vunor 0.4.0 → 0.4.2
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 +48 -2
- package/dist/Select.mjs +2 -0
- package/dist/theme.d.mts +28 -1
- package/dist/theme.mjs +68 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -177,6 +177,30 @@ h-fingertip flex items-center hover:bg-current/05 dark:text-white [&.btn-round]:
|
|
|
177
177
|
|
|
178
178
|
Wherever you use `class="btn"`, UnoCSS applies all those classes. The nesting is purely for readability and mergeability.
|
|
179
179
|
|
|
180
|
+
### Breakpoints and Hover
|
|
181
|
+
|
|
182
|
+
Breakpoints are variant prefixes like any other, so a breakpoint key works at any depth:
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
defineShortcuts({
|
|
186
|
+
'my-panel': {
|
|
187
|
+
'': 'flex flex-col gap-$s',
|
|
188
|
+
'md:': { '': 'flex-row gap-$m', 'dark:': 'bg-black' }, // → "md:flex-row md:gap-$m md:dark:bg-black"
|
|
189
|
+
},
|
|
190
|
+
})
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Vunor's own shortcuts paint hover only on devices whose primary input can hover. Use the same prefixes in yours:
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
import { defineShortcuts, whenHover, whenHoverIdle } from 'vunor/theme'
|
|
197
|
+
|
|
198
|
+
defineShortcuts({
|
|
199
|
+
'my-row': { '': 'p-$s', [whenHover]: 'bg-current/05' }, // @media (hover: hover) { .my-row:hover }
|
|
200
|
+
'my-tile': { [whenHoverIdle]: 'bg-current/10', 'active:': 'bg-current/20' }, // hover stands aside while pressed
|
|
201
|
+
})
|
|
202
|
+
```
|
|
203
|
+
|
|
180
204
|
### Compound Variants
|
|
181
205
|
|
|
182
206
|
Nesting can go deeper for compound variants:
|
|
@@ -275,18 +299,34 @@ Button and clickable element design variants:
|
|
|
275
299
|
|
|
276
300
|
| Class | Description |
|
|
277
301
|
| ------------- | --------------------------------------- |
|
|
278
|
-
| `c8-filled` | Solid background, white text
|
|
302
|
+
| `c8-filled` | Solid background, white text (WCAG AA) |
|
|
279
303
|
| `c8-flat` | Transparent background, colored text |
|
|
280
304
|
| `c8-outlined` | Border + colored text, transparent fill |
|
|
281
305
|
| `c8-light` | Light tinted background, colored text |
|
|
282
306
|
|
|
283
|
-
Each includes hover, active, and focus states. Hover and press do not paint on a disabled element: `disabled`, `aria-disabled="true"` or `data-disabled` (the same definition the `disabled-soft` shortcut uses to fade a disabled element). Keyboard focus still paints, so an `aria-disabled` control stays visibly focusable. Apply on any element alongside `scope-{color}`:
|
|
307
|
+
Each includes hover, active, and focus states. Hover paints only on devices whose primary input can hover (`@media (hover: hover)`), so a tap on a touch screen does not leave it stuck on; press (`:active`) paints everywhere. Hover and press do not paint on a disabled element: `disabled`, `aria-disabled="true"` or `data-disabled` (the same definition the `disabled-soft` shortcut uses to fade a disabled element). Keyboard focus still paints, so an `aria-disabled` control stays visibly focusable. Apply on any element alongside `scope-{color}`:
|
|
284
308
|
|
|
285
309
|
```html
|
|
286
310
|
<button class="scope-primary c8-filled">Save</button>
|
|
287
311
|
<button class="scope-error c8-flat">Cancel</button>
|
|
288
312
|
```
|
|
289
313
|
|
|
314
|
+
`c8-filled` rests on shade 600 and goes to 700 on hover and 800 on press, in light and dark mode. With the default palette white text reaches WCAG AA (4.5:1) on all three fills for every palette colour. In dark mode a 1px inset rim in shade 500 keeps the button's edge at 3:1 or more against every dark layer. If you tune the palette, check your colours' 600 shades: with `mainPalette.preserveInputColor: true` and `good: '#22c55e'`, for example, `good-600` gives white text only 4.18:1.
|
|
315
|
+
|
|
316
|
+
To change a c8 hover colour, override the same key vunor uses, so your class merges into vunor's rule and wins:
|
|
317
|
+
|
|
318
|
+
```ts
|
|
319
|
+
import { defineShortcuts, vunorShortcuts, whenEnabled, whenHoverIdle } from 'vunor/theme'
|
|
320
|
+
|
|
321
|
+
vunorShortcuts(
|
|
322
|
+
defineShortcuts({
|
|
323
|
+
'c8-filled': { [whenEnabled]: { [whenHoverIdle]: 'current-bg-scope-color-900' } },
|
|
324
|
+
})
|
|
325
|
+
)
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
For press feedback on any clickable, add `press`: it shrinks an enabled element slightly while it is `:active` (`[--press-scale:0.9]` changes the amount; add `transition-[scale]` to ease it). It ignores `data-active`, which Reka UI and vunor use for "current" (selected tab, pressed toggle, open popover trigger).
|
|
329
|
+
|
|
290
330
|
The `btn` layout primitive fades a disabled element to opacity 0.8. That is a default: `disabled-soft` (0.4) or a `disabled:opacity-*` utility replaces it, whether written on the element or composed with `btn` in your own shortcut (`'my-btn': 'btn disabled-soft'`).
|
|
291
331
|
|
|
292
332
|
### Inputable Styles (`i8`)
|
|
@@ -366,6 +406,12 @@ export default defineConfig({
|
|
|
366
406
|
reverseDark: false,
|
|
367
407
|
reverseLight: false,
|
|
368
408
|
},
|
|
409
|
+
|
|
410
|
+
// -- Page-level element styles --
|
|
411
|
+
// body / figcaption / h1–h6 typography (including a level's `font` and
|
|
412
|
+
// `css` above) and scrollbars. Set false to use only the classes and
|
|
413
|
+
// theme: variables stay, element rules go.
|
|
414
|
+
baseStyles: true,
|
|
369
415
|
}),
|
|
370
416
|
],
|
|
371
417
|
shortcuts: [vunorShortcuts()],
|
package/dist/Select.mjs
CHANGED
|
@@ -103,6 +103,7 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
103
103
|
}
|
|
104
104
|
return (_ctx, _cache) => {
|
|
105
105
|
return openBlock(), createBlock(VuSelectBase, mergeProps(unref(rootProps), {
|
|
106
|
+
multiple: __props.multiple,
|
|
106
107
|
modelValue: modelValue.value,
|
|
107
108
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
|
|
108
109
|
open: open.value,
|
|
@@ -183,6 +184,7 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
183
184
|
]))]),
|
|
184
185
|
_: 1
|
|
185
186
|
}, 16, [
|
|
187
|
+
"multiple",
|
|
186
188
|
"modelValue",
|
|
187
189
|
"open",
|
|
188
190
|
"disabled-values",
|
package/dist/theme.d.mts
CHANGED
|
@@ -29,6 +29,14 @@ interface TVunorUnoPresetOpts {
|
|
|
29
29
|
xl?: string;
|
|
30
30
|
};
|
|
31
31
|
baseRadius?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Page-level element styles: the body, figcaption and h1–h6 typography rules
|
|
34
|
+
* (size, weight, line-height, letter-spacing, plus a level's `font` and `css`
|
|
35
|
+
* from `typography`) and scrollbar styling. Default `true`. Set `false` when
|
|
36
|
+
* the app styles its own page; theme variables, shortcuts and classes are
|
|
37
|
+
* unaffected.
|
|
38
|
+
*/
|
|
39
|
+
baseStyles?: boolean;
|
|
32
40
|
animation?: {
|
|
33
41
|
durations?: Record<string, string>;
|
|
34
42
|
animation?: Record<string, string>;
|
|
@@ -333,6 +341,25 @@ declare const presetVunor: PresetFactory<TVunorTheme, TVunorUnoPresetOpts & {
|
|
|
333
341
|
palette?: TVunorPaletteOptions;
|
|
334
342
|
}>;
|
|
335
343
|
//#endregion
|
|
344
|
+
//#region src/theme/utils/disabled.d.ts
|
|
345
|
+
/** Variant prefix that matches while the element is disabled. */
|
|
346
|
+
declare const whenDisabled = "[&:is(:disabled,[disabled],[aria-disabled=true],[data-disabled])]:";
|
|
347
|
+
/** Variant prefix that matches only while the element is not disabled. */
|
|
348
|
+
declare const whenEnabled = "[&:not(:disabled,[disabled],[aria-disabled=true],[data-disabled])]:";
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/theme/utils/hover.d.ts
|
|
351
|
+
/** Variant prefix for any rule that should only apply on hover-capable devices. */
|
|
352
|
+
declare const whenCanHover = "[@media(hover:hover)]:";
|
|
353
|
+
/** Variant prefix: `hover:` gated behind `@media (hover: hover)`. */
|
|
354
|
+
declare const whenHover = "[@media(hover:hover)]:hover:";
|
|
355
|
+
/**
|
|
356
|
+
* Variant prefix: `hover:` gated behind `@media (hover: hover)` that also stands
|
|
357
|
+
* aside while the element is `:active`. Use it next to an `active:` paint: the
|
|
358
|
+
* gated block is emitted after the plain rules, so a plain gated `hover:` would
|
|
359
|
+
* beat the press paint on a mouse.
|
|
360
|
+
*/
|
|
361
|
+
declare const whenHoverIdle = "[@media(hover:hover)]:[&:hover:not(:active)]:";
|
|
362
|
+
//#endregion
|
|
336
363
|
//#region src/theme/shortcuts/raw.d.ts
|
|
337
364
|
declare const rawVunorShortcuts: TVunorShortcut[];
|
|
338
365
|
//#endregion
|
|
@@ -370,4 +397,4 @@ declare const mergedVunorShortcuts: TVunorShortcut;
|
|
|
370
397
|
*/
|
|
371
398
|
declare function vunorShortcuts(customShortcuts?: TVunorShortcut, baseShortcuts?: TVunorShortcut): Record<string, string>;
|
|
372
399
|
//#endregion
|
|
373
|
-
export { type TVunorLayerPaletteAdvanced, type TVunorMainPaletteAdvanced, type TVunorPaletteColor, type TVunorPaletteOptions, type TVunorShortcut, type TVunorSurfaceConfig, type TVunorTheme, componentClasses, defineShortcuts, getComponentClasses, mergeVunorShortcuts, mergedVunorShortcuts, presetVunor, rawVunorShortcuts, toUnoShortcut, vunorShortcuts };
|
|
400
|
+
export { type TVunorLayerPaletteAdvanced, type TVunorMainPaletteAdvanced, type TVunorPaletteColor, type TVunorPaletteOptions, type TVunorShortcut, type TVunorSurfaceConfig, type TVunorTheme, componentClasses, defineShortcuts, getComponentClasses, mergeVunorShortcuts, mergedVunorShortcuts, presetVunor, rawVunorShortcuts, toUnoShortcut, vunorShortcuts, whenCanHover, whenDisabled, whenEnabled, whenHover, whenHoverIdle };
|
package/dist/theme.mjs
CHANGED
|
@@ -41,6 +41,19 @@ const whenDisabledDefault = `[&:where(${disabledSelectors})]:`;
|
|
|
41
41
|
/** Variant prefix that matches only while the element is not disabled. */
|
|
42
42
|
const whenEnabled = `[&:not(${disabledSelectors})]:`;
|
|
43
43
|
//#endregion
|
|
44
|
+
//#region src/theme/utils/hover.ts
|
|
45
|
+
/** Variant prefix for any rule that should only apply on hover-capable devices. */
|
|
46
|
+
const whenCanHover = "[@media(hover:hover)]:";
|
|
47
|
+
/** Variant prefix: `hover:` gated behind `@media (hover: hover)`. */
|
|
48
|
+
const whenHover = `${whenCanHover}hover:`;
|
|
49
|
+
/**
|
|
50
|
+
* Variant prefix: `hover:` gated behind `@media (hover: hover)` that also stands
|
|
51
|
+
* aside while the element is `:active`. Use it next to an `active:` paint: the
|
|
52
|
+
* gated block is emitted after the plain rules, so a plain gated `hover:` would
|
|
53
|
+
* beat the press paint on a mouse.
|
|
54
|
+
*/
|
|
55
|
+
const whenHoverIdle = `${whenCanHover}[&:hover:not(:active)]:`;
|
|
56
|
+
//#endregion
|
|
44
57
|
//#region src/components/Calendar/shortcuts.ts
|
|
45
58
|
const calendarShortcuts = defineShortcuts({
|
|
46
59
|
"calendar-root": "inline-block",
|
|
@@ -54,7 +67,7 @@ const calendarShortcuts = defineShortcuts({
|
|
|
54
67
|
"before:": "absolute bottom-[0.6em] w-[1.5em] h-[2px] bg-scope-color-500/75 block",
|
|
55
68
|
"[&[data-today]::before]:": "content-['']",
|
|
56
69
|
"[&[data-today][data-selected]::before]:": "bg-white",
|
|
57
|
-
[`${whenEnabled}
|
|
70
|
+
[`${whenEnabled}${whenHoverIdle}`]: {
|
|
58
71
|
"": "bg-scope-color-200",
|
|
59
72
|
"dark:": "bg-scope-color-700"
|
|
60
73
|
},
|
|
@@ -110,7 +123,8 @@ const comboboxShortcuts = defineShortcuts({
|
|
|
110
123
|
"combobox-multi-items": "text-ellipsis overflow-hidden whitespace-nowrap absolute max-w-full pr-$m lh-1em",
|
|
111
124
|
"combobox-embedded-input": "text-left outline-0 outline-offset-0",
|
|
112
125
|
"combobox-c8-icon": {
|
|
113
|
-
"": "
|
|
126
|
+
"": "cursor-pointer",
|
|
127
|
+
[whenHover]: "current-icon-scope-color-500 icon-current",
|
|
114
128
|
"group-[[aria-expanded=true]]/i8:": "-scale-100"
|
|
115
129
|
}
|
|
116
130
|
});
|
|
@@ -127,7 +141,10 @@ const dialogShortcuts = defineShortcuts({
|
|
|
127
141
|
},
|
|
128
142
|
"dialog-header": "flex-shrink-0 border-b pb-$m px-$card-spacing pt-$card-spacing",
|
|
129
143
|
"dialog-title": "text-mb-0",
|
|
130
|
-
"dialog-close":
|
|
144
|
+
"dialog-close": {
|
|
145
|
+
"": "absolute right-$card-spacing top-$card-spacing rounded p-$xxs",
|
|
146
|
+
[whenHover]: "bg-grey-500/10"
|
|
147
|
+
},
|
|
131
148
|
"dialog-footer": "flex-shrink-0 flex gap-$s justify-end border-t px-$card-spacing py-$m"
|
|
132
149
|
});
|
|
133
150
|
//#endregion
|
|
@@ -223,7 +240,7 @@ const shortcuts = [
|
|
|
223
240
|
"dark:": "border-scope-dark-0",
|
|
224
241
|
[whenEnabled]: {
|
|
225
242
|
"": "cursor-grab",
|
|
226
|
-
|
|
243
|
+
[whenHover]: "shadow-md",
|
|
227
244
|
"active:": "cursor-grabbing",
|
|
228
245
|
"focus:": "outline-[0.5em]"
|
|
229
246
|
}
|
|
@@ -266,29 +283,24 @@ const btn = defineShortcuts({
|
|
|
266
283
|
//#region src/theme/shortcuts/c8.ts
|
|
267
284
|
const c8 = defineShortcuts({
|
|
268
285
|
"c8-filled": {
|
|
269
|
-
"": "current-bg-scope-color-
|
|
286
|
+
"": "current-bg-scope-color-600 rounded-r1 current-text-white current-icon-white icon-current/100 bg-current text-current",
|
|
287
|
+
"dark:": "ring-1 ring-inset [--un-ring-color:rgb(var(--scope-color-500))]",
|
|
270
288
|
"focus-visible:": "c8-filled-hover",
|
|
271
289
|
[whenEnabled]: {
|
|
272
|
-
|
|
290
|
+
[whenHoverIdle]: "c8-filled-hover",
|
|
273
291
|
"data-[highlighted]:": "c8-filled-hover",
|
|
274
292
|
"active:": "c8-filled-active",
|
|
275
293
|
"data-[active]:": "c8-filled-active"
|
|
276
294
|
}
|
|
277
295
|
},
|
|
278
|
-
"c8-filled-hover":
|
|
279
|
-
|
|
280
|
-
"dark:": "current-bg-scope-color-400"
|
|
281
|
-
},
|
|
282
|
-
"c8-filled-active": {
|
|
283
|
-
"": "current-bg-scope-color-700",
|
|
284
|
-
"dark:": "current-bg-scope-color-300"
|
|
285
|
-
},
|
|
296
|
+
"c8-filled-hover": "current-bg-scope-color-700",
|
|
297
|
+
"c8-filled-active": "current-bg-scope-color-800",
|
|
286
298
|
"c8-flat": {
|
|
287
299
|
"": "current-bg-scope-color-500 rounded-r1 current-text-black current-icon-black bg-current/0 text-current/80 icon-current/50",
|
|
288
300
|
"dark:": "current-text-white current-icon-white",
|
|
289
301
|
"focus-visible:": "c8-flat-hover",
|
|
290
302
|
[whenEnabled]: {
|
|
291
|
-
|
|
303
|
+
[whenHoverIdle]: "c8-flat-hover",
|
|
292
304
|
"data-[highlighted]:": "c8-flat-hover",
|
|
293
305
|
"active:": "c8-flat-active",
|
|
294
306
|
"data-[active]:": "c8-flat-active"
|
|
@@ -309,7 +321,7 @@ const c8 = defineShortcuts({
|
|
|
309
321
|
"dark:": "current-text-scope-color-400 current-icon-scope-color-400",
|
|
310
322
|
"focus-visible:": "c8-outlined-hover",
|
|
311
323
|
[whenEnabled]: {
|
|
312
|
-
|
|
324
|
+
[whenHoverIdle]: "c8-outlined-hover",
|
|
313
325
|
"data-[highlighted]:": "c8-outlined-hover",
|
|
314
326
|
"active:": "c8-outlined-active",
|
|
315
327
|
"data-[active]:": "c8-outlined-active"
|
|
@@ -321,7 +333,7 @@ const c8 = defineShortcuts({
|
|
|
321
333
|
"": "surface-0 rounded-r1 border",
|
|
322
334
|
"focus-visible:": "c8-chrome-hover",
|
|
323
335
|
[whenEnabled]: {
|
|
324
|
-
|
|
336
|
+
[whenHoverIdle]: "c8-chrome-hover",
|
|
325
337
|
"data-[highlighted]:": "c8-chrome-hover",
|
|
326
338
|
"active:": "c8-chrome-active",
|
|
327
339
|
"data-[active]:": "c8-chrome-active"
|
|
@@ -348,7 +360,7 @@ const c8 = defineShortcuts({
|
|
|
348
360
|
"dark:": "current-text-scope-color-400 current-icon-scope-color-400",
|
|
349
361
|
"focus-visible:": "c8-light-hover",
|
|
350
362
|
[whenEnabled]: {
|
|
351
|
-
|
|
363
|
+
[whenHoverIdle]: "c8-light-hover",
|
|
352
364
|
"data-[highlighted]:": "c8-light-hover",
|
|
353
365
|
"active:": "c8-light-active",
|
|
354
366
|
"data-[active]:": "c8-light-active"
|
|
@@ -368,6 +380,10 @@ const popupCard = defineShortcuts({
|
|
|
368
380
|
"popup-card": { "": "surface-0 bg-current rounded-r2 overflow-hidden shadow-popup z-[100] border current-border-grey-400 border-current/20" }
|
|
369
381
|
});
|
|
370
382
|
const disabledSoft = defineShortcuts({ "disabled-soft": { [whenDisabled]: "opacity-40 cursor-not-allowed" } });
|
|
383
|
+
const press = defineShortcuts({ press: {
|
|
384
|
+
"": "[-webkit-tap-highlight-color:transparent]",
|
|
385
|
+
[`${whenEnabled}active:`]: "[scale:var(--press-scale,0.97)]"
|
|
386
|
+
} });
|
|
371
387
|
//#endregion
|
|
372
388
|
//#region src/theme/shortcuts/i8.ts
|
|
373
389
|
const M = "1em";
|
|
@@ -404,7 +420,7 @@ const rawVunorShortcuts = [
|
|
|
404
420
|
"i8-transparent": "bg-transparent!",
|
|
405
421
|
"i8-bare": {
|
|
406
422
|
"": "i8-apply-bg i8-apply-border current-outline-hl rounded-r1 outline-none text-current placeholder:text-current/50 disabled-soft",
|
|
407
|
-
[`${whenEnabled}
|
|
423
|
+
[`${whenEnabled}${whenHover}`]: "border-current-hover",
|
|
408
424
|
"focus:": "current-border-hl outline i8-apply-outline",
|
|
409
425
|
"data-[error=true]:": "current-border-error-500 current-outline-error-500 border-current"
|
|
410
426
|
},
|
|
@@ -480,7 +496,7 @@ const rawVunorShortcuts = [
|
|
|
480
496
|
},
|
|
481
497
|
"i8-icon-clickable": {
|
|
482
498
|
"[&>.i8-icon-wrap]:": "cursor-pointer",
|
|
483
|
-
|
|
499
|
+
[`${whenCanHover}[&>.i8-icon-wrap:hover]:`]: "current-icon-hl icon-current"
|
|
484
500
|
}
|
|
485
501
|
}),
|
|
486
502
|
c8,
|
|
@@ -491,6 +507,7 @@ const rawVunorShortcuts = [
|
|
|
491
507
|
}),
|
|
492
508
|
popupCard,
|
|
493
509
|
disabledSoft,
|
|
510
|
+
press,
|
|
494
511
|
...shortcuts
|
|
495
512
|
];
|
|
496
513
|
//#endregion
|
|
@@ -1980,17 +1997,16 @@ function unitBy(input, factor, roundTo = 3) {
|
|
|
1980
1997
|
}
|
|
1981
1998
|
//#endregion
|
|
1982
1999
|
//#region src/theme/preflights.ts
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
${
|
|
1993
|
-
|
|
2000
|
+
/**
|
|
2001
|
+
* `:root` theme variables always; page-level element styles only with `baseStyles`.
|
|
2002
|
+
* Off, `body` keeps the body level's `--font-*` variables for `text-mt-*` / `font-$bold`.
|
|
2003
|
+
*/
|
|
2004
|
+
function vunorPreflights(baseStyles) {
|
|
2005
|
+
return { getCSS: ({ theme }) => baseStyles ? renderBaseStyles(theme) : renderRootVars(theme) + renderFontVarsCss("body", theme.fontSize.body) };
|
|
2006
|
+
}
|
|
2007
|
+
function renderBaseStyles(theme) {
|
|
2008
|
+
return `${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)}
|
|
2009
|
+
${renderRootVars(theme)}
|
|
1994
2010
|
|
|
1995
2011
|
::-webkit-scrollbar {
|
|
1996
2012
|
width: 10px;
|
|
@@ -2025,7 +2041,20 @@ ${renderDefaultScope(theme)}}
|
|
|
2025
2041
|
.dark ::-webkit-scrollbar-thumb:hover {
|
|
2026
2042
|
background-color: rgba(255,255,255,0.3);
|
|
2027
2043
|
}
|
|
2028
|
-
|
|
2044
|
+
`;
|
|
2045
|
+
}
|
|
2046
|
+
function renderRootVars(theme) {
|
|
2047
|
+
return `:root {
|
|
2048
|
+
--un-border-opacity: 0.25;
|
|
2049
|
+
--un-default-border-color: rgb(150 150 150 / var(--un-border-opacity));
|
|
2050
|
+
--scope-black: 0 0 0;
|
|
2051
|
+
--scope-white: 255 255 255;
|
|
2052
|
+
--scope-hl: var(--scope-color-500);
|
|
2053
|
+
--v-fingertip: ${theme.spacing["fingertip-m"] || "3em"};
|
|
2054
|
+
--v-fingertip-half: ${unitBy(theme.spacing["fingertip-m"] || "3em", .5)};
|
|
2055
|
+
${renderDefaultScope(theme)}}
|
|
2056
|
+
`;
|
|
2057
|
+
}
|
|
2029
2058
|
function renderDefaultScope(theme) {
|
|
2030
2059
|
const vars = getScopeCssVars("neutral", theme);
|
|
2031
2060
|
if (!vars) return "";
|
|
@@ -2034,6 +2063,10 @@ function renderDefaultScope(theme) {
|
|
|
2034
2063
|
function renderFontCss(selector, font) {
|
|
2035
2064
|
return `${selector} { font-size: ${font[0]}; ${Object.entries(font[1]).map((e) => `${e[0]}: ${e[1]};`).join(" ")} }\n`;
|
|
2036
2065
|
}
|
|
2066
|
+
/** Only a level's `--font-*` variables: a rule that styles nothing. */
|
|
2067
|
+
function renderFontVarsCss(selector, font) {
|
|
2068
|
+
return `${selector} { ${Object.entries(font[1]).filter(([k]) => k.startsWith("--")).map(([k, v]) => `${k}: ${v};`).join(" ")} }\n`;
|
|
2069
|
+
}
|
|
2037
2070
|
//#endregion
|
|
2038
2071
|
//#region src/theme/rules/i8-rules.ts
|
|
2039
2072
|
const i8Rules = [
|
|
@@ -2414,6 +2447,7 @@ const defaultOptions = {
|
|
|
2414
2447
|
xl: `4em`
|
|
2415
2448
|
},
|
|
2416
2449
|
baseRadius: `${round(1 / 1.618, 3)}em`,
|
|
2450
|
+
baseStyles: true,
|
|
2417
2451
|
animation: {
|
|
2418
2452
|
durations: {
|
|
2419
2453
|
"slide-down-and-fade": ".15s",
|
|
@@ -2485,7 +2519,7 @@ const presetVunor = (_opts) => {
|
|
|
2485
2519
|
const opts = defu(_opts, defaultOptions);
|
|
2486
2520
|
const wind = getFixedWind();
|
|
2487
2521
|
if (!wind.preflights) wind.preflights = [];
|
|
2488
|
-
wind.preflights.push(
|
|
2522
|
+
wind.preflights.push(vunorPreflights(opts.baseStyles));
|
|
2489
2523
|
if (!wind.rules) wind.rules = [];
|
|
2490
2524
|
wind.rules.push(...rules);
|
|
2491
2525
|
const paletteShortcuts = getPaletteShortcuts();
|
|
@@ -2539,4 +2573,4 @@ function vunorShortcuts(customShortcuts, baseShortcuts = mergedVunorShortcuts) {
|
|
|
2539
2573
|
return merged;
|
|
2540
2574
|
}
|
|
2541
2575
|
//#endregion
|
|
2542
|
-
export { componentClasses, defineShortcuts, getComponentClasses, mergeVunorShortcuts, mergedVunorShortcuts, presetVunor, rawVunorShortcuts, toUnoShortcut, vunorShortcuts };
|
|
2576
|
+
export { componentClasses, defineShortcuts, getComponentClasses, mergeVunorShortcuts, mergedVunorShortcuts, presetVunor, rawVunorShortcuts, toUnoShortcut, vunorShortcuts, whenCanHover, whenDisabled, whenEnabled, whenHover, whenHoverIdle };
|