@zazz-ui/core 0.4.0 → 0.5.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 +158 -0
- package/CHANGELOG.md +341 -0
- package/README.md +55 -23
- package/dist/scroll-state-C8mA5gq6.js +1 -0
- package/dist/sri.json +124 -72
- package/dist/zazz.css +1 -1
- package/dist/zazz.js +1 -1
- package/editor/zazz.css-data.json +116794 -0
- package/editor/zazz.html-data.json +1683 -0
- package/editor/zazz.language-data.json +5001 -0
- package/editor/zazz.lint-data.json +152 -0
- package/package.json +12 -5
- package/src/base/_breakpoints.css +12 -0
- package/src/base/_layers.css +8 -9
- package/src/base/_properties-2xl.css +171 -0
- package/src/base/_properties-active.css +107 -0
- package/src/base/_properties-checked.css +107 -0
- package/src/base/_properties-current.css +107 -0
- package/src/base/_properties-disabled.css +107 -0
- package/src/base/_properties-focus-visible.css +107 -0
- package/src/base/_properties-focus-within.css +107 -0
- package/src/base/_properties-hover.css +107 -0
- package/src/base/_properties-lg.css +171 -0
- package/src/base/_properties-md.css +171 -0
- package/src/base/_properties-open.css +107 -0
- package/src/base/_properties-sm.css +171 -0
- package/src/base/_properties-starting.css +55 -0
- package/src/base/_properties-stuck.css +55 -0
- package/src/base/_properties-xl.css +171 -0
- package/src/base/_properties.css +555 -0
- package/src/base/_reset.css +67 -75
- package/src/base/_switches.css +145 -0
- package/src/base/_typography.css +437 -370
- package/src/base/_utilities-box.css +142 -0
- package/src/base/_utilities-color.css +290 -0
- package/src/base/_utilities-effects.css +235 -0
- package/src/base/_utilities-flow.css +312 -0
- package/src/base/_utilities-grid.css +143 -0
- package/src/base/_utilities-margin.css +376 -0
- package/src/base/_utilities-pseudo.css +426 -0
- package/src/base/_utilities-sizing.css +259 -0
- package/src/base/_utilities-spacing.css +190 -0
- package/src/base/_utilities-tier-2xl.css +93 -0
- package/src/base/_utilities-tier-active.css +61 -0
- package/src/base/_utilities-tier-checked.css +61 -0
- package/src/base/_utilities-tier-current.css +61 -0
- package/src/base/_utilities-tier-disabled.css +61 -0
- package/src/base/_utilities-tier-focus-visible.css +61 -0
- package/src/base/_utilities-tier-focus-within.css +61 -0
- package/src/base/_utilities-tier-hover.css +63 -0
- package/src/base/_utilities-tier-lg.css +93 -0
- package/src/base/_utilities-tier-md.css +93 -0
- package/src/base/_utilities-tier-open.css +61 -0
- package/src/base/_utilities-tier-sm.css +93 -0
- package/src/base/_utilities-tier-starting.css +35 -0
- package/src/base/_utilities-tier-stuck.css +114 -0
- package/src/base/_utilities-tier-xl.css +93 -0
- package/src/base/_utilities-typography.css +141 -0
- package/src/base/_variables.css +323 -372
- package/src/base/_view-transitions.css +10 -12
- package/src/base/command-score.d.ts.map +1 -1
- package/src/base/command-score.js +1 -2
- package/src/base/command-score.ts +1 -2
- package/src/base/dialog-lifecycle.js +1 -1
- package/src/base/dialog-lifecycle.ts +1 -1
- package/src/base/embla.d.ts +6 -7
- package/src/base/embla.d.ts.map +1 -1
- package/src/base/embla.js +89 -55
- package/src/base/embla.ts +89 -55
- package/src/base/hotkeys.d.ts +0 -5
- package/src/base/hotkeys.d.ts.map +1 -1
- package/src/base/hotkeys.ts +0 -5
- package/src/base/navigation.d.ts +12 -1
- package/src/base/navigation.d.ts.map +1 -1
- package/src/base/navigation.js +229 -86
- package/src/base/navigation.ts +224 -92
- package/src/base/reveal.js +14 -14
- package/src/base/reveal.ts +14 -14
- package/src/base/scroll-state.d.ts +21 -0
- package/src/base/scroll-state.d.ts.map +1 -0
- package/src/base/scroll-state.js +177 -0
- package/src/base/scroll-state.ts +188 -0
- package/src/base/signals.d.ts +1 -2
- package/src/base/signals.d.ts.map +1 -1
- package/src/base/signals.js +4 -6
- package/src/base/signals.ts +4 -6
- package/src/base/style-format.d.ts +33 -0
- package/src/base/style-format.d.ts.map +1 -0
- package/src/base/style-format.js +160 -0
- package/src/base/style-format.ts +180 -0
- package/src/base/typeahead.d.ts +19 -4
- package/src/base/typeahead.d.ts.map +1 -1
- package/src/base/typeahead.js +68 -21
- package/src/base/typeahead.ts +73 -23
- package/src/base/utilities.d.ts +188 -0
- package/src/base/utilities.d.ts.map +1 -0
- package/src/base/utilities.js +750 -0
- package/src/base/utilities.ts +865 -0
- package/src/base/utils.d.ts +3 -7
- package/src/base/utils.d.ts.map +1 -1
- package/src/base/utils.js +4 -8
- package/src/base/utils.ts +4 -8
- package/src/base/zazz-element.d.ts +14 -8
- package/src/base/zazz-element.d.ts.map +1 -1
- package/src/base/zazz-element.js +14 -8
- package/src/base/zazz-element.ts +15 -8
- package/src/globals.d.ts +1 -1
- package/src/head.d.ts +50 -4
- package/src/head.d.ts.map +1 -1
- package/src/head.js +119 -38
- package/src/head.ts +172 -41
- package/src/index.css +57 -14
- package/src/index.js +5 -0
- package/src/index.ts +6 -0
- package/src/manifest.d.ts +36 -5
- package/src/manifest.d.ts.map +1 -1
- package/src/manifest.js +150 -6
- package/src/manifest.ts +167 -9
- package/src/primitives/accordion/accordion.css +18 -17
- package/src/primitives/accordion/accordion.html +42 -9
- package/src/primitives/alert-dialog/alert-dialog.css +13 -13
- package/src/primitives/alert-dialog/alert-dialog.html +26 -12
- package/src/primitives/autocomplete/autocomplete-groups.html +64 -33
- package/src/primitives/autocomplete/autocomplete.css +45 -43
- package/src/primitives/autocomplete/autocomplete.d.ts +6 -5
- package/src/primitives/autocomplete/autocomplete.d.ts.map +1 -1
- package/src/primitives/autocomplete/autocomplete.html +38 -26
- package/src/primitives/autocomplete/autocomplete.js +6 -5
- package/src/primitives/autocomplete/autocomplete.ts +6 -5
- package/src/primitives/avatar/avatar.html +110 -15
- package/src/primitives/badge/badge-icon.html +22 -8
- package/src/primitives/badge/badge.css +401 -128
- package/src/primitives/badge/badge.html +12 -6
- package/src/primitives/breadcrumbs/breadcrumbs.html +25 -5
- package/src/primitives/button/button-icon-only.html +17 -11
- package/src/primitives/button/button-icon.html +9 -3
- package/src/primitives/button/button.css +408 -164
- package/src/primitives/button/button.html +14 -7
- package/src/primitives/button-group/button-group-vertical.html +5 -5
- package/src/primitives/button-group/button-group.css +53 -25
- package/src/primitives/button-group/button-group.html +18 -12
- package/src/primitives/callout/callout.css +114 -0
- package/src/primitives/callout/callout.html +188 -0
- package/src/primitives/card/card-subgrid.html +249 -34
- package/src/primitives/card/card.css +125 -0
- package/src/primitives/card/card.html +141 -20
- package/src/primitives/carousel/carousel.css +30 -20
- package/src/primitives/carousel/carousel.d.ts +7 -10
- package/src/primitives/carousel/carousel.d.ts.map +1 -1
- package/src/primitives/carousel/carousel.html +420 -84
- package/src/primitives/carousel/carousel.js +1 -1
- package/src/primitives/carousel/carousel.ts +8 -11
- package/src/primitives/checkbox/checkbox-tasklist.html +6 -6
- package/src/primitives/checkbox/checkbox.css +98 -40
- package/src/primitives/checkbox/checkbox.d.ts.map +1 -1
- package/src/primitives/checkbox/checkbox.html +13 -8
- package/src/primitives/checkbox/checkbox.js +7 -9
- package/src/primitives/checkbox/checkbox.ts +7 -15
- package/src/primitives/combobox/combobox-multiselect.html +53 -33
- package/src/primitives/combobox/combobox.css +147 -126
- package/src/primitives/combobox/combobox.d.ts +12 -11
- package/src/primitives/combobox/combobox.d.ts.map +1 -1
- package/src/primitives/combobox/combobox.html +48 -28
- package/src/primitives/combobox/combobox.js +46 -51
- package/src/primitives/combobox/combobox.ts +48 -55
- package/src/primitives/command/command-actions.d.ts +2 -3
- package/src/primitives/command/command-actions.d.ts.map +1 -1
- package/src/primitives/command/command-actions.html +48 -33
- package/src/primitives/command/command-actions.js +12 -10
- package/src/primitives/command/command-actions.ts +12 -13
- package/src/primitives/command/command-dialog.html +49 -25
- package/src/primitives/command/command.css +52 -42
- package/src/primitives/command/command.d.ts +10 -7
- package/src/primitives/command/command.d.ts.map +1 -1
- package/src/primitives/command/command.html +95 -46
- package/src/primitives/command/command.js +30 -13
- package/src/primitives/command/command.ts +30 -12
- package/src/primitives/debug/audit-core.d.ts +64 -0
- package/src/primitives/debug/audit-core.d.ts.map +1 -0
- package/src/primitives/debug/audit-core.js +356 -0
- package/src/primitives/debug/audit-core.ts +535 -0
- package/src/primitives/debug/debug.d.ts +50 -0
- package/src/primitives/debug/debug.d.ts.map +1 -0
- package/src/primitives/debug/debug.js +168 -0
- package/src/primitives/debug/debug.ts +211 -0
- package/src/primitives/dialog/dialog-with-form.html +67 -45
- package/src/primitives/dialog/dialog.css +87 -61
- package/src/primitives/dialog/dialog.html +25 -17
- package/src/primitives/fields/fields.css +108 -134
- package/src/primitives/fields/fields.html +39 -0
- package/src/primitives/input/input-icon-leading.html +3 -3
- package/src/primitives/input/input-icon-trailing.html +3 -3
- package/src/primitives/input/input.css +87 -49
- package/src/primitives/input/input.html +15 -15
- package/src/primitives/input-group/input-group-password-group.html +15 -15
- package/src/primitives/input-group/input-group.css +118 -75
- package/src/primitives/input-group/input-group.html +42 -30
- package/src/primitives/kbd/kbd-group.html +15 -2
- package/src/primitives/kbd/kbd.css +44 -31
- package/src/primitives/kbd/kbd.html +7 -1
- package/src/primitives/layout/layout.css +159 -0
- package/src/primitives/layout/layout.html +35 -0
- package/src/primitives/lightbox/lightbox.css +178 -105
- package/src/primitives/lightbox/lightbox.d.ts.map +1 -1
- package/src/primitives/lightbox/lightbox.html +138 -166
- package/src/primitives/lightbox/lightbox.js +10 -13
- package/src/primitives/lightbox/lightbox.ts +12 -13
- package/src/primitives/menu/menu-interest.html +60 -18
- package/src/primitives/menu/menu.css +22 -17
- package/src/primitives/menu/menu.d.ts +5 -5
- package/src/primitives/menu/menu.html +195 -40
- package/src/primitives/menu/menu.js +8 -8
- package/src/primitives/menu/menu.ts +8 -8
- package/src/primitives/menubar/menubar-help-search.html +78 -32
- package/src/primitives/menubar/menubar.html +166 -38
- package/src/primitives/meter/meter.css +41 -38
- package/src/primitives/meter/meter.html +44 -9
- package/src/primitives/mobile-menu/mobile-menu.css +47 -40
- package/src/primitives/mobile-menu/mobile-menu.html +1460 -179
- package/src/primitives/navigation-menu/navigation-menu-featured.html +155 -33
- package/src/primitives/navigation-menu/navigation-menu-icon-grid.html +222 -47
- package/src/primitives/navigation-menu/navigation-menu-interest.html +130 -38
- package/src/primitives/navigation-menu/navigation-menu-megamenu.html +402 -72
- package/src/primitives/navigation-menu/navigation-menu-simple.html +90 -40
- package/src/primitives/navigation-menu/navigation-menu.css +104 -106
- package/src/primitives/navigation-menu/navigation-menu.html +554 -158
- package/src/primitives/otp/otp.css +43 -44
- package/src/primitives/otp/otp.d.ts +4 -5
- package/src/primitives/otp/otp.d.ts.map +1 -1
- package/src/primitives/otp/otp.html +7 -6
- package/src/primitives/otp/otp.js +13 -18
- package/src/primitives/otp/otp.ts +12 -19
- package/src/primitives/password-group/password-group.css +132 -107
- package/src/primitives/password-group/password-group.d.ts.map +1 -1
- package/src/primitives/password-group/password-group.html +23 -16
- package/src/primitives/password-group/password-group.js +11 -12
- package/src/primitives/password-group/password-group.ts +11 -12
- package/src/primitives/popover/popover.css +89 -95
- package/src/primitives/popover/popover.html +18 -0
- package/src/primitives/progress/progress-indeterminate.html +1 -1
- package/src/primitives/progress/progress.css +34 -35
- package/src/primitives/progress/progress.html +18 -4
- package/src/primitives/prose/prose.html +19 -12
- package/src/primitives/radio/radio.css +83 -46
- package/src/primitives/radio/radio.html +16 -11
- package/src/primitives/reveal/reveal.css +37 -46
- package/src/primitives/reveal/reveal.html +15 -0
- package/src/primitives/scroll-fade/scroll-fade.css +115 -0
- package/src/primitives/scroll-fade/scroll-fade.html +69 -0
- package/src/primitives/select/multiselect.d.ts +8 -10
- package/src/primitives/select/multiselect.d.ts.map +1 -1
- package/src/primitives/select/multiselect.js +23 -27
- package/src/primitives/select/multiselect.ts +23 -29
- package/src/primitives/select/select-align.html +79 -16
- package/src/primitives/select/select-multiple.html +8 -4
- package/src/primitives/select/select-sides.html +104 -21
- package/src/primitives/select/select.css +299 -191
- package/src/primitives/select/select.html +24 -5
- package/src/primitives/separator/separator.css +15 -18
- package/src/primitives/separator/separator.html +37 -10
- package/src/primitives/slider/slider.css +48 -38
- package/src/primitives/slider/slider.html +9 -1
- package/src/primitives/style-guard/style-guard.d.ts +19 -0
- package/src/primitives/style-guard/style-guard.d.ts.map +1 -0
- package/src/primitives/style-guard/style-guard.js +125 -0
- package/src/primitives/style-guard/style-guard.ts +153 -0
- package/src/primitives/switch/switch.css +42 -33
- package/src/primitives/switch/switch.html +11 -6
- package/src/primitives/table/table-alternating.html +1 -1
- package/src/primitives/table/table-grid.html +5 -5
- package/src/primitives/table/table-size-sm.html +1 -1
- package/src/primitives/table/table.css +64 -61
- package/src/primitives/table/table.html +7 -7
- package/src/primitives/tabs/tabs.css +167 -166
- package/src/primitives/tabs/tabs.d.ts +10 -11
- package/src/primitives/tabs/tabs.d.ts.map +1 -1
- package/src/primitives/tabs/tabs.html +192 -36
- package/src/primitives/tabs/tabs.js +14 -15
- package/src/primitives/tabs/tabs.ts +14 -15
- package/src/primitives/textarea/textarea.css +69 -44
- package/src/primitives/textarea/textarea.html +3 -3
- package/src/primitives/toaster/toaster.css +90 -92
- package/src/primitives/toaster/toaster.d.ts +0 -6
- package/src/primitives/toaster/toaster.d.ts.map +1 -1
- package/src/primitives/toaster/toaster.html +22 -18
- package/src/primitives/toaster/toaster.js +64 -72
- package/src/primitives/toaster/toaster.ts +71 -87
- package/src/primitives/toggle/toggle.css +368 -153
- package/src/primitives/toggle/toggle.html +27 -9
- package/src/primitives/toggle-group/toggle-group-multiple.html +3 -3
- package/src/primitives/toggle-group/toggle-group-vertical.html +4 -4
- package/src/primitives/toggle-group/toggle-group.css +71 -23
- package/src/primitives/toggle-group/toggle-group.html +3 -3
- package/src/primitives/toolbar/toolbar.html +35 -13
- package/src/primitives/tooltip/tooltip-disabled.html +3 -3
- package/src/primitives/tooltip/tooltip-sides.html +36 -14
- package/src/primitives/tooltip/tooltip-with-kbd.html +5 -5
- package/src/primitives/tooltip/tooltip.css +111 -80
- package/src/primitives/tooltip/tooltip.html +3 -3
- package/src/primitives/utilities/aspect-ratio.html +51 -7
- package/src/primitives/utilities/basis.html +64 -11
- package/src/primitives/utilities/col-span.html +65 -9
- package/src/primitives/utilities/compose.html +48 -10
- package/src/primitives/utilities/flex-align.html +89 -19
- package/src/primitives/utilities/flex-direction.html +111 -13
- package/src/primitives/utilities/flex-grow.html +41 -7
- package/src/primitives/utilities/gap.html +158 -19
- package/src/primitives/utilities/grid-cols.html +75 -7
- package/src/primitives/utilities/grid-responsive.html +111 -12
- package/src/primitives/utilities/margin-auto.html +38 -7
- package/src/primitives/utilities/object-fit.html +75 -13
- package/src/primitives/utilities/order.html +40 -4
- package/src/primitives/utilities/overflow.html +74 -20
- package/src/primitives/utilities/padding-compose.html +67 -10
- package/src/primitives/utilities/padding.html +84 -13
- package/src/primitives/utilities/pile.html +29 -0
- package/src/primitives/utilities/position.html +65 -8
- package/src/primitives/utilities/responsive-flex.html +54 -7
- package/src/primitives/utilities/responsive-grid.html +115 -12
- package/src/primitives/utilities/size.html +120 -16
- package/src/primitives/utilities/width.html +123 -16
- package/examples/about.html +0 -583
- package/examples/components.html +0 -1028
- package/examples/forms.html +0 -504
- package/examples/index.html +0 -261
- package/examples/layout.html +0 -313
- package/examples/products.html +0 -839
- package/examples/responsive.html +0 -332
- package/src/base/_layout.css +0 -571
- package/src/base/_utilities.css +0 -6758
- package/src/primitives/utilities/grid-pile.html +0 -5
package/AUTHORING.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Authoring markup with Zazz 0.5
|
|
2
|
+
|
|
3
|
+
How to write HTML for the Zazz kit: identities, presets, slots, and style utilities. This is the single source for humans, editor rules, and AI assistants. The contract behind it is `SPEC.md`; the vocabulary is `CONTEXT.md`.
|
|
4
|
+
|
|
5
|
+
Zazz markup has no classes. Every styling decision is one of four things:
|
|
6
|
+
|
|
7
|
+
| What | Where | Example |
|
|
8
|
+
| --------------------------- | ------------------------------ | -------------------------------------------------------- |
|
|
9
|
+
| **Identity**: what it is | `data-ui` (space-separated) | `data-ui="button"`, `data-ui="card group"` |
|
|
10
|
+
| **Preset**: a named variant | `data-<identity>-<key>` | `data-button-variant="primary"`, `data-layout-size="xl"` |
|
|
11
|
+
| **Slot**: a part inside it | `data-<identity>-slot` | `<header data-dialog-slot="header">` |
|
|
12
|
+
| **Utility**: one value | `style="--<utility>: <value>"` | `style="--px: 6; --bg: var(--color-muted)"` |
|
|
13
|
+
|
|
14
|
+
State tokens (`data-<identity>-state="active open"`) are written by the kit's scripts. Read them in selectors; never author them.
|
|
15
|
+
|
|
16
|
+
## Identity
|
|
17
|
+
|
|
18
|
+
- One element, one or more tokens: `data-ui="card group"`. Primitives (`button`, `card`, `dialog`, `layout`…), switches (`sr-only`, `pile`, `isolate`, `not-prose`, `truncate`, `spin`, `ping`, `pulse`, `bounce`, `container`, `divide-x`, `divide-y`), and typography roles (`text-h2`, `text-eyebrow`…) are all tokens.
|
|
19
|
+
- Interactive primitives also have a tag form (`<ui-carousel>`, `<ui-tabs>`, `<ui-layout>`). Use the tag where the wrapper would otherwise be a plain `div`.
|
|
20
|
+
- 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`.
|
|
21
|
+
- Default variant = no preset attribute. Write `data-button-variant="primary"`, never a combined token.
|
|
22
|
+
|
|
23
|
+
## Presets and slots
|
|
24
|
+
|
|
25
|
+
- 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.
|
|
26
|
+
- Three identities are native or attribute-based instead of a `data-ui` token: popovers are any `[popover]` element (`data-popover-side`, `data-popover-align`), reveal animations are the attributes `data-reveal` / `data-reveal-each` themselves, and `data-transition-layer` names view-transition groups.
|
|
27
|
+
- Slots sit on children, inside the identity: `<div data-ui="dialog"><header data-dialog-slot="header">`.
|
|
28
|
+
- 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.
|
|
29
|
+
- 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.
|
|
30
|
+
|
|
31
|
+
## Style utilities
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<div style="--display: grid; --grid-cols: 1; --grid-cols--md: 3; --gap: 6">…</div>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- **Spelling is exact**: `--<utility>: value`, one space after the colon, declarations separated by `; `. The kit matches the attribute text, so `--px:6` and `--px : 6` silently do nothing.
|
|
38
|
+
- **Numbers are scale steps** on spacing, margin and sizing 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`). Any length works too: `--px: 1.5rem`, `--w: 100%`.
|
|
39
|
+
- **Prefer tokens and their shorthands**: scale numbers for spacing (above), `var(--color-<role>)` for color, `var(--radius-*)`, `var(--font-size-*)`. A few utilities take a token by name, at every tier: `--shadow: md` (`2xs … 2xl`, any shadow or `var()` still works; `--shadow-hue: var(--color-primary)` tints an element's and its subtree's shadows, and `--color-shadow` on `:root` tints them all) and `--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.
|
|
40
|
+
- **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`, `--rounded`, `--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 are the `divide-x` / `divide-y` switches: `data-ui="divide-y"`, with `--divide: 2` or `--divide: var(--color-muted)` on the container to size or color them. Grids follow Tailwind: `--grid-cols` / `--grid-rows` take a count (`3` is three equal tracks) or `subgrid` (`none` is `--template-cols: none`); a track list goes in `--template-cols: 2fr 1fr` / `--template-rows`. 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`). 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`). The editor completes the full list (`editor/zazz.css-data.json`).
|
|
41
|
+
|
|
42
|
+
### Modifiers
|
|
43
|
+
|
|
44
|
+
`--<utility>--<breakpoint>` or `--<utility>--<state>`, joined with a double hyphen.
|
|
45
|
+
|
|
46
|
+
| Modifier | Values | Families |
|
|
47
|
+
| ----------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
48
|
+
| Breakpoint | `sm md lg xl 2xl` (nearest container's width in `ch`, mobile first) | flow, grid, spacing, margin, sizing, typography, color |
|
|
49
|
+
| State | `hover active focus-visible focus-within disabled open checked current` | color, effects (`--bg`, `--text`, `--opacity`, `--shadow`…) |
|
|
50
|
+
| Group state | `--group-<utility>--hover` reacts to an ancestor with `data-ui="group"` | color, effects |
|
|
51
|
+
| Starting | `--<utility>--starting`: the value a `--transition` animates from | color, effects |
|
|
52
|
+
| Stuck | `--<utility>--stuck` inside a sticky element (experimental) | color, effects |
|
|
53
|
+
| Pseudo | `--before-<utility>`, `--after-<utility>`, plus `--before-content: ''` | sizing, spacing (padding, inset), position, display, z, color, `--rounded`, opacity, transforms, transition, font-size/weight |
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<article data-ui="card group">
|
|
57
|
+
<img
|
|
58
|
+
src="…"
|
|
59
|
+
alt="…"
|
|
60
|
+
style="--aspect: 3 / 2; --object-fit: cover; --opacity: 1; --group-opacity--hover: 0.85"
|
|
61
|
+
/>
|
|
62
|
+
<a
|
|
63
|
+
href="/p/1"
|
|
64
|
+
style="--text: var(--color-muted-foreground); --group-text--hover: var(--color-foreground)"
|
|
65
|
+
>Read more</a
|
|
66
|
+
>
|
|
67
|
+
</article>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Starting.** `--<utility>--starting` is the element's `@starting-style` value: when it first renders, or leaves `display: none` (a popover opening, `hidden` removed), it starts there and a `--transition` animates it to its usual value. Without a transition it does nothing visible. It outranks every other state, has no `--group-*` form, and works without a base where the utility has a default (`--opacity`, `--scale`, `--translate`, `--rotate`). The formatter writes it first in its utility's lines.
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<div
|
|
74
|
+
style="
|
|
75
|
+
--opacity--starting: 0;
|
|
76
|
+
--opacity: 1;
|
|
77
|
+
--translate--starting: 0 1rem;
|
|
78
|
+
--translate: 0;
|
|
79
|
+
--transition: opacity 0.3s, translate 0.3s;
|
|
80
|
+
"
|
|
81
|
+
>
|
|
82
|
+
…
|
|
83
|
+
</div>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Stuck (experimental).** `--<utility>--stuck` applies while the nearest sticky ancestor is stuck: the sticky element (`--position: sticky`, or raw `position: sticky`) is the container, and `--stuck-state` on it names the side to track (`top right bottom left block-start block-end inline-start inline-end`; default `top`). A container query never matches the container itself, so put the `--*--stuck` utilities on a **child** of the sticky element. It ranks below every other state (`--bg--hover` beats `--bg--stuck`), has no `--group-*` form, and `--stuck-state` takes no tiers: switch `--position` at a breakpoint to drop the state there. Chromium evaluates it natively (container scroll-state queries); elsewhere `index.js` loads a small polyfill (`base/scroll-state.js`) that writes the stuck sides to the container's `data-ui-stuck`, so markup does not change.
|
|
87
|
+
|
|
88
|
+
```html
|
|
89
|
+
<header style="--position: sticky; --position--lg: static; --top: 0; --z: 10">
|
|
90
|
+
<div
|
|
91
|
+
style="--bg: transparent; --bg--stuck: var(--color-background); --shadow--stuck: var(--shadow-md)"
|
|
92
|
+
>
|
|
93
|
+
…
|
|
94
|
+
</div>
|
|
95
|
+
</header>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Rules that bite:
|
|
99
|
+
|
|
100
|
+
1. **A tier needs a base.** `--text--hover: red` alone does nothing; write `--text: currentColor; --text--hover: red`. These utilities have a natural default and work tier-only: `--flex-wrap --shrink --grid-flow --auto-cols --auto-rows --items --justify --place-items --place-content --self --flex --basis --order --band --grid-cols --grid-rows --gap --gap-x --gap-y --text-align --text-wrap --text-decoration --opacity --scale --translate --rotate --shadow --ring --ring-color --ring-offset --ring-offset-color --rounded --aspect --position --overflow --overflow-x --overflow-y --z` (on any element that is not a primitive: typography roles, switches, and prose count as plain, so `data-ui="text-2xl" style="--opacity--hover: .8"` works; a primitive like a button still needs the base).
|
|
101
|
+
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. On a color utility a state beats a breakpoint: `--bg--md: black; --bg--hover: gray` is gray on hover at any width.
|
|
102
|
+
3. **Keywords mix with numbers.** `--w: 4; --w--md: auto`, `--w: fit-content; --h: 4`, and `--grid-cols: 2; --grid-cols--md: subgrid` 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`).
|
|
103
|
+
4. **A utility on a primitive flattens its states.** `--bg: red` on a button is red on hover too. To keep hover, add the tier (`--bg--hover: darkred`) or set the hook instead (below).
|
|
104
|
+
5. **Breakpoints read the nearest container, not the window.** A tier answers to the closest inline-size container: the page's `html`, `body`, `main`, `section`, `header`, `footer`, `article`, a layout band's child (so tiers inside a `layout-md` band follow the band), or any `data-ui="container"`. Thresholds are character counts: `sm` 40ch, `md` 65ch, `lg` 90ch, `xl` 120ch, `2xl` 150ch. Mark a card, sidebar, or slot `data-ui="container"` and the tiers inside it follow its width. 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.
|
|
105
|
+
|
|
106
|
+
## Theming primitives: hooks
|
|
107
|
+
|
|
108
|
+
Every primitive reads `--ui-<identity>-<utility>` hooks that inherit and keep the primitive's own states. Where a primitive has a state, it also reads a state hook such as `--ui-button-bg--hover`; the editor lists exactly which hooks each primitive declares.
|
|
109
|
+
|
|
110
|
+
```html
|
|
111
|
+
<nav style="--ui-button-px: 2; --ui-button-bg--hover: var(--color-muted)">
|
|
112
|
+
…every button inside…
|
|
113
|
+
</nav>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Order of preference for changing how a primitive looks: preset, then hook on a subtree, then a utility on the one element.
|
|
117
|
+
|
|
118
|
+
## Layout and typography
|
|
119
|
+
|
|
120
|
+
- `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.
|
|
121
|
+
- Native `h1`–`h6` carry their role automatically. Give any other element a role with `data-ui="text-h3"`, `text-display`, `text-eyebrow`, or a body size `text-2xs … text-2xl`. Override one property with a utility (`--font-size`, `--leading`, `--font-weight`); never rebuild a role from utilities.
|
|
122
|
+
- `data-ui="prose"` styles rich text inside it. Give a reading column `--max-w: var(--article-lg); --mx: auto`. `data-ui="not-prose"` on a wrapper stops prose styling for that subtree (a form or widget inside an article).
|
|
123
|
+
|
|
124
|
+
## Navigation
|
|
125
|
+
|
|
126
|
+
Pages navigate normally by default; the kit animates full loads with CSS view transitions. To keep state across pages (a toast stack, a playing video, an open mini-cart), opt in with `<html data-ui-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-ui-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.
|
|
127
|
+
|
|
128
|
+
A region whose content depends on the page, such as a section sidebar, should not persist: give it `data-ui-persist-scroll="<id>"` instead. 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.
|
|
129
|
+
|
|
130
|
+
```html
|
|
131
|
+
<html data-ui-navigation="swap">
|
|
132
|
+
…
|
|
133
|
+
<body>
|
|
134
|
+
<header>…current-page links render fresh on every page…</header>
|
|
135
|
+
<main>…</main>
|
|
136
|
+
<ui-toaster data-ui-persist="toaster"></ui-toaster>
|
|
137
|
+
</body>
|
|
138
|
+
</html>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`<ui-debug>` lists the persisted elements on each page and warns about a missing or duplicate id, nested persisted elements, and `data-ui-persist` on a page without the opt-in. It checks `data-ui-persist-scroll` the same way, and flags one that sits on or inside a `data-ui-persist` element, which already keeps its scroll.
|
|
142
|
+
|
|
143
|
+
## Theme
|
|
144
|
+
|
|
145
|
+
`data-ui-theme="dark"` or `"light"` on any element (usually `<html>`) forces that scheme for the subtree; without it, the system setting applies. Color utilities and tokens follow automatically when they use `var(--color-<role>)`.
|
|
146
|
+
|
|
147
|
+
## Do not
|
|
148
|
+
|
|
149
|
+
- Write a `class` for styling, or a `<style>` block, to get something the utilities can express.
|
|
150
|
+
- Invent tokens: every `var(--…)` must exist in the kit (`src/base/_variables.css`).
|
|
151
|
+
- Use 0.4 syntax: `class="ui-button"`, `data-variant`, `data-slot`, utility classes like `p-md` / `@md:grid-cols-3`, `.container`, `class="dark"`.
|
|
152
|
+
|
|
153
|
+
## Tools
|
|
154
|
+
|
|
155
|
+
- **`<ui-debug data-debug-domains="localhost">`** in development warns in the console about unknown utilities, wrong values, tiers without a base, flattened states, and misplaced presets.
|
|
156
|
+
- **Editor**: the Zazz VS Code extension (`packages/vscode`, also for Cursor) shows the `<ui-debug>` audit as you type, completes utilities (only the tiers each takes), values with resolved tokens, identities, presets, and hooks, and adds hover, inlay hints, highlighting, snippets, and page templates. Without it, `editor/zazz.html-data.json` and `editor/zazz.css-data.json` give flat completions (`"html.customData"`, `"css.customData"` in settings).
|
|
157
|
+
- **Formatting**: the `zazz/style-format` ESLint rule puts each utility of a multi-utility `style` on its own line, in cascade order (family, then shorthands first, tiers after their base), and normalizes `--px:6` to `--px: 6`. VS Code applies it on save (`source.fixAll.zazz`, from the extension), the commit hook on staged HTML, and `vp run fmt:html` (repo root) on every file; `vp run ready` checks it.
|
|
158
|
+
- **`StyleGuard`** (`primitives/style-guard`) restores utilities when legacy scripts overwrite `style`.
|