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-wood-7 to 1.0.0-wood-8

alga/card.alga

2

package.json
{
"name": "alga-css",
"version": "1.0.0-wood-7",
"version": "1.0.0-wood-8",
"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",

@@ -7,3 +7,2 @@ module.exports = {

m: 'margin',
p: 'padding',
mt: 'marginTop',

@@ -15,2 +14,9 @@ me: 'marginRight',

ml: 'marginLeft',
p: 'padding',
pt: 'paddingTop',
pe: 'paddingRight',
pr: 'paddingRight',
pb: 'paddingBottom',
ps: 'paddingLeft',
pl: 'paddingLeft',
bd: 'border',

@@ -17,0 +23,0 @@ bg: 'background',

@@ -8,15 +8,17 @@ const glob = require('glob')

const data = fs.readFileSync(rp, 'utf8')
let regexp, replaceData
let regexp, replaceData, classes
if(rp.endsWith('.vue')) {
regexp = /(v-bind:class|:class|class)="([\w]+|[\s\w]+|[\s\w\-_\.:\d\(\)]+)"/g
//regexp = /(v-bind:class|:class|class)="([\w]+|[\s\w]+|[\s\w\-_\.:\d\(\)]+)"/g
replaceData = data.replace(/\[|\]|',|,\s|'|\(|\)|\<|\>|\{|\}/ig, ' ').replace(/:\s/ig, '')
classes = replaceData.replace(/class="|"/g, '').split(' ').filter(i => i.includes('-'))
} else if(rp.endsWith('.svelte')) {
regexp = /class:([\w]+|[\s\w]+|[\s\w\-_.:\d\(\)]+)\s/g
replaceData = data.replace(/=|\>/ig, ' ')
classes = [...replaceData.matchAll(regexp)].flat().filter(i => i.indexOf('class') === -1)
} else { //.html, .astro, .edge, .blade.php, .twig
regexp = /(v-bind:class|x-bind:class|:class|class)="([\w]+|[\s\w]+|[\s\w\-_\.:\d\(\)]+)"/g
replaceData = data.replace(/\[|\]|',|,\s|'|\(|\)|\<|\>|\{|\}/ig, ' ').replace(/:\s/ig, '')
classes = [...replaceData.matchAll(regexp)].flat().filter(i => i.indexOf('class') === -1)
}
if(regexp !== undefined && replaceData !== undefined) {
const classes = [...replaceData.matchAll(regexp)].flat().filter(i => i.indexOf('class') === -1)
if(classes) {
const uniqClasses = Array.from(new Set(classes.map(i => i.split(' ')).flat())).filter(i => i !== '')

@@ -23,0 +25,0 @@ content.push(...uniqClasses)

const camelDash = require('../helpers/camelDash.js')
const values = require('../configs/values.js')
const units = require('../configs/units.js')
module.exports = (value) => {
let newValue = value.replaceAll('_', ' ')
const newUnits = [...units.length, ...units.angle, ...units.time, ...units.resolution]
if(Object.keys(values).includes(newValue.trim())) {

@@ -10,2 +12,20 @@ newValue = values[newValue.trim()]

newValue = camelDash(newValue)
if(/\d+/g.test(newValue)) {
const unitVals = []
for(let newVal of newValue.split(' ')) {
if(newVal.startsWith('n') && newUnits.includes(newVal.split(/\d+/g)[1])) {
unitVals.push(newVal.replace('n', '-'))
} else if(newVal.includes('/')) {
const splitValue = newVal.split('/')
if(isNaN(splitValue[0]) === false && isNaN(splitValue[1]) === false) {
unitVals.push(Number(((Number(splitValue[0]) / Number(splitValue[1])) * 100).toFixed(6)) + '%')
} else {
unitVals.push(newVal)
}
} else {
unitVals.push(newVal)
}
}
newValue = unitVals.join(' ')
}
if(newValue.includes('pct')) {

@@ -12,0 +32,0 @@ newValue = newValue.replaceAll('pct', '%')

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