@onereach/styles 27.0.2-beta.6105.0 → 27.0.2-beta.6106.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/styles",
|
|
3
|
-
"version": "27.0.2-beta.
|
|
3
|
+
"version": "27.0.2-beta.6106.0",
|
|
4
4
|
"description": "Styles for or-ui-next",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"test:contract": "node --test tests/*.test.cjs"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@onereach/font-icons": "^27.0.2-beta.
|
|
44
|
+
"@onereach/font-icons": "^27.0.2-beta.6106.0",
|
|
45
45
|
"postcss-nested": "6.2.0",
|
|
46
46
|
"tailwindcss": "4.3.2"
|
|
47
47
|
},
|
|
@@ -23,6 +23,17 @@ const legacySpacingUtilityPattern = /^-?(?:p(?:[xytrblse])?|m(?:[xytrblse])?|gap
|
|
|
23
23
|
const responsiveVariantOrder = new Map(
|
|
24
24
|
['xs', ...Object.keys(screens)].map((variant, index) => [variant, index]),
|
|
25
25
|
);
|
|
26
|
+
const legacyPseudoElementVariants = new Map([
|
|
27
|
+
['after', '::after'],
|
|
28
|
+
['backdrop', '::backdrop'],
|
|
29
|
+
['before', '::before'],
|
|
30
|
+
['file', '::file-selector-button'],
|
|
31
|
+
['first-letter', '::first-letter'],
|
|
32
|
+
['first-line', '::first-line'],
|
|
33
|
+
['marker', '::marker'],
|
|
34
|
+
['placeholder', '::placeholder'],
|
|
35
|
+
['selection', '::selection'],
|
|
36
|
+
]);
|
|
26
37
|
const legacyTransformValue = [
|
|
27
38
|
'translate(var(--tw-translate-x, 0), var(--tw-translate-y, 0))',
|
|
28
39
|
'rotate(var(--tw-rotate, 0))',
|
|
@@ -61,6 +72,20 @@ const legacyComponentFactoryNames = [
|
|
|
61
72
|
'typography',
|
|
62
73
|
'layout',
|
|
63
74
|
].sort((left, right) => right.length - left.length);
|
|
75
|
+
const legacyComponentFactoryOrder = new Map([
|
|
76
|
+
'layout',
|
|
77
|
+
'typography',
|
|
78
|
+
'iconography',
|
|
79
|
+
'theme-preset-1',
|
|
80
|
+
'theme-preset-2',
|
|
81
|
+
'theme-preset-3',
|
|
82
|
+
'theme-preset-4',
|
|
83
|
+
'theme-foreground',
|
|
84
|
+
'theme-background',
|
|
85
|
+
'theme-border',
|
|
86
|
+
'theme-divider',
|
|
87
|
+
'theme-outline',
|
|
88
|
+
].map((factory, index) => [factory, index]));
|
|
64
89
|
const legacyCoreUtilities = new Map([
|
|
65
90
|
['leading-none', [
|
|
66
91
|
['line-height', '1'],
|
|
@@ -120,17 +145,24 @@ function tailwindV4Compat() {
|
|
|
120
145
|
|
|
121
146
|
utilityLayers(root).forEach((layer) => {
|
|
122
147
|
restoreLegacyGroupHover(layer);
|
|
148
|
+
restoreLegacyPseudoElementStateOrder(layer);
|
|
123
149
|
restoreStackedVariantOrder(layer);
|
|
124
150
|
restoreLegacySpacingClassNames(layer);
|
|
125
151
|
restoreImportantDeclarations(layer);
|
|
126
152
|
restoreLegacyCoreUtilities(layer);
|
|
153
|
+
restoreLegacyBorderWidthUtilities(layer);
|
|
127
154
|
restoreLegacyTransformUtilities(layer);
|
|
128
155
|
restoreArbitraryValueOrder(layer);
|
|
129
156
|
reorderLegacyComponentValueSiblings(layer);
|
|
130
157
|
reorderLegacyStateVariantSiblings(layer);
|
|
158
|
+
reorderLegacyOutlineSiblings(layer);
|
|
131
159
|
reorderResponsiveVariantSiblings(layer);
|
|
132
160
|
});
|
|
133
161
|
restoreLegacyComponentLayers(root);
|
|
162
|
+
componentLayers(root).forEach((layer) => {
|
|
163
|
+
reorderLegacyComponentFactorySiblings(layer);
|
|
164
|
+
reorderResponsiveVariantSiblings(layer);
|
|
165
|
+
});
|
|
134
166
|
},
|
|
135
167
|
};
|
|
136
168
|
}
|
|
@@ -142,8 +174,7 @@ function restoreNestedVariantOrder(root) {
|
|
|
142
174
|
const variants = classSegments(className).slice(0, -1);
|
|
143
175
|
const arbitraryIndex = variants.findIndex((variant) => variant.startsWith('[&'));
|
|
144
176
|
|
|
145
|
-
return variants.includes('children')
|
|
146
|
-
|| arbitraryIndex > 0;
|
|
177
|
+
return variants.includes('children') || arbitraryIndex > 0;
|
|
147
178
|
});
|
|
148
179
|
|
|
149
180
|
if (!candidate) return;
|
|
@@ -233,6 +264,16 @@ function utilityLayers(root) {
|
|
|
233
264
|
return layers;
|
|
234
265
|
}
|
|
235
266
|
|
|
267
|
+
function componentLayers(root) {
|
|
268
|
+
const layers = [];
|
|
269
|
+
|
|
270
|
+
root.walkAtRules('layer', (layer) => {
|
|
271
|
+
if (layer.params.trim() === 'components') layers.push(layer);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
return layers;
|
|
275
|
+
}
|
|
276
|
+
|
|
236
277
|
function restoreLegacyComponentLayers(root) {
|
|
237
278
|
utilityLayers(root).forEach((utilityLayer) => {
|
|
238
279
|
const componentNodes = extractLegacyComponentNodes(utilityLayer);
|
|
@@ -340,6 +381,56 @@ function reorderLegacyComponentValueSiblings(container) {
|
|
|
340
381
|
});
|
|
341
382
|
}
|
|
342
383
|
|
|
384
|
+
function reorderLegacyComponentFactorySiblings(container) {
|
|
385
|
+
const nodes = container.nodes ?? [];
|
|
386
|
+
const componentNodes = nodes.flatMap((node, index) => {
|
|
387
|
+
const selectors = [];
|
|
388
|
+
|
|
389
|
+
if (node.type === 'rule') selectors.push(node.selector);
|
|
390
|
+
node.walkRules?.((rule) => selectors.push(rule.selector));
|
|
391
|
+
|
|
392
|
+
const selectorClassNames = selectors.flatMap(classNames);
|
|
393
|
+
const factory = selectorClassNames
|
|
394
|
+
.map(baseUtility)
|
|
395
|
+
.flatMap((utility) => [...legacyComponentFactoryOrder.keys()]
|
|
396
|
+
.filter((candidate) => utility.startsWith(`${candidate}-`)))
|
|
397
|
+
.at(0);
|
|
398
|
+
|
|
399
|
+
if (!factory) return [];
|
|
400
|
+
|
|
401
|
+
return [{
|
|
402
|
+
index,
|
|
403
|
+
node,
|
|
404
|
+
order: legacyComponentFactoryOrder.get(factory),
|
|
405
|
+
state: selectorClassNames.some((className) => (
|
|
406
|
+
classSegments(className)
|
|
407
|
+
.slice(0, -1)
|
|
408
|
+
.some((segment) => legacyStateVariantOrder.has(segment))
|
|
409
|
+
)),
|
|
410
|
+
}];
|
|
411
|
+
});
|
|
412
|
+
const componentSet = new Set(componentNodes.map(({ node }) => node));
|
|
413
|
+
const sorted = [...componentNodes].sort((left, right) => (
|
|
414
|
+
Number(left.state) - Number(right.state)
|
|
415
|
+
|| left.order - right.order
|
|
416
|
+
|| left.index - right.index
|
|
417
|
+
));
|
|
418
|
+
|
|
419
|
+
if (componentNodes.length > 0) {
|
|
420
|
+
container.nodes = [
|
|
421
|
+
...nodes.filter((node) => !componentSet.has(node)),
|
|
422
|
+
...sorted.map(({ node }) => node),
|
|
423
|
+
];
|
|
424
|
+
container.nodes.forEach((node) => {
|
|
425
|
+
node.parent = container;
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
container.nodes?.forEach((node) => {
|
|
430
|
+
if (node.nodes) reorderLegacyComponentFactorySiblings(node);
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
|
|
343
434
|
function restoreStackedVariantOrder(root) {
|
|
344
435
|
root.walkRules((rule) => {
|
|
345
436
|
const candidate = classNames(rule.selector)
|
|
@@ -481,6 +572,25 @@ function restoreLegacyCoreUtilities(root) {
|
|
|
481
572
|
});
|
|
482
573
|
}
|
|
483
574
|
|
|
575
|
+
function restoreLegacyBorderWidthUtilities(root) {
|
|
576
|
+
root.walkRules((rule) => {
|
|
577
|
+
const isBorderWidthUtility = classNames(rule.selector)
|
|
578
|
+
.map(baseUtility)
|
|
579
|
+
.some((utility) => (
|
|
580
|
+
/^border(?:-[xytrblse])?(?:-(?:0|1|2|4|8|\[[^\]]+]))?$/.test(utility)
|
|
581
|
+
));
|
|
582
|
+
|
|
583
|
+
if (!isBorderWidthUtility) return;
|
|
584
|
+
|
|
585
|
+
rule.walkDecls((declaration) => {
|
|
586
|
+
if (
|
|
587
|
+
declaration.prop === 'border-style'
|
|
588
|
+
|| declaration.prop === '--tw-border-style'
|
|
589
|
+
) declaration.remove();
|
|
590
|
+
});
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
|
|
484
594
|
function restoreLegacyTransformUtilities(root) {
|
|
485
595
|
root.walkRules((rule) => {
|
|
486
596
|
const utility = classNames(rule.selector)
|
|
@@ -558,6 +668,30 @@ function restoreLegacyGroupHover(root) {
|
|
|
558
668
|
});
|
|
559
669
|
}
|
|
560
670
|
|
|
671
|
+
function restoreLegacyPseudoElementStateOrder(root) {
|
|
672
|
+
root.walkRules((rule) => {
|
|
673
|
+
rule.selectors = rule.selectors.map((selector) => {
|
|
674
|
+
const pseudoElement = classNames(selector)
|
|
675
|
+
.flatMap((className) => classSegments(className).slice(0, -1))
|
|
676
|
+
.map((variant) => legacyPseudoElementVariants.get(variant))
|
|
677
|
+
.find((pseudo) => pseudo && selector.includes(pseudo));
|
|
678
|
+
|
|
679
|
+
if (!pseudoElement) return selector;
|
|
680
|
+
|
|
681
|
+
const pseudoIndex = selector.indexOf(pseudoElement);
|
|
682
|
+
const suffix = selector.slice(pseudoIndex + pseudoElement.length);
|
|
683
|
+
|
|
684
|
+
if (!suffix || !/^[:[]/.test(suffix)) return selector;
|
|
685
|
+
|
|
686
|
+
return [
|
|
687
|
+
selector.slice(0, pseudoIndex),
|
|
688
|
+
suffix,
|
|
689
|
+
pseudoElement,
|
|
690
|
+
].join('');
|
|
691
|
+
});
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
|
|
561
695
|
function restoreLegacyGroupHoverSelector(selector) {
|
|
562
696
|
const candidate = classNames(selector)
|
|
563
697
|
.map((className) => ({
|
|
@@ -727,6 +861,56 @@ function compareVariantOrders(left, right) {
|
|
|
727
861
|
return 0;
|
|
728
862
|
}
|
|
729
863
|
|
|
864
|
+
function reorderLegacyOutlineSiblings(container) {
|
|
865
|
+
const groups = new Map();
|
|
866
|
+
|
|
867
|
+
container.nodes?.forEach((node, index) => {
|
|
868
|
+
if (node.type !== 'rule') return;
|
|
869
|
+
|
|
870
|
+
const candidate = classNames(node.selector)
|
|
871
|
+
.map((className) => ({
|
|
872
|
+
className,
|
|
873
|
+
utility: baseUtility(className),
|
|
874
|
+
}))
|
|
875
|
+
.find(({ utility }) => (
|
|
876
|
+
utility === 'outline-none'
|
|
877
|
+
|| utility.startsWith('outline-offset-')
|
|
878
|
+
));
|
|
879
|
+
|
|
880
|
+
if (!candidate) return;
|
|
881
|
+
|
|
882
|
+
const variants = classSegments(candidate.className).slice(0, -1).join(':');
|
|
883
|
+
const important = candidate.className.startsWith('!')
|
|
884
|
+
|| candidate.className.endsWith('!');
|
|
885
|
+
const key = `${variants}\0${important}`;
|
|
886
|
+
const group = groups.get(key) ?? [];
|
|
887
|
+
|
|
888
|
+
group.push({
|
|
889
|
+
index,
|
|
890
|
+
node,
|
|
891
|
+
order: candidate.utility === 'outline-none' ? 0 : 1,
|
|
892
|
+
});
|
|
893
|
+
groups.set(key, group);
|
|
894
|
+
});
|
|
895
|
+
|
|
896
|
+
groups.forEach((group) => {
|
|
897
|
+
const sorted = [...group].sort((left, right) => (
|
|
898
|
+
left.order - right.order || left.index - right.index
|
|
899
|
+
));
|
|
900
|
+
|
|
901
|
+
group.forEach(({ index }, sortedIndex) => {
|
|
902
|
+
const node = sorted[sortedIndex].node;
|
|
903
|
+
|
|
904
|
+
container.nodes[index] = node;
|
|
905
|
+
node.parent = container;
|
|
906
|
+
});
|
|
907
|
+
});
|
|
908
|
+
|
|
909
|
+
container.nodes?.forEach((node) => {
|
|
910
|
+
if (node.nodes) reorderLegacyOutlineSiblings(node);
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
|
|
730
914
|
function reorderArbitraryValueSiblings(container) {
|
|
731
915
|
const groups = new Map();
|
|
732
916
|
|
|
@@ -800,6 +984,13 @@ function reorderResponsiveVariantSiblings(container) {
|
|
|
800
984
|
}
|
|
801
985
|
|
|
802
986
|
function responsiveVariantForNode(node) {
|
|
987
|
+
if (node.type === 'atrule' && node.name === 'media') {
|
|
988
|
+
const screen = Object.entries(screens)
|
|
989
|
+
.find(([, minWidth]) => node.params.includes(`min-width: ${minWidth}`));
|
|
990
|
+
|
|
991
|
+
if (screen) return screen[0];
|
|
992
|
+
}
|
|
993
|
+
|
|
803
994
|
const selectors = [];
|
|
804
995
|
|
|
805
996
|
if (node.type === 'rule') selectors.push(node.selector);
|
|
@@ -37,6 +37,7 @@ module.exports = {
|
|
|
37
37
|
color: resolveThemeValue(theme, `textColor.on-${token}` + suffix),
|
|
38
38
|
backgroundColor: resolveThemeValue(theme, `backgroundColor.${token}` + suffix),
|
|
39
39
|
|
|
40
|
+
borderStyle: 'none',
|
|
40
41
|
outlineStyle: 'none',
|
|
41
42
|
|
|
42
43
|
[variants['mobile']]: {
|
|
@@ -77,6 +78,7 @@ module.exports = {
|
|
|
77
78
|
color: resolveThemeValue(theme, `textColor.${token}` + suffix),
|
|
78
79
|
backgroundColor: resolveThemeValue(theme, `backgroundColor.${token}-opacity-0-08` + suffix),
|
|
79
80
|
|
|
81
|
+
borderStyle: 'none',
|
|
80
82
|
outlineStyle: 'none',
|
|
81
83
|
|
|
82
84
|
[variants['mobile']]: {
|
|
@@ -117,6 +119,7 @@ module.exports = {
|
|
|
117
119
|
color: resolveThemeValue(theme, `textColor.${token}` + suffix),
|
|
118
120
|
backgroundColor: 'transparent',
|
|
119
121
|
|
|
122
|
+
borderStyle: 'none',
|
|
120
123
|
outlineStyle: 'none',
|
|
121
124
|
|
|
122
125
|
[variants['mobile']]: {
|
|
@@ -157,6 +160,7 @@ module.exports = {
|
|
|
157
160
|
color: resolveThemeValue(theme, `textColor.${token}` + suffix),
|
|
158
161
|
backgroundColor: 'transparent',
|
|
159
162
|
|
|
163
|
+
borderStyle: 'none',
|
|
160
164
|
outlineStyle: 'none',
|
|
161
165
|
|
|
162
166
|
[variants['mobile']]: {
|