@cryptic-css/core
Advanced tools
Comparing version 5.0.0-alpha.1 to 5.0.0-alpha.3
@@ -16,2 +16,4 @@ - new Map structure => performance | ||
- `ccssd` got removed => switch to function wrapper | ||
- `d` => `dp` | ||
- CLI removed | ||
@@ -23,5 +25,6 @@ babel-plugin: | ||
- default hashing: MurMur2 | ||
- ccss format | ||
- complete rewrite | ||
- strict mode | ||
- extracting dynamic values | ||
- Single constant resolve not supported anymore | ||
- add prepend/append |
@@ -6,2 +6,18 @@ # Change Log | ||
**Note:** Version bump only for package @cryptic-css/core | ||
# [3.19.0](https://github.com/wintercounter/ccss/compare/v3.18.0...v3.19.0) (2020-12-27) | ||
**Note:** Version bump only for package @cryptic-css/core | ||
# [3.18.0](https://github.com/wintercounter/ccss/compare/v3.17.0...v3.18.0) (2020-10-12) | ||
@@ -8,0 +24,0 @@ |
@@ -21,2 +21,3 @@ "use strict"; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _transformed[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -35,2 +36,3 @@ enumerable: true, | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _ccss[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -49,2 +51,3 @@ enumerable: true, | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _parsers[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -63,2 +66,3 @@ enumerable: true, | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _outputTransformers[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -77,2 +81,3 @@ enumerable: true, | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _types[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -79,0 +84,0 @@ enumerable: true, |
@@ -15,3 +15,7 @@ "use strict"; | ||
unit: typeof navigator != 'undefined' && navigator.product === 'ReactNative' ? 'px' : 'rem', | ||
applyUnit: n => "".concat(n).concat(options.unit) | ||
applyUnit(n) { | ||
return "".concat(n).concat(this.unit); | ||
} | ||
}; | ||
@@ -18,0 +22,0 @@ return options; |
@@ -38,3 +38,5 @@ "use strict"; | ||
var toCSSRule = (input, prop, transformedFn, inputObject, definition) => { | ||
var cssProp = definition ? definition.keys[definition.keys.length - 1] : prop; | ||
var cssProp = definition ? definition.keys[definition.keys.length - 1] : prop; // We only need value | ||
if (!inputObject) return input; | ||
return transformedFn.outputTransformer.toCSSRule(cssProp, input, prop, transformedFn); | ||
@@ -61,8 +63,4 @@ }; | ||
var definition = transformedFn.registry.get(k); | ||
if (definition) { | ||
generated = transformedFn.outputTransformer(generated, definition.fn(input[k], k, transformedFn, inputObject, definition)); | ||
} else { | ||
generated = transformedFn.outputTransformer(generated, transformedFn.outputTransformer.toChild(input[k], k, transformedFn, inputObject, definition)); | ||
} | ||
var isPseudo = k[0] === ':'; | ||
generated = transformedFn.outputTransformer(generated, transformedFn.outputTransformer.toChild(input[k], k, transformedFn, inputObject, isPseudo ? definition : undefined)); | ||
} | ||
@@ -69,0 +67,0 @@ } |
@@ -63,5 +63,8 @@ "use strict"; | ||
var nil = null; | ||
var htmlAttr = { | ||
htmlAttr: true | ||
}; | ||
var defaultProps = () => [// SVG presentational attributes | ||
[['ab', 'alignment-baseline'], nil, toCSSRuleHandler], [['bls', 'baseline-shift'], nil, toCSSRuleHandler], [['cpr', 'clip-rule'], nil, toCSSRuleHandler], [['cif', 'color-interpolation-filters'], nil, toCSSRuleHandler], [['ci', 'color-interpolation'], nil, toCSSRuleHandler], [['cpf', 'color-profile'], nil, toCSSRuleHandler], [['crd', 'color-rendering'], nil, toCSSRuleHandler], [['db', 'dominant-baseline'], nil, toCSSRuleHandler], [['eb', 'enable-background'], nil, toCSSRuleHandler], [['fo', 'fill-opacity'], nil, toCSSRuleHandler], [['fr', 'fill-rule'], nil, toCSSRuleHandler], [['fi', 'fill'], nil, toCSSRuleHandler], [['fdc', 'flood-color'], nil, toCSSRuleHandler], [['fdo', 'flood-opacity'], nil, toCSSRuleHandler], [['fsa', 'font-size-adjust'], nil, toCSSRuleHandler], [['goh', 'glyph-orientation-horizontal'], nil, toCSSRuleHandler], [['ir', 'image-rendering'], nil, toCSSRuleHandler], [['k', 'kerning'], nil, toCSSRuleHandler], [['lc', 'lighting-color'], nil, toCSSRuleHandler], [['me', 'marker-end'], nil, toCSSRuleHandler], [['mm', 'marker-mid'], nil, toCSSRuleHandler], [['ms', 'marker-start'], nil, toCSSRuleHandler], [['msk', 'mask'], nil, toCSSRuleHandler], [['sr', 'shape-rendering'], nil, toCSSRuleHandler], [['sc', 'stop-color'], nil, toCSSRuleHandler], [['sda', 'stroke-dasharray'], nil, toCSSRuleHandler], [['sdo', 'stroke-dashoffset'], nil, toCSSRuleHandler], [['slc', 'stroke-linecap'], nil, toCSSRuleHandler], [['slj', 'stroke-linejoin'], nil, toCSSRuleHandler], [['sml', 'stroke-miterlimit'], nil, toCSSRuleHandler], [['sop', 'stroke-opacity'], nil, toCSSRuleHandler], [['swt', 'stroke-width'], nil, toCSSRuleHandler], [['st', 'stroke'], nil, toCSSRuleHandler], [['txa', 'text-anchor'], nil, toCSSRuleHandler], [['txr', 'text-rendering'], nil, toCSSRuleHandler], [['ub', 'unicode-bidi'], nil, toCSSRuleHandler], [['wm', 'writing-mode'], nil, toCSSRuleHandler], // Animation + 3D | ||
[['ab', 'alignment-baseline'], nil, toCSSRuleHandler, htmlAttr], [['bls', 'baseline-shift'], nil, toCSSRuleHandler, htmlAttr], [['cpr', 'clip-rule'], nil, toCSSRuleHandler, htmlAttr], [['cif', 'color-interpolation-filters'], nil, toCSSRuleHandler, htmlAttr], [['ci', 'color-interpolation'], nil, toCSSRuleHandler, htmlAttr], [['cpf', 'color-profile'], nil, toCSSRuleHandler, htmlAttr], [['crd', 'color-rendering'], nil, toCSSRuleHandler, htmlAttr], [['db', 'dominant-baseline'], nil, toCSSRuleHandler, htmlAttr], [['d'], nil, toCSSRuleHandler, htmlAttr], [['eb', 'enable-background'], nil, toCSSRuleHandler, htmlAttr], [['fo', 'fill-opacity'], nil, toCSSRuleHandler, htmlAttr], [['fr', 'fill-rule'], nil, toCSSRuleHandler, htmlAttr], [['fi', 'fill'], nil, toCSSRuleHandler, htmlAttr], [['fdc', 'flood-color'], nil, toCSSRuleHandler, htmlAttr], [['fdo', 'flood-opacity'], nil, toCSSRuleHandler, htmlAttr], [['fsa', 'font-size-adjust'], nil, toCSSRuleHandler, htmlAttr], [['goh', 'glyph-orientation-horizontal'], nil, toCSSRuleHandler, htmlAttr], [['ir', 'image-rendering'], nil, toCSSRuleHandler, htmlAttr], [['k', 'kerning'], nil, toCSSRuleHandler, htmlAttr], [['lc', 'lighting-color'], nil, toCSSRuleHandler, htmlAttr], [['me', 'marker-end'], nil, toCSSRuleHandler, htmlAttr], [['mm', 'marker-mid'], nil, toCSSRuleHandler, htmlAttr], [['ms', 'marker-start'], nil, toCSSRuleHandler, htmlAttr], [['msk', 'mask'], nil, toCSSRuleHandler, htmlAttr], [['sr', 'shape-rendering'], nil, toCSSRuleHandler, htmlAttr], [['sc', 'stop-color'], nil, toCSSRuleHandler, htmlAttr], [['sda', 'stroke-dasharray'], nil, toCSSRuleHandler, htmlAttr], [['sdo', 'stroke-dashoffset'], nil, toCSSRuleHandler, htmlAttr], [['slc', 'stroke-linecap'], nil, toCSSRuleHandler, htmlAttr], [['slj', 'stroke-linejoin'], nil, toCSSRuleHandler, htmlAttr], [['sml', 'stroke-miterlimit'], nil, toCSSRuleHandler, htmlAttr], [['sop', 'stroke-opacity'], nil, toCSSRuleHandler, htmlAttr], [['swt', 'stroke-width'], nil, toCSSRuleHandler, htmlAttr], [['st', 'stroke'], nil, toCSSRuleHandler, htmlAttr], [['txa', 'text-anchor'], nil, toCSSRuleHandler, htmlAttr], [['txr', 'text-rendering'], nil, toCSSRuleHandler, htmlAttr], [['ub', 'unicode-bidi'], nil, toCSSRuleHandler, htmlAttr], [['wm', 'writing-mode'], nil, toCSSRuleHandler, htmlAttr], // Animation + 3D | ||
[['a', 'animation'], nil, toCSSRuleHandler], [['ad', 'animation-delay'], nil, toCSSRuleHandler], [['aDir', 'animation-direction'], { | ||
@@ -113,7 +116,16 @@ n: 'normal', | ||
l: 'lighter' | ||
}, toCSSRuleHandler], [['ls', 'letter-spacing'], nil, fromArrayToCSSRuleHandler], [['lh', 'line-height'], nil, toCSSRuleHandler], [['ta', 'text-align'], _objectSpread(_objectSpread({}, getFalseNone()), {}, { | ||
}, toCSSRuleHandler], [['ls', 'letter-spacing'], nil, fromArrayToCSSRuleHandler], [['lh', 'line-height'], nil, toCSSRuleHandler], [['ta', 'text-align'], { | ||
l: 'left', | ||
r: 'right', | ||
c: 'center', | ||
e: 'end', | ||
j: 'justify', | ||
re: 'revert', | ||
s: 'start', | ||
u: 'unset' | ||
}, toCSSRuleHandler], [['td', 'text-decoration'], _objectSpread(_objectSpread({}, getFalseNone()), {}, { | ||
u: 'underline', | ||
o: 'overline', | ||
t: 'line-through' | ||
}), toCSSRuleHandler], [['td', 'text-decoration'], nil, toCSSRuleHandler], [['ti', 'text-indent'], nil, fromArrayToCSSRuleHandler], [['to', 'text-overflow'], { | ||
}), toCSSRuleHandler], [['ti', 'text-indent'], nil, fromArrayToCSSRuleHandler], [['to', 'text-overflow'], { | ||
c: 'clip', | ||
@@ -151,3 +163,3 @@ e: 'ellipsis' | ||
[['m', 'margin'], nil, fromArrayToCSSRuleHandler], [['mT', 'margin-top'], nil, fromArrayToCSSRuleHandler], [['mR', 'margin-right'], nil, fromArrayToCSSRuleHandler], [['mB', 'margin-bottom'], nil, fromArrayToCSSRuleHandler], [['mL', 'margin-left'], nil, fromArrayToCSSRuleHandler], // Padding | ||
[['p', 'pad', 'padding'], nil, fromArrayToCSSRuleHandler], [['pT', 'padding-top'], nil, fromArrayToCSSRuleHandler], [['pR', 'padding-right'], nil, fromArrayToCSSRuleHandler], [['pB', 'padding-bottom'], nil, fromArrayToCSSRuleHandler], [['pL', 'padding-left'], nil, fromArrayToCSSRuleHandler], // Background | ||
[['p', 'pad', 'padding'], nil, fromArrayToCSSRuleHandler], [['pT', 'pad-top', 'padding-top'], nil, fromArrayToCSSRuleHandler], [['pR', 'pad-right', 'padding-right'], nil, fromArrayToCSSRuleHandler], [['pB', 'pad-bottom', 'padding-bottom'], nil, fromArrayToCSSRuleHandler], [['pL', 'pad-left', 'padding-left'], nil, fromArrayToCSSRuleHandler], // Background | ||
[['bg', 'background'], { | ||
@@ -198,3 +210,3 @@ t: 'transparent', | ||
[['clp', 'clip'], nil, fromArrayToCSSRuleHandler], [['clpp', 'clip-path'], nil, toCSSRuleHandler], // General | ||
[['d', 'display'], _objectSpread(_objectSpread({}, getFalseNone()), {}, { | ||
[['dp', 'display'], _objectSpread(_objectSpread({}, getFalseNone()), {}, { | ||
i: 'inline', | ||
@@ -317,3 +329,3 @@ if: 'inline-flex', | ||
all: 'all' | ||
}], [['cac', 'caret-color'], nil, toCSSRuleHandler], [['rs', 'resize'], nil, toCSSRuleHandler], [['raw'], nil, [i => i]], [['child'], nil, [_parsers.child]], // Webkit | ||
}, toCSSRuleHandler], [['cac', 'caret-color'], nil, toCSSRuleHandler], [['rs', 'resize'], nil, toCSSRuleHandler], [['raw'], nil, [i => i]], [['child'], nil, [_parsers.child]], // Webkit | ||
[['wtc', 'webkit-touch-callout', '-webkit-touch-callout'], { | ||
@@ -320,0 +332,0 @@ d: 'default', |
@@ -8,3 +8,7 @@ const defaultOptions = () => { | ||
unit: typeof navigator != 'undefined' && navigator.product === 'ReactNative' ? 'px' : 'rem', | ||
applyUnit: n => `${n}${options.unit}` | ||
applyUnit(n) { | ||
return `${n}${this.unit}`; | ||
} | ||
}; | ||
@@ -11,0 +15,0 @@ return options; |
@@ -26,3 +26,5 @@ export const parseSingle = (input, prop, transformedFn) => typeof input === 'number' ? input === 0 ? 0 : transformedFn.options.applyUnit(input) : input; | ||
export const toCSSRule = (input, prop, transformedFn, inputObject, definition) => { | ||
const cssProp = definition ? definition.keys[definition.keys.length - 1] : prop; | ||
const cssProp = definition ? definition.keys[definition.keys.length - 1] : prop; // We only need value | ||
if (!inputObject) return input; | ||
return transformedFn.outputTransformer.toCSSRule(cssProp, input, prop, transformedFn); | ||
@@ -40,8 +42,4 @@ }; | ||
const definition = transformedFn.registry.get(k); | ||
if (definition) { | ||
generated = transformedFn.outputTransformer(generated, definition.fn(input[k], k, transformedFn, inputObject, definition)); | ||
} else { | ||
generated = transformedFn.outputTransformer(generated, transformedFn.outputTransformer.toChild(input[k], k, transformedFn, inputObject, definition)); | ||
} | ||
const isPseudo = k[0] === ':'; | ||
generated = transformedFn.outputTransformer(generated, transformedFn.outputTransformer.toChild(input[k], k, transformedFn, inputObject, isPseudo ? definition : undefined)); | ||
} | ||
@@ -48,0 +46,0 @@ } |
@@ -56,5 +56,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
const nil = null; | ||
const htmlAttr = { | ||
htmlAttr: true | ||
}; | ||
const defaultProps = () => [// SVG presentational attributes | ||
[['ab', 'alignment-baseline'], nil, toCSSRuleHandler], [['bls', 'baseline-shift'], nil, toCSSRuleHandler], [['cpr', 'clip-rule'], nil, toCSSRuleHandler], [['cif', 'color-interpolation-filters'], nil, toCSSRuleHandler], [['ci', 'color-interpolation'], nil, toCSSRuleHandler], [['cpf', 'color-profile'], nil, toCSSRuleHandler], [['crd', 'color-rendering'], nil, toCSSRuleHandler], [['db', 'dominant-baseline'], nil, toCSSRuleHandler], [['eb', 'enable-background'], nil, toCSSRuleHandler], [['fo', 'fill-opacity'], nil, toCSSRuleHandler], [['fr', 'fill-rule'], nil, toCSSRuleHandler], [['fi', 'fill'], nil, toCSSRuleHandler], [['fdc', 'flood-color'], nil, toCSSRuleHandler], [['fdo', 'flood-opacity'], nil, toCSSRuleHandler], [['fsa', 'font-size-adjust'], nil, toCSSRuleHandler], [['goh', 'glyph-orientation-horizontal'], nil, toCSSRuleHandler], [['ir', 'image-rendering'], nil, toCSSRuleHandler], [['k', 'kerning'], nil, toCSSRuleHandler], [['lc', 'lighting-color'], nil, toCSSRuleHandler], [['me', 'marker-end'], nil, toCSSRuleHandler], [['mm', 'marker-mid'], nil, toCSSRuleHandler], [['ms', 'marker-start'], nil, toCSSRuleHandler], [['msk', 'mask'], nil, toCSSRuleHandler], [['sr', 'shape-rendering'], nil, toCSSRuleHandler], [['sc', 'stop-color'], nil, toCSSRuleHandler], [['sda', 'stroke-dasharray'], nil, toCSSRuleHandler], [['sdo', 'stroke-dashoffset'], nil, toCSSRuleHandler], [['slc', 'stroke-linecap'], nil, toCSSRuleHandler], [['slj', 'stroke-linejoin'], nil, toCSSRuleHandler], [['sml', 'stroke-miterlimit'], nil, toCSSRuleHandler], [['sop', 'stroke-opacity'], nil, toCSSRuleHandler], [['swt', 'stroke-width'], nil, toCSSRuleHandler], [['st', 'stroke'], nil, toCSSRuleHandler], [['txa', 'text-anchor'], nil, toCSSRuleHandler], [['txr', 'text-rendering'], nil, toCSSRuleHandler], [['ub', 'unicode-bidi'], nil, toCSSRuleHandler], [['wm', 'writing-mode'], nil, toCSSRuleHandler], // Animation + 3D | ||
[['ab', 'alignment-baseline'], nil, toCSSRuleHandler, htmlAttr], [['bls', 'baseline-shift'], nil, toCSSRuleHandler, htmlAttr], [['cpr', 'clip-rule'], nil, toCSSRuleHandler, htmlAttr], [['cif', 'color-interpolation-filters'], nil, toCSSRuleHandler, htmlAttr], [['ci', 'color-interpolation'], nil, toCSSRuleHandler, htmlAttr], [['cpf', 'color-profile'], nil, toCSSRuleHandler, htmlAttr], [['crd', 'color-rendering'], nil, toCSSRuleHandler, htmlAttr], [['db', 'dominant-baseline'], nil, toCSSRuleHandler, htmlAttr], [['d'], nil, toCSSRuleHandler, htmlAttr], [['eb', 'enable-background'], nil, toCSSRuleHandler, htmlAttr], [['fo', 'fill-opacity'], nil, toCSSRuleHandler, htmlAttr], [['fr', 'fill-rule'], nil, toCSSRuleHandler, htmlAttr], [['fi', 'fill'], nil, toCSSRuleHandler, htmlAttr], [['fdc', 'flood-color'], nil, toCSSRuleHandler, htmlAttr], [['fdo', 'flood-opacity'], nil, toCSSRuleHandler, htmlAttr], [['fsa', 'font-size-adjust'], nil, toCSSRuleHandler, htmlAttr], [['goh', 'glyph-orientation-horizontal'], nil, toCSSRuleHandler, htmlAttr], [['ir', 'image-rendering'], nil, toCSSRuleHandler, htmlAttr], [['k', 'kerning'], nil, toCSSRuleHandler, htmlAttr], [['lc', 'lighting-color'], nil, toCSSRuleHandler, htmlAttr], [['me', 'marker-end'], nil, toCSSRuleHandler, htmlAttr], [['mm', 'marker-mid'], nil, toCSSRuleHandler, htmlAttr], [['ms', 'marker-start'], nil, toCSSRuleHandler, htmlAttr], [['msk', 'mask'], nil, toCSSRuleHandler, htmlAttr], [['sr', 'shape-rendering'], nil, toCSSRuleHandler, htmlAttr], [['sc', 'stop-color'], nil, toCSSRuleHandler, htmlAttr], [['sda', 'stroke-dasharray'], nil, toCSSRuleHandler, htmlAttr], [['sdo', 'stroke-dashoffset'], nil, toCSSRuleHandler, htmlAttr], [['slc', 'stroke-linecap'], nil, toCSSRuleHandler, htmlAttr], [['slj', 'stroke-linejoin'], nil, toCSSRuleHandler, htmlAttr], [['sml', 'stroke-miterlimit'], nil, toCSSRuleHandler, htmlAttr], [['sop', 'stroke-opacity'], nil, toCSSRuleHandler, htmlAttr], [['swt', 'stroke-width'], nil, toCSSRuleHandler, htmlAttr], [['st', 'stroke'], nil, toCSSRuleHandler, htmlAttr], [['txa', 'text-anchor'], nil, toCSSRuleHandler, htmlAttr], [['txr', 'text-rendering'], nil, toCSSRuleHandler, htmlAttr], [['ub', 'unicode-bidi'], nil, toCSSRuleHandler, htmlAttr], [['wm', 'writing-mode'], nil, toCSSRuleHandler, htmlAttr], // Animation + 3D | ||
[['a', 'animation'], nil, toCSSRuleHandler], [['ad', 'animation-delay'], nil, toCSSRuleHandler], [['aDir', 'animation-direction'], { | ||
@@ -106,7 +109,16 @@ n: 'normal', | ||
l: 'lighter' | ||
}, toCSSRuleHandler], [['ls', 'letter-spacing'], nil, fromArrayToCSSRuleHandler], [['lh', 'line-height'], nil, toCSSRuleHandler], [['ta', 'text-align'], _objectSpread(_objectSpread({}, getFalseNone()), {}, { | ||
}, toCSSRuleHandler], [['ls', 'letter-spacing'], nil, fromArrayToCSSRuleHandler], [['lh', 'line-height'], nil, toCSSRuleHandler], [['ta', 'text-align'], { | ||
l: 'left', | ||
r: 'right', | ||
c: 'center', | ||
e: 'end', | ||
j: 'justify', | ||
re: 'revert', | ||
s: 'start', | ||
u: 'unset' | ||
}, toCSSRuleHandler], [['td', 'text-decoration'], _objectSpread(_objectSpread({}, getFalseNone()), {}, { | ||
u: 'underline', | ||
o: 'overline', | ||
t: 'line-through' | ||
}), toCSSRuleHandler], [['td', 'text-decoration'], nil, toCSSRuleHandler], [['ti', 'text-indent'], nil, fromArrayToCSSRuleHandler], [['to', 'text-overflow'], { | ||
}), toCSSRuleHandler], [['ti', 'text-indent'], nil, fromArrayToCSSRuleHandler], [['to', 'text-overflow'], { | ||
c: 'clip', | ||
@@ -144,3 +156,3 @@ e: 'ellipsis' | ||
[['m', 'margin'], nil, fromArrayToCSSRuleHandler], [['mT', 'margin-top'], nil, fromArrayToCSSRuleHandler], [['mR', 'margin-right'], nil, fromArrayToCSSRuleHandler], [['mB', 'margin-bottom'], nil, fromArrayToCSSRuleHandler], [['mL', 'margin-left'], nil, fromArrayToCSSRuleHandler], // Padding | ||
[['p', 'pad', 'padding'], nil, fromArrayToCSSRuleHandler], [['pT', 'padding-top'], nil, fromArrayToCSSRuleHandler], [['pR', 'padding-right'], nil, fromArrayToCSSRuleHandler], [['pB', 'padding-bottom'], nil, fromArrayToCSSRuleHandler], [['pL', 'padding-left'], nil, fromArrayToCSSRuleHandler], // Background | ||
[['p', 'pad', 'padding'], nil, fromArrayToCSSRuleHandler], [['pT', 'pad-top', 'padding-top'], nil, fromArrayToCSSRuleHandler], [['pR', 'pad-right', 'padding-right'], nil, fromArrayToCSSRuleHandler], [['pB', 'pad-bottom', 'padding-bottom'], nil, fromArrayToCSSRuleHandler], [['pL', 'pad-left', 'padding-left'], nil, fromArrayToCSSRuleHandler], // Background | ||
[['bg', 'background'], { | ||
@@ -191,3 +203,3 @@ t: 'transparent', | ||
[['clp', 'clip'], nil, fromArrayToCSSRuleHandler], [['clpp', 'clip-path'], nil, toCSSRuleHandler], // General | ||
[['d', 'display'], _objectSpread(_objectSpread({}, getFalseNone()), {}, { | ||
[['dp', 'display'], _objectSpread(_objectSpread({}, getFalseNone()), {}, { | ||
i: 'inline', | ||
@@ -310,3 +322,3 @@ if: 'inline-flex', | ||
all: 'all' | ||
}], [['cac', 'caret-color'], nil, toCSSRuleHandler], [['rs', 'resize'], nil, toCSSRuleHandler], [['raw'], nil, [i => i]], [['child'], nil, [child]], // Webkit | ||
}, toCSSRuleHandler], [['cac', 'caret-color'], nil, toCSSRuleHandler], [['rs', 'resize'], nil, toCSSRuleHandler], [['raw'], nil, [i => i]], [['child'], nil, [child]], // Webkit | ||
[['wtc', 'webkit-touch-callout', '-webkit-touch-callout'], { | ||
@@ -313,0 +325,0 @@ d: 'default', |
{ | ||
"name": "@cryptic-css/core", | ||
"version": "5.0.0-alpha.1", | ||
"version": "5.0.0-alpha.3", | ||
"description": "> TODO: description", | ||
@@ -14,5 +14,2 @@ "author": "Viktor Vincze <viktor.vincze@doclerholding.com>", | ||
}, | ||
"bin": { | ||
"ccss": "./dist/cjs/cli.js" | ||
}, | ||
"scripts": { | ||
@@ -22,4 +19,3 @@ "test": "mhy tsc && mhy jest", | ||
"jest:watch": "mhy jest --watchAll", | ||
"build": "npm run gen:props && npm run build:pure && npm run prop-doc:prod", | ||
"build:pure": "mhy tsc && mhy bb --mhy-env=prod && mhy bb --mhy-env=prod:cjs", | ||
"build": "mhy tsc && mhy bb --mhy-env=prod && mhy bb --mhy-env=prod:cjs", | ||
"build:watch": "mhy bb --watch", | ||
@@ -89,4 +85,4 @@ "config": "mhy config typescript -io", | ||
"csstype": "^3.0.3", | ||
"transformed": "0.0.6" | ||
"transformed": "^1.0.0" | ||
} | ||
} |
@@ -10,3 +10,5 @@ import { Options } from 'transformed' | ||
unit: typeof navigator != 'undefined' && navigator.product === 'ReactNative' ? 'px' : 'rem', | ||
applyUnit: (n) => `${n}${options.unit}` | ||
applyUnit(n) { | ||
return `${n}${this.unit}` | ||
} | ||
} | ||
@@ -13,0 +15,0 @@ return options |
@@ -27,2 +27,4 @@ import { CCSSParser } from '@/types' | ||
const cssProp = definition ? definition.keys[definition.keys.length - 1] : prop | ||
// We only need value | ||
if (!inputObject) return input | ||
return transformedFn.outputTransformer.toCSSRule(cssProp, input, prop, transformedFn) | ||
@@ -43,13 +45,13 @@ } | ||
const definition = transformedFn.registry.get(k) | ||
if (definition) { | ||
generated = transformedFn.outputTransformer( | ||
generated, | ||
definition.fn(input[k], k, transformedFn, inputObject, definition) | ||
const isPseudo = k[0] === ':' | ||
generated = transformedFn.outputTransformer( | ||
generated, | ||
transformedFn.outputTransformer.toChild( | ||
input[k], | ||
k, | ||
transformedFn, | ||
inputObject, | ||
isPseudo ? definition : undefined | ||
) | ||
} else { | ||
generated = transformedFn.outputTransformer( | ||
generated, | ||
transformedFn.outputTransformer.toChild(input[k], k, transformedFn, inputObject, definition) | ||
) | ||
} | ||
) | ||
} | ||
@@ -56,0 +58,0 @@ } |
105
src/props.ts
@@ -51,42 +51,44 @@ import { Props } from 'transformed' | ||
const nil = null | ||
const htmlAttr = { htmlAttr: true } | ||
const defaultProps = (): Props => [ | ||
// SVG presentational attributes | ||
[['ab', 'alignment-baseline'], nil, toCSSRuleHandler], | ||
[['bls', 'baseline-shift'], nil, toCSSRuleHandler], | ||
[['cpr', 'clip-rule'], nil, toCSSRuleHandler], | ||
[['cif', 'color-interpolation-filters'], nil, toCSSRuleHandler], | ||
[['ci', 'color-interpolation'], nil, toCSSRuleHandler], | ||
[['cpf', 'color-profile'], nil, toCSSRuleHandler], | ||
[['crd', 'color-rendering'], nil, toCSSRuleHandler], | ||
[['db', 'dominant-baseline'], nil, toCSSRuleHandler], | ||
[['eb', 'enable-background'], nil, toCSSRuleHandler], | ||
[['fo', 'fill-opacity'], nil, toCSSRuleHandler], | ||
[['fr', 'fill-rule'], nil, toCSSRuleHandler], | ||
[['fi', 'fill'], nil, toCSSRuleHandler], | ||
[['fdc', 'flood-color'], nil, toCSSRuleHandler], | ||
[['fdo', 'flood-opacity'], nil, toCSSRuleHandler], | ||
[['fsa', 'font-size-adjust'], nil, toCSSRuleHandler], | ||
[['goh', 'glyph-orientation-horizontal'], nil, toCSSRuleHandler], | ||
[['ir', 'image-rendering'], nil, toCSSRuleHandler], | ||
[['k', 'kerning'], nil, toCSSRuleHandler], | ||
[['lc', 'lighting-color'], nil, toCSSRuleHandler], | ||
[['me', 'marker-end'], nil, toCSSRuleHandler], | ||
[['mm', 'marker-mid'], nil, toCSSRuleHandler], | ||
[['ms', 'marker-start'], nil, toCSSRuleHandler], | ||
[['msk', 'mask'], nil, toCSSRuleHandler], | ||
[['sr', 'shape-rendering'], nil, toCSSRuleHandler], | ||
[['sc', 'stop-color'], nil, toCSSRuleHandler], | ||
[['sda', 'stroke-dasharray'], nil, toCSSRuleHandler], | ||
[['sdo', 'stroke-dashoffset'], nil, toCSSRuleHandler], | ||
[['slc', 'stroke-linecap'], nil, toCSSRuleHandler], | ||
[['slj', 'stroke-linejoin'], nil, toCSSRuleHandler], | ||
[['sml', 'stroke-miterlimit'], nil, toCSSRuleHandler], | ||
[['sop', 'stroke-opacity'], nil, toCSSRuleHandler], | ||
[['swt', 'stroke-width'], nil, toCSSRuleHandler], | ||
[['st', 'stroke'], nil, toCSSRuleHandler], | ||
[['txa', 'text-anchor'], nil, toCSSRuleHandler], | ||
[['txr', 'text-rendering'], nil, toCSSRuleHandler], | ||
[['ub', 'unicode-bidi'], nil, toCSSRuleHandler], | ||
[['wm', 'writing-mode'], nil, toCSSRuleHandler], | ||
[['ab', 'alignment-baseline'], nil, toCSSRuleHandler, htmlAttr], | ||
[['bls', 'baseline-shift'], nil, toCSSRuleHandler, htmlAttr], | ||
[['cpr', 'clip-rule'], nil, toCSSRuleHandler, htmlAttr], | ||
[['cif', 'color-interpolation-filters'], nil, toCSSRuleHandler, htmlAttr], | ||
[['ci', 'color-interpolation'], nil, toCSSRuleHandler, htmlAttr], | ||
[['cpf', 'color-profile'], nil, toCSSRuleHandler, htmlAttr], | ||
[['crd', 'color-rendering'], nil, toCSSRuleHandler, htmlAttr], | ||
[['db', 'dominant-baseline'], nil, toCSSRuleHandler, htmlAttr], | ||
[['d'], nil, toCSSRuleHandler, htmlAttr], | ||
[['eb', 'enable-background'], nil, toCSSRuleHandler, htmlAttr], | ||
[['fo', 'fill-opacity'], nil, toCSSRuleHandler, htmlAttr], | ||
[['fr', 'fill-rule'], nil, toCSSRuleHandler, htmlAttr], | ||
[['fi', 'fill'], nil, toCSSRuleHandler, htmlAttr], | ||
[['fdc', 'flood-color'], nil, toCSSRuleHandler, htmlAttr], | ||
[['fdo', 'flood-opacity'], nil, toCSSRuleHandler, htmlAttr], | ||
[['fsa', 'font-size-adjust'], nil, toCSSRuleHandler, htmlAttr], | ||
[['goh', 'glyph-orientation-horizontal'], nil, toCSSRuleHandler, htmlAttr], | ||
[['ir', 'image-rendering'], nil, toCSSRuleHandler, htmlAttr], | ||
[['k', 'kerning'], nil, toCSSRuleHandler, htmlAttr], | ||
[['lc', 'lighting-color'], nil, toCSSRuleHandler, htmlAttr], | ||
[['me', 'marker-end'], nil, toCSSRuleHandler, htmlAttr], | ||
[['mm', 'marker-mid'], nil, toCSSRuleHandler, htmlAttr], | ||
[['ms', 'marker-start'], nil, toCSSRuleHandler, htmlAttr], | ||
[['msk', 'mask'], nil, toCSSRuleHandler, htmlAttr], | ||
[['sr', 'shape-rendering'], nil, toCSSRuleHandler, htmlAttr], | ||
[['sc', 'stop-color'], nil, toCSSRuleHandler, htmlAttr], | ||
[['sda', 'stroke-dasharray'], nil, toCSSRuleHandler, htmlAttr], | ||
[['sdo', 'stroke-dashoffset'], nil, toCSSRuleHandler, htmlAttr], | ||
[['slc', 'stroke-linecap'], nil, toCSSRuleHandler, htmlAttr], | ||
[['slj', 'stroke-linejoin'], nil, toCSSRuleHandler, htmlAttr], | ||
[['sml', 'stroke-miterlimit'], nil, toCSSRuleHandler, htmlAttr], | ||
[['sop', 'stroke-opacity'], nil, toCSSRuleHandler, htmlAttr], | ||
[['swt', 'stroke-width'], nil, toCSSRuleHandler, htmlAttr], | ||
[['st', 'stroke'], nil, toCSSRuleHandler, htmlAttr], | ||
[['txa', 'text-anchor'], nil, toCSSRuleHandler, htmlAttr], | ||
[['txr', 'text-rendering'], nil, toCSSRuleHandler, htmlAttr], | ||
[['ub', 'unicode-bidi'], nil, toCSSRuleHandler, htmlAttr], | ||
[['wm', 'writing-mode'], nil, toCSSRuleHandler, htmlAttr], | ||
@@ -222,6 +224,19 @@ // Animation + 3D | ||
[['lh', 'line-height'], nil, toCSSRuleHandler], | ||
[ | ||
['ta', 'text-align'], | ||
{ | ||
l: 'left', | ||
r: 'right', | ||
c: 'center', | ||
e: 'end', | ||
j: 'justify', | ||
re: 'revert', | ||
s: 'start', | ||
u: 'unset' | ||
}, | ||
toCSSRuleHandler | ||
], | ||
[ | ||
['td', 'text-decoration'], | ||
{ | ||
...getFalseNone(), | ||
@@ -234,3 +249,2 @@ u: 'underline', | ||
], | ||
[['td', 'text-decoration'], nil, toCSSRuleHandler], | ||
[['ti', 'text-indent'], nil, fromArrayToCSSRuleHandler], | ||
@@ -322,6 +336,6 @@ [ | ||
[['p', 'pad', 'padding'], nil, fromArrayToCSSRuleHandler], | ||
[['pT', 'padding-top'], nil, fromArrayToCSSRuleHandler], | ||
[['pR', 'padding-right'], nil, fromArrayToCSSRuleHandler], | ||
[['pB', 'padding-bottom'], nil, fromArrayToCSSRuleHandler], | ||
[['pL', 'padding-left'], nil, fromArrayToCSSRuleHandler], | ||
[['pT', 'pad-top', 'padding-top'], nil, fromArrayToCSSRuleHandler], | ||
[['pR', 'pad-right', 'padding-right'], nil, fromArrayToCSSRuleHandler], | ||
[['pB', 'pad-bottom', 'padding-bottom'], nil, fromArrayToCSSRuleHandler], | ||
[['pL', 'pad-left', 'padding-left'], nil, fromArrayToCSSRuleHandler], | ||
@@ -478,3 +492,3 @@ // Background | ||
[ | ||
['d', 'display'], | ||
['dp', 'display'], | ||
{ | ||
@@ -712,3 +726,4 @@ ...getFalseNone(), | ||
all: 'all' | ||
} | ||
}, | ||
toCSSRuleHandler | ||
], | ||
@@ -715,0 +730,0 @@ [['cac', 'caret-color'], nil, toCSSRuleHandler], |
@@ -14,3 +14,3 @@ { | ||
"declaration": true, | ||
"baseUrl": "X:\\GITHUB\\ccss\\packages\\core\\src", | ||
"baseUrl": "X:\\GITHUB\\ccss\\packages\\cryptic-css\\core\\src", | ||
"skipLibCheck": true, | ||
@@ -21,10 +21,10 @@ "incremental": true, | ||
"*": [ | ||
"X:\\GITHUB\\ccss\\packages\\core\\node_modules\\*", | ||
"X:\\GITHUB\\ccss\\packages\\cryptic-css\\core\\node_modules\\*", | ||
"C:\\Users\\Winter\\AppData\\Roaming\\npm\\node_modules\\mhy\\node_modules\\*" | ||
], | ||
"@": [ | ||
"X:\\GITHUB\\ccss\\packages\\core\\src\\index" | ||
"X:\\GITHUB\\ccss\\packages\\cryptic-css\\core\\src\\index" | ||
], | ||
"@/*": [ | ||
"X:\\GITHUB\\ccss\\packages\\core\\src\\*" | ||
"X:\\GITHUB\\ccss\\packages\\cryptic-css\\core\\src\\*" | ||
], | ||
@@ -42,2 +42,8 @@ "@/mhy": [ | ||
"C:\\Users\\Winter\\AppData\\Roaming\\npm\\node_modules\\mhy\\node_modules\\*" | ||
], | ||
"node_modules": [ | ||
"X:\\GITHUB\\ccss\\node_modules\\index" | ||
], | ||
"node_modules/*": [ | ||
"X:\\GITHUB\\ccss\\node_modules\\*" | ||
] | ||
@@ -47,7 +53,7 @@ }, | ||
"C:\\Users\\Winter\\AppData\\Roaming\\npm\\node_modules\\mhy\\node_modules\\@types", | ||
"X:\\GITHUB\\ccss\\packages\\core\\node_modules\\@types" | ||
"X:\\GITHUB\\ccss\\packages\\cryptic-css\\core\\node_modules\\@types" | ||
] | ||
}, | ||
"include": [ | ||
"X:\\GITHUB\\ccss\\packages\\core\\src\\**\\*" | ||
"X:\\GITHUB\\ccss\\packages\\cryptic-css\\core\\src\\**\\*" | ||
], | ||
@@ -54,0 +60,0 @@ "exclude": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1082468
69
8542
+ Addedtransformed@1.1.4(transitive)
- Removedtransformed@0.0.6(transitive)
Updatedtransformed@^1.0.0