@byyuurin/ui 0.0.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/LICENSE.md +21 -0
- package/README.md +32 -0
- package/dist/components/Accordion.vue +104 -0
- package/dist/components/App.vue +57 -0
- package/dist/components/Button.vue +94 -0
- package/dist/components/Card.vue +76 -0
- package/dist/components/Checkbox.vue +104 -0
- package/dist/components/Drawer.vue +133 -0
- package/dist/components/Input.vue +169 -0
- package/dist/components/Link.vue +117 -0
- package/dist/components/Modal.vue +145 -0
- package/dist/components/ModalProvider.vue +10 -0
- package/dist/components/Popover.vue +97 -0
- package/dist/components/RadioGroup.vue +180 -0
- package/dist/components/Select.vue +258 -0
- package/dist/components/Switch.vue +99 -0
- package/dist/components/Tabs.vue +117 -0
- package/dist/components/Toast.vue +126 -0
- package/dist/components/Toaster.vue +143 -0
- package/dist/components/Tooltip.vue +71 -0
- package/dist/components/index.d.ts +18 -0
- package/dist/components/index.mjs +18 -0
- package/dist/composables/index.d.ts +4 -0
- package/dist/composables/index.mjs +4 -0
- package/dist/composables/useComponentIcons.d.ts +26 -0
- package/dist/composables/useComponentIcons.mjs +24 -0
- package/dist/composables/useModal.d.ts +15 -0
- package/dist/composables/useModal.mjs +51 -0
- package/dist/composables/useTheme.d.ts +8 -0
- package/dist/composables/useTheme.mjs +18 -0
- package/dist/composables/useToast.d.ts +24 -0
- package/dist/composables/useToast.mjs +48 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +3 -0
- package/dist/internal/constants.d.ts +3 -0
- package/dist/internal/constants.mjs +21 -0
- package/dist/internal/extend-theme.d.ts +9 -0
- package/dist/internal/extend-theme.mjs +16 -0
- package/dist/internal/extend-theme.test.d.ts +1 -0
- package/dist/internal/extend-theme.test.mjs +45 -0
- package/dist/internal/index.d.ts +4 -0
- package/dist/internal/index.mjs +4 -0
- package/dist/internal/link.d.ts +15 -0
- package/dist/internal/link.mjs +4 -0
- package/dist/internal/styler.d.ts +5 -0
- package/dist/internal/styler.mjs +236 -0
- package/dist/internal/styler.test.d.ts +1 -0
- package/dist/internal/styler.test.mjs +10 -0
- package/dist/nuxt.d.ts +10 -0
- package/dist/nuxt.mjs +28 -0
- package/dist/resolver.d.ts +10 -0
- package/dist/resolver.mjs +18 -0
- package/dist/theme/accordion.d.ts +39 -0
- package/dist/theme/accordion.mjs +25 -0
- package/dist/theme/app.d.ts +10 -0
- package/dist/theme/app.mjs +9 -0
- package/dist/theme/button.d.ts +184 -0
- package/dist/theme/button.mjs +140 -0
- package/dist/theme/card.d.ts +43 -0
- package/dist/theme/card.mjs +11 -0
- package/dist/theme/checkbox.d.ts +97 -0
- package/dist/theme/checkbox.mjs +53 -0
- package/dist/theme/drawer.d.ts +72 -0
- package/dist/theme/drawer.mjs +72 -0
- package/dist/theme/index.d.ts +17 -0
- package/dist/theme/index.mjs +17 -0
- package/dist/theme/input.d.ts +159 -0
- package/dist/theme/input.mjs +133 -0
- package/dist/theme/link.d.ts +31 -0
- package/dist/theme/link.mjs +23 -0
- package/dist/theme/modal.d.ts +50 -0
- package/dist/theme/modal.mjs +54 -0
- package/dist/theme/popover.d.ts +27 -0
- package/dist/theme/popover.mjs +10 -0
- package/dist/theme/radioGroup.d.ts +131 -0
- package/dist/theme/radioGroup.mjs +67 -0
- package/dist/theme/select.d.ts +177 -0
- package/dist/theme/select.mjs +154 -0
- package/dist/theme/switch.d.ts +131 -0
- package/dist/theme/switch.mjs +78 -0
- package/dist/theme/tabs.d.ts +101 -0
- package/dist/theme/tabs.mjs +117 -0
- package/dist/theme/toast.d.ts +51 -0
- package/dist/theme/toast.mjs +27 -0
- package/dist/theme/toaster.d.ts +73 -0
- package/dist/theme/toaster.mjs +89 -0
- package/dist/theme/tooltip.d.ts +31 -0
- package/dist/theme/tooltip.mjs +8 -0
- package/dist/types/components.d.ts +18 -0
- package/dist/types/components.mjs +0 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.mjs +2 -0
- package/dist/types/utils.d.ts +29 -0
- package/dist/types/utils.mjs +0 -0
- package/dist/unocss-preset.d.ts +37 -0
- package/dist/unocss-preset.mjs +164 -0
- package/dist/utils/index.d.ts +18 -0
- package/dist/utils/index.mjs +70 -0
- package/dist/utils/unocss.d.ts +3 -0
- package/dist/utils/unocss.mjs +50 -0
- package/package.json +103 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createDefu } from "defu";
|
|
2
|
+
export const extendTheme = createDefu((obj, key, value) => {
|
|
3
|
+
if (key === "global") {
|
|
4
|
+
obj[key] = { ...obj[key], ...value };
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
if (typeof obj[key] === "string" && typeof value === "string") {
|
|
8
|
+
if (value.trim())
|
|
9
|
+
obj[key] += ` ${value}`;
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
if (Array.isArray(obj[key]) && typeof value === "string") {
|
|
13
|
+
obj[key].push(value);
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { link } from "../theme/index.mjs";
|
|
3
|
+
import { extendTheme } from "./extend-theme.mjs";
|
|
4
|
+
describe("check defu result", () => {
|
|
5
|
+
it("should merge", () => {
|
|
6
|
+
const ui = {
|
|
7
|
+
base: "el-link",
|
|
8
|
+
variants: {
|
|
9
|
+
active: {
|
|
10
|
+
true: "el-link--active",
|
|
11
|
+
false: " "
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const result = extendTheme(ui, link);
|
|
16
|
+
expect(result).toMatchInlineSnapshot(`
|
|
17
|
+
{
|
|
18
|
+
"base": "border-y border-t-transparent focus-visible:outline-ui-cb el-link",
|
|
19
|
+
"compoundVariants": undefined,
|
|
20
|
+
"slots": undefined,
|
|
21
|
+
"variants": {
|
|
22
|
+
"active": {
|
|
23
|
+
"false": [
|
|
24
|
+
"color-ui-cb hover:color-ui-cb/80 transition-colors",
|
|
25
|
+
"disabled:hover:color-ui-cb aria-disabled:hover:color-ui-cb",
|
|
26
|
+
" ",
|
|
27
|
+
],
|
|
28
|
+
"true": [
|
|
29
|
+
"color-ui-fill",
|
|
30
|
+
"disabled:color-ui-fill aria-disabled:color-ui-fill",
|
|
31
|
+
"el-link--active",
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
"disabled": {
|
|
35
|
+
"true": "cursor-not-allowed opacity-50",
|
|
36
|
+
},
|
|
37
|
+
"underline": {
|
|
38
|
+
"false": "border-transparent",
|
|
39
|
+
"true": "border-current",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
`);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LinkProps } from '../types';
|
|
2
|
+
export declare function pickLinkProps(props: LinkProps & Partial<Pick<HTMLAnchorElement, 'ariaLabel' | 'title'>>): {
|
|
3
|
+
disabled: any;
|
|
4
|
+
active: any;
|
|
5
|
+
title: any;
|
|
6
|
+
type: any;
|
|
7
|
+
ariaLabel: any;
|
|
8
|
+
rel: any;
|
|
9
|
+
target: any;
|
|
10
|
+
href: any;
|
|
11
|
+
ui: any;
|
|
12
|
+
as: any;
|
|
13
|
+
noRel: any;
|
|
14
|
+
onClick: any;
|
|
15
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ClassValue, CRRule, CVCompoundVariants, CVMeta, CVSlots, CVVariants } from '@byyuurin/ui-kit';
|
|
2
|
+
export declare function createMergeRules(): CRRule[];
|
|
3
|
+
export declare function prepareStyler(rules?: CRRule[]): {
|
|
4
|
+
createStyler: <V extends CVVariants<S, B>, CV extends CVCompoundVariants<V, S, B>, B extends ClassValue = undefined, S extends CVSlots = undefined>(theme: CVMeta<V, CV, never, B, S>) => [keyof V] extends string[] ? (props: Required<import("@byyuurin/ui-kit/index").VariantProps<import("@byyuurin/ui-kit/index").CVReturnType<V, S, B>>> & import("../types").StylerBaseProps) => S extends undefined ? string : { [K in keyof S | (B extends undefined ? never : "base")]: import("@byyuurin/ui-kit/index").CVHandler<V, S, string>; } : (props?: import("../types").StylerBaseProps) => S extends undefined ? string : { [K in keyof S | (B extends undefined ? never : "base")]: import("@byyuurin/ui-kit/index").CVHandler<V, S, string>; };
|
|
5
|
+
};
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { cv } from "@byyuurin/ui-kit";
|
|
2
|
+
import { mergeConfigs, toArray } from "@unocss/core";
|
|
3
|
+
import { h, isCSSMathFn, parseColor, splitShorthand } from "@unocss/preset-mini/utils";
|
|
4
|
+
import { presetUno } from "@unocss/preset-uno";
|
|
5
|
+
import presetUI, { cssVarsAll, cssVarsPrefix } from "../unocss-preset.mjs";
|
|
6
|
+
const theme = mergeConfigs([
|
|
7
|
+
presetUno(),
|
|
8
|
+
presetUI()
|
|
9
|
+
]).theme;
|
|
10
|
+
export function createMergeRules() {
|
|
11
|
+
const GlobalKeywordsRE = /^inherit|initial|revert|revert-layer|unset$/;
|
|
12
|
+
return [
|
|
13
|
+
// _rules/align
|
|
14
|
+
[/^(?:vertical|align|v)-([-\w]+%?)$/, ([type]) => {
|
|
15
|
+
const valid = [
|
|
16
|
+
GlobalKeywordsRE,
|
|
17
|
+
/^(mid(?:dle)?|base(?:line)?|btm|bottom|top|start|bottom|end|text-(?:top|bottom)|sub|super)$/
|
|
18
|
+
].some((r) => r.test(type));
|
|
19
|
+
return valid ? "vertical-align" : null;
|
|
20
|
+
}],
|
|
21
|
+
[/^text-?(?:align-?)?(.+)$/, ([type]) => {
|
|
22
|
+
const valid = [
|
|
23
|
+
GlobalKeywordsRE,
|
|
24
|
+
/^center|left|right|justify|start|end$/
|
|
25
|
+
].some((r) => r.test(type));
|
|
26
|
+
return valid ? "text-align" : null;
|
|
27
|
+
}],
|
|
28
|
+
// _rules/behaviors
|
|
29
|
+
// _rules/border
|
|
30
|
+
[/^(?:border-|b-)(.+)$/, ([type]) => {
|
|
31
|
+
let result = "border";
|
|
32
|
+
[
|
|
33
|
+
/^([xyrltbse]|block|inline|[bi][se])(?:-(.+))?$/
|
|
34
|
+
].some((r) => {
|
|
35
|
+
const matched = type.match(r);
|
|
36
|
+
if (matched) {
|
|
37
|
+
const [_, type2, color = ""] = matched;
|
|
38
|
+
const parsed2 = parseColor(color, theme);
|
|
39
|
+
result = parsed2?.color ? `border-${type2}-color` : `border-${type2}`;
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
});
|
|
44
|
+
const parsed = parseColor(type, theme);
|
|
45
|
+
return parsed?.color ? "border-color" : result;
|
|
46
|
+
}],
|
|
47
|
+
[/^(?:border-|b-)?(?:rounded|rd)(.+)$/, ([type]) => {
|
|
48
|
+
let result = "border-radius";
|
|
49
|
+
[
|
|
50
|
+
/^([xyrltbse]|block|inline|[bi][se])(?:-(.+))?$/
|
|
51
|
+
].some((r) => {
|
|
52
|
+
const matched = type.match(r);
|
|
53
|
+
if (matched) {
|
|
54
|
+
result = `border-radius-${matched[1]}`;
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
});
|
|
59
|
+
return result;
|
|
60
|
+
}],
|
|
61
|
+
// _rules/color
|
|
62
|
+
[/^op(?:acity)?-?(.+)$/, () => `opacity`],
|
|
63
|
+
[/^bg-(.+)$/, ([type]) => {
|
|
64
|
+
if (/^\[url\(.+\)\]$/.test(type))
|
|
65
|
+
return "image";
|
|
66
|
+
if (/^\[image:.+\]$/.test(type))
|
|
67
|
+
return "image";
|
|
68
|
+
if (/^\[(?:linear|conic|radial)-gradient\(.+\)\]$/.test(type))
|
|
69
|
+
return "image";
|
|
70
|
+
if (/^\[(?:length|size):.+\]$/.test(type))
|
|
71
|
+
return "size";
|
|
72
|
+
if (/^\[position:.+\]$/.test(type))
|
|
73
|
+
return "position";
|
|
74
|
+
if (/^op(?:acity)?-?(.+)$/.test(type))
|
|
75
|
+
return "opacity";
|
|
76
|
+
const parsed = parseColor(type, theme);
|
|
77
|
+
return parsed?.color ? "color" : null;
|
|
78
|
+
}, { scope: "bg" }],
|
|
79
|
+
// _rules/container
|
|
80
|
+
[/^@container(?:\/(\w+))?(?:-(normal))?$/, () => "container"],
|
|
81
|
+
// _rules/decoration
|
|
82
|
+
// _rules/default
|
|
83
|
+
// _rules/flex
|
|
84
|
+
// [/^$/, () => ''],
|
|
85
|
+
// _rules/gap
|
|
86
|
+
[
|
|
87
|
+
/^(?:flex-|grid-)?(?:gap-?()|gap-([xy]-?|col-?|row-?))(.+)$/,
|
|
88
|
+
([direction]) => {
|
|
89
|
+
if (direction === "y" || direction === "row")
|
|
90
|
+
return "gap-row";
|
|
91
|
+
if (direction === "x" || direction === "col")
|
|
92
|
+
return "gap-column";
|
|
93
|
+
return "gap";
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
// _rules/grid
|
|
97
|
+
// _rules/layout
|
|
98
|
+
// _rules/position
|
|
99
|
+
[/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, () => "position"],
|
|
100
|
+
[/^(?:position-|pos-)([-\w]+)$/, ([type]) => GlobalKeywordsRE.test(type) ? "position" : null],
|
|
101
|
+
[/^(?:position-|pos-)?(static)$/, () => "position"],
|
|
102
|
+
// _rules/question-mark
|
|
103
|
+
// _rules/ring
|
|
104
|
+
// _rules/shadow
|
|
105
|
+
// _rules/size
|
|
106
|
+
// _rules/spacing
|
|
107
|
+
[/^p-?([xy])(?:-?(.+))?$/, ([type]) => `padding-${type}`],
|
|
108
|
+
[/^p-?([rltbse])(?:-?(.+))?$/, ([type]) => `padding-${type}`],
|
|
109
|
+
[/^p-(block|inline)(?:-(.+))?$/, ([type]) => `padding-${type}`],
|
|
110
|
+
[/^p-?([bi][se])(?:-?(.+))?$/, ([type]) => `padding-${type}`],
|
|
111
|
+
// [/^pa?()-?(.+)$/, () => 'padding'],
|
|
112
|
+
// [/^p-?xy()()$/, () => 'padding'],
|
|
113
|
+
[/^m-?([xy])(?:-?(.+))?$/, ([type]) => `margin-${type}`],
|
|
114
|
+
[/^m-?([rltbse])(?:-?(.+))?$/, ([type]) => `margin-${type}`],
|
|
115
|
+
[/^m-(block|inline)(?:-(.+))?$/, ([type]) => `margin-${type}`],
|
|
116
|
+
[/^m-?([bi][se])(?:-?(.+))?$/, ([type]) => `margin-${type}`],
|
|
117
|
+
// [/^ma?()-?(.+)$/, () => 'margin'],
|
|
118
|
+
// [/^m-?xy()()$/, () => 'margin'],
|
|
119
|
+
// _rules/static
|
|
120
|
+
[
|
|
121
|
+
/^(?:display-(.+)|inline|block|inline-block|contents|flow-root|list-item|hidden)$/,
|
|
122
|
+
([type]) => {
|
|
123
|
+
if (!type || GlobalKeywordsRE.test(type))
|
|
124
|
+
return "display";
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
[
|
|
129
|
+
/^(?:visible|invisible|backface-(.+))$/,
|
|
130
|
+
([type]) => {
|
|
131
|
+
if (!type || GlobalKeywordsRE.test(type) || /^(?:visible|hidden)$/.test(type))
|
|
132
|
+
return "visibility";
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
[/^content-(.+)$/, () => "content"],
|
|
137
|
+
// _rules/svg
|
|
138
|
+
// _rules/transform
|
|
139
|
+
[
|
|
140
|
+
/^(?:transform-)?(origin|perspect(?:ive)?(?:-origin)?|(?:translate|rotate|skew|scale)(?:-[xyz])?)-(.+)$/,
|
|
141
|
+
([type]) => type
|
|
142
|
+
],
|
|
143
|
+
[
|
|
144
|
+
/^(?:transform-)?preserve-(?:3d|flat)$/,
|
|
145
|
+
() => "preserve"
|
|
146
|
+
],
|
|
147
|
+
[
|
|
148
|
+
/^(?:transform)(?:-(.+))?$/,
|
|
149
|
+
([type]) => {
|
|
150
|
+
if (!type || type === "none" || GlobalKeywordsRE.test(type))
|
|
151
|
+
return "transform";
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
// _rules/transition
|
|
156
|
+
[/^(?:transition-)?(?:(duration|delay|ease|property)-)(.+)$/, ([type]) => type],
|
|
157
|
+
[/^transition(?:-(.+))$/, ([type]) => {
|
|
158
|
+
if (!type || type === "none" || GlobalKeywordsRE.test(type))
|
|
159
|
+
return "transition";
|
|
160
|
+
if (/^discrete|normal$/.test(type))
|
|
161
|
+
return "transition-behavior";
|
|
162
|
+
return null;
|
|
163
|
+
}],
|
|
164
|
+
// _rules/typography
|
|
165
|
+
[
|
|
166
|
+
/^text-(.+)$/,
|
|
167
|
+
([s = "base"]) => {
|
|
168
|
+
const returnValue = "font-size";
|
|
169
|
+
const split = splitShorthand(s, "length");
|
|
170
|
+
if (!split)
|
|
171
|
+
return null;
|
|
172
|
+
const [size] = split;
|
|
173
|
+
const sizePairs = toArray(theme.fontSize?.[size]);
|
|
174
|
+
if (sizePairs?.[0])
|
|
175
|
+
return returnValue;
|
|
176
|
+
const fontSize = h.bracketOfLength.rem(size);
|
|
177
|
+
if (fontSize)
|
|
178
|
+
return returnValue;
|
|
179
|
+
return h.bracketOfLength.rem(s) ? returnValue : null;
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
[
|
|
183
|
+
/^(?:text|font)-size-(.+)$/,
|
|
184
|
+
([s]) => {
|
|
185
|
+
const themed = toArray(theme.fontSize?.[s]);
|
|
186
|
+
const size = themed?.[0] ?? h.bracket.cssvar.global.rem(s);
|
|
187
|
+
return size == null ? null : "font-size";
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
[
|
|
191
|
+
/^text-(?:color-)?(.+)$/,
|
|
192
|
+
([colorOrSize]) => {
|
|
193
|
+
if (isCSSMathFn(h.bracket(colorOrSize)))
|
|
194
|
+
return "font-size";
|
|
195
|
+
const parsed = parseColor(colorOrSize, theme);
|
|
196
|
+
return parsed?.color ? "color" : null;
|
|
197
|
+
}
|
|
198
|
+
],
|
|
199
|
+
[
|
|
200
|
+
/^(?:color|c)-(.+)$/,
|
|
201
|
+
([color]) => {
|
|
202
|
+
const parsed = parseColor(color, theme);
|
|
203
|
+
return parsed?.color ? "color" : null;
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
// _rules/variables
|
|
207
|
+
[
|
|
208
|
+
/^\[(.*)\]$/,
|
|
209
|
+
([body]) => {
|
|
210
|
+
if (!body.includes(":"))
|
|
211
|
+
return null;
|
|
212
|
+
const [prop] = body.split(":");
|
|
213
|
+
return prop;
|
|
214
|
+
},
|
|
215
|
+
{ scope: "variables" }
|
|
216
|
+
],
|
|
217
|
+
// others
|
|
218
|
+
[
|
|
219
|
+
new RegExp(`^${cssVarsPrefix}-((?:${cssVarsAll.join("|")})-)?(.+)$`),
|
|
220
|
+
([type = "base", color]) => {
|
|
221
|
+
const parsed = parseColor(color, theme);
|
|
222
|
+
return parsed?.color ? type : null;
|
|
223
|
+
},
|
|
224
|
+
{ scope: cssVarsPrefix }
|
|
225
|
+
]
|
|
226
|
+
];
|
|
227
|
+
}
|
|
228
|
+
export function prepareStyler(rules = []) {
|
|
229
|
+
const createVariants = cv(rules);
|
|
230
|
+
function createStyler(theme2) {
|
|
231
|
+
const ui = createVariants(theme2);
|
|
232
|
+
const styler = (props) => ui(props);
|
|
233
|
+
return styler;
|
|
234
|
+
}
|
|
235
|
+
return { createStyler };
|
|
236
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
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/nuxt.d.ts
ADDED
package/dist/nuxt.mjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { addComponent, defineNuxtModule, useLogger } from "@nuxt/kit";
|
|
2
|
+
import { componentNames, packageName } from "./internal/index.mjs";
|
|
3
|
+
export default defineNuxtModule({
|
|
4
|
+
meta: {
|
|
5
|
+
name: packageName,
|
|
6
|
+
configKey: "ui",
|
|
7
|
+
compatibility: {
|
|
8
|
+
nuxt: ">=3.13.1"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
defaults: {
|
|
12
|
+
prefix: ""
|
|
13
|
+
},
|
|
14
|
+
setup(options, nuxt) {
|
|
15
|
+
const logger = useLogger(packageName);
|
|
16
|
+
if (!nuxt.options.modules.includes("@unocss/nuxt")) {
|
|
17
|
+
logger.error(`\`${packageName}\` requires the \`@unocss/nuxt\` module to be installed.`);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
for (const component of componentNames) {
|
|
21
|
+
addComponent({
|
|
22
|
+
name: `${options.prefix}${component}`,
|
|
23
|
+
export: component,
|
|
24
|
+
filePath: packageName
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ComponentResolver } from 'unplugin-vue-components';
|
|
2
|
+
export interface ResolverOptions {
|
|
3
|
+
/**
|
|
4
|
+
* prefix for components used in templates
|
|
5
|
+
*
|
|
6
|
+
* @default ""
|
|
7
|
+
*/
|
|
8
|
+
prefix?: string;
|
|
9
|
+
}
|
|
10
|
+
export default function (options?: ResolverOptions): ComponentResolver;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { componentNames, packageName } from "./internal/constants.mjs";
|
|
2
|
+
export default function(options = {}) {
|
|
3
|
+
const { prefix = "" } = options;
|
|
4
|
+
return {
|
|
5
|
+
type: "component",
|
|
6
|
+
resolve(name) {
|
|
7
|
+
if (name.toLowerCase().startsWith(prefix.toLowerCase())) {
|
|
8
|
+
const componentName = name.slice(prefix.length);
|
|
9
|
+
if (componentNames.includes(componentName)) {
|
|
10
|
+
return {
|
|
11
|
+
name: componentName,
|
|
12
|
+
from: packageName
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
base: undefined;
|
|
3
|
+
slots: {
|
|
4
|
+
root: string;
|
|
5
|
+
item: string;
|
|
6
|
+
header: string;
|
|
7
|
+
trigger: string;
|
|
8
|
+
content: string[];
|
|
9
|
+
body: string;
|
|
10
|
+
icon: string;
|
|
11
|
+
trailingIcon: string;
|
|
12
|
+
label: string;
|
|
13
|
+
};
|
|
14
|
+
variants: {
|
|
15
|
+
disabled: {
|
|
16
|
+
true: {
|
|
17
|
+
trigger: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
compoundVariants: import("@byyuurin/ui-kit/index").CVCompoundVariants<{
|
|
22
|
+
disabled: {
|
|
23
|
+
true: {
|
|
24
|
+
trigger: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}, {
|
|
28
|
+
root: string;
|
|
29
|
+
item: string;
|
|
30
|
+
header: string;
|
|
31
|
+
trigger: string;
|
|
32
|
+
content: string[];
|
|
33
|
+
body: string;
|
|
34
|
+
icon: string;
|
|
35
|
+
trailingIcon: string;
|
|
36
|
+
label: string;
|
|
37
|
+
}, undefined>;
|
|
38
|
+
};
|
|
39
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ct } from "@byyuurin/ui-kit";
|
|
2
|
+
export default ct({
|
|
3
|
+
slots: {
|
|
4
|
+
root: "w-full color-ui-cb",
|
|
5
|
+
item: "border-b last:border-b-0",
|
|
6
|
+
header: "flex",
|
|
7
|
+
trigger: "group flex-1 flex items-center gap-2 font-medium text-sm py-4 focus-visible:outline-ui-fill min-w-0",
|
|
8
|
+
content: [
|
|
9
|
+
"overflow-hidden focus:outline-none",
|
|
10
|
+
"data-[state=open]:animate-[accordion-down_200ms_ease-out]",
|
|
11
|
+
"data-[state=closed]:animate-[accordion-up_200ms_ease-out]"
|
|
12
|
+
],
|
|
13
|
+
body: "text-sm pb-4 color-ui-cb/80",
|
|
14
|
+
icon: "shrink-0 size-5",
|
|
15
|
+
trailingIcon: "shrink-0 size-5 ms-auto group-data-[state=open]:rotate-180 transition-transform duration-200",
|
|
16
|
+
label: "text-start break-words"
|
|
17
|
+
},
|
|
18
|
+
variants: {
|
|
19
|
+
disabled: {
|
|
20
|
+
true: {
|
|
21
|
+
trigger: "cursor-not-allowed opacity-50"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|