@byyuurin/ui 0.0.1 → 0.0.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/README.md +75 -5
- package/dist/index.cjs +38 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/nuxt.d.mts +13 -0
- package/dist/nuxt.d.ts +6 -3
- package/dist/nuxt.mjs +6 -3
- package/dist/resolver.d.mts +13 -0
- package/dist/resolver.d.ts +6 -3
- package/dist/resolver.mjs +5 -2
- package/dist/{components → runtime/components}/Accordion.vue +19 -3
- package/dist/{components → runtime/components}/Button.vue +93 -94
- package/dist/{components → runtime/components}/Checkbox.vue +104 -104
- package/dist/{components → runtime/components}/RadioGroup.vue +180 -180
- package/dist/{components → runtime/components}/Select.vue +262 -258
- package/dist/{components → runtime/components}/Switch.vue +99 -99
- package/dist/{components → runtime/components}/Tabs.vue +117 -117
- package/dist/{components → runtime/components}/Toaster.vue +35 -1
- package/dist/runtime/components/index.cjs +132 -0
- package/dist/runtime/composables/index.cjs +33 -0
- package/dist/runtime/composables/useComponentIcons.cjs +30 -0
- package/dist/runtime/composables/useModal.cjs +55 -0
- package/dist/runtime/composables/useTheme.cjs +30 -0
- package/dist/{composables → runtime/composables}/useTheme.d.ts +0 -1
- package/dist/{composables → runtime/composables}/useTheme.mjs +3 -3
- package/dist/runtime/composables/useToast.cjs +51 -0
- package/dist/{composables → runtime/composables}/useToast.d.ts +1 -1
- package/dist/runtime/theme/accordion.cjs +27 -0
- package/dist/runtime/theme/app.cjs +15 -0
- package/dist/runtime/theme/button.cjs +127 -0
- package/dist/runtime/theme/card.cjs +17 -0
- package/dist/runtime/theme/checkbox.cjs +56 -0
- package/dist/runtime/theme/drawer.cjs +73 -0
- package/dist/runtime/theme/index.cjs +125 -0
- package/dist/runtime/theme/input.cjs +115 -0
- package/dist/runtime/theme/link.cjs +23 -0
- package/dist/runtime/theme/modal.cjs +55 -0
- package/dist/runtime/theme/popover.cjs +13 -0
- package/dist/runtime/theme/radioGroup.cjs +73 -0
- package/dist/runtime/theme/select.cjs +128 -0
- package/dist/runtime/theme/switch.cjs +73 -0
- package/dist/runtime/theme/tabs.cjs +105 -0
- package/dist/runtime/theme/toast.cjs +33 -0
- package/dist/runtime/theme/toaster.cjs +72 -0
- package/dist/runtime/theme/tooltip.cjs +14 -0
- package/dist/runtime/types/components.cjs +1 -0
- package/dist/runtime/types/index.cjs +27 -0
- package/dist/{types → runtime/types}/index.d.ts +1 -1
- package/dist/runtime/types/utils.cjs +1 -0
- package/dist/runtime/utils/extend-theme.cjs +24 -0
- package/dist/runtime/utils/index.cjs +119 -0
- package/dist/{utils → runtime/utils}/index.d.ts +3 -1
- package/dist/{utils → runtime/utils}/index.mjs +3 -1
- package/dist/runtime/utils/link.cjs +10 -0
- package/dist/runtime/utils/styler.cjs +18 -0
- package/dist/{internal → runtime/utils}/styler.d.ts +0 -1
- package/dist/runtime/utils/styler.mjs +10 -0
- package/dist/{internal/constants.mjs → shared/ui.CPXA9QoM.mjs} +4 -2
- package/dist/unocss-preset.d.mts +49 -0
- package/dist/unocss-preset.d.ts +20 -8
- package/dist/unocss-preset.mjs +428 -78
- package/package.json +16 -10
- package/dist/internal/constants.d.ts +0 -3
- package/dist/internal/extend-theme.test.d.ts +0 -1
- package/dist/internal/extend-theme.test.mjs +0 -45
- package/dist/internal/index.d.ts +0 -4
- package/dist/internal/index.mjs +0 -4
- package/dist/internal/styler.mjs +0 -235
- package/dist/internal/styler.test.d.ts +0 -1
- package/dist/internal/styler.test.mjs +0 -10
- package/dist/utils/unocss.d.ts +0 -3
- package/dist/utils/unocss.mjs +0 -50
- /package/dist/{components → runtime/components}/App.vue +0 -0
- /package/dist/{components → runtime/components}/Card.vue +0 -0
- /package/dist/{components → runtime/components}/Drawer.vue +0 -0
- /package/dist/{components → runtime/components}/Input.vue +0 -0
- /package/dist/{components → runtime/components}/Link.vue +0 -0
- /package/dist/{components → runtime/components}/Modal.vue +0 -0
- /package/dist/{components → runtime/components}/ModalProvider.vue +0 -0
- /package/dist/{components → runtime/components}/Popover.vue +0 -0
- /package/dist/{components → runtime/components}/Toast.vue +0 -0
- /package/dist/{components → runtime/components}/Tooltip.vue +0 -0
- /package/dist/{components → runtime/components}/index.d.ts +0 -0
- /package/dist/{components → runtime/components}/index.mjs +0 -0
- /package/dist/{composables → runtime/composables}/index.d.ts +0 -0
- /package/dist/{composables → runtime/composables}/index.mjs +0 -0
- /package/dist/{composables → runtime/composables}/useComponentIcons.d.ts +0 -0
- /package/dist/{composables → runtime/composables}/useComponentIcons.mjs +0 -0
- /package/dist/{composables → runtime/composables}/useModal.d.ts +0 -0
- /package/dist/{composables → runtime/composables}/useModal.mjs +0 -0
- /package/dist/{composables → runtime/composables}/useToast.mjs +0 -0
- /package/dist/{theme → runtime/theme}/accordion.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/accordion.mjs +0 -0
- /package/dist/{theme → runtime/theme}/app.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/app.mjs +0 -0
- /package/dist/{theme → runtime/theme}/button.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/button.mjs +0 -0
- /package/dist/{theme → runtime/theme}/card.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/card.mjs +0 -0
- /package/dist/{theme → runtime/theme}/checkbox.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/checkbox.mjs +0 -0
- /package/dist/{theme → runtime/theme}/drawer.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/drawer.mjs +0 -0
- /package/dist/{theme → runtime/theme}/index.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/index.mjs +0 -0
- /package/dist/{theme → runtime/theme}/input.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/input.mjs +0 -0
- /package/dist/{theme → runtime/theme}/link.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/link.mjs +0 -0
- /package/dist/{theme → runtime/theme}/modal.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/modal.mjs +0 -0
- /package/dist/{theme → runtime/theme}/popover.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/popover.mjs +0 -0
- /package/dist/{theme → runtime/theme}/radioGroup.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/radioGroup.mjs +0 -0
- /package/dist/{theme → runtime/theme}/select.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/select.mjs +0 -0
- /package/dist/{theme → runtime/theme}/switch.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/switch.mjs +0 -0
- /package/dist/{theme → runtime/theme}/tabs.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/tabs.mjs +0 -0
- /package/dist/{theme → runtime/theme}/toast.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/toast.mjs +0 -0
- /package/dist/{theme → runtime/theme}/toaster.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/toaster.mjs +0 -0
- /package/dist/{theme → runtime/theme}/tooltip.d.ts +0 -0
- /package/dist/{theme → runtime/theme}/tooltip.mjs +0 -0
- /package/dist/{types → runtime/types}/components.d.ts +0 -0
- /package/dist/{types → runtime/types}/components.mjs +0 -0
- /package/dist/{types → runtime/types}/index.mjs +0 -0
- /package/dist/{types → runtime/types}/utils.d.ts +0 -0
- /package/dist/{types → runtime/types}/utils.mjs +0 -0
- /package/dist/{internal → runtime/utils}/extend-theme.d.ts +0 -0
- /package/dist/{internal → runtime/utils}/extend-theme.mjs +0 -0
- /package/dist/{internal → runtime/utils}/link.d.ts +0 -0
- /package/dist/{internal → runtime/utils}/link.mjs +0 -0
package/dist/internal/styler.mjs
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { cv } from "@byyuurin/ui-kit";
|
|
2
|
-
import { h, isCSSMathFn, parseColor, splitShorthand } from "@unocss/preset-mini/utils";
|
|
3
|
-
import { mergeConfigs, presetUno, toArray } from "unocss";
|
|
4
|
-
import presetUI, { cssVarsAll, cssVarsPrefix } from "../unocss-preset.mjs";
|
|
5
|
-
const theme = mergeConfigs([
|
|
6
|
-
presetUno(),
|
|
7
|
-
presetUI()
|
|
8
|
-
]).theme;
|
|
9
|
-
export function createMergeRules() {
|
|
10
|
-
const GlobalKeywordsRE = /^inherit|initial|revert|revert-layer|unset$/;
|
|
11
|
-
return [
|
|
12
|
-
// _rules/align
|
|
13
|
-
[/^(?:vertical|align|v)-([-\w]+%?)$/, ([type]) => {
|
|
14
|
-
const valid = [
|
|
15
|
-
GlobalKeywordsRE,
|
|
16
|
-
/^(mid(?:dle)?|base(?:line)?|btm|bottom|top|start|bottom|end|text-(?:top|bottom)|sub|super)$/
|
|
17
|
-
].some((r) => r.test(type));
|
|
18
|
-
return valid ? "vertical-align" : null;
|
|
19
|
-
}],
|
|
20
|
-
[/^text-?(?:align-?)?(.+)$/, ([type]) => {
|
|
21
|
-
const valid = [
|
|
22
|
-
GlobalKeywordsRE,
|
|
23
|
-
/^center|left|right|justify|start|end$/
|
|
24
|
-
].some((r) => r.test(type));
|
|
25
|
-
return valid ? "text-align" : null;
|
|
26
|
-
}],
|
|
27
|
-
// _rules/behaviors
|
|
28
|
-
// _rules/border
|
|
29
|
-
[/^(?:border-|b-)(.+)$/, ([type]) => {
|
|
30
|
-
let result = "border";
|
|
31
|
-
[
|
|
32
|
-
/^([xyrltbse]|block|inline|[bi][se])(?:-(.+))?$/
|
|
33
|
-
].some((r) => {
|
|
34
|
-
const matched = type.match(r);
|
|
35
|
-
if (matched) {
|
|
36
|
-
const [_, type2, color = ""] = matched;
|
|
37
|
-
const parsed2 = parseColor(color, theme);
|
|
38
|
-
result = parsed2?.color ? `border-${type2}-color` : `border-${type2}`;
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
return false;
|
|
42
|
-
});
|
|
43
|
-
const parsed = parseColor(type, theme);
|
|
44
|
-
return parsed?.color ? "border-color" : result;
|
|
45
|
-
}],
|
|
46
|
-
[/^(?:border-|b-)?(?:rounded|rd)(.+)$/, ([type]) => {
|
|
47
|
-
let result = "border-radius";
|
|
48
|
-
[
|
|
49
|
-
/^([xyrltbse]|block|inline|[bi][se])(?:-(.+))?$/
|
|
50
|
-
].some((r) => {
|
|
51
|
-
const matched = type.match(r);
|
|
52
|
-
if (matched) {
|
|
53
|
-
result = `border-radius-${matched[1]}`;
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
return false;
|
|
57
|
-
});
|
|
58
|
-
return result;
|
|
59
|
-
}],
|
|
60
|
-
// _rules/color
|
|
61
|
-
[/^op(?:acity)?-?(.+)$/, () => `opacity`],
|
|
62
|
-
[/^bg-(.+)$/, ([type]) => {
|
|
63
|
-
if (/^\[url\(.+\)\]$/.test(type))
|
|
64
|
-
return "image";
|
|
65
|
-
if (/^\[image:.+\]$/.test(type))
|
|
66
|
-
return "image";
|
|
67
|
-
if (/^\[(?:linear|conic|radial)-gradient\(.+\)\]$/.test(type))
|
|
68
|
-
return "image";
|
|
69
|
-
if (/^\[(?:length|size):.+\]$/.test(type))
|
|
70
|
-
return "size";
|
|
71
|
-
if (/^\[position:.+\]$/.test(type))
|
|
72
|
-
return "position";
|
|
73
|
-
if (/^op(?:acity)?-?(.+)$/.test(type))
|
|
74
|
-
return "opacity";
|
|
75
|
-
const parsed = parseColor(type, theme);
|
|
76
|
-
return parsed?.color ? "color" : null;
|
|
77
|
-
}, { scope: "bg" }],
|
|
78
|
-
// _rules/container
|
|
79
|
-
[/^@container(?:\/(\w+))?(?:-(normal))?$/, () => "container"],
|
|
80
|
-
// _rules/decoration
|
|
81
|
-
// _rules/default
|
|
82
|
-
// _rules/flex
|
|
83
|
-
// [/^$/, () => ''],
|
|
84
|
-
// _rules/gap
|
|
85
|
-
[
|
|
86
|
-
/^(?:flex-|grid-)?(?:gap-?()|gap-([xy]-?|col-?|row-?))(.+)$/,
|
|
87
|
-
([direction]) => {
|
|
88
|
-
if (direction === "y" || direction === "row")
|
|
89
|
-
return "gap-row";
|
|
90
|
-
if (direction === "x" || direction === "col")
|
|
91
|
-
return "gap-column";
|
|
92
|
-
return "gap";
|
|
93
|
-
}
|
|
94
|
-
],
|
|
95
|
-
// _rules/grid
|
|
96
|
-
// _rules/layout
|
|
97
|
-
// _rules/position
|
|
98
|
-
[/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, () => "position"],
|
|
99
|
-
[/^(?:position-|pos-)([-\w]+)$/, ([type]) => GlobalKeywordsRE.test(type) ? "position" : null],
|
|
100
|
-
[/^(?:position-|pos-)?(static)$/, () => "position"],
|
|
101
|
-
// _rules/question-mark
|
|
102
|
-
// _rules/ring
|
|
103
|
-
// _rules/shadow
|
|
104
|
-
// _rules/size
|
|
105
|
-
// _rules/spacing
|
|
106
|
-
[/^p-?([xy])(?:-?(.+))?$/, ([type]) => `padding-${type}`],
|
|
107
|
-
[/^p-?([rltbse])(?:-?(.+))?$/, ([type]) => `padding-${type}`],
|
|
108
|
-
[/^p-(block|inline)(?:-(.+))?$/, ([type]) => `padding-${type}`],
|
|
109
|
-
[/^p-?([bi][se])(?:-?(.+))?$/, ([type]) => `padding-${type}`],
|
|
110
|
-
// [/^pa?()-?(.+)$/, () => 'padding'],
|
|
111
|
-
// [/^p-?xy()()$/, () => 'padding'],
|
|
112
|
-
[/^m-?([xy])(?:-?(.+))?$/, ([type]) => `margin-${type}`],
|
|
113
|
-
[/^m-?([rltbse])(?:-?(.+))?$/, ([type]) => `margin-${type}`],
|
|
114
|
-
[/^m-(block|inline)(?:-(.+))?$/, ([type]) => `margin-${type}`],
|
|
115
|
-
[/^m-?([bi][se])(?:-?(.+))?$/, ([type]) => `margin-${type}`],
|
|
116
|
-
// [/^ma?()-?(.+)$/, () => 'margin'],
|
|
117
|
-
// [/^m-?xy()()$/, () => 'margin'],
|
|
118
|
-
// _rules/static
|
|
119
|
-
[
|
|
120
|
-
/^(?:display-(.+)|inline|block|inline-block|contents|flow-root|list-item|hidden)$/,
|
|
121
|
-
([type]) => {
|
|
122
|
-
if (!type || GlobalKeywordsRE.test(type))
|
|
123
|
-
return "display";
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
],
|
|
127
|
-
[
|
|
128
|
-
/^(?:visible|invisible|backface-(.+))$/,
|
|
129
|
-
([type]) => {
|
|
130
|
-
if (!type || GlobalKeywordsRE.test(type) || /^(?:visible|hidden)$/.test(type))
|
|
131
|
-
return "visibility";
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
],
|
|
135
|
-
[/^content-(.+)$/, () => "content"],
|
|
136
|
-
// _rules/svg
|
|
137
|
-
// _rules/transform
|
|
138
|
-
[
|
|
139
|
-
/^(?:transform-)?(origin|perspect(?:ive)?(?:-origin)?|(?:translate|rotate|skew|scale)(?:-[xyz])?)-(.+)$/,
|
|
140
|
-
([type]) => type
|
|
141
|
-
],
|
|
142
|
-
[
|
|
143
|
-
/^(?:transform-)?preserve-(?:3d|flat)$/,
|
|
144
|
-
() => "preserve"
|
|
145
|
-
],
|
|
146
|
-
[
|
|
147
|
-
/^(?:transform)(?:-(.+))?$/,
|
|
148
|
-
([type]) => {
|
|
149
|
-
if (!type || type === "none" || GlobalKeywordsRE.test(type))
|
|
150
|
-
return "transform";
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
],
|
|
154
|
-
// _rules/transition
|
|
155
|
-
[/^(?:transition-)?(?:(duration|delay|ease|property)-)(.+)$/, ([type]) => type],
|
|
156
|
-
[/^transition(?:-(.+))$/, ([type]) => {
|
|
157
|
-
if (!type || type === "none" || GlobalKeywordsRE.test(type))
|
|
158
|
-
return "transition";
|
|
159
|
-
if (/^discrete|normal$/.test(type))
|
|
160
|
-
return "transition-behavior";
|
|
161
|
-
return null;
|
|
162
|
-
}],
|
|
163
|
-
// _rules/typography
|
|
164
|
-
[
|
|
165
|
-
/^text-(.+)$/,
|
|
166
|
-
([s = "base"]) => {
|
|
167
|
-
const returnValue = "font-size";
|
|
168
|
-
const split = splitShorthand(s, "length");
|
|
169
|
-
if (!split)
|
|
170
|
-
return null;
|
|
171
|
-
const [size] = split;
|
|
172
|
-
const sizePairs = toArray(theme.fontSize?.[size]);
|
|
173
|
-
if (sizePairs?.[0])
|
|
174
|
-
return returnValue;
|
|
175
|
-
const fontSize = h.bracketOfLength.rem(size);
|
|
176
|
-
if (fontSize)
|
|
177
|
-
return returnValue;
|
|
178
|
-
return h.bracketOfLength.rem(s) ? returnValue : null;
|
|
179
|
-
}
|
|
180
|
-
],
|
|
181
|
-
[
|
|
182
|
-
/^(?:text|font)-size-(.+)$/,
|
|
183
|
-
([s]) => {
|
|
184
|
-
const themed = toArray(theme.fontSize?.[s]);
|
|
185
|
-
const size = themed?.[0] ?? h.bracket.cssvar.global.rem(s);
|
|
186
|
-
return size == null ? null : "font-size";
|
|
187
|
-
}
|
|
188
|
-
],
|
|
189
|
-
[
|
|
190
|
-
/^text-(?:color-)?(.+)$/,
|
|
191
|
-
([colorOrSize]) => {
|
|
192
|
-
if (isCSSMathFn(h.bracket(colorOrSize)))
|
|
193
|
-
return "font-size";
|
|
194
|
-
const parsed = parseColor(colorOrSize, theme);
|
|
195
|
-
return parsed?.color ? "color" : null;
|
|
196
|
-
}
|
|
197
|
-
],
|
|
198
|
-
[
|
|
199
|
-
/^(?:color|c)-(.+)$/,
|
|
200
|
-
([color]) => {
|
|
201
|
-
const parsed = parseColor(color, theme);
|
|
202
|
-
return parsed?.color ? "color" : null;
|
|
203
|
-
}
|
|
204
|
-
],
|
|
205
|
-
// _rules/variables
|
|
206
|
-
[
|
|
207
|
-
/^\[(.*)\]$/,
|
|
208
|
-
([body]) => {
|
|
209
|
-
if (!body.includes(":"))
|
|
210
|
-
return null;
|
|
211
|
-
const [prop] = body.split(":");
|
|
212
|
-
return prop;
|
|
213
|
-
},
|
|
214
|
-
{ scope: "variables" }
|
|
215
|
-
],
|
|
216
|
-
// others
|
|
217
|
-
[
|
|
218
|
-
new RegExp(`^${cssVarsPrefix}-((?:${cssVarsAll.join("|")})-)?(.+)$`),
|
|
219
|
-
([type = "base", color]) => {
|
|
220
|
-
const parsed = parseColor(color, theme);
|
|
221
|
-
return parsed?.color ? type : null;
|
|
222
|
-
},
|
|
223
|
-
{ scope: cssVarsPrefix }
|
|
224
|
-
]
|
|
225
|
-
];
|
|
226
|
-
}
|
|
227
|
-
export function prepareStyler(rules = []) {
|
|
228
|
-
const createVariants = cv(rules);
|
|
229
|
-
function createStyler(theme2) {
|
|
230
|
-
const ui = createVariants(theme2);
|
|
231
|
-
const styler = (props) => ui(props);
|
|
232
|
-
return styler;
|
|
233
|
-
}
|
|
234
|
-
return { createStyler };
|
|
235
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { cr } from "@byyuurin/ui-kit";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { mergeRules } from "../composables/useTheme.mjs";
|
|
4
|
-
describe("check style merge", () => {
|
|
5
|
-
const merge = cr(mergeRules, { debug: true });
|
|
6
|
-
it("should...", () => {
|
|
7
|
-
const result = merge("grid gap-10 grid-cols-10 scale-1 translate-y-full");
|
|
8
|
-
expect(result).toMatchInlineSnapshot(`"grid gap grid-cols-10 scale translate-y"`);
|
|
9
|
-
});
|
|
10
|
-
});
|
package/dist/utils/unocss.d.ts
DELETED
package/dist/utils/unocss.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export function transformUnoRules(config = {}) {
|
|
2
|
-
const { rules = [], theme = {} } = config;
|
|
3
|
-
const mergeRules = [];
|
|
4
|
-
const wrap = (value, skip = false) => skip ? value : `[${value}]`;
|
|
5
|
-
const resolveCSSEntries = (entries, skipWrap = false) => () => wrap(
|
|
6
|
-
entries.flatMap((value) => Object.keys(value)).join(","),
|
|
7
|
-
skipWrap
|
|
8
|
-
);
|
|
9
|
-
const resolveCSSObject = (object, skipWrap = false) => () => {
|
|
10
|
-
if (JSON.stringify(object) === "{}")
|
|
11
|
-
return null;
|
|
12
|
-
return wrap(
|
|
13
|
-
Object.keys(object).join(","),
|
|
14
|
-
skipWrap
|
|
15
|
-
);
|
|
16
|
-
};
|
|
17
|
-
for (const rule of rules) {
|
|
18
|
-
const [maybeString, maybeResult] = rule;
|
|
19
|
-
const ruleRE = typeof maybeString === "string" ? new RegExp(`^${maybeString}$`) : maybeString;
|
|
20
|
-
if (Array.isArray(maybeResult)) {
|
|
21
|
-
mergeRules.push([ruleRE, resolveCSSEntries(maybeResult)]);
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
if (typeof maybeResult === "object") {
|
|
25
|
-
mergeRules.push([ruleRE, resolveCSSObject(maybeResult)]);
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
const matcher = (matches, ctx) => {
|
|
29
|
-
try {
|
|
30
|
-
const result = maybeResult([ctx.input, ...matches], {
|
|
31
|
-
theme,
|
|
32
|
-
// @ts-expect-error pass
|
|
33
|
-
generator: { config: {} }
|
|
34
|
-
});
|
|
35
|
-
if (typeof result === "function")
|
|
36
|
-
return null;
|
|
37
|
-
if (Array.isArray(result)) {
|
|
38
|
-
return wrap(result.map((item) => Array.isArray(item) ? item[0] : resolveCSSObject(item, false)).join(","));
|
|
39
|
-
}
|
|
40
|
-
if (typeof result === "object")
|
|
41
|
-
return resolveCSSObject(result)();
|
|
42
|
-
} catch (e) {
|
|
43
|
-
console.warn(`[Fail Rule]`, ruleRE, e.message);
|
|
44
|
-
}
|
|
45
|
-
return null;
|
|
46
|
-
};
|
|
47
|
-
mergeRules.push([ruleRE, matcher]);
|
|
48
|
-
}
|
|
49
|
-
return mergeRules;
|
|
50
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|