@byyuurin/ui 0.0.2 → 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.
Files changed (132) hide show
  1. package/README.md +75 -5
  2. package/dist/index.cjs +38 -0
  3. package/dist/index.d.ts +3 -3
  4. package/dist/index.mjs +3 -3
  5. package/dist/nuxt.d.mts +13 -0
  6. package/dist/nuxt.d.ts +6 -3
  7. package/dist/nuxt.mjs +6 -3
  8. package/dist/resolver.d.mts +13 -0
  9. package/dist/resolver.d.ts +6 -3
  10. package/dist/resolver.mjs +5 -2
  11. package/dist/{components → runtime/components}/Accordion.vue +19 -3
  12. package/dist/{components → runtime/components}/Button.vue +93 -94
  13. package/dist/{components → runtime/components}/Checkbox.vue +104 -104
  14. package/dist/{components → runtime/components}/RadioGroup.vue +180 -180
  15. package/dist/{components → runtime/components}/Select.vue +262 -258
  16. package/dist/{components → runtime/components}/Switch.vue +99 -99
  17. package/dist/{components → runtime/components}/Tabs.vue +117 -117
  18. package/dist/{components → runtime/components}/Toaster.vue +35 -1
  19. package/dist/runtime/components/index.cjs +132 -0
  20. package/dist/runtime/composables/index.cjs +33 -0
  21. package/dist/runtime/composables/useComponentIcons.cjs +30 -0
  22. package/dist/runtime/composables/useModal.cjs +55 -0
  23. package/dist/runtime/composables/useTheme.cjs +30 -0
  24. package/dist/{composables → runtime/composables}/useTheme.d.ts +0 -1
  25. package/dist/{composables → runtime/composables}/useTheme.mjs +3 -3
  26. package/dist/runtime/composables/useToast.cjs +51 -0
  27. package/dist/{composables → runtime/composables}/useToast.d.ts +1 -1
  28. package/dist/runtime/theme/accordion.cjs +27 -0
  29. package/dist/runtime/theme/app.cjs +15 -0
  30. package/dist/runtime/theme/button.cjs +127 -0
  31. package/dist/runtime/theme/card.cjs +17 -0
  32. package/dist/runtime/theme/checkbox.cjs +56 -0
  33. package/dist/runtime/theme/drawer.cjs +73 -0
  34. package/dist/runtime/theme/index.cjs +125 -0
  35. package/dist/runtime/theme/input.cjs +115 -0
  36. package/dist/runtime/theme/link.cjs +23 -0
  37. package/dist/runtime/theme/modal.cjs +55 -0
  38. package/dist/runtime/theme/popover.cjs +13 -0
  39. package/dist/runtime/theme/radioGroup.cjs +73 -0
  40. package/dist/runtime/theme/select.cjs +128 -0
  41. package/dist/runtime/theme/switch.cjs +73 -0
  42. package/dist/runtime/theme/tabs.cjs +105 -0
  43. package/dist/runtime/theme/toast.cjs +33 -0
  44. package/dist/runtime/theme/toaster.cjs +72 -0
  45. package/dist/runtime/theme/tooltip.cjs +14 -0
  46. package/dist/runtime/types/components.cjs +1 -0
  47. package/dist/runtime/types/index.cjs +27 -0
  48. package/dist/{types → runtime/types}/index.d.ts +1 -1
  49. package/dist/runtime/types/utils.cjs +1 -0
  50. package/dist/runtime/utils/extend-theme.cjs +24 -0
  51. package/dist/runtime/utils/index.cjs +119 -0
  52. package/dist/{utils → runtime/utils}/index.d.ts +3 -1
  53. package/dist/{utils → runtime/utils}/index.mjs +3 -1
  54. package/dist/runtime/utils/link.cjs +10 -0
  55. package/dist/runtime/utils/styler.cjs +18 -0
  56. package/dist/{internal → runtime/utils}/styler.d.ts +0 -1
  57. package/dist/runtime/utils/styler.mjs +10 -0
  58. package/dist/{internal/constants.mjs → shared/ui.CPXA9QoM.mjs} +4 -2
  59. package/dist/unocss-preset.d.mts +49 -0
  60. package/dist/unocss-preset.d.ts +20 -8
  61. package/dist/unocss-preset.mjs +428 -78
  62. package/package.json +15 -10
  63. package/dist/internal/constants.d.ts +0 -3
  64. package/dist/internal/index.d.ts +0 -4
  65. package/dist/internal/index.mjs +0 -4
  66. package/dist/internal/styler.mjs +0 -236
  67. package/dist/utils/unocss.d.ts +0 -3
  68. package/dist/utils/unocss.mjs +0 -50
  69. /package/dist/{components → runtime/components}/App.vue +0 -0
  70. /package/dist/{components → runtime/components}/Card.vue +0 -0
  71. /package/dist/{components → runtime/components}/Drawer.vue +0 -0
  72. /package/dist/{components → runtime/components}/Input.vue +0 -0
  73. /package/dist/{components → runtime/components}/Link.vue +0 -0
  74. /package/dist/{components → runtime/components}/Modal.vue +0 -0
  75. /package/dist/{components → runtime/components}/ModalProvider.vue +0 -0
  76. /package/dist/{components → runtime/components}/Popover.vue +0 -0
  77. /package/dist/{components → runtime/components}/Toast.vue +0 -0
  78. /package/dist/{components → runtime/components}/Tooltip.vue +0 -0
  79. /package/dist/{components → runtime/components}/index.d.ts +0 -0
  80. /package/dist/{components → runtime/components}/index.mjs +0 -0
  81. /package/dist/{composables → runtime/composables}/index.d.ts +0 -0
  82. /package/dist/{composables → runtime/composables}/index.mjs +0 -0
  83. /package/dist/{composables → runtime/composables}/useComponentIcons.d.ts +0 -0
  84. /package/dist/{composables → runtime/composables}/useComponentIcons.mjs +0 -0
  85. /package/dist/{composables → runtime/composables}/useModal.d.ts +0 -0
  86. /package/dist/{composables → runtime/composables}/useModal.mjs +0 -0
  87. /package/dist/{composables → runtime/composables}/useToast.mjs +0 -0
  88. /package/dist/{theme → runtime/theme}/accordion.d.ts +0 -0
  89. /package/dist/{theme → runtime/theme}/accordion.mjs +0 -0
  90. /package/dist/{theme → runtime/theme}/app.d.ts +0 -0
  91. /package/dist/{theme → runtime/theme}/app.mjs +0 -0
  92. /package/dist/{theme → runtime/theme}/button.d.ts +0 -0
  93. /package/dist/{theme → runtime/theme}/button.mjs +0 -0
  94. /package/dist/{theme → runtime/theme}/card.d.ts +0 -0
  95. /package/dist/{theme → runtime/theme}/card.mjs +0 -0
  96. /package/dist/{theme → runtime/theme}/checkbox.d.ts +0 -0
  97. /package/dist/{theme → runtime/theme}/checkbox.mjs +0 -0
  98. /package/dist/{theme → runtime/theme}/drawer.d.ts +0 -0
  99. /package/dist/{theme → runtime/theme}/drawer.mjs +0 -0
  100. /package/dist/{theme → runtime/theme}/index.d.ts +0 -0
  101. /package/dist/{theme → runtime/theme}/index.mjs +0 -0
  102. /package/dist/{theme → runtime/theme}/input.d.ts +0 -0
  103. /package/dist/{theme → runtime/theme}/input.mjs +0 -0
  104. /package/dist/{theme → runtime/theme}/link.d.ts +0 -0
  105. /package/dist/{theme → runtime/theme}/link.mjs +0 -0
  106. /package/dist/{theme → runtime/theme}/modal.d.ts +0 -0
  107. /package/dist/{theme → runtime/theme}/modal.mjs +0 -0
  108. /package/dist/{theme → runtime/theme}/popover.d.ts +0 -0
  109. /package/dist/{theme → runtime/theme}/popover.mjs +0 -0
  110. /package/dist/{theme → runtime/theme}/radioGroup.d.ts +0 -0
  111. /package/dist/{theme → runtime/theme}/radioGroup.mjs +0 -0
  112. /package/dist/{theme → runtime/theme}/select.d.ts +0 -0
  113. /package/dist/{theme → runtime/theme}/select.mjs +0 -0
  114. /package/dist/{theme → runtime/theme}/switch.d.ts +0 -0
  115. /package/dist/{theme → runtime/theme}/switch.mjs +0 -0
  116. /package/dist/{theme → runtime/theme}/tabs.d.ts +0 -0
  117. /package/dist/{theme → runtime/theme}/tabs.mjs +0 -0
  118. /package/dist/{theme → runtime/theme}/toast.d.ts +0 -0
  119. /package/dist/{theme → runtime/theme}/toast.mjs +0 -0
  120. /package/dist/{theme → runtime/theme}/toaster.d.ts +0 -0
  121. /package/dist/{theme → runtime/theme}/toaster.mjs +0 -0
  122. /package/dist/{theme → runtime/theme}/tooltip.d.ts +0 -0
  123. /package/dist/{theme → runtime/theme}/tooltip.mjs +0 -0
  124. /package/dist/{types → runtime/types}/components.d.ts +0 -0
  125. /package/dist/{types → runtime/types}/components.mjs +0 -0
  126. /package/dist/{types → runtime/types}/index.mjs +0 -0
  127. /package/dist/{types → runtime/types}/utils.d.ts +0 -0
  128. /package/dist/{types → runtime/types}/utils.mjs +0 -0
  129. /package/dist/{internal → runtime/utils}/extend-theme.d.ts +0 -0
  130. /package/dist/{internal → runtime/utils}/extend-theme.mjs +0 -0
  131. /package/dist/{internal → runtime/utils}/link.d.ts +0 -0
  132. /package/dist/{internal → runtime/utils}/link.mjs +0 -0
@@ -1,77 +1,431 @@
1
- import { definePreset } from "@unocss/core";
2
- import { parseColor, parseCssColor } from "@unocss/preset-mini/utils";
3
- export const cssVarsPrefix = "ui";
4
- export const cssVarsBase = ["cb", "c1", "c2", "c3"];
5
- export const cssVarsDynamic = ["fill", "content"];
6
- export const cssVarsAll = [...cssVarsBase, ...cssVarsDynamic];
7
- export default definePreset((options = {}) => {
8
- const theme = {
9
- colors: {
10
- [cssVarsPrefix]: {
11
- cb: cssColor(cssVar("cb")),
12
- c: {
13
- 1: cssColor(cssVar("c1")),
14
- 2: cssColor(cssVar("c2")),
15
- 3: cssColor(cssVar("c3"))
16
- },
17
- fill: cssColor(cssVar("fill", cssVar("cb"))),
18
- content: cssColor(cssVar("content", cssVar("cb")))
19
- }
20
- },
21
- backgroundColor: {
22
- [cssVarsPrefix]: {
23
- base: cssColor(cssVar("fill", cssVar("c1")))
24
- }
25
- },
26
- textColor: {
27
- [cssVarsPrefix]: {
28
- base: cssColor(cssVar("content", cssVar("cb")))
29
- }
30
- },
31
- borderColor: {
32
- [cssVarsPrefix]: {
33
- base: cssColor(cssVar("fill", cssVar("cb")))
34
- }
35
- },
36
- borderRadius: {
37
- [`${cssVarsPrefix}-base`]: cssVar("radius"),
38
- [`${cssVarsPrefix}-button`]: cssVar("radius-button", cssVar("radius")),
39
- [`${cssVarsPrefix}-box`]: cssVar("radius-box", cssVar("radius")),
40
- [`${cssVarsPrefix}-tabs`]: cssVar("radius-tabs", cssVar("radius"))
41
- },
42
- ringWidth: {
43
- DEFAULT: "1px"
44
- },
45
- shadowColor: {
46
- [cssVarsPrefix]: {
47
- base: cssColor(cssVar("fill", cssVar("cb")))
48
- }
49
- },
50
- animation: {
51
- keyframes: {
52
- "fade-in": "{from {opacity: 0;}to {opacity: 1;}}",
53
- "fade-out": "{from {opacity: 1;}to {opacity: 0;}}",
54
- "scale-in": "{from {opacity: 0;scale: 0.95;}to {opacity: 1;scale: 1;}}",
55
- "scale-out": "{from {opacity: 1;scale: 1;}to {opacity: 0;scale: 0.95;}}",
56
- "slide-in-from-top": "{from {transform: translateY(-100%);}to {transform: translateY(0);}}",
57
- "slide-out-to-top": "{from {transform: translateY(0);}to {transform: translateY(-100%);}}",
58
- "slide-in-from-right": "{from {transform: translateX(100%);}to {transform: translateX(0);}}",
59
- "slide-out-to-right": "{from {transform: translateX(0);}to {transform: translateX(100%);}}",
60
- "slide-in-from-bottom": "{from {transform: translateY(100%);}to {transform: translateY(0);}}",
61
- "slide-out-to-bottom": "{from {transform: translateY(0);}to {transform: translateY(100%);}}",
62
- "slide-in-from-left": "{from {transform: translateX(-100%);}to {transform: translateX(0);}}",
63
- "slide-out-to-left": "{from {transform: translateX(0);}to {transform: translateX(-100%);}}",
64
- "slide-in-from-top-and-fade": "{from {opacity: 0;transform: translateY(-4px);}to {opacity: 1;transform: translateY(0);}}",
65
- "slide-out-to-top-and-fade": "{from {opacity: 1;transform: translateY(0);}to {opacity: 0;transform: translateY(-4px);}}",
66
- "slide-in-from-right-and-fade": "{from {opacity: 0;transform: translateX(4px);}to {opacity: 1;transform: translateX(0);}}",
67
- "slide-out-to-right-and-fade": "{from {opacity: 1;transform: translateX(0);}to {opacity: 0;transform: translateX(4px);}}",
68
- "slide-in-from-bottom-and-fade": "{from {opacity: 0;transform: translateY(4px);}to {opacity: 1;transform: translateY(0);}}",
69
- "slide-out-to-bottom-and-fade": "{from {opacity: 1;transform: translateY(0);}to {opacity: 0;transform: translateY(4px);}}",
70
- "slide-in-from-left-and-fade": "{from {opacity: 0;transform: translateX(-4px);}to {opacity: 1;transform: translateX(0);}}",
71
- "slide-out-to-left-and-fade": "{from {opacity: 1;transform: translateX(0);}to {opacity: 0;transform: translateX(-4px);}}"
72
- }
1
+ import { mergeDeep, toArray, definePreset } from '@unocss/core';
2
+ import { h, isCSSMathFn, parseColor, globalKeywords, directionMap, splitShorthand, resolveBreakpoints, directionSize, parseCssColor } from '@unocss/preset-mini/utils';
3
+ import { theme as theme$1 } from '@unocss/preset-mini';
4
+
5
+ const cssVarsPrefix = "ui";
6
+ const cssVarsBase = ["cb", "c1", "c2", "c3"];
7
+ const cssVarsDynamic = ["fill", "content"];
8
+ const cssVarsAll = [...cssVarsBase, ...cssVarsDynamic];
9
+
10
+ const theme = {
11
+ colors: {
12
+ [cssVarsPrefix]: {
13
+ cb: cssColor(cssVar("cb")),
14
+ c: {
15
+ 1: cssColor(cssVar("c1")),
16
+ 2: cssColor(cssVar("c2")),
17
+ 3: cssColor(cssVar("c3"))
18
+ },
19
+ fill: cssColor(cssVar("fill", cssVar("cb"))),
20
+ content: cssColor(cssVar("content", cssVar("cb")))
21
+ }
22
+ },
23
+ backgroundColor: {
24
+ [cssVarsPrefix]: {
25
+ base: cssColor(cssVar("fill", cssVar("c1")))
26
+ }
27
+ },
28
+ textColor: {
29
+ [cssVarsPrefix]: {
30
+ base: cssColor(cssVar("content", cssVar("cb")))
31
+ }
32
+ },
33
+ borderColor: {
34
+ [cssVarsPrefix]: {
35
+ base: cssColor(cssVar("fill", cssVar("cb")))
73
36
  }
37
+ },
38
+ borderRadius: {
39
+ [`${cssVarsPrefix}-base`]: cssVar("radius"),
40
+ [`${cssVarsPrefix}-button`]: cssVar("radius-button", cssVar("radius")),
41
+ [`${cssVarsPrefix}-box`]: cssVar("radius-box", cssVar("radius")),
42
+ [`${cssVarsPrefix}-tabs`]: cssVar("radius-tabs", cssVar("radius"))
43
+ },
44
+ ringWidth: {
45
+ DEFAULT: "1px"
46
+ },
47
+ shadowColor: {
48
+ [cssVarsPrefix]: {
49
+ base: cssColor(cssVar("fill", cssVar("cb")))
50
+ }
51
+ },
52
+ animation: {
53
+ keyframes: {
54
+ "fade-in": "{from {opacity: 0;}to {opacity: 1;}}",
55
+ "fade-out": "{from {opacity: 1;}to {opacity: 0;}}",
56
+ "scale-in": "{from {opacity: 0;scale: 0.95;}to {opacity: 1;scale: 1;}}",
57
+ "scale-out": "{from {opacity: 1;scale: 1;}to {opacity: 0;scale: 0.95;}}",
58
+ "slide-in-from-top": "{from {transform: translateY(-100%);}to {transform: translateY(0);}}",
59
+ "slide-out-to-top": "{from {transform: translateY(0);}to {transform: translateY(-100%);}}",
60
+ "slide-in-from-right": "{from {transform: translateX(100%);}to {transform: translateX(0);}}",
61
+ "slide-out-to-right": "{from {transform: translateX(0);}to {transform: translateX(100%);}}",
62
+ "slide-in-from-bottom": "{from {transform: translateY(100%);}to {transform: translateY(0);}}",
63
+ "slide-out-to-bottom": "{from {transform: translateY(0);}to {transform: translateY(100%);}}",
64
+ "slide-in-from-left": "{from {transform: translateX(-100%);}to {transform: translateX(0);}}",
65
+ "slide-out-to-left": "{from {transform: translateX(0);}to {transform: translateX(-100%);}}",
66
+ "slide-in-from-top-and-fade": "{from {opacity: 0;transform: translateY(-4px);}to {opacity: 1;transform: translateY(0);}}",
67
+ "slide-out-to-top-and-fade": "{from {opacity: 1;transform: translateY(0);}to {opacity: 0;transform: translateY(-4px);}}",
68
+ "slide-in-from-right-and-fade": "{from {opacity: 0;transform: translateX(4px);}to {opacity: 1;transform: translateX(0);}}",
69
+ "slide-out-to-right-and-fade": "{from {opacity: 1;transform: translateX(0);}to {opacity: 0;transform: translateX(4px);}}",
70
+ "slide-in-from-bottom-and-fade": "{from {opacity: 0;transform: translateY(4px);}to {opacity: 1;transform: translateY(0);}}",
71
+ "slide-out-to-bottom-and-fade": "{from {opacity: 1;transform: translateY(0);}to {opacity: 0;transform: translateY(4px);}}",
72
+ "slide-in-from-left-and-fade": "{from {opacity: 0;transform: translateX(-4px);}to {opacity: 1;transform: translateX(0);}}",
73
+ "slide-out-to-left-and-fade": "{from {opacity: 1;transform: translateX(0);}to {opacity: 0;transform: translateX(-4px);}}"
74
+ }
75
+ }
76
+ };
77
+ function cssVar(name, ...defaultValue) {
78
+ return `var(${[`--${cssVarsPrefix}-${name}`, ...defaultValue].join(",")})`;
79
+ }
80
+ function cssColor(...rgb) {
81
+ return `rgb(${rgb.join(" ")})`;
82
+ }
83
+
84
+ function createMergeRules() {
85
+ const theme$2 = mergeDeep(theme$1, theme);
86
+ const directionSpacing = (type, direction = "", size = "") => {
87
+ if (directionSize(type)(["", direction, size], { theme: theme$2 }))
88
+ return directionMap[direction]?.map((v) => `${type}${v}`).join(",");
89
+ return null;
74
90
  };
91
+ return [
92
+ // _rules/align
93
+ [
94
+ /^(?:vertical|align|v)-([-\w]+%?)$/,
95
+ () => "vertical-align"
96
+ ],
97
+ [
98
+ /^(?:text-align|text)-(.+)$/,
99
+ ([value]) => ["center", "left", "right", "justify", "start", "end"].includes(value) ? "text-align" : null
100
+ ],
101
+ // _rules/behaviors
102
+ [
103
+ /^outline-(?:width-|size-)?(.+)$/,
104
+ ([value]) => {
105
+ if (theme$2.lineWidth && value in theme$2.lineWidth)
106
+ return "outline-width";
107
+ if (h.bracket.cssvar.global.px(value))
108
+ return "outline-width";
109
+ return null;
110
+ }
111
+ ],
112
+ [
113
+ /^outline-(?:color-)?(.+)$/,
114
+ ([value]) => {
115
+ if (isCSSMathFn(h.bracket(value)))
116
+ return null;
117
+ const parsed = parseColor(value, theme$2);
118
+ return parsed?.color ? "outline-color" : null;
119
+ }
120
+ ],
121
+ [
122
+ /^outline-offset-(.+)$/,
123
+ ([value]) => {
124
+ if (theme$2.lineWidth && value in theme$2.lineWidth)
125
+ return "outline-offset";
126
+ if (h.bracket.cssvar.global.px(value))
127
+ return "outline-offset";
128
+ return null;
129
+ }
130
+ ],
131
+ [
132
+ /^outline(?:-(.+))$/,
133
+ ([value]) => {
134
+ if (!value)
135
+ return "outline-style";
136
+ if (["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset", ...globalKeywords].includes(value))
137
+ return "outline-style";
138
+ if (value === "none")
139
+ return "outline,outline-offset";
140
+ return null;
141
+ }
142
+ ],
143
+ // _rules/border
144
+ [/^(?:border|b)(?:-(.+))?$/, ([value]) => {
145
+ if (!value)
146
+ return "border-width";
147
+ const borderStyles = /* @__PURE__ */ new Set(["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset", ...globalKeywords]);
148
+ if (borderStyles.has(value))
149
+ return "border-style";
150
+ const matched = value && value.match(/^([xyrltbse]|block|inline|[bi][se])?(?:-(.+))?$/);
151
+ if (matched) {
152
+ const [_, d = "", value2 = "1"] = matched;
153
+ const parsed = parseColor(value2, theme$2);
154
+ const size = !!(theme$2.lineWidth && value2 in theme$2.lineWidth || h.bracket.cssvar.global.px(value2));
155
+ const base = directionMap[d]?.map((v) => `border${v}`) ?? null;
156
+ if (!base)
157
+ return `null`;
158
+ if (borderStyles.has(value2))
159
+ return base.map((v) => `${v}-style`).join(",");
160
+ if (size)
161
+ return base.map((v) => `${v}-width`).join(",");
162
+ if (parsed?.color)
163
+ return base.map((v) => `${v}-color`).join(",");
164
+ }
165
+ return null;
166
+ }],
167
+ [/^(?:border-|b-)?(?:rounded|rd)(.+)$/, ([type]) => {
168
+ let result = "border-radius";
169
+ [
170
+ /^([xyrltbse]|block|inline|[bi][se])(?:-(.+))?$/
171
+ ].some((r) => {
172
+ const matched = type.match(r);
173
+ if (matched) {
174
+ result = `border-radius-${matched[1]}`;
175
+ return true;
176
+ }
177
+ return false;
178
+ });
179
+ return result;
180
+ }],
181
+ // _rules/color
182
+ [/^op(?:acity)?-?(.+)$/, () => `opacity`],
183
+ [/^bg-(.+)$/, ([type]) => {
184
+ if (/^\[url\(.+\)\]$/.test(type))
185
+ return "image";
186
+ if (/^\[image:.+\]$/.test(type))
187
+ return "image";
188
+ if (/^\[(?:linear|conic|radial)-gradient\(.+\)\]$/.test(type))
189
+ return "image";
190
+ if (/^\[(?:length|size):.+\]$/.test(type))
191
+ return "size";
192
+ if (/^\[position:.+\]$/.test(type))
193
+ return "position";
194
+ if (/^op(?:acity)?-?(.+)$/.test(type))
195
+ return "opacity";
196
+ const parsed = parseColor(type, theme$2);
197
+ return parsed?.color ? "background-color" : null;
198
+ }],
199
+ // _rules/container
200
+ [/^@container(?:\/(\w+))?(?:-(normal))?$/, () => "container"],
201
+ // _rules/decoration
202
+ // _rules/default
203
+ // _rules/flex
204
+ // _rules/gap
205
+ [
206
+ /^(?:flex-|grid-)?(?:gap-?()|gap-([xy]-?|col-?|row-?))(.+)$/,
207
+ ([direction]) => {
208
+ if (direction === "y" || direction === "row")
209
+ return "row-gap";
210
+ if (direction === "x" || direction === "col")
211
+ return "column-gap";
212
+ return "gap";
213
+ }
214
+ ],
215
+ // _rules/grid
216
+ // _rules/layout
217
+ // _rules/position
218
+ [/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, () => "position"],
219
+ [/^(?:position-|pos-)([-\w]+)$/, ([value]) => globalKeywords.includes(value) ? "position" : null],
220
+ [/^(?:position-|pos-)?(static)$/, () => "position"],
221
+ // _rules/question-mark
222
+ // _rules/ring
223
+ // _rules/shadow
224
+ // _rules/size
225
+ [
226
+ /^size-(min-|max-)?(.+)$/,
227
+ ([m, s]) => {
228
+ return getSizeValue(m, "w", theme$2, s) ? [getSizePropName(m, "w"), getSizePropName(m, "h")].join(",") : null;
229
+ }
230
+ ],
231
+ [
232
+ /^(?:size-)?(min-|max-)?([wh])-?(.+)$/,
233
+ ([m, w, s]) => {
234
+ return getSizeValue(m, w, theme$2, s) ? getSizePropName(m, w) : null;
235
+ }
236
+ ],
237
+ [
238
+ /^(?:size-)?(min-|max-)?(block|inline)-(.+)$/,
239
+ ([m, w, s]) => {
240
+ return getSizeValue(m, w, theme$2, s) ? getSizePropName(m, w) : null;
241
+ }
242
+ ],
243
+ [
244
+ /^(?:size-)?(min-|max-)?(h)-screen-(.+)$/,
245
+ ([m, h2, p]) => getSizeBreakpointValue(theme$2, p, "verticalBreakpoints") ? getSizePropName(m, h2) : null
246
+ ],
247
+ [
248
+ /^(?:size-)?(min-|max-)?(w)-screen-(.+)$/,
249
+ ([m, w, p]) => getSizeBreakpointValue(theme$2, p) ? getSizePropName(m, w) : null
250
+ ],
251
+ [
252
+ /^(?:size-)?aspect-(?:ratio-)?(?:\d+\/\d+|square|video)$/,
253
+ () => "aspect-ratio"
254
+ ],
255
+ // _rules/spacing
256
+ [
257
+ /^p-?([xyrltbse])?(?:-?(.+))?$/,
258
+ ([direction, size]) => directionSpacing("padding", direction, size)
259
+ ],
260
+ [
261
+ /^p-(block|inline)(?:-(.+))?$/,
262
+ ([direction, size]) => directionSpacing("padding", direction, size)
263
+ ],
264
+ [
265
+ /^p-?([bi][se])(?:-?(.+))?$/,
266
+ ([direction, size]) => directionSpacing("padding", direction, size)
267
+ ],
268
+ [
269
+ /^m-?([xyrltbse])?(?:-?(.+))?$/,
270
+ ([direction, size]) => directionSpacing("margin", direction, size)
271
+ ],
272
+ [
273
+ /^m-(block|inline)(?:-(.+))?$/,
274
+ ([direction, size]) => directionSpacing("margin", direction, size)
275
+ ],
276
+ [
277
+ /^m-?([bi][se])(?:-?(.+))?$/,
278
+ ([direction, size]) => directionSpacing("margin", direction, size)
279
+ ],
280
+ // _rules/static
281
+ [
282
+ /^(?:display-(.+)|inline|block|inline-block|contents|flow-root|list-item|hidden)$/,
283
+ ([value]) => {
284
+ if (!value || globalKeywords.includes(value))
285
+ return "display";
286
+ return null;
287
+ }
288
+ ],
289
+ [
290
+ /^(?:visible|invisible|backface-(.+))$/,
291
+ ([value]) => value ? "backface-visibility" : "visibility"
292
+ ],
293
+ [/^content-(.+)$/, () => "content"],
294
+ // _rules/svg
295
+ // _rules/transform
296
+ [
297
+ /^(?:transform-)?(origin|perspect(?:ive)?(?:-origin)?|(?:translate|rotate|skew|scale)(?:-[xyz])?)-(.+)$/,
298
+ ([type]) => type
299
+ ],
300
+ [
301
+ /^(?:transform-)?preserve-(?:3d|flat)$/,
302
+ () => "transform-style"
303
+ ],
304
+ [
305
+ /^(?:transform)(?:-(.+))?$/,
306
+ ([value]) => {
307
+ if (!value || value === "none" || globalKeywords.includes(value))
308
+ return "transform";
309
+ return null;
310
+ }
311
+ ],
312
+ // _rules/transition
313
+ [
314
+ /^(?:transition-)?(?:(duration|delay|ease|property)-)(.+)$/,
315
+ ([value]) => {
316
+ const mapping = {
317
+ duration: "transition-duration",
318
+ delay: "transition-delay",
319
+ ease: "transition-timing-function",
320
+ property: "transition-property"
321
+ };
322
+ return mapping[value];
323
+ }
324
+ ],
325
+ [
326
+ /^transition(?:-(.+))$/,
327
+ ([value]) => {
328
+ if (!value)
329
+ return "transition-property,transition-timing-function,transition-duration";
330
+ if (value === "none" || globalKeywords.includes(value))
331
+ return "transition";
332
+ if (/^discrete|normal$/.test(value))
333
+ return "transition-behavior";
334
+ return null;
335
+ }
336
+ ],
337
+ // _rules/typography
338
+ [
339
+ /^text-(.+)$/,
340
+ ([s = "base"]) => {
341
+ const returnValue = "font-size";
342
+ const split = splitShorthand(s, "length");
343
+ if (!split)
344
+ return null;
345
+ const [size] = split;
346
+ const sizePairs = toArray(theme$2.fontSize?.[size]);
347
+ if (sizePairs?.[0])
348
+ return returnValue;
349
+ const fontSize = h.bracketOfLength.rem(size);
350
+ if (fontSize)
351
+ return returnValue;
352
+ return h.bracketOfLength.rem(s) ? returnValue : null;
353
+ }
354
+ ],
355
+ [
356
+ /^(?:text|font)-size-(.+)$/,
357
+ ([s]) => {
358
+ const themed = toArray(theme$2.fontSize?.[s]);
359
+ const size = themed?.[0] ?? h.bracket.cssvar.global.rem(s);
360
+ return size == null ? null : "font-size";
361
+ }
362
+ ],
363
+ [
364
+ /^text-(?:color-)?(.+)$/,
365
+ ([colorOrSize]) => {
366
+ if (isCSSMathFn(h.bracket(colorOrSize)))
367
+ return "font-size";
368
+ const parsed = parseColor(colorOrSize, theme$2);
369
+ return parsed?.color ? "color" : null;
370
+ }
371
+ ],
372
+ [
373
+ /^(?:color|c)-(.+)$/,
374
+ ([color]) => {
375
+ const parsed = parseColor(color, theme$2);
376
+ return parsed?.color ? "color" : null;
377
+ }
378
+ ],
379
+ // _rules/variables
380
+ [
381
+ /^\[(.*)\]$/,
382
+ ([body]) => {
383
+ if (!body.includes(":"))
384
+ return null;
385
+ return body.split(":")[0];
386
+ }
387
+ ],
388
+ // others
389
+ [
390
+ new RegExp(`^${cssVarsPrefix}-((?:${cssVarsAll.join("|")})-)?(.+)$`),
391
+ ([prop, color]) => {
392
+ const parsed = parseColor(color, theme$2);
393
+ if (!parsed?.color)
394
+ return null;
395
+ return prop ? `--ui-${prop}` : "--ui-fill,--ui-content";
396
+ }
397
+ ]
398
+ ];
399
+ }
400
+ function getSizePropName(minmax, hw) {
401
+ const sizeMapping = {
402
+ h: "height",
403
+ w: "width",
404
+ inline: "inline-size",
405
+ block: "block-size"
406
+ };
407
+ return `${minmax || ""}${sizeMapping[hw]}`;
408
+ }
409
+ function getSizeValue(minmax, hw, theme, prop) {
410
+ const str = getSizePropName(minmax, hw).replace(/-(\w)/g, (_, p) => p.toUpperCase());
411
+ const v = theme[str]?.[prop];
412
+ if (v != null)
413
+ return v;
414
+ switch (prop) {
415
+ case "fit":
416
+ case "max":
417
+ case "min":
418
+ return `${prop}-content`;
419
+ }
420
+ return h.bracket.cssvar.global.auto.fraction.rem(prop);
421
+ }
422
+ function getSizeBreakpointValue(theme, point, key = "breakpoints") {
423
+ const bp = resolveBreakpoints({ theme }, key);
424
+ if (bp)
425
+ return bp.find((i) => i.point === point)?.size;
426
+ }
427
+
428
+ const preset = definePreset((options = {}) => {
75
429
  const resolveRuleValue = (data) => {
76
430
  if (data?.color && data.cssColor?.components) {
77
431
  let value = data.cssColor.components.join(" ");
@@ -130,12 +484,6 @@ function mergeOptions(options) {
130
484
  ...options
131
485
  };
132
486
  }
133
- function cssVar(name, ...defaultValue) {
134
- return `var(${[`--${cssVarsPrefix}-${name}`, ...defaultValue].join(",")})`;
135
- }
136
- function cssColor(...rgb) {
137
- return `rgb(${rgb.join(" ")})`;
138
- }
139
487
  function createRootCSS(kv) {
140
488
  const kebabCase = (input) => input.replace(/([A-Z][^A-Z]*)/g, "-$1").replace(/^-/, "").toLowerCase();
141
489
  const join = (input) => input.map((item) => item.endsWith(";") ? item : `${item};`).join("");
@@ -162,3 +510,5 @@ function createRootCSS(kv) {
162
510
  ];
163
511
  return css.join("");
164
512
  }
513
+
514
+ export { createMergeRules, cssColor, cssVar, cssVarsAll, cssVarsBase, cssVarsDynamic, cssVarsPrefix, preset as default, preset, theme };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@byyuurin/ui",
3
3
  "type": "module",
4
- "version": "0.0.2",
4
+ "version": "0.0.3",
5
5
  "description": "",
6
6
  "author": "Yuurin <byyuurin@gmail.com>",
7
7
  "license": "MIT",
@@ -16,24 +16,29 @@
16
16
  "exports": {
17
17
  ".": {
18
18
  "types": "./dist/index.d.ts",
19
- "import": "./dist/index.mjs"
19
+ "default": "./dist/index.mjs"
20
+ },
21
+ "./index": {
22
+ "types": "./dist/index.d.ts",
23
+ "default": "./dist/index.mjs"
20
24
  },
21
25
  "./resolver": {
22
26
  "types": "./dist/resolver.d.ts",
23
- "import": "./dist/resolver.mjs"
27
+ "default": "./dist/resolver.mjs"
24
28
  },
25
29
  "./nuxt": {
26
30
  "types": "./dist/nuxt.d.ts",
27
- "import": "./dist/nuxt.mjs"
31
+ "default": "./dist/nuxt.mjs"
28
32
  },
29
33
  "./unocss-preset": {
30
34
  "types": "./dist/unocss-preset.d.ts",
31
- "import": "./dist/unocss-preset.mjs"
32
- }
35
+ "default": "./dist/unocss-preset.mjs"
36
+ },
37
+ "./*": "./dist/*"
33
38
  },
34
- "main": "./dist/index.mjs",
35
- "module": "./dist/index.mjs",
36
- "types": "./dist/index.d.ts",
39
+ "main": "dist/index.cjs",
40
+ "module": "dist/index.mjs",
41
+ "types": "dist/index.d.ts",
37
42
  "typesVersions": {
38
43
  "*": {
39
44
  "*": [
@@ -43,6 +48,7 @@
43
48
  }
44
49
  },
45
50
  "files": [
51
+ "*.d.ts",
46
52
  "dist"
47
53
  ],
48
54
  "peerDependencies": {
@@ -60,7 +66,6 @@
60
66
  "@nuxt/kit": "^3.15.4",
61
67
  "@unocss/core": "^65.4.3",
62
68
  "@unocss/preset-mini": "^65.4.3",
63
- "@unocss/preset-uno": "^65.4.3",
64
69
  "@vueuse/core": "^12.5.0",
65
70
  "defu": "^6.1.4",
66
71
  "ohash": "^1.1.4",
@@ -1,3 +0,0 @@
1
- import type { ComponentName } from '../types';
2
- export declare const packageName = "@byyuurin/ui";
3
- export declare const componentNames: ComponentName[];
@@ -1,4 +0,0 @@
1
- export * from './constants';
2
- export * from './extend-theme';
3
- export * from './link';
4
- export * from './styler';
@@ -1,4 +0,0 @@
1
- export * from "./constants.mjs";
2
- export * from "./extend-theme.mjs";
3
- export * from "./link.mjs";
4
- export * from "./styler.mjs";