@navita/engine 0.2.2 → 3.0.0-next.1
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/_virtual/_rolldown/runtime.cjs +23 -0
- package/cache.cjs +26 -26
- package/cache.mjs +28 -24
- package/helpers/declarationsToBlock.cjs +10 -14
- package/helpers/declarationsToBlock.mjs +12 -12
- package/helpers/generateCombinedAtRules.cjs +5 -7
- package/helpers/generateCombinedAtRules.mjs +7 -5
- package/helpers/getPropertyPriority.cjs +221 -260
- package/helpers/getPropertyPriority.mjs +223 -258
- package/helpers/hyphenateProperty.cjs +8 -9
- package/helpers/hyphenateProperty.mjs +10 -7
- package/helpers/isContainerQuery.cjs +4 -4
- package/helpers/isContainerQuery.mjs +6 -2
- package/helpers/isMediaQuery.cjs +4 -4
- package/helpers/isMediaQuery.mjs +6 -2
- package/helpers/isNestedSelector.cjs +5 -5
- package/helpers/isNestedSelector.mjs +7 -3
- package/helpers/isObject.cjs +4 -4
- package/helpers/isObject.mjs +6 -2
- package/helpers/isSupportsQuery.cjs +4 -4
- package/helpers/isSupportsQuery.mjs +6 -2
- package/helpers/normalizeCSSVarsProperty.cjs +7 -11
- package/helpers/normalizeCSSVarsProperty.mjs +9 -9
- package/helpers/normalizeCSSVarsValue.cjs +6 -8
- package/helpers/normalizeCSSVarsValue.mjs +8 -6
- package/helpers/normalizeNestedProperty.cjs +5 -7
- package/helpers/normalizeNestedProperty.mjs +7 -5
- package/helpers/pixelifyProperties.cjs +50 -53
- package/helpers/pixelifyProperties.mjs +52 -51
- package/helpers/splitSelectorList.cjs +55 -0
- package/helpers/splitSelectorList.mjs +57 -0
- package/helpers/splitStyleBlocks.cjs +23 -25
- package/helpers/splitStyleBlocks.mjs +25 -23
- package/helpers/transformContentProperty.cjs +4 -5
- package/helpers/transformContentProperty.mjs +6 -3
- package/identifiers/IDGenerator.cjs +9 -9
- package/identifiers/IDGenerator.mjs +11 -7
- package/identifiers/alphaIDGenerator.cjs +23 -26
- package/identifiers/alphaIDGenerator.mjs +25 -24
- package/identifiers/propertyValueIDGenerator.cjs +18 -23
- package/identifiers/propertyValueIDGenerator.mjs +20 -21
- package/index.cjs +187 -238
- package/index.d.ts +91 -84
- package/index.mjs +184 -234
- package/package.json +1 -1
- package/printers/printFontFaces.cjs +7 -12
- package/printers/printFontFaces.mjs +9 -10
- package/printers/printKeyFrames.cjs +10 -16
- package/printers/printKeyFrames.mjs +12 -14
- package/printers/printSourceMap.cjs +34 -39
- package/printers/printSourceMap.mjs +36 -37
- package/printers/printStyleBlocks.cjs +71 -70
- package/printers/printStyleBlocks.mjs +73 -68
- package/printers/sortAtRules.cjs +8 -7
- package/printers/sortAtRules.mjs +7 -4
- package/processKeyframes.cjs +16 -22
- package/processKeyframes.mjs +19 -20
- package/processStyles.cjs +99 -105
- package/processStyles.mjs +101 -103
- package/types.cjs +0 -2
- package/types.mjs +4 -1
- package/wrappers/classList.cjs +4 -5
- package/wrappers/classList.mjs +6 -3
- package/wrappers/static.cjs +4 -5
- package/wrappers/static.mjs +6 -3
- package/printers/sortStatic.cjs +0 -7
- package/printers/sortStatic.mjs +0 -5
package/processKeyframes.mjs
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { isObject } from "./helpers/isObject.mjs";
|
|
5
|
+
import { transformContentProperty } from "./helpers/transformContentProperty.mjs";
|
|
6
|
+
//#region src/processKeyframes.ts
|
|
7
|
+
const transformValuePropertyMap = { content: transformContentProperty };
|
|
7
8
|
function processKeyframes(keyframes) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
return newKeyframes;
|
|
9
|
+
const newKeyframes = {};
|
|
10
|
+
for (const [key, value] of Object.entries(keyframes)) {
|
|
11
|
+
if (isObject(value)) {
|
|
12
|
+
newKeyframes[key] = processKeyframes(value);
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
let newValue = value;
|
|
16
|
+
if (transformValuePropertyMap[key]) newValue = transformValuePropertyMap[key](newValue);
|
|
17
|
+
newKeyframes[key] = newValue;
|
|
18
|
+
}
|
|
19
|
+
return newKeyframes;
|
|
21
20
|
}
|
|
22
|
-
|
|
21
|
+
//#endregion
|
|
23
22
|
export { processKeyframes };
|
package/processStyles.cjs
CHANGED
|
@@ -1,107 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const transformValuePropertyMap = {
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
support,
|
|
100
|
-
container
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
|
-
return result;
|
|
104
|
-
};
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_helpers_isObject = require("./helpers/isObject.cjs");
|
|
3
|
+
const require_helpers_hyphenateProperty = require("./helpers/hyphenateProperty.cjs");
|
|
4
|
+
const require_helpers_transformContentProperty = require("./helpers/transformContentProperty.cjs");
|
|
5
|
+
const require_helpers_generateCombinedAtRules = require("./helpers/generateCombinedAtRules.cjs");
|
|
6
|
+
const require_helpers_isContainerQuery = require("./helpers/isContainerQuery.cjs");
|
|
7
|
+
const require_helpers_isMediaQuery = require("./helpers/isMediaQuery.cjs");
|
|
8
|
+
const require_helpers_isNestedSelector = require("./helpers/isNestedSelector.cjs");
|
|
9
|
+
const require_helpers_isSupportsQuery = require("./helpers/isSupportsQuery.cjs");
|
|
10
|
+
const require_helpers_normalizeCSSVarsProperty = require("./helpers/normalizeCSSVarsProperty.cjs");
|
|
11
|
+
const require_helpers_normalizeCSSVarsValue = require("./helpers/normalizeCSSVarsValue.cjs");
|
|
12
|
+
const require_helpers_normalizeNestedProperty = require("./helpers/normalizeNestedProperty.cjs");
|
|
13
|
+
const require_helpers_pixelifyProperties = require("./helpers/pixelifyProperties.cjs");
|
|
14
|
+
const require_helpers_splitSelectorList = require("./helpers/splitSelectorList.cjs");
|
|
15
|
+
//#region src/processStyles.ts
|
|
16
|
+
const transformValuePropertyMap = { content: require_helpers_transformContentProperty.transformContentProperty };
|
|
17
|
+
function processStyles({ cache, type }) {
|
|
18
|
+
return function process({ styles, pseudo = "", media = "", support = "", container = "", selector = "" }) {
|
|
19
|
+
const result = [];
|
|
20
|
+
for (const [property, value] of Object.entries(styles)) {
|
|
21
|
+
if (require_helpers_isObject.isObject(value)) {
|
|
22
|
+
if (require_helpers_isMediaQuery.isMediaQuery(property)) {
|
|
23
|
+
const combinedMedia = require_helpers_generateCombinedAtRules.generateCombinedAtRules(media, property.slice(6).trim());
|
|
24
|
+
result.push(...process({
|
|
25
|
+
styles: value,
|
|
26
|
+
pseudo,
|
|
27
|
+
media: combinedMedia,
|
|
28
|
+
support,
|
|
29
|
+
container,
|
|
30
|
+
selector
|
|
31
|
+
}));
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (require_helpers_isSupportsQuery.isSupportsQuery(property)) {
|
|
35
|
+
const combinedSupport = require_helpers_generateCombinedAtRules.generateCombinedAtRules(support, property.slice(9).trim());
|
|
36
|
+
result.push(...process({
|
|
37
|
+
styles: value,
|
|
38
|
+
pseudo,
|
|
39
|
+
media,
|
|
40
|
+
support: combinedSupport,
|
|
41
|
+
container,
|
|
42
|
+
selector
|
|
43
|
+
}));
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (require_helpers_isContainerQuery.isContainerQuery(property)) {
|
|
47
|
+
const combinedContainer = require_helpers_generateCombinedAtRules.generateCombinedAtRules(container, property.slice(10).trim());
|
|
48
|
+
result.push(...process({
|
|
49
|
+
styles: value,
|
|
50
|
+
pseudo,
|
|
51
|
+
media,
|
|
52
|
+
support,
|
|
53
|
+
container: combinedContainer,
|
|
54
|
+
selector
|
|
55
|
+
}));
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (require_helpers_isNestedSelector.isNestedSelector(property)) {
|
|
59
|
+
const copies = require_helpers_splitSelectorList.splitSelectorList(property);
|
|
60
|
+
const hasLeadingDescendant = /^\s/.test(property);
|
|
61
|
+
for (let i = 0; i < copies.length; i++) {
|
|
62
|
+
const copy = i === 0 && hasLeadingDescendant ? ` ${copies[i]}` : copies[i];
|
|
63
|
+
result.push(...process({
|
|
64
|
+
styles: value,
|
|
65
|
+
pseudo: pseudo + require_helpers_normalizeNestedProperty.normalizeNestedProperty(copy),
|
|
66
|
+
media,
|
|
67
|
+
support,
|
|
68
|
+
container,
|
|
69
|
+
selector
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
console.warn("Unknown property", property);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
let newProperty = require_helpers_normalizeCSSVarsProperty.normalizeCSSVarsProperty(property);
|
|
78
|
+
let newValue = value;
|
|
79
|
+
if (typeof value === "string") {
|
|
80
|
+
newValue = value.trim().replace(/;[\n\s]*$/, "");
|
|
81
|
+
newValue = require_helpers_normalizeCSSVarsValue.normalizeCSSVarsValue(newValue);
|
|
82
|
+
}
|
|
83
|
+
if (typeof value === "number") newValue = require_helpers_pixelifyProperties.pixelifyProperties(newProperty, value);
|
|
84
|
+
if (transformValuePropertyMap[newProperty]) newValue = transformValuePropertyMap[newProperty](value);
|
|
85
|
+
newProperty = require_helpers_hyphenateProperty.hyphenateProperty(newProperty);
|
|
86
|
+
result.push(cache.getOrStore({
|
|
87
|
+
type,
|
|
88
|
+
selector,
|
|
89
|
+
property: newProperty,
|
|
90
|
+
value: newValue,
|
|
91
|
+
pseudo,
|
|
92
|
+
media,
|
|
93
|
+
support,
|
|
94
|
+
container
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
return result;
|
|
98
|
+
};
|
|
105
99
|
}
|
|
106
|
-
|
|
100
|
+
//#endregion
|
|
107
101
|
exports.processStyles = processStyles;
|
package/processStyles.mjs
CHANGED
|
@@ -1,105 +1,103 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return result;
|
|
102
|
-
};
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { isObject } from "./helpers/isObject.mjs";
|
|
5
|
+
import { hyphenateProperty } from "./helpers/hyphenateProperty.mjs";
|
|
6
|
+
import { transformContentProperty } from "./helpers/transformContentProperty.mjs";
|
|
7
|
+
import { generateCombinedAtRules } from "./helpers/generateCombinedAtRules.mjs";
|
|
8
|
+
import { isContainerQuery } from "./helpers/isContainerQuery.mjs";
|
|
9
|
+
import { isMediaQuery } from "./helpers/isMediaQuery.mjs";
|
|
10
|
+
import { isNestedSelector } from "./helpers/isNestedSelector.mjs";
|
|
11
|
+
import { isSupportsQuery } from "./helpers/isSupportsQuery.mjs";
|
|
12
|
+
import { normalizeCSSVarsProperty } from "./helpers/normalizeCSSVarsProperty.mjs";
|
|
13
|
+
import { normalizeCSSVarsValue } from "./helpers/normalizeCSSVarsValue.mjs";
|
|
14
|
+
import { normalizeNestedProperty } from "./helpers/normalizeNestedProperty.mjs";
|
|
15
|
+
import { pixelifyProperties } from "./helpers/pixelifyProperties.mjs";
|
|
16
|
+
import { splitSelectorList } from "./helpers/splitSelectorList.mjs";
|
|
17
|
+
//#region src/processStyles.ts
|
|
18
|
+
const transformValuePropertyMap = { content: transformContentProperty };
|
|
19
|
+
function processStyles({ cache, type }) {
|
|
20
|
+
return function process({ styles, pseudo = "", media = "", support = "", container = "", selector = "" }) {
|
|
21
|
+
const result = [];
|
|
22
|
+
for (const [property, value] of Object.entries(styles)) {
|
|
23
|
+
if (isObject(value)) {
|
|
24
|
+
if (isMediaQuery(property)) {
|
|
25
|
+
const combinedMedia = generateCombinedAtRules(media, property.slice(6).trim());
|
|
26
|
+
result.push(...process({
|
|
27
|
+
styles: value,
|
|
28
|
+
pseudo,
|
|
29
|
+
media: combinedMedia,
|
|
30
|
+
support,
|
|
31
|
+
container,
|
|
32
|
+
selector
|
|
33
|
+
}));
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (isSupportsQuery(property)) {
|
|
37
|
+
const combinedSupport = generateCombinedAtRules(support, property.slice(9).trim());
|
|
38
|
+
result.push(...process({
|
|
39
|
+
styles: value,
|
|
40
|
+
pseudo,
|
|
41
|
+
media,
|
|
42
|
+
support: combinedSupport,
|
|
43
|
+
container,
|
|
44
|
+
selector
|
|
45
|
+
}));
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (isContainerQuery(property)) {
|
|
49
|
+
const combinedContainer = generateCombinedAtRules(container, property.slice(10).trim());
|
|
50
|
+
result.push(...process({
|
|
51
|
+
styles: value,
|
|
52
|
+
pseudo,
|
|
53
|
+
media,
|
|
54
|
+
support,
|
|
55
|
+
container: combinedContainer,
|
|
56
|
+
selector
|
|
57
|
+
}));
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (isNestedSelector(property)) {
|
|
61
|
+
const copies = splitSelectorList(property);
|
|
62
|
+
const hasLeadingDescendant = /^\s/.test(property);
|
|
63
|
+
for (let i = 0; i < copies.length; i++) {
|
|
64
|
+
const copy = i === 0 && hasLeadingDescendant ? ` ${copies[i]}` : copies[i];
|
|
65
|
+
result.push(...process({
|
|
66
|
+
styles: value,
|
|
67
|
+
pseudo: pseudo + normalizeNestedProperty(copy),
|
|
68
|
+
media,
|
|
69
|
+
support,
|
|
70
|
+
container,
|
|
71
|
+
selector
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
console.warn("Unknown property", property);
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
let newProperty = normalizeCSSVarsProperty(property);
|
|
80
|
+
let newValue = value;
|
|
81
|
+
if (typeof value === "string") {
|
|
82
|
+
newValue = value.trim().replace(/;[\n\s]*$/, "");
|
|
83
|
+
newValue = normalizeCSSVarsValue(newValue);
|
|
84
|
+
}
|
|
85
|
+
if (typeof value === "number") newValue = pixelifyProperties(newProperty, value);
|
|
86
|
+
if (transformValuePropertyMap[newProperty]) newValue = transformValuePropertyMap[newProperty](value);
|
|
87
|
+
newProperty = hyphenateProperty(newProperty);
|
|
88
|
+
result.push(cache.getOrStore({
|
|
89
|
+
type,
|
|
90
|
+
selector,
|
|
91
|
+
property: newProperty,
|
|
92
|
+
value: newValue,
|
|
93
|
+
pseudo,
|
|
94
|
+
media,
|
|
95
|
+
support,
|
|
96
|
+
container
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
};
|
|
103
101
|
}
|
|
104
|
-
|
|
102
|
+
//#endregion
|
|
105
103
|
export { processStyles };
|
package/types.cjs
CHANGED
package/types.mjs
CHANGED
package/wrappers/classList.cjs
CHANGED
package/wrappers/classList.mjs
CHANGED
package/wrappers/static.cjs
CHANGED
package/wrappers/static.mjs
CHANGED
package/printers/sortStatic.cjs
DELETED