vunor 0.4.2 → 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.
Files changed (3) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/README.md +5 -1
  3. 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
@@ -201,13 +201,15 @@ defineShortcuts({
201
201
  })
202
202
  ```
203
203
 
204
+ `whenCanHover` is the bare `@media (hover: hover)` prefix, for a hover selector of your own: ``[`${whenCanHover}[&>.icon:hover]:`]: 'text-current-hl'``.
205
+
204
206
  ### Compound Variants
205
207
 
206
208
  Nesting can go deeper for compound variants:
207
209
 
208
210
  ```ts
209
211
  defineShortcuts({
210
- 'c8-filled': {
212
+ 'my-btn': {
211
213
  '': 'current-bg-scope-color-500 text-white rounded-base',
212
214
  'hover:': 'current-bg-scope-color-400',
213
215
  'dark:': {
@@ -325,6 +327,8 @@ vunorShortcuts(
325
327
  )
326
328
  ```
327
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
+
328
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).
329
333
 
330
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'`).
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "vunor",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "files": [
5
- "dist"
5
+ "dist",
6
+ "CHANGELOG.md"
6
7
  ],
7
8
  "type": "module",
8
9
  "exports": {