boss-css 0.0.21 → 0.0.23
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/dist/devtools-app/index.mjs +194 -194
- package/dist/merge/index.cjs +13 -275
- package/dist/merge/index.mjs +13 -275
- package/dist/tasks/postcss.cjs +8 -13
- package/dist/tasks/postcss.mjs +8 -13
- package/package.json +1 -1
package/dist/merge/index.cjs
CHANGED
|
@@ -6,25 +6,12 @@ _boss_css_is_css_prop = require_rolldown_runtime.__toESM(_boss_css_is_css_prop);
|
|
|
6
6
|
//#region src/merge/index.ts
|
|
7
7
|
const cssPropCache = /* @__PURE__ */ new Map();
|
|
8
8
|
const whitespaceRegexp = /\s/;
|
|
9
|
-
const borderSideVariants = [
|
|
10
|
-
"width",
|
|
11
|
-
"style",
|
|
12
|
-
"color"
|
|
13
|
-
];
|
|
14
|
-
const physicalSides = [
|
|
15
|
-
"top",
|
|
16
|
-
"right",
|
|
17
|
-
"bottom",
|
|
18
|
-
"left"
|
|
19
|
-
];
|
|
20
|
-
const logicalAxes = ["block", "inline"];
|
|
21
|
-
const logicalSides = logicalAxes.flatMap((axis) => [`${axis}-start`, `${axis}-end`]);
|
|
22
9
|
const defaultConfig = {
|
|
23
10
|
cacheSize: 500,
|
|
24
11
|
sortContexts: true,
|
|
25
12
|
orderSensitiveContexts: ["before", "after"],
|
|
26
13
|
compoundContexts: ["at", "container"],
|
|
27
|
-
conflictMap:
|
|
14
|
+
conflictMap: {}
|
|
28
15
|
};
|
|
29
16
|
const createBossMerge = (config = {}) => {
|
|
30
17
|
const resolved = resolveConfig(config);
|
|
@@ -84,13 +71,19 @@ const mergeClassList = (classList, config) => {
|
|
|
84
71
|
const parsedTokens = [];
|
|
85
72
|
const lastIndexByKey = /* @__PURE__ */ new Map();
|
|
86
73
|
for (const token of tokens.flatMap(expandGroupedSelector)) {
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
74
|
+
const parsed = parseToken(token);
|
|
75
|
+
if (parsed) {
|
|
76
|
+
const { contexts, prop } = parsed;
|
|
77
|
+
const contextKey = normalizeContexts(contexts, config).join(":");
|
|
78
|
+
const exactKey = buildKey(contextKey, prop);
|
|
79
|
+
const previousExactIndex = lastIndexByKey.get(exactKey);
|
|
80
|
+
if (previousExactIndex !== void 0) parsedTokens[previousExactIndex] = { value: "" };
|
|
81
|
+
const shorthandConflicts = config.conflictMap.get(prop);
|
|
82
|
+
if (shorthandConflicts?.length) for (const longhand of shorthandConflicts) {
|
|
83
|
+
const previousLonghandIndex = lastIndexByKey.get(buildKey(contextKey, longhand));
|
|
84
|
+
if (previousLonghandIndex !== void 0) parsedTokens[previousLonghandIndex] = { value: "" };
|
|
92
85
|
}
|
|
93
|
-
|
|
86
|
+
lastIndexByKey.set(exactKey, parsedTokens.length);
|
|
94
87
|
}
|
|
95
88
|
parsedTokens.push({ value: token });
|
|
96
89
|
}
|
|
@@ -207,16 +200,6 @@ const findGroupStart = (selector) => {
|
|
|
207
200
|
}
|
|
208
201
|
return -1;
|
|
209
202
|
};
|
|
210
|
-
const getConflictKeys = (token, config) => {
|
|
211
|
-
const parsed = parseToken(token);
|
|
212
|
-
if (!parsed) return null;
|
|
213
|
-
const { contexts, prop } = parsed;
|
|
214
|
-
const contextKey = normalizeContexts(contexts, config).join(":");
|
|
215
|
-
const keys = [buildKey(contextKey, prop)];
|
|
216
|
-
const longhands = config.conflictMap.get(prop);
|
|
217
|
-
if (longhands?.length) for (const longhand of longhands) keys.push(buildKey(contextKey, longhand));
|
|
218
|
-
return keys;
|
|
219
|
-
};
|
|
220
203
|
const parseToken = (token) => {
|
|
221
204
|
const grouped = parseGroupedSelector(token);
|
|
222
205
|
if (grouped) {
|
|
@@ -327,251 +310,6 @@ function createLruCache(maxCacheSize) {
|
|
|
327
310
|
}
|
|
328
311
|
};
|
|
329
312
|
}
|
|
330
|
-
function createDefaultConflictMap() {
|
|
331
|
-
const map = {};
|
|
332
|
-
map.margin = unique([
|
|
333
|
-
...physicalSides.map((side) => `margin-${side}`),
|
|
334
|
-
...logicalAxes.map((axis) => `margin-${axis}`),
|
|
335
|
-
...logicalSides.map((side) => `margin-${side}`)
|
|
336
|
-
]);
|
|
337
|
-
map["margin-block"] = ["margin-block-start", "margin-block-end"];
|
|
338
|
-
map["margin-inline"] = ["margin-inline-start", "margin-inline-end"];
|
|
339
|
-
map.padding = unique([
|
|
340
|
-
...physicalSides.map((side) => `padding-${side}`),
|
|
341
|
-
...logicalAxes.map((axis) => `padding-${axis}`),
|
|
342
|
-
...logicalSides.map((side) => `padding-${side}`)
|
|
343
|
-
]);
|
|
344
|
-
map["padding-block"] = ["padding-block-start", "padding-block-end"];
|
|
345
|
-
map["padding-inline"] = ["padding-inline-start", "padding-inline-end"];
|
|
346
|
-
map.inset = unique([
|
|
347
|
-
"top",
|
|
348
|
-
"right",
|
|
349
|
-
"bottom",
|
|
350
|
-
"left",
|
|
351
|
-
...logicalAxes.map((axis) => `inset-${axis}`),
|
|
352
|
-
...logicalSides.map((side) => `inset-${side}`)
|
|
353
|
-
]);
|
|
354
|
-
map["inset-block"] = ["inset-block-start", "inset-block-end"];
|
|
355
|
-
map["inset-inline"] = ["inset-inline-start", "inset-inline-end"];
|
|
356
|
-
const borderSideLonghands = (side) => borderSideVariants.map((variant) => `border-${side}-${variant}`);
|
|
357
|
-
const borderPhysicalSideLonghands = physicalSides.flatMap((side) => borderSideLonghands(side));
|
|
358
|
-
const borderLogicalSideLonghands = logicalSides.flatMap((side) => borderSideLonghands(side));
|
|
359
|
-
const borderAxisVariants = (axis) => borderSideVariants.map((variant) => `border-${axis}-${variant}`);
|
|
360
|
-
const borderAxisSides = (axis) => [`${axis}-start`, `${axis}-end`];
|
|
361
|
-
const borderAxisSideLonghands = (axis) => borderAxisSides(axis).flatMap((side) => borderSideLonghands(side));
|
|
362
|
-
const borderWidthLonghands = unique([
|
|
363
|
-
...physicalSides.map((side) => `border-${side}-width`),
|
|
364
|
-
...logicalSides.map((side) => `border-${side}-width`),
|
|
365
|
-
...logicalAxes.map((axis) => `border-${axis}-width`),
|
|
366
|
-
...logicalAxes.flatMap((axis) => borderAxisSides(axis).map((side) => `border-${side}-width`))
|
|
367
|
-
]);
|
|
368
|
-
const borderStyleLonghands = unique([
|
|
369
|
-
...physicalSides.map((side) => `border-${side}-style`),
|
|
370
|
-
...logicalSides.map((side) => `border-${side}-style`),
|
|
371
|
-
...logicalAxes.map((axis) => `border-${axis}-style`),
|
|
372
|
-
...logicalAxes.flatMap((axis) => borderAxisSides(axis).map((side) => `border-${side}-style`))
|
|
373
|
-
]);
|
|
374
|
-
const borderColorLonghands = unique([
|
|
375
|
-
...physicalSides.map((side) => `border-${side}-color`),
|
|
376
|
-
...logicalSides.map((side) => `border-${side}-color`),
|
|
377
|
-
...logicalAxes.map((axis) => `border-${axis}-color`),
|
|
378
|
-
...logicalAxes.flatMap((axis) => borderAxisSides(axis).map((side) => `border-${side}-color`))
|
|
379
|
-
]);
|
|
380
|
-
map.border = unique([
|
|
381
|
-
...physicalSides.map((side) => `border-${side}`),
|
|
382
|
-
...logicalSides.map((side) => `border-${side}`),
|
|
383
|
-
...logicalAxes.map((axis) => `border-${axis}`),
|
|
384
|
-
...borderPhysicalSideLonghands,
|
|
385
|
-
...borderLogicalSideLonghands,
|
|
386
|
-
...borderAxisVariants("block"),
|
|
387
|
-
...borderAxisVariants("inline"),
|
|
388
|
-
...borderAxisSideLonghands("block"),
|
|
389
|
-
...borderAxisSideLonghands("inline"),
|
|
390
|
-
"border-width",
|
|
391
|
-
"border-style",
|
|
392
|
-
"border-color"
|
|
393
|
-
]);
|
|
394
|
-
map["border-top"] = borderSideLonghands("top");
|
|
395
|
-
map["border-right"] = borderSideLonghands("right");
|
|
396
|
-
map["border-bottom"] = borderSideLonghands("bottom");
|
|
397
|
-
map["border-left"] = borderSideLonghands("left");
|
|
398
|
-
map["border-block"] = unique([
|
|
399
|
-
"border-block-start",
|
|
400
|
-
"border-block-end",
|
|
401
|
-
...borderAxisVariants("block"),
|
|
402
|
-
...borderAxisSideLonghands("block")
|
|
403
|
-
]);
|
|
404
|
-
map["border-inline"] = unique([
|
|
405
|
-
"border-inline-start",
|
|
406
|
-
"border-inline-end",
|
|
407
|
-
...borderAxisVariants("inline"),
|
|
408
|
-
...borderAxisSideLonghands("inline")
|
|
409
|
-
]);
|
|
410
|
-
map["border-block-start"] = borderSideLonghands("block-start");
|
|
411
|
-
map["border-block-end"] = borderSideLonghands("block-end");
|
|
412
|
-
map["border-inline-start"] = borderSideLonghands("inline-start");
|
|
413
|
-
map["border-inline-end"] = borderSideLonghands("inline-end");
|
|
414
|
-
map["border-width"] = borderWidthLonghands;
|
|
415
|
-
map["border-style"] = borderStyleLonghands;
|
|
416
|
-
map["border-color"] = borderColorLonghands;
|
|
417
|
-
map["border-block-width"] = ["border-block-start-width", "border-block-end-width"];
|
|
418
|
-
map["border-inline-width"] = ["border-inline-start-width", "border-inline-end-width"];
|
|
419
|
-
map["border-block-style"] = ["border-block-start-style", "border-block-end-style"];
|
|
420
|
-
map["border-inline-style"] = ["border-inline-start-style", "border-inline-end-style"];
|
|
421
|
-
map["border-block-color"] = ["border-block-start-color", "border-block-end-color"];
|
|
422
|
-
map["border-inline-color"] = ["border-inline-start-color", "border-inline-end-color"];
|
|
423
|
-
map["border-radius"] = [
|
|
424
|
-
"border-top-left-radius",
|
|
425
|
-
"border-top-right-radius",
|
|
426
|
-
"border-bottom-right-radius",
|
|
427
|
-
"border-bottom-left-radius",
|
|
428
|
-
"border-start-start-radius",
|
|
429
|
-
"border-start-end-radius",
|
|
430
|
-
"border-end-start-radius",
|
|
431
|
-
"border-end-end-radius"
|
|
432
|
-
];
|
|
433
|
-
map["border-image"] = [
|
|
434
|
-
"border-image-source",
|
|
435
|
-
"border-image-slice",
|
|
436
|
-
"border-image-width",
|
|
437
|
-
"border-image-outset",
|
|
438
|
-
"border-image-repeat"
|
|
439
|
-
];
|
|
440
|
-
map["background"] = [
|
|
441
|
-
"background-color",
|
|
442
|
-
"background-image",
|
|
443
|
-
"background-position",
|
|
444
|
-
"background-size",
|
|
445
|
-
"background-repeat",
|
|
446
|
-
"background-origin",
|
|
447
|
-
"background-clip",
|
|
448
|
-
"background-attachment"
|
|
449
|
-
];
|
|
450
|
-
map["background-position"] = ["background-position-x", "background-position-y"];
|
|
451
|
-
map["font"] = [
|
|
452
|
-
"font-style",
|
|
453
|
-
"font-variant",
|
|
454
|
-
"font-variant-ligatures",
|
|
455
|
-
"font-variant-caps",
|
|
456
|
-
"font-variant-numeric",
|
|
457
|
-
"font-variant-east-asian",
|
|
458
|
-
"font-weight",
|
|
459
|
-
"font-stretch",
|
|
460
|
-
"font-size",
|
|
461
|
-
"line-height",
|
|
462
|
-
"font-family"
|
|
463
|
-
];
|
|
464
|
-
map["font-variant"] = [
|
|
465
|
-
"font-variant-ligatures",
|
|
466
|
-
"font-variant-caps",
|
|
467
|
-
"font-variant-numeric",
|
|
468
|
-
"font-variant-east-asian"
|
|
469
|
-
];
|
|
470
|
-
map["list-style"] = [
|
|
471
|
-
"list-style-position",
|
|
472
|
-
"list-style-image",
|
|
473
|
-
"list-style-type"
|
|
474
|
-
];
|
|
475
|
-
map["grid"] = [
|
|
476
|
-
"grid-template",
|
|
477
|
-
"grid-template-rows",
|
|
478
|
-
"grid-template-columns",
|
|
479
|
-
"grid-template-areas",
|
|
480
|
-
"grid-auto-rows",
|
|
481
|
-
"grid-auto-columns",
|
|
482
|
-
"grid-auto-flow",
|
|
483
|
-
"grid-row",
|
|
484
|
-
"grid-row-start",
|
|
485
|
-
"grid-row-end",
|
|
486
|
-
"grid-column",
|
|
487
|
-
"grid-column-start",
|
|
488
|
-
"grid-column-end",
|
|
489
|
-
"grid-area"
|
|
490
|
-
];
|
|
491
|
-
map["grid-template"] = [
|
|
492
|
-
"grid-template-rows",
|
|
493
|
-
"grid-template-columns",
|
|
494
|
-
"grid-template-areas"
|
|
495
|
-
];
|
|
496
|
-
map["grid-row"] = ["grid-row-start", "grid-row-end"];
|
|
497
|
-
map["grid-column"] = ["grid-column-start", "grid-column-end"];
|
|
498
|
-
map["grid-area"] = [
|
|
499
|
-
"grid-row-start",
|
|
500
|
-
"grid-row-end",
|
|
501
|
-
"grid-column-start",
|
|
502
|
-
"grid-column-end"
|
|
503
|
-
];
|
|
504
|
-
map["flex"] = [
|
|
505
|
-
"flex-grow",
|
|
506
|
-
"flex-shrink",
|
|
507
|
-
"flex-basis"
|
|
508
|
-
];
|
|
509
|
-
map["flex-flow"] = ["flex-direction", "flex-wrap"];
|
|
510
|
-
map["gap"] = ["row-gap", "column-gap"];
|
|
511
|
-
map["overflow"] = ["overflow-x", "overflow-y"];
|
|
512
|
-
map["overscroll-behavior"] = ["overscroll-behavior-x", "overscroll-behavior-y"];
|
|
513
|
-
map["scroll-margin"] = unique([
|
|
514
|
-
...physicalSides.map((side) => `scroll-margin-${side}`),
|
|
515
|
-
...logicalAxes.map((axis) => `scroll-margin-${axis}`),
|
|
516
|
-
...logicalSides.map((side) => `scroll-margin-${side}`)
|
|
517
|
-
]);
|
|
518
|
-
map["scroll-margin-block"] = ["scroll-margin-block-start", "scroll-margin-block-end"];
|
|
519
|
-
map["scroll-margin-inline"] = ["scroll-margin-inline-start", "scroll-margin-inline-end"];
|
|
520
|
-
map["scroll-padding"] = unique([
|
|
521
|
-
...physicalSides.map((side) => `scroll-padding-${side}`),
|
|
522
|
-
...logicalAxes.map((axis) => `scroll-padding-${axis}`),
|
|
523
|
-
...logicalSides.map((side) => `scroll-padding-${side}`)
|
|
524
|
-
]);
|
|
525
|
-
map["scroll-padding-block"] = ["scroll-padding-block-start", "scroll-padding-block-end"];
|
|
526
|
-
map["scroll-padding-inline"] = ["scroll-padding-inline-start", "scroll-padding-inline-end"];
|
|
527
|
-
map["place-content"] = ["align-content", "justify-content"];
|
|
528
|
-
map["place-items"] = ["align-items", "justify-items"];
|
|
529
|
-
map["place-self"] = ["align-self", "justify-self"];
|
|
530
|
-
map["column-rule"] = [
|
|
531
|
-
"column-rule-width",
|
|
532
|
-
"column-rule-style",
|
|
533
|
-
"column-rule-color"
|
|
534
|
-
];
|
|
535
|
-
map["columns"] = ["column-width", "column-count"];
|
|
536
|
-
map["text-decoration"] = [
|
|
537
|
-
"text-decoration-line",
|
|
538
|
-
"text-decoration-style",
|
|
539
|
-
"text-decoration-color",
|
|
540
|
-
"text-decoration-thickness",
|
|
541
|
-
"text-decoration-skip-ink"
|
|
542
|
-
];
|
|
543
|
-
map["text-emphasis"] = [
|
|
544
|
-
"text-emphasis-style",
|
|
545
|
-
"text-emphasis-color",
|
|
546
|
-
"text-emphasis-position"
|
|
547
|
-
];
|
|
548
|
-
map["transition"] = [
|
|
549
|
-
"transition-property",
|
|
550
|
-
"transition-duration",
|
|
551
|
-
"transition-timing-function",
|
|
552
|
-
"transition-delay",
|
|
553
|
-
"transition-behavior"
|
|
554
|
-
];
|
|
555
|
-
map["animation"] = [
|
|
556
|
-
"animation-name",
|
|
557
|
-
"animation-duration",
|
|
558
|
-
"animation-timing-function",
|
|
559
|
-
"animation-delay",
|
|
560
|
-
"animation-iteration-count",
|
|
561
|
-
"animation-direction",
|
|
562
|
-
"animation-fill-mode",
|
|
563
|
-
"animation-play-state",
|
|
564
|
-
"animation-composition",
|
|
565
|
-
"animation-timeline",
|
|
566
|
-
"animation-range"
|
|
567
|
-
];
|
|
568
|
-
map["outline"] = [
|
|
569
|
-
"outline-color",
|
|
570
|
-
"outline-style",
|
|
571
|
-
"outline-width"
|
|
572
|
-
];
|
|
573
|
-
return map;
|
|
574
|
-
}
|
|
575
313
|
function normalizeConflictMap(conflictMap) {
|
|
576
314
|
const normalized = /* @__PURE__ */ new Map();
|
|
577
315
|
for (const [key, values] of Object.entries(conflictMap)) normalized.set(key, unique(values));
|
package/dist/merge/index.mjs
CHANGED
|
@@ -4,25 +4,12 @@ import isCSSProp from "@boss-css/is-css-prop";
|
|
|
4
4
|
//#region src/merge/index.ts
|
|
5
5
|
const cssPropCache = /* @__PURE__ */ new Map();
|
|
6
6
|
const whitespaceRegexp = /\s/;
|
|
7
|
-
const borderSideVariants = [
|
|
8
|
-
"width",
|
|
9
|
-
"style",
|
|
10
|
-
"color"
|
|
11
|
-
];
|
|
12
|
-
const physicalSides = [
|
|
13
|
-
"top",
|
|
14
|
-
"right",
|
|
15
|
-
"bottom",
|
|
16
|
-
"left"
|
|
17
|
-
];
|
|
18
|
-
const logicalAxes = ["block", "inline"];
|
|
19
|
-
const logicalSides = logicalAxes.flatMap((axis) => [`${axis}-start`, `${axis}-end`]);
|
|
20
7
|
const defaultConfig = {
|
|
21
8
|
cacheSize: 500,
|
|
22
9
|
sortContexts: true,
|
|
23
10
|
orderSensitiveContexts: ["before", "after"],
|
|
24
11
|
compoundContexts: ["at", "container"],
|
|
25
|
-
conflictMap:
|
|
12
|
+
conflictMap: {}
|
|
26
13
|
};
|
|
27
14
|
const createBossMerge = (config = {}) => {
|
|
28
15
|
const resolved = resolveConfig(config);
|
|
@@ -82,13 +69,19 @@ const mergeClassList = (classList, config) => {
|
|
|
82
69
|
const parsedTokens = [];
|
|
83
70
|
const lastIndexByKey = /* @__PURE__ */ new Map();
|
|
84
71
|
for (const token of tokens.flatMap(expandGroupedSelector)) {
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
72
|
+
const parsed = parseToken(token);
|
|
73
|
+
if (parsed) {
|
|
74
|
+
const { contexts, prop } = parsed;
|
|
75
|
+
const contextKey = normalizeContexts(contexts, config).join(":");
|
|
76
|
+
const exactKey = buildKey(contextKey, prop);
|
|
77
|
+
const previousExactIndex = lastIndexByKey.get(exactKey);
|
|
78
|
+
if (previousExactIndex !== void 0) parsedTokens[previousExactIndex] = { value: "" };
|
|
79
|
+
const shorthandConflicts = config.conflictMap.get(prop);
|
|
80
|
+
if (shorthandConflicts?.length) for (const longhand of shorthandConflicts) {
|
|
81
|
+
const previousLonghandIndex = lastIndexByKey.get(buildKey(contextKey, longhand));
|
|
82
|
+
if (previousLonghandIndex !== void 0) parsedTokens[previousLonghandIndex] = { value: "" };
|
|
90
83
|
}
|
|
91
|
-
|
|
84
|
+
lastIndexByKey.set(exactKey, parsedTokens.length);
|
|
92
85
|
}
|
|
93
86
|
parsedTokens.push({ value: token });
|
|
94
87
|
}
|
|
@@ -205,16 +198,6 @@ const findGroupStart = (selector) => {
|
|
|
205
198
|
}
|
|
206
199
|
return -1;
|
|
207
200
|
};
|
|
208
|
-
const getConflictKeys = (token, config) => {
|
|
209
|
-
const parsed = parseToken(token);
|
|
210
|
-
if (!parsed) return null;
|
|
211
|
-
const { contexts, prop } = parsed;
|
|
212
|
-
const contextKey = normalizeContexts(contexts, config).join(":");
|
|
213
|
-
const keys = [buildKey(contextKey, prop)];
|
|
214
|
-
const longhands = config.conflictMap.get(prop);
|
|
215
|
-
if (longhands?.length) for (const longhand of longhands) keys.push(buildKey(contextKey, longhand));
|
|
216
|
-
return keys;
|
|
217
|
-
};
|
|
218
201
|
const parseToken = (token) => {
|
|
219
202
|
const grouped = parseGroupedSelector(token);
|
|
220
203
|
if (grouped) {
|
|
@@ -325,251 +308,6 @@ function createLruCache(maxCacheSize) {
|
|
|
325
308
|
}
|
|
326
309
|
};
|
|
327
310
|
}
|
|
328
|
-
function createDefaultConflictMap() {
|
|
329
|
-
const map = {};
|
|
330
|
-
map.margin = unique([
|
|
331
|
-
...physicalSides.map((side) => `margin-${side}`),
|
|
332
|
-
...logicalAxes.map((axis) => `margin-${axis}`),
|
|
333
|
-
...logicalSides.map((side) => `margin-${side}`)
|
|
334
|
-
]);
|
|
335
|
-
map["margin-block"] = ["margin-block-start", "margin-block-end"];
|
|
336
|
-
map["margin-inline"] = ["margin-inline-start", "margin-inline-end"];
|
|
337
|
-
map.padding = unique([
|
|
338
|
-
...physicalSides.map((side) => `padding-${side}`),
|
|
339
|
-
...logicalAxes.map((axis) => `padding-${axis}`),
|
|
340
|
-
...logicalSides.map((side) => `padding-${side}`)
|
|
341
|
-
]);
|
|
342
|
-
map["padding-block"] = ["padding-block-start", "padding-block-end"];
|
|
343
|
-
map["padding-inline"] = ["padding-inline-start", "padding-inline-end"];
|
|
344
|
-
map.inset = unique([
|
|
345
|
-
"top",
|
|
346
|
-
"right",
|
|
347
|
-
"bottom",
|
|
348
|
-
"left",
|
|
349
|
-
...logicalAxes.map((axis) => `inset-${axis}`),
|
|
350
|
-
...logicalSides.map((side) => `inset-${side}`)
|
|
351
|
-
]);
|
|
352
|
-
map["inset-block"] = ["inset-block-start", "inset-block-end"];
|
|
353
|
-
map["inset-inline"] = ["inset-inline-start", "inset-inline-end"];
|
|
354
|
-
const borderSideLonghands = (side) => borderSideVariants.map((variant) => `border-${side}-${variant}`);
|
|
355
|
-
const borderPhysicalSideLonghands = physicalSides.flatMap((side) => borderSideLonghands(side));
|
|
356
|
-
const borderLogicalSideLonghands = logicalSides.flatMap((side) => borderSideLonghands(side));
|
|
357
|
-
const borderAxisVariants = (axis) => borderSideVariants.map((variant) => `border-${axis}-${variant}`);
|
|
358
|
-
const borderAxisSides = (axis) => [`${axis}-start`, `${axis}-end`];
|
|
359
|
-
const borderAxisSideLonghands = (axis) => borderAxisSides(axis).flatMap((side) => borderSideLonghands(side));
|
|
360
|
-
const borderWidthLonghands = unique([
|
|
361
|
-
...physicalSides.map((side) => `border-${side}-width`),
|
|
362
|
-
...logicalSides.map((side) => `border-${side}-width`),
|
|
363
|
-
...logicalAxes.map((axis) => `border-${axis}-width`),
|
|
364
|
-
...logicalAxes.flatMap((axis) => borderAxisSides(axis).map((side) => `border-${side}-width`))
|
|
365
|
-
]);
|
|
366
|
-
const borderStyleLonghands = unique([
|
|
367
|
-
...physicalSides.map((side) => `border-${side}-style`),
|
|
368
|
-
...logicalSides.map((side) => `border-${side}-style`),
|
|
369
|
-
...logicalAxes.map((axis) => `border-${axis}-style`),
|
|
370
|
-
...logicalAxes.flatMap((axis) => borderAxisSides(axis).map((side) => `border-${side}-style`))
|
|
371
|
-
]);
|
|
372
|
-
const borderColorLonghands = unique([
|
|
373
|
-
...physicalSides.map((side) => `border-${side}-color`),
|
|
374
|
-
...logicalSides.map((side) => `border-${side}-color`),
|
|
375
|
-
...logicalAxes.map((axis) => `border-${axis}-color`),
|
|
376
|
-
...logicalAxes.flatMap((axis) => borderAxisSides(axis).map((side) => `border-${side}-color`))
|
|
377
|
-
]);
|
|
378
|
-
map.border = unique([
|
|
379
|
-
...physicalSides.map((side) => `border-${side}`),
|
|
380
|
-
...logicalSides.map((side) => `border-${side}`),
|
|
381
|
-
...logicalAxes.map((axis) => `border-${axis}`),
|
|
382
|
-
...borderPhysicalSideLonghands,
|
|
383
|
-
...borderLogicalSideLonghands,
|
|
384
|
-
...borderAxisVariants("block"),
|
|
385
|
-
...borderAxisVariants("inline"),
|
|
386
|
-
...borderAxisSideLonghands("block"),
|
|
387
|
-
...borderAxisSideLonghands("inline"),
|
|
388
|
-
"border-width",
|
|
389
|
-
"border-style",
|
|
390
|
-
"border-color"
|
|
391
|
-
]);
|
|
392
|
-
map["border-top"] = borderSideLonghands("top");
|
|
393
|
-
map["border-right"] = borderSideLonghands("right");
|
|
394
|
-
map["border-bottom"] = borderSideLonghands("bottom");
|
|
395
|
-
map["border-left"] = borderSideLonghands("left");
|
|
396
|
-
map["border-block"] = unique([
|
|
397
|
-
"border-block-start",
|
|
398
|
-
"border-block-end",
|
|
399
|
-
...borderAxisVariants("block"),
|
|
400
|
-
...borderAxisSideLonghands("block")
|
|
401
|
-
]);
|
|
402
|
-
map["border-inline"] = unique([
|
|
403
|
-
"border-inline-start",
|
|
404
|
-
"border-inline-end",
|
|
405
|
-
...borderAxisVariants("inline"),
|
|
406
|
-
...borderAxisSideLonghands("inline")
|
|
407
|
-
]);
|
|
408
|
-
map["border-block-start"] = borderSideLonghands("block-start");
|
|
409
|
-
map["border-block-end"] = borderSideLonghands("block-end");
|
|
410
|
-
map["border-inline-start"] = borderSideLonghands("inline-start");
|
|
411
|
-
map["border-inline-end"] = borderSideLonghands("inline-end");
|
|
412
|
-
map["border-width"] = borderWidthLonghands;
|
|
413
|
-
map["border-style"] = borderStyleLonghands;
|
|
414
|
-
map["border-color"] = borderColorLonghands;
|
|
415
|
-
map["border-block-width"] = ["border-block-start-width", "border-block-end-width"];
|
|
416
|
-
map["border-inline-width"] = ["border-inline-start-width", "border-inline-end-width"];
|
|
417
|
-
map["border-block-style"] = ["border-block-start-style", "border-block-end-style"];
|
|
418
|
-
map["border-inline-style"] = ["border-inline-start-style", "border-inline-end-style"];
|
|
419
|
-
map["border-block-color"] = ["border-block-start-color", "border-block-end-color"];
|
|
420
|
-
map["border-inline-color"] = ["border-inline-start-color", "border-inline-end-color"];
|
|
421
|
-
map["border-radius"] = [
|
|
422
|
-
"border-top-left-radius",
|
|
423
|
-
"border-top-right-radius",
|
|
424
|
-
"border-bottom-right-radius",
|
|
425
|
-
"border-bottom-left-radius",
|
|
426
|
-
"border-start-start-radius",
|
|
427
|
-
"border-start-end-radius",
|
|
428
|
-
"border-end-start-radius",
|
|
429
|
-
"border-end-end-radius"
|
|
430
|
-
];
|
|
431
|
-
map["border-image"] = [
|
|
432
|
-
"border-image-source",
|
|
433
|
-
"border-image-slice",
|
|
434
|
-
"border-image-width",
|
|
435
|
-
"border-image-outset",
|
|
436
|
-
"border-image-repeat"
|
|
437
|
-
];
|
|
438
|
-
map["background"] = [
|
|
439
|
-
"background-color",
|
|
440
|
-
"background-image",
|
|
441
|
-
"background-position",
|
|
442
|
-
"background-size",
|
|
443
|
-
"background-repeat",
|
|
444
|
-
"background-origin",
|
|
445
|
-
"background-clip",
|
|
446
|
-
"background-attachment"
|
|
447
|
-
];
|
|
448
|
-
map["background-position"] = ["background-position-x", "background-position-y"];
|
|
449
|
-
map["font"] = [
|
|
450
|
-
"font-style",
|
|
451
|
-
"font-variant",
|
|
452
|
-
"font-variant-ligatures",
|
|
453
|
-
"font-variant-caps",
|
|
454
|
-
"font-variant-numeric",
|
|
455
|
-
"font-variant-east-asian",
|
|
456
|
-
"font-weight",
|
|
457
|
-
"font-stretch",
|
|
458
|
-
"font-size",
|
|
459
|
-
"line-height",
|
|
460
|
-
"font-family"
|
|
461
|
-
];
|
|
462
|
-
map["font-variant"] = [
|
|
463
|
-
"font-variant-ligatures",
|
|
464
|
-
"font-variant-caps",
|
|
465
|
-
"font-variant-numeric",
|
|
466
|
-
"font-variant-east-asian"
|
|
467
|
-
];
|
|
468
|
-
map["list-style"] = [
|
|
469
|
-
"list-style-position",
|
|
470
|
-
"list-style-image",
|
|
471
|
-
"list-style-type"
|
|
472
|
-
];
|
|
473
|
-
map["grid"] = [
|
|
474
|
-
"grid-template",
|
|
475
|
-
"grid-template-rows",
|
|
476
|
-
"grid-template-columns",
|
|
477
|
-
"grid-template-areas",
|
|
478
|
-
"grid-auto-rows",
|
|
479
|
-
"grid-auto-columns",
|
|
480
|
-
"grid-auto-flow",
|
|
481
|
-
"grid-row",
|
|
482
|
-
"grid-row-start",
|
|
483
|
-
"grid-row-end",
|
|
484
|
-
"grid-column",
|
|
485
|
-
"grid-column-start",
|
|
486
|
-
"grid-column-end",
|
|
487
|
-
"grid-area"
|
|
488
|
-
];
|
|
489
|
-
map["grid-template"] = [
|
|
490
|
-
"grid-template-rows",
|
|
491
|
-
"grid-template-columns",
|
|
492
|
-
"grid-template-areas"
|
|
493
|
-
];
|
|
494
|
-
map["grid-row"] = ["grid-row-start", "grid-row-end"];
|
|
495
|
-
map["grid-column"] = ["grid-column-start", "grid-column-end"];
|
|
496
|
-
map["grid-area"] = [
|
|
497
|
-
"grid-row-start",
|
|
498
|
-
"grid-row-end",
|
|
499
|
-
"grid-column-start",
|
|
500
|
-
"grid-column-end"
|
|
501
|
-
];
|
|
502
|
-
map["flex"] = [
|
|
503
|
-
"flex-grow",
|
|
504
|
-
"flex-shrink",
|
|
505
|
-
"flex-basis"
|
|
506
|
-
];
|
|
507
|
-
map["flex-flow"] = ["flex-direction", "flex-wrap"];
|
|
508
|
-
map["gap"] = ["row-gap", "column-gap"];
|
|
509
|
-
map["overflow"] = ["overflow-x", "overflow-y"];
|
|
510
|
-
map["overscroll-behavior"] = ["overscroll-behavior-x", "overscroll-behavior-y"];
|
|
511
|
-
map["scroll-margin"] = unique([
|
|
512
|
-
...physicalSides.map((side) => `scroll-margin-${side}`),
|
|
513
|
-
...logicalAxes.map((axis) => `scroll-margin-${axis}`),
|
|
514
|
-
...logicalSides.map((side) => `scroll-margin-${side}`)
|
|
515
|
-
]);
|
|
516
|
-
map["scroll-margin-block"] = ["scroll-margin-block-start", "scroll-margin-block-end"];
|
|
517
|
-
map["scroll-margin-inline"] = ["scroll-margin-inline-start", "scroll-margin-inline-end"];
|
|
518
|
-
map["scroll-padding"] = unique([
|
|
519
|
-
...physicalSides.map((side) => `scroll-padding-${side}`),
|
|
520
|
-
...logicalAxes.map((axis) => `scroll-padding-${axis}`),
|
|
521
|
-
...logicalSides.map((side) => `scroll-padding-${side}`)
|
|
522
|
-
]);
|
|
523
|
-
map["scroll-padding-block"] = ["scroll-padding-block-start", "scroll-padding-block-end"];
|
|
524
|
-
map["scroll-padding-inline"] = ["scroll-padding-inline-start", "scroll-padding-inline-end"];
|
|
525
|
-
map["place-content"] = ["align-content", "justify-content"];
|
|
526
|
-
map["place-items"] = ["align-items", "justify-items"];
|
|
527
|
-
map["place-self"] = ["align-self", "justify-self"];
|
|
528
|
-
map["column-rule"] = [
|
|
529
|
-
"column-rule-width",
|
|
530
|
-
"column-rule-style",
|
|
531
|
-
"column-rule-color"
|
|
532
|
-
];
|
|
533
|
-
map["columns"] = ["column-width", "column-count"];
|
|
534
|
-
map["text-decoration"] = [
|
|
535
|
-
"text-decoration-line",
|
|
536
|
-
"text-decoration-style",
|
|
537
|
-
"text-decoration-color",
|
|
538
|
-
"text-decoration-thickness",
|
|
539
|
-
"text-decoration-skip-ink"
|
|
540
|
-
];
|
|
541
|
-
map["text-emphasis"] = [
|
|
542
|
-
"text-emphasis-style",
|
|
543
|
-
"text-emphasis-color",
|
|
544
|
-
"text-emphasis-position"
|
|
545
|
-
];
|
|
546
|
-
map["transition"] = [
|
|
547
|
-
"transition-property",
|
|
548
|
-
"transition-duration",
|
|
549
|
-
"transition-timing-function",
|
|
550
|
-
"transition-delay",
|
|
551
|
-
"transition-behavior"
|
|
552
|
-
];
|
|
553
|
-
map["animation"] = [
|
|
554
|
-
"animation-name",
|
|
555
|
-
"animation-duration",
|
|
556
|
-
"animation-timing-function",
|
|
557
|
-
"animation-delay",
|
|
558
|
-
"animation-iteration-count",
|
|
559
|
-
"animation-direction",
|
|
560
|
-
"animation-fill-mode",
|
|
561
|
-
"animation-play-state",
|
|
562
|
-
"animation-composition",
|
|
563
|
-
"animation-timeline",
|
|
564
|
-
"animation-range"
|
|
565
|
-
];
|
|
566
|
-
map["outline"] = [
|
|
567
|
-
"outline-color",
|
|
568
|
-
"outline-style",
|
|
569
|
-
"outline-width"
|
|
570
|
-
];
|
|
571
|
-
return map;
|
|
572
|
-
}
|
|
573
311
|
function normalizeConflictMap(conflictMap) {
|
|
574
312
|
const normalized = /* @__PURE__ */ new Map();
|
|
575
313
|
for (const [key, values] of Object.entries(conflictMap)) normalized.set(key, unique(values));
|
package/dist/tasks/postcss.cjs
CHANGED
|
@@ -91,7 +91,6 @@ const runPostcss = async (root, result, options = {}) => {
|
|
|
91
91
|
promises.push(require_processFile.default(file));
|
|
92
92
|
});
|
|
93
93
|
const processedFiles = await Promise.allSettled(promises);
|
|
94
|
-
const onParseTasks = [];
|
|
95
94
|
for (const settled of processedFiles) {
|
|
96
95
|
if (settled.status !== "fulfilled") continue;
|
|
97
96
|
const processed = settled.value;
|
|
@@ -100,19 +99,15 @@ const runPostcss = async (root, result, options = {}) => {
|
|
|
100
99
|
const changedPath = value.path ? node_path.default.resolve(value.path) : null;
|
|
101
100
|
if (changedPath) api.css?.removeSource?.(changedPath);
|
|
102
101
|
const sourcePath = changedPath ?? value.path ?? "(unknown file)";
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
try {
|
|
103
|
+
await api.trigger("onParse", value);
|
|
104
|
+
} catch (parseError) {
|
|
105
|
+
const relativePath = node_path.default.relative(baseDir ?? process.cwd(), sourcePath);
|
|
106
|
+
const sourceLabel = relativePath && !relativePath.startsWith("..") ? relativePath : sourcePath;
|
|
107
|
+
const reason = parseError instanceof Error ? parseError.message : String(parseError ?? "Unknown parsing error");
|
|
108
|
+
result.warn(`[boss-css] Failed parsing ${sourceLabel}: ${reason}`, { plugin: "boss-postcss-plugin" });
|
|
109
|
+
}
|
|
107
110
|
}
|
|
108
|
-
(await Promise.allSettled(onParseTasks.map((task) => task.promise))).forEach((parseResult, index) => {
|
|
109
|
-
if (parseResult.status !== "rejected") return;
|
|
110
|
-
const task = onParseTasks[index];
|
|
111
|
-
const relativePath = node_path.default.relative(baseDir ?? process.cwd(), task.filePath);
|
|
112
|
-
const sourceLabel = relativePath && !relativePath.startsWith("..") ? relativePath : task.filePath;
|
|
113
|
-
const reason = parseResult.reason instanceof Error ? parseResult.reason.message : String(parseResult.reason ?? "Unknown parsing error");
|
|
114
|
-
result.warn(`[boss-css] Failed parsing ${sourceLabel}: ${reason}`, { plugin: "boss-postcss-plugin" });
|
|
115
|
-
});
|
|
116
111
|
const boundaryResult = await require_boundaries.resolveBoundaryOutputs(api, {
|
|
117
112
|
rootDir: baseDir ?? process.cwd(),
|
|
118
113
|
stylesheetPath,
|