@navita/engine 0.0.11 → 0.0.13
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/normalizeCSSVarsValue.cjs +11 -0
- package/helpers/normalizeCSSVarsValue.mjs +9 -0
- package/index.cjs +0 -13
- package/index.mjs +0 -13
- package/package.json +1 -1
- package/printers/printFontFaces.cjs +0 -1
- package/printers/printFontFaces.mjs +0 -1
- package/printers/printKeyFrames.cjs +0 -1
- package/printers/printKeyFrames.mjs +0 -1
- package/processStyles.cjs +2 -4
- package/processStyles.mjs +2 -4
|
@@ -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.startsWith('--') || value.includes(' --') || value.includes(',--')) {
|
|
6
|
+
return value.replace(cssVarRegex, "$1var($2)");
|
|
7
|
+
}
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
exports.normalizeCSSVarsValue = normalizeCSSVarsValue;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const cssVarRegex = /(?<!var\()(\s*)(--[a-zA-Z0-9_-]+)/g;
|
|
2
|
+
function normalizeCSSVarsValue(value) {
|
|
3
|
+
if (value.startsWith('--') || value.includes(' --') || value.includes(',--')) {
|
|
4
|
+
return value.replace(cssVarRegex, "$1var($2)");
|
|
5
|
+
}
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { normalizeCSSVarsValue };
|
package/index.cjs
CHANGED
|
@@ -16,19 +16,6 @@ var printers_sortAtRules = require('./printers/sortAtRules.cjs');
|
|
|
16
16
|
var processStyles = require('./processStyles.cjs');
|
|
17
17
|
var wrappers_classList = require('./wrappers/classList.cjs');
|
|
18
18
|
var wrappers_static = require('./wrappers/static.cjs');
|
|
19
|
-
require('./helpers/declarationsToBlock.cjs');
|
|
20
|
-
require('./helpers/hypenateProperty.cjs');
|
|
21
|
-
require('source-map');
|
|
22
|
-
require('./helpers/getPropertyPriority.cjs');
|
|
23
|
-
require('sort-css-media-queries/lib/create-sort.js');
|
|
24
|
-
require('./helpers/generateCombinedAtRules.cjs');
|
|
25
|
-
require('./helpers/isMediaQuery.cjs');
|
|
26
|
-
require('./helpers/isNestedSelector.cjs');
|
|
27
|
-
require('./helpers/isSupportsQuery.cjs');
|
|
28
|
-
require('./helpers/normalizeCSSVarsProperty.cjs');
|
|
29
|
-
require('./helpers/normalizeNestedProperty.cjs');
|
|
30
|
-
require('./helpers/pixelifyProperties.cjs');
|
|
31
|
-
require('./helpers/transformContentProperty.cjs');
|
|
32
19
|
|
|
33
20
|
const defaultOptions = {
|
|
34
21
|
enableSourceMaps: false,
|
package/index.mjs
CHANGED
|
@@ -14,19 +14,6 @@ import { sortAtRules } from './printers/sortAtRules.mjs';
|
|
|
14
14
|
import { processStyles } from './processStyles.mjs';
|
|
15
15
|
import { ClassList } from './wrappers/classList.mjs';
|
|
16
16
|
import { Static } from './wrappers/static.mjs';
|
|
17
|
-
import './helpers/declarationsToBlock.mjs';
|
|
18
|
-
import './helpers/hypenateProperty.mjs';
|
|
19
|
-
import 'source-map';
|
|
20
|
-
import './helpers/getPropertyPriority.mjs';
|
|
21
|
-
import 'sort-css-media-queries/lib/create-sort.js';
|
|
22
|
-
import './helpers/generateCombinedAtRules.mjs';
|
|
23
|
-
import './helpers/isMediaQuery.mjs';
|
|
24
|
-
import './helpers/isNestedSelector.mjs';
|
|
25
|
-
import './helpers/isSupportsQuery.mjs';
|
|
26
|
-
import './helpers/normalizeCSSVarsProperty.mjs';
|
|
27
|
-
import './helpers/normalizeNestedProperty.mjs';
|
|
28
|
-
import './helpers/pixelifyProperties.mjs';
|
|
29
|
-
import './helpers/transformContentProperty.mjs';
|
|
30
17
|
|
|
31
18
|
const defaultOptions = {
|
|
32
19
|
enableSourceMaps: false,
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var helpers_declarationsToBlock = require('../helpers/declarationsToBlock.cjs');
|
|
4
|
-
require('../helpers/hypenateProperty.cjs');
|
|
5
4
|
|
|
6
5
|
// https://github.com/styletron/styletron/blob/master/packages/styletron-engine-atomic/src/css.ts#L48
|
|
7
6
|
function keyframesToBlock(keyframes) {
|
package/processStyles.cjs
CHANGED
|
@@ -10,6 +10,7 @@ var helpers_normalizeCSSVarsProperty = require('./helpers/normalizeCSSVarsProper
|
|
|
10
10
|
var helpers_normalizeNestedProperty = require('./helpers/normalizeNestedProperty.cjs');
|
|
11
11
|
var helpers_pixelifyProperties = require('./helpers/pixelifyProperties.cjs');
|
|
12
12
|
var helpers_transformContentProperty = require('./helpers/transformContentProperty.cjs');
|
|
13
|
+
var helpers_normalizeCSSVarsValue = require('./helpers/normalizeCSSVarsValue.cjs');
|
|
13
14
|
|
|
14
15
|
const transformValuePropertyMap = {
|
|
15
16
|
content: helpers_transformContentProperty.transformContentProperty
|
|
@@ -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);
|
package/processStyles.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import { normalizeCSSVarsProperty } from './helpers/normalizeCSSVarsProperty.mjs
|
|
|
8
8
|
import { normalizeNestedProperty } from './helpers/normalizeNestedProperty.mjs';
|
|
9
9
|
import { pixelifyProperties } from './helpers/pixelifyProperties.mjs';
|
|
10
10
|
import { transformContentProperty } from './helpers/transformContentProperty.mjs';
|
|
11
|
+
import { normalizeCSSVarsValue } from './helpers/normalizeCSSVarsValue.mjs';
|
|
11
12
|
|
|
12
13
|
const transformValuePropertyMap = {
|
|
13
14
|
content: transformContentProperty
|
|
@@ -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);
|