@yahoo/uds 3.116.1 → 3.116.3
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/Scrim.cjs +0 -2
- package/dist/components/Scrim.js +0 -2
- package/dist/components/client/BottomSheet/BottomSheet.cjs +37 -8
- package/dist/components/client/BottomSheet/BottomSheet.js +38 -9
- package/dist/components/client/BottomSheet/BottomSheetContent.cjs +4 -2
- package/dist/components/client/BottomSheet/BottomSheetContent.js +4 -2
- package/dist/components/client/BottomSheet/BottomSheetInternalContext.cjs +15 -0
- package/dist/components/client/BottomSheet/BottomSheetInternalContext.d.cts +12 -0
- package/dist/components/client/BottomSheet/BottomSheetInternalContext.d.ts +12 -0
- package/dist/components/client/BottomSheet/BottomSheetInternalContext.js +12 -0
- package/dist/styles/styler.d.cts +85 -85
- package/dist/styles/styler.d.ts +85 -85
- package/dist/tailwind/dist/css/generate.cjs +6 -0
- package/dist/tailwind/dist/css/generate.helpers.cjs +5 -1
- package/dist/tailwind/dist/css/generate.helpers.js +5 -1
- package/dist/tailwind/dist/css/generate.js +6 -0
- package/dist/tailwind/dist/css/nodeUtils.cjs +2 -1
- package/dist/tailwind/dist/css/nodeUtils.js +2 -1
- package/dist/tailwind/dist/purger/optimized/ast/expressions.cjs +103 -1
- package/dist/tailwind/dist/purger/optimized/ast/expressions.js +102 -2
- package/dist/tailwind/dist/purger/optimized/ast/jsx.cjs +7 -1
- package/dist/tailwind/dist/purger/optimized/ast/jsx.js +7 -1
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.cjs +18 -13
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.js +18 -13
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.cjs +2 -1
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js +2 -1
- package/dist/uds/generated/componentData.cjs +1124 -1105
- package/dist/uds/generated/componentData.js +1077 -1064
- package/dist/uds/generated/tailwindPurge.cjs +7 -7
- package/dist/uds/generated/tailwindPurge.js +7 -7
- package/generated/componentData.json +1610 -1595
- package/generated/tailwindPurge.ts +2 -2
- package/package.json +1 -1
package/dist/styles/styler.d.ts
CHANGED
|
@@ -10,52 +10,52 @@ declare function normalizeObject(props: Record<string, unknown>): Record<string,
|
|
|
10
10
|
declare const cx: CX<string>;
|
|
11
11
|
declare const cva: CVA<string>;
|
|
12
12
|
declare const getStylesInternal: (props?: ({
|
|
13
|
-
avatarIconVariantRoot?: "
|
|
14
|
-
avatarImageVariantRoot?: "
|
|
15
|
-
avatarSizeIcon?: "xs" | "sm" | "md" | "lg" | "xl" |
|
|
16
|
-
avatarSizeRoot?: "xs" | "sm" | "md" | "lg" | "xl" |
|
|
17
|
-
avatarTextVariantRoot?: "
|
|
18
|
-
badgeSizeIcon?: "
|
|
19
|
-
badgeSizeRoot?: "
|
|
20
|
-
badgeVariantIcon?: "primary" | "secondary" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" |
|
|
21
|
-
badgeVariantRoot?: "primary" | "secondary" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" |
|
|
13
|
+
avatarIconVariantRoot?: "default" | "primary" | "secondary" | undefined;
|
|
14
|
+
avatarImageVariantRoot?: "default" | "primary" | "secondary" | undefined;
|
|
15
|
+
avatarSizeIcon?: "default" | "xs" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
16
|
+
avatarSizeRoot?: "default" | "xs" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
17
|
+
avatarTextVariantRoot?: "default" | "primary" | "secondary" | undefined;
|
|
18
|
+
badgeSizeIcon?: "default" | "xs" | "sm" | "md" | "lg" | undefined;
|
|
19
|
+
badgeSizeRoot?: "default" | "xs" | "sm" | "md" | "lg" | undefined;
|
|
20
|
+
badgeVariantIcon?: "default" | "primary" | "secondary" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | undefined;
|
|
21
|
+
badgeVariantRoot?: "default" | "primary" | "secondary" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | undefined;
|
|
22
22
|
bottomsheetVariantHeader?: "default" | undefined;
|
|
23
23
|
bottomsheetVariantRoot?: "default" | undefined;
|
|
24
|
-
buttonSizeIcon?: "
|
|
25
|
-
buttonSizeRoot?: "
|
|
26
|
-
buttonVariantIcon?: "primary" | "secondary" | "tertiary" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "
|
|
27
|
-
buttonVariantRoot?: "primary" | "secondary" | "tertiary" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "
|
|
28
|
-
checkboxSizeCheckbox?: "
|
|
29
|
-
checkboxSizeRoot?: "
|
|
30
|
-
checkboxVariantCheckbox?: "primary" | "secondary" | "alert" | "alert-secondary" |
|
|
31
|
-
checkboxVariantCheckboxIcon?: "primary" | "secondary" | "alert" | "alert-secondary" |
|
|
32
|
-
checkboxVariantRoot?: "primary" | "secondary" | "alert" | "alert-secondary" |
|
|
24
|
+
buttonSizeIcon?: "default" | "xs" | "sm" | "md" | "lg" | undefined;
|
|
25
|
+
buttonSizeRoot?: "default" | "xs" | "sm" | "md" | "lg" | undefined;
|
|
26
|
+
buttonVariantIcon?: "default" | "primary" | "secondary" | "tertiary" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "alert-tertiary" | "brand-tertiary" | "contrast-high" | "contrast-low" | "contrast-medium" | "info-tertiary" | "positive-tertiary" | "warning-tertiary" | undefined;
|
|
27
|
+
buttonVariantRoot?: "default" | "primary" | "secondary" | "tertiary" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "alert-tertiary" | "brand-tertiary" | "contrast-high" | "contrast-low" | "contrast-medium" | "info-tertiary" | "positive-tertiary" | "warning-tertiary" | undefined;
|
|
28
|
+
checkboxSizeCheckbox?: "default" | "sm" | "md" | undefined;
|
|
29
|
+
checkboxSizeRoot?: "default" | "sm" | "md" | undefined;
|
|
30
|
+
checkboxVariantCheckbox?: "default" | "primary" | "secondary" | "alert" | "alert-secondary" | undefined;
|
|
31
|
+
checkboxVariantCheckboxIcon?: "default" | "primary" | "secondary" | "alert" | "alert-secondary" | undefined;
|
|
32
|
+
checkboxVariantRoot?: "default" | "primary" | "secondary" | "alert" | "alert-secondary" | undefined;
|
|
33
33
|
checkboxVariantValueCheckbox?: "checked" | "indeterminate" | "unchecked" | undefined;
|
|
34
34
|
checkboxVariantValueCheckboxIcon?: "checked" | "indeterminate" | "unchecked" | undefined;
|
|
35
35
|
checkboxVariantValueRoot?: "checked" | "indeterminate" | "unchecked" | undefined;
|
|
36
|
-
chipDismissibleVariantIcon?: "primary" | "secondary" | "brand" | "brand-secondary" |
|
|
37
|
-
chipDismissibleVariantRoot?: "primary" | "secondary" | "brand" | "brand-secondary" |
|
|
38
|
-
chipLinkVariantIcon?: "primary" | "secondary" | "brand" | "brand-secondary" |
|
|
39
|
-
chipLinkVariantRoot?: "primary" | "secondary" | "brand" | "brand-secondary" |
|
|
40
|
-
chipSizeIcon?: "
|
|
41
|
-
chipSizeRoot?: "
|
|
36
|
+
chipDismissibleVariantIcon?: "default" | "primary" | "secondary" | "brand" | "brand-secondary" | undefined;
|
|
37
|
+
chipDismissibleVariantRoot?: "default" | "primary" | "secondary" | "brand" | "brand-secondary" | undefined;
|
|
38
|
+
chipLinkVariantIcon?: "default" | "primary" | "secondary" | "brand" | "brand-secondary" | undefined;
|
|
39
|
+
chipLinkVariantRoot?: "default" | "primary" | "secondary" | "brand" | "brand-secondary" | undefined;
|
|
40
|
+
chipSizeIcon?: "default" | "sm" | "md" | undefined;
|
|
41
|
+
chipSizeRoot?: "default" | "sm" | "md" | undefined;
|
|
42
42
|
chipToggleVariantActiveIcon?: "off" | "on" | undefined;
|
|
43
43
|
chipToggleVariantActiveRoot?: "off" | "on" | undefined;
|
|
44
|
-
chipToggleVariantIcon?: "primary" | "secondary" | "brand" | "brand-secondary" |
|
|
45
|
-
chipToggleVariantRoot?: "primary" | "secondary" | "brand" | "brand-secondary" |
|
|
46
|
-
dividerVariantLabel?: "
|
|
47
|
-
dividerVariantLine?: "
|
|
48
|
-
dividerVariantRoot?: "
|
|
49
|
-
iconbuttonSizeIcon?: "xs" | "sm" | "md" | "lg" | "xl" |
|
|
50
|
-
iconbuttonSizeRoot?: "xs" | "sm" | "md" | "lg" | "xl" |
|
|
51
|
-
inputSizeEndIcon?: "
|
|
52
|
-
inputSizeHelperIcon?: "
|
|
53
|
-
inputSizeHelperText?: "
|
|
54
|
-
inputSizeInput?: "
|
|
55
|
-
inputSizeInputWrapper?: "
|
|
56
|
-
inputSizeLabel?: "
|
|
57
|
-
inputSizeRoot?: "
|
|
58
|
-
inputSizeStartIcon?: "
|
|
44
|
+
chipToggleVariantIcon?: "default" | "primary" | "secondary" | "brand" | "brand-secondary" | undefined;
|
|
45
|
+
chipToggleVariantRoot?: "default" | "primary" | "secondary" | "brand" | "brand-secondary" | undefined;
|
|
46
|
+
dividerVariantLabel?: "default" | "primary" | "secondary" | "tertiary" | "muted" | undefined;
|
|
47
|
+
dividerVariantLine?: "default" | "primary" | "secondary" | "tertiary" | "muted" | undefined;
|
|
48
|
+
dividerVariantRoot?: "default" | "primary" | "secondary" | "tertiary" | "muted" | undefined;
|
|
49
|
+
iconbuttonSizeIcon?: "default" | "xs" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
50
|
+
iconbuttonSizeRoot?: "default" | "xs" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
51
|
+
inputSizeEndIcon?: "default" | "md" | "lg" | undefined;
|
|
52
|
+
inputSizeHelperIcon?: "default" | "md" | "lg" | undefined;
|
|
53
|
+
inputSizeHelperText?: "default" | "md" | "lg" | undefined;
|
|
54
|
+
inputSizeInput?: "default" | "md" | "lg" | undefined;
|
|
55
|
+
inputSizeInputWrapper?: "default" | "md" | "lg" | undefined;
|
|
56
|
+
inputSizeLabel?: "default" | "md" | "lg" | undefined;
|
|
57
|
+
inputSizeRoot?: "default" | "md" | "lg" | undefined;
|
|
58
|
+
inputSizeStartIcon?: "default" | "md" | "lg" | undefined;
|
|
59
59
|
inputVariantEndIcon?: "default" | undefined;
|
|
60
60
|
inputVariantHelperIcon?: "default" | undefined;
|
|
61
61
|
inputVariantHelperText?: "default" | undefined;
|
|
@@ -76,11 +76,11 @@ declare const getStylesInternal: (props?: ({
|
|
|
76
76
|
inputVariantValueLabelRequired?: "empty" | "filled" | undefined;
|
|
77
77
|
inputVariantValueRoot?: "empty" | "filled" | undefined;
|
|
78
78
|
inputVariantValueStartIcon?: "empty" | "filled" | undefined;
|
|
79
|
-
linkTextStyleIcon?: "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" |
|
|
80
|
-
linkTextStyleRoot?: "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" |
|
|
81
|
-
linkVariantIconEnd?: "primary" | "secondary" | "tertiary" | "on-color" |
|
|
82
|
-
linkVariantIconStart?: "primary" | "secondary" | "tertiary" | "on-color" |
|
|
83
|
-
linkVariantRoot?: "primary" | "secondary" | "tertiary" | "on-color" |
|
|
79
|
+
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;
|
|
80
|
+
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;
|
|
81
|
+
linkVariantIconEnd?: "default" | "primary" | "secondary" | "tertiary" | "on-color" | undefined;
|
|
82
|
+
linkVariantIconStart?: "default" | "primary" | "secondary" | "tertiary" | "on-color" | undefined;
|
|
83
|
+
linkVariantRoot?: "default" | "primary" | "secondary" | "tertiary" | "on-color" | undefined;
|
|
84
84
|
menucontentSizeRoot?: "default" | undefined;
|
|
85
85
|
menucontentVariantRoot?: "default" | undefined;
|
|
86
86
|
menuitemDividerVariantLine?: "default" | undefined;
|
|
@@ -103,19 +103,19 @@ declare const getStylesInternal: (props?: ({
|
|
|
103
103
|
menuitemSizeEndIcon?: "default" | undefined;
|
|
104
104
|
menuitemSizeRoot?: "default" | undefined;
|
|
105
105
|
menuitemSizeStartIcon?: "default" | undefined;
|
|
106
|
-
radioSizeRadio?: "
|
|
107
|
-
radioSizeRoot?: "
|
|
108
|
-
radioVariantRadio?: "primary" | "secondary" | "alert" | "alert-secondary" |
|
|
109
|
-
radioVariantRadioCircle?: "primary" | "secondary" | "alert" | "alert-secondary" |
|
|
110
|
-
radioVariantRoot?: "primary" | "secondary" | "alert" | "alert-secondary" |
|
|
106
|
+
radioSizeRadio?: "default" | "sm" | "md" | undefined;
|
|
107
|
+
radioSizeRoot?: "default" | "sm" | "md" | undefined;
|
|
108
|
+
radioVariantRadio?: "default" | "primary" | "secondary" | "alert" | "alert-secondary" | undefined;
|
|
109
|
+
radioVariantRadioCircle?: "default" | "primary" | "secondary" | "alert" | "alert-secondary" | undefined;
|
|
110
|
+
radioVariantRoot?: "default" | "primary" | "secondary" | "alert" | "alert-secondary" | undefined;
|
|
111
111
|
radioVariantValueRadio?: "checked" | "unchecked" | undefined;
|
|
112
112
|
radioVariantValueRadioCircle?: "checked" | "unchecked" | undefined;
|
|
113
113
|
radioVariantValueRoot?: "checked" | "unchecked" | undefined;
|
|
114
114
|
scrimVariantRoot?: "default" | undefined;
|
|
115
|
-
switchSizeHandle?: "
|
|
116
|
-
switchSizeHandleIcon?: "
|
|
117
|
-
switchSizeRoot?: "
|
|
118
|
-
switchSizeSwitch?: "
|
|
115
|
+
switchSizeHandle?: "default" | "sm" | "md" | undefined;
|
|
116
|
+
switchSizeHandleIcon?: "default" | "sm" | "md" | undefined;
|
|
117
|
+
switchSizeRoot?: "default" | "sm" | "md" | undefined;
|
|
118
|
+
switchSizeSwitch?: "default" | "sm" | "md" | undefined;
|
|
119
119
|
switchVariantActiveHandle?: "off" | "on" | undefined;
|
|
120
120
|
switchVariantActiveHandleIcon?: "off" | "on" | undefined;
|
|
121
121
|
switchVariantActiveRoot?: "off" | "on" | undefined;
|
|
@@ -129,10 +129,10 @@ declare const getStylesInternal: (props?: ({
|
|
|
129
129
|
toastSizeIcon?: "default" | undefined;
|
|
130
130
|
toastSizeLabel?: "default" | undefined;
|
|
131
131
|
toastSizeRoot?: "default" | undefined;
|
|
132
|
-
toastVariantActionButton?: "
|
|
133
|
-
toastVariantCloseIcon?: "
|
|
134
|
-
toastVariantIcon?: "
|
|
135
|
-
toastVariantRoot?: "
|
|
132
|
+
toastVariantActionButton?: "default" | "warning" | "info" | "error" | "loading" | "success" | undefined;
|
|
133
|
+
toastVariantCloseIcon?: "default" | "warning" | "info" | "error" | "loading" | "success" | undefined;
|
|
134
|
+
toastVariantIcon?: "default" | "warning" | "info" | "error" | "loading" | "success" | undefined;
|
|
135
|
+
toastVariantRoot?: "default" | "warning" | "info" | "error" | "loading" | "success" | undefined;
|
|
136
136
|
tooltipSizeBody?: "default" | undefined;
|
|
137
137
|
tooltipSizeEndContent?: "default" | undefined;
|
|
138
138
|
tooltipSizeIcon?: "default" | undefined;
|
|
@@ -147,11 +147,11 @@ declare const getStylesInternal: (props?: ({
|
|
|
147
147
|
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;
|
|
148
148
|
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;
|
|
149
149
|
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;
|
|
150
|
-
fontWeight?: "
|
|
150
|
+
fontWeight?: "black" | "bold" | "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" | "thin" | "extralight" | "light" | "regular" | "medium" | "semibold" | "extrabold" | undefined;
|
|
151
151
|
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;
|
|
152
152
|
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;
|
|
153
|
-
textAlign?: "
|
|
154
|
-
textTransform?: "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" | "
|
|
153
|
+
textAlign?: "center" | "justify" | "start" | "end" | undefined;
|
|
154
|
+
textTransform?: "none" | "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" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
155
155
|
spacing?: "0" | "px" | "0.5" | "1" | "1.5" | "2" | "2.5" | "3" | "3.5" | "4" | "4.5" | "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;
|
|
156
156
|
spacingHorizontal?: "0" | "px" | "0.5" | "1" | "1.5" | "2" | "2.5" | "3" | "3.5" | "4" | "4.5" | "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;
|
|
157
157
|
spacingVertical?: "0" | "px" | "0.5" | "1" | "1.5" | "2" | "2.5" | "3" | "3.5" | "4" | "4.5" | "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,44 +174,44 @@ declare const getStylesInternal: (props?: ({
|
|
|
174
174
|
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;
|
|
175
175
|
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;
|
|
176
176
|
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;
|
|
177
|
-
borderRadius?: "
|
|
178
|
-
borderTopStartRadius?: "
|
|
179
|
-
borderTopEndRadius?: "
|
|
180
|
-
borderBottomStartRadius?: "
|
|
181
|
-
borderBottomEndRadius?: "
|
|
182
|
-
borderWidth?: "
|
|
183
|
-
borderVerticalWidth?: "
|
|
184
|
-
borderHorizontalWidth?: "
|
|
185
|
-
borderStartWidth?: "
|
|
186
|
-
borderEndWidth?: "
|
|
187
|
-
borderTopWidth?: "
|
|
188
|
-
borderBottomWidth?: "
|
|
177
|
+
borderRadius?: "xs" | "sm" | "md" | "lg" | "none" | "xl" | "full" | undefined;
|
|
178
|
+
borderTopStartRadius?: "xs" | "sm" | "md" | "lg" | "none" | "xl" | "full" | undefined;
|
|
179
|
+
borderTopEndRadius?: "xs" | "sm" | "md" | "lg" | "none" | "xl" | "full" | undefined;
|
|
180
|
+
borderBottomStartRadius?: "xs" | "sm" | "md" | "lg" | "none" | "xl" | "full" | undefined;
|
|
181
|
+
borderBottomEndRadius?: "xs" | "sm" | "md" | "lg" | "none" | "xl" | "full" | undefined;
|
|
182
|
+
borderWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
183
|
+
borderVerticalWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
184
|
+
borderHorizontalWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
185
|
+
borderStartWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
186
|
+
borderEndWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
187
|
+
borderTopWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
188
|
+
borderBottomWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
189
189
|
avatarSize?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
190
190
|
iconSize?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
191
191
|
alignContent?: "center" | "flex-start" | "flex-end" | "stretch" | "space-between" | "space-around" | undefined;
|
|
192
192
|
alignItems?: "center" | "flex-start" | "flex-end" | "stretch" | "baseline" | undefined;
|
|
193
|
-
alignSelf?: "center" | "flex-start" | "flex-end" | "stretch" | "baseline" |
|
|
194
|
-
flex?: "
|
|
193
|
+
alignSelf?: "auto" | "center" | "flex-start" | "flex-end" | "stretch" | "baseline" | undefined;
|
|
194
|
+
flex?: "1" | "none" | "auto" | "initial" | undefined;
|
|
195
195
|
flexDirection?: "row" | "column" | "row-reverse" | "column-reverse" | undefined;
|
|
196
196
|
flexGrow?: "0" | "1" | "2" | "3" | undefined;
|
|
197
197
|
flexShrink?: "0" | "1" | undefined;
|
|
198
198
|
flexWrap?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
|
|
199
199
|
justifyContent?: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | undefined;
|
|
200
200
|
flexBasis?: "min-content" | undefined;
|
|
201
|
-
display?: "flex" | "none" | "block" | "inline-block" | "inline" | "inline-flex" | "
|
|
202
|
-
overflow?: "
|
|
203
|
-
overflowX?: "
|
|
204
|
-
overflowY?: "
|
|
205
|
-
position?: "
|
|
206
|
-
contentFit?: "
|
|
201
|
+
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;
|
|
202
|
+
overflow?: "hidden" | "auto" | "clip" | "visible" | "scroll" | undefined;
|
|
203
|
+
overflowX?: "hidden" | "auto" | "clip" | "visible" | "scroll" | undefined;
|
|
204
|
+
overflowY?: "hidden" | "auto" | "clip" | "visible" | "scroll" | undefined;
|
|
205
|
+
position?: "fixed" | "absolute" | "static" | "relative" | "sticky" | undefined;
|
|
206
|
+
contentFit?: "fill" | "none" | "cover" | "contain" | "scale-down" | undefined;
|
|
207
207
|
colorMode?: "light" | "dark" | undefined;
|
|
208
|
-
scaleMode?: "
|
|
208
|
+
scaleMode?: "small" | "medium" | "xSmall" | "large" | "xLarge" | "xxLarge" | "xxxLarge" | undefined;
|
|
209
209
|
width?: "full" | "fit" | "screen" | undefined;
|
|
210
210
|
height?: "full" | "fit" | "screen" | undefined;
|
|
211
|
-
dropShadow?: "
|
|
212
|
-
insetShadow?: "
|
|
213
|
-
nestedBorderRadiusSize?: "
|
|
214
|
-
nestedBorderRadiusWidth?: "
|
|
211
|
+
dropShadow?: "xs" | "sm" | "md" | "lg" | "none" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "xl" | "2xl" | undefined;
|
|
212
|
+
insetShadow?: "xs" | "sm" | "md" | "lg" | "none" | "xl" | "2xl" | "xs-invert" | "sm-invert" | "md-invert" | "lg-invert" | "xl-invert" | "2xl-invert" | undefined;
|
|
213
|
+
nestedBorderRadiusSize?: "xs" | "sm" | "md" | "lg" | "none" | "xl" | "full" | undefined;
|
|
214
|
+
nestedBorderRadiusWidth?: "none" | "thin" | "medium" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "thick" | undefined;
|
|
215
215
|
nestedBorderRadiusSpacing?: "0" | "px" | "0.5" | "1" | "1.5" | "2" | "2.5" | "3" | "3.5" | "4" | "4.5" | "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;
|
|
216
216
|
nestedBorderRadius?: boolean | "first" | "last" | undefined;
|
|
217
217
|
} & {
|
|
@@ -23,6 +23,11 @@ const normalizeScope = (scope) => {
|
|
|
23
23
|
const trimmedScope = scope?.trim();
|
|
24
24
|
return trimmedScope ? trimmedScope : void 0;
|
|
25
25
|
};
|
|
26
|
+
const getArbitrarySafelistRawContent = (safelist) => {
|
|
27
|
+
const arbitraryClasses = safelist.filter((entry) => typeof entry === "string" && entry.includes("["));
|
|
28
|
+
if (arbitraryClasses.length === 0) return [];
|
|
29
|
+
return [`<div class="${arbitraryClasses.join(" ")}"></div>`];
|
|
30
|
+
};
|
|
26
31
|
/**
|
|
27
32
|
* Generate CSS from a safelist using Tailwind + PostCSS
|
|
28
33
|
* @param safelist - UDS component classes to include
|
|
@@ -38,6 +43,7 @@ const generateCSS = async (safelist, config, options) => {
|
|
|
38
43
|
let css = await require_generate_helpers.applyScopedColorModeFix((await (0, postcss.default)(require_generate_helpers.buildPostcssPlugins({
|
|
39
44
|
tailwindPlugin: require_generate_helpers.createTailwindPlugin({
|
|
40
45
|
contentDir,
|
|
46
|
+
rawContents: getArbitrarySafelistRawContent(safelist),
|
|
41
47
|
safelist,
|
|
42
48
|
config,
|
|
43
49
|
enablePreflight: cssFlags.enablePreflight,
|
|
@@ -34,9 +34,13 @@ const getCssFeatureFlags = (cssOptions) => {
|
|
|
34
34
|
const getContentGlobs = (contentDir) => {
|
|
35
35
|
return (Array.isArray(contentDir) ? contentDir : [contentDir]).map((dir) => require_entryPoints.hasAllowedEntryFileExtension(dir) ? dir : node_path.default.join(dir, "**/*.{js,jsx,ts,tsx}"));
|
|
36
36
|
};
|
|
37
|
+
const getRawContentEntries = (rawContents) => rawContents.map((rawContent) => ({
|
|
38
|
+
raw: rawContent,
|
|
39
|
+
extension: "html"
|
|
40
|
+
}));
|
|
37
41
|
const createTailwindPlugin = (options) => {
|
|
38
42
|
return (0, tailwindcss.default)({
|
|
39
|
-
content: getContentGlobs(options.contentDir),
|
|
43
|
+
content: [...getContentGlobs(options.contentDir), ...getRawContentEntries(options.rawContents ?? [])],
|
|
40
44
|
safelist: options.safelist,
|
|
41
45
|
corePlugins: { preflight: options.enablePreflight },
|
|
42
46
|
plugins: [require_plugin.tailwindPlugin({
|
|
@@ -27,9 +27,13 @@ const getCssFeatureFlags = (cssOptions) => {
|
|
|
27
27
|
const getContentGlobs = (contentDir) => {
|
|
28
28
|
return (Array.isArray(contentDir) ? contentDir : [contentDir]).map((dir) => hasAllowedEntryFileExtension(dir) ? dir : path.join(dir, "**/*.{js,jsx,ts,tsx}"));
|
|
29
29
|
};
|
|
30
|
+
const getRawContentEntries = (rawContents) => rawContents.map((rawContent) => ({
|
|
31
|
+
raw: rawContent,
|
|
32
|
+
extension: "html"
|
|
33
|
+
}));
|
|
30
34
|
const createTailwindPlugin = (options) => {
|
|
31
35
|
return tailwindcss({
|
|
32
|
-
content: getContentGlobs(options.contentDir),
|
|
36
|
+
content: [...getContentGlobs(options.contentDir), ...getRawContentEntries(options.rawContents ?? [])],
|
|
33
37
|
safelist: options.safelist,
|
|
34
38
|
corePlugins: { preflight: options.enablePreflight },
|
|
35
39
|
plugins: [tailwindPlugin({
|
|
@@ -19,6 +19,11 @@ const normalizeScope = (scope) => {
|
|
|
19
19
|
const trimmedScope = scope?.trim();
|
|
20
20
|
return trimmedScope ? trimmedScope : void 0;
|
|
21
21
|
};
|
|
22
|
+
const getArbitrarySafelistRawContent = (safelist) => {
|
|
23
|
+
const arbitraryClasses = safelist.filter((entry) => typeof entry === "string" && entry.includes("["));
|
|
24
|
+
if (arbitraryClasses.length === 0) return [];
|
|
25
|
+
return [`<div class="${arbitraryClasses.join(" ")}"></div>`];
|
|
26
|
+
};
|
|
22
27
|
/**
|
|
23
28
|
* Generate CSS from a safelist using Tailwind + PostCSS
|
|
24
29
|
* @param safelist - UDS component classes to include
|
|
@@ -34,6 +39,7 @@ const generateCSS = async (safelist, config, options) => {
|
|
|
34
39
|
let css = await applyScopedColorModeFix((await postcss(buildPostcssPlugins({
|
|
35
40
|
tailwindPlugin: createTailwindPlugin({
|
|
36
41
|
contentDir,
|
|
42
|
+
rawContents: getArbitrarySafelistRawContent(safelist),
|
|
37
43
|
safelist,
|
|
38
44
|
config,
|
|
39
45
|
enablePreflight: cssFlags.enablePreflight,
|
|
@@ -1,9 +1,108 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
const require_runtime = require('../../../../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let node_path = require("node:path");
|
|
4
|
+
node_path = require_runtime.__toESM(node_path);
|
|
5
|
+
let node_fs = require("node:fs");
|
|
6
|
+
node_fs = require_runtime.__toESM(node_fs);
|
|
3
7
|
let ts_morph = require("ts-morph");
|
|
4
8
|
|
|
5
9
|
//#region ../tailwind/dist/purger/optimized/ast/expressions.js
|
|
6
10
|
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
11
|
+
const importedSourceProject = new ts_morph.Project({ useInMemoryFileSystem: true });
|
|
12
|
+
const importedSourceFileCache = /* @__PURE__ */ new Map();
|
|
13
|
+
const tsConfigPathCache = /* @__PURE__ */ new Map();
|
|
14
|
+
const compilerOptionsCache = /* @__PURE__ */ new Map();
|
|
15
|
+
const hasImportQuery = (moduleSpecifier) => moduleSpecifier.includes("?");
|
|
16
|
+
const isExistingFile = (candidate) => node_fs.default.existsSync(candidate) && node_fs.default.statSync(candidate).isFile();
|
|
17
|
+
const resolveRelativeImportPath = (sourceFilePath, moduleSpecifier) => {
|
|
18
|
+
if (!node_path.default.isAbsolute(sourceFilePath) || !moduleSpecifier.startsWith(".") || hasImportQuery(moduleSpecifier)) return null;
|
|
19
|
+
const basePath = node_path.default.resolve(node_path.default.dirname(sourceFilePath), moduleSpecifier);
|
|
20
|
+
return [
|
|
21
|
+
basePath,
|
|
22
|
+
`${basePath}.ts`,
|
|
23
|
+
`${basePath}.tsx`,
|
|
24
|
+
`${basePath}.js`,
|
|
25
|
+
`${basePath}.jsx`,
|
|
26
|
+
node_path.default.join(basePath, "index.ts"),
|
|
27
|
+
node_path.default.join(basePath, "index.tsx"),
|
|
28
|
+
node_path.default.join(basePath, "index.js"),
|
|
29
|
+
node_path.default.join(basePath, "index.jsx")
|
|
30
|
+
].find((candidate) => isExistingFile(candidate)) ?? null;
|
|
31
|
+
};
|
|
32
|
+
const findNearestTypeScriptConfig = (sourceFilePath) => {
|
|
33
|
+
const sourceDir = node_path.default.dirname(sourceFilePath);
|
|
34
|
+
const cached = tsConfigPathCache.get(sourceDir);
|
|
35
|
+
if (cached !== void 0) return cached;
|
|
36
|
+
let currentDir = sourceDir;
|
|
37
|
+
while (true) {
|
|
38
|
+
const tsConfigPath = node_path.default.join(currentDir, "tsconfig.json");
|
|
39
|
+
if (isExistingFile(tsConfigPath)) {
|
|
40
|
+
tsConfigPathCache.set(sourceDir, tsConfigPath);
|
|
41
|
+
return tsConfigPath;
|
|
42
|
+
}
|
|
43
|
+
const jsConfigPath = node_path.default.join(currentDir, "jsconfig.json");
|
|
44
|
+
if (isExistingFile(jsConfigPath)) {
|
|
45
|
+
tsConfigPathCache.set(sourceDir, jsConfigPath);
|
|
46
|
+
return jsConfigPath;
|
|
47
|
+
}
|
|
48
|
+
const parentDir = node_path.default.dirname(currentDir);
|
|
49
|
+
if (parentDir === currentDir) {
|
|
50
|
+
tsConfigPathCache.set(sourceDir, null);
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
currentDir = parentDir;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const getCompilerOptionsForSourceFile = (sourceFilePath) => {
|
|
57
|
+
const configPath = findNearestTypeScriptConfig(sourceFilePath);
|
|
58
|
+
if (!configPath) return null;
|
|
59
|
+
const cached = compilerOptionsCache.get(configPath);
|
|
60
|
+
if (cached !== void 0) return cached;
|
|
61
|
+
const readResult = ts_morph.ts.readConfigFile(configPath, ts_morph.ts.sys.readFile);
|
|
62
|
+
if (readResult.error) {
|
|
63
|
+
compilerOptionsCache.set(configPath, null);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const parsed = ts_morph.ts.parseJsonConfigFileContent(readResult.config, ts_morph.ts.sys, node_path.default.dirname(configPath));
|
|
67
|
+
const compilerOptions = parsed.options.paths && !parsed.options.baseUrl ? {
|
|
68
|
+
...parsed.options,
|
|
69
|
+
baseUrl: node_path.default.dirname(configPath)
|
|
70
|
+
} : parsed.options;
|
|
71
|
+
compilerOptionsCache.set(configPath, compilerOptions);
|
|
72
|
+
return compilerOptions;
|
|
73
|
+
};
|
|
74
|
+
const resolveConfigImportPath = (sourceFilePath, moduleSpecifier) => {
|
|
75
|
+
if (hasImportQuery(moduleSpecifier)) return null;
|
|
76
|
+
const compilerOptions = getCompilerOptionsForSourceFile(sourceFilePath);
|
|
77
|
+
if (!compilerOptions) return null;
|
|
78
|
+
const resolvedModule = ts_morph.ts.resolveModuleName(moduleSpecifier, sourceFilePath, compilerOptions, ts_morph.ts.sys).resolvedModule;
|
|
79
|
+
if (!resolvedModule) return null;
|
|
80
|
+
return isExistingFile(resolvedModule.resolvedFileName) ? resolvedModule.resolvedFileName : null;
|
|
81
|
+
};
|
|
82
|
+
const resolveImportPath = (sourceFilePath, moduleSpecifier) => moduleSpecifier.startsWith(".") ? resolveRelativeImportPath(sourceFilePath, moduleSpecifier) : resolveConfigImportPath(sourceFilePath, moduleSpecifier);
|
|
83
|
+
const getImportedSourceFile = (filePath) => {
|
|
84
|
+
const cached = importedSourceFileCache.get(filePath);
|
|
85
|
+
if (cached) return cached;
|
|
86
|
+
if (!node_fs.default.existsSync(filePath)) return null;
|
|
87
|
+
const sourceFile = importedSourceProject.createSourceFile(filePath, node_fs.default.readFileSync(filePath, "utf-8"), { overwrite: true });
|
|
88
|
+
importedSourceFileCache.set(filePath, sourceFile);
|
|
89
|
+
return sourceFile;
|
|
90
|
+
};
|
|
91
|
+
const extractImportedIdentifierValues = (node, visited) => {
|
|
92
|
+
if (!ts_morph.Node.isIdentifier(node)) return [];
|
|
93
|
+
const sourceFile = node.getSourceFile();
|
|
94
|
+
const sourceFilePath = sourceFile.getFilePath();
|
|
95
|
+
const importMatch = sourceFile.getImportDeclarations().find((importDecl) => importDecl.getNamedImports().some((namedImport) => (namedImport.getAliasNode()?.getText() ?? namedImport.getName()) === node.getText()));
|
|
96
|
+
if (!importMatch) return [];
|
|
97
|
+
const namedImport = importMatch.getNamedImports().find((candidate) => (candidate.getAliasNode()?.getText() ?? candidate.getName()) === node.getText());
|
|
98
|
+
if (!namedImport) return [];
|
|
99
|
+
const resolvedPath = resolveImportPath(sourceFilePath, importMatch.getModuleSpecifierValue());
|
|
100
|
+
if (!resolvedPath) return [];
|
|
101
|
+
const importedSourceFile = getImportedSourceFile(resolvedPath);
|
|
102
|
+
if (!importedSourceFile) return [];
|
|
103
|
+
const initializer = importedSourceFile.getVariableDeclaration(namedImport.getName())?.getInitializer();
|
|
104
|
+
return initializer ? extractStringLiterals(initializer, visited) : [];
|
|
105
|
+
};
|
|
7
106
|
/**
|
|
8
107
|
* Extracts string literal values from an expression.
|
|
9
108
|
*
|
|
@@ -109,7 +208,10 @@ const extractIdentifierValues = (node, visited) => {
|
|
|
109
208
|
}
|
|
110
209
|
return [];
|
|
111
210
|
});
|
|
112
|
-
|
|
211
|
+
if (values.length > 0) return values;
|
|
212
|
+
const importedValues = extractImportedIdentifierValues(node, visited);
|
|
213
|
+
if (importedValues.length > 0) return importedValues;
|
|
214
|
+
return extractLiteralValuesFromType(node);
|
|
113
215
|
};
|
|
114
216
|
/**
|
|
115
217
|
* Extract string literals from arrow functions or function expressions
|