@yahoo/uds 3.120.0 → 3.121.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/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
- package/dist/components/client/Popover/Popover.cjs +1 -1
- package/dist/components/client/Popover/Popover.js +1 -1
- package/dist/components/client/Popover/PopoverContent.cjs +12 -17
- package/dist/components/client/Popover/PopoverContent.js +12 -17
- package/dist/components/client/Popover/UDSPopoverConfigProvider.cjs +13 -3
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +13 -5
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +13 -5
- package/dist/components/client/Popover/UDSPopoverConfigProvider.js +13 -3
- package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +1 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/runtime/popoverConfig.cjs +2 -0
- package/dist/runtime/popoverConfig.d.cts +3 -1
- package/dist/runtime/popoverConfig.d.ts +3 -1
- package/dist/runtime/popoverConfig.js +2 -0
- package/dist/styles/styler.d.cts +51 -51
- package/dist/styles/styler.d.ts +51 -51
- package/dist/tailwind/dist/commands/generateComponentData.cjs +5 -1
- package/dist/tailwind/dist/commands/generateComponentData.d.cts +3 -0
- package/dist/tailwind/dist/commands/generateComponentData.d.cts.map +1 -1
- package/dist/tailwind/dist/commands/generateComponentData.d.ts +3 -0
- package/dist/tailwind/dist/commands/generateComponentData.d.ts.map +1 -1
- package/dist/tailwind/dist/commands/generateComponentData.js +5 -1
- package/dist/tailwind/dist/commands/generateComponentData.js.map +1 -1
- package/dist/tailwind/dist/css/generate.cjs +2 -1
- package/dist/tailwind/dist/css/generate.d.cts.map +1 -1
- package/dist/tailwind/dist/css/generate.d.ts.map +1 -1
- package/dist/tailwind/dist/css/generate.js +3 -2
- package/dist/tailwind/dist/css/generate.js.map +1 -1
- package/dist/tailwind/dist/css/nodeUtils.cjs +7 -5
- package/dist/tailwind/dist/css/nodeUtils.js +7 -5
- package/dist/tailwind/dist/css/nodeUtils.js.map +1 -1
- package/dist/tailwind/dist/css/runner.cjs +4 -3
- package/dist/tailwind/dist/css/runner.js +5 -4
- package/dist/tailwind/dist/css/runner.js.map +1 -1
- package/dist/tailwind/dist/css/utils.cjs +62 -0
- package/dist/tailwind/dist/css/utils.js +62 -1
- package/dist/tailwind/dist/css/utils.js.map +1 -1
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.cjs +104 -19
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.d.cts +5 -0
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.d.cts.map +1 -1
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.d.ts +5 -0
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.d.ts.map +1 -1
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.js +104 -19
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.js.map +1 -1
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.cjs +99 -10
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js +99 -10
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js.map +1 -1
- package/dist/tailwind/dist/runtimeConfig/hookMetadata.cjs +364 -0
- package/dist/tailwind/dist/runtimeConfig/hookMetadata.js +358 -0
- package/dist/tailwind/dist/runtimeConfig/hookMetadata.js.map +1 -0
- package/dist/tailwind/dist/types/dist/index.d.cts.map +1 -1
- package/dist/tailwind/dist/types/dist/index.d.ts.map +1 -1
- package/dist/tokens/index.d.cts +2 -2
- package/dist/tokens/index.d.ts +2 -2
- package/dist/tokens/types.d.cts +2 -2
- package/dist/tokens/types.d.ts +2 -2
- package/dist/types/dist/index.d.cts +2 -1
- package/dist/types/dist/index.d.ts +2 -1
- package/dist/uds/generated/componentData.cjs +858 -571
- package/dist/uds/generated/componentData.js +858 -571
- package/generated/componentData.json +1786 -1437
- package/package.json +1 -1
package/dist/styles/styler.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ declare const cva: CVA<string>;
|
|
|
12
12
|
declare const getStylesInternal: (props?: ({
|
|
13
13
|
avatarIconVariantRoot?: "primary" | "secondary" | "default" | undefined;
|
|
14
14
|
avatarImageVariantRoot?: "primary" | "secondary" | "default" | undefined;
|
|
15
|
-
avatarSizeIcon?: "xs" | "sm" | "md" | "lg" | "
|
|
16
|
-
avatarSizeRoot?: "xs" | "sm" | "md" | "lg" | "
|
|
15
|
+
avatarSizeIcon?: "xs" | "sm" | "md" | "lg" | "default" | "xl" | undefined;
|
|
16
|
+
avatarSizeRoot?: "xs" | "sm" | "md" | "lg" | "default" | "xl" | undefined;
|
|
17
17
|
avatarTextVariantRoot?: "primary" | "secondary" | "default" | undefined;
|
|
18
18
|
badgeSizeIcon?: "xs" | "sm" | "md" | "lg" | "default" | undefined;
|
|
19
19
|
badgeSizeRoot?: "xs" | "sm" | "md" | "lg" | "default" | undefined;
|
|
@@ -24,8 +24,8 @@ declare const getStylesInternal: (props?: ({
|
|
|
24
24
|
bottomsheetVariantRoot?: "default" | undefined;
|
|
25
25
|
buttonSizeIcon?: "xs" | "sm" | "md" | "lg" | "default" | undefined;
|
|
26
26
|
buttonSizeRoot?: "xs" | "sm" | "md" | "lg" | "default" | undefined;
|
|
27
|
-
buttonVariantIcon?: "primary" | "secondary" | "tertiary" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "default" | "
|
|
28
|
-
buttonVariantRoot?: "primary" | "secondary" | "tertiary" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "default" | "
|
|
27
|
+
buttonVariantIcon?: "primary" | "secondary" | "tertiary" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "default" | "alert-tertiary" | "brand-tertiary" | "contrast-high" | "contrast-low" | "contrast-medium" | "info-tertiary" | "positive-tertiary" | "warning-tertiary" | undefined;
|
|
28
|
+
buttonVariantRoot?: "primary" | "secondary" | "tertiary" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "default" | "alert-tertiary" | "brand-tertiary" | "contrast-high" | "contrast-low" | "contrast-medium" | "info-tertiary" | "positive-tertiary" | "warning-tertiary" | undefined;
|
|
29
29
|
checkboxSizeCheckbox?: "sm" | "md" | "default" | undefined;
|
|
30
30
|
checkboxSizeRoot?: "sm" | "md" | "default" | undefined;
|
|
31
31
|
checkboxVariantCheckbox?: "primary" | "secondary" | "alert" | "alert-secondary" | "default" | undefined;
|
|
@@ -47,8 +47,8 @@ declare const getStylesInternal: (props?: ({
|
|
|
47
47
|
dividerVariantLabel?: "primary" | "secondary" | "tertiary" | "muted" | "default" | undefined;
|
|
48
48
|
dividerVariantLine?: "primary" | "secondary" | "tertiary" | "muted" | "default" | undefined;
|
|
49
49
|
dividerVariantRoot?: "primary" | "secondary" | "tertiary" | "muted" | "default" | undefined;
|
|
50
|
-
iconbuttonSizeIcon?: "xs" | "sm" | "md" | "lg" | "
|
|
51
|
-
iconbuttonSizeRoot?: "xs" | "sm" | "md" | "lg" | "
|
|
50
|
+
iconbuttonSizeIcon?: "xs" | "sm" | "md" | "lg" | "default" | "xl" | undefined;
|
|
51
|
+
iconbuttonSizeRoot?: "xs" | "sm" | "md" | "lg" | "default" | "xl" | undefined;
|
|
52
52
|
inputSizeEndIcon?: "md" | "lg" | "default" | undefined;
|
|
53
53
|
inputSizeHelperIcon?: "md" | "lg" | "default" | undefined;
|
|
54
54
|
inputSizeHelperText?: "md" | "lg" | "default" | undefined;
|
|
@@ -77,8 +77,8 @@ declare const getStylesInternal: (props?: ({
|
|
|
77
77
|
inputVariantValueLabelRequired?: "empty" | "filled" | undefined;
|
|
78
78
|
inputVariantValueRoot?: "empty" | "filled" | undefined;
|
|
79
79
|
inputVariantValueStartIcon?: "empty" | "filled" | undefined;
|
|
80
|
-
linkTextStyleIcon?: "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" |
|
|
81
|
-
linkTextStyleRoot?: "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" |
|
|
80
|
+
linkTextStyleIcon?: "default" | "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | undefined;
|
|
81
|
+
linkTextStyleRoot?: "default" | "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | undefined;
|
|
82
82
|
linkVariantIconEnd?: "primary" | "secondary" | "tertiary" | "on-color" | "default" | undefined;
|
|
83
83
|
linkVariantIconStart?: "primary" | "secondary" | "tertiary" | "on-color" | "default" | undefined;
|
|
84
84
|
linkVariantRoot?: "primary" | "secondary" | "tertiary" | "on-color" | "default" | undefined;
|
|
@@ -141,10 +141,10 @@ declare const getStylesInternal: (props?: ({
|
|
|
141
141
|
toastSizeIcon?: "default" | undefined;
|
|
142
142
|
toastSizeLabel?: "default" | undefined;
|
|
143
143
|
toastSizeRoot?: "default" | undefined;
|
|
144
|
-
toastVariantActionButton?: "warning" | "info" | "default" | "
|
|
145
|
-
toastVariantCloseIcon?: "warning" | "info" | "default" | "
|
|
146
|
-
toastVariantIcon?: "warning" | "info" | "default" | "
|
|
147
|
-
toastVariantRoot?: "warning" | "info" | "default" | "
|
|
144
|
+
toastVariantActionButton?: "warning" | "info" | "default" | "error" | "loading" | "success" | undefined;
|
|
145
|
+
toastVariantCloseIcon?: "warning" | "info" | "default" | "error" | "loading" | "success" | undefined;
|
|
146
|
+
toastVariantIcon?: "warning" | "info" | "default" | "error" | "loading" | "success" | undefined;
|
|
147
|
+
toastVariantRoot?: "warning" | "info" | "default" | "error" | "loading" | "success" | undefined;
|
|
148
148
|
tooltipSizeBody?: "default" | undefined;
|
|
149
149
|
tooltipSizeEndContent?: "default" | undefined;
|
|
150
150
|
tooltipSizeIcon?: "default" | undefined;
|
|
@@ -159,50 +159,50 @@ declare const getStylesInternal: (props?: ({
|
|
|
159
159
|
placeholderColor?: "primary" | "secondary" | "tertiary" | "muted" | "on-color" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | undefined;
|
|
160
160
|
fontFamily?: "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | "display1/emphasized" | "display2/emphasized" | "display3/emphasized" | "title1/emphasized" | "title2/emphasized" | "title3/emphasized" | "title4/emphasized" | "headline1/emphasized" | "body1/emphasized" | "label1/emphasized" | "label2/emphasized" | "label3/emphasized" | "label4/emphasized" | "caption1/emphasized" | "caption2/emphasized" | "legal1/emphasized" | "ui1/emphasized" | "ui2/emphasized" | "ui3/emphasized" | "ui4/emphasized" | "ui5/emphasized" | "ui6/emphasized" | "sans" | "sans-alt" | "serif" | "serif-alt" | "mono" | undefined;
|
|
161
161
|
fontSize?: "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | "display1/emphasized" | "display2/emphasized" | "display3/emphasized" | "title1/emphasized" | "title2/emphasized" | "title3/emphasized" | "title4/emphasized" | "headline1/emphasized" | "body1/emphasized" | "label1/emphasized" | "label2/emphasized" | "label3/emphasized" | "label4/emphasized" | "caption1/emphasized" | "caption2/emphasized" | "legal1/emphasized" | "ui1/emphasized" | "ui2/emphasized" | "ui3/emphasized" | "ui4/emphasized" | "ui5/emphasized" | "ui6/emphasized" | undefined;
|
|
162
|
-
fontWeight?: "black" | "
|
|
162
|
+
fontWeight?: "black" | "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | "bold" | "display1/emphasized" | "display2/emphasized" | "display3/emphasized" | "title1/emphasized" | "title2/emphasized" | "title3/emphasized" | "title4/emphasized" | "headline1/emphasized" | "body1/emphasized" | "label1/emphasized" | "label2/emphasized" | "label3/emphasized" | "label4/emphasized" | "caption1/emphasized" | "caption2/emphasized" | "legal1/emphasized" | "ui1/emphasized" | "ui2/emphasized" | "ui3/emphasized" | "ui4/emphasized" | "ui5/emphasized" | "ui6/emphasized" | "thin" | "extralight" | "light" | "regular" | "medium" | "semibold" | "extrabold" | undefined;
|
|
163
163
|
lineHeight?: "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | "display1/emphasized" | "display2/emphasized" | "display3/emphasized" | "title1/emphasized" | "title2/emphasized" | "title3/emphasized" | "title4/emphasized" | "headline1/emphasized" | "body1/emphasized" | "label1/emphasized" | "label2/emphasized" | "label3/emphasized" | "label4/emphasized" | "caption1/emphasized" | "caption2/emphasized" | "legal1/emphasized" | "ui1/emphasized" | "ui2/emphasized" | "ui3/emphasized" | "ui4/emphasized" | "ui5/emphasized" | "ui6/emphasized" | undefined;
|
|
164
164
|
letterSpacing?: "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | "display1/emphasized" | "display2/emphasized" | "display3/emphasized" | "title1/emphasized" | "title2/emphasized" | "title3/emphasized" | "title4/emphasized" | "headline1/emphasized" | "body1/emphasized" | "label1/emphasized" | "label2/emphasized" | "label3/emphasized" | "label4/emphasized" | "caption1/emphasized" | "caption2/emphasized" | "legal1/emphasized" | "ui1/emphasized" | "ui2/emphasized" | "ui3/emphasized" | "ui4/emphasized" | "ui5/emphasized" | "ui6/emphasized" | undefined;
|
|
165
165
|
textAlign?: "center" | "justify" | "start" | "end" | undefined;
|
|
166
|
-
textTransform?: "
|
|
167
|
-
spacing?: "0" | "
|
|
168
|
-
spacingHorizontal?: "0" | "
|
|
169
|
-
spacingVertical?: "0" | "
|
|
170
|
-
spacingBottom?: "0" | "
|
|
171
|
-
spacingEnd?: "0" | "
|
|
172
|
-
spacingStart?: "0" | "
|
|
173
|
-
spacingTop?: "0" | "
|
|
174
|
-
offset?: "0" | "
|
|
175
|
-
offsetVertical?: "0" | "
|
|
176
|
-
offsetHorizontal?: "0" | "
|
|
177
|
-
offsetBottom?: "0" | "
|
|
178
|
-
offsetEnd?: "0" | "
|
|
179
|
-
offsetStart?: "0" | "
|
|
180
|
-
offsetTop?: "0" | "
|
|
181
|
-
columnGap?: "0" | "
|
|
182
|
-
rowGap?: "0" | "
|
|
166
|
+
textTransform?: "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | "none" | "display1/emphasized" | "display2/emphasized" | "display3/emphasized" | "title1/emphasized" | "title2/emphasized" | "title3/emphasized" | "title4/emphasized" | "headline1/emphasized" | "body1/emphasized" | "label1/emphasized" | "label2/emphasized" | "label3/emphasized" | "label4/emphasized" | "caption1/emphasized" | "caption2/emphasized" | "legal1/emphasized" | "ui1/emphasized" | "ui2/emphasized" | "ui3/emphasized" | "ui4/emphasized" | "ui5/emphasized" | "ui6/emphasized" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
167
|
+
spacing?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
168
|
+
spacingHorizontal?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
169
|
+
spacingVertical?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
170
|
+
spacingBottom?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
171
|
+
spacingEnd?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
172
|
+
spacingStart?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
173
|
+
spacingTop?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
174
|
+
offset?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
175
|
+
offsetVertical?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
176
|
+
offsetHorizontal?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
177
|
+
offsetBottom?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
178
|
+
offsetEnd?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
179
|
+
offsetStart?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
180
|
+
offsetTop?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
181
|
+
columnGap?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
182
|
+
rowGap?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
183
183
|
backgroundColor?: "primary" | "secondary" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | undefined;
|
|
184
184
|
borderColor?: "primary" | "secondary" | "tertiary" | "muted" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | undefined;
|
|
185
185
|
borderStartColor?: "primary" | "secondary" | "tertiary" | "muted" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | undefined;
|
|
186
186
|
borderEndColor?: "primary" | "secondary" | "tertiary" | "muted" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | undefined;
|
|
187
187
|
borderBottomColor?: "primary" | "secondary" | "tertiary" | "muted" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | undefined;
|
|
188
188
|
borderTopColor?: "primary" | "secondary" | "tertiary" | "muted" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | undefined;
|
|
189
|
-
borderRadius?: "
|
|
190
|
-
borderTopStartRadius?: "
|
|
191
|
-
borderTopEndRadius?: "
|
|
192
|
-
borderBottomStartRadius?: "
|
|
193
|
-
borderBottomEndRadius?: "
|
|
194
|
-
borderWidth?: "none" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "
|
|
195
|
-
borderVerticalWidth?: "none" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "
|
|
196
|
-
borderHorizontalWidth?: "none" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "
|
|
197
|
-
borderStartWidth?: "none" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "
|
|
198
|
-
borderEndWidth?: "none" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "
|
|
199
|
-
borderTopWidth?: "none" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "
|
|
200
|
-
borderBottomWidth?: "none" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "
|
|
189
|
+
borderRadius?: "xs" | "sm" | "md" | "lg" | "none" | "xl" | "full" | undefined;
|
|
190
|
+
borderTopStartRadius?: "xs" | "sm" | "md" | "lg" | "none" | "xl" | "full" | undefined;
|
|
191
|
+
borderTopEndRadius?: "xs" | "sm" | "md" | "lg" | "none" | "xl" | "full" | undefined;
|
|
192
|
+
borderBottomStartRadius?: "xs" | "sm" | "md" | "lg" | "none" | "xl" | "full" | undefined;
|
|
193
|
+
borderBottomEndRadius?: "xs" | "sm" | "md" | "lg" | "none" | "xl" | "full" | undefined;
|
|
194
|
+
borderWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
195
|
+
borderVerticalWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
196
|
+
borderHorizontalWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
197
|
+
borderStartWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
198
|
+
borderEndWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
199
|
+
borderTopWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
200
|
+
borderBottomWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
201
201
|
avatarSize?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
202
202
|
iconSize?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
203
203
|
alignContent?: "center" | "flex-start" | "flex-end" | "stretch" | "space-between" | "space-around" | undefined;
|
|
204
204
|
alignItems?: "center" | "flex-start" | "flex-end" | "stretch" | "baseline" | undefined;
|
|
205
|
-
alignSelf?: "
|
|
205
|
+
alignSelf?: "auto" | "center" | "flex-start" | "flex-end" | "stretch" | "baseline" | undefined;
|
|
206
206
|
flex?: "none" | "auto" | "1" | "initial" | undefined;
|
|
207
207
|
flexDirection?: "row" | "column" | "row-reverse" | "column-reverse" | undefined;
|
|
208
208
|
flexGrow?: "0" | "1" | "2" | "3" | undefined;
|
|
@@ -210,21 +210,21 @@ declare const getStylesInternal: (props?: ({
|
|
|
210
210
|
flexWrap?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
|
|
211
211
|
justifyContent?: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | undefined;
|
|
212
212
|
flexBasis?: "min-content" | undefined;
|
|
213
|
-
display?: "
|
|
213
|
+
display?: "flex" | "none" | "grid" | "table" | "block" | "inline-block" | "inline" | "inline-flex" | "inline-table" | "table-caption" | "table-cell" | "table-column" | "table-column-group" | "table-footer-group" | "table-header-group" | "table-row-group" | "table-row" | "flow-root" | "contents" | undefined;
|
|
214
214
|
overflow?: "hidden" | "auto" | "clip" | "visible" | "scroll" | undefined;
|
|
215
215
|
overflowX?: "hidden" | "auto" | "clip" | "visible" | "scroll" | undefined;
|
|
216
216
|
overflowY?: "hidden" | "auto" | "clip" | "visible" | "scroll" | undefined;
|
|
217
|
-
position?: "
|
|
218
|
-
contentFit?: "fill" | "none" | "
|
|
217
|
+
position?: "fixed" | "absolute" | "static" | "relative" | "sticky" | undefined;
|
|
218
|
+
contentFit?: "fill" | "none" | "cover" | "contain" | "scale-down" | undefined;
|
|
219
219
|
colorMode?: "light" | "dark" | undefined;
|
|
220
220
|
scaleMode?: "small" | "medium" | "xSmall" | "large" | "xLarge" | "xxLarge" | "xxxLarge" | undefined;
|
|
221
221
|
width?: "full" | "fit" | "screen" | undefined;
|
|
222
222
|
height?: "full" | "fit" | "screen" | undefined;
|
|
223
|
-
dropShadow?: "
|
|
224
|
-
insetShadow?: "
|
|
225
|
-
nestedBorderRadiusSize?: "
|
|
226
|
-
nestedBorderRadiusWidth?: "none" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "
|
|
227
|
-
nestedBorderRadiusSpacing?: "0" | "
|
|
223
|
+
dropShadow?: "xs" | "sm" | "md" | "lg" | "none" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "xl" | "2xl" | undefined;
|
|
224
|
+
insetShadow?: "xs" | "sm" | "md" | "lg" | "none" | "xl" | "2xl" | "xs-invert" | "sm-invert" | "md-invert" | "lg-invert" | "xl-invert" | "2xl-invert" | undefined;
|
|
225
|
+
nestedBorderRadiusSize?: "xs" | "sm" | "md" | "lg" | "none" | "xl" | "full" | undefined;
|
|
226
|
+
nestedBorderRadiusWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
227
|
+
nestedBorderRadiusSpacing?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
228
228
|
nestedBorderRadius?: boolean | "first" | "last" | undefined;
|
|
229
229
|
} & {
|
|
230
230
|
className?: string | undefined;
|
|
@@ -8,6 +8,7 @@ let node_path = require("node:path");
|
|
|
8
8
|
//#region src/commands/generateComponentData.ts
|
|
9
9
|
/**
|
|
10
10
|
* Pre-generates component analysis data at build time.
|
|
11
|
+
* Keep src/purger/optimized/README.md in sync when this metadata shape changes.
|
|
11
12
|
* This data is used by the optimized purger to know:
|
|
12
13
|
* - Default prop values for each component
|
|
13
14
|
* - Hardcoded literals in getStyles() calls
|
|
@@ -59,8 +60,11 @@ const serializeComponentInfo = (info) => ({
|
|
|
59
60
|
getStylesLiterals: Object.fromEntries(info.getStylesLiterals),
|
|
60
61
|
cxLiterals: info.cxLiterals,
|
|
61
62
|
internalComponents: info.internalComponents,
|
|
62
|
-
internalComponentProps: Object.fromEntries(
|
|
63
|
+
internalComponentProps: Object.fromEntries([...info.internalComponentProps.entries()].map(([key, propsMap]) => [key, Object.fromEntries(propsMap)])),
|
|
63
64
|
propToVariantKeys: Object.fromEntries(info.propToVariantKeys),
|
|
65
|
+
runtimeConfigDefaultProps: Object.fromEntries(info.runtimeConfigDefaultProps),
|
|
66
|
+
runtimeConfigGetStyles: Object.fromEntries([...info.runtimeConfigGetStyles.entries()].map(([key, selectors]) => [key, selectors])),
|
|
67
|
+
runtimeConfigInternalComponentProps: Object.fromEntries([...info.runtimeConfigInternalComponentProps.entries()].map(([key, propsMap]) => [key, Object.fromEntries(propsMap)])),
|
|
64
68
|
motionVarPrefixes: info.motionVarPrefixes
|
|
65
69
|
});
|
|
66
70
|
|
|
@@ -11,6 +11,9 @@ interface SerializedComponentInfo {
|
|
|
11
11
|
internalComponents: string[];
|
|
12
12
|
internalComponentProps: Record<string, Record<string, string[]>>;
|
|
13
13
|
propToVariantKeys: Record<string, string[]>;
|
|
14
|
+
runtimeConfigDefaultProps: Record<string, string>;
|
|
15
|
+
runtimeConfigGetStyles: Record<string, string[]>;
|
|
16
|
+
runtimeConfigInternalComponentProps: Record<string, Record<string, string[]>>;
|
|
14
17
|
motionVarPrefixes: string[];
|
|
15
18
|
}
|
|
16
19
|
type Context = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateComponentData.d.cts","names":[],"sources":["../../src/commands/generateComponentData.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"generateComponentData.d.cts","names":[],"sources":["../../src/commands/generateComponentData.ts"],"mappings":";;;;;UAmBU,uBAAA;EACR,IAAA;EACA,YAAA,EAAc,MAAA;EACd,iBAAA,EAAmB,MAAA;EACnB,UAAA;EACA,kBAAA;EACA,sBAAA,EAAwB,MAAA,SAAe,MAAA;EACvC,iBAAA,EAAmB,MAAA;EACnB,yBAAA,EAA2B,MAAA;EAC3B,sBAAA,EAAwB,MAAA;EACxB,mCAAA,EAAqC,MAAA,SAAe,MAAA;EACpD,iBAAA;AAAA;AAAA,KAQG,OAAA;EACH,OAAA,EAAS,OAAA;EACT,aAAA;EACA,UAAA;AAAA;AAAA,cAGI,gCAAA,GAAoC,UAAA,QAAkB,OAAA,CAAQ,OAAA,MAAW,OAAA"}
|
|
@@ -11,6 +11,9 @@ interface SerializedComponentInfo {
|
|
|
11
11
|
internalComponents: string[];
|
|
12
12
|
internalComponentProps: Record<string, Record<string, string[]>>;
|
|
13
13
|
propToVariantKeys: Record<string, string[]>;
|
|
14
|
+
runtimeConfigDefaultProps: Record<string, string>;
|
|
15
|
+
runtimeConfigGetStyles: Record<string, string[]>;
|
|
16
|
+
runtimeConfigInternalComponentProps: Record<string, Record<string, string[]>>;
|
|
14
17
|
motionVarPrefixes: string[];
|
|
15
18
|
}
|
|
16
19
|
type Context = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateComponentData.d.ts","names":[],"sources":["../../src/commands/generateComponentData.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"generateComponentData.d.ts","names":[],"sources":["../../src/commands/generateComponentData.ts"],"mappings":";;;;;UAmBU,uBAAA;EACR,IAAA;EACA,YAAA,EAAc,MAAA;EACd,iBAAA,EAAmB,MAAA;EACnB,UAAA;EACA,kBAAA;EACA,sBAAA,EAAwB,MAAA,SAAe,MAAA;EACvC,iBAAA,EAAmB,MAAA;EACnB,yBAAA,EAA2B,MAAA;EAC3B,sBAAA,EAAwB,MAAA;EACxB,mCAAA,EAAqC,MAAA,SAAe,MAAA;EACpD,iBAAA;AAAA;AAAA,KAQG,OAAA;EACH,OAAA,EAAS,OAAA;EACT,aAAA;EACA,UAAA;AAAA;AAAA,cAGI,gCAAA,GAAoC,UAAA,QAAkB,OAAA,CAAQ,OAAA,MAAW,OAAA"}
|
|
@@ -7,6 +7,7 @@ import { dirname } from "node:path";
|
|
|
7
7
|
//#region src/commands/generateComponentData.ts
|
|
8
8
|
/**
|
|
9
9
|
* Pre-generates component analysis data at build time.
|
|
10
|
+
* Keep src/purger/optimized/README.md in sync when this metadata shape changes.
|
|
10
11
|
* This data is used by the optimized purger to know:
|
|
11
12
|
* - Default prop values for each component
|
|
12
13
|
* - Hardcoded literals in getStyles() calls
|
|
@@ -58,8 +59,11 @@ const serializeComponentInfo = (info) => ({
|
|
|
58
59
|
getStylesLiterals: Object.fromEntries(info.getStylesLiterals),
|
|
59
60
|
cxLiterals: info.cxLiterals,
|
|
60
61
|
internalComponents: info.internalComponents,
|
|
61
|
-
internalComponentProps: Object.fromEntries(
|
|
62
|
+
internalComponentProps: Object.fromEntries([...info.internalComponentProps.entries()].map(([key, propsMap]) => [key, Object.fromEntries(propsMap)])),
|
|
62
63
|
propToVariantKeys: Object.fromEntries(info.propToVariantKeys),
|
|
64
|
+
runtimeConfigDefaultProps: Object.fromEntries(info.runtimeConfigDefaultProps),
|
|
65
|
+
runtimeConfigGetStyles: Object.fromEntries([...info.runtimeConfigGetStyles.entries()].map(([key, selectors]) => [key, selectors])),
|
|
66
|
+
runtimeConfigInternalComponentProps: Object.fromEntries([...info.runtimeConfigInternalComponentProps.entries()].map(([key, propsMap]) => [key, Object.fromEntries(propsMap)])),
|
|
63
67
|
motionVarPrefixes: info.motionVarPrefixes
|
|
64
68
|
});
|
|
65
69
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateComponentData.js","names":[],"sources":["../../src/commands/generateComponentData.ts"],"sourcesContent":["/**\n * Pre-generates component analysis data at build time.\n * This data is used by the optimized purger to know:\n * - Default prop values for each component\n * - Hardcoded literals in getStyles() calls\n * - Internal component dependencies\n * - Literal props passed to internal components\n */\nimport { mkdirSync, writeFileSync } from 'node:fs';\nimport { dirname } from 'node:path';\n\nimport type { Command, Props } from '@yahoo/uds-cli/lib';\nimport { print } from '@yahoo/uds-cli/lib';\nimport type { Project } from 'ts-morph';\n\nimport type { ComponentInfo } from '../purger/optimized/utils/componentAnalyzer';\nimport { analyzeComponent, scanComponentFiles } from '../purger/optimized/utils/componentAnalyzer';\n\ninterface SerializedComponentInfo {\n name: string;\n defaultProps: Record<string, string>;\n getStylesLiterals: Record<string, string>;\n cxLiterals: string[];\n internalComponents: string[];\n internalComponentProps: Record<string, Record<string, string[]>>;\n propToVariantKeys: Record<string, string[]>;\n motionVarPrefixes: string[];\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ninterface GenerateComponentDataProps extends Props {\n // options: PurgeOptions;\n}\n\ntype Context = {\n project: Project;\n componentsDir: string;\n outputFile: string;\n};\n\nconst makeGenerateComponentDataCommand = (getContext: () => Promise<Context>): Command => ({\n name: 'generateComponentData',\n description: `Generates component data for UDS components. This is an internal command used to by the optimized purger.`,\n tag: 'hidden',\n\n run: async (_props: GenerateComponentDataProps) => {\n const { project, componentsDir, outputFile } = await getContext();\n\n print('Scanning components in:', componentsDir);\n\n const componentPaths = await scanComponentFiles(componentsDir);\n\n print(`Found ${componentPaths.size} components`);\n\n const componentDataEntries = await Promise.all(\n [...componentPaths].map(async ([name, filePath]) => {\n try {\n project.addSourceFileAtPath(filePath);\n const info = analyzeComponent(project, filePath);\n\n return info ? ([name, serializeComponentInfo(info)] as const) : null;\n } catch (error) {\n console.warn(`Warning: Could not analyze ${name}:`, error);\n return null;\n }\n }),\n );\n\n const componentData = Object.fromEntries(\n componentDataEntries.filter((entry): entry is readonly [string, SerializedComponentInfo] =>\n Boolean(entry),\n ),\n );\n\n // Write the data\n mkdirSync(dirname(outputFile), { recursive: true });\n writeFileSync(outputFile, JSON.stringify(componentData, null, 2));\n\n print(`Generated component data for ${Object.keys(componentData).length} components`);\n print(`Output written to: ${outputFile}`);\n\n // Print some stats\n const totals = Object.values(componentData).reduce(\n (acc, comp) => ({\n totalDefaults: acc.totalDefaults + Object.keys(comp.defaultProps).length,\n totalLiterals: acc.totalLiterals + Object.keys(comp.getStylesLiterals).length,\n totalInternalComponents: acc.totalInternalComponents + comp.internalComponents.length,\n }),\n { totalDefaults: 0, totalLiterals: 0, totalInternalComponents: 0 },\n );\n\n print('\\nStats:');\n print(` Default props: ${totals.totalDefaults}`);\n print(` getStyles literals: ${totals.totalLiterals}`);\n print(` Internal component refs: ${totals.totalInternalComponents}`);\n },\n});\n\nconst serializeComponentInfo = (info: ComponentInfo): SerializedComponentInfo => ({\n name: info.name,\n defaultProps: Object.fromEntries(info.defaultProps),\n getStylesLiterals: Object.fromEntries(info.getStylesLiterals),\n cxLiterals: info.cxLiterals,\n internalComponents: info.internalComponents,\n internalComponentProps: Object.fromEntries(\n
|
|
1
|
+
{"version":3,"file":"generateComponentData.js","names":[],"sources":["../../src/commands/generateComponentData.ts"],"sourcesContent":["/**\n * Pre-generates component analysis data at build time.\n * Keep src/purger/optimized/README.md in sync when this metadata shape changes.\n * This data is used by the optimized purger to know:\n * - Default prop values for each component\n * - Hardcoded literals in getStyles() calls\n * - Internal component dependencies\n * - Literal props passed to internal components\n */\nimport { mkdirSync, writeFileSync } from 'node:fs';\nimport { dirname } from 'node:path';\n\nimport type { Command, Props } from '@yahoo/uds-cli/lib';\nimport { print } from '@yahoo/uds-cli/lib';\nimport type { Project } from 'ts-morph';\n\nimport type { ComponentInfo } from '../purger/optimized/utils/componentAnalyzer';\nimport { analyzeComponent, scanComponentFiles } from '../purger/optimized/utils/componentAnalyzer';\n\ninterface SerializedComponentInfo {\n name: string;\n defaultProps: Record<string, string>;\n getStylesLiterals: Record<string, string>;\n cxLiterals: string[];\n internalComponents: string[];\n internalComponentProps: Record<string, Record<string, string[]>>;\n propToVariantKeys: Record<string, string[]>;\n runtimeConfigDefaultProps: Record<string, string>;\n runtimeConfigGetStyles: Record<string, string[]>;\n runtimeConfigInternalComponentProps: Record<string, Record<string, string[]>>;\n motionVarPrefixes: string[];\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ninterface GenerateComponentDataProps extends Props {\n // options: PurgeOptions;\n}\n\ntype Context = {\n project: Project;\n componentsDir: string;\n outputFile: string;\n};\n\nconst makeGenerateComponentDataCommand = (getContext: () => Promise<Context>): Command => ({\n name: 'generateComponentData',\n description: `Generates component data for UDS components. This is an internal command used to by the optimized purger.`,\n tag: 'hidden',\n\n run: async (_props: GenerateComponentDataProps) => {\n const { project, componentsDir, outputFile } = await getContext();\n\n print('Scanning components in:', componentsDir);\n\n const componentPaths = await scanComponentFiles(componentsDir);\n\n print(`Found ${componentPaths.size} components`);\n\n const componentDataEntries = await Promise.all(\n [...componentPaths].map(async ([name, filePath]) => {\n try {\n project.addSourceFileAtPath(filePath);\n const info = analyzeComponent(project, filePath);\n\n return info ? ([name, serializeComponentInfo(info)] as const) : null;\n } catch (error) {\n console.warn(`Warning: Could not analyze ${name}:`, error);\n return null;\n }\n }),\n );\n\n const componentData = Object.fromEntries(\n componentDataEntries.filter((entry): entry is readonly [string, SerializedComponentInfo] =>\n Boolean(entry),\n ),\n );\n\n // Write the data\n mkdirSync(dirname(outputFile), { recursive: true });\n writeFileSync(outputFile, JSON.stringify(componentData, null, 2));\n\n print(`Generated component data for ${Object.keys(componentData).length} components`);\n print(`Output written to: ${outputFile}`);\n\n // Print some stats\n const totals = Object.values(componentData).reduce(\n (acc, comp) => ({\n totalDefaults: acc.totalDefaults + Object.keys(comp.defaultProps).length,\n totalLiterals: acc.totalLiterals + Object.keys(comp.getStylesLiterals).length,\n totalInternalComponents: acc.totalInternalComponents + comp.internalComponents.length,\n }),\n { totalDefaults: 0, totalLiterals: 0, totalInternalComponents: 0 },\n );\n\n print('\\nStats:');\n print(` Default props: ${totals.totalDefaults}`);\n print(` getStyles literals: ${totals.totalLiterals}`);\n print(` Internal component refs: ${totals.totalInternalComponents}`);\n },\n});\n\nconst serializeComponentInfo = (info: ComponentInfo): SerializedComponentInfo => ({\n name: info.name,\n defaultProps: Object.fromEntries(info.defaultProps),\n getStylesLiterals: Object.fromEntries(info.getStylesLiterals),\n cxLiterals: info.cxLiterals,\n internalComponents: info.internalComponents,\n internalComponentProps: Object.fromEntries(\n [...info.internalComponentProps.entries()].map(([key, propsMap]) => [\n key,\n Object.fromEntries(propsMap),\n ]),\n ),\n propToVariantKeys: Object.fromEntries(info.propToVariantKeys),\n runtimeConfigDefaultProps: Object.fromEntries(info.runtimeConfigDefaultProps),\n runtimeConfigGetStyles: Object.fromEntries(\n [...info.runtimeConfigGetStyles.entries()].map(([key, selectors]) => [key, selectors]),\n ),\n runtimeConfigInternalComponentProps: Object.fromEntries(\n [...info.runtimeConfigInternalComponentProps.entries()].map(([key, propsMap]) => [\n key,\n Object.fromEntries(propsMap),\n ]),\n ),\n motionVarPrefixes: info.motionVarPrefixes,\n});\n\nexport { makeGenerateComponentDataCommand };\nexport type { SerializedComponentInfo };\n"],"mappings":";;;;;;;;;;;;;;;;AA4CA,MAAM,oCAAoC,gBAAiD;CACzF,MAAM;CACN,aAAa;CACb,KAAK;CAEL,KAAK,OAAO,WAAuC;EACjD,MAAM,EAAE,SAAS,eAAe,eAAe,MAAM,YAAY;AAEjE,QAAM,2BAA2B,cAAc;EAE/C,MAAM,iBAAiB,MAAM,mBAAmB,cAAc;AAE9D,QAAM,SAAS,eAAe,KAAK,aAAa;EAEhD,MAAM,uBAAuB,MAAM,QAAQ,IACzC,CAAC,GAAG,eAAe,CAAC,IAAI,OAAO,CAAC,MAAM,cAAc;AAClD,OAAI;AACF,YAAQ,oBAAoB,SAAS;IACrC,MAAM,OAAO,iBAAiB,SAAS,SAAS;AAEhD,WAAO,OAAQ,CAAC,MAAM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AAS,CAAC,CAAC,KAAK,CAAC,KAAK,eAAe,CAAC,KAAK,UAAU,CAAC,CACvF;CACD,qCAAqC,OAAO,YAC1C,CAAC,GAAG,KAAK,oCAAoC,SAAS,CAAC,CAAC,KAAK,CAAC,KAAK,cAAc,CAC/E,KACA,OAAO,YAAY,SAAS,CAC7B,CAAC,CACH;CACD,mBAAmB,KAAK;CACzB"}
|
|
@@ -85,9 +85,10 @@ const generateSimpleModeCSS = async (options) => {
|
|
|
85
85
|
else if (shouldLogStats) require_spinner.spinStop("⚠️", `Config file not found: ${options.configPath}, using defaults`);
|
|
86
86
|
}
|
|
87
87
|
const variantDefaults = require_utils.extractVariantDefaults(tokensConfig);
|
|
88
|
+
const runtimeConfigValues = require_utils.extractRuntimeConfigValues(tokensConfig);
|
|
88
89
|
const resolvedEntries = require_entryPoints.resolveEntryPaths(options.entry, options.workspaceDir);
|
|
89
90
|
const entryDirs = resolvedEntries.map((entry) => entry.absolutePath);
|
|
90
|
-
const scanResult = await require_nodeUtils.scanDirectoriesForSafelist(entryDirs, colorModes, options.variants, options.autoVariants, options.componentData, variantDefaults);
|
|
91
|
+
const scanResult = await require_nodeUtils.scanDirectoriesForSafelist(entryDirs, colorModes, options.variants, options.autoVariants, options.componentData, variantDefaults, runtimeConfigValues);
|
|
91
92
|
const totalFilesScanned = scanResult.filesScanned;
|
|
92
93
|
const allClasses = [...scanResult.safelist];
|
|
93
94
|
const allComponents = new Set(scanResult.components);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.cts","names":[],"sources":["../../src/css/generate.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"generate.d.cts","names":[],"sources":["../../src/css/generate.ts"],"mappings":";;;;;;;;UAmDU,aAAA;;EAER,KAAA;;EAEA,QAAA,GAAW,cAAA;;EAEX,YAAA,GAAe,yBAAA;;EAEf,SAAA;;EAEA,oBAAA;;EAEA,aAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","names":[],"sources":["../../src/css/generate.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","names":[],"sources":["../../src/css/generate.ts"],"mappings":";;;;;;;;;UAmDU,aAAA;;EAER,KAAA;;EAEA,QAAA,GAAW,cAAA;;EAEX,YAAA,GAAe,yBAAA;;EAEf,SAAA;;EAEA,oBAAA;;EAEA,aAAA;AAAA"}
|
|
@@ -6,7 +6,7 @@ import { resolveEntryPaths } from "../utils/entryPoints.js";
|
|
|
6
6
|
import { loadConfigFile, scanDirectoriesForSafelist } from "./nodeUtils.js";
|
|
7
7
|
import { defaultTokensConfig } from "../config/dist/index.js";
|
|
8
8
|
import { deduplicateSafelist, getThemeAndScaleClasses } from "../purger/optimized/utils/safelist.js";
|
|
9
|
-
import { extractVariantDefaults, getConfigurableCssVariables, getMotionVarPrefixes } from "./utils.js";
|
|
9
|
+
import { extractRuntimeConfigValues, extractVariantDefaults, getConfigurableCssVariables, getMotionVarPrefixes } from "./utils.js";
|
|
10
10
|
import { applyScopedColorModeFix, buildPostcssPlugins, createTailwindPlugin, getCssFeatureFlags, optimizeGeneratedCss, printSimpleModeStats } from "./generate.helpers.js";
|
|
11
11
|
import fs from "node:fs";
|
|
12
12
|
import path from "node:path";
|
|
@@ -81,9 +81,10 @@ const generateSimpleModeCSS = async (options) => {
|
|
|
81
81
|
else if (shouldLogStats) spinStop("⚠️", `Config file not found: ${options.configPath}, using defaults`);
|
|
82
82
|
}
|
|
83
83
|
const variantDefaults = extractVariantDefaults(tokensConfig);
|
|
84
|
+
const runtimeConfigValues = extractRuntimeConfigValues(tokensConfig);
|
|
84
85
|
const resolvedEntries = resolveEntryPaths(options.entry, options.workspaceDir);
|
|
85
86
|
const entryDirs = resolvedEntries.map((entry) => entry.absolutePath);
|
|
86
|
-
const scanResult = await scanDirectoriesForSafelist(entryDirs, colorModes, options.variants, options.autoVariants, options.componentData, variantDefaults);
|
|
87
|
+
const scanResult = await scanDirectoriesForSafelist(entryDirs, colorModes, options.variants, options.autoVariants, options.componentData, variantDefaults, runtimeConfigValues);
|
|
87
88
|
const totalFilesScanned = scanResult.filesScanned;
|
|
88
89
|
const allClasses = [...scanResult.safelist];
|
|
89
90
|
const allComponents = new Set(scanResult.components);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","names":[],"sources":["../../src/css/generate.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { gzipSync } from 'node:zlib';\n\nimport { cyan, magenta, print, spinStop, yellow } from '@yahoo/uds-cli/lib';\nimport type { UniversalTokensConfig } from '@yahoo/uds-config';\nimport { defaultTokensConfig } from '@yahoo/uds-config';\nimport postcss from 'postcss';\nimport type { SafelistConfig } from 'tailwindcss/types/config';\n\nimport type { SerializedComponentInfo } from '../commands/generateComponentData';\nimport { deduplicateSafelist, getThemeAndScaleClasses } from '../purger/optimized';\nimport type { EntryValue } from '../utils/entryPoints';\nimport { resolveEntryPaths } from '../utils/entryPoints';\nimport {\n applyScopedColorModeFix,\n buildPostcssPlugins,\n createTailwindPlugin,\n getCssFeatureFlags,\n optimizeGeneratedCss,\n printSimpleModeStats,\n} from './generate.helpers';\nimport { loadConfigFile, scanDirectoriesForSafelist } from './nodeUtils';\nimport type { UDSCSSOptimizationOptions, UDSCSSVarSafelistPattern } from './theme';\nimport { extractVariantDefaults, getConfigurableCssVariables, getMotionVarPrefixes } from './utils';\n\n/**\n * Result from generating CSS\n */\ninterface CSSResult {\n css: string;\n sizeBytes: number;\n sizeGzipBytes: number;\n classCount: number;\n optimizationStats?: {\n originalSize: number;\n originalSizeGzip: number;\n fontFacesRemoved: number;\n emptyRulesRemoved: number;\n validationErrors: string[];\n };\n}\n\n/**\n * CSS generation options for uds.theme.ts\n */\ninterface UDSCSSOptions {\n /** CSS scope wrapper class (optional) */\n scope?: string;\n /** Safelist of CSS classes to always include */\n safelist?: SafelistConfig[];\n /** CSS optimization settings */\n optimization?: UDSCSSOptimizationOptions;\n /** Include Tailwind preflight/reset styles (default: true) */\n preflight?: boolean;\n /** Include @font-face declarations (default: true) */\n fontFaceDeclarations?: boolean;\n /** Debounce delay (ms) for watch mode regenerations */\n watchDebounce?: number;\n}\n\n/**\n * Options for generateCSS function\n */\ninterface GenerateCSSOptions {\n /** CSS scope wrapper class */\n scope?: string;\n /** Directory to scan for arbitrary Tailwind classes (className props) */\n contentDir?: string | string[];\n /** CSS generation options from theme config */\n cssOptions?: UDSCSSOptions;\n /** Reference CSS to deduplicate font-faces against (for scoped CSS) */\n referenceCss?: string;\n /** CSS variable prefixes or patterns to preserve during pruning */\n safeVarPrefixes?: UDSCSSVarSafelistPattern[];\n}\n\nconst normalizeScope = (scope?: string): string | undefined => {\n const trimmedScope = scope?.trim();\n return trimmedScope ? trimmedScope : undefined;\n};\n\nconst getArbitrarySafelistRawContent = (safelist: SafelistConfig[]): string[] => {\n const arbitraryClasses = safelist.filter(\n (entry): entry is string => typeof entry === 'string' && entry.includes('['),\n );\n\n if (arbitraryClasses.length === 0) {\n return [];\n }\n\n return [`<div class=\"${arbitraryClasses.join(' ')}\"></div>`];\n};\n\n/**\n * Generate CSS from a safelist using Tailwind + PostCSS\n * @param safelist - UDS component classes to include\n * @param config - Token configuration\n * @param options - Additional options\n */\nconst generateCSS = async (\n safelist: SafelistConfig[],\n config: UniversalTokensConfig,\n options?: GenerateCSSOptions,\n): Promise<CSSResult> => {\n // Do we need base?\n const sourceCSS = '@tailwind base; @tailwind components; @tailwind utilities';\n\n const contentDir = options?.contentDir ?? path.join(process.cwd(), 'src');\n const cssFlags = getCssFeatureFlags(options?.cssOptions);\n const optimizationConfig = options?.cssOptions?.optimization;\n const scopeClass = normalizeScope(options?.scope) ?? normalizeScope(options?.cssOptions?.scope);\n const twPlugin = createTailwindPlugin({\n contentDir,\n rawContents: getArbitrarySafelistRawContent(safelist),\n safelist,\n config,\n enablePreflight: cssFlags.enablePreflight,\n enableFontFaceDeclarations: cssFlags.enableFontFaceDeclarations,\n });\n const plugins = buildPostcssPlugins({\n tailwindPlugin: twPlugin,\n shouldPruneVars: cssFlags.shouldPruneVars,\n safeVarPrefixes: options?.safeVarPrefixes ?? [],\n scopeClass,\n });\n\n const result = await postcss(plugins).process(sourceCSS, { from: undefined });\n let css = await applyScopedColorModeFix(result.css, scopeClass);\n const optimizedCss = await optimizeGeneratedCss({\n css,\n shouldOptimize: cssFlags.shouldOptimize,\n optimizationConfig,\n referenceCss: options?.referenceCss,\n scopeClass,\n });\n css = optimizedCss.css;\n\n const sizeBytes = Buffer.byteLength(css, 'utf8');\n const sizeGzipBytes = gzipSync(css).length;\n\n return {\n css,\n sizeBytes,\n sizeGzipBytes,\n classCount: safelist.length,\n optimizationStats: optimizedCss.optimizationStats,\n };\n};\n\n/**\n * Generate CSS in simple mode (no uds.theme.ts)\n */\nconst generateSimpleModeCSS = async (options: {\n workspaceDir: string;\n entry: EntryValue;\n outFile: string;\n variants: Record<string, Record<string, string>>;\n autoVariants: Record<string, Record<string, string>>;\n componentData: Record<string, SerializedComponentInfo>;\n scope?: string;\n configPath?: string;\n isWatch?: boolean;\n silent?: boolean;\n}): Promise<{ success: boolean; outputPath: string; packageDirs?: string[] }> => {\n const isWatch = options.isWatch === true;\n const isSilent = options.silent === true;\n const shouldLogStats = !isSilent && !isWatch;\n const startTime = performance.now();\n const colorModes: ('dark' | 'light')[] = ['dark']; // Light mode is already in :root\n\n // Load config if provided, otherwise use default\n let tokensConfig: UniversalTokensConfig = defaultTokensConfig;\n if (options.configPath) {\n const loadedConfig = await loadConfigFile<UniversalTokensConfig>(options.configPath);\n if (loadedConfig) {\n tokensConfig = loadedConfig;\n } else if (shouldLogStats) {\n spinStop('⚠️', `Config file not found: ${options.configPath}, using defaults`);\n }\n }\n\n // Extract variant defaults from config for auto-variant class generation\n const variantDefaults = extractVariantDefaults(tokensConfig);\n\n const resolvedEntries = resolveEntryPaths(options.entry, options.workspaceDir);\n const entryDirs = resolvedEntries.map((entry) => entry.absolutePath);\n const scanResult = await scanDirectoriesForSafelist(\n entryDirs,\n colorModes,\n options.variants,\n options.autoVariants,\n options.componentData,\n variantDefaults,\n );\n\n const totalFilesScanned = scanResult.filesScanned;\n const allClasses: string[] = [...scanResult.safelist];\n const allComponents = new Set<string>(scanResult.components);\n const packageDirs: string[] = [\n ...new Set(\n resolvedEntries.map((entry) =>\n entry.kind === 'directory' ? entry.absolutePath : entry.watchDirectory,\n ),\n ),\n ];\n\n // Add color mode classes\n const fullSafelist = [...allClasses, ...getThemeAndScaleClasses(colorModes)];\n const finalSafelist = deduplicateSafelist(fullSafelist);\n\n // Generate CSS (Tailwind will scan entry dir for arbitrary classes on className props)\n const cssResult = await generateCSS(finalSafelist, tokensConfig, {\n scope: options.scope,\n contentDir: entryDirs,\n safeVarPrefixes: [\n ...getMotionVarPrefixes(options.componentData, [...allComponents]),\n ...getConfigurableCssVariables(),\n ],\n });\n\n // Write output\n const outputPath = path.isAbsolute(options.outFile)\n ? options.outFile\n : path.join(options.workspaceDir, options.outFile);\n const outputDir = path.dirname(outputPath);\n\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n\n fs.writeFileSync(outputPath, cssResult.css);\n\n const duration = Math.round(performance.now() - startTime);\n\n if (shouldLogStats) {\n printSimpleModeStats({\n outputPath,\n totalFilesScanned,\n classCount: cssResult.classCount,\n sizeBytes: cssResult.sizeBytes,\n sizeGzipBytes: cssResult.sizeGzipBytes,\n duration,\n scope: options.scope,\n optimizationStats: cssResult.optimizationStats,\n print,\n magenta,\n cyan,\n yellow,\n });\n }\n\n return { success: true, outputPath, packageDirs };\n};\n\nexport { generateCSS, generateSimpleModeCSS };\nexport type { UDSCSSOptions };\n"],"mappings":";;;;;;;;;;;;;;;;AA6EA,MAAM,kBAAkB,UAAuC;CAC7D,MAAM,eAAe,OAAO,MAAM;AAClC,QAAO,eAAe,eAAe;;AAGvC,MAAM,kCAAkC,aAAyC;CAC/E,MAAM,mBAAmB,SA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eAAe,UAAU;EACzB;EACA,OAAO,QAAQ;EACf,mBAAmB,UAAU;EAC7B;EACA;EACA;EACA;EACD,CAAC;AAGJ,QAAO;EAAE,SAAS;EAAM;EAAY;EAAa"}
|
|
1
|
+
{"version":3,"file":"generate.js","names":[],"sources":["../../src/css/generate.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { gzipSync } from 'node:zlib';\n\nimport { cyan, magenta, print, spinStop, yellow } from '@yahoo/uds-cli/lib';\nimport type { UniversalTokensConfig } from '@yahoo/uds-config';\nimport { defaultTokensConfig } from '@yahoo/uds-config';\nimport postcss from 'postcss';\nimport type { SafelistConfig } from 'tailwindcss/types/config';\n\nimport type { SerializedComponentInfo } from '../commands/generateComponentData';\nimport { deduplicateSafelist, getThemeAndScaleClasses } from '../purger/optimized';\nimport type { EntryValue } from '../utils/entryPoints';\nimport { resolveEntryPaths } from '../utils/entryPoints';\nimport {\n applyScopedColorModeFix,\n buildPostcssPlugins,\n createTailwindPlugin,\n getCssFeatureFlags,\n optimizeGeneratedCss,\n printSimpleModeStats,\n} from './generate.helpers';\nimport { loadConfigFile, scanDirectoriesForSafelist } from './nodeUtils';\nimport type { UDSCSSOptimizationOptions, UDSCSSVarSafelistPattern } from './theme';\nimport {\n extractRuntimeConfigValues,\n extractVariantDefaults,\n getConfigurableCssVariables,\n getMotionVarPrefixes,\n} from './utils';\n\n/**\n * Result from generating CSS\n */\ninterface CSSResult {\n css: string;\n sizeBytes: number;\n sizeGzipBytes: number;\n classCount: number;\n optimizationStats?: {\n originalSize: number;\n originalSizeGzip: number;\n fontFacesRemoved: number;\n emptyRulesRemoved: number;\n validationErrors: string[];\n };\n}\n\n/**\n * CSS generation options for uds.theme.ts\n */\ninterface UDSCSSOptions {\n /** CSS scope wrapper class (optional) */\n scope?: string;\n /** Safelist of CSS classes to always include */\n safelist?: SafelistConfig[];\n /** CSS optimization settings */\n optimization?: UDSCSSOptimizationOptions;\n /** Include Tailwind preflight/reset styles (default: true) */\n preflight?: boolean;\n /** Include @font-face declarations (default: true) */\n fontFaceDeclarations?: boolean;\n /** Debounce delay (ms) for watch mode regenerations */\n watchDebounce?: number;\n}\n\n/**\n * Options for generateCSS function\n */\ninterface GenerateCSSOptions {\n /** CSS scope wrapper class */\n scope?: string;\n /** Directory to scan for arbitrary Tailwind classes (className props) */\n contentDir?: string | string[];\n /** CSS generation options from theme config */\n cssOptions?: UDSCSSOptions;\n /** Reference CSS to deduplicate font-faces against (for scoped CSS) */\n referenceCss?: string;\n /** CSS variable prefixes or patterns to preserve during pruning */\n safeVarPrefixes?: UDSCSSVarSafelistPattern[];\n}\n\nconst normalizeScope = (scope?: string): string | undefined => {\n const trimmedScope = scope?.trim();\n return trimmedScope ? trimmedScope : undefined;\n};\n\nconst getArbitrarySafelistRawContent = (safelist: SafelistConfig[]): string[] => {\n const arbitraryClasses = safelist.filter(\n (entry): entry is string => typeof entry === 'string' && entry.includes('['),\n );\n\n if (arbitraryClasses.length === 0) {\n return [];\n }\n\n return [`<div class=\"${arbitraryClasses.join(' ')}\"></div>`];\n};\n\n/**\n * Generate CSS from a safelist using Tailwind + PostCSS\n * @param safelist - UDS component classes to include\n * @param config - Token configuration\n * @param options - Additional options\n */\nconst generateCSS = async (\n safelist: SafelistConfig[],\n config: UniversalTokensConfig,\n options?: GenerateCSSOptions,\n): Promise<CSSResult> => {\n // Do we need base?\n const sourceCSS = '@tailwind base; @tailwind components; @tailwind utilities';\n\n const contentDir = options?.contentDir ?? path.join(process.cwd(), 'src');\n const cssFlags = getCssFeatureFlags(options?.cssOptions);\n const optimizationConfig = options?.cssOptions?.optimization;\n const scopeClass = normalizeScope(options?.scope) ?? normalizeScope(options?.cssOptions?.scope);\n const twPlugin = createTailwindPlugin({\n contentDir,\n rawContents: getArbitrarySafelistRawContent(safelist),\n safelist,\n config,\n enablePreflight: cssFlags.enablePreflight,\n enableFontFaceDeclarations: cssFlags.enableFontFaceDeclarations,\n });\n const plugins = buildPostcssPlugins({\n tailwindPlugin: twPlugin,\n shouldPruneVars: cssFlags.shouldPruneVars,\n safeVarPrefixes: options?.safeVarPrefixes ?? [],\n scopeClass,\n });\n\n const result = await postcss(plugins).process(sourceCSS, { from: undefined });\n let css = await applyScopedColorModeFix(result.css, scopeClass);\n const optimizedCss = await optimizeGeneratedCss({\n css,\n shouldOptimize: cssFlags.shouldOptimize,\n optimizationConfig,\n referenceCss: options?.referenceCss,\n scopeClass,\n });\n css = optimizedCss.css;\n\n const sizeBytes = Buffer.byteLength(css, 'utf8');\n const sizeGzipBytes = gzipSync(css).length;\n\n return {\n css,\n sizeBytes,\n sizeGzipBytes,\n classCount: safelist.length,\n optimizationStats: optimizedCss.optimizationStats,\n };\n};\n\n/**\n * Generate CSS in simple mode (no uds.theme.ts)\n */\nconst generateSimpleModeCSS = async (options: {\n workspaceDir: string;\n entry: EntryValue;\n outFile: string;\n variants: Record<string, Record<string, string>>;\n autoVariants: Record<string, Record<string, string>>;\n componentData: Record<string, SerializedComponentInfo>;\n scope?: string;\n configPath?: string;\n isWatch?: boolean;\n silent?: boolean;\n}): Promise<{ success: boolean; outputPath: string; packageDirs?: string[] }> => {\n const isWatch = options.isWatch === true;\n const isSilent = options.silent === true;\n const shouldLogStats = !isSilent && !isWatch;\n const startTime = performance.now();\n const colorModes: ('dark' | 'light')[] = ['dark']; // Light mode is already in :root\n\n // Load config if provided, otherwise use default\n let tokensConfig: UniversalTokensConfig = defaultTokensConfig;\n if (options.configPath) {\n const loadedConfig = await loadConfigFile<UniversalTokensConfig>(options.configPath);\n if (loadedConfig) {\n tokensConfig = loadedConfig;\n } else if (shouldLogStats) {\n spinStop('⚠️', `Config file not found: ${options.configPath}, using defaults`);\n }\n }\n\n // Extract variant defaults from config for auto-variant class generation\n const variantDefaults = extractVariantDefaults(tokensConfig);\n const runtimeConfigValues = extractRuntimeConfigValues(tokensConfig);\n\n const resolvedEntries = resolveEntryPaths(options.entry, options.workspaceDir);\n const entryDirs = resolvedEntries.map((entry) => entry.absolutePath);\n const scanResult = await scanDirectoriesForSafelist(\n entryDirs,\n colorModes,\n options.variants,\n options.autoVariants,\n options.componentData,\n variantDefaults,\n runtimeConfigValues,\n );\n\n const totalFilesScanned = scanResult.filesScanned;\n const allClasses: string[] = [...scanResult.safelist];\n const allComponents = new Set<string>(scanResult.components);\n const packageDirs: string[] = [\n ...new Set(\n resolvedEntries.map((entry) =>\n entry.kind === 'directory' ? entry.absolutePath : entry.watchDirectory,\n ),\n ),\n ];\n\n // Add color mode classes\n const fullSafelist = [...allClasses, ...getThemeAndScaleClasses(colorModes)];\n const finalSafelist = deduplicateSafelist(fullSafelist);\n\n // Generate CSS (Tailwind will scan entry dir for arbitrary classes on className props)\n const cssResult = await generateCSS(finalSafelist, tokensConfig, {\n scope: options.scope,\n contentDir: entryDirs,\n safeVarPrefixes: [\n ...getMotionVarPrefixes(options.componentData, [...allComponents]),\n ...getConfigurableCssVariables(),\n ],\n });\n\n // Write output\n const outputPath = path.isAbsolute(options.outFile)\n ? options.outFile\n : path.join(options.workspaceDir, options.outFile);\n const outputDir = path.dirname(outputPath);\n\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n\n fs.writeFileSync(outputPath, cssResult.css);\n\n const duration = Math.round(performance.now() - startTime);\n\n if (shouldLogStats) {\n printSimpleModeStats({\n outputPath,\n totalFilesScanned,\n classCount: cssResult.classCount,\n sizeBytes: cssResult.sizeBytes,\n sizeGzipBytes: cssResult.sizeGzipBytes,\n duration,\n scope: options.scope,\n optimizationStats: cssResult.optimizationStats,\n print,\n magenta,\n cyan,\n yellow,\n });\n }\n\n return { success: true, outputPath, packageDirs };\n};\n\nexport { generateCSS, generateSimpleModeCSS };\nexport type { UDSCSSOptions };\n"],"mappings":";;;;;;;;;;;;;;;;AAkFA,MAAM,kBAAkB,UAAuC;CAC7D,MAAM,eAAe,OAAO,MAAM;AAClC,QAAO,eAAe,eAAe;;AAGvC,MAAM,kCAAkC,aAAyC;CAC/E,MAA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qB;EACnB;EACA;EACA,YAAY,UAAU;EACtB,WAAW,UAAU;EACrB,eAAe,UAAU;EACzB;EACA,OAAO,QAAQ;EACf,mBAAmB,UAAU;EAC7B;EACA;EACA;EACA;EACD,CAAC;AAGJ,QAAO;EAAE,SAAS;EAAM;EAAY;EAAa"}
|
|
@@ -23,7 +23,7 @@ const loadConfigFile = async (configPath) => {
|
|
|
23
23
|
throw new Error(`Failed to load config file: ${absolutePath}\n${error instanceof Error ? error.message : "Unknown error"}`);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
const scanDirectoryForSafelist = async (dir, colorModes, variants, autoVariants, componentData, variantDefaults, includeAllClassNamePrimitives = false) => {
|
|
26
|
+
const scanDirectoryForSafelist = async (dir, colorModes, variants, autoVariants, componentData, variantDefaults, runtimeConfigValues, includeAllClassNamePrimitives = false) => {
|
|
27
27
|
const files = await (0, fast_glob.default)("**/*.{js,jsx,ts,tsx}", {
|
|
28
28
|
cwd: dir,
|
|
29
29
|
absolute: true,
|
|
@@ -33,6 +33,7 @@ const scanDirectoryForSafelist = async (dir, colorModes, variants, autoVariants,
|
|
|
33
33
|
return require_purgeFromCode.purgeFromCodeOptimized(node_fs.default.readFileSync(filePath, "utf-8"), {
|
|
34
34
|
colorModes,
|
|
35
35
|
variantDefaults,
|
|
36
|
+
runtimeConfigValues,
|
|
36
37
|
variants,
|
|
37
38
|
autoVariants,
|
|
38
39
|
componentData,
|
|
@@ -46,10 +47,11 @@ const scanDirectoryForSafelist = async (dir, colorModes, variants, autoVariants,
|
|
|
46
47
|
filesScanned: files.length
|
|
47
48
|
};
|
|
48
49
|
};
|
|
49
|
-
const scanFileForSafelist = async (filePath, colorModes, variants, autoVariants, componentData, variantDefaults, includeAllClassNamePrimitives = false) => {
|
|
50
|
+
const scanFileForSafelist = async (filePath, colorModes, variants, autoVariants, componentData, variantDefaults, runtimeConfigValues, includeAllClassNamePrimitives = false) => {
|
|
50
51
|
const result = await require_purgeFromCode.purgeFromCodeOptimized(node_fs.default.readFileSync(filePath, "utf-8"), {
|
|
51
52
|
colorModes,
|
|
52
53
|
variantDefaults,
|
|
54
|
+
runtimeConfigValues,
|
|
53
55
|
variants,
|
|
54
56
|
autoVariants,
|
|
55
57
|
componentData,
|
|
@@ -61,10 +63,10 @@ const scanFileForSafelist = async (filePath, colorModes, variants, autoVariants,
|
|
|
61
63
|
filesScanned: 1
|
|
62
64
|
};
|
|
63
65
|
};
|
|
64
|
-
const scanDirectoriesForSafelist = async (dirs, colorModes, variants, autoVariants, componentData, variantDefaults, includeAllClassNamePrimitives = false) => {
|
|
66
|
+
const scanDirectoriesForSafelist = async (dirs, colorModes, variants, autoVariants, componentData, variantDefaults, runtimeConfigValues, includeAllClassNamePrimitives = false) => {
|
|
65
67
|
const results = await Promise.all(dirs.map((dir) => {
|
|
66
|
-
if (node_fs.default.existsSync(dir) && node_fs.default.statSync(dir).isFile()) return scanFileForSafelist(dir, colorModes, variants, autoVariants, componentData, variantDefaults, includeAllClassNamePrimitives);
|
|
67
|
-
return scanDirectoryForSafelist(dir, colorModes, variants, autoVariants, componentData, variantDefaults, includeAllClassNamePrimitives);
|
|
68
|
+
if (node_fs.default.existsSync(dir) && node_fs.default.statSync(dir).isFile()) return scanFileForSafelist(dir, colorModes, variants, autoVariants, componentData, variantDefaults, runtimeConfigValues, includeAllClassNamePrimitives);
|
|
69
|
+
return scanDirectoryForSafelist(dir, colorModes, variants, autoVariants, componentData, variantDefaults, runtimeConfigValues, includeAllClassNamePrimitives);
|
|
68
70
|
}));
|
|
69
71
|
return {
|
|
70
72
|
safelist: results.flatMap((result) => result.safelist),
|
|
@@ -19,7 +19,7 @@ const loadConfigFile = async (configPath) => {
|
|
|
19
19
|
throw new Error(`Failed to load config file: ${absolutePath}\n${error instanceof Error ? error.message : "Unknown error"}`);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
const scanDirectoryForSafelist = async (dir, colorModes, variants, autoVariants, componentData, variantDefaults, includeAllClassNamePrimitives = false) => {
|
|
22
|
+
const scanDirectoryForSafelist = async (dir, colorModes, variants, autoVariants, componentData, variantDefaults, runtimeConfigValues, includeAllClassNamePrimitives = false) => {
|
|
23
23
|
const files = await fg("**/*.{js,jsx,ts,tsx}", {
|
|
24
24
|
cwd: dir,
|
|
25
25
|
absolute: true,
|
|
@@ -29,6 +29,7 @@ const scanDirectoryForSafelist = async (dir, colorModes, variants, autoVariants,
|
|
|
29
29
|
return purgeFromCodeOptimized(fs.readFileSync(filePath, "utf-8"), {
|
|
30
30
|
colorModes,
|
|
31
31
|
variantDefaults,
|
|
32
|
+
runtimeConfigValues,
|
|
32
33
|
variants,
|
|
33
34
|
autoVariants,
|
|
34
35
|
componentData,
|
|
@@ -42,10 +43,11 @@ const scanDirectoryForSafelist = async (dir, colorModes, variants, autoVariants,
|
|
|
42
43
|
filesScanned: files.length
|
|
43
44
|
};
|
|
44
45
|
};
|
|
45
|
-
const scanFileForSafelist = async (filePath, colorModes, variants, autoVariants, componentData, variantDefaults, includeAllClassNamePrimitives = false) => {
|
|
46
|
+
const scanFileForSafelist = async (filePath, colorModes, variants, autoVariants, componentData, variantDefaults, runtimeConfigValues, includeAllClassNamePrimitives = false) => {
|
|
46
47
|
const result = await purgeFromCodeOptimized(fs.readFileSync(filePath, "utf-8"), {
|
|
47
48
|
colorModes,
|
|
48
49
|
variantDefaults,
|
|
50
|
+
runtimeConfigValues,
|
|
49
51
|
variants,
|
|
50
52
|
autoVariants,
|
|
51
53
|
componentData,
|
|
@@ -57,10 +59,10 @@ const scanFileForSafelist = async (filePath, colorModes, variants, autoVariants,
|
|
|
57
59
|
filesScanned: 1
|
|
58
60
|
};
|
|
59
61
|
};
|
|
60
|
-
const scanDirectoriesForSafelist = async (dirs, colorModes, variants, autoVariants, componentData, variantDefaults, includeAllClassNamePrimitives = false) => {
|
|
62
|
+
const scanDirectoriesForSafelist = async (dirs, colorModes, variants, autoVariants, componentData, variantDefaults, runtimeConfigValues, includeAllClassNamePrimitives = false) => {
|
|
61
63
|
const results = await Promise.all(dirs.map((dir) => {
|
|
62
|
-
if (fs.existsSync(dir) && fs.statSync(dir).isFile()) return scanFileForSafelist(dir, colorModes, variants, autoVariants, componentData, variantDefaults, includeAllClassNamePrimitives);
|
|
63
|
-
return scanDirectoryForSafelist(dir, colorModes, variants, autoVariants, componentData, variantDefaults, includeAllClassNamePrimitives);
|
|
64
|
+
if (fs.existsSync(dir) && fs.statSync(dir).isFile()) return scanFileForSafelist(dir, colorModes, variants, autoVariants, componentData, variantDefaults, runtimeConfigValues, includeAllClassNamePrimitives);
|
|
65
|
+
return scanDirectoryForSafelist(dir, colorModes, variants, autoVariants, componentData, variantDefaults, runtimeConfigValues, includeAllClassNamePrimitives);
|
|
64
66
|
}));
|
|
65
67
|
return {
|
|
66
68
|
safelist: results.flatMap((result) => result.safelist),
|