@openelement/ui 1.0.0-alpha.15 → 1.0.0-alpha.16

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/CUSTOMIZATION.md CHANGED
@@ -1,118 +1,26 @@
1
1
  # Customizing @openelement/ui
2
2
 
3
- This document is the package's **customization surface declaration** (alpha9
4
- C3, #1506). It lists, per component, the shadow parts (`::part(...)`) and the
5
- CSS custom properties the recipes consume. A test guard
6
- (`__tests__/customization-surface.test.ts`) pins both lists to the code and
7
- to the 1.0.0-alpha.8 baseline.
8
-
9
- ## Semver contract
10
-
11
- - **`::part` names never shrink.** Every part shipped in 1.0.0-alpha.8 exists
12
- today and must exist in every later release, for every component that still
13
- ships; adding a part is allowed. (`open-card`, `open-callout`, `open-badge`
14
- and `open-tabs` left the package under the Alpha disclaimer and are no
15
- longer part of this contract.)
16
- - **Consumed variables are pinned at the C3 role-direct baseline.** Adding or
17
- removing a `var()` reference in a recipe is a deliberate surface change: the
18
- guard fails until the pin and this document are updated in the same change.
19
- - Component internals are authored as **Tailwind utilities** wherever a class
20
- utility is the clearest form. The compiler admits every static class token and
21
- the build's shadow component stylesheet (theme + utilities) carries the
22
- generated rules into the component's shadow root. What stays in the
23
- component's `.css` sheet is what reads better as one owned rule — see
24
- [Why the residue is CSS](#why-the-residue-is-css). **This makes a Tailwind
25
- entry a requirement of the consuming app** (`tailwind: { theme: [...] }` in
26
- `openelement.config.ts` — the scaffold's single default form): without it the
27
- component stylesheet is not emitted and the utilities are not delivered. That
28
- is the MANUAL path. A package that declares its own requirement admits the
29
- entry by itself in automatic mode — this package does exactly
30
- that, which is why a consumer that admits `@openelement/ui` needs no
31
- `tailwind` key at all.
32
- - Colours still come from this role table, never from a literal — either a role
33
- variable in the sheet or a utility generated from a role (`bg-primary/14`
34
- compiles to `color-mix` on `--color-primary`). The guard fails on a raw
35
- colour literal in a declaration, because a literal escapes the light, dark
36
- and forced-colors seats the roles guarantee.
37
-
38
- ### Why the residue is CSS
39
-
40
- An earlier revision of this document and of the component sheets said the
41
- retained rules "cannot be a class utility": a utility could not select the
42
- host's attribute from inside the shadow root, the compiler admitted only
43
- two-branch conditionals, and `color-mix` over role pairs was out of reach. That
44
- is **not true of the official engine**, and it is not a good reason to keep
45
- anything. Measured with the installed `tailwindcss` (the same compiler the build
46
- mounts), every one of those shapes has a real utility spelling:
47
-
48
- | Shape | Utility spelling | Compiles to |
49
- |---|---|---|
50
- | host attribute | `[:host([size='sm'])_&]:p-1` | `:host([size='sm']) .[…]\/\:p-1 { padding: var(--spacing) }` |
51
- | form-associated state | `[:host(:state(invalid))_&]:border-destructive` | `:host(:state(invalid)) .[…]\/\:border-destructive { border-color: var(--color-destructive) }` |
52
- | derived role mix | `bg-[color-mix(in_srgb,var(--color-popover)_78%,transparent)]` | the mix, with `var(--color-popover)` kept in the supported branch |
53
- | pseudo-class | `focus:border-primary` | `.focus\:border-primary:focus { border-color: var(--color-primary) }` |
54
-
55
- What the residue actually rests on is **readability and size**, measured on
56
- open-button's size matrix rather than asserted:
57
-
58
- - the retained sheet block: **444 bytes**;
59
- - the equivalent utilities: **998 bytes** of class attribute — the same tokens
60
- are needed on both rendered controls (the anchor branch and the button
61
- branch) — plus **1,881 bytes** of generated rules, each selector a mangled
62
- escape (`:host(:not([size])) .\[\:host\(\:not\(\[size\]\)\)_\&\]\:min-h-\[38px\]`);
63
- - total **≈ 6.5×**, for the same three branches.
64
-
65
- There is no capability limit left to claim. The transition configuration this
66
- document used to call one — `@starting-style` and
67
- `transition-behavior: allow-discrete` — is expressible too, and was measured:
68
- `starting:opacity-0` compiles into an `@starting-style` block and
69
- `transition-discrete` into `transition-behavior: allow-discrete`. What the
70
- sheets keep is therefore a deliberate choice of clarity, size or single
71
- ownership in every case, never an "impossible". The guards hold both sides to
72
- that: every generated colour must resolve to a declared role
73
- (`__tests__/utility-colour-roles.test.ts`) and every class a sheet selects must
74
- be carried by its own markup (`__tests__/customization-surface.test.ts`).
75
-
76
- ### What is NOT part of this contract
77
-
78
- The declared surface is the two lists above: **`::part` names and the consumed
79
- role variables.** Everything else a component class exposes on its type — its
80
- internal class hooks, its computed signals, its methods — sits OUTSIDE those
81
- lists, which is not the same as being ungoverned. Every one of them is a
82
- published type shape: the package's retained-interface baseline (a checked-in
83
- snapshot, verified by the repository's `interface:snapshot` task) fails on any
84
- change until the
85
- decision is made and the baseline is regenerated in the same change, and the
86
- experimental disclaimer (owner ruling C1, #1468) is what lets such a decision be
87
- "removed" rather than "kept forever". There is no blanket rule that exported
88
- types may churn; there is a per-change decision, recorded and pinned. The two
89
- cases below are exactly that — individual decisions, not precedents that make
90
- the next one free:
91
-
92
- - **Internal class hooks are not a contract.** A class a sheet selects
93
- (`open-button`'s `btn`, `open-input`'s `control`) is internal: an element in a
94
- shadow root can only be reached through its `::part`, so no consumer can
95
- address a hook directly. The hook-name guard
96
- (`__tests__/customization-surface.test.ts`) keeps the sheet and the markup
97
- spelling the same hook, which is what stops a rename from silently killing
98
- rules; it does not make the name public.
99
- - **A retired class-carrying signal is not a compatibility break.** The alpha15
100
- S lane deleted `OpenInput.inputClass`, a computed whose only value was the
101
- internal class string (`'control input input--error'`) and whose only
102
- consumer was the `class=` binding that is now a static literal. It was never
103
- an attribute (it could not be set from markup) and never part of the lists
104
- above. It is retired rather than restored: re-adding a signal with no
105
- behavior would keep a type shape green while telling a consumer nothing true.
106
- The same change retired the `input--error` class: `:host(:state(invalid))`
107
- owns that border.
3
+ The supported CSS customization surface is the per-component list of shadow
4
+ parts and consumed custom properties below. Select a published part with
5
+ `::part()` to style one component. Set semantic color roles at the document or
6
+ theme scope to change related components together.
7
+
8
+ ```css
9
+ open-button::part(control) {
10
+ border-radius: 999px;
11
+ }
12
+ ```
13
+
14
+ Component sheets and utility classes both resolve colors from the declared
15
+ role table. Internal selectors belong to the component's markup and sheets.
16
+ The package tests pin the published parts and consumed variables and check
17
+ the generated utilities against the documented role table.
108
18
 
109
19
  ## Theming model
110
20
 
111
21
  Components read the shadcn-convention role table in
112
22
  [`src/theme.css`](./src/theme.css) directly: `--color-*` semantic roles seated
113
- on the Tailwind v4 default scale. There is no intermediate alias layer — the
114
- C1 alias sheet (`semantic-tokens.css`) was deleted in C3 under its own
115
- DELETION CONDITION.
23
+ on the Tailwind v4 default scale.
116
24
 
117
25
  - **Light/dark**: the roles carry `[data-theme='dark']` pairs re-pointed at
118
26
  this repo's theme mechanism (`:root[data-theme='dark']`,
@@ -135,12 +43,8 @@ The contract a consumer may rely on:
135
43
  - each role's `[data-theme='dark']` dark pair,
136
44
  - the `forced-colors: active` tier that re-seats every role on a system color.
137
45
 
138
- **The package carries no scale values of its own.** Since the alpha9 C5 twin
139
- removal, `@openelement/ui` embeds no compiled value table and exports no
140
- token module — the retired `@openelement/ui/theme-tokens`
141
- (`themeTokenCss` / `themeTokenSheet`) is gone. Component recipes reference
142
- `var(--color-*)` / `var(--spacing)` / etc.; until the host supplies those
143
- variables the recipes resolve to nothing. Values have exactly two suppliers:
46
+ Component recipes read values from the CSS variables supplied by the selected
47
+ stylesheet delivery path.
144
48
 
145
49
  - **Entry ON**: a `@openelement/router` Tailwind build compiles
146
50
  `theme.css` through the official `@tailwindcss/vite` pipeline
@@ -176,12 +80,12 @@ The full role-name inventory is the `@theme` block of
176
80
  [`src/theme.css`](./src/theme.css): `--color-background`, `--color-foreground`,
177
81
  `--color-card(-foreground)`, `--color-popover(-foreground)`,
178
82
  `--color-primary(-foreground)`, `--color-secondary(-foreground)`,
179
- `--color-muted(-foreground)`, `--color-accent(-foreground)`,
83
+ `--color-muted`, `--color-muted-foreground`, `--color-accent(-foreground)`,
180
84
  `--color-destructive(-foreground)`, `--color-success`, `--color-warning`,
181
85
  `--color-info`, `--color-border`, `--color-input`, `--color-ring`, and
182
86
  `--color-chart-1` … `--color-chart-5`.
183
87
 
184
- ### Which engine compiles the components (alpha15 stage 2B)
88
+ ### Style providers
185
89
 
186
90
  This package's components author their control surfaces as **`tailwind4`-dialect
187
91
  utility tokens** and declare exactly that in their manifest entries
@@ -213,51 +117,6 @@ router refuses a `@theme` source under UnoCSS
213
117
  the roles it declares — which is why the combination above is refused instead
214
118
  of half-styled.
215
119
 
216
- ## alpha8 → C3 variable rename map
217
-
218
- The retired alias names are gone. The notable re-seats (consumers renaming
219
- their overrides):
220
-
221
- | Retired (alpha8) | C3 role expression |
222
- | ----------------- | --------------------------------------------------------- |
223
- | `--bg-base` | `--color-background` |
224
- | `--bg-card` | `--color-card` |
225
- | `--bg-elevated` | `--color-popover` |
226
- | `--bg-surface` | `--color-muted` |
227
- | `--text-primary` | `--color-foreground` |
228
- | `--text-secondary`| `--color-muted-foreground` |
229
- | `--text-muted` | `--color-muted-foreground` (one ink step since C1) |
230
- | `--brand` | `--color-primary` |
231
- | `--on-brand` | `--color-primary-foreground` |
232
- | `--border` | `--color-border` |
233
- | `--error` | `--color-destructive` |
234
- | `--success` | `--color-success` (new role, same AA-tuned values) |
235
- | `--warning` | `--color-warning` (new role, same AA-tuned values) |
236
- | `--info` | `--color-info` (new role, same AA-tuned values) |
237
- | `--focus-ring` | `--color-ring` |
238
- | `--bg-code` | static `--color-zinc-950` (code surfaces stay dark) |
239
- | `--code-text` | static `--color-zinc-200` |
240
- | `--code-border` | static `--color-zinc-700` |
241
- | `--size-N` | `calc(var(--spacing) * N)` |
242
- | `--radius-1/2/3` | `--radius-md` / `--radius-lg` / `--radius-xl` |
243
- | `--radius-round` | `calc(infinity * 1px)` |
244
- | `--font-size-0..3`| `--text-sm` / `--text-base` / `--text-xl` / `--text-2xl` |
245
- | `--font-weight-N` | `--font-weight-medium` … `--font-weight-black` |
246
- | `--motion-fast`, `--duration-2` | `--default-transition-duration` (150ms) |
247
- | `--ease-3`, `--motion-standard` | `--ease-out` |
248
- | `--ease-2` | `--ease-in-out` |
249
-
250
- Deliberate pixel breaks to note (this is C3's contract, not a migration):
251
-
252
- - `--brand-deep` (static violet-950) became a 50/50 primary/foreground mix —
253
- the default-button hover ink now tracks the theme's ink side.
254
- - `--violet-0/1/2/5/8/10` re-seat on flipping roles
255
- (primary-foreground/secondary/border/ring/primary/secondary-foreground), so
256
- coordinated surfaces (e.g. the site's flood panels) invert together with
257
- the theme instead of mirroring a fixed ramp.
258
- - Code-block and dialog backdrop keep static zinc surfaces in both themes
259
- (the retired sheet's behavior, now explicit literals-free ramp references).
260
-
261
120
  ## Per-component surface
262
121
 
263
122
  Variables listed are the ones each component's recipe **consumes**; all of
@@ -273,7 +132,7 @@ custom properties.
273
132
  `--shadow-sm`, `--spacing`, `--text-base`, `--text-sm`, `--text-xl`
274
133
  - The base treatment (inline flex box, gap, typography, radius, cursor,
275
134
  white-space), the focus ring and the disabled / aria-disabled states are
276
- authored as Tailwind utilities (alpha15 S lane). The sheet keeps the host
135
+ authored as Tailwind utilities. The sheet keeps the host
277
136
  box, the `[hidden]` rule, the size and variant surfaces (host-attribute
278
137
  scoped: the utility spelling exists — `[:host([size='sm'])_&]:p-1` compiles —
279
138
  and costs ≈6.5× the bytes for the same branches; see
@@ -285,7 +144,7 @@ custom properties.
285
144
 
286
145
  - Parts: `copy`
287
146
  - Variables: `--color-destructive`, `--color-success`
288
- - The chip's presentation is authored as Tailwind utilities (alpha15 S lane);
147
+ - The chip's presentation is authored as Tailwind utilities;
289
148
  the sheet keeps the host box and the `:state(copied)` / `:state(failed)`
290
149
  feedback, which paint the two status roles above.
291
150
  - Since #1552 the component owns the copy chip only: the code surface and the
@@ -300,7 +159,7 @@ custom properties.
300
159
  `--color-primary`, `--color-white`, `--color-zinc-950`, `--shadow-2xl`,
301
160
  `--spacing`
302
161
  - The dialog box and the header / title / close / body / footer presentation
303
- are authored as Tailwind utilities (alpha15 S lane). The sheet keeps the
162
+ are authored as Tailwind utilities. The sheet keeps the
304
163
  host box, the trigger slot's cursor, the derived frame (a
305
164
  foreground/border/primary triple mix) and the close button's hover wash.
306
165
  - Shares the overlay recipe (below); the backdrop composes the zinc-950
@@ -314,7 +173,12 @@ custom properties.
314
173
 
315
174
  - Parts: `trigger`, `content`
316
175
  - Variables: `--spacing` (the anchor-positioning block's gap; the rest of the
317
- content's presentation is authored as Tailwind utilities)
176
+ content's presentation is authored as Tailwind utilities) and
177
+ `--oe-dropdown-anchor` (the component's own runtime anchor identity — the
178
+ activation writes the realm-unique anchor name here, and the authored
179
+ `.content { position-anchor: var(--oe-dropdown-anchor) }` reads it. It is an
180
+ internal wiring property, not a theme token; overriding it re-points the
181
+ popover's anchor.)
318
182
  - Shares the overlay recipe for the popover surface.
319
183
 
320
184
  ### `open-input`
@@ -324,7 +188,7 @@ custom properties.
324
188
  `--color-popover`, `--color-primary`, `--color-violet-400`, `--spacing`
325
189
  - The wrapper layout, the label's typography, the control's box (width,
326
190
  padding, font, radius, transition, outline) and the error message's ink are
327
- authored as Tailwind utilities (alpha15 S lane). The sheet keeps the host
191
+ authored as Tailwind utilities. The sheet keeps the host
328
192
  box, the control's derived surfaces (the popover/border mixes, the violet
329
193
  hover border, the focus ring's box-shadow) and the disabled / invalid
330
194
  treatments scoped to the host's form state; those states use
@@ -336,8 +200,7 @@ custom properties.
336
200
  - Variables: `--color-background`, `--color-border`, `--color-popover`,
337
201
  `--color-primary`, `--color-violet-400`, `--spacing`
338
202
  - The button's element-level presentation (flex box, size, radius, cursor,
339
- ink, focus ring, transition) is authored as Tailwind utilities (alpha15 S
340
- lane); the sheet keeps the derived surface, its hover values and the
203
+ ink, focus ring, transition) is authored as Tailwind utilities; the sheet keeps the derived surface, its hover values and the
341
204
  `[data-theme]` icon display swap.
342
205
 
343
206
  ### Shared recipes (`component-recipes.ts`)
@@ -345,10 +208,9 @@ custom properties.
345
208
  - `surface-recipe.css` (`.surface`): `--color-border`, `--color-card`,
346
209
  `--color-foreground`, `--color-popover`, `--color-primary`, `--color-white`,
347
210
  `--radius-lg`, `--shadow-2xl`, `--spacing`
348
- - The control recipe retired with the alpha15 utility migration: open-button
349
- and open-input author their control surface as utilities plus each
350
- component's own irreducible residue (above), so there is one owner per
351
- property instead of a shared sheet plus overrides.
211
+ - The button and input control surfaces combine utilities with each component's
212
+ own stylesheet. The shared surface and overlay recipes own their respective
213
+ shared treatments.
352
214
  - `overlay-recipe.css` (`.overlay`) adds: `--radius-xl`
353
215
 
354
216
  ## Deep customization
package/README.md CHANGED
@@ -34,8 +34,8 @@ npm install @openelement/ui
34
34
  | ----------------- | ------------------- | ---------------------------------------------------------------- |
35
35
  | `OpenButton` | `open-button` | Button component. |
36
36
  | `OpenInput` | `open-input` | Input component. |
37
- | `OpenCodeBlock` | `open-code-block` | Code block with copy behavior; highlighting is the host's build-time step. |
38
- | `OpenThemeToggle` | `open-theme-toggle` | Theme switch island. |
37
+ | `OpenCodeBlock` | `open-code-block` | Code block with copy behavior; highlighting is the host's build-time step (authored function component; the element class is build-emitted, not exported). |
38
+ | `OpenThemeToggle` | `open-theme-toggle` | Theme switch island (authored function component; the element class is build-emitted, not exported). |
39
39
  | `OpenDialog` | `open-dialog` | Modal/non-modal dialog. |
40
40
  | `OpenDropdown` | `open-dropdown` | Popover-first dropdown. |
41
41
 
@@ -81,37 +81,14 @@ copy button — an expected degradation, not a bug.
81
81
  The token layer is hand-maintained — there is no generator. One authored CSS
82
82
  source, no shipped values:
83
83
 
84
- - `src/theme.css` — **the single source of design roles** (P6: the only place
85
- in the repository that defines them). shadcn-convention roles
86
- (`--color-background`, `--color-primary`, …) seated on the Tailwind v4
87
- default scale; roles reference only scale variables, dark pairs follow the
88
- shadcn v4 convention with the selector re-pointed at this repo's
89
- `[data-theme='dark']` mechanism, and a forced-colors layer re-seats every
90
- role on a system color. Since alpha9 C2 the scale layer is the real
91
- `@theme` block; role names are the migration contract. Since C3 (#1506) the
92
- component recipes read these role names directly — the C1 alias layer
93
- (`semantic-tokens.css`) was deleted under its own DELETION CONDITION, and
94
- three non-shadcn status roles (`--color-success/-warning/-info`) joined the
95
- table with the same forced-colors and dark-pair discipline.
96
-
97
- **The package ships no token values.** The compiled `theme-tokens` twin
98
- (`themeTokenCss` / `themeTokenSheet`) was deleted in alpha9 C5 — the role
99
- names, dark pairs and forced-colors tier are the contract; the values come
100
- from the `@openelement/router` Tailwind entry (ON) or a table the consumer
101
- writes itself (OFF). See [CUSTOMIZATION.md](./CUSTOMIZATION.md),
102
- "Value delivery".
103
-
104
- The ui suite fails closed on the role contract (dark
105
- pairs, forced-colors totality), on recipes consuming undeclared variables,
106
- and on WCAG floors (3:1 focus ring, 4.5:1 status inks on the background and
107
- their 10% recipe washes). `daisyClassSheet`, modal and step-card are retired
108
- and must not reappear in exports, manifests, docs or packed artifacts.
109
-
110
- The per-component customization surface (`::part` names, consumed variables,
111
- the alpha8 alias→role rename map) is declared in
112
- [CUSTOMIZATION.md](./CUSTOMIZATION.md) and pinned by test.
113
-
114
- Existing per-component imports remain stable across this layering change.
84
+ - `src/theme.css` defines the semantic `--color-*` roles over the Tailwind
85
+ scale, including dark pairs and system colors for forced-colors mode.
86
+ - The Router Tailwind entry compiles the role table and its scale. Applications
87
+ with manual CSS delivery supply those variables through their own stylesheet.
88
+
89
+ Use [the customization surface](./CUSTOMIZATION.md) for each component's
90
+ published `::part()` selectors and consumed variables. The UI test suite
91
+ checks those declarations, role coverage, and focus and status contrast.
115
92
 
116
93
  ## Package Manifest
117
94