vunor 0.4.1 → 0.4.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/CHANGELOG.md +100 -0
- package/README.md +47 -3
- package/dist/theme.d.mts +20 -1
- package/dist/theme.mjs +38 -21
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.4.3
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- The npm package now ships this `CHANGELOG.md`, so the notes for a release are in `node_modules/vunor/` next to the code. No code changes.
|
|
8
|
+
|
|
9
|
+
## 0.4.2
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `press` shortcut: press feedback for any clickable. An enabled element shrinks to `scale: var(--press-scale, 0.97)` while it is `:active`, on touch and mouse. It ignores `data-active`, which Reka UI and vunor use for "current" (selected tab, pressed toggle, open popover trigger). It uses the `scale` property, so it stacks with translate/rotate utilities, sets no transition (add `transition-[scale]` to ease it) and clears the iOS tap highlight.
|
|
14
|
+
- `whenHover`, `whenHoverIdle` and `whenCanHover` from `vunor/theme`: variant-prefix keys for your own shortcuts that apply hover only on devices whose primary input can hover. Use `whenHoverIdle` when the shortcut also paints `active:`.
|
|
15
|
+
- `whenEnabled` and `whenDisabled` from `vunor/theme`: the variant-prefix keys for vunor's shared disabled definition, needed to override c8 states (see below).
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Hover paint is applied only on devices whose primary input can hover (`@media (hover: hover)`): the `c8-*` families, `i8-bare`, `i8-icon-clickable`, `calendar-cell`, `slider-thumb`, `combobox-c8-icon` and `dialog-close`. A tap on a touch screen no longer leaves a hover wash stuck on. Press (`:active`), `:focus-visible` and `[data-highlighted]` are not gated. While the mouse presses, the press paint still wins. Other differences on a device that can hover:
|
|
20
|
+
- **Overrides of a c8 hover must move.** An override written as `'c8-x': { [whenEnabled]: { 'hover:': '…' } }` now compiles to a separate, less specific rule and loses. Write `'c8-x': { [whenEnabled]: { [whenHoverIdle]: '…' } }`; it merges into vunor's rule and wins.
|
|
21
|
+
- In dark mode, pressing a `calendar-cell` shows the 15% press tint; it used to keep the solid 700 hover fill.
|
|
22
|
+
- `c8-filled` now rests on `scope-color-600` and goes to 700 on hover and 800 on press, in light and dark mode. On 500 its white text measured 3.4–4.1:1 against the default palette, below WCAG AA, and the lighter dark-mode hover and press fills (400, 300) measured 2.1–3.0:1. White text now reaches at least 4.5:1 on every fill for every default palette colour (lowest: `good-600`, 4.62:1). Filled buttons are one shade darker, and in dark mode hover and press darken instead of lightening. In dark mode the button also gets a 1px inset rim in `scope-color-500` (a `ring-inset` box-shadow that composes with `shadow-*`): 600–800 sit at 1.7–3.6:1 against the dark layers, the rim at 3.05:1 or more against every one. The selected `VuCalendar` day (which uses `c8-filled`) changes the same way. With a tuned palette, check your 600 shades: `mainPalette.preserveInputColor: true` with `good: '#22c55e'` gives `good-600` only 4.18:1.
|
|
23
|
+
- Not changed: the checkbox and radio fills, the slider thumb and range and the tab indicator stay on `scope-color-500`. They carry no text; their marks (the white check and radio dot) and fills reach the 3:1 non-text contrast at 500 (3.4:1 or more against white, 3.05:1 or more against the dark layers).
|
|
24
|
+
|
|
25
|
+
## 0.4.1
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- `presetVunor({ baseStyles })`, default `true`. Set it to `false` when the app styles its own page: the page-level element rules go (the body, figcaption and h1–h6 typography, including a level's `font` and `css` from `typography`, and the scrollbar styling). The theme variables on `:root` and the body `--font-*` variables stay, as do all shortcuts and classes.
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- `VuSelect`'s `v-model` type now follows `multiple`: an array with `multiple`, a single value without it. Before, the type did not follow `multiple`.
|
|
34
|
+
|
|
35
|
+
## 0.4.0
|
|
36
|
+
|
|
37
|
+
### Breaking
|
|
38
|
+
|
|
39
|
+
- `vue` (`^3.5.0`), `unocss` (`^66.2.1`) and `reka-ui` (`^2.8.0`) are now **peer dependencies** (they were dependencies). The app provides them, so it has a single copy of each. npm and pnpm install missing peers automatically; list them in your app to pin versions: `pnpm add vunor vue unocss reka-ui`. The floors are measured: the dist checks pass with reka-ui 2.8.0 (older 2.x releases do not render popups with Vue 3.4), reka-ui 2.8 needs `@vueuse/core` 14, which needs Vue 3.5, and the theme generates identical CSS from unocss 66.2.1 on (66.2.0 and older miss arbitrary custom-property utilities).
|
|
40
|
+
- `@unocss/preset-mini` is no longer a dependency: types come from `unocss/preset-mini` (no second `@unocss` copy).
|
|
41
|
+
- `@nuxt/kit` and `@nuxt/schema` are optional peer dependencies, used only by `vunor/nuxt`.
|
|
42
|
+
|
|
43
|
+
### Intended changes of default behaviour
|
|
44
|
+
|
|
45
|
+
The dist test compares what each component passes to its Reka/vunor parts by default with
|
|
46
|
+
0.3.2; these are the only differences:
|
|
47
|
+
|
|
48
|
+
- `VuCheckbox` is no longer `required` by default (it always set `required` on the checkbox, which would block form submission now that `name` is forwarded). Pass `required` to require it.
|
|
49
|
+
- `VuButton` renders `aria-pressed` only when `pressed` is passed, and `aria-selected` only when `selected` is passed **and** the button has a role that allows it (`option`, `tab`, `gridcell`, `row`, `columnheader`, `rowheader`, `treeitem`, e.g. inside a listbox). Before, every button rendered `aria-pressed="false" aria-selected="false"`. `selected` now also sets `data-selected`, which `c8-*` styles like `aria-selected`.
|
|
50
|
+
- `VuButton` with `to`: the active router link gets `data-selected="true"` and, when exactly active, `aria-current="page"`, instead of the invalid `aria-selected` on a link. The `c8-flat` look is the same.
|
|
51
|
+
- `id`: on `VuCheckbox` it goes to the checkbox control (for `<label for>`), not the wrapper div. On `VuPopover` (and a `multiple` + `groupItem` `VuCombobox`) the trigger keeps Reka's id, which links it to the popup; an `id` you pass is not applied there.
|
|
52
|
+
- Button-only props (`active`, `pressed`, `selected`, `asLink`, `to`) no longer appear as DOM attributes.
|
|
53
|
+
- Wrappers no longer pass `false` for boolean props you did not set, so Reka's own defaults apply (for example the hidden date input of `VuDatePicker` is no longer `required="false"`).
|
|
54
|
+
- `VuPopover` no longer passes its own props to the popup as attributes (`as-link`, `model-value`, … appeared on the popup element).
|
|
55
|
+
- Removed invalid `as-child` attributes from `VuCombobox`'s popup portal and `VuPopover`'s root (they did nothing and warned in development).
|
|
56
|
+
- `VuButton` no longer renders an empty `style=""` attribute.
|
|
57
|
+
- `default-open` works on `VuPopover`, `VuSelect`, `VuSelectBase`, `VuCombobox`, `VuDatePicker` and `VuDatePickerBase`: when you do not bind `open` (`v-model:open`), the `open` model is now `undefined` (Reka's "uncontrolled") instead of `false`, which kept the popup closed and ignored `default-open`. Likewise `VuCheckbox` `default-value` works: its model is `undefined` until you bind it.
|
|
58
|
+
- What a component exposes about that state now always matches the Reka root, also when it is uncontrolled: slot props (`VuPopover` `isOpen`, `VuSelectBase` `open` / `value` / `displayItem`), the open-state styling (`data-active` / `data-group-active` on the Select, Combobox and date picker shells, the Popover trigger), `openPopup()` (one call toggles once), the Checkbox mark, the Slider value label and the Select / Combobox shown label with `default-value`. `VuDialog` uses the same rule: `default-open` opens it without emitting `update:open`.
|
|
59
|
+
- Like Reka, components read `default-open` / `default-value` once, when they mount: changing it later has no effect, and what the component exposes stays in step with the Reka root. When you clear a bound model (`v-model` back to `undefined`), the exposed state falls back exactly like the root (for example `VuSlider`'s label shows Reka's default `0`, not nothing), and the component does not emit.
|
|
60
|
+
- Behaviour change: with `multiple`, `VuCombobox`'s `open` (`v-model:open`, `default-open`) is the popover the user opens with the field. In 0.3.2 it described the option list inside the popover, which is always open: mounting emitted `update:open(true)` with the popover closed, the first open emitted nothing, and a bound `:open` did not open the popover. Now mounting emits nothing, each open and close emits one `update:open`, a bound `:open` / `default-open` opens the popover, and the field's open-state styling (`data-expanded`, `data-active`) follows the popover.
|
|
61
|
+
- Clearing a `multiple` `VuCombobox` (its clear icon) now emits `[]` (0.3.2 emitted `undefined`), so the selection is empty rather than handed back to the uncontrolled default.
|
|
62
|
+
- One click toggles a popup once. A click on a field's append icon (the chevron) also reached the field around it, and both toggled: the `VuCombobox` chevron (single and `groupItem`) could not open its popup, and in `multiple` mode a second chevron click did not close it. Every wrapper now routes a gesture to exactly one toggle (`VuCombobox`, `VuSelect`, `VuSelectBase`, `VuDatePicker`, `VuDatePickerBase`, `VuPopover`); the Reka triggers they render are marked `data-vu-trigger` and toggle by themselves.
|
|
63
|
+
- The `VuDatePicker` / `VuDatePickerBase` calendar icon is keyboard-operable: it is a `role="button"` with an `aria-label`, and Enter / Space open and close the calendar (it reacted to clicks only).
|
|
64
|
+
- A popup whose `v-model:open` went back to `undefined` after being set no longer passes `undefined` to Reka (`Invalid prop "present"` warning in development): once set, the open state handed to Reka stays a boolean.
|
|
65
|
+
- `VuCombobox`: the field shows its open state (`data-group-active`, like `VuSelect`), and `popupPosition` / `sticky` apply.
|
|
66
|
+
- `VuCombobox` with `groupItem`: moving the pointer off the input clears the keyboard highlight, and the reading direction applies, as in non-`groupItem` mode. Reka's listbox wiring (`dir`, pointer-leave and focus-out handlers) now reaches the input, and the wrapper classes `relative w-full h-full` are no longer passed down (in 0.3.2 both were merged into a hidden template node and never reached the DOM).
|
|
67
|
+
- `VuMenu` highlights its first item when it opens (Reka's default). In 0.3.2 the item buttons rendered a Fragment root, so Reka could not register the items.
|
|
68
|
+
- `VuDatePicker` / `VuDatePickerBase` render their input shell (see Fixes), so the date field, its trigger and the popup's `aria-labelledby` now exist by default.
|
|
69
|
+
|
|
70
|
+
Defaults kept on purpose: `VuCombobox` keeps the typed text on blur (`resetSearchTermOnBlur` defaults to `false`; Reka's default is `true`), and `VuPopover` keeps collision handling off (`avoidCollisions`, `sideFlip`, `alignFlip`, `hideShiftedArrow` default to `false`; pass them to opt in).
|
|
71
|
+
|
|
72
|
+
### Fixes
|
|
73
|
+
|
|
74
|
+
- Components are compiled in production mode. Before, template comments next to a root element turned it into a Fragment, and production apps silently lost `class`, `@click` and `aria-*` on `VuButton`, `VuButtonBase`, `VuCheckbox` and `VuMenuItem`.
|
|
75
|
+
- Every component forwards fallthrough attributes (`class`, `style`, `id`, `data-*`, `aria-*`, listeners) to its rendered root, including components whose Reka root renders no element (`VuDialog`, `VuPopover`, `VuSelect`, `VuSelectBase`, `VuDatePickerBase`, `VuAppToasts`, `VuCombobox`).
|
|
76
|
+
- Props and events of the wrapped Reka component pass through, for example `VuSelect`/`VuSelectBase` `name`, `multiple`, `by`, `dir`, `autocomplete`, `v-model:open`; `VuPopover` `v-model:open`, `modal`, `default-open` and the content events; `VuCombobox` `name`, `by`, `open-on-focus`, `@highlight` and more; `@update:placeholder` on `VuCalendar` and `VuDatePicker`. `name` now submits the value with the enclosing form.
|
|
77
|
+
- `vunor/nuxt` no longer throws `ReferenceError: __vue_files__ is not defined` on import.
|
|
78
|
+
- `VuDatePickerBase` renders `VuInputBase` (it rendered an unknown `<vuinputbase>` element).
|
|
79
|
+
- `VuCombobox` no longer imports `@vueuse/core` (it was not a dependency), and no longer warns about a readonly computed on every mount.
|
|
80
|
+
- A disabled or loading `VuButton` rendered as a link (`to`, `as-link`) no longer navigates or fires `@click`: it drops `href` (so middle-click and "open in new tab" have nothing to follow) and stays a focusable link (`role="link"`, `aria-disabled="true"`, `tabindex="0"`). `VuButtonBase` no longer renders the invalid `disabled` attribute on `<a>`.
|
|
81
|
+
- `VuButton`: `to` uses the app's `RouterLink` (no `vue-router` import; its type is structural) and navigates client-side; without a router, a string `to` renders `<a href>` and warns in dev.
|
|
82
|
+
- `@click` on `VuSelect` and `VuCombobox` fires in `groupItem` mode too.
|
|
83
|
+
- `VuSelect` / `VuSelectBase` types: the model is `string`, or `string[]` with `multiple`.
|
|
84
|
+
- `VuSlider` no longer calls `@update:model-value` twice per change.
|
|
85
|
+
- `VuAppToasts` forwards `hotkey` to the toast viewport.
|
|
86
|
+
- The published `dist/` is rebuilt from scratch, so no stale chunks are shipped.
|
|
87
|
+
- `VuCheckbox` forwards `name`, `value`, `true-value`, `false-value` and `default-value` to the checkbox control.
|
|
88
|
+
- `VuRadioGroup` forwards `name`, `required`, `orientation`, `dir` and `loop`.
|
|
89
|
+
- `VuDialog` supports `default-open` and `disable-outside-pointer-events`, and no longer points `aria-describedby` at a missing description.
|
|
90
|
+
- `VuOverflowContainer` no longer hangs when it has no width (hidden or not laid out).
|
|
91
|
+
- `VuInputBase` used outside `VuInput` no longer warns about a missing injection.
|
|
92
|
+
- `VuCheckbox` shows its checkmark from Reka's own state: with custom `true-value` / `false-value`, and inside a Reka `CheckboxGroupRoot` (the group's model decides), the mark now matches the checkbox.
|
|
93
|
+
- `VuCombobox` with `open-on-click` / `open-on-focus`: a click on the input opens the popup once (one `update:open`) instead of opening and immediately closing it; the chevron still toggles.
|
|
94
|
+
- A disabled or loading `VuButton` link also ignores `@click.once`, `@click.capture` and `@click.passive` listeners.
|
|
95
|
+
- `VuSelectBase` with `multiple`: its slot `value` is `[]` when nothing is selected, as in Reka (it was `undefined`).
|
|
96
|
+
- `VuDialog` footer buttons no longer warn in development (`Component emitted event "footer-click-ok" but it is neither declared …`) and no longer put the `@footer-click-<label>` listeners on the dialog card element. The event names are unchanged: `footer-click` (with the label) and `footer-click-<label>` (lower-cased, spaces removed). `.once`, kebab-case and `v-on` object listeners work for `footer-click-<label>` as for any Vue event.
|
|
97
|
+
|
|
98
|
+
### Known trade-off
|
|
99
|
+
|
|
100
|
+
- Because components are compiled in production mode, their props carry no runtime type information (only what boolean casting needs). Apps no longer get Vue's "Invalid prop type" warnings for vunor components in development; TypeScript types are unchanged.
|
package/README.md
CHANGED
|
@@ -177,13 +177,39 @@ 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
|
+
|
|
204
|
+
`whenCanHover` is the bare `@media (hover: hover)` prefix, for a hover selector of your own: ``[`${whenCanHover}[&>.icon:hover]:`]: 'text-current-hl'``.
|
|
205
|
+
|
|
180
206
|
### Compound Variants
|
|
181
207
|
|
|
182
208
|
Nesting can go deeper for compound variants:
|
|
183
209
|
|
|
184
210
|
```ts
|
|
185
211
|
defineShortcuts({
|
|
186
|
-
'
|
|
212
|
+
'my-btn': {
|
|
187
213
|
'': 'current-bg-scope-color-500 text-white rounded-base',
|
|
188
214
|
'hover:': 'current-bg-scope-color-400',
|
|
189
215
|
'dark:': {
|
|
@@ -275,18 +301,36 @@ Button and clickable element design variants:
|
|
|
275
301
|
|
|
276
302
|
| Class | Description |
|
|
277
303
|
| ------------- | --------------------------------------- |
|
|
278
|
-
| `c8-filled` | Solid background, white text
|
|
304
|
+
| `c8-filled` | Solid background, white text (WCAG AA) |
|
|
279
305
|
| `c8-flat` | Transparent background, colored text |
|
|
280
306
|
| `c8-outlined` | Border + colored text, transparent fill |
|
|
281
307
|
| `c8-light` | Light tinted background, colored text |
|
|
282
308
|
|
|
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}`:
|
|
309
|
+
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
310
|
|
|
285
311
|
```html
|
|
286
312
|
<button class="scope-primary c8-filled">Save</button>
|
|
287
313
|
<button class="scope-error c8-flat">Cancel</button>
|
|
288
314
|
```
|
|
289
315
|
|
|
316
|
+
`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.
|
|
317
|
+
|
|
318
|
+
To change a c8 hover colour, override the same key vunor uses, so your class merges into vunor's rule and wins:
|
|
319
|
+
|
|
320
|
+
```ts
|
|
321
|
+
import { defineShortcuts, vunorShortcuts, whenEnabled, whenHoverIdle } from 'vunor/theme'
|
|
322
|
+
|
|
323
|
+
vunorShortcuts(
|
|
324
|
+
defineShortcuts({
|
|
325
|
+
'c8-filled': { [whenEnabled]: { [whenHoverIdle]: 'current-bg-scope-color-900' } },
|
|
326
|
+
})
|
|
327
|
+
)
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
`whenEnabled` and `whenDisabled` are the variant-prefix keys for the shared disabled definition above. Use them in your own shortcuts so a state matches the same elements vunor treats as disabled: `{ [whenEnabled]: { 'active:': 'bg-current/20' }, [whenDisabled]: 'cursor-not-allowed' }`.
|
|
331
|
+
|
|
332
|
+
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).
|
|
333
|
+
|
|
290
334
|
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
335
|
|
|
292
336
|
### Inputable Styles (`i8`)
|
package/dist/theme.d.mts
CHANGED
|
@@ -341,6 +341,25 @@ declare const presetVunor: PresetFactory<TVunorTheme, TVunorUnoPresetOpts & {
|
|
|
341
341
|
palette?: TVunorPaletteOptions;
|
|
342
342
|
}>;
|
|
343
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
|
|
344
363
|
//#region src/theme/shortcuts/raw.d.ts
|
|
345
364
|
declare const rawVunorShortcuts: TVunorShortcut[];
|
|
346
365
|
//#endregion
|
|
@@ -378,4 +397,4 @@ declare const mergedVunorShortcuts: TVunorShortcut;
|
|
|
378
397
|
*/
|
|
379
398
|
declare function vunorShortcuts(customShortcuts?: TVunorShortcut, baseShortcuts?: TVunorShortcut): Record<string, string>;
|
|
380
399
|
//#endregion
|
|
381
|
-
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
|
|
@@ -2556,4 +2573,4 @@ function vunorShortcuts(customShortcuts, baseShortcuts = mergedVunorShortcuts) {
|
|
|
2556
2573
|
return merged;
|
|
2557
2574
|
}
|
|
2558
2575
|
//#endregion
|
|
2559
|
-
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 };
|