@openelement/ui 0.44.0-beta.2.2 → 1.0.0-alpha.10
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 +272 -0
- package/README.md +67 -34
- package/package.json +34 -12
- package/src/component-recipes.js +80 -84
- package/src/generated-manifest.json +19 -8
- package/src/index.d.ts +14 -0
- package/src/index.js +14 -47
- package/src/instance-state.d.ts +16 -0
- package/src/instance-state.js +30 -25
- package/src/manifest.d.ts +5 -0
- package/src/manifest.js +6 -10
- package/src/open-badge.d.ts +139 -0
- package/src/open-badge.js +208 -354
- package/src/open-button.d.ts +359 -0
- package/src/open-button.js +1163 -1834
- package/src/open-callout.d.ts +261 -0
- package/src/open-callout.js +483 -829
- package/src/open-card.d.ts +138 -0
- package/src/open-card.js +208 -400
- package/src/open-code-block.d.ts +182 -0
- package/src/open-code-block.js +242 -565
- package/src/open-dialog.d.ts +271 -0
- package/src/open-dialog.js +705 -1197
- package/src/open-dropdown.d.ts +225 -0
- package/src/open-dropdown.js +353 -667
- package/src/open-input.d.ts +481 -0
- package/src/open-input.js +1809 -2888
- package/src/open-tabs.d.ts +190 -0
- package/src/open-tabs.js +302 -515
- package/src/open-theme-toggle.d.ts +196 -0
- package/src/open-theme-toggle.js +527 -1059
- package/src/register.d.ts +4 -0
- package/src/register.js +27 -59
- package/src/theme.css +205 -0
- package/src/open-props-tokens.css +0 -386
- package/src/open-props-tokens.js +0 -400
package/CUSTOMIZATION.md
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# Customizing @openelement/ui
|
|
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; adding a part is allowed.
|
|
13
|
+
- **Consumed variables are pinned at the C3 role-direct baseline.** Adding or
|
|
14
|
+
removing a `var()` reference in a recipe is a deliberate surface change: the
|
|
15
|
+
guard fails until the pin and this document are updated in the same change.
|
|
16
|
+
- Component internals carry **no utility classes** — the role variables are
|
|
17
|
+
the entire styling contract.
|
|
18
|
+
|
|
19
|
+
## Theming model
|
|
20
|
+
|
|
21
|
+
Components read the shadcn-convention role table in
|
|
22
|
+
[`src/theme.css`](./src/theme.css) directly: `--color-*` semantic roles seated
|
|
23
|
+
on the Tailwind v4 default scale. There is no intermediate alias layer — the
|
|
24
|
+
C1 alias sheet (`semantic-tokens.css`) was deleted in C3 under its own
|
|
25
|
+
DELETION CONDITION.
|
|
26
|
+
|
|
27
|
+
- **Light/dark**: the roles carry `[data-theme='dark']` pairs re-pointed at
|
|
28
|
+
this repo's theme mechanism (`:root[data-theme='dark']`,
|
|
29
|
+
`:host([data-theme='dark'])`). Components flip automatically.
|
|
30
|
+
- **Forced colors** (Windows High Contrast): the `forced-colors: active`
|
|
31
|
+
tier in `theme.css` re-seats **every** role on a system color
|
|
32
|
+
(`Canvas`, `CanvasText`, `ButtonFace`, `ButtonText`, `GrayText`,
|
|
33
|
+
`Highlight`, `LinkText`, `Mark`) in both selector blocks. Every component
|
|
34
|
+
therefore resolves fully under forced colors; hue carries no meaning there,
|
|
35
|
+
so status is also encoded by border and label, never by color alone.
|
|
36
|
+
- **Delivery**: see the [Value delivery](#value-delivery) section below.
|
|
37
|
+
|
|
38
|
+
## Value delivery
|
|
39
|
+
|
|
40
|
+
**What the ui package guarantees is the role table's SHAPE, not its values.**
|
|
41
|
+
The contract a consumer may rely on:
|
|
42
|
+
|
|
43
|
+
- the role names declared in the `@theme` block of
|
|
44
|
+
[`src/theme.css`](./src/theme.css) (the full inventory below),
|
|
45
|
+
- each role's `[data-theme='dark']` dark pair,
|
|
46
|
+
- the `forced-colors: active` tier that re-seats every role on a system color.
|
|
47
|
+
|
|
48
|
+
**The package carries no scale values of its own.** Since the alpha9 C5 twin
|
|
49
|
+
removal, `@openelement/ui` embeds no compiled value table and exports no
|
|
50
|
+
token module — the retired `@openelement/ui/theme-tokens`
|
|
51
|
+
(`themeTokenCss` / `themeTokenSheet`) is gone. Component recipes reference
|
|
52
|
+
`var(--color-*)` / `var(--spacing)` / etc.; until the host supplies those
|
|
53
|
+
variables the recipes resolve to nothing. Values have exactly two suppliers:
|
|
54
|
+
|
|
55
|
+
- **Preset ON**: a `@openelement/router` Tailwind build compiles
|
|
56
|
+
`theme.css` through the preset (`tailwind: { theme:
|
|
57
|
+
['@openelement/ui/theme.css'] }`), emitting the roles plus Tailwind's own
|
|
58
|
+
scale layer. This is the first-party delivery (the www site and the
|
|
59
|
+
router-ui-dogfood fixture).
|
|
60
|
+
- **Preset OFF**: the consumer writes its own table. The only requirement is
|
|
61
|
+
that it defines the role names (and any scale variables the recipes
|
|
62
|
+
consume, e.g. `--spacing`, `--radius-md`) under the same selectors.
|
|
63
|
+
Minimal shape, values illustrative:
|
|
64
|
+
|
|
65
|
+
```css
|
|
66
|
+
/* OFF-state table — role names from src/theme.css are the contract;
|
|
67
|
+
the values are the consumer's own. */
|
|
68
|
+
:root,
|
|
69
|
+
:host {
|
|
70
|
+
--color-background: white;
|
|
71
|
+
--color-foreground: black;
|
|
72
|
+
--color-primary: rebeccapurple;
|
|
73
|
+
--color-primary-foreground: white;
|
|
74
|
+
/* …the remaining --color-* roles of src/theme.css… */
|
|
75
|
+
--spacing: 0.25rem;
|
|
76
|
+
--radius-md: 0.375rem;
|
|
77
|
+
}
|
|
78
|
+
:root[data-theme='dark'],
|
|
79
|
+
:host([data-theme='dark']) {
|
|
80
|
+
/* the same roles, dark-side values */
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The full role-name inventory is the `@theme` block of
|
|
85
|
+
[`src/theme.css`](./src/theme.css): `--color-background`, `--color-foreground`,
|
|
86
|
+
`--color-card(-foreground)`, `--color-popover(-foreground)`,
|
|
87
|
+
`--color-primary(-foreground)`, `--color-secondary(-foreground)`,
|
|
88
|
+
`--color-muted(-foreground)`, `--color-accent(-foreground)`,
|
|
89
|
+
`--color-destructive(-foreground)`, `--color-success`, `--color-warning`,
|
|
90
|
+
`--color-info`, `--color-border`, `--color-input`, `--color-ring`, and
|
|
91
|
+
`--color-chart-1` … `--color-chart-5`.
|
|
92
|
+
|
|
93
|
+
## alpha8 → C3 variable rename map
|
|
94
|
+
|
|
95
|
+
The retired alias names are gone. The notable re-seats (consumers renaming
|
|
96
|
+
their overrides):
|
|
97
|
+
|
|
98
|
+
| Retired (alpha8) | C3 role expression |
|
|
99
|
+
| ----------------- | --------------------------------------------------------- |
|
|
100
|
+
| `--bg-base` | `--color-background` |
|
|
101
|
+
| `--bg-card` | `--color-card` |
|
|
102
|
+
| `--bg-elevated` | `--color-popover` |
|
|
103
|
+
| `--bg-surface` | `--color-muted` |
|
|
104
|
+
| `--text-primary` | `--color-foreground` |
|
|
105
|
+
| `--text-secondary`| `--color-muted-foreground` |
|
|
106
|
+
| `--text-muted` | `--color-muted-foreground` (one ink step since C1) |
|
|
107
|
+
| `--brand` | `--color-primary` |
|
|
108
|
+
| `--on-brand` | `--color-primary-foreground` |
|
|
109
|
+
| `--border` | `--color-border` |
|
|
110
|
+
| `--error` | `--color-destructive` |
|
|
111
|
+
| `--success` | `--color-success` (new role, same AA-tuned values) |
|
|
112
|
+
| `--warning` | `--color-warning` (new role, same AA-tuned values) |
|
|
113
|
+
| `--info` | `--color-info` (new role, same AA-tuned values) |
|
|
114
|
+
| `--focus-ring` | `--color-ring` |
|
|
115
|
+
| `--bg-code` | static `--color-zinc-950` (code surfaces stay dark) |
|
|
116
|
+
| `--code-text` | static `--color-zinc-200` |
|
|
117
|
+
| `--code-border` | static `--color-zinc-700` |
|
|
118
|
+
| `--size-N` | `calc(var(--spacing) * N)` |
|
|
119
|
+
| `--radius-1/2/3` | `--radius-md` / `--radius-lg` / `--radius-xl` |
|
|
120
|
+
| `--radius-round` | `calc(infinity * 1px)` |
|
|
121
|
+
| `--font-size-0..3`| `--text-sm` / `--text-base` / `--text-xl` / `--text-2xl` |
|
|
122
|
+
| `--font-weight-N` | `--font-weight-medium` … `--font-weight-black` |
|
|
123
|
+
| `--motion-fast`, `--duration-2` | `--default-transition-duration` (150ms) |
|
|
124
|
+
| `--ease-3`, `--motion-standard` | `--ease-out` |
|
|
125
|
+
| `--ease-2` | `--ease-in-out` |
|
|
126
|
+
|
|
127
|
+
Deliberate pixel breaks to note (this is C3's contract, not a migration):
|
|
128
|
+
|
|
129
|
+
- `--brand-deep` (static violet-950) became a 50/50 primary/foreground mix —
|
|
130
|
+
the default-button hover ink now tracks the theme's ink side.
|
|
131
|
+
- `--violet-0/1/2/5/8/10` re-seat on flipping roles
|
|
132
|
+
(primary-foreground/secondary/border/ring/primary/secondary-foreground), so
|
|
133
|
+
coordinated surfaces (e.g. the site's flood panels) invert together with
|
|
134
|
+
the theme instead of mirroring a fixed ramp.
|
|
135
|
+
- Badge/callout washes are computed inline (`color-mix(... 10%, transparent)`)
|
|
136
|
+
from each status role; the light-theme rgba tint overrides are gone.
|
|
137
|
+
- Card `artifact`, code-block and dialog backdrop keep static zinc surfaces
|
|
138
|
+
in both themes (the retired sheet's behavior, now explicit literals-free
|
|
139
|
+
ramp references).
|
|
140
|
+
|
|
141
|
+
## Per-component surface
|
|
142
|
+
|
|
143
|
+
Variables listed are the ones each component's recipe **consumes**; all of
|
|
144
|
+
them resolve from the role table above. There are no component-defined
|
|
145
|
+
custom properties.
|
|
146
|
+
|
|
147
|
+
### `open-badge`
|
|
148
|
+
|
|
149
|
+
- Parts: `badge`
|
|
150
|
+
- Variables: `--color-border`, `--color-info`, `--color-muted`,
|
|
151
|
+
`--color-muted-foreground`, `--color-primary`, `--color-success`,
|
|
152
|
+
`--color-warning`, `--font-mono`, `--font-weight-extrabold`,
|
|
153
|
+
`--leading-normal`, `--radius-md`, `--spacing`, `--text-xs`
|
|
154
|
+
- Tones `brand/success/warning/info` paint their 10% wash with `color-mix`
|
|
155
|
+
off the matching role; AA is asserted against base and wash in the suite.
|
|
156
|
+
|
|
157
|
+
### `open-button`
|
|
158
|
+
|
|
159
|
+
- Parts: `control`
|
|
160
|
+
- Variables: `--color-border`, `--color-foreground`, `--color-popover`,
|
|
161
|
+
`--color-primary`, `--color-primary-foreground`, `--color-ring`,
|
|
162
|
+
`--color-violet-400`, `--color-white`, `--default-transition-duration`,
|
|
163
|
+
`--ease-out`, `--font-sans`, `--font-weight-extrabold`, `--radius-md`,
|
|
164
|
+
`--shadow-sm`, `--spacing`, `--text-base`, `--text-sm`, `--text-xl`
|
|
165
|
+
- Shares the control recipe (below). Variant `primary`/`accent` fill with
|
|
166
|
+
`--color-primary` over `--color-primary-foreground`.
|
|
167
|
+
|
|
168
|
+
### `open-callout`
|
|
169
|
+
|
|
170
|
+
- Parts: `container`, `icon`, `content`
|
|
171
|
+
- Variables: `--color-destructive`, `--color-foreground`,
|
|
172
|
+
`--color-muted-foreground`, `--color-primary`, `--color-success`,
|
|
173
|
+
`--color-warning`, `--font-weight-semibold`, `--leading-relaxed`,
|
|
174
|
+
`--radius-lg`, `--spacing`, `--text-base`, `--text-sm`
|
|
175
|
+
- Types `info/warning/danger/tip` map to primary/warning/destructive/success
|
|
176
|
+
inks with 10% washes; the alpha8 light-theme rgba overrides are gone (the
|
|
177
|
+
roles' dark pairs carry the flip).
|
|
178
|
+
|
|
179
|
+
### `open-card`
|
|
180
|
+
|
|
181
|
+
- Parts: `container`, `body`
|
|
182
|
+
- Variables: `--color-border`, `--color-card`, `--color-foreground`,
|
|
183
|
+
`--color-muted`, `--color-muted-foreground`, `--color-primary`,
|
|
184
|
+
`--color-secondary`, `--color-zinc-200`, `--color-zinc-700`,
|
|
185
|
+
`--color-zinc-950`, `--default-transition-duration`, `--ease-out`,
|
|
186
|
+
`--font-weight-semibold`, `--radius-md`, `--spacing`, `--text-sm`,
|
|
187
|
+
`--text-xl`
|
|
188
|
+
- Variant `artifact` paints a static zinc-950 panel in both themes.
|
|
189
|
+
|
|
190
|
+
### `open-code-block`
|
|
191
|
+
|
|
192
|
+
- Parts: `copy`
|
|
193
|
+
- Variables: `--color-destructive`, `--color-foreground`, `--color-primary`,
|
|
194
|
+
`--default-transition-duration`, `--ease-in-out`, `--font-sans`,
|
|
195
|
+
`--font-weight-semibold`, `--radius-md`, `--spacing`, `--text-xs`,
|
|
196
|
+
`--tracking-wider`
|
|
197
|
+
- Since #1552 the component owns the copy chip only: the code surface and the
|
|
198
|
+
token inks belong to the host's build-time highlight pipeline and its
|
|
199
|
+
stylesheet, so the former Prism-derived token palette and surface variables
|
|
200
|
+
left the pinned surface in the same deliberate edit (the chip ink follows
|
|
201
|
+
the theme-aware `--color-foreground` role).
|
|
202
|
+
|
|
203
|
+
### `open-dialog`
|
|
204
|
+
|
|
205
|
+
- Parts: `overlay`, `header`, `close`, `body`, `footer`
|
|
206
|
+
- Variables: `--color-border`, `--color-foreground`,
|
|
207
|
+
`--color-muted-foreground`, `--color-popover`, `--color-primary`,
|
|
208
|
+
`--color-white`, `--color-zinc-950`, `--font-sans`,
|
|
209
|
+
`--font-weight-semibold`, `--leading-normal`, `--leading-tight`,
|
|
210
|
+
`--radius-md`, `--radius-xl`, `--shadow-2xl`, `--spacing`, `--text-base`,
|
|
211
|
+
`--text-xl`
|
|
212
|
+
- Shares the overlay recipe (below); the backdrop composes the zinc-950
|
|
213
|
+
scrim in both themes.
|
|
214
|
+
- Entry and exit animate through `transition-behavior: allow-discrete` +
|
|
215
|
+
`@starting-style` (no keyframes, no JS timing); under
|
|
216
|
+
`forced-colors: active` and `prefers-reduced-motion: reduce` the
|
|
217
|
+
transitions collapse and the dialog opens/closes immediately.
|
|
218
|
+
|
|
219
|
+
### `open-dropdown`
|
|
220
|
+
|
|
221
|
+
- Parts: `trigger`, `content`
|
|
222
|
+
- Variables: `--font-sans`, `--spacing`
|
|
223
|
+
- Shares the overlay recipe for the popover surface.
|
|
224
|
+
|
|
225
|
+
### `open-input`
|
|
226
|
+
|
|
227
|
+
- Parts: `wrapper`, `label`, `control`, `error`
|
|
228
|
+
- Variables: `--color-border`, `--color-destructive`, `--color-foreground`,
|
|
229
|
+
`--color-muted`, `--color-muted-foreground`, `--color-popover`,
|
|
230
|
+
`--color-primary`, `--color-violet-400`, `--font-sans`,
|
|
231
|
+
`--font-weight-medium`, `--radius-md`, `--spacing`, `--text-base`,
|
|
232
|
+
`--text-sm`, `--text-xs`, `--tracking-normal`
|
|
233
|
+
- Shares the control recipe; error/invalid states use
|
|
234
|
+
`--color-destructive`.
|
|
235
|
+
|
|
236
|
+
### `open-tabs`
|
|
237
|
+
|
|
238
|
+
- Parts: none (light-DOM decoration pattern; the tabs/panels stay in the
|
|
239
|
+
page's DOM, styled through inherited roles)
|
|
240
|
+
- Variables: `--color-border`, `--color-foreground`,
|
|
241
|
+
`--color-muted-foreground`, `--color-primary`, `--spacing`
|
|
242
|
+
|
|
243
|
+
### `open-theme-toggle`
|
|
244
|
+
|
|
245
|
+
- Parts: `toggle`, `icon-sun`, `icon-moon`
|
|
246
|
+
- Variables: `--color-background`, `--color-border`, `--color-foreground`,
|
|
247
|
+
`--color-muted-foreground`, `--color-popover`, `--color-primary`,
|
|
248
|
+
`--color-ring`, `--color-violet-400`, `--default-transition-duration`,
|
|
249
|
+
`--ease-in-out`, `--spacing`
|
|
250
|
+
|
|
251
|
+
### Shared recipes (`component-recipes.ts`)
|
|
252
|
+
|
|
253
|
+
- `controlRecipe` (`.control`): `--color-border`, `--color-foreground`,
|
|
254
|
+
`--color-popover`, `--color-primary`, `--color-ring`, `--color-violet-400`,
|
|
255
|
+
`--color-white`, `--default-transition-duration`, `--ease-out`,
|
|
256
|
+
`--radius-md`, `--spacing`
|
|
257
|
+
- `surfaceRecipe` (`.surface`) adds: `--color-card`, `--radius-lg`,
|
|
258
|
+
`--shadow-2xl`
|
|
259
|
+
- `overlayRecipe` (`.overlay`) adds: `--radius-xl`
|
|
260
|
+
|
|
261
|
+
## Deep customization
|
|
262
|
+
|
|
263
|
+
`::part()` reaches every interactive element. Beyond parts, recolor by
|
|
264
|
+
overriding the **roles** on `:root` (light), `:root[data-theme='dark']`
|
|
265
|
+
(dark), or inside the `forced-colors` media query — never by redefining
|
|
266
|
+
component internals. Example:
|
|
267
|
+
|
|
268
|
+
```css
|
|
269
|
+
:root {
|
|
270
|
+
--color-primary: oklch(54.1% 0.281 293.009); /* re-brand every component */
|
|
271
|
+
}
|
|
272
|
+
```
|
package/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# @openelement/ui
|
|
2
2
|
|
|
3
|
+
> Experimental product: maintained in the OpenElement repository, outside the
|
|
4
|
+
> 1.0 stable API promise. APIs may change without a migration path during Alpha.
|
|
5
|
+
|
|
6
|
+
Docs and guides: <https://openelement.org>.
|
|
7
|
+
|
|
3
8
|
First-party dogfood and reference UI package for OpenElement.
|
|
4
9
|
|
|
5
10
|
Element and Router are the two core products; Router includes Framework Mode.
|
|
@@ -12,10 +17,10 @@ prove the OpenElement authoring model with shadow/DSD output, explicit light DOM
|
|
|
12
17
|
where needed, and island upgrade. UI is a supporting reference surface, not a
|
|
13
18
|
separate application-framework promise.
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
There is **no Linear compatibility layer**: the `open-*-linear` components and
|
|
21
|
+
the `linear-token-sheet` token sheet are not part of the public surface. Use the
|
|
22
|
+
canonical components and the `@theme` role table in
|
|
23
|
+
[`src/theme.css`](./src/theme.css) instead.
|
|
19
24
|
|
|
20
25
|
## Install
|
|
21
26
|
|
|
@@ -30,7 +35,7 @@ npm install @openelement/ui
|
|
|
30
35
|
| `OpenButton` | `open-button` | Button component. |
|
|
31
36
|
| `OpenInput` | `open-input` | Input component. |
|
|
32
37
|
| `OpenCard` | `open-card` | Content card. |
|
|
33
|
-
| `OpenCodeBlock` | `open-code-block` | Code block with copy behavior;
|
|
38
|
+
| `OpenCodeBlock` | `open-code-block` | Code block with copy behavior; highlighting is the host's build-time step. |
|
|
34
39
|
| `OpenBadge` | `open-badge` | Status/content badge. |
|
|
35
40
|
| `OpenThemeToggle` | `open-theme-toggle` | Theme switch island. |
|
|
36
41
|
| `OpenDialog` | `open-dialog` | Modal/non-modal dialog. |
|
|
@@ -43,46 +48,72 @@ npm install @openelement/ui
|
|
|
43
48
|
Dependencies flow in one direction:
|
|
44
49
|
|
|
45
50
|
```text
|
|
46
|
-
|
|
47
|
-
->
|
|
48
|
-
->
|
|
49
|
-
-> Web Component primitives
|
|
51
|
+
@theme-derived token table (theme.css)
|
|
52
|
+
-> component recipes (role names, direct)
|
|
53
|
+
-> Web Component primitives
|
|
50
54
|
```
|
|
51
55
|
|
|
52
56
|
Tokens contain shared style values and classes and import no components.
|
|
53
57
|
Primitives may consume tokens but never composites. Composites may compose
|
|
54
58
|
primitives and tokens. Application routing and document navigation belongs to
|
|
55
|
-
`@openelement/
|
|
56
|
-
reference site
|
|
59
|
+
`@openelement/router`; the site layout component (`OpenLayout`) lives in the
|
|
60
|
+
reference site that consumes this package, not in it.
|
|
57
61
|
|
|
58
|
-
## `open-code-block` syntax highlighting
|
|
62
|
+
## `open-code-block` and syntax highlighting
|
|
59
63
|
|
|
60
|
-
`open-code-block` ships the copy button
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
`open-code-block` ships the copy button only. It bundles **no tokenizer and no
|
|
65
|
+
highlighting runtime** — the component stays cross-runtime, and since the
|
|
66
|
+
runtime-highlighter contract was retired (#1552) it no longer looks for a
|
|
67
|
+
global `Prism` either. The host page compiles its code fences to token-span
|
|
68
|
+
HTML at BUILD time (the reference site runs Shiki inside its markdown
|
|
69
|
+
pipeline) and projects the result through the slot; the projected content
|
|
70
|
+
stays light DOM, so the host's stylesheet owns the code surface and the token
|
|
71
|
+
inks, and the component only paints its chip.
|
|
67
72
|
|
|
68
73
|
```html
|
|
69
|
-
<
|
|
70
|
-
<script
|
|
71
|
-
src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-typescript.min.js"></script>
|
|
72
|
-
|
|
74
|
+
<!-- build time: markdown fences -> <pre class="shiki …"><code>…token spans…</code></pre> -->
|
|
73
75
|
<open-code-block>
|
|
74
|
-
<pre><code
|
|
76
|
+
<pre><code>const x: number = 1;</code></pre>
|
|
75
77
|
</open-code-block>
|
|
76
78
|
```
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
token
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
Without a host-side highlighting step the block renders plain text with the
|
|
81
|
+
copy button — an expected degradation, not a bug.
|
|
82
|
+
|
|
83
|
+
## Design tokens
|
|
84
|
+
|
|
85
|
+
The token layer is hand-maintained — there is no generator. One authored CSS
|
|
86
|
+
source, no shipped values:
|
|
87
|
+
|
|
88
|
+
- `src/theme.css` — **the single source of design roles** (P6: the only place
|
|
89
|
+
in the repository that defines them). shadcn-convention roles
|
|
90
|
+
(`--color-background`, `--color-primary`, …) seated on the Tailwind v4
|
|
91
|
+
default scale; roles reference only scale variables, dark pairs follow the
|
|
92
|
+
shadcn v4 convention with the selector re-pointed at this repo's
|
|
93
|
+
`[data-theme='dark']` mechanism, and a forced-colors layer re-seats every
|
|
94
|
+
role on a system color. Since alpha9 C2 the scale layer is the real
|
|
95
|
+
`@theme` block; role names are the migration contract. Since C3 (#1506) the
|
|
96
|
+
component recipes read these role names directly — the C1 alias layer
|
|
97
|
+
(`semantic-tokens.css`) was deleted under its own DELETION CONDITION, and
|
|
98
|
+
three non-shadcn status roles (`--color-success/-warning/-info`) joined the
|
|
99
|
+
table with the same forced-colors and dark-pair discipline.
|
|
100
|
+
|
|
101
|
+
**The package ships no token values.** The compiled `theme-tokens` twin
|
|
102
|
+
(`themeTokenCss` / `themeTokenSheet`) was deleted in alpha9 C5 — the role
|
|
103
|
+
names, dark pairs and forced-colors tier are the contract; the values come
|
|
104
|
+
from the `@openelement/router` Tailwind preset (ON) or a table the consumer
|
|
105
|
+
writes itself (OFF). See [CUSTOMIZATION.md](./CUSTOMIZATION.md),
|
|
106
|
+
"Value delivery".
|
|
107
|
+
|
|
108
|
+
The ui suite fails closed on the role contract (dark
|
|
109
|
+
pairs, forced-colors totality), on recipes consuming undeclared variables,
|
|
110
|
+
and on WCAG floors (3:1 focus ring, 4.5:1 status inks on the background and
|
|
111
|
+
their 10% recipe washes). `daisyClassSheet`, modal and step-card are retired
|
|
112
|
+
and must not reappear in exports, manifests, docs or packed artifacts.
|
|
113
|
+
|
|
114
|
+
The per-component customization surface (`::part` names, consumed variables,
|
|
115
|
+
the alpha8 alias→role rename map) is declared in
|
|
116
|
+
[CUSTOMIZATION.md](./CUSTOMIZATION.md) and pinned by test.
|
|
86
117
|
|
|
87
118
|
Existing per-component imports remain stable across this layering change.
|
|
88
119
|
|
|
@@ -94,7 +125,7 @@ metadata) so openElement can include these components in package manifest
|
|
|
94
125
|
scanning:
|
|
95
126
|
|
|
96
127
|
```ts
|
|
97
|
-
import { openElement } from '@openelement/
|
|
128
|
+
import { openElement } from '@openelement/router/vite';
|
|
98
129
|
|
|
99
130
|
export default {
|
|
100
131
|
plugins: [
|
|
@@ -127,7 +158,9 @@ manifest; the per-component JSDoc is the source of truth for those.
|
|
|
127
158
|
@openelement/ui/open-callout
|
|
128
159
|
@openelement/ui/open-dropdown
|
|
129
160
|
@openelement/ui/open-tabs
|
|
130
|
-
@openelement/ui/
|
|
161
|
+
@openelement/ui/theme.css (the @theme role source; compiled through the router preset)
|
|
162
|
+
@openelement/ui/instance-state (per-element instance state store; tree-shakeable leaf)
|
|
163
|
+
@openelement/ui/manifest (generated WC package manifest; node-safe leaf)
|
|
131
164
|
```
|
|
132
165
|
|
|
133
166
|
## License
|
package/package.json
CHANGED
|
@@ -1,60 +1,77 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openelement/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
6
7
|
"exports": {
|
|
7
8
|
".": {
|
|
9
|
+
"types": "./src/index.d.ts",
|
|
8
10
|
"import": "./src/index.js",
|
|
9
11
|
"default": "./src/index.js"
|
|
10
12
|
},
|
|
13
|
+
"./manifest": {
|
|
14
|
+
"types": "./src/manifest.d.ts",
|
|
15
|
+
"import": "./src/manifest.js",
|
|
16
|
+
"default": "./src/manifest.js"
|
|
17
|
+
},
|
|
11
18
|
"./open-button": {
|
|
19
|
+
"types": "./src/open-button.d.ts",
|
|
12
20
|
"import": "./src/open-button.js",
|
|
13
21
|
"default": "./src/open-button.js"
|
|
14
22
|
},
|
|
15
23
|
"./open-card": {
|
|
24
|
+
"types": "./src/open-card.d.ts",
|
|
16
25
|
"import": "./src/open-card.js",
|
|
17
26
|
"default": "./src/open-card.js"
|
|
18
27
|
},
|
|
19
28
|
"./open-input": {
|
|
29
|
+
"types": "./src/open-input.d.ts",
|
|
20
30
|
"import": "./src/open-input.js",
|
|
21
31
|
"default": "./src/open-input.js"
|
|
22
32
|
},
|
|
23
33
|
"./open-code-block": {
|
|
34
|
+
"types": "./src/open-code-block.d.ts",
|
|
24
35
|
"import": "./src/open-code-block.js",
|
|
25
36
|
"default": "./src/open-code-block.js"
|
|
26
37
|
},
|
|
27
38
|
"./open-badge": {
|
|
39
|
+
"types": "./src/open-badge.d.ts",
|
|
28
40
|
"import": "./src/open-badge.js",
|
|
29
41
|
"default": "./src/open-badge.js"
|
|
30
42
|
},
|
|
31
43
|
"./open-theme-toggle": {
|
|
44
|
+
"types": "./src/open-theme-toggle.d.ts",
|
|
32
45
|
"import": "./src/open-theme-toggle.js",
|
|
33
46
|
"default": "./src/open-theme-toggle.js"
|
|
34
47
|
},
|
|
35
48
|
"./open-dialog": {
|
|
49
|
+
"types": "./src/open-dialog.d.ts",
|
|
36
50
|
"import": "./src/open-dialog.js",
|
|
37
51
|
"default": "./src/open-dialog.js"
|
|
38
52
|
},
|
|
39
53
|
"./open-callout": {
|
|
54
|
+
"types": "./src/open-callout.d.ts",
|
|
40
55
|
"import": "./src/open-callout.js",
|
|
41
56
|
"default": "./src/open-callout.js"
|
|
42
57
|
},
|
|
43
58
|
"./open-dropdown": {
|
|
59
|
+
"types": "./src/open-dropdown.d.ts",
|
|
44
60
|
"import": "./src/open-dropdown.js",
|
|
45
61
|
"default": "./src/open-dropdown.js"
|
|
46
62
|
},
|
|
47
63
|
"./open-tabs": {
|
|
64
|
+
"types": "./src/open-tabs.d.ts",
|
|
48
65
|
"import": "./src/open-tabs.js",
|
|
49
66
|
"default": "./src/open-tabs.js"
|
|
50
67
|
},
|
|
51
|
-
"./
|
|
52
|
-
"
|
|
53
|
-
"
|
|
68
|
+
"./instance-state": {
|
|
69
|
+
"types": "./src/instance-state.d.ts",
|
|
70
|
+
"import": "./src/instance-state.js",
|
|
71
|
+
"default": "./src/instance-state.js"
|
|
54
72
|
},
|
|
55
|
-
"./
|
|
56
|
-
"
|
|
57
|
-
"default": "./src/open-props-tokens.js"
|
|
73
|
+
"./theme.css": {
|
|
74
|
+
"default": "./src/theme.css"
|
|
58
75
|
}
|
|
59
76
|
},
|
|
60
77
|
"repository": {
|
|
@@ -64,15 +81,20 @@
|
|
|
64
81
|
"homepage": "https://openelement.org",
|
|
65
82
|
"bugs": "https://github.com/open-element/openelement/issues",
|
|
66
83
|
"license": "MIT",
|
|
67
|
-
"description": "
|
|
84
|
+
"description": "Experimental reference Web Components and UI primitives built on the OpenElement runtime.",
|
|
68
85
|
"keywords": [
|
|
69
86
|
"openelement",
|
|
70
87
|
"web-components",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
88
|
+
"ui",
|
|
89
|
+
"design-tokens",
|
|
90
|
+
"experimental"
|
|
74
91
|
],
|
|
92
|
+
"engines": {
|
|
93
|
+
"node": ">=24.2"
|
|
94
|
+
},
|
|
95
|
+
"sideEffects": false,
|
|
96
|
+
"peerDependenciesMeta": {},
|
|
75
97
|
"dependencies": {
|
|
76
|
-
"@openelement/element": "0.
|
|
98
|
+
"@openelement/element": "1.0.0-alpha.10"
|
|
77
99
|
}
|
|
78
100
|
}
|