@navita/engine 0.2.2 → 3.0.0-next.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/_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
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { declarationsToBlock } from "../helpers/declarationsToBlock.mjs";
|
|
5
|
+
//#region src/printers/printFontFaces.ts
|
|
3
6
|
function printFontFaces(blocks) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
fontFaces += `@font-face{font-family:${block.id};${declarationsToBlock(rule)}}`;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
return fontFaces;
|
|
7
|
+
let fontFaces = "";
|
|
8
|
+
for (const block of blocks) for (const rule of block.rule) fontFaces += `@font-face{font-family:${block.id};${declarationsToBlock(rule)}}`;
|
|
9
|
+
return fontFaces;
|
|
11
10
|
}
|
|
12
|
-
|
|
11
|
+
//#endregion
|
|
13
12
|
export { printFontFaces };
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// https://github.com/styletron/styletron/blob/master/packages/styletron-engine-atomic/src/css.ts#L48
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_helpers_declarationsToBlock = require("../helpers/declarationsToBlock.cjs");
|
|
3
|
+
//#region src/printers/printKeyFrames.ts
|
|
6
4
|
function keyframesToBlock(keyframes) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
return result;
|
|
5
|
+
let result = "";
|
|
6
|
+
for (const animationState in keyframes) result += `${animationState}{${require_helpers_declarationsToBlock.declarationsToBlock(keyframes[animationState])}}`;
|
|
7
|
+
return result;
|
|
12
8
|
}
|
|
13
9
|
function printKeyFrames(blocks) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
return keyframes;
|
|
10
|
+
let keyframes = "";
|
|
11
|
+
for (const block of blocks) keyframes += `@keyframes ${block.id}{${keyframesToBlock(block.rule)}}`;
|
|
12
|
+
return keyframes;
|
|
19
13
|
}
|
|
20
|
-
|
|
14
|
+
//#endregion
|
|
21
15
|
exports.printKeyFrames = printKeyFrames;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { declarationsToBlock } from "../helpers/declarationsToBlock.mjs";
|
|
5
|
+
//#region src/printers/printKeyFrames.ts
|
|
4
6
|
function keyframesToBlock(keyframes) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
return result;
|
|
7
|
+
let result = "";
|
|
8
|
+
for (const animationState in keyframes) result += `${animationState}{${declarationsToBlock(keyframes[animationState])}}`;
|
|
9
|
+
return result;
|
|
10
10
|
}
|
|
11
11
|
function printKeyFrames(blocks) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
return keyframes;
|
|
12
|
+
let keyframes = "";
|
|
13
|
+
for (const block of blocks) keyframes += `@keyframes ${block.id}{${keyframesToBlock(block.rule)}}`;
|
|
14
|
+
return keyframes;
|
|
17
15
|
}
|
|
18
|
-
|
|
16
|
+
//#endregion
|
|
19
17
|
export { printKeyFrames };
|
|
@@ -1,42 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let source_map = require("source-map");
|
|
3
|
+
//#region src/printers/printSourceMap.ts
|
|
5
4
|
function printSourceMap(sourceMapReferences, content) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
const sourceMapContent = Buffer.from(sourceMap$1.toString()).toString('base64');
|
|
38
|
-
content += `\n/*# sourceMappingURL=data:application/json;base64,${sourceMapContent} */`;
|
|
39
|
-
return content;
|
|
5
|
+
if (content.length === 0) return content;
|
|
6
|
+
const entries = Object.entries(sourceMapReferences);
|
|
7
|
+
if (entries.length === 0) return content;
|
|
8
|
+
const sourceMap = new source_map.SourceMapGenerator({
|
|
9
|
+
file: "navita.css",
|
|
10
|
+
skipValidation: true
|
|
11
|
+
});
|
|
12
|
+
const references = entries.flatMap(([filePath, references]) => references.map((reference) => ({
|
|
13
|
+
filePath,
|
|
14
|
+
...reference
|
|
15
|
+
})));
|
|
16
|
+
for (const reference of references) {
|
|
17
|
+
const { filePath, selector, line, column } = reference;
|
|
18
|
+
const generatedColumn = content.length - 1;
|
|
19
|
+
content += `${selector}{/* Only used for sourceMap */}`;
|
|
20
|
+
sourceMap.addMapping({
|
|
21
|
+
source: filePath,
|
|
22
|
+
original: {
|
|
23
|
+
line,
|
|
24
|
+
column
|
|
25
|
+
},
|
|
26
|
+
generated: {
|
|
27
|
+
line: 1,
|
|
28
|
+
column: generatedColumn
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const sourceMapContent = Buffer.from(sourceMap.toString()).toString("base64");
|
|
33
|
+
content += `\n/*# sourceMappingURL=data:application/json;base64,${sourceMapContent} */`;
|
|
34
|
+
return content;
|
|
40
35
|
}
|
|
41
|
-
|
|
36
|
+
//#endregion
|
|
42
37
|
exports.printSourceMap = printSourceMap;
|
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { SourceMapGenerator } from "source-map";
|
|
5
|
+
//#region src/printers/printSourceMap.ts
|
|
3
6
|
function printSourceMap(sourceMapReferences, content) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
const sourceMapContent = Buffer.from(sourceMap.toString()).toString('base64');
|
|
36
|
-
content += `\n/*# sourceMappingURL=data:application/json;base64,${sourceMapContent} */`;
|
|
37
|
-
return content;
|
|
7
|
+
if (content.length === 0) return content;
|
|
8
|
+
const entries = Object.entries(sourceMapReferences);
|
|
9
|
+
if (entries.length === 0) return content;
|
|
10
|
+
const sourceMap = new SourceMapGenerator({
|
|
11
|
+
file: "navita.css",
|
|
12
|
+
skipValidation: true
|
|
13
|
+
});
|
|
14
|
+
const references = entries.flatMap(([filePath, references]) => references.map((reference) => ({
|
|
15
|
+
filePath,
|
|
16
|
+
...reference
|
|
17
|
+
})));
|
|
18
|
+
for (const reference of references) {
|
|
19
|
+
const { filePath, selector, line, column } = reference;
|
|
20
|
+
const generatedColumn = content.length - 1;
|
|
21
|
+
content += `${selector}{/* Only used for sourceMap */}`;
|
|
22
|
+
sourceMap.addMapping({
|
|
23
|
+
source: filePath,
|
|
24
|
+
original: {
|
|
25
|
+
line,
|
|
26
|
+
column
|
|
27
|
+
},
|
|
28
|
+
generated: {
|
|
29
|
+
line: 1,
|
|
30
|
+
column: generatedColumn
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const sourceMapContent = Buffer.from(sourceMap.toString()).toString("base64");
|
|
35
|
+
content += `\n/*# sourceMappingURL=data:application/json;base64,${sourceMapContent} */`;
|
|
36
|
+
return content;
|
|
38
37
|
}
|
|
39
|
-
|
|
38
|
+
//#endregion
|
|
40
39
|
export { printSourceMap };
|
|
@@ -1,73 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_helpers_getPropertyPriority = require("../helpers/getPropertyPriority.cjs");
|
|
3
|
+
//#region src/printers/printStyleBlocks.ts
|
|
4
|
+
const AT_RULE_PREFIX = {
|
|
5
|
+
media: "@media ",
|
|
6
|
+
container: "@container ",
|
|
7
|
+
support: "@supports "
|
|
8
|
+
};
|
|
9
|
+
function getDesiredAtRules(style) {
|
|
10
|
+
const desired = [];
|
|
11
|
+
if (style.media) desired.push({
|
|
12
|
+
kind: "media",
|
|
13
|
+
value: style.media
|
|
14
|
+
});
|
|
15
|
+
if (style.container) desired.push({
|
|
16
|
+
kind: "container",
|
|
17
|
+
value: style.container
|
|
18
|
+
});
|
|
19
|
+
if (style.support) desired.push({
|
|
20
|
+
kind: "support",
|
|
21
|
+
value: style.support
|
|
22
|
+
});
|
|
23
|
+
return desired;
|
|
24
|
+
}
|
|
25
|
+
function composeSelector(elementSelector, pseudo) {
|
|
26
|
+
if (pseudo.includes("&")) return pseudo.replace(/&/g, elementSelector);
|
|
27
|
+
return `${elementSelector}${pseudo}`;
|
|
28
|
+
}
|
|
5
29
|
function printStyleBlocks(blocks) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
stylesheet += `${style.property}:${style.value}`;
|
|
50
|
-
if (style.type === 'static') {
|
|
51
|
-
stylesheet += ';';
|
|
52
|
-
}
|
|
53
|
-
if (style.type === 'rule') {
|
|
54
|
-
stylesheet += '}';
|
|
55
|
-
}
|
|
56
|
-
previousStyle = style;
|
|
57
|
-
}
|
|
58
|
-
if (previousStyle?.container) {
|
|
59
|
-
stylesheet += '}';
|
|
60
|
-
}
|
|
61
|
-
if (previousStyle?.support) {
|
|
62
|
-
stylesheet += '}';
|
|
63
|
-
}
|
|
64
|
-
if (previousStyle?.media) {
|
|
65
|
-
stylesheet += '}';
|
|
66
|
-
}
|
|
67
|
-
if (previousStyle?.type === 'static') {
|
|
68
|
-
stylesheet += '}';
|
|
69
|
-
}
|
|
70
|
-
return stylesheet;
|
|
30
|
+
let stylesheet = "";
|
|
31
|
+
const openAtRules = [];
|
|
32
|
+
let staticOpen = false;
|
|
33
|
+
let previousStyle;
|
|
34
|
+
for (const style of blocks) {
|
|
35
|
+
const desired = getDesiredAtRules(style);
|
|
36
|
+
let common = 0;
|
|
37
|
+
while (common < openAtRules.length && common < desired.length && openAtRules[common].kind === desired[common].kind && openAtRules[common].value === desired[common].value) common++;
|
|
38
|
+
const atRulesWillChange = openAtRules.length > common;
|
|
39
|
+
const staticGroupChanged = !!previousStyle && (previousStyle.selector !== style.selector || previousStyle.pseudo !== style.pseudo || previousStyle.media !== style.media || previousStyle.support !== style.support || previousStyle.container !== style.container);
|
|
40
|
+
if (staticOpen && (atRulesWillChange || staticGroupChanged)) {
|
|
41
|
+
stylesheet += "}";
|
|
42
|
+
staticOpen = false;
|
|
43
|
+
}
|
|
44
|
+
while (openAtRules.length > common) {
|
|
45
|
+
openAtRules.pop();
|
|
46
|
+
stylesheet += "}";
|
|
47
|
+
}
|
|
48
|
+
for (let i = common; i < desired.length; i++) {
|
|
49
|
+
const wrapper = desired[i];
|
|
50
|
+
stylesheet += `${AT_RULE_PREFIX[wrapper.kind]}${wrapper.value}{`;
|
|
51
|
+
openAtRules.push(wrapper);
|
|
52
|
+
}
|
|
53
|
+
if (style.type === "rule") {
|
|
54
|
+
const selector = composeSelector(`.${style.id}`.repeat(require_helpers_getPropertyPriority.getPropertyPriority(style.property)), style.pseudo);
|
|
55
|
+
stylesheet += `${selector}{${style.property}:${style.value}}`;
|
|
56
|
+
} else {
|
|
57
|
+
if (!staticOpen) {
|
|
58
|
+
const selector = composeSelector(style.selector, style.pseudo);
|
|
59
|
+
stylesheet += `${selector}{`;
|
|
60
|
+
staticOpen = true;
|
|
61
|
+
}
|
|
62
|
+
stylesheet += `${style.property}:${style.value};`;
|
|
63
|
+
}
|
|
64
|
+
previousStyle = style;
|
|
65
|
+
}
|
|
66
|
+
if (staticOpen) stylesheet += "}";
|
|
67
|
+
while (openAtRules.length > 0) {
|
|
68
|
+
openAtRules.pop();
|
|
69
|
+
stylesheet += "}";
|
|
70
|
+
}
|
|
71
|
+
return stylesheet;
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
//#endregion
|
|
73
74
|
exports.printStyleBlocks = printStyleBlocks;
|
|
@@ -1,71 +1,76 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { getPropertyPriority } from "../helpers/getPropertyPriority.mjs";
|
|
5
|
+
//#region src/printers/printStyleBlocks.ts
|
|
6
|
+
const AT_RULE_PREFIX = {
|
|
7
|
+
media: "@media ",
|
|
8
|
+
container: "@container ",
|
|
9
|
+
support: "@supports "
|
|
10
|
+
};
|
|
11
|
+
function getDesiredAtRules(style) {
|
|
12
|
+
const desired = [];
|
|
13
|
+
if (style.media) desired.push({
|
|
14
|
+
kind: "media",
|
|
15
|
+
value: style.media
|
|
16
|
+
});
|
|
17
|
+
if (style.container) desired.push({
|
|
18
|
+
kind: "container",
|
|
19
|
+
value: style.container
|
|
20
|
+
});
|
|
21
|
+
if (style.support) desired.push({
|
|
22
|
+
kind: "support",
|
|
23
|
+
value: style.support
|
|
24
|
+
});
|
|
25
|
+
return desired;
|
|
26
|
+
}
|
|
27
|
+
function composeSelector(elementSelector, pseudo) {
|
|
28
|
+
if (pseudo.includes("&")) return pseudo.replace(/&/g, elementSelector);
|
|
29
|
+
return `${elementSelector}${pseudo}`;
|
|
30
|
+
}
|
|
3
31
|
function printStyleBlocks(blocks) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
stylesheet += `${style.property}:${style.value}`;
|
|
48
|
-
if (style.type === 'static') {
|
|
49
|
-
stylesheet += ';';
|
|
50
|
-
}
|
|
51
|
-
if (style.type === 'rule') {
|
|
52
|
-
stylesheet += '}';
|
|
53
|
-
}
|
|
54
|
-
previousStyle = style;
|
|
55
|
-
}
|
|
56
|
-
if (previousStyle?.container) {
|
|
57
|
-
stylesheet += '}';
|
|
58
|
-
}
|
|
59
|
-
if (previousStyle?.support) {
|
|
60
|
-
stylesheet += '}';
|
|
61
|
-
}
|
|
62
|
-
if (previousStyle?.media) {
|
|
63
|
-
stylesheet += '}';
|
|
64
|
-
}
|
|
65
|
-
if (previousStyle?.type === 'static') {
|
|
66
|
-
stylesheet += '}';
|
|
67
|
-
}
|
|
68
|
-
return stylesheet;
|
|
32
|
+
let stylesheet = "";
|
|
33
|
+
const openAtRules = [];
|
|
34
|
+
let staticOpen = false;
|
|
35
|
+
let previousStyle;
|
|
36
|
+
for (const style of blocks) {
|
|
37
|
+
const desired = getDesiredAtRules(style);
|
|
38
|
+
let common = 0;
|
|
39
|
+
while (common < openAtRules.length && common < desired.length && openAtRules[common].kind === desired[common].kind && openAtRules[common].value === desired[common].value) common++;
|
|
40
|
+
const atRulesWillChange = openAtRules.length > common;
|
|
41
|
+
const staticGroupChanged = !!previousStyle && (previousStyle.selector !== style.selector || previousStyle.pseudo !== style.pseudo || previousStyle.media !== style.media || previousStyle.support !== style.support || previousStyle.container !== style.container);
|
|
42
|
+
if (staticOpen && (atRulesWillChange || staticGroupChanged)) {
|
|
43
|
+
stylesheet += "}";
|
|
44
|
+
staticOpen = false;
|
|
45
|
+
}
|
|
46
|
+
while (openAtRules.length > common) {
|
|
47
|
+
openAtRules.pop();
|
|
48
|
+
stylesheet += "}";
|
|
49
|
+
}
|
|
50
|
+
for (let i = common; i < desired.length; i++) {
|
|
51
|
+
const wrapper = desired[i];
|
|
52
|
+
stylesheet += `${AT_RULE_PREFIX[wrapper.kind]}${wrapper.value}{`;
|
|
53
|
+
openAtRules.push(wrapper);
|
|
54
|
+
}
|
|
55
|
+
if (style.type === "rule") {
|
|
56
|
+
const selector = composeSelector(`.${style.id}`.repeat(getPropertyPriority(style.property)), style.pseudo);
|
|
57
|
+
stylesheet += `${selector}{${style.property}:${style.value}}`;
|
|
58
|
+
} else {
|
|
59
|
+
if (!staticOpen) {
|
|
60
|
+
const selector = composeSelector(style.selector, style.pseudo);
|
|
61
|
+
stylesheet += `${selector}{`;
|
|
62
|
+
staticOpen = true;
|
|
63
|
+
}
|
|
64
|
+
stylesheet += `${style.property}:${style.value};`;
|
|
65
|
+
}
|
|
66
|
+
previousStyle = style;
|
|
67
|
+
}
|
|
68
|
+
if (staticOpen) stylesheet += "}";
|
|
69
|
+
while (openAtRules.length > 0) {
|
|
70
|
+
openAtRules.pop();
|
|
71
|
+
stylesheet += "}";
|
|
72
|
+
}
|
|
73
|
+
return stylesheet;
|
|
69
74
|
}
|
|
70
|
-
|
|
75
|
+
//#endregion
|
|
71
76
|
export { printStyleBlocks };
|
package/printers/sortAtRules.cjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let sort_css_media_queries_lib_create_sort_js = require("sort-css-media-queries/lib/create-sort.js");
|
|
4
|
+
sort_css_media_queries_lib_create_sort_js = require_runtime.__toESM(sort_css_media_queries_lib_create_sort_js);
|
|
5
|
+
//#region src/printers/sortAtRules.ts
|
|
6
|
+
const sortCSSMediaQueries = (0, sort_css_media_queries_lib_create_sort_js.default)();
|
|
6
7
|
function sortAtRules(blocks) {
|
|
7
|
-
|
|
8
|
+
return blocks.sort((a, b) => sortCSSMediaQueries(a.media, b.media) || sortCSSMediaQueries(a.container, b.container) || a.support.localeCompare(b.support));
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
//#endregion
|
|
10
11
|
exports.sortAtRules = sortAtRules;
|
package/printers/sortAtRules.mjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import createSort from "sort-css-media-queries/lib/create-sort.js";
|
|
5
|
+
//#region src/printers/sortAtRules.ts
|
|
3
6
|
const sortCSSMediaQueries = createSort();
|
|
4
7
|
function sortAtRules(blocks) {
|
|
5
|
-
|
|
8
|
+
return blocks.sort((a, b) => sortCSSMediaQueries(a.media, b.media) || sortCSSMediaQueries(a.container, b.container) || a.support.localeCompare(b.support));
|
|
6
9
|
}
|
|
7
|
-
|
|
10
|
+
//#endregion
|
|
8
11
|
export { sortAtRules };
|
package/processKeyframes.cjs
CHANGED
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const transformValuePropertyMap = {
|
|
7
|
-
content: transformContentProperty.transformContentProperty
|
|
8
|
-
};
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_helpers_isObject = require("./helpers/isObject.cjs");
|
|
3
|
+
//#region src/processKeyframes.ts
|
|
4
|
+
const transformValuePropertyMap = { content: require("./helpers/transformContentProperty.cjs").transformContentProperty };
|
|
9
5
|
function processKeyframes(keyframes) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
return newKeyframes;
|
|
6
|
+
const newKeyframes = {};
|
|
7
|
+
for (const [key, value] of Object.entries(keyframes)) {
|
|
8
|
+
if (require_helpers_isObject.isObject(value)) {
|
|
9
|
+
newKeyframes[key] = processKeyframes(value);
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
let newValue = value;
|
|
13
|
+
if (transformValuePropertyMap[key]) newValue = transformValuePropertyMap[key](newValue);
|
|
14
|
+
newKeyframes[key] = newValue;
|
|
15
|
+
}
|
|
16
|
+
return newKeyframes;
|
|
23
17
|
}
|
|
24
|
-
|
|
18
|
+
//#endregion
|
|
25
19
|
exports.processKeyframes = processKeyframes;
|