@navita/engine 0.0.10 → 0.0.11

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 (58) hide show
  1. package/cache.cjs +27 -0
  2. package/cache.mjs +25 -0
  3. package/helpers/declarationsToBlock.cjs +17 -0
  4. package/helpers/declarationsToBlock.mjs +15 -0
  5. package/helpers/generateCombinedAtRules.cjs +10 -0
  6. package/helpers/generateCombinedAtRules.mjs +8 -0
  7. package/helpers/getPropertyPriority.cjs +262 -0
  8. package/helpers/getPropertyPriority.mjs +260 -0
  9. package/helpers/hypenateProperty.cjs +11 -0
  10. package/helpers/hypenateProperty.mjs +9 -0
  11. package/helpers/isMediaQuery.cjs +7 -0
  12. package/helpers/isMediaQuery.mjs +5 -0
  13. package/helpers/isNestedSelector.cjs +8 -0
  14. package/helpers/isNestedSelector.mjs +6 -0
  15. package/helpers/isObject.cjs +7 -0
  16. package/helpers/isObject.mjs +5 -0
  17. package/helpers/isSupportsQuery.cjs +7 -0
  18. package/helpers/isSupportsQuery.mjs +5 -0
  19. package/helpers/normalizeCSSVarsProperty.cjs +15 -0
  20. package/helpers/normalizeCSSVarsProperty.mjs +13 -0
  21. package/helpers/normalizeNestedProperty.cjs +10 -0
  22. package/helpers/normalizeNestedProperty.mjs +8 -0
  23. package/helpers/pixelifyProperties.cjs +58 -0
  24. package/helpers/pixelifyProperties.mjs +56 -0
  25. package/helpers/splitStyleBlocks.cjs +19 -0
  26. package/helpers/splitStyleBlocks.mjs +17 -0
  27. package/helpers/transformContentProperty.cjs +8 -0
  28. package/helpers/transformContentProperty.mjs +6 -0
  29. package/identifiers/IDGenerator.cjs +10 -0
  30. package/identifiers/IDGenerator.mjs +8 -0
  31. package/identifiers/alphaIDGenerator.cjs +27 -0
  32. package/identifiers/alphaIDGenerator.mjs +25 -0
  33. package/identifiers/propertyValueIDGenerator.cjs +24 -0
  34. package/identifiers/propertyValueIDGenerator.mjs +22 -0
  35. package/index.cjs +226 -0
  36. package/index.mjs +27 -677
  37. package/package.json +2 -2
  38. package/printers/printFontFaces.cjs +16 -0
  39. package/printers/printFontFaces.mjs +14 -0
  40. package/printers/printKeyFrames.cjs +22 -0
  41. package/printers/printKeyFrames.mjs +20 -0
  42. package/printers/printSourceMap.cjs +42 -0
  43. package/printers/printSourceMap.mjs +40 -0
  44. package/printers/printStyleBlocks.cjs +60 -0
  45. package/printers/printStyleBlocks.mjs +58 -0
  46. package/printers/sortAtRules.cjs +10 -0
  47. package/printers/sortAtRules.mjs +8 -0
  48. package/printers/sortStatic.cjs +7 -0
  49. package/printers/sortStatic.mjs +5 -0
  50. package/processStyles.cjs +88 -0
  51. package/processStyles.mjs +86 -0
  52. package/types.cjs +2 -0
  53. package/types.mjs +1 -0
  54. package/wrappers/classList.cjs +6 -0
  55. package/wrappers/classList.mjs +4 -0
  56. package/wrappers/static.cjs +6 -0
  57. package/wrappers/static.mjs +4 -0
  58. package/index.js +0 -876
package/index.mjs CHANGED
@@ -1,682 +1,32 @@
1
1
  import path from 'node:path';
2
2
  import hash from '@emotion/hash';
3
- import { SourceMapGenerator } from 'source-map';
4
- import createSort from 'sort-css-media-queries/lib/create-sort.js';
5
-
6
- class Cache {
7
- constructor(_idGenerator){
8
- this._idGenerator = _idGenerator;
9
- this._items = {};
10
- }
11
- getOrStore(value) {
12
- const cacheKey = JSON.stringify(value);
13
- if (this._items[cacheKey]) {
14
- return this._items[cacheKey];
15
- }
16
- return this._items[cacheKey] = {
17
- id: this._idGenerator.next(value),
18
- ...value
19
- };
20
- }
21
- items(ids = undefined) {
22
- const items = Object.values(this._items);
23
- if (ids === undefined) {
24
- return items;
25
- }
26
- return items.filter((item)=>ids.includes(item.id));
27
- }
28
- }
29
-
30
- function isObject(val) {
31
- return val != null && typeof val === 'object' && Array.isArray(val) === false;
32
- }
33
-
34
- function splitStyleBlocks(blocks) {
35
- const atRules = [];
36
- const rules = [];
37
- for (const block of blocks){
38
- if (block.media || block.support) {
39
- atRules.push(block);
40
- } else {
41
- rules.push(block);
42
- }
43
- }
44
- return {
45
- atRules,
46
- rules
47
- };
48
- }
49
-
50
- class IDGenerator {
51
- counter = 1;
52
- next() {
53
- return this.counter++;
54
- }
55
- }
56
-
57
- const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
58
- const charLength = chars.length;
59
- class AlphaIDGenerator {
60
- constructor(blacklist = [
61
- 'ad'
62
- ]){
63
- this.blacklist = blacklist;
64
- this.counter = 1;
65
- }
66
- next() {
67
- const nextString = (id, className = '')=>{
68
- if (id <= charLength) {
69
- return chars[id - 1] + className;
70
- }
71
- return nextString(id / charLength | 0, chars[(id - 1) % charLength] + className);
72
- };
73
- let className;
74
- do {
75
- className = nextString(this.counter++);
76
- }while (this.blacklist.includes(className.toLowerCase()))
77
- return className;
78
- }
79
- }
80
-
81
- class PropertyValueIDGenerator {
82
- property = new AlphaIDGenerator();
83
- cache = {};
84
- next({ property , media ='' , support ='' , pseudo ='' , value }) {
85
- const propertyKey = `${media}${support}${pseudo}${property}`;
86
- if (this.cache[propertyKey] === undefined) {
87
- this.cache[propertyKey] = {
88
- key: this.property.next(),
89
- cache: {}
90
- };
91
- }
92
- const entry = this.cache[propertyKey];
93
- if (entry.cache[value] === undefined) {
94
- entry.cache[value] = Object.keys(entry.cache).length + 1;
95
- }
96
- return `${entry.key}${entry.cache[value]}`;
97
- }
98
- }
99
-
100
- // https://github.com/styletron/styletron/blob/b552ddc5050a8cc5eec84a46a299d937d3bb0112/packages/styletron-engine-atomic/src/hyphenate-style-name.ts
101
- const uppercasePattern = /[A-Z]/g;
102
- const msPattern = /^ms-/;
103
- const cache = {};
104
- function hyphenateProperty(property) {
105
- return property in cache ? cache[property] : cache[property] = property.replace(uppercasePattern, "-$&").toLowerCase().replace(msPattern, "-ms-");
106
- }
107
-
108
- // https://github.com/styletron/styletron/blob/b552ddc5050a8cc5eec84a46a299d937d3bb0112/packages/styletron-engine-atomic/src/css.ts#L36
109
- function declarationsToBlock(style) {
110
- let css = "";
111
- for(const prop in style){
112
- const val = style[prop];
113
- if (typeof val === "string" || typeof val === "number") {
114
- css += `${hyphenateProperty(prop)}:${val};`;
115
- }
116
- }
117
- return css.slice(0, -1);
118
- }
119
-
120
- function printFontFaces(blocks) {
121
- let fontFaces = '';
122
- for (const block of blocks){
123
- for (const rule of block.rule){
124
- fontFaces += `@font-face{font-family:${block.id};${declarationsToBlock(rule)}}`;
125
- }
126
- }
127
- return fontFaces;
128
- }
129
-
130
- // https://github.com/styletron/styletron/blob/master/packages/styletron-engine-atomic/src/css.ts#L48
131
- function keyframesToBlock(keyframes) {
132
- let result = "";
133
- for(const animationState in keyframes){
134
- result += `${animationState}{${declarationsToBlock(keyframes[animationState])}}`;
135
- }
136
- return result;
137
- }
138
- function printKeyFrames(blocks) {
139
- let keyframes = '';
140
- for (const block of blocks){
141
- keyframes += `@keyframes ${block.id}{${keyframesToBlock(block.rule)}}`;
142
- }
143
- return keyframes;
144
- }
145
-
146
- function printSourceMap(sourceMapReferences, content) {
147
- if (content.length === 0) {
148
- return content;
149
- }
150
- const entries = Object.entries(sourceMapReferences);
151
- if (entries.length === 0) {
152
- return content;
153
- }
154
- const sourceMap = new SourceMapGenerator({
155
- file: "navita.css",
156
- skipValidation: true
157
- });
158
- const references = entries.flatMap(([filePath, references])=>references.map((reference)=>({
159
- filePath,
160
- ...reference
161
- })));
162
- for (const reference of references){
163
- const { filePath , selector , line , column } = reference;
164
- const generatedColumn = content.length - 1;
165
- content += `${selector}{/* Only used for sourceMap */}`;
166
- sourceMap.addMapping({
167
- source: filePath,
168
- original: {
169
- line,
170
- column
171
- },
172
- generated: {
173
- line: 1,
174
- column: generatedColumn
175
- }
176
- });
177
- }
178
- const sourceMapContent = Buffer.from(sourceMap.toString()).toString('base64');
179
- content += `\n/*# sourceMappingURL=data:application/json;base64,${sourceMapContent} */`;
180
- return content;
181
- }
182
-
183
- /**
184
- * This list comes from:
185
- * https://github.com/callstack/linaria/blob/master/packages/atomic/src/processors/helpers/propertyPriority.ts
186
- */ const shorthandProperties = {
187
- // The `all` property resets everything, and should effectively have priority zero.
188
- // In practice, this can be achieved by using: div { all: ... } to have even less specificity, but to avoid duplicating all selectors, we just let it be
189
- // 'all': []
190
- animation: [
191
- 'animation-name',
192
- 'animation-duration',
193
- 'animation-timing-function',
194
- 'animation-delay',
195
- 'animation-iteration-count',
196
- 'animation-direction',
197
- 'animation-fill-mode',
198
- 'animation-play-state'
199
- ],
200
- background: [
201
- 'background-attachment',
202
- 'background-clip',
203
- 'background-color',
204
- 'background-image',
205
- 'background-origin',
206
- 'background-position',
207
- 'background-repeat',
208
- 'background-size'
209
- ],
210
- border: [
211
- 'border-color',
212
- 'border-style',
213
- 'border-width'
214
- ],
215
- 'border-block-end': [
216
- 'border-block-end-color',
217
- 'border-block-end-style',
218
- 'border-block-end-width'
219
- ],
220
- 'border-block-start': [
221
- 'border-block-start-color',
222
- 'border-block-start-style',
223
- 'border-block-start-width'
224
- ],
225
- 'border-bottom': [
226
- 'border-bottom-color',
227
- 'border-bottom-style',
228
- 'border-bottom-width'
229
- ],
230
- 'border-color': [
231
- 'border-bottom-color',
232
- 'border-left-color',
233
- 'border-right-color',
234
- 'border-top-color'
235
- ],
236
- 'border-image': [
237
- 'border-image-outset',
238
- 'border-image-repeat',
239
- 'border-image-slice',
240
- 'border-image-source',
241
- 'border-image-width'
242
- ],
243
- 'border-inline-end': [
244
- 'border-inline-end-color',
245
- 'border-inline-end-style',
246
- 'border-inline-end-width'
247
- ],
248
- 'border-inline-start': [
249
- 'border-inline-start-color',
250
- 'border-inline-start-style',
251
- 'border-inline-start-width'
252
- ],
253
- 'border-left': [
254
- 'border-left-color',
255
- 'border-left-style',
256
- 'border-left-width'
257
- ],
258
- 'border-radius': [
259
- 'border-top-left-radius',
260
- 'border-top-right-radius',
261
- 'border-bottom-right-radius',
262
- 'border-bottom-left-radius'
263
- ],
264
- 'border-right': [
265
- 'border-right-color',
266
- 'border-right-style',
267
- 'border-right-width'
268
- ],
269
- 'border-style': [
270
- 'border-bottom-style',
271
- 'border-left-style',
272
- 'border-right-style',
273
- 'border-top-style'
274
- ],
275
- 'border-top': [
276
- 'border-top-color',
277
- 'border-top-style',
278
- 'border-top-width'
279
- ],
280
- 'border-width': [
281
- 'border-bottom-width',
282
- 'border-left-width',
283
- 'border-right-width',
284
- 'border-top-width'
285
- ],
286
- 'column-rule': [
287
- 'column-rule-width',
288
- 'column-rule-style',
289
- 'column-rule-color'
290
- ],
291
- columns: [
292
- 'column-count',
293
- 'column-width'
294
- ],
295
- flex: [
296
- 'flex-grow',
297
- 'flex-shrink',
298
- 'flex-basis'
299
- ],
300
- 'flex-flow': [
301
- 'flex-direction',
302
- 'flex-wrap'
303
- ],
304
- font: [
305
- 'font-family',
306
- 'font-size',
307
- 'font-stretch',
308
- 'font-style',
309
- 'font-variant',
310
- 'font-weight',
311
- 'line-height'
312
- ],
313
- gap: [
314
- 'row-gap',
315
- 'column-gap'
316
- ],
317
- grid: [
318
- 'grid-auto-columns',
319
- 'grid-auto-flow',
320
- 'grid-auto-rows',
321
- 'grid-template-areas',
322
- 'grid-template-columns',
323
- 'grid-template-rows'
324
- ],
325
- 'grid-area': [
326
- 'grid-row-start',
327
- 'grid-column-start',
328
- 'grid-row-end',
329
- 'grid-column-end'
330
- ],
331
- 'grid-column': [
332
- 'grid-column-end',
333
- 'grid-column-start'
334
- ],
335
- 'grid-row': [
336
- 'grid-row-end',
337
- 'grid-row-start'
338
- ],
339
- 'grid-template': [
340
- 'grid-template-areas',
341
- 'grid-template-columns',
342
- 'grid-template-rows'
343
- ],
344
- 'list-style': [
345
- 'list-style-image',
346
- 'list-style-position',
347
- 'list-style-type'
348
- ],
349
- margin: [
350
- 'margin-bottom',
351
- 'margin-left',
352
- 'margin-right',
353
- 'margin-top'
354
- ],
355
- mask: [
356
- 'mask-clip',
357
- 'mask-composite',
358
- 'mask-image',
359
- 'mask-mode',
360
- 'mask-origin',
361
- 'mask-position',
362
- 'mask-repeat',
363
- 'mask-size'
364
- ],
365
- offset: [
366
- 'offset-anchor',
367
- 'offset-distance',
368
- 'offset-path',
369
- 'offset-position',
370
- 'offset-rotate'
371
- ],
372
- outline: [
373
- 'outline-color',
374
- 'outline-style',
375
- 'outline-width'
376
- ],
377
- overflow: [
378
- 'overflow-x',
379
- 'overflow-y'
380
- ],
381
- padding: [
382
- 'padding-bottom',
383
- 'padding-left',
384
- 'padding-right',
385
- 'padding-top'
386
- ],
387
- 'place-content': [
388
- 'align-content',
389
- 'justify-content'
390
- ],
391
- 'place-items': [
392
- 'align-items',
393
- 'justify-items'
394
- ],
395
- 'place-self': [
396
- 'align-self',
397
- 'justify-self'
398
- ],
399
- 'scroll-margin': [
400
- 'scroll-margin-bottom',
401
- 'scroll-margin-left',
402
- 'scroll-margin-right',
403
- 'scroll-margin-top'
404
- ],
405
- 'scroll-padding': [
406
- 'scroll-padding-bottom',
407
- 'scroll-padding-left',
408
- 'scroll-padding-right',
409
- 'scroll-padding-top'
410
- ],
411
- 'text-decoration': [
412
- 'text-decoration-color',
413
- 'text-decoration-line',
414
- 'text-decoration-style',
415
- 'text-decoration-thickness'
416
- ],
417
- 'text-emphasis': [
418
- 'text-emphasis-color',
419
- 'text-emphasis-style'
420
- ],
421
- transition: [
422
- 'transition-delay',
423
- 'transition-duration',
424
- 'transition-property',
425
- 'transition-timing-function'
426
- ]
427
- };
428
- const longhands = Object.values(shorthandProperties).reduce((a, b)=>[
429
- ...a,
430
- ...b
431
- ], []);
432
- /**
433
- * The concept here is that shorthand properties, such as "border" gets
434
- * a priority of one, while longhand properties, such as "border-color" gets
435
- * a priority of 2.
436
- *
437
- * Read more:
438
- * @see https://weser.io/blog/the-shorthand-longhand-problem-in-atomic-css
439
- * @see https://www.w3.org/TR/selectors-3/#specificity
440
- */ const getPropertyPriority = (property)=>longhands.includes(property) ? 2 : 1;
441
-
442
- function printStyleBlocks(blocks) {
443
- let stylesheet = '';
444
- let previousStyle;
445
- for (const style of blocks){
446
- if (style.type === 'static' && previousStyle && (previousStyle.selector !== style.selector || previousStyle.pseudo !== style.pseudo || previousStyle.media !== style.media || previousStyle.support !== style.support)) {
447
- stylesheet += '}';
448
- }
449
- // Close support queries:
450
- // 1. When the current style is not a support query, and the previous style was support query
451
- // 2. When the current style is a support query and the previous style was a support query with a different support query
452
- if (previousStyle && previousStyle.support && (!style.support || style.support !== previousStyle.support)) {
453
- stylesheet += '}';
454
- }
455
- // Close media queries:
456
- // 1. When the current style is not a media query, and the previous style was media query
457
- // 2. When the current style is a media query and the previous style was a media query with a different media query
458
- if (previousStyle && previousStyle.media && (!style.media || style.media !== previousStyle.media)) {
459
- stylesheet += '}';
460
- }
461
- // Only add media queries if the previous style was not the same media query
462
- if (style.media && previousStyle?.media !== style.media) {
463
- stylesheet += `@media ${style.media}{`;
464
- }
465
- // Only add support queries if the previous style was not the same support query
466
- if (style.support && previousStyle?.support !== style.support) {
467
- stylesheet += `@supports ${style.support}{`;
468
- }
469
- if (style.type === 'rule') {
470
- const className = `.${style.id}`.repeat(getPropertyPriority(style.property));
471
- stylesheet += `${className}${style.pseudo}{`;
472
- } else if (style.type === 'static' && (previousStyle?.selector !== style.selector || previousStyle?.pseudo !== style.pseudo || previousStyle?.media !== style.media || previousStyle?.support !== style.support)) {
473
- // If static, we don't add pseudo selectors currently
474
- stylesheet += `${style.selector}${style.pseudo}{`;
475
- }
476
- stylesheet += `${style.property}:${style.value}`;
477
- if (style.type === 'static') {
478
- stylesheet += ';';
479
- }
480
- if (style.type === 'rule') {
481
- stylesheet += '}';
482
- }
483
- previousStyle = style;
484
- }
485
- if (previousStyle?.support) {
486
- stylesheet += '}';
487
- }
488
- if (previousStyle?.media) {
489
- stylesheet += '}';
490
- }
491
- if (previousStyle?.type === 'static') {
492
- stylesheet += '}';
493
- }
494
- return stylesheet;
495
- }
496
-
497
- const sortCSSMediaQueries = createSort();
498
- function sortAtRules(blocks) {
499
- return blocks.sort((a, b)=>sortCSSMediaQueries(a.media, b.media) || a.support.localeCompare(b.support));
500
- }
501
-
502
- function generateCombinedAtRules(currentMediaQuery, nestedMediaQuery) {
503
- if (currentMediaQuery.length === 0) {
504
- return nestedMediaQuery;
505
- }
506
- return `${currentMediaQuery} and ${nestedMediaQuery}`;
507
- }
508
-
509
- function isMediaQuery(property) {
510
- return property.startsWith('@media');
511
- }
512
-
513
- const regex$1 = /^([:\[>&])/;
514
- function isNestedSelector(property) {
515
- return regex$1.test(property);
516
- }
517
-
518
- function isSupportsQuery(property) {
519
- return property.startsWith("@supports");
520
- }
521
-
522
- const regex = /var\(([^,]+).*\)/;
523
- function normalizeCSSVarsProperty(property) {
524
- if (!property.startsWith('var(')) {
525
- return property;
526
- }
527
- const matches = property.match(regex);
528
- if (!matches) {
529
- return property;
530
- }
531
- return matches[1];
532
- }
533
-
534
- function normalizeNestedProperty(nestedProperty) {
535
- if (nestedProperty.charAt(0) === '&') {
536
- return nestedProperty.slice(1);
537
- }
538
- return nestedProperty;
539
- }
540
-
541
- const UNITLESS = {
542
- animationIterationCount: true,
543
- borderImage: true,
544
- borderImageOutset: true,
545
- borderImageSlice: true,
546
- borderImageWidth: true,
547
- boxFlex: true,
548
- boxFlexGroup: true,
549
- columnCount: true,
550
- columns: true,
551
- flex: true,
552
- flexGrow: true,
553
- flexShrink: true,
554
- fontWeight: true,
555
- gridArea: true,
556
- gridColumn: true,
557
- gridColumnEnd: true,
558
- gridColumnStart: true,
559
- gridRow: true,
560
- gridRowEnd: true,
561
- gridRowStart: true,
562
- initialLetter: true,
563
- lineClamp: true,
564
- lineHeight: true,
565
- maxLines: true,
566
- opacity: true,
567
- order: true,
568
- orphans: true,
569
- scale: true,
570
- tabSize: true,
571
- WebkitLineClamp: true,
572
- widows: true,
573
- zIndex: true,
574
- zoom: true,
575
- // svg properties
576
- fillOpacity: true,
577
- floodOpacity: true,
578
- maskBorder: true,
579
- maskBorderOutset: true,
580
- maskBorderSlice: true,
581
- maskBorderWidth: true,
582
- shapeImageThreshold: true,
583
- stopOpacity: true,
584
- strokeDashoffset: true,
585
- strokeMiterlimit: true,
586
- strokeOpacity: true,
587
- strokeWidth: true
588
- };
589
- function pixelifyProperties(property, value) {
590
- if (value !== 0 && !UNITLESS[property]) {
591
- return `${value}px`;
592
- }
593
- return value;
594
- }
595
-
596
- // https://github.com/vanilla-extract-css/vanilla-extract/blob/40d7e72c041989a4dc847dc66b94a4c680b5536e/packages/css/src/transformCss.ts#L277
597
- function transformContentProperty(value) {
598
- return value && (value.includes('"') || value.includes("'") || /^([A-Za-z\-]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)(\s|$)/.test(value)) ? value : `"${value}"`;
599
- }
600
-
601
- const transformValuePropertyMap = {
602
- content: transformContentProperty
603
- };
604
- function processStyles({ cache , type }) {
605
- return function process({ styles , pseudo ="" , media ="" , support ="" , selector ="" }) {
606
- const result = [];
607
- for (const [property, value] of Object.entries(styles)){
608
- if (isObject(value)) {
609
- if (isMediaQuery(property)) {
610
- const combinedMedia = generateCombinedAtRules(media, property.slice(6).trim());
611
- result.push(...process({
612
- styles: value,
613
- pseudo,
614
- media: combinedMedia,
615
- support,
616
- selector
617
- }));
618
- } else if (isSupportsQuery(property)) {
619
- const combinedSupport = generateCombinedAtRules(support, property.slice(9).trim());
620
- result.push(...process({
621
- styles: value,
622
- pseudo,
623
- media,
624
- support: combinedSupport,
625
- selector
626
- }));
627
- } else if (isNestedSelector(property)) {
628
- // This is only allowed in simple pseudos currently.
629
- const copies = property.split(',').map((p)=>p.trim());
630
- for (const copy of copies){
631
- result.push(...process({
632
- styles: value,
633
- pseudo: pseudo + normalizeNestedProperty(copy),
634
- media,
635
- support,
636
- selector
637
- }));
638
- }
639
- } else {
640
- console.warn("Unknown property", property);
641
- }
642
- } else {
643
- let newProperty = normalizeCSSVarsProperty(property);
644
- let newValue = value;
645
- if (typeof value === "string") {
646
- newValue = value.trim().replace(/;[\n\s]*$/, "");
647
- }
648
- // Check if value starts with --, if so, wrap in var()
649
- if (typeof newValue === "string" && newValue.startsWith("--")) {
650
- newValue = `var(${value})`;
651
- }
652
- if (typeof value === "number") {
653
- newValue = pixelifyProperties(newProperty, value);
654
- }
655
- if (transformValuePropertyMap[newProperty]) {
656
- newValue = transformValuePropertyMap[newProperty](value);
657
- }
658
- newProperty = hyphenateProperty(newProperty);
659
- // Remove trailing semicolon and new lines with regex
660
- result.push(cache.getOrStore({
661
- type,
662
- selector,
663
- property: newProperty,
664
- value: newValue,
665
- pseudo,
666
- media,
667
- support
668
- }));
669
- }
670
- }
671
- return result;
672
- };
673
- }
674
-
675
- class ClassList extends String {
676
- }
677
-
678
- class Static {
679
- }
3
+ import { Cache } from './cache.mjs';
4
+ import { isObject } from './helpers/isObject.mjs';
5
+ import { splitStyleBlocks } from './helpers/splitStyleBlocks.mjs';
6
+ import { IDGenerator } from './identifiers/IDGenerator.mjs';
7
+ import { AlphaIDGenerator } from './identifiers/alphaIDGenerator.mjs';
8
+ import { PropertyValueIDGenerator } from './identifiers/propertyValueIDGenerator.mjs';
9
+ import { printFontFaces } from './printers/printFontFaces.mjs';
10
+ import { printKeyFrames } from './printers/printKeyFrames.mjs';
11
+ import { printSourceMap } from './printers/printSourceMap.mjs';
12
+ import { printStyleBlocks } from './printers/printStyleBlocks.mjs';
13
+ import { sortAtRules } from './printers/sortAtRules.mjs';
14
+ import { processStyles } from './processStyles.mjs';
15
+ import { ClassList } from './wrappers/classList.mjs';
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';
680
30
 
681
31
  const defaultOptions = {
682
32
  enableSourceMaps: false,