vunor 0.1.2 → 0.1.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 +6 -11
- package/dist/AppLayout.mjs +0 -0
- package/dist/AppToasts.mjs +4 -8
- package/dist/Button.mjs +5 -10
- package/dist/ButtonBase.mjs +4 -8
- package/dist/Calendar.mjs +10 -14
- package/dist/Card.mjs +4 -9
- package/dist/CardHeader.mjs +5 -10
- package/dist/CardInner.mjs +4 -9
- package/dist/Checkbox.mjs +4 -8
- package/dist/Combobox.d.mts +9 -9
- package/dist/Combobox.mjs +5 -9
- package/dist/DatePicker.d.mts +9 -9
- package/dist/DatePicker.mjs +12 -17
- package/dist/DatePickerBase.d.mts +9 -9
- package/dist/DatePickerBase.mjs +13 -17
- package/dist/DatePickerInner.mjs +5 -9
- package/dist/DatePickerPopup.mjs +4 -8
- package/dist/DelayedSwitch.mjs +4 -9
- package/dist/DevTools.mjs +583 -150
- package/dist/Dialog.d.mts +6 -6
- package/dist/Dialog.mjs +4 -8
- package/dist/Icon.mjs +4 -9
- package/dist/InnerLoading.mjs +4 -8
- package/dist/Input.d.mts +13 -13
- package/dist/Input.mjs +4 -8
- package/dist/InputBase.d.mts +9 -9
- package/dist/InputBase.mjs +4 -8
- package/dist/Label.mjs +1 -4
- package/dist/LoadingIndicator.mjs +4 -8
- package/dist/Menu.d.mts +2 -2
- package/dist/Menu.mjs +5 -14
- package/dist/MenuItem.mjs +4 -9
- package/dist/OverflowContainer.mjs +4 -8
- package/dist/Pagination.mjs +4 -9
- package/dist/Popover.mjs +4 -9
- package/dist/ProgressBar.mjs +4 -9
- package/dist/RadioGroup.mjs +4 -8
- package/dist/Select.d.mts +9 -9
- package/dist/Select.mjs +4 -9
- package/dist/SelectBase.mjs +4 -8
- package/dist/Slider.mjs +4 -8
- package/dist/Tabs.mjs +4 -9
- package/dist/nuxt.mjs +1 -3
- package/dist/theme.d.mts +35 -0
- package/dist/theme.mjs +289 -336
- package/dist/utils-6bTTIoaw.js +40 -0
- package/dist/utils.d.mts +2 -2
- package/dist/utils.mjs +1 -4
- package/dist/vite.mjs +1 -2
- package/dist/vunor.d.mts +13 -13
- package/dist/vunor.mjs +1 -6
- package/package.json +30 -37
- package/scripts/setup-skills.js +0 -78
- package/skills/vunor/SKILL.md +0 -115
- package/skills/vunor/components.md +0 -320
- package/skills/vunor/core.md +0 -173
- package/skills/vunor/forms.md +0 -348
- package/skills/vunor/palette.md +0 -223
- package/skills/vunor/rules.md +0 -263
- package/skills/vunor/shortcuts.md +0 -239
- package/skills/vunor/typography.md +0 -204
package/dist/theme.mjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import defu$1, { defu } from "defu";
|
|
2
2
|
import { presetWind } from "unocss";
|
|
3
3
|
import { color, palitra } from "@prostojs/palitra";
|
|
4
|
-
|
|
5
4
|
//#region src/theme/utils/define-sc.ts
|
|
6
5
|
const defineShortcuts = (sc) => sc;
|
|
7
|
-
|
|
8
6
|
//#endregion
|
|
9
7
|
//#region src/components/AppToasts/shortcuts.ts
|
|
10
8
|
const toastShortcuts = defineShortcuts({
|
|
@@ -30,7 +28,6 @@ const toastShortcuts = defineShortcuts({
|
|
|
30
28
|
"data-[swipe=right]:": "[--toast-out-x:calc(100%+var(--viewport-padding))]"
|
|
31
29
|
}
|
|
32
30
|
});
|
|
33
|
-
|
|
34
31
|
//#endregion
|
|
35
32
|
//#region src/components/Button/shortcuts.ts
|
|
36
33
|
const buttonShortcuts = defineShortcuts({
|
|
@@ -57,7 +54,6 @@ const buttonShortcuts = defineShortcuts({
|
|
|
57
54
|
"group-[.btn-round.btn-square]/btn:": "m-0!"
|
|
58
55
|
}
|
|
59
56
|
});
|
|
60
|
-
|
|
61
57
|
//#endregion
|
|
62
58
|
//#region src/components/Calendar/shortcuts.ts
|
|
63
59
|
const calendarShortcuts = defineShortcuts({
|
|
@@ -90,10 +86,7 @@ const calendarShortcuts = defineShortcuts({
|
|
|
90
86
|
}
|
|
91
87
|
}
|
|
92
88
|
});
|
|
93
|
-
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region src/components/Card/shortcuts.ts
|
|
96
|
-
const headers = [
|
|
89
|
+
const cardShortcuts = defineShortcuts({ card: `data-[rounded=true]:rounded-$card-spacing data-[dense=true]:card-dense! ${[
|
|
97
90
|
"h1",
|
|
98
91
|
"h2",
|
|
99
92
|
"h3",
|
|
@@ -105,9 +98,7 @@ const headers = [
|
|
|
105
98
|
"body",
|
|
106
99
|
"body-s",
|
|
107
100
|
"callout"
|
|
108
|
-
];
|
|
109
|
-
const cardShortcuts = defineShortcuts({ card: `data-[rounded=true]:rounded-$card-spacing data-[dense=true]:card-dense! ${headers.map((header) => `data-[level=${header}]:card-${header}`).join(" ")}` });
|
|
110
|
-
|
|
101
|
+
].map((header) => `data-[level=${header}]:card-${header}`).join(" ")}` });
|
|
111
102
|
//#endregion
|
|
112
103
|
//#region src/components/Checkbox/shortcuts.ts
|
|
113
104
|
const checkboxShortcuts = defineShortcuts({
|
|
@@ -127,7 +118,6 @@ const checkboxShortcuts = defineShortcuts({
|
|
|
127
118
|
"checkbox-icon": { "": "size-0.9em animate-cb-appear animate-duration-200 animate-ease" },
|
|
128
119
|
"checkbox-label": { "": "select-none text-body lh-1.5em" }
|
|
129
120
|
});
|
|
130
|
-
|
|
131
121
|
//#endregion
|
|
132
122
|
//#region src/components/Combobox/shortcuts.ts
|
|
133
123
|
const comboboxShortcuts = defineShortcuts({
|
|
@@ -139,7 +129,6 @@ const comboboxShortcuts = defineShortcuts({
|
|
|
139
129
|
"group-[[aria-expanded=true]]/i8:": "-scale-100"
|
|
140
130
|
}
|
|
141
131
|
});
|
|
142
|
-
|
|
143
132
|
//#endregion
|
|
144
133
|
//#region src/components/Dialog/shortcuts.ts
|
|
145
134
|
const dialogShortcuts = defineShortcuts({
|
|
@@ -156,7 +145,6 @@ const dialogShortcuts = defineShortcuts({
|
|
|
156
145
|
"dialog-close": "absolute right-$card-spacing top-$card-spacing hover:bg-grey-500/10 rounded p-$xxs",
|
|
157
146
|
"dialog-footer": "flex-shrink-0 flex gap-$s justify-end border-t px-$card-spacing py-$m"
|
|
158
147
|
});
|
|
159
|
-
|
|
160
148
|
//#endregion
|
|
161
149
|
//#region src/components/Loading/shortcuts.ts
|
|
162
150
|
const loadingShortcuts = defineShortcuts({
|
|
@@ -167,14 +155,12 @@ const loadingShortcuts = defineShortcuts({
|
|
|
167
155
|
},
|
|
168
156
|
"inner-loading": "bg-white/50 dark:bg-black/50 flex items-center justify-center absolute left-0 top-0 right-0 bottom-0 z-5 cursor-wait"
|
|
169
157
|
});
|
|
170
|
-
|
|
171
158
|
//#endregion
|
|
172
159
|
//#region src/components/Menu/shortcuts.ts
|
|
173
160
|
const menuShortcuts = defineShortcuts({
|
|
174
161
|
"menu-root": "flex flex-col overflow-hidden",
|
|
175
162
|
"menu-item": "justify-start c8-flat gap-$m w-full fw-400"
|
|
176
163
|
});
|
|
177
|
-
|
|
178
164
|
//#endregion
|
|
179
165
|
//#region src/components/ProgressBar/shortcuts.ts
|
|
180
166
|
const progressShortcuts = defineShortcuts({
|
|
@@ -200,84 +186,6 @@ const progressShortcuts = defineShortcuts({
|
|
|
200
186
|
"dark:": "bg-scope-color-600"
|
|
201
187
|
}
|
|
202
188
|
});
|
|
203
|
-
|
|
204
|
-
//#endregion
|
|
205
|
-
//#region src/components/RadioGroup/shortcuts.ts
|
|
206
|
-
const radioShortcuts = defineShortcuts({
|
|
207
|
-
"rb-container": { "": "flex flex-col gap-$s text-body" },
|
|
208
|
-
"rb-label": { "": "text-label text-grey-400" },
|
|
209
|
-
"rb-root": {
|
|
210
|
-
"": "flex gap-x-$l gap-y-$m",
|
|
211
|
-
"[&.rb-row]:": "flex-wrap",
|
|
212
|
-
"not-[.rb-row]:": "flex-col"
|
|
213
|
-
},
|
|
214
|
-
"rb-item-wrapper": { "": "flex" },
|
|
215
|
-
"rb-item": {
|
|
216
|
-
"": "select-none shrink-0 current-bg-scope-color-500 bg-current/0 size-1.25em rounded-full cursor-default current-border-grey-500 border-current/40 border-[0.16em] transition-none",
|
|
217
|
-
"data-[state=checked]:not-[[data-error='true']]:": "current-border-scope-color-500 border-current",
|
|
218
|
-
"data-[state=checked]:": "bg-current",
|
|
219
|
-
"active:enabled:": "bg-current/20",
|
|
220
|
-
"aria-[disabled=true]:": "scope-grey opacity-50 cursor-not-allowed",
|
|
221
|
-
"data-[error=true]:": "current-border-error-500 current-bg-error-500"
|
|
222
|
-
},
|
|
223
|
-
"rb-item-indicator": { "": "flex items-center justify-center w-full h-full rounded-full relative after:content-[''] after:block after:size-[0.5em] after:rounded-[50%] after:bg-white animate-zoom-in animate-duration-100" },
|
|
224
|
-
"rb-item-label": {
|
|
225
|
-
"": "select-none px-$s text-body leading-none lh-1.25em",
|
|
226
|
-
"aria-[disabled=true]:": "scope-grey opacity-50 cursor-not-allowed"
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
//#endregion
|
|
231
|
-
//#region src/components/Select/shortcuts.ts
|
|
232
|
-
const selectShortcuts = defineShortcuts({
|
|
233
|
-
"select-content": {
|
|
234
|
-
"": "min-w-[60px] rounded-base surface-0 bg-current overflow-hidden shadow-popup z-[100] current-border-grey-400 border-current/20 ",
|
|
235
|
-
"data-[design=round]:": "rounded-fingertip-half",
|
|
236
|
-
"[&>div[data-reka-combobox-viewport]]:": "max-h-[var(--reka-popper-available-height)] [scrollbar-width:auto]",
|
|
237
|
-
"[&>div[data-reka-combobox-viewport]::-webkit-scrollbar]:": "block"
|
|
238
|
-
},
|
|
239
|
-
"select-scroll-btn": "flex items-center justify-center h-fingertip cursor-default",
|
|
240
|
-
"select-grp-label": {
|
|
241
|
-
"": "px-$m h-fingertip flex items-center ",
|
|
242
|
-
"group-data-[design=round]:": "px-fingertip-half",
|
|
243
|
-
"[&>span]:": "text-label text-grey-400"
|
|
244
|
-
},
|
|
245
|
-
"select-item": {
|
|
246
|
-
"": "text-body leading-none flex items-center min-h-fingertip relative select-none relative",
|
|
247
|
-
"data-[disabled]:": "opacity-40 pointer-events-none",
|
|
248
|
-
"data-[highlighted]:": "outline-none bg-scope-color-500/15",
|
|
249
|
-
"[&>span]:": "px-$m",
|
|
250
|
-
"group-data-[design=round]:[&>span]:": "px-fingertip-half",
|
|
251
|
-
"[&>span]:data-[state=checked]:": "text-scope-color-500 fw-700!"
|
|
252
|
-
},
|
|
253
|
-
"select-separator": "h-[1px] bg-grey-500/10 mx-$s"
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
//#endregion
|
|
257
|
-
//#region src/components/Slider/shortcuts.ts
|
|
258
|
-
const sliderShortcuts = defineShortcuts({
|
|
259
|
-
"slider": { "": "relative flex items-center select-none touch-none min-w-2em min-h-2em" },
|
|
260
|
-
"slider-track": { "": "bg-grey-500/20 relative grow rounded-full h-[0.25em]" },
|
|
261
|
-
"slider-range": { "": "absolute bg-scope-color-500 rounded-full h-full" },
|
|
262
|
-
"slider-thumb": {
|
|
263
|
-
"": "block w-[1.5em] h-[1.5em] bg-scope-color-500 rounded-full border-scope-light-0 border-[3px] outline-scope-color-500/10 outline-0px outline-solid",
|
|
264
|
-
"dark:": "border-scope-dark-0",
|
|
265
|
-
"not-[[disabled]]:": {
|
|
266
|
-
"": "cursor-grab",
|
|
267
|
-
"hover:": "shadow-md",
|
|
268
|
-
"active:": "cursor-grabbing",
|
|
269
|
-
"focus:": "outline-[0.5em]"
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
//#endregion
|
|
275
|
-
//#region src/components/Tabs/shortcuts.ts
|
|
276
|
-
const tabShortcuts = defineShortcuts({
|
|
277
|
-
"tabs-indicator": "absolute left-0 h-[2px] bottom-0 w-[--reka-tabs-indicator-size] translate-x-[--reka-tabs-indicator-position] rounded-full transition-all duration-200 bg-scope-color-500",
|
|
278
|
-
"tab": "h-fingertip rounded flex items-center justify-center px-$m gap-$m select-none"
|
|
279
|
-
});
|
|
280
|
-
|
|
281
189
|
//#endregion
|
|
282
190
|
//#region src/components/shortcuts.ts
|
|
283
191
|
const shortcuts = [
|
|
@@ -285,19 +193,79 @@ const shortcuts = [
|
|
|
285
193
|
menuShortcuts,
|
|
286
194
|
buttonShortcuts,
|
|
287
195
|
checkboxShortcuts,
|
|
288
|
-
|
|
289
|
-
|
|
196
|
+
defineShortcuts({
|
|
197
|
+
"rb-container": { "": "flex flex-col gap-$s text-body" },
|
|
198
|
+
"rb-label": { "": "text-label text-grey-400" },
|
|
199
|
+
"rb-root": {
|
|
200
|
+
"": "flex gap-x-$l gap-y-$m",
|
|
201
|
+
"[&.rb-row]:": "flex-wrap",
|
|
202
|
+
"not-[.rb-row]:": "flex-col"
|
|
203
|
+
},
|
|
204
|
+
"rb-item-wrapper": { "": "flex" },
|
|
205
|
+
"rb-item": {
|
|
206
|
+
"": "select-none shrink-0 current-bg-scope-color-500 bg-current/0 size-1.25em rounded-full cursor-default current-border-grey-500 border-current/40 border-[0.16em] transition-none",
|
|
207
|
+
"data-[state=checked]:not-[[data-error='true']]:": "current-border-scope-color-500 border-current",
|
|
208
|
+
"data-[state=checked]:": "bg-current",
|
|
209
|
+
"active:enabled:": "bg-current/20",
|
|
210
|
+
"aria-[disabled=true]:": "scope-grey opacity-50 cursor-not-allowed",
|
|
211
|
+
"data-[error=true]:": "current-border-error-500 current-bg-error-500"
|
|
212
|
+
},
|
|
213
|
+
"rb-item-indicator": { "": "flex items-center justify-center w-full h-full rounded-full relative after:content-[''] after:block after:size-[0.5em] after:rounded-[50%] after:bg-white animate-zoom-in animate-duration-100" },
|
|
214
|
+
"rb-item-label": {
|
|
215
|
+
"": "select-none px-$s text-body leading-none lh-1.25em",
|
|
216
|
+
"aria-[disabled=true]:": "scope-grey opacity-50 cursor-not-allowed"
|
|
217
|
+
}
|
|
218
|
+
}),
|
|
219
|
+
defineShortcuts({
|
|
220
|
+
"select-content": {
|
|
221
|
+
"": "min-w-[60px] rounded-base surface-0 bg-current overflow-hidden shadow-popup z-[100] current-border-grey-400 border-current/20 ",
|
|
222
|
+
"data-[design=round]:": "rounded-fingertip-half",
|
|
223
|
+
"[&>div[data-reka-combobox-viewport]]:": "max-h-[var(--reka-popper-available-height)] [scrollbar-width:auto]",
|
|
224
|
+
"[&>div[data-reka-combobox-viewport]::-webkit-scrollbar]:": "block"
|
|
225
|
+
},
|
|
226
|
+
"select-scroll-btn": "flex items-center justify-center h-fingertip cursor-default",
|
|
227
|
+
"select-grp-label": {
|
|
228
|
+
"": "px-$m h-fingertip flex items-center ",
|
|
229
|
+
"group-data-[design=round]:": "px-fingertip-half",
|
|
230
|
+
"[&>span]:": "text-label text-grey-400"
|
|
231
|
+
},
|
|
232
|
+
"select-item": {
|
|
233
|
+
"": "text-body leading-none flex items-center min-h-fingertip relative select-none relative",
|
|
234
|
+
"data-[disabled]:": "opacity-40 pointer-events-none",
|
|
235
|
+
"data-[highlighted]:": "outline-none bg-scope-color-500/15",
|
|
236
|
+
"[&>span]:": "px-$m",
|
|
237
|
+
"group-data-[design=round]:[&>span]:": "px-fingertip-half",
|
|
238
|
+
"[&>span]:data-[state=checked]:": "text-scope-color-500 fw-700!"
|
|
239
|
+
},
|
|
240
|
+
"select-separator": "h-[1px] bg-grey-500/10 mx-$s"
|
|
241
|
+
}),
|
|
290
242
|
comboboxShortcuts,
|
|
291
|
-
|
|
243
|
+
defineShortcuts({
|
|
244
|
+
"slider": { "": "relative flex items-center select-none touch-none min-w-2em min-h-2em" },
|
|
245
|
+
"slider-track": { "": "bg-grey-500/20 relative grow rounded-full h-[0.25em]" },
|
|
246
|
+
"slider-range": { "": "absolute bg-scope-color-500 rounded-full h-full" },
|
|
247
|
+
"slider-thumb": {
|
|
248
|
+
"": "block w-[1.5em] h-[1.5em] bg-scope-color-500 rounded-full border-scope-light-0 border-[3px] outline-scope-color-500/10 outline-0px outline-solid",
|
|
249
|
+
"dark:": "border-scope-dark-0",
|
|
250
|
+
"not-[[disabled]]:": {
|
|
251
|
+
"": "cursor-grab",
|
|
252
|
+
"hover:": "shadow-md",
|
|
253
|
+
"active:": "cursor-grabbing",
|
|
254
|
+
"focus:": "outline-[0.5em]"
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}),
|
|
292
258
|
loadingShortcuts,
|
|
293
|
-
|
|
259
|
+
defineShortcuts({
|
|
260
|
+
"tabs-indicator": "absolute left-0 h-[2px] bottom-0 w-[--reka-tabs-indicator-size] translate-x-[--reka-tabs-indicator-position] rounded-full transition-all duration-200 bg-scope-color-500",
|
|
261
|
+
"tab": "h-fingertip rounded flex items-center justify-center px-$m gap-$m select-none"
|
|
262
|
+
}),
|
|
294
263
|
dialogShortcuts,
|
|
295
264
|
calendarShortcuts,
|
|
296
265
|
progressShortcuts,
|
|
297
266
|
toastShortcuts,
|
|
298
267
|
{ "shadow-popup": "shadow-[0_0_10px_rgba(0,0,0,0.1),0_4px_20px_rgba(0,0,0,0.15)]" }
|
|
299
268
|
];
|
|
300
|
-
|
|
301
269
|
//#endregion
|
|
302
270
|
//#region src/theme/shortcuts/c8.ts
|
|
303
271
|
const c8 = defineShortcuts({
|
|
@@ -358,7 +326,6 @@ const c8 = defineShortcuts({
|
|
|
358
326
|
"c8-light-hover": { "not-([disabled]):": "bg-current/15" },
|
|
359
327
|
"c8-light-active": { "not-([disabled]):": "bg-current/20" }
|
|
360
328
|
});
|
|
361
|
-
|
|
362
329
|
//#endregion
|
|
363
330
|
//#region src/theme/shortcuts/i8.ts
|
|
364
331
|
const i8 = defineShortcuts({
|
|
@@ -475,7 +442,6 @@ const i8 = defineShortcuts({
|
|
|
475
442
|
"[&>.i8-icon-wrap:hover]:": "current-icon-hl icon-current"
|
|
476
443
|
}
|
|
477
444
|
});
|
|
478
|
-
|
|
479
445
|
//#endregion
|
|
480
446
|
//#region src/theme/utils/shortcut-obj.ts
|
|
481
447
|
/**
|
|
@@ -509,17 +475,20 @@ function prepareScArray(input) {
|
|
|
509
475
|
const mergeTwoVunorShortcuts = (target, source) => {
|
|
510
476
|
const result = {};
|
|
511
477
|
const keys = new Set([...Object.keys(source), ...Object.keys(target)]);
|
|
512
|
-
for (const key of Array.from(keys))
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
478
|
+
for (const key of Array.from(keys)) {
|
|
479
|
+
const inSource = Object.prototype.hasOwnProperty.call(source, key);
|
|
480
|
+
const inTarget = Object.prototype.hasOwnProperty.call(target, key);
|
|
481
|
+
if (inSource && inTarget) {
|
|
482
|
+
let sourceValue = source[key];
|
|
483
|
+
let targetValue = target[key];
|
|
484
|
+
if (Array.isArray(sourceValue)) sourceValue = sourceValue.join(" ");
|
|
485
|
+
if (Array.isArray(targetValue)) targetValue = targetValue.join(" ");
|
|
486
|
+
if (typeof sourceValue === "string" && typeof targetValue === "string") result[key] = `${targetValue} ${sourceValue}`;
|
|
487
|
+
else if (typeof sourceValue === "object" && typeof targetValue === "string") result[key] = `${targetValue} ${toUnoShortcut(sourceValue)}`;
|
|
488
|
+
else if (typeof sourceValue === "string" && typeof targetValue === "object") result[key] = `${toUnoShortcut(targetValue)} ${sourceValue}`;
|
|
489
|
+
else if (typeof sourceValue === "object" && typeof targetValue === "object") result[key] = `${toUnoShortcut(targetValue)} ${toUnoShortcut(sourceValue)}`;
|
|
490
|
+
} else if (inSource) result[key] = source[key];
|
|
491
|
+
else result[key] = target[key];
|
|
523
492
|
}
|
|
524
493
|
return result;
|
|
525
494
|
};
|
|
@@ -531,7 +500,6 @@ const mergeTwoVunorShortcuts = (target, source) => {
|
|
|
531
500
|
* @returns TVunorShortcut
|
|
532
501
|
*/
|
|
533
502
|
const mergeVunorShortcuts = (shortcuts) => shortcuts.reduce((acc, shortcut) => mergeTwoVunorShortcuts(acc, shortcut), {});
|
|
534
|
-
|
|
535
503
|
//#endregion
|
|
536
504
|
//#region src/theme/palitra.ts
|
|
537
505
|
const defaultOpts = {
|
|
@@ -584,6 +552,7 @@ const defaultOpts = {
|
|
|
584
552
|
lightest: .97,
|
|
585
553
|
darkest: .24,
|
|
586
554
|
layersDepth: .08,
|
|
555
|
+
flatness: 1,
|
|
587
556
|
mainPalette: {
|
|
588
557
|
preserveInputColor: false,
|
|
589
558
|
luminance: {
|
|
@@ -746,6 +715,7 @@ function generatePalette(_opts) {
|
|
|
746
715
|
const bgOptions = {
|
|
747
716
|
count: 5,
|
|
748
717
|
preserveInputColor: false,
|
|
718
|
+
flatness: opts.layerPalette.flatness ?? opts.flatness,
|
|
749
719
|
luminance: {
|
|
750
720
|
dark: opts.layerPalette.luminance?.dark ?? opts.darkest,
|
|
751
721
|
light: opts.layerPalette.luminance?.light ?? opts.darkest + opts.layersDepth,
|
|
@@ -769,8 +739,9 @@ function generatePalette(_opts) {
|
|
|
769
739
|
"light-3",
|
|
770
740
|
"light-4"
|
|
771
741
|
].toReversed();
|
|
742
|
+
const lumDark = bgOptions.luminance?.dark ?? opts.darkest;
|
|
772
743
|
bgOptions.luminance = {
|
|
773
|
-
dark: 1 - (bgOptions.luminance
|
|
744
|
+
dark: 1 - ((bgOptions.luminance?.light ?? opts.darkest + opts.layersDepth) - lumDark),
|
|
774
745
|
light: 1,
|
|
775
746
|
useMiddle: false
|
|
776
747
|
};
|
|
@@ -786,6 +757,7 @@ function generatePalette(_opts) {
|
|
|
786
757
|
}, {
|
|
787
758
|
count: 10,
|
|
788
759
|
preserveInputColor: opts.mainPalette.preserveInputColor,
|
|
760
|
+
flatness: opts.mainPalette.flatness ?? opts.flatness,
|
|
789
761
|
luminance: {
|
|
790
762
|
dark: opts.mainPalette.luminance?.dark ?? opts.darkest + opts.layersDepth + .02,
|
|
791
763
|
light: opts.mainPalette.luminance?.light ?? opts.lightest,
|
|
@@ -816,23 +788,21 @@ function multiplySaturation(colors, m = .5) {
|
|
|
816
788
|
}
|
|
817
789
|
return newObj;
|
|
818
790
|
}
|
|
791
|
+
const layerN = (n, reverse) => reverse ? 4 - n : n;
|
|
819
792
|
function getPaletteShortcuts() {
|
|
820
|
-
const layerN = (n, reverse) => reverse ? 4 - n : n;
|
|
821
793
|
return [
|
|
822
794
|
[/^layer-([0-4])$/, ([, a], { theme }) => {
|
|
823
795
|
const d = layerN(Number(a), theme.reverseDarkLayers);
|
|
824
|
-
const l = layerN(Number(a), theme.reverseLightLayers);
|
|
825
796
|
return toUnoShortcut({
|
|
826
|
-
"": `current-bg-scope-light-${
|
|
797
|
+
"": `current-bg-scope-light-${layerN(Number(a), theme.reverseLightLayers)} current-text-scope-dark-2 current-icon-scope-dark-2 current-border-grey-500 bg-current text-current`,
|
|
827
798
|
"dark:": `current-bg-scope-dark-${d} current-text-scope-light-2 current-icon-scope-light-2`,
|
|
828
799
|
"[&.dark]:": `current-bg-scope-dark-${d} current-text-scope-light-2 current-icon-scope-light-2`
|
|
829
800
|
});
|
|
830
801
|
}],
|
|
831
802
|
[/^(bg|text|current-text|current-bg|current-icon|current-border|current-outline|current-caret|current-hl|i8-bg|i8-border|i8-outline)-layer-([0-4])$/, ([, target, a], { theme }) => {
|
|
832
803
|
const d = layerN(Number(a), theme.reverseDarkLayers);
|
|
833
|
-
const l = layerN(Number(a), theme.reverseLightLayers);
|
|
834
804
|
return toUnoShortcut({
|
|
835
|
-
"": `${target}-scope-light-${
|
|
805
|
+
"": `${target}-scope-light-${layerN(Number(a), theme.reverseLightLayers)}`,
|
|
836
806
|
"dark:": `${target}-scope-dark-${d}`,
|
|
837
807
|
"[&.dark]:": `${target}-scope-dark-${d}`
|
|
838
808
|
});
|
|
@@ -845,74 +815,6 @@ function getPaletteShortcuts() {
|
|
|
845
815
|
{ surface: "surface-100" }
|
|
846
816
|
];
|
|
847
817
|
}
|
|
848
|
-
|
|
849
|
-
//#endregion
|
|
850
|
-
//#region src/theme/utils/round.ts
|
|
851
|
-
function round(v, decimals = 0) {
|
|
852
|
-
const d = 10 ** decimals;
|
|
853
|
-
return Math.round(v * d) / d;
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
//#endregion
|
|
857
|
-
//#region src/theme/utils/unit-by.ts
|
|
858
|
-
function unitBy(input, factor, roundTo = 3) {
|
|
859
|
-
const v = Number.parseFloat(input);
|
|
860
|
-
const units = /(px|em|rem|%)$/.exec(input)?.[1] || "";
|
|
861
|
-
return `${round(v * factor, roundTo)}${units}`;
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
//#endregion
|
|
865
|
-
//#region src/theme/preflights.ts
|
|
866
|
-
const fontsPreflights = { getCSS: ({ theme }) => `${renderFontCss("body", theme.fontSize.body) + renderFontCss("figcaption", theme.fontSize.caption) + renderFontCss("h1", theme.fontSize.h1) + renderFontCss("h2", theme.fontSize.h2) + renderFontCss("h3", theme.fontSize.h3) + renderFontCss("h4", theme.fontSize.h4) + renderFontCss("h5", theme.fontSize.h5) + renderFontCss("h6", theme.fontSize.h6)}
|
|
867
|
-
:root {
|
|
868
|
-
--un-border-opacity: 0.25;
|
|
869
|
-
--un-default-border-color: rgb(150 150 150 / var(--un-border-opacity));
|
|
870
|
-
--scope-black: 0 0 0;
|
|
871
|
-
--scope-white: 255 255 255;
|
|
872
|
-
--scope-hl: var(--scope-color-500);
|
|
873
|
-
--v-fingertip: ${theme.spacing["fingertip-m"] || "3em"};
|
|
874
|
-
--v-fingertip-half: ${unitBy(theme.spacing["fingertip-m"] || "3em", .5)};
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
::-webkit-scrollbar {
|
|
879
|
-
width: 10px;
|
|
880
|
-
height: 10px;
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
::-webkit-scrollbar-track {
|
|
884
|
-
background: rgba(0,0,0,0.05);
|
|
885
|
-
border-radius: 5px;
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
::-webkit-scrollbar-thumb {
|
|
889
|
-
background-color: rgba(0,0,0,0.2);
|
|
890
|
-
border-radius: 5px;
|
|
891
|
-
border: 2px solid transparent;
|
|
892
|
-
background-clip: padding-box;
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
::-webkit-scrollbar-thumb:hover {
|
|
896
|
-
background-color: rgba(0,0,0,0.3);
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
.dark ::-webkit-scrollbar-track {
|
|
901
|
-
background: rgba(255,255,255,0.05);
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
.dark ::-webkit-scrollbar-thumb {
|
|
905
|
-
background-color: rgba(255,255,255,0.2);
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
.dark ::-webkit-scrollbar-thumb:hover {
|
|
909
|
-
background-color: rgba(255,255,255,0.3);
|
|
910
|
-
}
|
|
911
|
-
` };
|
|
912
|
-
function renderFontCss(selector, font) {
|
|
913
|
-
return `${selector} { font-size: ${font[0]}; ${Object.entries(font[1]).map((e) => `${e[0]}: ${e[1]};`).join(" ")} }\n`;
|
|
914
|
-
}
|
|
915
|
-
|
|
916
818
|
//#endregion
|
|
917
819
|
//#region src/theme/rules/palette.ts
|
|
918
820
|
function colorToRgbWithOpacity(c) {
|
|
@@ -947,6 +849,37 @@ function getCssTarget(key) {
|
|
|
947
849
|
ring: "--un-ring-color"
|
|
948
850
|
}[key];
|
|
949
851
|
}
|
|
852
|
+
const SCOPE_SHADES = [
|
|
853
|
+
"50",
|
|
854
|
+
"100",
|
|
855
|
+
"200",
|
|
856
|
+
"300",
|
|
857
|
+
"400",
|
|
858
|
+
"500",
|
|
859
|
+
"600",
|
|
860
|
+
"700",
|
|
861
|
+
"800",
|
|
862
|
+
"900"
|
|
863
|
+
];
|
|
864
|
+
const SCOPE_LAYERS = [
|
|
865
|
+
"0",
|
|
866
|
+
"1",
|
|
867
|
+
"2",
|
|
868
|
+
"3",
|
|
869
|
+
"4"
|
|
870
|
+
];
|
|
871
|
+
function getScopeCssVars(c, theme) {
|
|
872
|
+
const col = theme.colors[c];
|
|
873
|
+
if (!col) return;
|
|
874
|
+
const vars = { "--scope-color": colorToRgbWithOpacity(col) };
|
|
875
|
+
for (const shade of SCOPE_SHADES) vars[`--scope-color-${shade}`] = colorToRgbWithOpacity(theme.colors[`${c}-${shade}`]) || "";
|
|
876
|
+
for (const layer of SCOPE_LAYERS) {
|
|
877
|
+
vars[`--scope-light-${layer}`] = colorToRgbWithOpacity(theme.colors[`${c}-light-${layer}`]) || "";
|
|
878
|
+
vars[`--scope-dark-${layer}`] = colorToRgbWithOpacity(theme.colors[`${c}-dark-${layer}`]) || "";
|
|
879
|
+
}
|
|
880
|
+
vars["--current-hl"] = colorToRgbWithOpacity(theme.colors[`${c}-500`]) || "";
|
|
881
|
+
return vars;
|
|
882
|
+
}
|
|
950
883
|
const paletteRules = [
|
|
951
884
|
[/^current-(text|bg|icon|border|outline|caret|hl)-(.+)$/, (match, { theme }) => {
|
|
952
885
|
const t = match[1];
|
|
@@ -977,34 +910,7 @@ const paletteRules = [
|
|
|
977
910
|
[cssVar]: `rgb(var(--current${source}) / ${opacityVal})`
|
|
978
911
|
};
|
|
979
912
|
}],
|
|
980
|
-
[/^scope-(.*)$/, (match, { theme }) =>
|
|
981
|
-
const c = match[1];
|
|
982
|
-
const col = theme.colors[c];
|
|
983
|
-
if (col) return {
|
|
984
|
-
"--scope-color": colorToRgbWithOpacity(col),
|
|
985
|
-
"--scope-color-50": colorToRgbWithOpacity(theme.colors[`${c}-50`]) || "",
|
|
986
|
-
"--scope-color-100": colorToRgbWithOpacity(theme.colors[`${c}-100`]) || "",
|
|
987
|
-
"--scope-color-200": colorToRgbWithOpacity(theme.colors[`${c}-200`]) || "",
|
|
988
|
-
"--scope-color-300": colorToRgbWithOpacity(theme.colors[`${c}-300`]) || "",
|
|
989
|
-
"--scope-color-400": colorToRgbWithOpacity(theme.colors[`${c}-400`]) || "",
|
|
990
|
-
"--scope-color-500": colorToRgbWithOpacity(theme.colors[`${c}-500`]) || "",
|
|
991
|
-
"--scope-color-600": colorToRgbWithOpacity(theme.colors[`${c}-600`]) || "",
|
|
992
|
-
"--scope-color-700": colorToRgbWithOpacity(theme.colors[`${c}-700`]) || "",
|
|
993
|
-
"--scope-color-800": colorToRgbWithOpacity(theme.colors[`${c}-800`]) || "",
|
|
994
|
-
"--scope-color-900": colorToRgbWithOpacity(theme.colors[`${c}-900`]) || "",
|
|
995
|
-
"--scope-light-0": colorToRgbWithOpacity(theme.colors[`${c}-light-0`]) || "",
|
|
996
|
-
"--scope-light-1": colorToRgbWithOpacity(theme.colors[`${c}-light-1`]) || "",
|
|
997
|
-
"--scope-light-2": colorToRgbWithOpacity(theme.colors[`${c}-light-2`]) || "",
|
|
998
|
-
"--scope-light-3": colorToRgbWithOpacity(theme.colors[`${c}-light-3`]) || "",
|
|
999
|
-
"--scope-light-4": colorToRgbWithOpacity(theme.colors[`${c}-light-4`]) || "",
|
|
1000
|
-
"--scope-dark-0": colorToRgbWithOpacity(theme.colors[`${c}-dark-0`]) || "",
|
|
1001
|
-
"--scope-dark-1": colorToRgbWithOpacity(theme.colors[`${c}-dark-1`]) || "",
|
|
1002
|
-
"--scope-dark-2": colorToRgbWithOpacity(theme.colors[`${c}-dark-2`]) || "",
|
|
1003
|
-
"--scope-dark-3": colorToRgbWithOpacity(theme.colors[`${c}-dark-3`]) || "",
|
|
1004
|
-
"--scope-dark-4": colorToRgbWithOpacity(theme.colors[`${c}-dark-4`]) || "",
|
|
1005
|
-
"--current-hl": colorToRgbWithOpacity(theme.colors[`${c}-500`]) || ""
|
|
1006
|
-
};
|
|
1007
|
-
}],
|
|
913
|
+
[/^scope-(.*)$/, (match, { theme }) => getScopeCssVars(match[1], theme)],
|
|
1008
914
|
[/^(bg|text|fill|stroke|border|outline|icon|caret)-scope-((?:color|dark|light|text|bg|white|black|icon)(?:-\d+)?)(\/\d{1,3})?$/, (match, { theme }) => {
|
|
1009
915
|
const cssVar = getCssTarget(match[1]);
|
|
1010
916
|
const opacityVar = getOpacityVar(match[1]);
|
|
@@ -1033,7 +939,75 @@ const paletteRules = [
|
|
|
1033
939
|
height: `var(--icon-size, 1em)`
|
|
1034
940
|
})]
|
|
1035
941
|
];
|
|
942
|
+
//#endregion
|
|
943
|
+
//#region src/theme/utils/round.ts
|
|
944
|
+
function round(v, decimals = 0) {
|
|
945
|
+
const d = 10 ** decimals;
|
|
946
|
+
return Math.round(v * d) / d;
|
|
947
|
+
}
|
|
948
|
+
//#endregion
|
|
949
|
+
//#region src/theme/utils/unit-by.ts
|
|
950
|
+
function unitBy(input, factor, roundTo = 3) {
|
|
951
|
+
const v = Number.parseFloat(input);
|
|
952
|
+
const units = /(px|em|rem|%)$/.exec(input)?.[1] || "";
|
|
953
|
+
return `${round(v * factor, roundTo)}${units}`;
|
|
954
|
+
}
|
|
955
|
+
//#endregion
|
|
956
|
+
//#region src/theme/preflights.ts
|
|
957
|
+
const fontsPreflights = { getCSS: ({ theme }) => `${renderFontCss("body", theme.fontSize.body) + renderFontCss("figcaption", theme.fontSize.caption) + renderFontCss("h1", theme.fontSize.h1) + renderFontCss("h2", theme.fontSize.h2) + renderFontCss("h3", theme.fontSize.h3) + renderFontCss("h4", theme.fontSize.h4) + renderFontCss("h5", theme.fontSize.h5) + renderFontCss("h6", theme.fontSize.h6)}
|
|
958
|
+
:root {
|
|
959
|
+
--un-border-opacity: 0.25;
|
|
960
|
+
--un-default-border-color: rgb(150 150 150 / var(--un-border-opacity));
|
|
961
|
+
--scope-black: 0 0 0;
|
|
962
|
+
--scope-white: 255 255 255;
|
|
963
|
+
--scope-hl: var(--scope-color-500);
|
|
964
|
+
--v-fingertip: ${theme.spacing["fingertip-m"] || "3em"};
|
|
965
|
+
--v-fingertip-half: ${unitBy(theme.spacing["fingertip-m"] || "3em", .5)};
|
|
966
|
+
${renderDefaultScope(theme)}}
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
::-webkit-scrollbar {
|
|
970
|
+
width: 10px;
|
|
971
|
+
height: 10px;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
::-webkit-scrollbar-track {
|
|
975
|
+
background: rgba(0,0,0,0.05);
|
|
976
|
+
border-radius: 5px;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
::-webkit-scrollbar-thumb {
|
|
980
|
+
background-color: rgba(0,0,0,0.2);
|
|
981
|
+
border-radius: 5px;
|
|
982
|
+
border: 2px solid transparent;
|
|
983
|
+
background-clip: padding-box;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
::-webkit-scrollbar-thumb:hover {
|
|
987
|
+
background-color: rgba(0,0,0,0.3);
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
.dark ::-webkit-scrollbar-track {
|
|
992
|
+
background: rgba(255,255,255,0.05);
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
.dark ::-webkit-scrollbar-thumb {
|
|
996
|
+
background-color: rgba(255,255,255,0.2);
|
|
997
|
+
}
|
|
1036
998
|
|
|
999
|
+
.dark ::-webkit-scrollbar-thumb:hover {
|
|
1000
|
+
background-color: rgba(255,255,255,0.3);
|
|
1001
|
+
}
|
|
1002
|
+
` };
|
|
1003
|
+
function renderDefaultScope(theme) {
|
|
1004
|
+
const vars = getScopeCssVars("neutral", theme);
|
|
1005
|
+
if (!vars) return "";
|
|
1006
|
+
return `${Object.entries(vars).map(([k, v]) => ` ${k}: ${v};`).join("\n")}\n`;
|
|
1007
|
+
}
|
|
1008
|
+
function renderFontCss(selector, font) {
|
|
1009
|
+
return `${selector} { font-size: ${font[0]}; ${Object.entries(font[1]).map((e) => `${e[0]}: ${e[1]};`).join(" ")} }\n`;
|
|
1010
|
+
}
|
|
1037
1011
|
//#endregion
|
|
1038
1012
|
//#region src/theme/rules/i8-rules.ts
|
|
1039
1013
|
const i8Rules = [
|
|
@@ -1082,99 +1056,92 @@ const i8Rules = [
|
|
|
1082
1056
|
};
|
|
1083
1057
|
}]
|
|
1084
1058
|
];
|
|
1085
|
-
|
|
1086
|
-
//#endregion
|
|
1087
|
-
//#region src/theme/rules/spacing.ts
|
|
1088
|
-
const spacingRules = [
|
|
1089
|
-
[
|
|
1090
|
-
/^text-m([bty])?-(.*)$/,
|
|
1091
|
-
(match, { theme }) => {
|
|
1092
|
-
const dir = match[1];
|
|
1093
|
-
const size = match[2];
|
|
1094
|
-
const d = dir ? {
|
|
1095
|
-
y: ["top", "bottom"],
|
|
1096
|
-
t: ["top"],
|
|
1097
|
-
b: ["bottom"]
|
|
1098
|
-
}[dir] : [
|
|
1099
|
-
"top",
|
|
1100
|
-
"bottom",
|
|
1101
|
-
"left",
|
|
1102
|
-
"right"
|
|
1103
|
-
];
|
|
1104
|
-
const result = {};
|
|
1105
|
-
if (theme.spacing[size]) {
|
|
1106
|
-
for (const prop of d) result[`margin-${prop}`] = ["left", "right"].includes(prop) ? theme.spacing[size] : `calc(${theme.spacing[size]} + var(--font-${prop === "top" ? "tc" : "bc"}))`;
|
|
1107
|
-
return result;
|
|
1108
|
-
} else if (/^\d+(em|rem|px)?$/.test(size)) {
|
|
1109
|
-
let s = size;
|
|
1110
|
-
if (/^[\d.]+$/.test(size)) s = `${Number(size) * .25}rem`;
|
|
1111
|
-
for (const prop of d) result[`margin-${prop}`] = ["left", "right"].includes(prop) ? s : `calc(${s} + var(--font-${prop === "top" ? "tc" : "bc"}))`;
|
|
1112
|
-
return result;
|
|
1113
|
-
}
|
|
1114
|
-
},
|
|
1115
|
-
{ layer: "utilities" }
|
|
1116
|
-
],
|
|
1117
|
-
[
|
|
1118
|
-
/^card-dense$/,
|
|
1119
|
-
(_match, { theme: _theme }) => ({ "--card-spacing": "var(--card-spacing-dense)" }),
|
|
1120
|
-
{ layer: "utilities" }
|
|
1121
|
-
],
|
|
1122
|
-
[/^card-(.*)$/, (match, { theme }) => {
|
|
1123
|
-
const name = match[1];
|
|
1124
|
-
if (theme.fontSize[name]) {
|
|
1125
|
-
const props = theme.fontSize[name][1];
|
|
1126
|
-
return {
|
|
1127
|
-
"--card-spacing": `${unitBy(props["--font-corrected"], theme.cardSpacingFactor.regular)}`,
|
|
1128
|
-
"--card-spacing-dense": `${unitBy(props["--font-corrected"], theme.cardSpacingFactor.dense)}`,
|
|
1129
|
-
"--card-heading-size": props["--font-size"],
|
|
1130
|
-
"--card-heading-bold": props["--font-bold"],
|
|
1131
|
-
"--card-heading-corrected": props["--font-corrected"],
|
|
1132
|
-
"--card-heading-weight": props["font-weight"],
|
|
1133
|
-
"--card-heading-lh": props["line-height"],
|
|
1134
|
-
"--card-heading-ls": props["letter-spacing"],
|
|
1135
|
-
"--card-heading-bc": props["--font-bc"],
|
|
1136
|
-
"--card-heading-tc": props["--font-tc"],
|
|
1137
|
-
"padding": "var(--card-spacing)"
|
|
1138
|
-
};
|
|
1139
|
-
}
|
|
1140
|
-
}],
|
|
1141
|
-
[/^fingertip-(.*)/, (match, { theme }) => {
|
|
1142
|
-
const name = match[1];
|
|
1143
|
-
if (name.startsWith("[") && name.endsWith("]")) return {
|
|
1144
|
-
"--v-fingertip": name.slice(1, -1),
|
|
1145
|
-
"--v-fingertip-half": unitBy(name.slice(1, -1), .5)
|
|
1146
|
-
};
|
|
1147
|
-
if ([
|
|
1148
|
-
"xs",
|
|
1149
|
-
"s",
|
|
1150
|
-
"m",
|
|
1151
|
-
"l",
|
|
1152
|
-
"xl"
|
|
1153
|
-
].includes(name)) return {
|
|
1154
|
-
"--v-fingertip": theme.spacing[`fingertip-${name}`],
|
|
1155
|
-
"--v-fingertip-half": unitBy(theme.spacing[`fingertip-${name}`], .5)
|
|
1156
|
-
};
|
|
1157
|
-
if (theme.spacing[name]) return {
|
|
1158
|
-
"--v-fingertip": theme.spacing[name],
|
|
1159
|
-
"--v-fingertip-half": unitBy(theme.spacing[name], .5)
|
|
1160
|
-
};
|
|
1161
|
-
}]
|
|
1162
|
-
];
|
|
1163
|
-
|
|
1164
1059
|
//#endregion
|
|
1165
1060
|
//#region src/theme/rules/index.ts
|
|
1166
1061
|
const rules = [
|
|
1167
|
-
...
|
|
1062
|
+
...[
|
|
1063
|
+
[
|
|
1064
|
+
/^text-m([bty])?-(.*)$/,
|
|
1065
|
+
(match, { theme }) => {
|
|
1066
|
+
const dir = match[1];
|
|
1067
|
+
const size = match[2];
|
|
1068
|
+
const d = dir ? {
|
|
1069
|
+
y: ["top", "bottom"],
|
|
1070
|
+
t: ["top"],
|
|
1071
|
+
b: ["bottom"]
|
|
1072
|
+
}[dir] : [
|
|
1073
|
+
"top",
|
|
1074
|
+
"bottom",
|
|
1075
|
+
"left",
|
|
1076
|
+
"right"
|
|
1077
|
+
];
|
|
1078
|
+
const result = {};
|
|
1079
|
+
if (theme.spacing[size]) {
|
|
1080
|
+
for (const prop of d) result[`margin-${prop}`] = ["left", "right"].includes(prop) ? theme.spacing[size] : `calc(${theme.spacing[size]} + var(--font-${prop === "top" ? "tc" : "bc"}))`;
|
|
1081
|
+
return result;
|
|
1082
|
+
} else if (/^\d+(em|rem|px)?$/.test(size)) {
|
|
1083
|
+
let s = size;
|
|
1084
|
+
if (/^[\d.]+$/.test(size)) s = `${Number(size) * .25}rem`;
|
|
1085
|
+
for (const prop of d) result[`margin-${prop}`] = ["left", "right"].includes(prop) ? s : `calc(${s} + var(--font-${prop === "top" ? "tc" : "bc"}))`;
|
|
1086
|
+
return result;
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
{ layer: "utilities" }
|
|
1090
|
+
],
|
|
1091
|
+
[
|
|
1092
|
+
/^card-dense$/,
|
|
1093
|
+
(_match, { theme: _theme }) => ({ "--card-spacing": "var(--card-spacing-dense)" }),
|
|
1094
|
+
{ layer: "utilities" }
|
|
1095
|
+
],
|
|
1096
|
+
[/^card-(.*)$/, (match, { theme }) => {
|
|
1097
|
+
const name = match[1];
|
|
1098
|
+
if (theme.fontSize[name]) {
|
|
1099
|
+
const props = theme.fontSize[name][1];
|
|
1100
|
+
return {
|
|
1101
|
+
"--card-spacing": `${unitBy(props["--font-corrected"], theme.cardSpacingFactor.regular)}`,
|
|
1102
|
+
"--card-spacing-dense": `${unitBy(props["--font-corrected"], theme.cardSpacingFactor.dense)}`,
|
|
1103
|
+
"--card-heading-size": props["--font-size"],
|
|
1104
|
+
"--card-heading-bold": props["--font-bold"],
|
|
1105
|
+
"--card-heading-corrected": props["--font-corrected"],
|
|
1106
|
+
"--card-heading-weight": props["font-weight"],
|
|
1107
|
+
"--card-heading-lh": props["line-height"],
|
|
1108
|
+
"--card-heading-ls": props["letter-spacing"],
|
|
1109
|
+
"--card-heading-bc": props["--font-bc"],
|
|
1110
|
+
"--card-heading-tc": props["--font-tc"],
|
|
1111
|
+
"padding": "var(--card-spacing)"
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
}],
|
|
1115
|
+
[/^fingertip-(.*)/, (match, { theme }) => {
|
|
1116
|
+
const name = match[1];
|
|
1117
|
+
if (name.startsWith("[") && name.endsWith("]")) return {
|
|
1118
|
+
"--v-fingertip": name.slice(1, -1),
|
|
1119
|
+
"--v-fingertip-half": unitBy(name.slice(1, -1), .5)
|
|
1120
|
+
};
|
|
1121
|
+
if ([
|
|
1122
|
+
"xs",
|
|
1123
|
+
"s",
|
|
1124
|
+
"m",
|
|
1125
|
+
"l",
|
|
1126
|
+
"xl"
|
|
1127
|
+
].includes(name)) return {
|
|
1128
|
+
"--v-fingertip": theme.spacing[`fingertip-${name}`],
|
|
1129
|
+
"--v-fingertip-half": unitBy(theme.spacing[`fingertip-${name}`], .5)
|
|
1130
|
+
};
|
|
1131
|
+
if (theme.spacing[name]) return {
|
|
1132
|
+
"--v-fingertip": theme.spacing[name],
|
|
1133
|
+
"--v-fingertip-half": unitBy(theme.spacing[name], .5)
|
|
1134
|
+
};
|
|
1135
|
+
}]
|
|
1136
|
+
],
|
|
1168
1137
|
...paletteRules,
|
|
1169
1138
|
...i8Rules
|
|
1170
1139
|
];
|
|
1171
|
-
|
|
1172
1140
|
//#endregion
|
|
1173
1141
|
//#region src/theme/types.ts
|
|
1174
1142
|
function k$1(n, base = 1) {
|
|
1175
1143
|
return base * 1.618 ** n;
|
|
1176
1144
|
}
|
|
1177
|
-
|
|
1178
1145
|
//#endregion
|
|
1179
1146
|
//#region src/theme/typography.ts
|
|
1180
1147
|
function font(weight, boldWeight, size, height, spacing) {
|
|
@@ -1227,7 +1194,6 @@ function buildFontTheme(size, w, wBold, lh, ls, actualFontHeightFactor = 1, actu
|
|
|
1227
1194
|
}]
|
|
1228
1195
|
};
|
|
1229
1196
|
}
|
|
1230
|
-
|
|
1231
1197
|
//#endregion
|
|
1232
1198
|
//#region src/theme/theme.ts
|
|
1233
1199
|
const themeFactory = (opts) => {
|
|
@@ -1319,7 +1285,6 @@ const themeFactory = (opts) => {
|
|
|
1319
1285
|
}
|
|
1320
1286
|
};
|
|
1321
1287
|
};
|
|
1322
|
-
|
|
1323
1288
|
//#endregion
|
|
1324
1289
|
//#region src/theme/generated/component-classes.ts
|
|
1325
1290
|
const componentClasses = {
|
|
@@ -1702,19 +1667,25 @@ const componentClasses = {
|
|
|
1702
1667
|
],
|
|
1703
1668
|
DelayedSwitch: ["visible"],
|
|
1704
1669
|
DevTools: [
|
|
1670
|
+
"[&>.checkbox]:hover:bg-neutral-100",
|
|
1705
1671
|
"absolute",
|
|
1706
1672
|
"b",
|
|
1707
1673
|
"bg-transparent",
|
|
1708
|
-
"blur",
|
|
1709
1674
|
"border",
|
|
1675
|
+
"border-0",
|
|
1710
1676
|
"border-b",
|
|
1677
|
+
"border-grey-500/30",
|
|
1711
1678
|
"border-grey-500/50",
|
|
1712
|
-
"bottom-0",
|
|
1713
1679
|
"btn",
|
|
1714
1680
|
"btn-icon",
|
|
1715
1681
|
"btn-label",
|
|
1716
1682
|
"c8-flat",
|
|
1717
1683
|
"card",
|
|
1684
|
+
"checkbox",
|
|
1685
|
+
"checkbox-icon",
|
|
1686
|
+
"checkbox-indicator",
|
|
1687
|
+
"checkbox-label",
|
|
1688
|
+
"checkbox-root",
|
|
1718
1689
|
"current-outline-primary-700",
|
|
1719
1690
|
"cursor-grab",
|
|
1720
1691
|
"cursor-grabbing",
|
|
@@ -1725,12 +1696,15 @@ const componentClasses = {
|
|
|
1725
1696
|
"flex",
|
|
1726
1697
|
"flex-col",
|
|
1727
1698
|
"flex-grow",
|
|
1699
|
+
"flex-row-reverse",
|
|
1728
1700
|
"fw-$bold",
|
|
1729
1701
|
"gap-$xs",
|
|
1730
1702
|
"grid",
|
|
1703
|
+
"grid-cols-1",
|
|
1704
|
+
"grid-cols-2",
|
|
1731
1705
|
"grow",
|
|
1732
1706
|
"h-[3em]",
|
|
1733
|
-
"h-[
|
|
1707
|
+
"h-[44em]",
|
|
1734
1708
|
"h1",
|
|
1735
1709
|
"h2",
|
|
1736
1710
|
"h3",
|
|
@@ -1738,29 +1712,10 @@ const componentClasses = {
|
|
|
1738
1712
|
"h5",
|
|
1739
1713
|
"h6",
|
|
1740
1714
|
"hover:opacity-100",
|
|
1741
|
-
"i8",
|
|
1742
|
-
"i8-after",
|
|
1743
|
-
"i8-append",
|
|
1744
|
-
"i8-before",
|
|
1745
|
-
"i8-counter",
|
|
1746
|
-
"i8-hint",
|
|
1747
|
-
"i8-hint-wrapper",
|
|
1748
|
-
"i8-hint-wrapper-stack",
|
|
1749
|
-
"i8-icon-clickable",
|
|
1750
|
-
"i8-icon-wrap",
|
|
1751
|
-
"i8-input",
|
|
1752
|
-
"i8-input-wrapper",
|
|
1753
|
-
"i8-label",
|
|
1754
|
-
"i8-label-wrapper",
|
|
1755
|
-
"i8-loading",
|
|
1756
|
-
"i8-prepend",
|
|
1757
|
-
"i8-stack-label",
|
|
1758
|
-
"i8-ta-wrapper",
|
|
1759
|
-
"i8-textarea",
|
|
1760
|
-
"i8-underline",
|
|
1761
1715
|
"icon-color",
|
|
1762
1716
|
"icon-size",
|
|
1763
1717
|
"items-center",
|
|
1718
|
+
"items-start",
|
|
1764
1719
|
"justify-between",
|
|
1765
1720
|
"justify-center",
|
|
1766
1721
|
"layer-0",
|
|
@@ -1771,7 +1726,7 @@ const componentClasses = {
|
|
|
1771
1726
|
"max-h-screen",
|
|
1772
1727
|
"max-w-100%",
|
|
1773
1728
|
"max-w-screen",
|
|
1774
|
-
"mb-$
|
|
1729
|
+
"mb-$xs",
|
|
1775
1730
|
"opacity-0",
|
|
1776
1731
|
"opacity-50",
|
|
1777
1732
|
"outline-[2px]",
|
|
@@ -1782,18 +1737,17 @@ const componentClasses = {
|
|
|
1782
1737
|
"overflow-hidden",
|
|
1783
1738
|
"p-$card-spacing",
|
|
1784
1739
|
"p-0",
|
|
1740
|
+
"pb-$xs",
|
|
1741
|
+
"pl-$m",
|
|
1785
1742
|
"pointer-events-none",
|
|
1786
1743
|
"pt-$l",
|
|
1787
|
-
"px",
|
|
1744
|
+
"px-$xs",
|
|
1745
|
+
"py-1",
|
|
1788
1746
|
"relative",
|
|
1789
|
-
"resize",
|
|
1790
|
-
"right-0",
|
|
1791
1747
|
"rounded",
|
|
1792
1748
|
"rounded-full",
|
|
1793
1749
|
"scale-100",
|
|
1794
1750
|
"scale-20",
|
|
1795
|
-
"scope-error",
|
|
1796
|
-
"segmented",
|
|
1797
1751
|
"select-none",
|
|
1798
1752
|
"shadow-[0_0_5px_2px_rgb(var(--scope-color-500))]",
|
|
1799
1753
|
"shadow-md",
|
|
@@ -1809,23 +1763,25 @@ const componentClasses = {
|
|
|
1809
1763
|
"text-11px",
|
|
1810
1764
|
"text-16px",
|
|
1811
1765
|
"text-body",
|
|
1766
|
+
"text-caption",
|
|
1812
1767
|
"text-card-header",
|
|
1813
1768
|
"text-ellipsis",
|
|
1814
1769
|
"text-error-500",
|
|
1815
1770
|
"text-grey-400",
|
|
1816
1771
|
"text-label",
|
|
1817
1772
|
"text-mb-0",
|
|
1773
|
+
"text-mt-$s",
|
|
1818
1774
|
"text-mt-0",
|
|
1819
|
-
"text-
|
|
1775
|
+
"text-right",
|
|
1820
1776
|
"top-0",
|
|
1821
1777
|
"transform",
|
|
1822
1778
|
"transform-origin-tl",
|
|
1823
1779
|
"transition-all-200",
|
|
1824
1780
|
"transition-opacity-200",
|
|
1825
|
-
"
|
|
1826
|
-
"w-
|
|
1781
|
+
"truncate",
|
|
1782
|
+
"w-6em",
|
|
1783
|
+
"w-[34em]",
|
|
1827
1784
|
"w-[3em]",
|
|
1828
|
-
"w-full",
|
|
1829
1785
|
"whitespace-nowrap"
|
|
1830
1786
|
],
|
|
1831
1787
|
Dialog: [
|
|
@@ -2188,7 +2144,6 @@ function getComponentClasses(...components) {
|
|
|
2188
2144
|
}
|
|
2189
2145
|
return [...set];
|
|
2190
2146
|
}
|
|
2191
|
-
|
|
2192
2147
|
//#endregion
|
|
2193
2148
|
//#region src/theme/preset-vunor.ts
|
|
2194
2149
|
function createVunorExtractor() {
|
|
@@ -2324,7 +2279,6 @@ function getFixedWind() {
|
|
|
2324
2279
|
});
|
|
2325
2280
|
return wind;
|
|
2326
2281
|
}
|
|
2327
|
-
|
|
2328
2282
|
//#endregion
|
|
2329
2283
|
//#region src/theme.ts
|
|
2330
2284
|
/**
|
|
@@ -2351,6 +2305,5 @@ function vunorShortcuts(customShortcuts, baseShortcuts = mergedVunorShortcuts) {
|
|
|
2351
2305
|
for (const [key, val] of Object.entries(merged)) merged[key] = typeof val === "string" ? val : toUnoShortcut(val);
|
|
2352
2306
|
return merged;
|
|
2353
2307
|
}
|
|
2354
|
-
|
|
2355
2308
|
//#endregion
|
|
2356
|
-
export { componentClasses, defineShortcuts, getComponentClasses, mergeVunorShortcuts, mergedVunorShortcuts, presetVunor, rawVunorShortcuts, toUnoShortcut, vunorShortcuts };
|
|
2309
|
+
export { componentClasses, defineShortcuts, getComponentClasses, mergeVunorShortcuts, mergedVunorShortcuts, presetVunor, rawVunorShortcuts, toUnoShortcut, vunorShortcuts };
|