@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.
Files changed (67) hide show
  1. package/_virtual/_rolldown/runtime.cjs +23 -0
  2. package/cache.cjs +26 -26
  3. package/cache.mjs +28 -24
  4. package/helpers/declarationsToBlock.cjs +10 -14
  5. package/helpers/declarationsToBlock.mjs +12 -12
  6. package/helpers/generateCombinedAtRules.cjs +5 -7
  7. package/helpers/generateCombinedAtRules.mjs +7 -5
  8. package/helpers/getPropertyPriority.cjs +221 -260
  9. package/helpers/getPropertyPriority.mjs +223 -258
  10. package/helpers/hyphenateProperty.cjs +8 -9
  11. package/helpers/hyphenateProperty.mjs +10 -7
  12. package/helpers/isContainerQuery.cjs +4 -4
  13. package/helpers/isContainerQuery.mjs +6 -2
  14. package/helpers/isMediaQuery.cjs +4 -4
  15. package/helpers/isMediaQuery.mjs +6 -2
  16. package/helpers/isNestedSelector.cjs +5 -5
  17. package/helpers/isNestedSelector.mjs +7 -3
  18. package/helpers/isObject.cjs +4 -4
  19. package/helpers/isObject.mjs +6 -2
  20. package/helpers/isSupportsQuery.cjs +4 -4
  21. package/helpers/isSupportsQuery.mjs +6 -2
  22. package/helpers/normalizeCSSVarsProperty.cjs +7 -11
  23. package/helpers/normalizeCSSVarsProperty.mjs +9 -9
  24. package/helpers/normalizeCSSVarsValue.cjs +6 -8
  25. package/helpers/normalizeCSSVarsValue.mjs +8 -6
  26. package/helpers/normalizeNestedProperty.cjs +5 -7
  27. package/helpers/normalizeNestedProperty.mjs +7 -5
  28. package/helpers/pixelifyProperties.cjs +50 -53
  29. package/helpers/pixelifyProperties.mjs +52 -51
  30. package/helpers/splitSelectorList.cjs +55 -0
  31. package/helpers/splitSelectorList.mjs +57 -0
  32. package/helpers/splitStyleBlocks.cjs +23 -25
  33. package/helpers/splitStyleBlocks.mjs +25 -23
  34. package/helpers/transformContentProperty.cjs +4 -5
  35. package/helpers/transformContentProperty.mjs +6 -3
  36. package/identifiers/IDGenerator.cjs +9 -9
  37. package/identifiers/IDGenerator.mjs +11 -7
  38. package/identifiers/alphaIDGenerator.cjs +23 -26
  39. package/identifiers/alphaIDGenerator.mjs +25 -24
  40. package/identifiers/propertyValueIDGenerator.cjs +18 -23
  41. package/identifiers/propertyValueIDGenerator.mjs +20 -21
  42. package/index.cjs +187 -238
  43. package/index.d.ts +91 -84
  44. package/index.mjs +184 -234
  45. package/package.json +1 -1
  46. package/printers/printFontFaces.cjs +7 -12
  47. package/printers/printFontFaces.mjs +9 -10
  48. package/printers/printKeyFrames.cjs +10 -16
  49. package/printers/printKeyFrames.mjs +12 -14
  50. package/printers/printSourceMap.cjs +34 -39
  51. package/printers/printSourceMap.mjs +36 -37
  52. package/printers/printStyleBlocks.cjs +71 -70
  53. package/printers/printStyleBlocks.mjs +73 -68
  54. package/printers/sortAtRules.cjs +8 -7
  55. package/printers/sortAtRules.mjs +7 -4
  56. package/processKeyframes.cjs +16 -22
  57. package/processKeyframes.mjs +19 -20
  58. package/processStyles.cjs +99 -105
  59. package/processStyles.mjs +101 -103
  60. package/types.cjs +0 -2
  61. package/types.mjs +4 -1
  62. package/wrappers/classList.cjs +4 -5
  63. package/wrappers/classList.mjs +6 -3
  64. package/wrappers/static.cjs +4 -5
  65. package/wrappers/static.mjs +6 -3
  66. package/printers/sortStatic.cjs +0 -7
  67. package/printers/sortStatic.mjs +0 -5
@@ -1,13 +1,12 @@
1
- import { declarationsToBlock } from '../helpers/declarationsToBlock.mjs';
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
- let fontFaces = '';
5
- for (const block of blocks){
6
- for (const rule of block.rule){
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
- 'use strict';
2
-
3
- var declarationsToBlock = require('../helpers/declarationsToBlock.cjs');
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
- let result = "";
8
- for(const animationState in keyframes){
9
- result += `${animationState}{${declarationsToBlock.declarationsToBlock(keyframes[animationState])}}`;
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
- let keyframes = '';
15
- for (const block of blocks){
16
- keyframes += `@keyframes ${block.id}{${keyframesToBlock(block.rule)}}`;
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 { declarationsToBlock } from '../helpers/declarationsToBlock.mjs';
2
-
3
- // https://github.com/styletron/styletron/blob/master/packages/styletron-engine-atomic/src/css.ts#L48
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
- let result = "";
6
- for(const animationState in keyframes){
7
- result += `${animationState}{${declarationsToBlock(keyframes[animationState])}}`;
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
- let keyframes = '';
13
- for (const block of blocks){
14
- keyframes += `@keyframes ${block.id}{${keyframesToBlock(block.rule)}}`;
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
- 'use strict';
2
-
3
- var sourceMap = require('source-map');
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
- if (content.length === 0) {
7
- return content;
8
- }
9
- const entries = Object.entries(sourceMapReferences);
10
- if (entries.length === 0) {
11
- return content;
12
- }
13
- const sourceMap$1 = new sourceMap.SourceMapGenerator({
14
- file: "navita.css",
15
- skipValidation: true
16
- });
17
- const references = entries.flatMap(([filePath, references])=>references.map((reference)=>({
18
- filePath,
19
- ...reference
20
- })));
21
- for (const reference of references){
22
- const { filePath , selector , line , column } = reference;
23
- const generatedColumn = content.length - 1;
24
- content += `${selector}{/* Only used for sourceMap */}`;
25
- sourceMap$1.addMapping({
26
- source: filePath,
27
- original: {
28
- line,
29
- column
30
- },
31
- generated: {
32
- line: 1,
33
- column: generatedColumn
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 { SourceMapGenerator } from 'source-map';
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
- if (content.length === 0) {
5
- return content;
6
- }
7
- const entries = Object.entries(sourceMapReferences);
8
- if (entries.length === 0) {
9
- return content;
10
- }
11
- const sourceMap = new SourceMapGenerator({
12
- file: "navita.css",
13
- skipValidation: true
14
- });
15
- const references = entries.flatMap(([filePath, references])=>references.map((reference)=>({
16
- filePath,
17
- ...reference
18
- })));
19
- for (const reference of references){
20
- const { filePath , selector , line , column } = reference;
21
- const generatedColumn = content.length - 1;
22
- content += `${selector}{/* Only used for sourceMap */}`;
23
- sourceMap.addMapping({
24
- source: filePath,
25
- original: {
26
- line,
27
- column
28
- },
29
- generated: {
30
- line: 1,
31
- column: generatedColumn
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
- 'use strict';
2
-
3
- var getPropertyPriority = require('../helpers/getPropertyPriority.cjs');
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
- let stylesheet = '';
7
- let previousStyle;
8
- for (const style of blocks){
9
- if (style.type === 'static' && previousStyle && (previousStyle.selector !== style.selector || previousStyle.pseudo !== style.pseudo || previousStyle.media !== style.media || previousStyle.support !== style.support || previousStyle.container !== style.container)) {
10
- stylesheet += '}';
11
- }
12
- // Close container queries:
13
- // 1. When the current style is not a container query, and the previous style was container query
14
- // 2. When the current style is a container query and the previous style was a container query with a different container query
15
- if (previousStyle && previousStyle.container && (!style.container || style.container !== previousStyle.container)) {
16
- stylesheet += '}';
17
- }
18
- // Close support queries:
19
- // 1. When the current style is not a support query, and the previous style was support query
20
- // 2. When the current style is a support query and the previous style was a support query with a different support query
21
- if (previousStyle && previousStyle.support && (!style.support || style.support !== previousStyle.support)) {
22
- stylesheet += '}';
23
- }
24
- // Close media queries:
25
- // 1. When the current style is not a media query, and the previous style was media query
26
- // 2. When the current style is a media query and the previous style was a media query with a different media query
27
- if (previousStyle && previousStyle.media && (!style.media || style.media !== previousStyle.media)) {
28
- stylesheet += '}';
29
- }
30
- // Only add media queries if the previous style was not the same media query
31
- if (style.media && previousStyle?.media !== style.media) {
32
- stylesheet += `@media ${style.media}{`;
33
- }
34
- // Only add support queries if the previous style was not the same support query
35
- if (style.support && previousStyle?.support !== style.support) {
36
- stylesheet += `@supports ${style.support}{`;
37
- }
38
- // Only add container queries if the previous style was not the same container query
39
- if (style.container && previousStyle?.container !== style.container) {
40
- stylesheet += `@container ${style.container}{`;
41
- }
42
- if (style.type === 'rule') {
43
- const className = `.${style.id}`.repeat(getPropertyPriority.getPropertyPriority(style.property));
44
- stylesheet += `${className}${style.pseudo}{`;
45
- } else if (style.type === 'static' && (previousStyle?.selector !== style.selector || previousStyle?.pseudo !== style.pseudo || previousStyle?.media !== style.media || previousStyle?.support !== style.support || previousStyle?.container !== style.container)) {
46
- // If static, we don't add pseudo selectors currently
47
- stylesheet += `${style.selector}${style.pseudo}{`;
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 { getPropertyPriority } from '../helpers/getPropertyPriority.mjs';
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
- let stylesheet = '';
5
- let previousStyle;
6
- for (const style of blocks){
7
- if (style.type === 'static' && previousStyle && (previousStyle.selector !== style.selector || previousStyle.pseudo !== style.pseudo || previousStyle.media !== style.media || previousStyle.support !== style.support || previousStyle.container !== style.container)) {
8
- stylesheet += '}';
9
- }
10
- // Close container queries:
11
- // 1. When the current style is not a container query, and the previous style was container query
12
- // 2. When the current style is a container query and the previous style was a container query with a different container query
13
- if (previousStyle && previousStyle.container && (!style.container || style.container !== previousStyle.container)) {
14
- stylesheet += '}';
15
- }
16
- // Close support queries:
17
- // 1. When the current style is not a support query, and the previous style was support query
18
- // 2. When the current style is a support query and the previous style was a support query with a different support query
19
- if (previousStyle && previousStyle.support && (!style.support || style.support !== previousStyle.support)) {
20
- stylesheet += '}';
21
- }
22
- // Close media queries:
23
- // 1. When the current style is not a media query, and the previous style was media query
24
- // 2. When the current style is a media query and the previous style was a media query with a different media query
25
- if (previousStyle && previousStyle.media && (!style.media || style.media !== previousStyle.media)) {
26
- stylesheet += '}';
27
- }
28
- // Only add media queries if the previous style was not the same media query
29
- if (style.media && previousStyle?.media !== style.media) {
30
- stylesheet += `@media ${style.media}{`;
31
- }
32
- // Only add support queries if the previous style was not the same support query
33
- if (style.support && previousStyle?.support !== style.support) {
34
- stylesheet += `@supports ${style.support}{`;
35
- }
36
- // Only add container queries if the previous style was not the same container query
37
- if (style.container && previousStyle?.container !== style.container) {
38
- stylesheet += `@container ${style.container}{`;
39
- }
40
- if (style.type === 'rule') {
41
- const className = `.${style.id}`.repeat(getPropertyPriority(style.property));
42
- stylesheet += `${className}${style.pseudo}{`;
43
- } else if (style.type === 'static' && (previousStyle?.selector !== style.selector || previousStyle?.pseudo !== style.pseudo || previousStyle?.media !== style.media || previousStyle?.support !== style.support || previousStyle?.container !== style.container)) {
44
- // If static, we don't add pseudo selectors currently
45
- stylesheet += `${style.selector}${style.pseudo}{`;
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 };
@@ -1,10 +1,11 @@
1
- 'use strict';
2
-
3
- var createSort = require('sort-css-media-queries/lib/create-sort.js');
4
-
5
- const sortCSSMediaQueries = createSort();
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
- return blocks.sort((a, b)=>sortCSSMediaQueries(a.media, b.media) || sortCSSMediaQueries(a.container, b.container) || a.support.localeCompare(b.support));
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;
@@ -1,8 +1,11 @@
1
- import createSort from 'sort-css-media-queries/lib/create-sort.js';
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
- return blocks.sort((a, b)=>sortCSSMediaQueries(a.media, b.media) || sortCSSMediaQueries(a.container, b.container) || a.support.localeCompare(b.support));
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 };
@@ -1,25 +1,19 @@
1
- 'use strict';
2
-
3
- var isObject = require('./helpers/isObject.cjs');
4
- var transformContentProperty = require('./helpers/transformContentProperty.cjs');
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
- const newKeyframes = {};
11
- for (const [key, value] of Object.entries(keyframes)){
12
- if (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;
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;