Comparing version 1.0.0-beta-18 to 1.0.0-beta-19
{ | ||
"name": "alga-css", | ||
"version": "1.0.0-beta-18", | ||
"version": "1.0.0-beta-19", | ||
"description": "Alga CSS is a scope or component oriented CSS toolkit for quickly reuse CSS components and it can be stored in .alga format file as a custom CSS component and also it has many built-in customizable CSS properties that can be directly inserted to HTML Element class", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -10,3 +10,15 @@ const preset = require('../configs/preset.js') | ||
const refs = ref.value.split(' ').filter(i => i !== '') | ||
const refs = ref.value.split(' ').filter(i => i !== '').map(item => { | ||
if(item.startsWith('mx-')) { | ||
item = [item.replace('mx-', 'mr-'), item.replace('mx-', 'ml-')] | ||
} else if(item.startsWith('my-')) { | ||
item = [item.replace('my-', 'mt-'), item.replace('my-', 'mb-')] | ||
} else if(item.startsWith('px-')) { | ||
item = [item.replace('px-', 'pr-'), item.replace('px-', 'pl-')] | ||
} else if(item.startsWith('py-')) { | ||
item = [item.replace('py-', 'pt-'), item.replace('py-', 'pb-')] | ||
} | ||
return item | ||
}).flat() | ||
for(let rf of refs) { | ||
@@ -13,0 +25,0 @@ const props = rf.trim().split('-').filter(i => i !== '') |
@@ -24,4 +24,8 @@ const postcss = require('postcss') | ||
if(Object.keys(newState).includes(refs[0])) { | ||
const newRule = postcss.rule({ selector: '.'+ref.replaceAll(':', '\\:').replaceAll('.', '\\.').replaceAll(',', '\\,').replaceAll('/', '\\/').replaceAll('(', '\\(').replaceAll(')', '\\)')+''+opts.state[refs[0]].state, source: source }) | ||
if(['rtl', 'ltr', ...Object.keys(newState)].includes(refs[0])) { | ||
const newReplacedSelector = '.'+ref.replaceAll(':', '\\:').replaceAll('.', '\\.').replaceAll(',', '\\,').replaceAll('/', '\\/').replaceAll('(', '\\(').replaceAll(')', '\\)') | ||
let newRule = postcss.rule({ selector: newReplacedSelector+''+opts.state[refs[0]].state, source: source }) | ||
if(['rtl', 'ltr'].includes(refs[0])) { | ||
newRule = postcss.rule({ selector: `html[dir=${refs[0]}] `+newReplacedSelector, source: source }) | ||
} | ||
//const declVal = postcss.decl({ prop: camelDash(refs[1]), value: value(refs[2]) }) | ||
@@ -28,0 +32,0 @@ //newRule.append(declVal) |
Sorry, the diff of this file is not supported yet
260790
3723