New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

alga-css

Package Overview
Dependencies
Maintainers
1
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alga-css - npm Package Compare versions

Comparing version 1.0.0-stone-0 to 1.0.0-stone-1

alga/modal.alga

2

package.json
{
"name": "alga-css",
"version": "1.0.0-stone-0",
"version": "1.0.0-stone-1",
"description": "Alga CSS is a scope-first CSS toolkit for quickly mix or compose CSS references and share CSS properties between components",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -18,2 +18,3 @@ const postcss = require('postcss')

component[componentName]['modules'] = {}
component[componentName]['inits'] = []

@@ -96,4 +97,4 @@ const root = postcss.parse(data)

for(let dnode of rnode.nodes) {
if(dnode.type === 'decl' && dnode.prop === 'use') {
defineObj['header'] = Object.assign({}, defineObj['header'], component[componentName]['modules'][dnode.value.trim()])
if(dnode.type === 'atrule' && dnode.name === 'use') {
defineObj['header'] = Object.assign({}, defineObj['header'], component[componentName]['modules'][dnode.params.trim()])
} else if(dnode.type === 'atrule' && dnode.name === 'if') {

@@ -121,2 +122,12 @@ if('nodes' in dnode) {

component[componentName][param] = Object.assign({}, component[componentName][param], defineObj)
} else if(rnode.type === 'atrule' && rnode.name === 'use') {
component[componentName]['inits'].push(rnode)
} else if(rnode.type === 'atrule' && rnode.name === 'export') {
const param = rnode.params?.trim() || ''
const newParams = param.split(',').filter(i => i !== '')
for(let dnode of newParams) {
if(component[componentName]['modules'][dnode.trim()]) {
component[dnode.trim()] = component[componentName]['modules'][dnode.trim()]
}
}
}

@@ -123,0 +134,0 @@ }

const camelDash = require('../helpers/camelDash.js')
const values = require('../configs/values.js')
const units = require('../configs/units.js')
const specialValues = ['currentColor']

@@ -11,3 +12,5 @@ module.exports = (value) => {

}
newValue = camelDash(newValue)
if(!specialValues.includes(newValue)) {
newValue = camelDash(newValue)
}
if(/\d+/g.test(newValue)) {

@@ -14,0 +17,0 @@ const unitVals = []

@@ -14,2 +14,3 @@ // Configs

const config = {
inits: [],
preset: Object.assign({}, preset, options?.preset),

@@ -28,2 +29,19 @@ screen: Object.assign({}, screen, options?.screen),

if(options?.plugins && Number(options?.plugins.length) >= 1) {
const newPlugins = options?.plugins.map(item => {
return './node_modules/'+item+'/*.alga'
})
const newComponent = component(options?.plugins, opts)
config.components = Object.assign({}, config.components, newComponent)
for(let keyComponent of Object.keys(newComponent)) {
if(newComponent[keyComponent]['inits']) {
for(let init of newComponent[keyComponent]['inits']) {
if(!config.inits.map(i => i.params).includes(init.params)) {
config.inits.push(init)
}
}
}
}
}
return {

@@ -90,2 +108,57 @@ Once (root, {Rule, Declaration, AtRule}) {

}
for(let rule of config.inits) {
let param = rule.params.trim()
let name = param
if(param.includes('.')) {
const prms = param.split('.')
param = prms[0].trim()
name = prms[1].trim()
}
if(config.components[param]) {
let newNodes = []
if(rule?.nodes) {
for(let node of rule.nodes) {
config.components[param]['props'][node.prop] = node.value
}
}
const conditionDecls = []
for(let [condKey, condVal] of Object.entries(config.components[param][name]['condition'])) {
if(condKey.includes(' is ')) {
const splitKey = condKey.trim().split(/\@if\s|\sis\s/g).filter(i => i !== '')
if(config.components[param]['props'] && splitKey[0].trim() in config.components[param]['props'] && config.components[param]['props'][splitKey[0].trim()] === splitKey[1].trim()) {
conditionDecls.push([
...declaration(condVal, config.components[param]['props'], config.components[param]['provide'], {
screen: config.screen,
state: config.state,
prefers: config.prefers
})
])
}
} else if(condKey.includes(' has ')) {
const splitKey = condKey.trim().split(/\@if\s|\shas\s/g).filter(i => i !== '')
if(config.components[param]['props'] && splitKey[0].trim() in config.components[param]['props'] && config.components[param]['props'][splitKey[0].trim()].replaceAll(' ', '').split(',').filter(i => i !== '').includes(splitKey[1].trim())) {
conditionDecls.push([
...declaration(condVal, config.components[param]['props'], config.components[param]['provide'], {
screen: config.screen,
state: config.state,
prefers: config.prefers
})
])
}
}
}
newNodes = [
...newNodes,
...declaration(config.components[param][name]['body'], config.components[param]['props'], config.components[param]['provide'], {
screen: config.screen,
state: config.state,
prefers: config.prefers
}),
...conditionDecls.flat()
]
root.append(newNodes)
}
}
}

@@ -92,0 +165,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc