@zazz-ui/core 0.15.0 → 0.16.0
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/AUTHORING.md +29 -14
- package/CHANGELOG.md +162 -0
- package/README.md +6 -5
- package/dist/{csp-LRx1fynI.js → csp-C1f62vyT.js} +1 -1
- package/dist/sri.json +70 -65
- package/dist/zazz.css +1 -1
- package/dist/zazz.js +1 -1
- package/editor/zazz.css-data.json +74 -2
- package/editor/zazz.html-data.json +119 -79
- package/editor/zazz.language-data.json +402 -314
- package/editor/zazz.lint-data.json +1752 -1731
- package/package.json +2 -1
- package/src/base/_defaults.css +11 -11
- package/src/base/_reset.css +2 -10
- package/src/base/_typography.css +17 -568
- package/src/base/_utilities-box.css +17 -17
- package/src/base/_utilities-pseudo.css +2 -2
- package/src/base/_variables.css +142 -97
- package/src/base/carousel-scroll.d.ts +1 -1
- package/src/base/carousel-scroll.js +6 -6
- package/src/base/carousel-scroll.ts +6 -6
- package/src/base/carousel.d.ts.map +1 -1
- package/src/base/carousel.js +6 -2
- package/src/base/carousel.ts +6 -2
- package/src/base/csp.js +2 -2
- package/src/base/csp.ts +2 -2
- package/src/base/kit-styling.d.ts.map +1 -1
- package/src/base/kit-styling.js +186 -183
- package/src/base/kit-styling.ts +186 -183
- package/src/base/navigation.d.ts +2 -2
- package/src/base/navigation.d.ts.map +1 -1
- package/src/base/navigation.js +25 -21
- package/src/base/navigation.ts +27 -21
- package/src/base/utilities.d.ts +1 -1
- package/src/base/utilities.d.ts.map +1 -1
- package/src/base/utilities.js +20 -4
- package/src/base/utilities.ts +21 -5
- package/src/base/zazz-element.d.ts +1 -1
- package/src/base/zazz-element.js +1 -1
- package/src/base/zazz-element.ts +1 -1
- package/src/{base → behaviors}/gesture.d.ts +4 -3
- package/src/behaviors/gesture.d.ts.map +1 -0
- package/src/{base → behaviors}/gesture.js +1 -1
- package/src/{base → behaviors}/gesture.ts +5 -4
- package/src/{base → behaviors}/hotkeys.d.ts +2 -1
- package/src/behaviors/hotkeys.d.ts.map +1 -0
- package/src/{base → behaviors}/hotkeys.ts +2 -1
- package/src/behaviors/list-navigation.d.ts +64 -0
- package/src/behaviors/list-navigation.d.ts.map +1 -0
- package/src/behaviors/list-navigation.js +66 -0
- package/src/behaviors/list-navigation.ts +107 -0
- package/src/{base → behaviors}/typeahead.d.ts +3 -1
- package/src/behaviors/typeahead.d.ts.map +1 -0
- package/src/{base → behaviors}/typeahead.js +12 -17
- package/src/{base → behaviors}/typeahead.ts +12 -17
- package/src/css-properties.json +704 -0
- package/src/index.css +7 -0
- package/src/manifest.d.ts +20 -9
- package/src/manifest.d.ts.map +1 -1
- package/src/manifest.js +125 -37
- package/src/manifest.ts +132 -38
- package/src/primitives/accordion/accordion.json +49 -0
- package/src/primitives/alert-dialog/alert-dialog.json +35 -0
- package/src/primitives/autocomplete/autocomplete.d.ts +2 -2
- package/src/primitives/autocomplete/autocomplete.d.ts.map +1 -1
- package/src/primitives/autocomplete/autocomplete.js +2 -2
- package/src/primitives/autocomplete/autocomplete.json +65 -0
- package/src/primitives/autocomplete/autocomplete.ts +2 -2
- package/src/primitives/avatar/avatar.css +108 -0
- package/src/primitives/avatar/avatar.html +20 -74
- package/src/primitives/avatar/avatar.json +48 -0
- package/src/primitives/badge/badge.css +45 -10
- package/src/primitives/badge/badge.html +4 -0
- package/src/primitives/badge/badge.json +83 -0
- package/src/primitives/breadcrumbs/breadcrumbs.json +20 -0
- package/src/primitives/button/button.css +50 -66
- package/src/primitives/button/button.html +4 -0
- package/src/primitives/button/button.json +85 -0
- package/src/primitives/button-group/button-group.css +4 -15
- package/src/primitives/button-group/button-group.json +40 -0
- package/src/primitives/callout/callout.css +1 -1
- package/src/primitives/callout/callout.html +12 -12
- package/src/primitives/callout/callout.json +54 -0
- package/src/primitives/card/card-article.html +13 -37
- package/src/primitives/card/card-horizontal.html +11 -14
- package/src/primitives/card/card-login.html +4 -4
- package/src/primitives/card/card-product.html +3 -3
- package/src/primitives/card/card-subgrid.html +4 -4
- package/src/primitives/card/card.css +1 -1
- package/src/primitives/card/card.html +8 -8
- package/src/primitives/card/card.json +73 -0
- package/src/primitives/carousel/carousel.css +1 -1
- package/src/primitives/carousel/carousel.json +89 -0
- package/src/primitives/checkbox/checkbox.css +1 -2
- package/src/primitives/checkbox/checkbox.json +51 -0
- package/src/primitives/combobox/combobox.css +3 -2
- package/src/primitives/combobox/combobox.d.ts +2 -2
- package/src/primitives/combobox/combobox.d.ts.map +1 -1
- package/src/primitives/combobox/combobox.js +2 -2
- package/src/primitives/combobox/combobox.json +113 -0
- package/src/primitives/combobox/combobox.ts +2 -2
- package/src/primitives/command/command-actions.html +1 -1
- package/src/primitives/command/command.d.ts +4 -3
- package/src/primitives/command/command.d.ts.map +1 -1
- package/src/primitives/command/command.js +7 -6
- package/src/primitives/command/command.json +86 -0
- package/src/primitives/command/command.ts +7 -6
- package/src/primitives/debug/audit-core.d.ts +19 -12
- package/src/primitives/debug/audit-core.d.ts.map +1 -1
- package/src/primitives/debug/audit-core.js +78 -16
- package/src/primitives/debug/audit-core.ts +94 -22
- package/src/primitives/debug/debug.d.ts +6 -4
- package/src/primitives/debug/debug.d.ts.map +1 -1
- package/src/primitives/debug/debug.js +50 -21
- package/src/primitives/debug/debug.json +29 -0
- package/src/primitives/debug/debug.ts +57 -35
- package/src/primitives/dialog/dialog.css +1 -4
- package/src/primitives/dialog/dialog.json +78 -0
- package/src/primitives/drawer/drawer.css +4 -2
- package/src/primitives/drawer/drawer.d.ts.map +1 -1
- package/src/primitives/drawer/drawer.js +76 -4
- package/src/primitives/drawer/drawer.json +98 -0
- package/src/primitives/drawer/drawer.ts +78 -5
- package/src/primitives/fields/fields.css +11 -4
- package/src/primitives/fields/fields.json +92 -0
- package/src/primitives/font/font.css +188 -0
- package/src/primitives/font/font.html +14 -0
- package/src/primitives/font/font.json +39 -0
- package/src/primitives/group/group.json +25 -0
- package/src/primitives/input/input.css +1 -2
- package/src/primitives/input/input.json +56 -0
- package/src/primitives/input-group/input-group-password-group.html +1 -1
- package/src/primitives/input-group/input-group.css +32 -3
- package/src/primitives/input-group/input-group.html +5 -8
- package/src/primitives/input-group/input-group.json +69 -0
- package/src/primitives/kbd/kbd.css +1 -1
- package/src/primitives/kbd/kbd.json +52 -0
- package/src/primitives/layout/layout.json +45 -0
- package/src/primitives/lightbox/lightbox.css +4 -3
- package/src/primitives/lightbox/lightbox.html +2 -2
- package/src/primitives/lightbox/lightbox.js +1 -1
- package/src/primitives/lightbox/lightbox.json +87 -0
- package/src/primitives/lightbox/lightbox.ts +1 -1
- package/src/primitives/link/link.css +28 -0
- package/src/primitives/link/link.html +5 -0
- package/src/primitives/link/link.json +23 -0
- package/src/primitives/menu/menu.d.ts +3 -0
- package/src/primitives/menu/menu.d.ts.map +1 -1
- package/src/primitives/menu/menu.js +10 -25
- package/src/primitives/menu/menu.json +51 -0
- package/src/primitives/menu/menu.ts +10 -27
- package/src/primitives/menubar/menubar.json +23 -0
- package/src/primitives/meter/meter.css +24 -3
- package/src/primitives/meter/meter.json +41 -0
- package/src/primitives/mobile-menu/mobile-menu.html +1 -1
- package/src/primitives/mobile-menu/mobile-menu.json +64 -0
- package/src/primitives/navigation-menu/navigation-menu-featured.html +58 -58
- package/src/primitives/navigation-menu/navigation-menu-megamenu.html +6 -113
- package/src/primitives/navigation-menu/navigation-menu.css +11 -5
- package/src/primitives/navigation-menu/navigation-menu.html +1 -1
- package/src/primitives/navigation-menu/navigation-menu.json +82 -0
- package/src/primitives/otp/otp.css +1 -1
- package/src/primitives/otp/otp.d.ts +3 -3
- package/src/primitives/otp/otp.js +5 -5
- package/src/primitives/otp/otp.json +75 -0
- package/src/primitives/otp/otp.ts +5 -5
- package/src/primitives/password-group/password-group.css +32 -2
- package/src/primitives/password-group/password-group.html +1 -1
- package/src/primitives/password-group/password-group.json +74 -0
- package/src/primitives/popover/popover.css +1 -1
- package/src/primitives/popover/popover.json +64 -0
- package/src/primitives/progress/progress.css +25 -3
- package/src/primitives/progress/progress.json +41 -0
- package/src/primitives/prose/prose.css +341 -0
- package/src/primitives/prose/prose.html +11 -11
- package/src/primitives/prose/prose.json +47 -0
- package/src/primitives/radio/radio.css +1 -1
- package/src/primitives/radio/radio.json +48 -0
- package/src/primitives/reveal/reveal.json +72 -0
- package/src/primitives/scroll-fade/scroll-fade.css +0 -3
- package/src/primitives/scroll-fade/scroll-fade.json +34 -0
- package/src/primitives/select/select.css +2 -2
- package/src/primitives/select/select.json +119 -0
- package/src/primitives/separator/separator.json +34 -0
- package/src/primitives/slider/slider.css +87 -13
- package/src/primitives/slider/slider.json +49 -0
- package/src/primitives/style-guard/style-guard.js +1 -1
- package/src/primitives/style-guard/style-guard.json +22 -0
- package/src/primitives/style-guard/style-guard.ts +2 -2
- package/src/primitives/switch/switch.css +107 -18
- package/src/primitives/switch/switch.json +71 -0
- package/src/primitives/table/table.json +74 -0
- package/src/primitives/tabs/tabs.css +24 -12
- package/src/primitives/tabs/tabs.d.ts +4 -2
- package/src/primitives/tabs/tabs.d.ts.map +1 -1
- package/src/primitives/tabs/tabs.js +14 -24
- package/src/primitives/tabs/tabs.json +94 -0
- package/src/primitives/tabs/tabs.ts +14 -26
- package/src/primitives/textarea/textarea.css +1 -1
- package/src/primitives/textarea/textarea.json +48 -0
- package/src/primitives/toaster/toaster.d.ts.map +1 -1
- package/src/primitives/toaster/toaster.js +4 -4
- package/src/primitives/toaster/toaster.json +101 -0
- package/src/primitives/toaster/toaster.ts +5 -5
- package/src/primitives/toggle/toggle.css +2 -52
- package/src/primitives/toggle/toggle.json +84 -0
- package/src/primitives/toggle-group/toggle-group.css +1 -1
- package/src/primitives/toggle-group/toggle-group.json +41 -0
- package/src/primitives/toolbar/toolbar.json +26 -0
- package/src/primitives/tooltip/tooltip.css +6 -4
- package/src/primitives/tooltip/tooltip.json +85 -0
- package/src/primitives/utilities/aspect-ratio.html +3 -3
- package/src/primitives/utilities/basis.html +5 -5
- package/src/primitives/utilities/col-span.html +5 -5
- package/src/primitives/utilities/compose.html +3 -3
- package/src/primitives/utilities/flex-align.html +3 -3
- package/src/primitives/utilities/flex-direction.html +8 -8
- package/src/primitives/utilities/flex-grow.html +3 -3
- package/src/primitives/utilities/flex-reverse.html +8 -8
- package/src/primitives/utilities/gallery.html +19 -19
- package/src/primitives/utilities/gap.html +12 -12
- package/src/primitives/utilities/grid-cols.html +6 -6
- package/src/primitives/utilities/grid-responsive.html +9 -9
- package/src/primitives/utilities/inline-flex.html +2 -2
- package/src/primitives/utilities/margin-auto.html +1 -1
- package/src/primitives/utilities/object-fit.html +3 -3
- package/src/primitives/utilities/order.html +3 -3
- package/src/primitives/utilities/overflow.html +14 -14
- package/src/primitives/utilities/padding-compose.html +3 -3
- package/src/primitives/utilities/padding.html +4 -4
- package/src/primitives/utilities/position.html +1 -1
- package/src/primitives/utilities/responsive-flex.html +4 -4
- package/src/primitives/utilities/responsive-grid.html +9 -9
- package/src/primitives/utilities/size.html +5 -5
- package/src/primitives/utilities/subgrid-col.html +7 -7
- package/src/primitives/utilities/subgrid-row.html +9 -9
- package/src/primitives/utilities/subgrid.html +9 -9
- package/src/primitives/utilities/utilities.json +48 -0
- package/src/primitives/utilities/width.html +5 -5
- package/src/base/gesture.d.ts.map +0 -1
- package/src/base/hotkeys.d.ts.map +0 -1
- package/src/base/typeahead.d.ts.map +0 -1
- /package/src/{base → behaviors}/command-score.d.ts +0 -0
- /package/src/{base → behaviors}/command-score.d.ts.map +0 -0
- /package/src/{base → behaviors}/command-score.js +0 -0
- /package/src/{base → behaviors}/command-score.ts +0 -0
- /package/src/{base → behaviors}/hotkeys.js +0 -0
package/AUTHORING.md
CHANGED
|
@@ -15,7 +15,7 @@ State tokens (`data-<identity>-state="active open"`) are written by the kit's sc
|
|
|
15
15
|
|
|
16
16
|
## Identity
|
|
17
17
|
|
|
18
|
-
- One element, one or more tokens: `data-ui="card group"`.
|
|
18
|
+
- One element, one or more tokens: `data-ui="card group"`. Every primitive (`button`, `card`, `dialog`, `layout`, `link`…) is a token. `data-ui` says what an element is and holds identities only; anything that sets a value is a utility, and a typography role goes in `data-font`.
|
|
19
19
|
- `group` marks an ancestor for the `--group-*` utilities, and stacks on anything (`data-ui="card group"`). Its tag form is `<ui-group>`, a block; the attribute form keeps its host's display. A custom element never matches `:disabled`, so `<ui-group>` takes `aria-disabled="true"` with a role that allows it.
|
|
20
20
|
- Interactive primitives also have a tag form (`<ui-carousel>`, `<ui-tabs>`, `<ui-layout>`), and so does the card (`<ui-card>`). Use the tag where the wrapper would otherwise be a plain `div`; a card that is an article or a form stays `<article data-ui="card">` or `<form data-ui="card">`.
|
|
21
21
|
- Native elements keep their meaning: a button is a `<button data-ui="button">`, a dialog is a `<dialog data-ui="dialog">`, an input is `<input data-ui="input">`. Never put `data-ui="button"` on a `div`.
|
|
@@ -25,7 +25,7 @@ State tokens (`data-<identity>-state="active open"`) are written by the kit's sc
|
|
|
25
25
|
## Presets and slots
|
|
26
26
|
|
|
27
27
|
- A preset attribute only works on an element whose `data-ui` carries that identity (or the matching `ui-*` tag). `data-button-variant` on a bare `<button>` does nothing.
|
|
28
|
-
-
|
|
28
|
+
- Four primitives are native or attribute-based instead of a `data-ui` token: popovers are any `[popover]` element (`data-popover-side`, `data-popover-align`), typography roles are the values of `data-font`, reveal animations are the attributes `data-reveal` / `data-reveal-each` themselves, and `data-transition-layer` names view-transition groups.
|
|
29
29
|
- Slots sit on children, inside the identity: `<div data-ui="dialog"><header data-dialog-slot="header">`.
|
|
30
30
|
- One exception: a button that fires a primitive's custom command carries that primitive's attributes. `<button commandfor="toasts" command="--toast" data-toaster-title="Saved">` works because the toaster reads them off the button.
|
|
31
31
|
- Copy the real fragment for a primitive from `src/primitives/<name>/<name>.html` and adapt it. Do not reconstruct a primitive's anatomy from memory.
|
|
@@ -38,7 +38,7 @@ State tokens (`data-<identity>-state="active open"`) are written by the kit's sc
|
|
|
38
38
|
|
|
39
39
|
- **Tailwind's names, CSS values.** A utility is named after the Tailwind class it stands in for (`--justify`, `--items`, `--w`; `border-radius` is `--radius`) and takes the value its CSS property takes (`--justify: space-between`, `--w: 100%`, `--shadow: 0 1px 2px black`). Three exceptions: a bare number on spacing, margin, sizing, and radius utilities is a step on the spacing scale (next); `--font-weight` and `--radius` also take a token by name (`strong`, `full`); and `--display` takes `flex-col` and its siblings. The `var()` form of a token (`--shadow: var(--shadow-md)`) always works too. Coming from CSS rather than Tailwind? The docs have a [property-to-utility table](https://zazz.sh/docs/concepts/utilities-reference/).
|
|
40
40
|
- **Spelling is exact**: `--<utility>: value`, one space after the colon, declarations separated by `; `. The kit matches the attribute text, so `--px : 6` silently does nothing. A tier gate (`--p:`, `--md:`) reads the property itself and takes `--p:4`, but a keyword, a token by name, a `--display` shorthand, `--bg: none`, and `--position: sticky` match as text and need the one space: `--w:auto` is 0 wide and `--radius:full` stays square. React and Vue serialize an object `style` without the space, so in JSX or a Vue object write those values as a string `style` or as `var()` (`"--shadow": "var(--shadow-md)"`).
|
|
41
|
-
- **Numbers are scale steps** on spacing, margin, sizing, and radius utilities: `--px: 6` is `6 × --spacing`. The space tokens sit on that scale, so write their number and skip the `var()`: `--space-2xs` = 1, `xs` = 2, `sm` = 4, `md` = 6, `lg` = 11, `xl` = 24, `2xl` = 40 (`--gap: 4` is `--space-sm`). Radius steps also scale with `--radius-
|
|
41
|
+
- **Numbers are scale steps** on spacing, margin, sizing, and radius utilities: `--px: 6` is `6 × --spacing`. The space tokens sit on that scale, so write their number and skip the `var()`: `--space-2xs` = 1, `xs` = 2, `sm` = 4, `md` = 6, `lg` = 11, `xl` = 24, `2xl` = 40 (`--gap: 4` is `--space-sm`). Radius steps also scale with `--radius-coefficient`, and its tokens sit on the scale too: `--radius: 2.5` is `--radius-md` (0.5 2xs, 1 xs, 1.5 sm, 4.5 lg, 7 xl, 10 2xl). Any length works too: `--px: 1.5rem`, `--w: 100%`.
|
|
42
42
|
- **Prefer tokens and their shorthands**: scale numbers for spacing (above), `var(--color-<role>)` for color, radius numbers, `var(--font-size-*)`. Shadows: `--elevation: 4` is a height drawn as a four-layer box-shadow, and `--shadow: var(--shadow-md)` (or any box-shadow) is the explicit form (it wins over `--elevation`); `--shadow-tint: var(--color-primary)` tints an element's and its subtree's shadows, and `--color-shadow` on `:root` tints them all. `--font-weight` takes a token by name, at every tier: `--font-weight: strong` (also `heading`, `body`; standard names such as `medium` are not CSS, so write `500`). `--display` takes flex shorthands that set the direction too: `flex-row`, `flex-col`, their `-reverse` forms, and `inline-flex-…` (`--display: flex-col; --display--md: flex-row`); there is no `--flex-direction` utility. Raw values are the escape hatch.
|
|
43
43
|
- **Utilities need the `style` attribute to apply.** Under a strict Content Security Policy, allow it with `style-src-attr 'unsafe-inline'` and keep stylesheets locked with `style-src-elem`; where a policy blocks it anyway, `index.js` loads a fallback that copies each attribute into the CSSOM, at the cost of needing JavaScript. Markup that passes through a sanitizer which strips `style` should use presets, slots, and hooks set in a stylesheet instead. Every utility goes with the attribute, so `--sr: only` text shows on the page.
|
|
44
44
|
- **Names are short**, Tailwind-style where Tailwind has one: `--p --px --py --pt --pb --pl --pr`, `--m …`, `--w --h --size --min-w --max-w`, `--bg --text --border --border-color`, `--bg-linear --bg-radial --bg-conic --bg-stops`, `--mask-linear --mask-stops`, `--radius`, `--inset --inset-x --inset-y --top --right --bottom --left`, `--font-size --leading --tracking --font-weight`, `--items --justify --self`, `--place-items --place-content` (alignment keywords only, `safe end` included), `--grid-cols --grid-rows --col-span --col-start --col-end --row-span --row-start --row-end`, `--flex --basis --shrink`. Sides are `l`/`t`/`r`/`b` (`--pl`, `--mr`, `--border-l`); they set logical properties, so `l` is the right side in RTL. `--border: <color | number | length>` is a solid border: a color is 1px wide, a number is that many px in `--color-border`, a length is the width in `--color-border`; `--border-width` and `--border-color` win over it. A side takes only the shorthand: `--border-b: 1` is a one-line divider, `--border-l: var(--color-primary)` an accent edge (there is no `--border-b-width`). Borders between direct children go on the container: `--divide-y: 1`, `--divide-x: 2`, or `--divide: var(--color-muted)` for both axes. They take the `--border` grammar plus `none`, and an axis beats `--divide`. There are no width or color longhands. A child's border utilities override the divider (`--border-b: 0` clears one). `--divide: 1` on a single flex row draws a bottom border too, so use `--divide-x` there. Grids follow Tailwind: `--grid-cols` / `--grid-rows` take a count (`3` is three equal tracks; `none` is `--template-cols: none`); a track list goes in `--template-cols: 2fr 1fr` / `--template-rows`. A grid that takes its tracks from its parent grid is a display: `--display: subgrid` (both axes), `--display: subgrid-col` (columns), or `--display: subgrid-row` (rows). Span the parent's tracks with `--col-span` / `--row-span`. The axis it does not take keeps its own `--grid-cols` or `--grid-rows`. Across breakpoints the highest tier that names a display or a count decides: `--display: grid; --grid-cols: 2; --display--md: subgrid-col` is two columns below `md` and the parent's columns from there up, and `--display: subgrid-col; --grid-cols--lg: 3` is three columns from `lg`. At the same tier the display wins, so `--display: subgrid-col; --grid-cols: 3` ignores the count. Place items with `--col-span: 2` (`span 2 / span 2`), `--col-start: 2`, `--col-end: -1`, and the `--row-*` twins; span every track with `--col-start: 1; --col-end: -1` (Tailwind's `col-span-full`). `--display: grid` packs its rows at the top (`place-content: start stretch`), so don't add that pair yourself; write `--place-content` only for another alignment. The default stays off with `--place-items` or `--items`, so `--display: grid; --place-items: center` still centers a child in a sized box. A child's `--self: center` or `--self: end` needs `--place-content: normal` on its grid. Inside a layout, `--band: layout-md` puts a child in a band. Gradients pair a type with its stops: `--bg-linear: to bottom in oklch; --bg-stops: var(--color-shade-600), transparent 20%` (also `--bg-radial: circle at top`, `--bg-conic: from 45deg`); the type takes the gradient's prelude (direction, shape, position, `in <color-space> [<hue> hue]`), any of it optional but not all of it, and `--bg` stays the color underneath. `--bg: none` clears both the color and any gradient, at the base or a state (`--bg--hover: none`). Masks pair the same way: `--mask-linear: to bottom; --mask-stops: black 70%, transparent` fades the element out (no tiers). `--bg-clip` sets `background-clip` (no tiers): `--bg-clip: text; --text: transparent` shows the background, a gradient, through the text. The editor completes the full list (`editor/zazz.css-data.json`).
|
|
@@ -104,10 +104,10 @@ A few utilities break the family rule. `--divide`, `--divide-x`, and `--divide-y
|
|
|
104
104
|
|
|
105
105
|
Rules that bite:
|
|
106
106
|
|
|
107
|
-
1. **A tier needs a base.** `--text--hover: red` alone does nothing; write `--text: currentColor; --text--hover: red`. These utilities have a natural default on a plain element and work tier-only: `--p --px --py --pt --pb --pl --pr --bg --flex-wrap --shrink --grid-flow --auto-cols --auto-rows --items --justify --place-items --place-content --self --flex --basis --order --band --col-span --col-start --col-end --row-span --row-start --row-end --grid-cols --grid-rows --template-cols --template-rows --gap --gap-x --gap-y --text-align --text-wrap --text-decoration --opacity --filter --backdrop-filter --mix-blend --scale --translate --rotate --shadow --shadow-angle --ring --ring-color --ring-offset --ring-offset-color --focus-ring --elevation --radius --radius-t --radius-b --radius-l --radius-r --aspect --position --anchor-name --position-anchor --position-area --animation --divide --divide-x --divide-y --container --container-type --sr` (on any element where the kit does not set that property itself: `data-
|
|
107
|
+
1. **A tier needs a base.** `--text--hover: red` alone does nothing; write `--text: currentColor; --text--hover: red`. These utilities have a natural default on a plain element and work tier-only: `--p --px --py --pt --pb --pl --pr --bg --flex-wrap --shrink --grid-flow --auto-cols --auto-rows --items --justify --place-items --place-content --self --flex --basis --order --band --col-span --col-start --col-end --row-span --row-start --row-end --grid-cols --grid-rows --template-cols --template-rows --gap --gap-x --gap-y --text-align --text-wrap --text-decoration --opacity --filter --backdrop-filter --mix-blend --scale --translate --rotate --shadow --shadow-angle --ring --ring-color --ring-offset --ring-offset-color --focus-ring --elevation --radius --radius-t --radius-b --radius-l --radius-r --aspect --position --anchor-name --position-anchor --position-area --animation --divide --divide-x --divide-y --container --container-type --sr` (on any element where the kit does not set that property itself: `data-font="2xl" style="--opacity--hover: .8"` works, and so does `--opacity--hover` on a card). Where a primitive or the base does set it, its value wins over a tier alone: the tier then applies only if that rule reads the utility, as a button reads `--px` and `--bg`; otherwise write the base (`--bg--md` alone on a popover keeps the popover's paint). The tier-only rules sit in `@layer defaults`, below every component, vendor, and legacy layer (ADR-0017); the editor and `<ui-debug>` report a tier alone that has no effect. Margin, `--text`, and `--font-size` stay out: the base sets a heading's size, a link's color, and the margins between text blocks, and a tier-only value would reset those at rest.
|
|
108
108
|
2. **Breakpoints reach layout and color; states reach color and effects.** `--bg--md`, `--text--lg`, and `--px--md` exist; `--px--hover` and `--shadow--md` do not. The rings, the shadow's angle, `--elevation`, and `--radius` take breakpoints too: `--ring--md`, `--focus-ring--md`, `--shadow-angle--md`, `--elevation--md`, `--radius--md` (the corner utilities `--radius-t`, `-b`, `-l`, `-r` take breakpoints only). The anchor utilities take states too (`--anchor-name--hover`, `--position-area--open`), so editor chrome can follow the hovered block. On a color utility a state beats a breakpoint: `--bg--md: black; --bg--hover: gray` is gray on hover at any width.
|
|
109
109
|
3. **Keywords mix with numbers.** `--w: 4; --w--md: auto`, `--w: fit-content; --h: 4`, and `--bottom: 0; --bottom--lg: auto` all work: each keyword-bearing utility has explicit keyword rules per tier until CSS `if()` can branch on the value. Keywords must be spelled exactly (`--w--md: auto`). The side insets (`--top`, `--right`, `--bottom`, `--left`) take `auto`; `--inset`, `--inset-x`, and `--inset-y` take lengths only.
|
|
110
|
-
4. **A utility on a primitive flattens its states.** `--bg: red` on a button is red on hover too
|
|
110
|
+
4. **A utility on a primitive flattens its states.** `--bg: red` on a button is red on hover too, and it cuts that one button off from the theme. Don't write a utility for anything the primitive owns; set its hook (below).
|
|
111
111
|
5. **Breakpoints read the nearest container, not the window.** A tier answers to the closest inline-size container: the page's `html`, a layout band's child (so tiers inside a `layout-md` band follow the band), or any element with `--container-type: inline-size`. Thresholds are the `--layout-*` widths in rem, the same in any font: `sm` 40rem, `md` 48rem, `lg` 64rem, `xl` 80rem, `2xl` 96rem. Give a card, sidebar, or slot `--container-type: inline-size` and the tiers inside it follow its width. `--container` is the `name / type` shorthand, so `--container: inline-size` sets a name, not a type; on a sticky element use `--container-name` and `--container-type`, because the shorthand drops the scroll-state type. An element never queries itself: a container's own tiers read the container above it. A container cannot size itself from its content, so give it a definite or stretched width.
|
|
112
112
|
|
|
113
113
|
6. **Ring widths are signed pixels.** `--ring: 2` is a 2px ring and `--ring: -2` draws it inset; a length works too. A primitive's focus ring takes the same signed width from `--focus-ring` (`--focus-ring: -2` keeps it inside a clipping container), defaulting to the `--ring-width` token. `--shadow-angle` turns the direction shadows are cast in (`0deg` down, `90deg` left, `180deg` up) for the element's `--shadow` and `--elevation` and for the shadows in its subtree, primitives included. `--default-shadow-angle` on `:root` sets it for the whole page, and `--default-shadow-intensity`, `--default-shadow-blur`, and `--default-shadow-distance` (all `1`) scale every shadow's alpha, blur, and offset.
|
|
@@ -122,34 +122,47 @@ Every primitive reads `--ui-<identity>-<utility>` hooks that inherit and keep th
|
|
|
122
122
|
</nav>
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
### Don't restyle a primitive with utilities
|
|
126
|
+
|
|
127
|
+
A primitive owns a property when it declares a `--ui-<identity>-<utility>` hook for it, or when one of its presets (variant, size, orientation…) sets it. Never write the bare utility for an owned property on the primitive's element: no `--px`, `--py`, `--h`, `--radius`, `--bg`, `--text`, `--border-width`, or `--font-size` on a `data-ui="button"`. The utility bypasses the theme and flattens the states, so that one instance quietly drifts from every other button. The primitive's `<name>.json` (`hooks`, `attributes`) and the Hooks and Attributes tables on its docs page list what it owns.
|
|
128
|
+
|
|
129
|
+
Utilities the primitive doesn't hook are fine on it, because they place it rather than restyle it: margins, `--w` and `--max-w`, `--flex`, `--self`, grid placement, `--order`, and `--display` tiers that show or hide it at a breakpoint.
|
|
130
|
+
|
|
131
|
+
To change an owned property, in order:
|
|
132
|
+
|
|
133
|
+
1. **A preset**, if one already does it (`data-button-variant="outline"`).
|
|
134
|
+
2. **Ask the scope** when the change came from a request rather than from a preset. Should it apply to this one instance or to every instance of the primitive? Don't guess.
|
|
135
|
+
3. **One instance, or one region:** set the hook inline on the element or on the region's wrapper. Hooks take the same values as utilities, and the states keep working: `style="--ui-button-px: 2"`.
|
|
136
|
+
4. **Every instance:** set the hook on `:root` in the theme stylesheet (`--ui-button-px: 2`), or change the token it defaults to.
|
|
137
|
+
|
|
138
|
+
Size is not an instance change. Buttons and toggles have the default size and `icon`, and fields have one size. There is no small size, and a control in a row of others keeps the default. Never shrink or grow one control with hooks or utilities. A control that needs another size gets a size variant: a new `data-button-size` (and `data-toggle-size`) value. Ask the user where it lives: in the kit's stylesheets (the global primitives) or in the project's theme overrides. That value is the one `data-*` value you may add, and only once the user has named it and picked its scope.
|
|
126
139
|
|
|
127
140
|
## Layout and typography
|
|
128
141
|
|
|
129
142
|
- `data-ui="layout"` (or `<ui-layout>`) makes the element a band grid. Children default to the `xl` band. Change the default with `data-layout-size="md"`; place one child with `--band: layout-bleed | layout-full | layout-2xl … layout-sm`, responsive with `--band--md: layout-sm`. A layout nested in a layout aligns to the parent's bands.
|
|
130
|
-
- Native `h1`–`h6` carry their role automatically. Give any other element a role with `data-
|
|
143
|
+
- Native `h1`–`h6` carry their role automatically. Give any other element a role with `data-font`: `display`, `h1 … h6`, `eyebrow`, or a body size `2xs … 2xl` (`data-font="h3"`). One role per element. A role beats the font of the primitive it sits on (`data-ui="badge" data-font="sm"`). An inline link outside `prose` is `data-ui="link"` (`data-ui="link" data-font="sm"` adds a size). Override one property with a utility (`--font-size`, `--leading`, `--font-weight`); never rebuild a role from utilities.
|
|
131
144
|
- `data-ui="prose"` styles rich text inside it. Give a reading column `--max-w: var(--article-lg); --mx: auto`. `data-prose-slot="end"` on a wrapper ends prose for that subtree (a form or widget inside an article), and `data-prose-slot="start"` inside it turns prose back on. Both work only inside `data-ui="prose"`. `data-prose-size="sm"` (compact) or `"lg"` (reading) resizes one article's type and spacing; `--ui-prose-flow` scales only its spacing.
|
|
132
145
|
|
|
133
146
|
## Navigation
|
|
134
147
|
|
|
135
|
-
Pages navigate normally by default, with no transition. To animate full loads, add `@view-transition { navigation: auto; }` to the site's own CSS; `_view-transitions.css` styles it. To keep state across pages (a toast stack, a playing video, an open mini-cart), opt in with `<html data-
|
|
148
|
+
Pages navigate normally by default, with no transition. To animate full loads, add `@view-transition { navigation: auto; }` to the site's own CSS; `_view-transitions.css` styles it. To keep state across pages (a toast stack, a playing video, an open mini-cart), opt in with `<html data-navigation="swap">` on every page that should swap. A navigation between two opted-in pages replaces the whole `<body>` in place, except elements marked `data-navigation-persist="<id>"` that both pages contain: those keep their live DOM, state, and scroll offsets, and their links take `aria-current` from the new page. Nothing else persists, so headers and footers come from the new page unless marked. The window scrolls to the top (or the target) instantly; back and forward restore it.
|
|
136
149
|
|
|
137
|
-
A region whose content depends on the page, such as a section sidebar, should not persist:
|
|
150
|
+
A region whose content depends on the page, such as a section sidebar, should not persist: add `data-navigation-persist-mode="scroll"` beside its `data-navigation-persist="<id>"`. It renders from the new page and keeps only its scroll offset. Style current-page links with the `current` state (`aria-current`), so a persisted header updates too: `aria-current="page"` with `--bg: transparent; --bg--current: var(--color-muted)` on the link.
|
|
138
151
|
|
|
139
152
|
```html
|
|
140
|
-
<html data-
|
|
153
|
+
<html data-navigation="swap">
|
|
141
154
|
…
|
|
142
155
|
<body>
|
|
143
156
|
<header>…current-page links render fresh on every page…</header>
|
|
144
157
|
<main>…</main>
|
|
145
|
-
<ui-toaster data-
|
|
158
|
+
<ui-toaster data-navigation-persist="toaster"></ui-toaster>
|
|
146
159
|
</body>
|
|
147
160
|
</html>
|
|
148
161
|
```
|
|
149
162
|
|
|
150
|
-
If the page also runs htmx or a client router, put `data-
|
|
163
|
+
If the page also runs htmx or a client router, put `data-navigation="off"` on the regions that library drives (the nearest `data-navigation` ancestor wins), and call `Zazz.refresh(element)` after it inserts markup (`htmx.onLoad((el) => Zazz.refresh(el))`). Back and Forward into or out of an entry the page pushed with `history.pushState()`, or to one a script gave `history.state` (htmx's `{ htmx: true }`), are left to the page.
|
|
151
164
|
|
|
152
|
-
`<ui-debug>` lists the persisted elements on each page and warns about a missing or duplicate id, nested persisted elements, and `data-
|
|
165
|
+
`<ui-debug>` lists the persisted elements on each page and warns about a missing or duplicate id, nested persisted elements, and `data-navigation-persist` on a page without the opt-in. It checks scroll mode the same way, and flags one that sits inside a persisted element, which already keeps its scroll.
|
|
153
166
|
|
|
154
167
|
## Theme
|
|
155
168
|
|
|
@@ -158,9 +171,11 @@ If the page also runs htmx or a client router, put `data-ui-navigation="off"` on
|
|
|
158
171
|
## Do not
|
|
159
172
|
|
|
160
173
|
- Write a `class` for styling, or a `<style>` block, to get something the utilities can express.
|
|
174
|
+
- Set a utility for a property the primitive owns (a hook or preset covers it), such as `--px` or `--radius` on a button. Use the preset or the hook, and ask whether the change is for one instance or for all of them.
|
|
161
175
|
- Invent a `data-*` attribute or a custom property in `style` to style by. A `style` attribute holds only the kit's utilities and `--ui-<identity>-*` hooks; anything else (a token like `--code-border`, a property no utility covers) goes in a BEM-style class (`.block__element--modifier`) with plain CSS in your own stylesheet. `data-*` outside the kit's vocabulary is for your scripts' hooks and state, and the kit never reads `class`.
|
|
162
176
|
- Invent tokens: every `var(--…)` must exist in the kit (`src/base/_variables.css`, plus the generated `--shadow-*` tokens in `src/base/_shadows.css`).
|
|
163
|
-
- Use a retired `data-ui` token: `sr-only`, `pile`, `isolate`, `not-prose`, `truncate`, `spin`, `ping`, `pulse`, `bounce`, `divide-x`, `divide-y`, `container`, `theme-dark`, `theme-light
|
|
177
|
+
- Use a retired `data-ui` token: `sr-only`, `pile`, `isolate`, `not-prose`, `truncate`, `spin`, `ping`, `pulse`, `bounce`, `divide-x`, `divide-y`, `container`, `theme-dark`, `theme-light`, or a `text-*` role (`text-sm` is `data-font="sm"`, `text-link` is `data-ui="link"`). The `retired-token` audit rule names each replacement, and `eslint --fix` rewrites a `text-*` one where the element has a single role and no `data-font` yet.
|
|
178
|
+
- Give `data-font` anything but one role: `data-font="sm lg"` and `data-font="huge"` style nothing. The `font-role` audit rule lists the roles.
|
|
164
179
|
- Use 0.4 syntax: `class="ui-button"`, `data-variant`, `data-slot`, utility classes like `p-md` / `@md:grid-cols-3`, `.container`, `class="dark"`.
|
|
165
180
|
|
|
166
181
|
## Tools
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,167 @@
|
|
|
1
1
|
Notable changes to `@zazz-ui/core`, grouped by primitive or base scope under each version. The grouping is load-bearing: the `zazz-ui` CLI's `update` and `diff` print only the slice that touches the files you've vendored. Breaking entries are flagged **BREAKING** with a one-line migration note. During 0.x, a minor bump means at least one breaking entry (ADR-0010 has the full definition of "breaking").
|
|
2
2
|
|
|
3
|
+
## 0.16.0 (2026-11-27)
|
|
4
|
+
|
|
5
|
+
### button
|
|
6
|
+
|
|
7
|
+
- **BREAKING** The small sizes are gone: `data-button-size="sm"` and `"icon-sm"` no longer exist, so a button keeps the default size or `icon`. Remove `data-button-size="sm"` and change `"icon-sm"` to `"icon"`; `npx zazz-ui codemod small-sizes` does it for a whole project, or, if you'd rather keep the small sizes, adds their rules back (`--restore`). A button inside an input group or a password group needs no size: the group sizes it (below). A button that was `sm` in a table, toolbar, or row now takes the default height, so check those layouts. Nothing at runtime flags a leftover `"sm"`: the attribute is ignored and the button renders at the default size. For another size, add a size preset (a new `data-button-size` value); the zazz skill's "Control sizes" covers where it can live.
|
|
8
|
+
- New variants: `data-button-variant="neutral"` is a solid surface (white in light mode, `--color-neutral-950` in dark) raised by `--shadow-xs`, and steps one neutral shade at hover and again at active. `"faded"` is the translucent `--color-faded` overlay, for a button over an image or a colored surface; over the page itself it barely shows.
|
|
9
|
+
- `muted` deepens at hover and active (its alpha is multiplied by 1.66 at hover and 2 at active), where it used to fade toward the surface beneath. `faded` does the same.
|
|
10
|
+
- `secondary` steps darker at hover and active in light mode and lighter in dark, the reverse of `primary`, because the default palette now makes it a light fill in light mode (see base). A light secondary used to lighten by a step too small to see. A theme whose light-mode secondary is dark gets almost no hover step now, so it should set `--ui-button-bg--hover` and `--ui-button-bg--active` (and the badge's) itself.
|
|
11
|
+
|
|
12
|
+
### badge
|
|
13
|
+
|
|
14
|
+
- New `neutral` and `faded` variants, matching the button's. Badge and button resolve the same in every variant, these two included, so the badge's `muted` and `secondary` states change as the button's do (above).
|
|
15
|
+
|
|
16
|
+
### toggle
|
|
17
|
+
|
|
18
|
+
- **BREAKING** `data-toggle-size="sm"` and `"icon-sm"` are gone, as on the button. Remove `"sm"` and change `"icon-sm"` to `"icon"`. A toggle in an input-group addon is sized by the group.
|
|
19
|
+
|
|
20
|
+
### button-group
|
|
21
|
+
|
|
22
|
+
- Removed the unused `--_button-group-radius` private (only the button's `sm` size wrote it). The group's outer corners still follow `--ui-button-group-radius`.
|
|
23
|
+
|
|
24
|
+
### input-group
|
|
25
|
+
|
|
26
|
+
- A button or toggle in an addon takes its size from the shell. It sits `--ui-field-inset-p` inside the border, so it no longer makes the group taller, and it needs no size preset. An icon-only one keeps `data-button-size="icon"` (or `data-toggle-size="icon"`) and comes out square. On a touch screen it keeps its box and an invisible hit area takes the touch floor. The group sets the `--ui-button-*` and `--ui-toggle-*` metric hooks on the control itself, so an inline hook or utility on it still wins, and a popover or dialog opened from the addon (a menu's items) keeps its own sizes.
|
|
27
|
+
|
|
28
|
+
### password-group
|
|
29
|
+
|
|
30
|
+
- The toggle takes its size from the shell, as in the input group. Change `data-button-size="icon-sm"` on it to `"icon"`.
|
|
31
|
+
|
|
32
|
+
### font
|
|
33
|
+
|
|
34
|
+
- **BREAKING** Typography roles moved from `data-ui` tokens to the value of `data-font`: `data-ui="text-h3"` is now `data-font="h3"`, and the same for `display`, `h1`–`h6`, `2xl`–`2xs`, and `eyebrow`. Replace each `text-<role>` token with `data-font="<role>"`; an element that also has an identity keeps it (`data-ui="badge text-xs"` becomes `data-ui="badge" data-font="xs"`). One role per element. `npx zazz-ui codemod data-font` rewrites a project's markup and selectors and vendors the new primitives. The `retired-token` rule in `<ui-debug>` and the ESLint plugin names the replacement for each, and `eslint --fix` applies it where the element has one role, plain tokens, and no `data-font` yet.
|
|
35
|
+
- **BREAKING** The roles are a primitive, `font`, with its own stylesheet (`primitives/font/font.css`) in `ui.components`, where they were in the reset. A page that loads the kit per primitive adds it; `npx zazz-ui add font` vendors it.
|
|
36
|
+
- A role now beats the font of the primitive it sits on, where the primitive used to win: `data-font="sm"` on a badge, button, tooltip, or dialog takes effect. It also beats the font a primitive gives a slot (a tooltip's content, a field label). A `--font-size` utility still beats both. A role on a native heading wins whether it is larger or smaller than the heading (`<h5 data-font="h2">`). A larger role lost before.
|
|
37
|
+
|
|
38
|
+
### link
|
|
39
|
+
|
|
40
|
+
- **BREAKING** `data-ui="text-link"` is now the `link` identity, with its own stylesheet (`primitives/link/link.css`). Replace the token with `link`; with a size, `data-ui="text-sm text-link"` becomes `data-ui="link" data-font="sm"`.
|
|
41
|
+
|
|
42
|
+
### prose
|
|
43
|
+
|
|
44
|
+
- **BREAKING** Prose has its own stylesheet (`primitives/prose/prose.css`), where its rules were in `base/_typography.css`. A page that loads the kit per primitive adds `prose`, and `npx zazz-ui add prose` vendors it (with `font`, which it needs).
|
|
45
|
+
- A paragraph with a role takes the role's spacing (`<p data-font="h3">` is spaced as a heading). It took a paragraph's spacing before.
|
|
46
|
+
- A `data-font` role on a figure caption, a blockquote's `cite`, or an `hgroup` replaces the font prose gives it. Prose kept its own font before.
|
|
47
|
+
- `data-prose-size="sm"` reads its leading from `--leading-sm`, so `--leading-body-coefficient` reaches it. The default is still 1.5.
|
|
48
|
+
|
|
49
|
+
### navigation-menu
|
|
50
|
+
|
|
51
|
+
- The panel's links and submenu triggers take their padding and gap from new hooks: `--ui-navigation-menu-popover-child-px` and `--ui-navigation-menu-popover-child-py` (both `--space-xs`) and `--ui-navigation-menu-popover-child-gap` (one `--spacing` step: between a link's title and description, and between a submenu trigger's label and chevron). They used to be padded by `--ui-navigation-menu-popover-gap`.
|
|
52
|
+
- `--ui-navigation-menu-popover-gap` and `--ui-navigation-menu-popover-viewport-gap` default to `--space-xs`, where they were one and a half `--spacing` steps.
|
|
53
|
+
|
|
54
|
+
### tabs
|
|
55
|
+
|
|
56
|
+
- In a right-to-left page the horizontal arrow keys follow the writing direction: ArrowLeft moves to the next tab and ArrowRight to the previous one. They were not mirrored, so the keys moved against the visual order.
|
|
57
|
+
- The keys the script handles (the arrows along the list, Home, End) skip a tab marked `aria-disabled="true"`. The browser's own radio keys and a click still reach it, so use `disabled` to take a tab out.
|
|
58
|
+
- A vendored tabs script needs `behaviors/list-navigation.js`. `npx zazz-ui update` adds it.
|
|
59
|
+
- The indicator covers the checked label, one track padding in from the border: `--ui-tabs-indicator-inset` defaults to `0px`, where it was half the track padding. Its corners are concentric with the track's: `--ui-tabs-indicator-radius` is the track radius less the track border, the track padding, and the inset. It used to be the track radius less the padding alone, so its corners were rounder than the track's. The label has its own hook, `--ui-tabs-label-radius` (the track radius less the border and the padding), where it used to share the indicator's. It rounds the focus ring, and the checked tab where anchor positioning is missing.
|
|
60
|
+
|
|
61
|
+
### lightbox
|
|
62
|
+
|
|
63
|
+
- The thumbnail strip's previous and next buttons are `data-button-size="icon"`; they were `icon-sm`, so they are larger.
|
|
64
|
+
- The counter centers with logical insets and auto margins, where it used `left: 50%` and a translate. It sits in the same place, and a long count may now use the full width of the stage before it wraps, where it was held to half.
|
|
65
|
+
|
|
66
|
+
### menu
|
|
67
|
+
|
|
68
|
+
- The arrow keys skip a button disabled by an ancestor `<fieldset disabled>`. They stopped on it before, and it could not take focus.
|
|
69
|
+
- A vendored menu script needs `behaviors/list-navigation.js`. `npx zazz-ui update` adds it.
|
|
70
|
+
|
|
71
|
+
### drawer
|
|
72
|
+
|
|
73
|
+
- **BREAKING** `data-drawer-snap-sequential` is now `data-drawer-snap-behavior="sequential"`. Replace the attribute; any other value, or none, keeps the default, where a very fast flick goes all the way.
|
|
74
|
+
- On a touch screen, opening a drawer no longer focuses a field. A dialog focuses its first control when it opens; when that was a text field, iOS scrolled the page up to show it while the drawer was still below the screen, so the page jumped before the drawer rose. A drawer that holds a text field, a select, or a date, time, or color input now takes focus itself, so the keyboard stays down until a field is tapped. Put `autofocus` on a field to focus it on open anyway. With a mouse, and in a drawer without fields, the first control is focused as before.
|
|
75
|
+
|
|
76
|
+
### command
|
|
77
|
+
|
|
78
|
+
- **BREAKING** `data-command-stay-open` on an item is now `data-command-select-behavior="persist"`. Replace the attribute; without it, activating the item closes the panel as before.
|
|
79
|
+
|
|
80
|
+
### otp
|
|
81
|
+
|
|
82
|
+
- **BREAKING** `data-otp-auto-submit` is now `data-otp-submit-behavior="auto"`. Replace the attribute; without it, the form is submitted by its own button as before.
|
|
83
|
+
- **BREAKING** `data-otp-mask` needs a value: `data-otp-mask="true"` masks the cells. A bare `data-otp-mask` no longer does; add `="true"`.
|
|
84
|
+
|
|
85
|
+
### style-guard
|
|
86
|
+
|
|
87
|
+
- **BREAKING** `data-ui-guard="off"` is now `data-style-guard="off"`. Rename the attribute; it opts an element out of the style guard and of the CSP fallback (`base/csp.js`) as before.
|
|
88
|
+
|
|
89
|
+
### carousel
|
|
90
|
+
|
|
91
|
+
- **BREAKING** `data-carousel-drag-free="true"` is now `data-carousel-snap="free"`, and the default is `slide`. A thumb strip is still free by default; `data-carousel-thumbs-snap="slide"` makes it snap, where `data-carousel-thumbs-drag-free="false"` did.
|
|
92
|
+
- The drag opt-out (`data-draggable="false"`, formerly `data-ui-no-drag`; see base) applies inside a slide: a mouse press there does not drag the track. It did before, and is now documented and tested.
|
|
93
|
+
|
|
94
|
+
### toaster
|
|
95
|
+
|
|
96
|
+
- A toast's action button is the default size and its close button is `icon`; they were `sm` and `icon-sm`, so a toast is a little taller.
|
|
97
|
+
- The drag opt-out (`data-draggable="false"`, formerly `data-ui-no-drag`; see base) on `<ui-toaster>` keeps its toasts from being swiped away. It did before, and is now documented and tested.
|
|
98
|
+
|
|
99
|
+
### combobox
|
|
100
|
+
|
|
101
|
+
- A selection tag's label clips only along its length (`overflow-x: clip`), so its ellipsis still works and tall glyphs and descenders are no longer cut off at the top and bottom.
|
|
102
|
+
|
|
103
|
+
### debug
|
|
104
|
+
|
|
105
|
+
- New rule, `font-role`: a `data-font` value that is not exactly one role the kit styles. It reports an unknown role (`data-font="huge"`), two roles (`data-font="sm lg"`), an old token spelling (`data-font="text-sm"`), and a page that sets `data-font` without `primitives/font/font.css` loaded. `<ui-debug>` reads the roles from the page's stylesheets, and skips the rule when it finds no role and could not read every sheet (`font.css` may be the one it could not read, loaded cross-origin without `crossorigin`).
|
|
106
|
+
- `<ui-debug>` follows `@import` when it reads the page's stylesheets, so a page that loads `index.css` unbundled gets its identities, hooks, and roles. It found none there before, which silenced `attribute-outside-identity` and `flattens-state`.
|
|
107
|
+
- `auditNode` in `audit-core.js` takes the roles in its context (`roles`), and `audit()` in `debug.js` takes them as an option. `roles` is `null` when the roles are unknown. A finding can carry `attributes`, the attribute values that resolve it; the first `retired-token` finding for an element's `text-*` tokens does, when the rewrite is safe.
|
|
108
|
+
- The persistence checks read the renamed navigation attributes (see base). `auditPersistence` in `audit-core.js` takes a mode, `"element"` or `"scroll"`, in place of the attribute name, and its owner callback returns the carrying element's id.
|
|
109
|
+
|
|
110
|
+
### avatar
|
|
111
|
+
|
|
112
|
+
- Avatar is a primitive with its own stylesheet (`primitives/avatar/avatar.css`), where it was a utility composition. Put `data-ui="avatar"` on the root, `data-avatar-slot="image"` on the `<img>`, and `data-avatar-slot="fallback"` on the initials. The image covers the fallback, so the initials show when the markup has no image. A page that loads the kit per primitive adds it; `npx zazz-ui add avatar` vendors it. The old utility composition still renders, so existing markup keeps working until you move it over.
|
|
113
|
+
- Hooks: `--ui-avatar-size` (a scale number or a length), `--ui-avatar-radius`, `--ui-avatar-corner-shape`, `--ui-avatar-bg`, `--ui-avatar-border-width`, `--ui-avatar-border-style`, `--ui-avatar-border-color`, `--ui-avatar-font-size`, `--ui-avatar-font-weight`, `--ui-avatar-fallback-bg`, and `--ui-avatar-fallback-text`. The `--size`, `--radius`, `--bg`, border, and font utilities work on the root.
|
|
114
|
+
- The primitive defaults to 10 spacing steps (`--ui-avatar-size`) and `--font-size-sm`, where the old composition's examples used `--size: 11` and the inherited font size. Add `style="--size: 11"` to keep the old size.
|
|
115
|
+
|
|
116
|
+
### fields
|
|
117
|
+
|
|
118
|
+
- `--ui-field-inset-radius` (the radius of a part inset in a field, such as a tabs label or an input-group button) stops at `0px`. With a small field radius it used to go negative, so a part that subtracts from it, such as the tabs indicator's corners, came out wrong.
|
|
119
|
+
|
|
120
|
+
### slider
|
|
121
|
+
|
|
122
|
+
- The track has no visible border and a `--color-muted` fill: `--ui-slider-track-border-color` defaults to `transparent` and `--ui-slider-track-bg` to `--color-muted`, where both followed the field (`--ui-field-border-color`, `--ui-field-bg`). The border keeps its width, so the track's size doesn't change. Set the two hooks back to the `--ui-field-*` values for the old look.
|
|
123
|
+
- The track and thumb follow the field shape (`--ui-field-corner-shape`, which defaults to `--radius-corner-shape`). They were round before.
|
|
124
|
+
- A concave corner shape can no longer hide the thumb. `notch` or `superellipse(-2)` at a full radius cut a circle down to nothing. CSS can't read the number in `superellipse()`, so the track and thumb keep only the convex shapes they can name (`round`, `squircle`, `square`, `superellipse(1)`, `superellipse(1.3)`, `superellipse(2)`, `superellipse(infinity)`) and draw anything else round, including a convex value like `superellipse(2.5)` or a theme builder value between the listed steps. Matching is exact, so `superellipse(1.30)` draws round too. Only Chromium and Safari draw `corner-shape`, and both support the `if()` the check uses. A `--corner-shape` utility on the input now sets any shape on the track; it didn't reach the track before.
|
|
125
|
+
|
|
126
|
+
### switch
|
|
127
|
+
|
|
128
|
+
- The track and thumb follow the field shape: `--ui-switch-corner-shape` defaults to `--ui-field-corner-shape` instead of `round`. Set it back to `round` for the old look.
|
|
129
|
+
- The track and thumb keep a convex shape from the slider's list, so a concave theme shape can't hide the thumb.
|
|
130
|
+
- **BREAKING** `--ui-switch-thumb-size` is gone, split into `--ui-switch-thumb-w` and `--ui-switch-thumb-h`. Set both where you set the one; the thumb height used to follow the width.
|
|
131
|
+
- New `--ui-switch-w-coefficient` and `--ui-switch-h-coefficient` (both `1`) stretch the track and thumb together, so the gap around the thumb holds. A `--w` or `--h` utility on the switch still sets the size outright.
|
|
132
|
+
- The checked thumb has no border color: `--ui-switch-thumb-border-color--checked` and `--checked-hover` default to `transparent`, where they were the field's hover border color.
|
|
133
|
+
|
|
134
|
+
### progress
|
|
135
|
+
|
|
136
|
+
- The bar keeps a convex shape from the slider's list and draws any other shape round. The fill follows the bar. A `--corner-shape` utility still takes any shape.
|
|
137
|
+
|
|
138
|
+
### meter
|
|
139
|
+
|
|
140
|
+
- The bar keeps a convex shape from the slider's list and draws any other shape round. The fill follows the bar. A `--corner-shape` utility still takes any shape.
|
|
141
|
+
|
|
142
|
+
### base
|
|
143
|
+
|
|
144
|
+
- The default `secondary` and `tertiary` palettes change. `--color-secondary-*` is a neutral gray scale, and `--color-secondary` is `secondary-100` in light mode and `secondary-800` in dark, so it is a light fill in light mode. `--color-secondary-foreground` is `secondary-950` (near black) in light mode and white in dark. `--color-tertiary-*` is a violet scale, and `--color-tertiary` is `tertiary-500` in light mode and `tertiary-600` in dark, with white text in both. A theme that sets its own palettes is unaffected.
|
|
145
|
+
- The `--color-tint-*` overlays are white at each alpha, where they were `--color-neutral-50`, so a tinted neutral no longer reaches the dark-mode muted, faded, and input overlays.
|
|
146
|
+
- **BREAKING** The `*-multiplier` tokens are now `*-coefficient`: `--radius-multiplier` is `--radius-coefficient`, `--leading-heading-multiplier` is `--leading-heading-coefficient`, `--leading-body-multiplier` is `--leading-body-coefficient`, and `--paragraph-spacing-multiplier` is `--paragraph-spacing-coefficient`. The defaults and what they scale are unchanged. **Migration:** rename each token where your theme sets it. An old name still parses but does nothing.
|
|
147
|
+
- **BREAKING** `base/_typography.css` holds only the native `h1`–`h6` baselines. The fluid type scale (`--fluid`, `--typeset-base`, `--typeset-scale`, and every `--font-size-*`) is computed in `base/_variables.css`, so `_variables.css` no longer needs `_typography.css` loaded for `--spacing`. The values are unchanged.
|
|
148
|
+
- **BREAKING** The navigation attributes drop the `data-ui-` prefix: `data-ui-navigation="swap"` and `"off"` are now `data-navigation="swap"` and `"off"`, and `data-ui-persist="<id>"` is now `data-navigation-persist="<id>"`. Rename them on every page; a page left on the old names navigates with full loads.
|
|
149
|
+
- **BREAKING** `data-ui-persist-scroll="<id>"` is now `data-navigation-persist="<id>"` with `data-navigation-persist-mode="scroll"` on the same element. An element in scroll mode still comes from the new page and keeps only its scroll offset.
|
|
150
|
+
- **BREAKING** `data-ui-no-drag` is now `data-draggable="false"`. It still keeps a press inside the element from dragging a drawer, swiping a toast, or dragging a carousel. Replace it with `data-draggable="false"`; a bare `data-draggable` does nothing.
|
|
151
|
+
- Every primitive has a data file beside its stylesheet, `primitives/<name>/<name>.json`: its `data-ui` identities, tag forms, `--ui-*` hooks with their defaults (grouped by CSS property category), `data-*` attributes with their values, slots, states, the primitives it requires, and its files. The typography roles are the `data-font` values in `primitives/font/font.json`. The files are generated from the stylesheets, scripts, and examples. `npx zazz-ui add` and `update` vendor them from `zazz-ui` 0.3.4 on.
|
|
152
|
+
- The manifest lists the data files: `data` on each `PRIMITIVES` entry, and a new `BASE_DATA` export for data files no primitive owns (empty today).
|
|
153
|
+
- New `src/css-properties.json`: every standard CSS property that is not deprecated, grouped by category. The data files take their hook categories from it.
|
|
154
|
+
- `editor/zazz.language-data.json` gives a hook the default from the primitive it is named for. A hook another primitive overrides (for example `--ui-dialog-shadow` in the alert dialog, nine `--ui-popover-*` hooks in the navigation menu, three `--ui-kbd-*` hooks in the button) reported the override and that primitive's stylesheet.
|
|
155
|
+
- **BREAKING** Shared interaction scripts move from `base/` to a new `behaviors/` folder: `base/gesture.js`, `base/hotkeys.js`, `base/typeahead.js`, and `base/command-score.js` are now `behaviors/gesture.js`, `behaviors/hotkeys.js`, `behaviors/typeahead.js`, and `behaviors/command-score.js`. Their exports are unchanged. Change `base/` to `behaviors/` in any import of them (`import { bindHotkey } from "@zazz-ui/core/behaviors/hotkeys.js"`) and in any `<script>` tag or `modulepreload` that names one. In a vendored project, `npx zazz-ui update` vendors the new files, rewrites the entry script, and deletes the old ones. A file you edited is kept where it is (unless you pass `--theirs`) and no longer loaded, so copy your edits to its new path. Update the CLI first: a narrowed update (`update toaster`) needs `zazz-ui` 0.3.4 or later to vendor the new files.
|
|
156
|
+
- New `behaviors/list-navigation.js`: `listStep` maps a key to a step through a list (by orientation and writing direction), `stepIndex` gives the index a step lands on, and `isDisabledItem` tests an item the keys skip. The tabs, the menu, and `behaviors/typeahead.js` use it; `nextActiveIndex` is unchanged. Vendored autocomplete, combobox, and command scripts need the file too, and `npx zazz-ui update` adds it.
|
|
157
|
+
- New package export `@zazz-ui/core/behaviors/*`.
|
|
158
|
+
|
|
159
|
+
## 0.15.1 (2026-11-23)
|
|
160
|
+
|
|
161
|
+
### tooltip
|
|
162
|
+
|
|
163
|
+
- On a touch screen the tooltip hides only its content, not the whole `ui-tooltip`. Since 0.11.0 the trigger inside it was hidden too, so an icon button with a tooltip disappeared on phones.
|
|
164
|
+
|
|
3
165
|
## 0.15.0 (2026-11-18)
|
|
4
166
|
|
|
5
167
|
### base
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Zazz is a CSS and vanilla JavaScript UI kit that does not require a build step.
|
|
|
4
4
|
|
|
5
5
|
Docs: <https://zazz.sh> (guides, a [quick start](https://zazz.sh/docs/quick-start/), and an [API reference](https://zazz.sh/api/) generated from this package's data).
|
|
6
6
|
|
|
7
|
-
**Zazz is in alpha (0.
|
|
7
|
+
**Zazz is in alpha (0.16).** The markup contract can change in any minor release before 1.0, and 0.5 and later are not compatible with 0.4; see [`CHANGELOG.md`](./CHANGELOG.md) for every breaking change and its migration note.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ import "@zazz-ui/core"; // custom elements and shared behaviors
|
|
|
20
20
|
From a CDN, the script needs an import map for its one dependency and the Interest Invokers polyfill:
|
|
21
21
|
|
|
22
22
|
```html
|
|
23
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@zazz-ui/core@0.
|
|
23
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@zazz-ui/core@0.16.0/dist/zazz.css" />
|
|
24
24
|
<script type="importmap">
|
|
25
25
|
{
|
|
26
26
|
"imports": {
|
|
@@ -32,7 +32,7 @@ From a CDN, the script needs an import map for its one dependency and the Intere
|
|
|
32
32
|
type="module"
|
|
33
33
|
src="https://cdn.jsdelivr.net/npm/invokers@2.2.2/dist/esm/production/interest.js"
|
|
34
34
|
></script>
|
|
35
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@zazz-ui/core@0.
|
|
35
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@zazz-ui/core@0.16.0/dist/zazz.js"></script>
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
Use an exact version in CDN URLs. Under a strict `script-src`, give the import map and the theme script the response's nonce (`buildHead({ nonce })` does); the docs' [security page](https://zazz.sh/docs/install/security/) has the full policy, including `style-src-attr` for the utilities. The [installation guide](https://zazz.sh/docs/install/installation/) has the complete `<head>`, with fonts, the theme script, a per-primitive variant, and integrity hashes on every URL; `buildHead({ cdn: { version } })` from `@zazz-ui/core/head` returns the same markup. Each release also includes `dist/sri.json` with the SHA-384 hash of every published file.
|
|
@@ -44,7 +44,7 @@ pnpm dlx zazz-ui init
|
|
|
44
44
|
pnpm dlx zazz-ui add button card dialog
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
Each primitive is a folder under `src/primitives/<name>/` with its stylesheet, script, and HTML examples, so copying by hand works too.
|
|
47
|
+
Each primitive is a folder under `src/primitives/<name>/` with its stylesheet, script, data file (`<name>.json`: hooks, attributes, slots, and states), and HTML examples, so copying by hand works too.
|
|
48
48
|
|
|
49
49
|
## Usage
|
|
50
50
|
|
|
@@ -119,7 +119,8 @@ src/
|
|
|
119
119
|
├── index.css stylesheet entry: @imports base + every primitive in cascade order
|
|
120
120
|
├── index.js script entry: registers every custom element / behavior
|
|
121
121
|
├── base/ tokens, reset, typography, utilities, layout + shared runtime
|
|
122
|
-
|
|
122
|
+
├── behaviors/ interaction logic primitives share: list navigation, gestures, typeahead, hotkeys
|
|
123
|
+
└── primitives/<name>/ one folder per primitive: <name>.css, <name>.ts, <name>.json, examples (.html)
|
|
123
124
|
dist/
|
|
124
125
|
├── zazz.css flattened single-file bundle (loaded by CDN tags)
|
|
125
126
|
├── zazz.js
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t,n){for(;t<n&&/\s/.test(e[t]);)t++;for(;n>t&&/\s/.test(e[n-1]);)n--;return[t,n]}const t=/!\s*important$/i;function n(n){let r=[],i=(i,a)=>{let o=e(n,i,a);if(o[0]===o[1])return;let s=n.indexOf(`:`,o[0]),c=s!==-1&&s<o[1],l=c?e(n,o[0],s):o,u=c?e(n,s+1,o[1]):[o[1],o[1]],d=n.slice(...u);r.push({span:o,name:n.slice(...l),nameSpan:l,colon:c?s:-1,value:d,valueSpan:u,priority:t.test(d)?`important`:``})},a=0,o=null,s=0;for(let e=0;e<n.length;e++){let t=n[e];o?t===`\\`?e++:t===o&&(o=null):t===`"`||t===`'`?o=t:t===`(`?a++:t===`)`?a=Math.max(0,a-1):t===`;`&&a===0&&(i(s,e),s=e+1)}return i(s,n.length),r}function r({value:e}){return e.replace(t,``).trimEnd()}function i(e){if(!(`style`in e))return!1;let t=e.getAttribute(`style`);return!!t&&t.includes(`:`)&&e.style.length===0}function a(e=document){for(let t of e.querySelectorAll(`[style]`))if(i(t))return!0;return!1}function o(e){let t=/* @__PURE__ */ new Map;for(let i of n(e))i.colon!==-1&&t.set(i.name,[r(i),i.priority]);return t}function s(e,t){let{style:n}=e;if(n.length!==t.size)return!1;for(let[e,[r,i]]of t)if(n.getPropertyValue(e).trim()!==r.trim()||n.getPropertyPriority(e)!==i)return!1;return!0}function c(e){if(!(`style`in e)||e.getAttribute(`data-
|
|
1
|
+
function e(e,t,n){for(;t<n&&/\s/.test(e[t]);)t++;for(;n>t&&/\s/.test(e[n-1]);)n--;return[t,n]}const t=/!\s*important$/i;function n(n){let r=[],i=(i,a)=>{let o=e(n,i,a);if(o[0]===o[1])return;let s=n.indexOf(`:`,o[0]),c=s!==-1&&s<o[1],l=c?e(n,o[0],s):o,u=c?e(n,s+1,o[1]):[o[1],o[1]],d=n.slice(...u);r.push({span:o,name:n.slice(...l),nameSpan:l,colon:c?s:-1,value:d,valueSpan:u,priority:t.test(d)?`important`:``})},a=0,o=null,s=0;for(let e=0;e<n.length;e++){let t=n[e];o?t===`\\`?e++:t===o&&(o=null):t===`"`||t===`'`?o=t:t===`(`?a++:t===`)`?a=Math.max(0,a-1):t===`;`&&a===0&&(i(s,e),s=e+1)}return i(s,n.length),r}function r({value:e}){return e.replace(t,``).trimEnd()}function i(e){if(!(`style`in e))return!1;let t=e.getAttribute(`style`);return!!t&&t.includes(`:`)&&e.style.length===0}function a(e=document){for(let t of e.querySelectorAll(`[style]`))if(i(t))return!0;return!1}function o(e){let t=/* @__PURE__ */ new Map;for(let i of n(e))i.colon!==-1&&t.set(i.name,[r(i),i.priority]);return t}function s(e,t){let{style:n}=e;if(n.length!==t.size)return!1;for(let[e,[r,i]]of t)if(n.getPropertyValue(e).trim()!==r.trim()||n.getPropertyPriority(e)!==i)return!1;return!0}function c(e){if(!(`style`in e)||e.getAttribute(`data-style-guard`)===`off`)return;let t=e,n=o(e.getAttribute(`style`)??``);if(!s(t,n)){for(let e of[...t.style].reverse())t.style.removeProperty(e);for(let[e,[r,i]]of n)t.style.setProperty(e,r,i)}}function l(e){return e.nodeType===1}function u(e){l(e)&&c(e);for(let t of e.querySelectorAll(`[style]`))c(t)}let d=null;function f(e){for(let t of e){t.type===`attributes`&&l(t.target)&&c(t.target);for(let e of t.addedNodes)l(e)&&u(e)}}const p={blockedInlineStyles:a,applyInlineStyles:c,start(e=document.body){p.stop(),u(e),d=new MutationObserver(f),d.observe(e,{attributes:!0,attributeFilter:[`style`],childList:!0,subtree:!0})},stop(){d?.disconnect(),d=null}};typeof window<`u`&&typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>p.start()):p.start());export{p as Csp};
|