@navita/engine 0.0.12 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/helpers/declarationsToBlock.cjs +2 -2
- package/helpers/declarationsToBlock.mjs +1 -1
- package/helpers/{hypenateProperty.cjs → hyphenateProperty.cjs} +5 -0
- package/helpers/{hypenateProperty.mjs → hyphenateProperty.mjs} +5 -0
- package/helpers/normalizeCSSVarsValue.cjs +11 -0
- package/helpers/normalizeCSSVarsValue.mjs +9 -0
- package/helpers/splitStyleBlocks.cjs +11 -2
- package/helpers/splitStyleBlocks.mjs +11 -2
- package/index.cjs +23 -5
- package/index.d.ts +2 -0
- package/index.mjs +23 -5
- package/package.json +1 -1
- package/processKeyframes.cjs +25 -0
- package/processKeyframes.mjs +23 -0
- package/processStyles.cjs +4 -6
- package/processStyles.mjs +3 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var helpers_hyphenateProperty = require('./hyphenateProperty.cjs');
|
|
4
4
|
|
|
5
5
|
// https://github.com/styletron/styletron/blob/b552ddc5050a8cc5eec84a46a299d937d3bb0112/packages/styletron-engine-atomic/src/css.ts#L36
|
|
6
6
|
function declarationsToBlock(style) {
|
|
@@ -8,7 +8,7 @@ function declarationsToBlock(style) {
|
|
|
8
8
|
for(const prop in style){
|
|
9
9
|
const val = style[prop];
|
|
10
10
|
if (typeof val === "string" || typeof val === "number") {
|
|
11
|
-
css += `${
|
|
11
|
+
css += `${helpers_hyphenateProperty.hyphenateProperty(prop)}:${val};`;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
return css.slice(0, -1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hyphenateProperty } from './
|
|
1
|
+
import { hyphenateProperty } from './hyphenateProperty.mjs';
|
|
2
2
|
|
|
3
3
|
// https://github.com/styletron/styletron/blob/b552ddc5050a8cc5eec84a46a299d937d3bb0112/packages/styletron-engine-atomic/src/css.ts#L36
|
|
4
4
|
function declarationsToBlock(style) {
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
// Modified from
|
|
3
4
|
// https://github.com/styletron/styletron/blob/b552ddc5050a8cc5eec84a46a299d937d3bb0112/packages/styletron-engine-atomic/src/hyphenate-style-name.ts
|
|
4
5
|
const uppercasePattern = /[A-Z]/g;
|
|
5
6
|
const msPattern = /^ms-/;
|
|
7
|
+
const cssVarPattern = /^--/;
|
|
6
8
|
const cache = {};
|
|
7
9
|
function hyphenateProperty(property) {
|
|
10
|
+
if (cssVarPattern.test(property)) {
|
|
11
|
+
return property;
|
|
12
|
+
}
|
|
8
13
|
return property in cache ? cache[property] : cache[property] = property.replace(uppercasePattern, "-$&").toLowerCase().replace(msPattern, "-ms-");
|
|
9
14
|
}
|
|
10
15
|
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
// Modified from
|
|
1
2
|
// https://github.com/styletron/styletron/blob/b552ddc5050a8cc5eec84a46a299d937d3bb0112/packages/styletron-engine-atomic/src/hyphenate-style-name.ts
|
|
2
3
|
const uppercasePattern = /[A-Z]/g;
|
|
3
4
|
const msPattern = /^ms-/;
|
|
5
|
+
const cssVarPattern = /^--/;
|
|
4
6
|
const cache = {};
|
|
5
7
|
function hyphenateProperty(property) {
|
|
8
|
+
if (cssVarPattern.test(property)) {
|
|
9
|
+
return property;
|
|
10
|
+
}
|
|
6
11
|
return property in cache ? cache[property] : cache[property] = property.replace(uppercasePattern, "-$&").toLowerCase().replace(msPattern, "-ms-");
|
|
7
12
|
}
|
|
8
13
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const cssVarRegex = /(?<!var\()(\s*)(--[a-zA-Z0-9_-]+)/g;
|
|
4
|
+
function normalizeCSSVarsValue(value) {
|
|
5
|
+
if (value.includes('--')) {
|
|
6
|
+
return value.replace(cssVarRegex, "$1var($2)");
|
|
7
|
+
}
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
exports.normalizeCSSVarsValue = normalizeCSSVarsValue;
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const lowPriorityProperties = [
|
|
4
|
+
'all'
|
|
5
|
+
];
|
|
3
6
|
function splitStyleBlocks(blocks) {
|
|
4
7
|
const atRules = [];
|
|
5
8
|
const rules = [];
|
|
9
|
+
const lowPrioRules = [];
|
|
6
10
|
for (const block of blocks){
|
|
7
11
|
if (block.media || block.support) {
|
|
8
12
|
atRules.push(block);
|
|
9
|
-
|
|
10
|
-
rules.push(block);
|
|
13
|
+
continue;
|
|
11
14
|
}
|
|
15
|
+
if (lowPriorityProperties.includes(block.property.toLowerCase())) {
|
|
16
|
+
lowPrioRules.push(block);
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
rules.push(block);
|
|
12
20
|
}
|
|
13
21
|
return {
|
|
14
22
|
atRules,
|
|
23
|
+
lowPrioRules,
|
|
15
24
|
rules
|
|
16
25
|
};
|
|
17
26
|
}
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
+
const lowPriorityProperties = [
|
|
2
|
+
'all'
|
|
3
|
+
];
|
|
1
4
|
function splitStyleBlocks(blocks) {
|
|
2
5
|
const atRules = [];
|
|
3
6
|
const rules = [];
|
|
7
|
+
const lowPrioRules = [];
|
|
4
8
|
for (const block of blocks){
|
|
5
9
|
if (block.media || block.support) {
|
|
6
10
|
atRules.push(block);
|
|
7
|
-
|
|
8
|
-
rules.push(block);
|
|
11
|
+
continue;
|
|
9
12
|
}
|
|
13
|
+
if (lowPriorityProperties.includes(block.property.toLowerCase())) {
|
|
14
|
+
lowPrioRules.push(block);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
rules.push(block);
|
|
10
18
|
}
|
|
11
19
|
return {
|
|
12
20
|
atRules,
|
|
21
|
+
lowPrioRules,
|
|
13
22
|
rules
|
|
14
23
|
};
|
|
15
24
|
}
|
package/index.cjs
CHANGED
|
@@ -13,6 +13,7 @@ var printers_printKeyFrames = require('./printers/printKeyFrames.cjs');
|
|
|
13
13
|
var printers_printSourceMap = require('./printers/printSourceMap.cjs');
|
|
14
14
|
var printers_printStyleBlocks = require('./printers/printStyleBlocks.cjs');
|
|
15
15
|
var printers_sortAtRules = require('./printers/sortAtRules.cjs');
|
|
16
|
+
var processKeyframes = require('./processKeyframes.cjs');
|
|
16
17
|
var processStyles = require('./processStyles.cjs');
|
|
17
18
|
var wrappers_classList = require('./wrappers/classList.cjs');
|
|
18
19
|
var wrappers_static = require('./wrappers/static.cjs');
|
|
@@ -80,7 +81,7 @@ class Engine {
|
|
|
80
81
|
addKeyframes(keyframes) {
|
|
81
82
|
const { id } = this.caches.keyframes.getOrStore({
|
|
82
83
|
type: "keyframes",
|
|
83
|
-
rule: keyframes
|
|
84
|
+
rule: processKeyframes.processKeyframes(keyframes)
|
|
84
85
|
});
|
|
85
86
|
this.addUsedIds("keyframes", [
|
|
86
87
|
id
|
|
@@ -105,6 +106,14 @@ class Engine {
|
|
|
105
106
|
};
|
|
106
107
|
return extraClass;
|
|
107
108
|
}
|
|
109
|
+
clearSourceMapReferences(filePath) {
|
|
110
|
+
const newFilePath = path.relative(this.options.context || process.cwd(), filePath);
|
|
111
|
+
this.sourceMapReferences[newFilePath] = [];
|
|
112
|
+
}
|
|
113
|
+
clearCache(filePath) {
|
|
114
|
+
this.clearUsedIds(filePath);
|
|
115
|
+
this.clearSourceMapReferences(filePath);
|
|
116
|
+
}
|
|
108
117
|
generateIdentifier(value) {
|
|
109
118
|
if (typeof value === 'undefined') {
|
|
110
119
|
let identifier = hash((this.identifierCount++).toString(36));
|
|
@@ -126,20 +135,29 @@ class Engine {
|
|
|
126
135
|
const { filePaths , usedIds , opinionatedLayers =false } = options || {};
|
|
127
136
|
// We prioritize ids over filePaths. If neither are provided, we use all the used filePaths.
|
|
128
137
|
const { keyframes: keyframesCache , fontFace: fontFaceCache , static: staticCache , rule: ruleCache } = usedIds ?? this.getUsedCacheIds(filePaths ?? Object.keys(this.usedIds));
|
|
129
|
-
const { atRules , rules } = helpers_splitStyleBlocks.splitStyleBlocks(this.caches.rule.items(ruleCache));
|
|
138
|
+
const { atRules , lowPrioRules , rules } = helpers_splitStyleBlocks.splitStyleBlocks(this.caches.rule.items(ruleCache));
|
|
130
139
|
const keyFrameCss = printers_printKeyFrames.printKeyFrames(this.caches.keyframes.items(keyframesCache));
|
|
131
140
|
const fontFaceCss = printers_printFontFaces.printFontFaces(this.caches.fontFace.items(fontFaceCache));
|
|
132
141
|
const staticCss = printers_printStyleBlocks.printStyleBlocks(this.caches.static.items(staticCache));
|
|
133
142
|
const atRulesCss = printers_printStyleBlocks.printStyleBlocks(printers_sortAtRules.sortAtRules(atRules));
|
|
143
|
+
const lowPrioRulesCss = printers_printStyleBlocks.printStyleBlocks(lowPrioRules);
|
|
134
144
|
const rulesCss = printers_printStyleBlocks.printStyleBlocks(rules);
|
|
135
145
|
if (opinionatedLayers) {
|
|
136
|
-
const result = `${keyFrameCss}${fontFaceCss}` + (staticCss.length > 0 ? `@layer
|
|
146
|
+
const result = `${keyFrameCss}${fontFaceCss}` + (staticCss.length > 0 ? `@layer s{${staticCss}}` : '') + (lowPrioRulesCss.length > 0 ? `@layer lpr{${lowPrioRulesCss}}` : '') + (rulesCss.length > 0 ? `@layer r{${rulesCss}}` : '') + (atRulesCss.length > 0 ? `@layer at{${atRulesCss}}` : '');
|
|
137
147
|
if (result.length > 0) {
|
|
138
|
-
|
|
148
|
+
// s - static
|
|
149
|
+
// lpr - low priority rules
|
|
150
|
+
// r - rules
|
|
151
|
+
// at - at rules
|
|
152
|
+
return `@layer s,lpr,r,at;${result}`;
|
|
139
153
|
}
|
|
140
154
|
return '';
|
|
141
155
|
}
|
|
142
|
-
|
|
156
|
+
const content = keyFrameCss + fontFaceCss + staticCss + lowPrioRulesCss + rulesCss + atRulesCss;
|
|
157
|
+
if (this.options.enableSourceMaps) {
|
|
158
|
+
return printers_printSourceMap.printSourceMap(this.sourceMapReferences, content);
|
|
159
|
+
}
|
|
160
|
+
return content;
|
|
143
161
|
}
|
|
144
162
|
serialize() {
|
|
145
163
|
const { caches , usedIds , identifierCount , sourceMapReferences } = this;
|
package/index.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ declare class Engine {
|
|
|
35
35
|
line: number;
|
|
36
36
|
column: number;
|
|
37
37
|
}): string | false;
|
|
38
|
+
private clearSourceMapReferences;
|
|
39
|
+
clearCache(filePath: string): void;
|
|
38
40
|
generateIdentifier(value: unknown): string;
|
|
39
41
|
renderCssToString(options?: {
|
|
40
42
|
filePaths?: string[];
|
package/index.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import { printKeyFrames } from './printers/printKeyFrames.mjs';
|
|
|
11
11
|
import { printSourceMap } from './printers/printSourceMap.mjs';
|
|
12
12
|
import { printStyleBlocks } from './printers/printStyleBlocks.mjs';
|
|
13
13
|
import { sortAtRules } from './printers/sortAtRules.mjs';
|
|
14
|
+
import { processKeyframes } from './processKeyframes.mjs';
|
|
14
15
|
import { processStyles } from './processStyles.mjs';
|
|
15
16
|
import { ClassList } from './wrappers/classList.mjs';
|
|
16
17
|
import { Static } from './wrappers/static.mjs';
|
|
@@ -78,7 +79,7 @@ class Engine {
|
|
|
78
79
|
addKeyframes(keyframes) {
|
|
79
80
|
const { id } = this.caches.keyframes.getOrStore({
|
|
80
81
|
type: "keyframes",
|
|
81
|
-
rule: keyframes
|
|
82
|
+
rule: processKeyframes(keyframes)
|
|
82
83
|
});
|
|
83
84
|
this.addUsedIds("keyframes", [
|
|
84
85
|
id
|
|
@@ -103,6 +104,14 @@ class Engine {
|
|
|
103
104
|
};
|
|
104
105
|
return extraClass;
|
|
105
106
|
}
|
|
107
|
+
clearSourceMapReferences(filePath) {
|
|
108
|
+
const newFilePath = path.relative(this.options.context || process.cwd(), filePath);
|
|
109
|
+
this.sourceMapReferences[newFilePath] = [];
|
|
110
|
+
}
|
|
111
|
+
clearCache(filePath) {
|
|
112
|
+
this.clearUsedIds(filePath);
|
|
113
|
+
this.clearSourceMapReferences(filePath);
|
|
114
|
+
}
|
|
106
115
|
generateIdentifier(value) {
|
|
107
116
|
if (typeof value === 'undefined') {
|
|
108
117
|
let identifier = hash((this.identifierCount++).toString(36));
|
|
@@ -124,20 +133,29 @@ class Engine {
|
|
|
124
133
|
const { filePaths , usedIds , opinionatedLayers =false } = options || {};
|
|
125
134
|
// We prioritize ids over filePaths. If neither are provided, we use all the used filePaths.
|
|
126
135
|
const { keyframes: keyframesCache , fontFace: fontFaceCache , static: staticCache , rule: ruleCache } = usedIds ?? this.getUsedCacheIds(filePaths ?? Object.keys(this.usedIds));
|
|
127
|
-
const { atRules , rules } = splitStyleBlocks(this.caches.rule.items(ruleCache));
|
|
136
|
+
const { atRules , lowPrioRules , rules } = splitStyleBlocks(this.caches.rule.items(ruleCache));
|
|
128
137
|
const keyFrameCss = printKeyFrames(this.caches.keyframes.items(keyframesCache));
|
|
129
138
|
const fontFaceCss = printFontFaces(this.caches.fontFace.items(fontFaceCache));
|
|
130
139
|
const staticCss = printStyleBlocks(this.caches.static.items(staticCache));
|
|
131
140
|
const atRulesCss = printStyleBlocks(sortAtRules(atRules));
|
|
141
|
+
const lowPrioRulesCss = printStyleBlocks(lowPrioRules);
|
|
132
142
|
const rulesCss = printStyleBlocks(rules);
|
|
133
143
|
if (opinionatedLayers) {
|
|
134
|
-
const result = `${keyFrameCss}${fontFaceCss}` + (staticCss.length > 0 ? `@layer
|
|
144
|
+
const result = `${keyFrameCss}${fontFaceCss}` + (staticCss.length > 0 ? `@layer s{${staticCss}}` : '') + (lowPrioRulesCss.length > 0 ? `@layer lpr{${lowPrioRulesCss}}` : '') + (rulesCss.length > 0 ? `@layer r{${rulesCss}}` : '') + (atRulesCss.length > 0 ? `@layer at{${atRulesCss}}` : '');
|
|
135
145
|
if (result.length > 0) {
|
|
136
|
-
|
|
146
|
+
// s - static
|
|
147
|
+
// lpr - low priority rules
|
|
148
|
+
// r - rules
|
|
149
|
+
// at - at rules
|
|
150
|
+
return `@layer s,lpr,r,at;${result}`;
|
|
137
151
|
}
|
|
138
152
|
return '';
|
|
139
153
|
}
|
|
140
|
-
|
|
154
|
+
const content = keyFrameCss + fontFaceCss + staticCss + lowPrioRulesCss + rulesCss + atRulesCss;
|
|
155
|
+
if (this.options.enableSourceMaps) {
|
|
156
|
+
return printSourceMap(this.sourceMapReferences, content);
|
|
157
|
+
}
|
|
158
|
+
return content;
|
|
141
159
|
}
|
|
142
160
|
serialize() {
|
|
143
161
|
const { caches , usedIds , identifierCount , sourceMapReferences } = this;
|
package/package.json
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var helpers_isObject = require('./helpers/isObject.cjs');
|
|
4
|
+
var helpers_transformContentProperty = require('./helpers/transformContentProperty.cjs');
|
|
5
|
+
|
|
6
|
+
const transformValuePropertyMap = {
|
|
7
|
+
content: helpers_transformContentProperty.transformContentProperty
|
|
8
|
+
};
|
|
9
|
+
function processKeyframes(keyframes) {
|
|
10
|
+
const newKeyframes = {};
|
|
11
|
+
for (const [key, value] of Object.entries(keyframes)){
|
|
12
|
+
if (helpers_isObject.isObject(value)) {
|
|
13
|
+
newKeyframes[key] = processKeyframes(value);
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
let newValue = value;
|
|
17
|
+
if (transformValuePropertyMap[key]) {
|
|
18
|
+
newValue = transformValuePropertyMap[key](newValue);
|
|
19
|
+
}
|
|
20
|
+
newKeyframes[key] = newValue;
|
|
21
|
+
}
|
|
22
|
+
return newKeyframes;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.processKeyframes = processKeyframes;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isObject } from './helpers/isObject.mjs';
|
|
2
|
+
import { transformContentProperty } from './helpers/transformContentProperty.mjs';
|
|
3
|
+
|
|
4
|
+
const transformValuePropertyMap = {
|
|
5
|
+
content: transformContentProperty
|
|
6
|
+
};
|
|
7
|
+
function processKeyframes(keyframes) {
|
|
8
|
+
const newKeyframes = {};
|
|
9
|
+
for (const [key, value] of Object.entries(keyframes)){
|
|
10
|
+
if (isObject(value)) {
|
|
11
|
+
newKeyframes[key] = processKeyframes(value);
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
let newValue = value;
|
|
15
|
+
if (transformValuePropertyMap[key]) {
|
|
16
|
+
newValue = transformValuePropertyMap[key](newValue);
|
|
17
|
+
}
|
|
18
|
+
newKeyframes[key] = newValue;
|
|
19
|
+
}
|
|
20
|
+
return newKeyframes;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { processKeyframes };
|
package/processStyles.cjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var helpers_generateCombinedAtRules = require('./helpers/generateCombinedAtRules.cjs');
|
|
4
|
-
var
|
|
4
|
+
var helpers_hyphenateProperty = require('./helpers/hyphenateProperty.cjs');
|
|
5
5
|
var helpers_isMediaQuery = require('./helpers/isMediaQuery.cjs');
|
|
6
6
|
var helpers_isNestedSelector = require('./helpers/isNestedSelector.cjs');
|
|
7
7
|
var helpers_isObject = require('./helpers/isObject.cjs');
|
|
8
8
|
var helpers_isSupportsQuery = require('./helpers/isSupportsQuery.cjs');
|
|
9
9
|
var helpers_normalizeCSSVarsProperty = require('./helpers/normalizeCSSVarsProperty.cjs');
|
|
10
|
+
var helpers_normalizeCSSVarsValue = require('./helpers/normalizeCSSVarsValue.cjs');
|
|
10
11
|
var helpers_normalizeNestedProperty = require('./helpers/normalizeNestedProperty.cjs');
|
|
11
12
|
var helpers_pixelifyProperties = require('./helpers/pixelifyProperties.cjs');
|
|
12
13
|
var helpers_transformContentProperty = require('./helpers/transformContentProperty.cjs');
|
|
@@ -57,10 +58,7 @@ function processStyles({ cache , type }) {
|
|
|
57
58
|
let newValue = value;
|
|
58
59
|
if (typeof value === "string") {
|
|
59
60
|
newValue = value.trim().replace(/;[\n\s]*$/, "");
|
|
60
|
-
|
|
61
|
-
// Check if value starts with --, if so, wrap in var()
|
|
62
|
-
if (typeof newValue === "string" && newValue.startsWith("--")) {
|
|
63
|
-
newValue = `var(${value})`;
|
|
61
|
+
newValue = helpers_normalizeCSSVarsValue.normalizeCSSVarsValue(newValue);
|
|
64
62
|
}
|
|
65
63
|
if (typeof value === "number") {
|
|
66
64
|
newValue = helpers_pixelifyProperties.pixelifyProperties(newProperty, value);
|
|
@@ -68,7 +66,7 @@ function processStyles({ cache , type }) {
|
|
|
68
66
|
if (transformValuePropertyMap[newProperty]) {
|
|
69
67
|
newValue = transformValuePropertyMap[newProperty](value);
|
|
70
68
|
}
|
|
71
|
-
newProperty =
|
|
69
|
+
newProperty = helpers_hyphenateProperty.hyphenateProperty(newProperty);
|
|
72
70
|
// Remove trailing semicolon and new lines with regex
|
|
73
71
|
result.push(cache.getOrStore({
|
|
74
72
|
type,
|
package/processStyles.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { generateCombinedAtRules } from './helpers/generateCombinedAtRules.mjs';
|
|
2
|
-
import { hyphenateProperty } from './helpers/
|
|
2
|
+
import { hyphenateProperty } from './helpers/hyphenateProperty.mjs';
|
|
3
3
|
import { isMediaQuery } from './helpers/isMediaQuery.mjs';
|
|
4
4
|
import { isNestedSelector } from './helpers/isNestedSelector.mjs';
|
|
5
5
|
import { isObject } from './helpers/isObject.mjs';
|
|
6
6
|
import { isSupportsQuery } from './helpers/isSupportsQuery.mjs';
|
|
7
7
|
import { normalizeCSSVarsProperty } from './helpers/normalizeCSSVarsProperty.mjs';
|
|
8
|
+
import { normalizeCSSVarsValue } from './helpers/normalizeCSSVarsValue.mjs';
|
|
8
9
|
import { normalizeNestedProperty } from './helpers/normalizeNestedProperty.mjs';
|
|
9
10
|
import { pixelifyProperties } from './helpers/pixelifyProperties.mjs';
|
|
10
11
|
import { transformContentProperty } from './helpers/transformContentProperty.mjs';
|
|
@@ -55,10 +56,7 @@ function processStyles({ cache , type }) {
|
|
|
55
56
|
let newValue = value;
|
|
56
57
|
if (typeof value === "string") {
|
|
57
58
|
newValue = value.trim().replace(/;[\n\s]*$/, "");
|
|
58
|
-
|
|
59
|
-
// Check if value starts with --, if so, wrap in var()
|
|
60
|
-
if (typeof newValue === "string" && newValue.startsWith("--")) {
|
|
61
|
-
newValue = `var(${value})`;
|
|
59
|
+
newValue = normalizeCSSVarsValue(newValue);
|
|
62
60
|
}
|
|
63
61
|
if (typeof value === "number") {
|
|
64
62
|
newValue = pixelifyProperties(newProperty, value);
|