@uipath/apollo-wind 2.83.0 → 2.85.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/dist/components/ui/index.cjs +32 -32
- package/dist/components/ui/json-tree-view/DecorationChip.cjs +6 -4
- package/dist/components/ui/json-tree-view/DecorationChip.js +6 -4
- package/dist/components/ui/json-tree-view/JsonTree.types.d.ts +13 -2
- package/dist/components/ui/select.cjs +2 -2
- package/dist/components/ui/select.js +2 -2
- package/dist/styles.css +31 -13
- package/dist/tailwind.css +28 -18
- package/package.json +10 -3
- package/postcss-scope-preflight.d.ts +23 -0
- package/postcss-scope-preflight.js +218 -0
|
@@ -33,13 +33,13 @@ var __webpack_modules__ = {
|
|
|
33
33
|
"./button-group" (module) {
|
|
34
34
|
module.exports = require("./button-group.cjs");
|
|
35
35
|
},
|
|
36
|
-
"
|
|
36
|
+
"./button" (module) {
|
|
37
37
|
module.exports = require("./button.cjs");
|
|
38
38
|
},
|
|
39
|
-
"
|
|
39
|
+
"./calendar" (module) {
|
|
40
40
|
module.exports = require("./calendar.cjs");
|
|
41
41
|
},
|
|
42
|
-
"
|
|
42
|
+
"./card" (module) {
|
|
43
43
|
module.exports = require("./card.cjs");
|
|
44
44
|
},
|
|
45
45
|
"./chart" (module) {
|
|
@@ -51,7 +51,7 @@ var __webpack_modules__ = {
|
|
|
51
51
|
"./chat-hero" (module) {
|
|
52
52
|
module.exports = require("./chat-hero.cjs");
|
|
53
53
|
},
|
|
54
|
-
"
|
|
54
|
+
"./checkbox" (module) {
|
|
55
55
|
module.exports = require("./checkbox.cjs");
|
|
56
56
|
},
|
|
57
57
|
"./citation" (module) {
|
|
@@ -60,16 +60,16 @@ var __webpack_modules__ = {
|
|
|
60
60
|
"./code-block" (module) {
|
|
61
61
|
module.exports = require("./code-block.cjs");
|
|
62
62
|
},
|
|
63
|
-
"
|
|
63
|
+
"@/components/ui/collapsible" (module) {
|
|
64
64
|
module.exports = require("./collapsible.cjs");
|
|
65
65
|
},
|
|
66
66
|
"./combobox" (module) {
|
|
67
67
|
module.exports = require("./combobox.cjs");
|
|
68
68
|
},
|
|
69
|
-
"
|
|
69
|
+
"./command" (module) {
|
|
70
70
|
module.exports = require("./command.cjs");
|
|
71
71
|
},
|
|
72
|
-
"
|
|
72
|
+
"@/components/ui/context-menu" (module) {
|
|
73
73
|
module.exports = require("./context-menu.cjs");
|
|
74
74
|
},
|
|
75
75
|
"./data-table" (module) {
|
|
@@ -81,7 +81,7 @@ var __webpack_modules__ = {
|
|
|
81
81
|
"./datetime-picker" (module) {
|
|
82
82
|
module.exports = require("./datetime-picker.cjs");
|
|
83
83
|
},
|
|
84
|
-
"
|
|
84
|
+
"@/components/ui/dialog" (module) {
|
|
85
85
|
module.exports = require("./dialog.cjs");
|
|
86
86
|
},
|
|
87
87
|
"./disclosure-tree" (module) {
|
|
@@ -90,13 +90,13 @@ var __webpack_modules__ = {
|
|
|
90
90
|
"./drawer" (module) {
|
|
91
91
|
module.exports = require("./drawer.cjs");
|
|
92
92
|
},
|
|
93
|
-
"
|
|
93
|
+
"@/components/ui/dropdown-menu" (module) {
|
|
94
94
|
module.exports = require("./dropdown-menu.cjs");
|
|
95
95
|
},
|
|
96
96
|
"./dropzone-overlay" (module) {
|
|
97
97
|
module.exports = require("./dropzone-overlay.cjs");
|
|
98
98
|
},
|
|
99
|
-
"
|
|
99
|
+
"./editable-cell" (module) {
|
|
100
100
|
module.exports = require("./editable-cell.cjs");
|
|
101
101
|
},
|
|
102
102
|
"./editable-text" (module) {
|
|
@@ -117,16 +117,16 @@ var __webpack_modules__ = {
|
|
|
117
117
|
"./file-validation" (module) {
|
|
118
118
|
module.exports = require("./file-validation.cjs");
|
|
119
119
|
},
|
|
120
|
-
"
|
|
120
|
+
"./form-field" (module) {
|
|
121
121
|
module.exports = require("./form-field.cjs");
|
|
122
122
|
},
|
|
123
|
-
"
|
|
123
|
+
"@/components/ui/hover-card" (module) {
|
|
124
124
|
module.exports = require("./hover-card.cjs");
|
|
125
125
|
},
|
|
126
126
|
"./info-tooltip" (module) {
|
|
127
127
|
module.exports = require("./info-tooltip.cjs");
|
|
128
128
|
},
|
|
129
|
-
"
|
|
129
|
+
"./input-group" (module) {
|
|
130
130
|
module.exports = require("./input-group.cjs");
|
|
131
131
|
},
|
|
132
132
|
"./input" (module) {
|
|
@@ -180,10 +180,10 @@ var __webpack_modules__ = {
|
|
|
180
180
|
"./panel-tabs" (module) {
|
|
181
181
|
module.exports = require("./panel-tabs.cjs");
|
|
182
182
|
},
|
|
183
|
-
"
|
|
183
|
+
"./popover" (module) {
|
|
184
184
|
module.exports = require("./popover.cjs");
|
|
185
185
|
},
|
|
186
|
-
"
|
|
186
|
+
"./portal-container" (module) {
|
|
187
187
|
module.exports = require("./portal-container.cjs");
|
|
188
188
|
},
|
|
189
189
|
"./progress" (module) {
|
|
@@ -276,7 +276,7 @@ var __webpack_modules__ = {
|
|
|
276
276
|
"./tool-call" (module) {
|
|
277
277
|
module.exports = require("./tool-call.cjs");
|
|
278
278
|
},
|
|
279
|
-
"
|
|
279
|
+
"./tooltip" (module) {
|
|
280
280
|
module.exports = require("./tooltip.cjs");
|
|
281
281
|
},
|
|
282
282
|
"./tree-view" (module) {
|
|
@@ -438,7 +438,7 @@ var __webpack_exports__ = {};
|
|
|
438
438
|
"ReferenceChip"
|
|
439
439
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_bubble__rspack_import_9[__rspack_import_key];
|
|
440
440
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
441
|
-
var _button__rspack_import_10 = __webpack_require__("
|
|
441
|
+
var _button__rspack_import_10 = __webpack_require__("./button");
|
|
442
442
|
var __rspack_reexport = {};
|
|
443
443
|
for(const __rspack_import_key in _button__rspack_import_10)if ([
|
|
444
444
|
"getReferenceChipColors",
|
|
@@ -458,7 +458,7 @@ var __webpack_exports__ = {};
|
|
|
458
458
|
"ReferenceChip"
|
|
459
459
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_button_group__rspack_import_11[__rspack_import_key];
|
|
460
460
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
461
|
-
var _calendar__rspack_import_12 = __webpack_require__("
|
|
461
|
+
var _calendar__rspack_import_12 = __webpack_require__("./calendar");
|
|
462
462
|
var __rspack_reexport = {};
|
|
463
463
|
for(const __rspack_import_key in _calendar__rspack_import_12)if ([
|
|
464
464
|
"getReferenceChipColors",
|
|
@@ -468,7 +468,7 @@ var __webpack_exports__ = {};
|
|
|
468
468
|
"ReferenceChip"
|
|
469
469
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_calendar__rspack_import_12[__rspack_import_key];
|
|
470
470
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
471
|
-
var _card__rspack_import_13 = __webpack_require__("
|
|
471
|
+
var _card__rspack_import_13 = __webpack_require__("./card");
|
|
472
472
|
var __rspack_reexport = {};
|
|
473
473
|
for(const __rspack_import_key in _card__rspack_import_13)if ([
|
|
474
474
|
"getReferenceChipColors",
|
|
@@ -508,7 +508,7 @@ var __webpack_exports__ = {};
|
|
|
508
508
|
"ReferenceChip"
|
|
509
509
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_chat_hero__rspack_import_16[__rspack_import_key];
|
|
510
510
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
511
|
-
var _checkbox__rspack_import_17 = __webpack_require__("
|
|
511
|
+
var _checkbox__rspack_import_17 = __webpack_require__("./checkbox");
|
|
512
512
|
var __rspack_reexport = {};
|
|
513
513
|
for(const __rspack_import_key in _checkbox__rspack_import_17)if ([
|
|
514
514
|
"getReferenceChipColors",
|
|
@@ -538,7 +538,7 @@ var __webpack_exports__ = {};
|
|
|
538
538
|
"ReferenceChip"
|
|
539
539
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_code_block__rspack_import_19[__rspack_import_key];
|
|
540
540
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
541
|
-
var _collapsible__rspack_import_20 = __webpack_require__("
|
|
541
|
+
var _collapsible__rspack_import_20 = __webpack_require__("@/components/ui/collapsible");
|
|
542
542
|
var __rspack_reexport = {};
|
|
543
543
|
for(const __rspack_import_key in _collapsible__rspack_import_20)if ([
|
|
544
544
|
"getReferenceChipColors",
|
|
@@ -558,7 +558,7 @@ var __webpack_exports__ = {};
|
|
|
558
558
|
"ReferenceChip"
|
|
559
559
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_combobox__rspack_import_21[__rspack_import_key];
|
|
560
560
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
561
|
-
var _command__rspack_import_22 = __webpack_require__("
|
|
561
|
+
var _command__rspack_import_22 = __webpack_require__("./command");
|
|
562
562
|
var __rspack_reexport = {};
|
|
563
563
|
for(const __rspack_import_key in _command__rspack_import_22)if ([
|
|
564
564
|
"getReferenceChipColors",
|
|
@@ -568,7 +568,7 @@ var __webpack_exports__ = {};
|
|
|
568
568
|
"ReferenceChip"
|
|
569
569
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_command__rspack_import_22[__rspack_import_key];
|
|
570
570
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
571
|
-
var _context_menu__rspack_import_23 = __webpack_require__("
|
|
571
|
+
var _context_menu__rspack_import_23 = __webpack_require__("@/components/ui/context-menu");
|
|
572
572
|
var __rspack_reexport = {};
|
|
573
573
|
for(const __rspack_import_key in _context_menu__rspack_import_23)if ([
|
|
574
574
|
"getReferenceChipColors",
|
|
@@ -608,7 +608,7 @@ var __webpack_exports__ = {};
|
|
|
608
608
|
"ReferenceChip"
|
|
609
609
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_datetime_picker__rspack_import_26[__rspack_import_key];
|
|
610
610
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
611
|
-
var _dialog__rspack_import_27 = __webpack_require__("
|
|
611
|
+
var _dialog__rspack_import_27 = __webpack_require__("@/components/ui/dialog");
|
|
612
612
|
var __rspack_reexport = {};
|
|
613
613
|
for(const __rspack_import_key in _dialog__rspack_import_27)if ([
|
|
614
614
|
"getReferenceChipColors",
|
|
@@ -638,7 +638,7 @@ var __webpack_exports__ = {};
|
|
|
638
638
|
"ReferenceChip"
|
|
639
639
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_drawer__rspack_import_29[__rspack_import_key];
|
|
640
640
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
641
|
-
var _dropdown_menu__rspack_import_30 = __webpack_require__("
|
|
641
|
+
var _dropdown_menu__rspack_import_30 = __webpack_require__("@/components/ui/dropdown-menu");
|
|
642
642
|
var __rspack_reexport = {};
|
|
643
643
|
for(const __rspack_import_key in _dropdown_menu__rspack_import_30)if ([
|
|
644
644
|
"getReferenceChipColors",
|
|
@@ -658,7 +658,7 @@ var __webpack_exports__ = {};
|
|
|
658
658
|
"ReferenceChip"
|
|
659
659
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_dropzone_overlay__rspack_import_31[__rspack_import_key];
|
|
660
660
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
661
|
-
var _editable_cell__rspack_import_32 = __webpack_require__("
|
|
661
|
+
var _editable_cell__rspack_import_32 = __webpack_require__("./editable-cell");
|
|
662
662
|
var __rspack_reexport = {};
|
|
663
663
|
for(const __rspack_import_key in _editable_cell__rspack_import_32)if ([
|
|
664
664
|
"getReferenceChipColors",
|
|
@@ -728,7 +728,7 @@ var __webpack_exports__ = {};
|
|
|
728
728
|
"ReferenceChip"
|
|
729
729
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_file_validation__rspack_import_38[__rspack_import_key];
|
|
730
730
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
731
|
-
var _form_field__rspack_import_39 = __webpack_require__("
|
|
731
|
+
var _form_field__rspack_import_39 = __webpack_require__("./form-field");
|
|
732
732
|
var __rspack_reexport = {};
|
|
733
733
|
for(const __rspack_import_key in _form_field__rspack_import_39)if ([
|
|
734
734
|
"getReferenceChipColors",
|
|
@@ -738,7 +738,7 @@ var __webpack_exports__ = {};
|
|
|
738
738
|
"ReferenceChip"
|
|
739
739
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_form_field__rspack_import_39[__rspack_import_key];
|
|
740
740
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
741
|
-
var _hover_card__rspack_import_40 = __webpack_require__("
|
|
741
|
+
var _hover_card__rspack_import_40 = __webpack_require__("@/components/ui/hover-card");
|
|
742
742
|
var __rspack_reexport = {};
|
|
743
743
|
for(const __rspack_import_key in _hover_card__rspack_import_40)if ([
|
|
744
744
|
"getReferenceChipColors",
|
|
@@ -768,7 +768,7 @@ var __webpack_exports__ = {};
|
|
|
768
768
|
"ReferenceChip"
|
|
769
769
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_input__rspack_import_42[__rspack_import_key];
|
|
770
770
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
771
|
-
var _input_group__rspack_import_43 = __webpack_require__("
|
|
771
|
+
var _input_group__rspack_import_43 = __webpack_require__("./input-group");
|
|
772
772
|
var __rspack_reexport = {};
|
|
773
773
|
for(const __rspack_import_key in _input_group__rspack_import_43)if ([
|
|
774
774
|
"getReferenceChipColors",
|
|
@@ -938,7 +938,7 @@ var __webpack_exports__ = {};
|
|
|
938
938
|
"ReferenceChip"
|
|
939
939
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_panel_tabs__rspack_import_59[__rspack_import_key];
|
|
940
940
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
941
|
-
var _popover__rspack_import_60 = __webpack_require__("
|
|
941
|
+
var _popover__rspack_import_60 = __webpack_require__("./popover");
|
|
942
942
|
var __rspack_reexport = {};
|
|
943
943
|
for(const __rspack_import_key in _popover__rspack_import_60)if ([
|
|
944
944
|
"getReferenceChipColors",
|
|
@@ -948,7 +948,7 @@ var __webpack_exports__ = {};
|
|
|
948
948
|
"ReferenceChip"
|
|
949
949
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_popover__rspack_import_60[__rspack_import_key];
|
|
950
950
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
951
|
-
var _portal_container__rspack_import_61 = __webpack_require__("
|
|
951
|
+
var _portal_container__rspack_import_61 = __webpack_require__("./portal-container");
|
|
952
952
|
var __rspack_reexport = {};
|
|
953
953
|
for(const __rspack_import_key in _portal_container__rspack_import_61)if ([
|
|
954
954
|
"getReferenceChipColors",
|
|
@@ -1240,7 +1240,7 @@ var __webpack_exports__ = {};
|
|
|
1240
1240
|
"ReferenceChip"
|
|
1241
1241
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_tool_call__rspack_import_91[__rspack_import_key];
|
|
1242
1242
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
1243
|
-
var _tooltip__rspack_import_92 = __webpack_require__("
|
|
1243
|
+
var _tooltip__rspack_import_92 = __webpack_require__("./tooltip");
|
|
1244
1244
|
var __rspack_reexport = {};
|
|
1245
1245
|
for(const __rspack_import_key in _tooltip__rspack_import_92)if ([
|
|
1246
1246
|
"getReferenceChipColors",
|
|
@@ -45,6 +45,8 @@ function DecorationChip({ decoration }) {
|
|
|
45
45
|
const chip = decoration?.chip;
|
|
46
46
|
if (!chip || null == chip.label && null == chip.icon) return null;
|
|
47
47
|
const tone = chip.tone ?? 'neutral';
|
|
48
|
+
const hasTooltip = null != chip.tooltip && false !== chip.tooltip && '' !== chip.tooltip;
|
|
49
|
+
const iconName = chip.ariaLabel ?? ('string' == typeof chip.tooltip ? chip.tooltip : void 0);
|
|
48
50
|
const content = chip.label ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
|
|
49
51
|
className: (0, index_cjs_namespaceObject.cn)('flex min-w-0 items-center gap-1 truncate rounded-full border px-1.5 py-px text-[10px] font-medium leading-none', CHIP_TONE_BORDER_CLASS[tone], CHIP_TONE_TEXT_CLASS[tone]),
|
|
50
52
|
children: [
|
|
@@ -56,16 +58,16 @@ function DecorationChip({ decoration }) {
|
|
|
56
58
|
]
|
|
57
59
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
58
60
|
className: (0, index_cjs_namespaceObject.cn)('flex shrink-0 items-center', CHIP_TONE_TEXT_CLASS[tone]),
|
|
59
|
-
...
|
|
61
|
+
...iconName ? {
|
|
60
62
|
role: 'img',
|
|
61
|
-
'aria-label':
|
|
63
|
+
'aria-label': iconName
|
|
62
64
|
} : {},
|
|
63
65
|
children: chip.icon
|
|
64
66
|
});
|
|
65
|
-
if (!
|
|
67
|
+
if (!hasTooltip) return content;
|
|
66
68
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_JsonTreeTooltip_cjs_namespaceObject.JsonTreeTooltip, {
|
|
67
69
|
placement: "top",
|
|
68
|
-
content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("
|
|
70
|
+
content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
69
71
|
className: "text-xs",
|
|
70
72
|
children: chip.tooltip
|
|
71
73
|
}),
|
|
@@ -17,6 +17,8 @@ function DecorationChip({ decoration }) {
|
|
|
17
17
|
const chip = decoration?.chip;
|
|
18
18
|
if (!chip || null == chip.label && null == chip.icon) return null;
|
|
19
19
|
const tone = chip.tone ?? 'neutral';
|
|
20
|
+
const hasTooltip = null != chip.tooltip && false !== chip.tooltip && '' !== chip.tooltip;
|
|
21
|
+
const iconName = chip.ariaLabel ?? ('string' == typeof chip.tooltip ? chip.tooltip : void 0);
|
|
20
22
|
const content = chip.label ? /*#__PURE__*/ jsxs("span", {
|
|
21
23
|
className: cn('flex min-w-0 items-center gap-1 truncate rounded-full border px-1.5 py-px text-[10px] font-medium leading-none', CHIP_TONE_BORDER_CLASS[tone], CHIP_TONE_TEXT_CLASS[tone]),
|
|
22
24
|
children: [
|
|
@@ -28,16 +30,16 @@ function DecorationChip({ decoration }) {
|
|
|
28
30
|
]
|
|
29
31
|
}) : /*#__PURE__*/ jsx("span", {
|
|
30
32
|
className: cn('flex shrink-0 items-center', CHIP_TONE_TEXT_CLASS[tone]),
|
|
31
|
-
...
|
|
33
|
+
...iconName ? {
|
|
32
34
|
role: 'img',
|
|
33
|
-
'aria-label':
|
|
35
|
+
'aria-label': iconName
|
|
34
36
|
} : {},
|
|
35
37
|
children: chip.icon
|
|
36
38
|
});
|
|
37
|
-
if (!
|
|
39
|
+
if (!hasTooltip) return content;
|
|
38
40
|
return /*#__PURE__*/ jsx(JsonTreeTooltip, {
|
|
39
41
|
placement: "top",
|
|
40
|
-
content: /*#__PURE__*/ jsx("
|
|
42
|
+
content: /*#__PURE__*/ jsx("div", {
|
|
41
43
|
className: "text-xs",
|
|
42
44
|
children: chip.tooltip
|
|
43
45
|
}),
|
|
@@ -91,8 +91,19 @@ export interface NodeDecorationChip {
|
|
|
91
91
|
label?: string;
|
|
92
92
|
/** Icon rendered before the label (or alone when there is no label). */
|
|
93
93
|
icon?: ReactNode;
|
|
94
|
-
/**
|
|
95
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Tooltip shown on hover. Rich content (lists, `<code>`, line breaks) is
|
|
96
|
+
* fine, but keep it non-interactive: the chip takes no focus and a tooltip
|
|
97
|
+
* must not hold controls, so put actions in `nodeActions` instead. On an
|
|
98
|
+
* icon-only chip a string tooltip also becomes its accessible name.
|
|
99
|
+
*/
|
|
100
|
+
tooltip?: ReactNode;
|
|
101
|
+
/**
|
|
102
|
+
* Accessible name for an icon-only chip, winning over a string `tooltip`.
|
|
103
|
+
* Required when the tooltip isn't a string, or the icon goes unnamed.
|
|
104
|
+
* Ignored on a chip with a `label`, which already names it.
|
|
105
|
+
*/
|
|
106
|
+
ariaLabel?: string;
|
|
96
107
|
tone?: NodeDecorationTone;
|
|
97
108
|
}
|
|
98
109
|
/** Overrides for the row's type badge (the leading icon-in-a-box). */
|
|
@@ -62,10 +62,10 @@ const SelectValue = /*#__PURE__*/ external_react_namespaceObject.forwardRef((pro
|
|
|
62
62
|
...props
|
|
63
63
|
}));
|
|
64
64
|
SelectValue.displayName = react_select_namespaceObject.Value.displayName;
|
|
65
|
-
const selectTriggerVariants = (0, external_class_variance_authority_namespaceObject.cva)('flex w-full cursor-pointer items-center justify-between bg-transparent text-
|
|
65
|
+
const selectTriggerVariants = (0, external_class_variance_authority_namespaceObject.cva)('flex w-full cursor-pointer items-center justify-between bg-transparent text-sm transition-colors data-[placeholder]:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 whitespace-nowrap *:data-[slot=select-value]:truncate *:data-[slot=select-value]:text-left [&_svg]:pointer-events-none [&_svg]:shrink-0 future:font-normal', {
|
|
66
66
|
variants: {
|
|
67
67
|
grouped: {
|
|
68
|
-
false: 'h-9 rounded-md border border-input px-3 py-1 focus:outline-none focus:ring-2 focus:ring-ring focus-visible:ring-2 focus-visible:ring-ring future:h-10 future:rounded-xl future:border-0 future:bg-surface-overlay future:hover:bg-surface-hover future:px-4 future:gap-4 aria-invalid:border-error aria-invalid:focus-visible:ring-error future:aria-invalid:ring-1 future:aria-invalid:ring-error/40 future:focus:ring-primary future:focus-visible:ring-primary future:aria-invalid:focus:ring-error future:aria-invalid:focus-visible:ring-error',
|
|
68
|
+
false: 'h-9 gap-2 rounded-md border border-input px-3 py-1 focus:outline-none focus:ring-2 focus:ring-ring focus-visible:ring-2 focus-visible:ring-ring future:h-10 future:rounded-xl future:border-0 future:bg-surface-overlay future:hover:bg-surface-hover future:px-4 future:gap-4 aria-invalid:border-error aria-invalid:focus-visible:ring-error future:aria-invalid:ring-1 future:aria-invalid:ring-error/40 future:focus:ring-primary future:focus-visible:ring-primary future:aria-invalid:focus:ring-error future:aria-invalid:focus-visible:ring-error',
|
|
69
69
|
true: 'h-full min-h-5 min-w-0 flex-1 gap-2 p-0'
|
|
70
70
|
}
|
|
71
71
|
},
|
|
@@ -25,10 +25,10 @@ const SelectValue = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx(Val
|
|
|
25
25
|
...props
|
|
26
26
|
}));
|
|
27
27
|
SelectValue.displayName = Value.displayName;
|
|
28
|
-
const selectTriggerVariants = cva('flex w-full cursor-pointer items-center justify-between bg-transparent text-
|
|
28
|
+
const selectTriggerVariants = cva('flex w-full cursor-pointer items-center justify-between bg-transparent text-sm transition-colors data-[placeholder]:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 whitespace-nowrap *:data-[slot=select-value]:truncate *:data-[slot=select-value]:text-left [&_svg]:pointer-events-none [&_svg]:shrink-0 future:font-normal', {
|
|
29
29
|
variants: {
|
|
30
30
|
grouped: {
|
|
31
|
-
false: 'h-9 rounded-md border border-input px-3 py-1 focus:outline-none focus:ring-2 focus:ring-ring focus-visible:ring-2 focus-visible:ring-ring future:h-10 future:rounded-xl future:border-0 future:bg-surface-overlay future:hover:bg-surface-hover future:px-4 future:gap-4 aria-invalid:border-error aria-invalid:focus-visible:ring-error future:aria-invalid:ring-1 future:aria-invalid:ring-error/40 future:focus:ring-primary future:focus-visible:ring-primary future:aria-invalid:focus:ring-error future:aria-invalid:focus-visible:ring-error',
|
|
31
|
+
false: 'h-9 gap-2 rounded-md border border-input px-3 py-1 focus:outline-none focus:ring-2 focus:ring-ring focus-visible:ring-2 focus-visible:ring-ring future:h-10 future:rounded-xl future:border-0 future:bg-surface-overlay future:hover:bg-surface-hover future:px-4 future:gap-4 aria-invalid:border-error aria-invalid:focus-visible:ring-error future:aria-invalid:ring-1 future:aria-invalid:ring-error/40 future:focus:ring-primary future:focus-visible:ring-primary future:aria-invalid:focus:ring-error future:aria-invalid:focus-visible:ring-error',
|
|
32
32
|
true: 'h-full min-h-5 min-w-0 flex-1 gap-2 p-0'
|
|
33
33
|
}
|
|
34
34
|
},
|
package/dist/styles.css
CHANGED
|
@@ -8187,6 +8187,22 @@
|
|
|
8187
8187
|
}
|
|
8188
8188
|
}
|
|
8189
8189
|
}
|
|
8190
|
+
.\*\:data-\[slot\=select-value\]\:truncate {
|
|
8191
|
+
:is(& > *) {
|
|
8192
|
+
&[data-slot="select-value"] {
|
|
8193
|
+
overflow: hidden;
|
|
8194
|
+
text-overflow: ellipsis;
|
|
8195
|
+
white-space: nowrap;
|
|
8196
|
+
}
|
|
8197
|
+
}
|
|
8198
|
+
}
|
|
8199
|
+
.\*\:data-\[slot\=select-value\]\:text-left {
|
|
8200
|
+
:is(& > *) {
|
|
8201
|
+
&[data-slot="select-value"] {
|
|
8202
|
+
text-align: left;
|
|
8203
|
+
}
|
|
8204
|
+
}
|
|
8205
|
+
}
|
|
8190
8206
|
.data-\[spacing\=0\]\:rounded-none {
|
|
8191
8207
|
&[data-spacing="0"] {
|
|
8192
8208
|
border-radius: 0;
|
|
@@ -13923,19 +13939,21 @@ body.canvas, .canvas {
|
|
|
13923
13939
|
.future-dark, .dark, .dark-hc {
|
|
13924
13940
|
scrollbar-width: thin;
|
|
13925
13941
|
scrollbar-color: var(--color-border) transparent;
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
13934
|
-
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13942
|
+
@supports not (scrollbar-color: auto) {
|
|
13943
|
+
& *::-webkit-scrollbar {
|
|
13944
|
+
width: 6px;
|
|
13945
|
+
height: 6px;
|
|
13946
|
+
}
|
|
13947
|
+
& *::-webkit-scrollbar-track {
|
|
13948
|
+
background: transparent;
|
|
13949
|
+
}
|
|
13950
|
+
& *::-webkit-scrollbar-thumb {
|
|
13951
|
+
background-color: var(--color-border);
|
|
13952
|
+
border-radius: 9999px;
|
|
13953
|
+
}
|
|
13954
|
+
& *::-webkit-scrollbar-thumb:hover {
|
|
13955
|
+
background-color: var(--color-border-hover);
|
|
13956
|
+
}
|
|
13939
13957
|
}
|
|
13940
13958
|
}
|
|
13941
13959
|
.mat-typography :is( [data-slot="dialog-content"], [data-slot="sheet-content"], [data-slot="alert-dialog-content"], [data-slot="drawer-content"] ) :where(p) {
|
package/dist/tailwind.css
CHANGED
|
@@ -897,32 +897,42 @@ body.canvas, .canvas {
|
|
|
897
897
|
* Dark themes: future-dark + dark-hc are applied to <html>;
|
|
898
898
|
* dark + dark-hc are applied to <body>. Both cases are covered by the
|
|
899
899
|
* class selectors below since * matches all descendants.
|
|
900
|
+
*
|
|
901
|
+
* The standard properties inherit, so they cost nothing per element. The
|
|
902
|
+
* WebKit pseudo-element rules do not: `.dark *::-webkit-scrollbar` makes
|
|
903
|
+
* Chrome walk every element's ancestors for the theme class on every style
|
|
904
|
+
* recalc (about 7 ms per copy of this block in Studio Web, MST-17369).
|
|
905
|
+
* Browsers that implement `scrollbar-color` ignore `::-webkit-scrollbar`
|
|
906
|
+
* once it is set (Chrome 121+, Safari 26.2+), so the WebKit rules only
|
|
907
|
+
* exist where the standard properties are missing.
|
|
900
908
|
* ============================================================================ */
|
|
901
909
|
|
|
902
910
|
.future-dark,
|
|
903
911
|
.dark,
|
|
904
912
|
.dark-hc {
|
|
905
|
-
/* Firefox — inherits down the tree */
|
|
913
|
+
/* Firefox, Chrome 121+, Safari 26.2+ — inherits down the tree */
|
|
906
914
|
scrollbar-width: thin;
|
|
907
915
|
scrollbar-color: var(--color-border) transparent;
|
|
908
916
|
|
|
909
|
-
/* WebKit — pseudo-elements don't inherit, must target descendants */
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
917
|
+
/* Older WebKit — pseudo-elements don't inherit, must target descendants */
|
|
918
|
+
@supports not (scrollbar-color: auto) {
|
|
919
|
+
& *::-webkit-scrollbar {
|
|
920
|
+
width: 6px;
|
|
921
|
+
height: 6px;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
& *::-webkit-scrollbar-track {
|
|
925
|
+
background: transparent;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
& *::-webkit-scrollbar-thumb {
|
|
929
|
+
background-color: var(--color-border);
|
|
930
|
+
border-radius: 9999px;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
& *::-webkit-scrollbar-thumb:hover {
|
|
934
|
+
background-color: var(--color-border-hover);
|
|
935
|
+
}
|
|
926
936
|
}
|
|
927
937
|
}
|
|
928
938
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/apollo-wind",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.85.0",
|
|
4
4
|
"description": "UiPath wind design system - A Tailwind CSS based React component library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -51,6 +51,11 @@
|
|
|
51
51
|
"import": "./dist/postcss.config.export.js",
|
|
52
52
|
"require": "./dist/postcss.config.export.cjs"
|
|
53
53
|
},
|
|
54
|
+
"./postcss-scope-preflight": {
|
|
55
|
+
"types": "./postcss-scope-preflight.d.ts",
|
|
56
|
+
"import": "./postcss-scope-preflight.js",
|
|
57
|
+
"default": "./postcss-scope-preflight.js"
|
|
58
|
+
},
|
|
54
59
|
"./editor-themes": {
|
|
55
60
|
"import": "./dist/editor-themes/index.js",
|
|
56
61
|
"require": "./dist/editor-themes/index.cjs",
|
|
@@ -59,7 +64,9 @@
|
|
|
59
64
|
},
|
|
60
65
|
"files": [
|
|
61
66
|
"dist",
|
|
62
|
-
"postcss.config.export.js"
|
|
67
|
+
"postcss.config.export.js",
|
|
68
|
+
"postcss-scope-preflight.js",
|
|
69
|
+
"postcss-scope-preflight.d.ts"
|
|
63
70
|
],
|
|
64
71
|
"peerDependencies": {
|
|
65
72
|
"react": ">=18.0.0",
|
|
@@ -177,7 +184,7 @@
|
|
|
177
184
|
"storybook": "^10.6.2",
|
|
178
185
|
"typescript": "^5.9.3",
|
|
179
186
|
"vitest": "^4.1.12",
|
|
180
|
-
"@uipath/apollo-ui-icons-react": "
|
|
187
|
+
"@uipath/apollo-ui-icons-react": "0.0.0"
|
|
181
188
|
},
|
|
182
189
|
"keywords": [
|
|
183
190
|
"react",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Plugin, PluginCreator } from 'postcss';
|
|
2
|
+
|
|
3
|
+
export interface ScopePreflightOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Selectors for the elements that own the consumer's DOM: web-component tags, portal markers,
|
|
6
|
+
* `[data-slot]`. Preflight applies to these elements and their descendants.
|
|
7
|
+
*/
|
|
8
|
+
roots: string[];
|
|
9
|
+
/**
|
|
10
|
+
* Preflight's `html, :host` rule sets the page font from `--font-sans`, a `:root` variable every
|
|
11
|
+
* consumer in a shared document redefines. By default the font declarations stay on the outermost
|
|
12
|
+
* root. Pass the selector of the element the consumer renders when it owns the whole document to
|
|
13
|
+
* apply them there only, so embedded roots inherit the host's font; pass `false` to drop them.
|
|
14
|
+
*/
|
|
15
|
+
documentRoot?: string | false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Inserts `:where(:scope)` into the subject of a selector, ahead of any pseudo-element. */
|
|
19
|
+
export function scopeSelector(selector: string): string;
|
|
20
|
+
|
|
21
|
+
declare const scopePreflight: PluginCreator<ScopePreflightOptions> &
|
|
22
|
+
((options: ScopePreflightOptions) => Plugin);
|
|
23
|
+
export default scopePreflight;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PostCSS plugin: confine Tailwind's Preflight reset to the DOM a consumer renders.
|
|
3
|
+
*
|
|
4
|
+
* A micro-frontend's CSS lands in its host's document. Preflight is written for a page you own:
|
|
5
|
+
* left global it restyles the host's markup, and its `[hidden] { display: none !important }` beats
|
|
6
|
+
* the host's own unlayered `display` rules. This plugin wraps the Preflight rules, and the bare `*`
|
|
7
|
+
* resets apollo-wind adds to `@layer base`, in `@scope (roots) { … }`, so they match only inside the
|
|
8
|
+
* consumer's own root elements.
|
|
9
|
+
*
|
|
10
|
+
* `@scope` is the cheap way to do this. The older `X:where(R1, …, Rn, R1 *, …, Rn *)` wrapper makes
|
|
11
|
+
* Chrome walk every element's ancestor chain once per root for every universal Preflight rule, which
|
|
12
|
+
* showed up as 100+ ms style recalcs in Studio Web (MST-17369). Inside `@scope`, a bare selector
|
|
13
|
+
* matches descendants of the root only, so each rule also gets an `X:where(:scope)` copy for the root
|
|
14
|
+
* itself. `:where()` keeps Preflight at zero specificity, as upstream.
|
|
15
|
+
*
|
|
16
|
+
* Runs after Tailwind. Preflight is found by shape, not source file: Tailwind's production optimise
|
|
17
|
+
* pass re-parses its output, so every rule reports the entry file as its source. The run starts at
|
|
18
|
+
* the `::backdrop` box-sizing rule and ends at `[hidden]:where(:not([hidden=until-found]))`; if a
|
|
19
|
+
* Tailwind update moves the end, the plugin throws rather than scope the rest of the base layer. If
|
|
20
|
+
* the start moves, nothing is scoped: the test against real Tailwind output in `src/styles` is what
|
|
21
|
+
* catches that, so keep it when bumping Tailwind.
|
|
22
|
+
*
|
|
23
|
+
* Two cascade details for consumers:
|
|
24
|
+
*
|
|
25
|
+
* - Scoping proximity ranks below specificity but above source order. A scoped Preflight
|
|
26
|
+
* declaration therefore beats an unscoped one of equal specificity in the same layer, whatever
|
|
27
|
+
* the order, which the old wrapper did not. Override Preflight from an unlayered rule or with
|
|
28
|
+
* higher specificity, not from a later rule in `@layer base`.
|
|
29
|
+
* - Safari 26.0 to 26.3 do not apply `@scope` rules to elements with a UA shadow root (`input`,
|
|
30
|
+
* `textarea`; WebKit 305369, fixed in 26.4). Form controls render with UA styles there. Those
|
|
31
|
+
* versions are outside UiPath's support matrix (Safari: latest version only), and `@supports`
|
|
32
|
+
* cannot detect the bug, so there is no workaround.
|
|
33
|
+
*
|
|
34
|
+
* Usage, in a consumer's postcss config:
|
|
35
|
+
*
|
|
36
|
+
* import apolloWind from '@uipath/apollo-wind/postcss';
|
|
37
|
+
* import scopePreflight from '@uipath/apollo-wind/postcss-scope-preflight';
|
|
38
|
+
* export default { plugins: [...apolloWind.plugins, scopePreflight({ roots: ['my-canvas', '[data-my-portal]'] })] };
|
|
39
|
+
*
|
|
40
|
+
* Anything the consumer portals onto `document.body` must carry one of the roots, or it renders
|
|
41
|
+
* without Preflight. apollo-wind stamps `data-slot` on its components, including what it portals, so
|
|
42
|
+
* `[data-slot]` is a sensible root for apollo-wind consumers.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @typedef {object} ScopePreflightOptions
|
|
47
|
+
* @property {string[]} roots
|
|
48
|
+
* Selectors for the elements that own the consumer's DOM: web-component tags, portal markers,
|
|
49
|
+
* `[data-slot]`. Preflight applies to these elements and their descendants.
|
|
50
|
+
* @property {string | false} [documentRoot]
|
|
51
|
+
* Preflight's `html, :host` rule sets the page font from `--font-sans`, a `:root` variable every
|
|
52
|
+
* consumer in a shared document redefines. By default the font declarations stay on the outermost
|
|
53
|
+
* root. Pass the selector of the element the consumer renders when it owns the whole document to
|
|
54
|
+
* apply them there only, so embedded roots inherit the host's font; pass `false` to drop them.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/** Preflight's first rule: the `*, ::before, ::after, ::backdrop` box-sizing reset. */
|
|
58
|
+
const isPreflightStart = (/** @type {import('postcss').Rule} */ rule) =>
|
|
59
|
+
rule.selectors.some((s) => s.trim() === '::backdrop') &&
|
|
60
|
+
rule.some((d) => d.type === 'decl' && d.prop === 'box-sizing');
|
|
61
|
+
|
|
62
|
+
/** Preflight's last rule. */
|
|
63
|
+
const isPreflightEnd = (/** @type {import('postcss').Rule} */ rule) =>
|
|
64
|
+
/^\[hidden\]:where\(:not\(\[hidden=["']?until-found["']?\]\)\)$/.test(rule.selector.trim());
|
|
65
|
+
|
|
66
|
+
/** @param {string} selector */
|
|
67
|
+
const isDocumentRoot = (selector) => selector === 'html' || selector === ':host';
|
|
68
|
+
|
|
69
|
+
/** The inherited typography `html, :host` sets; on an embedded root these follow the host instead. */
|
|
70
|
+
const DOCUMENT_FONT_PROPS = new Set([
|
|
71
|
+
'font-family',
|
|
72
|
+
'font-feature-settings',
|
|
73
|
+
'font-variation-settings',
|
|
74
|
+
]);
|
|
75
|
+
|
|
76
|
+
// Tailwind's production pass prints `::before`/`::after` in their single-colon form; a pseudo-class
|
|
77
|
+
// after one is invalid, and the minifier empties it to `:where()`.
|
|
78
|
+
const LEGACY_PSEUDO_ELEMENT = /^:(before|after|first-line|first-letter)(?![\w-])/;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Inserts `:where(:scope)` into the subject (last compound) of a selector, ahead of any pseudo-element.
|
|
82
|
+
* @param {string} selector
|
|
83
|
+
*/
|
|
84
|
+
export function scopeSelector(selector) {
|
|
85
|
+
const s = selector.trim();
|
|
86
|
+
let depth = 0;
|
|
87
|
+
let subjectStart = 0;
|
|
88
|
+
for (let i = 0; i < s.length; i++) {
|
|
89
|
+
const c = s[i];
|
|
90
|
+
if (c === '(' || c === '[') depth++;
|
|
91
|
+
else if (c === ')' || c === ']') depth--;
|
|
92
|
+
else if (depth === 0 && (c === ' ' || c === '>' || c === '+' || c === '~'))
|
|
93
|
+
subjectStart = i + 1;
|
|
94
|
+
}
|
|
95
|
+
depth = 0;
|
|
96
|
+
for (let i = subjectStart; i < s.length; i++) {
|
|
97
|
+
const c = s[i];
|
|
98
|
+
if (c === '(' || c === '[') depth++;
|
|
99
|
+
else if (c === ')' || c === ']') depth--;
|
|
100
|
+
else if (
|
|
101
|
+
depth === 0 &&
|
|
102
|
+
c === ':' &&
|
|
103
|
+
(s[i + 1] === ':' || LEGACY_PSEUDO_ELEMENT.test(s.slice(i)))
|
|
104
|
+
)
|
|
105
|
+
return `${s.slice(0, i)}:where(:scope)${s.slice(i)}`;
|
|
106
|
+
}
|
|
107
|
+
return `${s}:where(:scope)`;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @param {ScopePreflightOptions} options
|
|
112
|
+
* @returns {import('postcss').Plugin}
|
|
113
|
+
*/
|
|
114
|
+
const scopePreflight = (options) => {
|
|
115
|
+
const roots = options?.roots?.map((r) => r.trim()).filter(Boolean) ?? [];
|
|
116
|
+
if (roots.length === 0)
|
|
117
|
+
throw new Error('scope-preflight: `roots` must list at least one selector');
|
|
118
|
+
const { documentRoot } = options;
|
|
119
|
+
|
|
120
|
+
const ROOTS = roots.join(', ');
|
|
121
|
+
// The outermost root only: `html, :host` sets inherited typography, and on every nested root it
|
|
122
|
+
// would override what the component's parent chose. Flat lists, no `:is()`: minifiers lower `:is()`
|
|
123
|
+
// into `:-webkit-any()`/`:-moz-any()` copies.
|
|
124
|
+
const SCOPE_TOP = `:where(${ROOTS}):where(:not(${roots.map((r) => `${r} *`).join(', ')}))`;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Rewrites one rule for use inside the `@scope` block: a `:where(:scope)` copy for the root, the
|
|
128
|
+
* bare selector for its descendants.
|
|
129
|
+
* @param {import('postcss').Rule} rule
|
|
130
|
+
*/
|
|
131
|
+
const scopeRule = (rule) => {
|
|
132
|
+
const selectors = rule.selectors.map((s) => s.trim());
|
|
133
|
+
rule.selectors = [...selectors.map(scopeSelector), ...selectors];
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* `html, :host` becomes a rule on the outermost root, outside the block. Its font declarations move
|
|
138
|
+
* to `documentRoot`, or are dropped, when the consumer asked for that.
|
|
139
|
+
* @param {import('postcss').Rule} rule
|
|
140
|
+
* @param {import('postcss').Helpers} helpers
|
|
141
|
+
*/
|
|
142
|
+
const scopeDocumentRule = (rule, { Rule }) => {
|
|
143
|
+
if (documentRoot !== undefined) {
|
|
144
|
+
const fontDecls = rule.nodes.filter(
|
|
145
|
+
(n) => n.type === 'decl' && DOCUMENT_FONT_PROPS.has(n.prop)
|
|
146
|
+
);
|
|
147
|
+
for (const decl of fontDecls) decl.remove();
|
|
148
|
+
if (documentRoot && fontDecls.length) {
|
|
149
|
+
rule.after(
|
|
150
|
+
new Rule({ selector: `:where(${documentRoot})`, nodes: fontDecls.map((d) => d.clone()) })
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
rule.selector = SCOPE_TOP;
|
|
155
|
+
if (rule.nodes.length === 0) rule.remove();
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
postcssPlugin: 'scope-preflight',
|
|
160
|
+
OnceExit(root, helpers) {
|
|
161
|
+
const { AtRule } = helpers;
|
|
162
|
+
root.walkAtRules('layer', (layer) => {
|
|
163
|
+
if (layer.params !== 'base') return;
|
|
164
|
+
// Collect the nodes to scope first, so the walk is not disturbed by the rewrite.
|
|
165
|
+
/** @type {import('postcss').ChildNode[]} */
|
|
166
|
+
const toScope = [];
|
|
167
|
+
let inPreflight = false;
|
|
168
|
+
for (const node of layer.nodes ?? []) {
|
|
169
|
+
if (node.type === 'atrule') {
|
|
170
|
+
if (inPreflight) toScope.push(node);
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (node.type !== 'rule') continue;
|
|
174
|
+
if (isPreflightStart(node)) inPreflight = true;
|
|
175
|
+
if (inPreflight) {
|
|
176
|
+
toScope.push(node);
|
|
177
|
+
if (isPreflightEnd(node)) inPreflight = false;
|
|
178
|
+
} else if (node.selector.trim() === '*') {
|
|
179
|
+
// A bare `*` in the base layer (apollo-wind's `border-color`) is the same kind of page-wide reset.
|
|
180
|
+
toScope.push(node);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (inPreflight) {
|
|
184
|
+
// Scoping on to the end of the layer would also wrap the consumer's own base rules
|
|
185
|
+
// (`body { … }` matches nothing inside a root), with no build error. Fail instead.
|
|
186
|
+
throw layer.error(
|
|
187
|
+
'scope-preflight: found the start of Preflight but not its last rule, `[hidden]:where(:not([hidden=until-found]))`. Tailwind may have changed Preflight; update isPreflightEnd.',
|
|
188
|
+
{ plugin: 'scope-preflight' }
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// One `@scope` block per run of consecutive nodes. Chrome resolves scope activations per
|
|
193
|
+
// block, so hundreds of single-rule blocks cost measurably more than a handful.
|
|
194
|
+
/** @type {import('postcss').AtRule | null} */
|
|
195
|
+
let block = null;
|
|
196
|
+
for (const node of toScope) {
|
|
197
|
+
if (!block || node.prev() !== block) {
|
|
198
|
+
block = new AtRule({ name: 'scope', params: `(${ROOTS})` });
|
|
199
|
+
node.before(block);
|
|
200
|
+
}
|
|
201
|
+
if (node.type === 'rule' && node.selectors.map((s) => s.trim()).every(isDocumentRoot)) {
|
|
202
|
+
// Stays outside the block, ahead of it, so its position in the cascade does not change.
|
|
203
|
+
block.before(node);
|
|
204
|
+
scopeDocumentRule(node, helpers);
|
|
205
|
+
// The next node is still adjacent to the block.
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (node.type === 'rule') scopeRule(node);
|
|
209
|
+
else node.walkRules(scopeRule);
|
|
210
|
+
block.append(node);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
scopePreflight.postcss = true;
|
|
217
|
+
|
|
218
|
+
export default scopePreflight;
|