@openelement/ui 0.44.0-beta.2.1 → 1.0.0-alpha.1
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/README.md +38 -10
- package/THIRD_PARTY_NOTICES.md +45 -0
- package/package.json +20 -4
- package/src/component-recipes.js +0 -1
- package/src/generated-manifest.json +2 -1
- package/src/index.d.ts +42 -0
- package/src/index.js +2 -3
- package/src/instance-state.js +1 -2
- package/src/manifest.d.ts +9 -0
- package/src/manifest.js +4 -3
- package/src/open-badge.d.ts +185 -0
- package/src/open-badge.js +0 -92
- package/src/open-button.d.ts +961 -0
- package/src/open-button.js +8 -487
- package/src/open-callout.d.ts +402 -0
- package/src/open-callout.js +0 -245
- package/src/open-card.d.ts +168 -0
- package/src/open-card.js +0 -126
- package/src/open-code-block.d.ts +192 -0
- package/src/open-code-block.js +13 -133
- package/src/open-dialog.d.ts +454 -0
- package/src/open-dialog.js +0 -347
- package/src/open-dropdown.d.ts +282 -0
- package/src/open-dropdown.js +18 -203
- package/src/open-input.d.ts +1497 -0
- package/src/open-input.js +0 -772
- package/src/open-props-tokens.d.ts +9 -0
- package/src/open-props-tokens.js +140 -81
- package/src/open-tabs.d.ts +218 -0
- package/src/open-tabs.js +0 -143
- package/src/open-theme-toggle.d.ts +312 -0
- package/src/open-theme-toggle.js +5 -296
- package/src/register.d.ts +1 -0
- package/src/register.js +0 -1
- package/src/{open-props-tokens.css → semantic-tokens.css} +97 -70
|
@@ -1,20 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @openelement/ui -
|
|
2
|
+
* @openelement/ui - semantic token layer (hand-maintained single source).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Everything here is OURS: tuned primitives, semantic roles, light/dark
|
|
5
|
+
* themes, the :host structural fallback, and the CJK font stacks. Tokens that
|
|
6
|
+
* match upstream open-props verbatim (gray ramp, indigo-6, border sizes,
|
|
7
|
+
* font weights, two line-heights) are NOT listed here — they are injected at
|
|
8
|
+
* the @upstream-tokens anchor below by packages/ui/tools/generate-ui-tokens.ts
|
|
9
|
+
* (deno task --cwd packages/ui generate:ui-tokens), which reads them from the real
|
|
10
|
+
* open-props npm dependency. Do not re-add them here: the generator fails on
|
|
11
|
+
* any duplication.
|
|
7
12
|
*
|
|
8
|
-
*
|
|
13
|
+
* Intentional divergences from open-props (do not "fix" by copying upstream):
|
|
14
|
+
* - violet/green/red/orange scales are re-tuned (brand AA on light and dark
|
|
15
|
+
* surfaces; upstream dark entries would invert shadow/hover semantics).
|
|
16
|
+
* - --size-* is a px step scale (upstream is rem-based and larger).
|
|
17
|
+
* - --radius-*, --font-size-*, --font-letterspacing-*, --ease-*, --shadow-*
|
|
18
|
+
* are tuned for the component layer (upstream values differ).
|
|
19
|
+
* - dark ramps are our own inversion (open-props ships no dark mode).
|
|
20
|
+
*
|
|
21
|
+
* The token block selects :root, :host so one generated sheet serves both
|
|
22
|
+
* the document root and shadow adoption; only the structural fallback is
|
|
23
|
+
* :host-exclusive (display/containment must never land on <html>).
|
|
9
24
|
*/
|
|
10
25
|
|
|
11
26
|
:host {
|
|
12
27
|
display: block;
|
|
13
28
|
min-height: 1px;
|
|
14
29
|
contain: layout style;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:root,
|
|
33
|
+
:host {
|
|
34
|
+
/* @upstream-tokens */
|
|
15
35
|
|
|
16
36
|
/* ═══════════════════════════════════════════════
|
|
17
|
-
Spacing scale
|
|
37
|
+
Spacing scale (tuned px steps — not upstream rem sizes)
|
|
18
38
|
═══════════════════════════════════════════════ */
|
|
19
39
|
--size-1: 4px;
|
|
20
40
|
--size-2: 8px;
|
|
@@ -30,24 +50,7 @@
|
|
|
30
50
|
--size-16: 64px;
|
|
31
51
|
|
|
32
52
|
/* ═══════════════════════════════════════════════
|
|
33
|
-
|
|
34
|
-
═══════════════════════════════════════════════ */
|
|
35
|
-
--gray-0: #f8f9fa;
|
|
36
|
-
--gray-1: #f1f3f5;
|
|
37
|
-
--gray-2: #e9ecef;
|
|
38
|
-
--gray-3: #dee2e6;
|
|
39
|
-
--gray-4: #ced4da;
|
|
40
|
-
--gray-5: #adb5bd;
|
|
41
|
-
--gray-6: #868e96;
|
|
42
|
-
--gray-7: #495057;
|
|
43
|
-
--gray-8: #343a40;
|
|
44
|
-
--gray-9: #212529;
|
|
45
|
-
--gray-10: #16191d;
|
|
46
|
-
--gray-11: #0d0f12;
|
|
47
|
-
--gray-12: #030507;
|
|
48
|
-
|
|
49
|
-
/* ═══════════════════════════════════════════════
|
|
50
|
-
Border radius
|
|
53
|
+
Border radius (tuned — not upstream radii)
|
|
51
54
|
═══════════════════════════════════════════════ */
|
|
52
55
|
--radius-1: 6px;
|
|
53
56
|
--radius-2: 8px;
|
|
@@ -55,23 +58,27 @@
|
|
|
55
58
|
--radius-4: 20px;
|
|
56
59
|
--radius-round: 9999px;
|
|
57
60
|
|
|
58
|
-
/* ═══════════════════════════════════════════════
|
|
59
|
-
Border size
|
|
60
|
-
═══════════════════════════════════════════════ */
|
|
61
|
-
--border-size-1: 1px;
|
|
62
|
-
--border-size-2: 2px;
|
|
63
|
-
|
|
64
61
|
/* ═══════════════════════════════════════════════
|
|
65
62
|
Shadows
|
|
66
63
|
═══════════════════════════════════════════════ */
|
|
64
|
+
/* Shadows read as ink, so the color must flip per theme: gray-12 is a dark
|
|
65
|
+
ink in light mode but flips to near-white in dark mode, which turned every
|
|
66
|
+
large shadow into a white glow. --shadow-color carries the theme-aware
|
|
67
|
+
ink; --shadow-2 is the elevation-2 ambient built on it. */
|
|
67
68
|
--shadow-1: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
69
|
+
--shadow-color: var(--violet-12);
|
|
70
|
+
--shadow-2: 0 20px 60px color-mix(in srgb, var(--shadow-color) 20%, transparent);
|
|
68
71
|
|
|
69
72
|
/* ═══════════════════════════════════════════════
|
|
70
|
-
Typography
|
|
73
|
+
Typography (tuned stacks/sizes/spacing; weights + lineheight 3/4 are
|
|
74
|
+
upstream-verbatim and injected at the anchor above)
|
|
71
75
|
═══════════════════════════════════════════════ */
|
|
72
76
|
--font-sans: 'JetBrains Mono', monospace;
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
/* CJK fallbacks: the Latin-only faces render CJK glyphs as tofu/system
|
|
78
|
+
substitution with mismatched metrics. Serif gets Songti/Noto Serif CJK so
|
|
79
|
+
zh italic accents stay serif, not synthetic-slanted sans. */
|
|
80
|
+
--font-mono: 'JetBrains Mono', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace;
|
|
81
|
+
--font-serif: 'Instrument Serif', 'Songti SC', 'Noto Serif CJK SC', serif;
|
|
75
82
|
--font-size-00: 0.75rem;
|
|
76
83
|
--font-size-0: 0.875rem;
|
|
77
84
|
--font-size-1: 1rem;
|
|
@@ -82,24 +89,13 @@
|
|
|
82
89
|
--font-size-6: 3.125rem;
|
|
83
90
|
--font-size-7: 4rem;
|
|
84
91
|
--font-size-8: 5.5rem;
|
|
85
|
-
--font-weight-4: 400;
|
|
86
|
-
--font-weight-5: 500;
|
|
87
|
-
--font-weight-6: 600;
|
|
88
|
-
--font-weight-7: 700;
|
|
89
|
-
--font-weight-8: 800;
|
|
90
|
-
--font-weight-9: 900;
|
|
91
|
-
--font-letterspacing-0: 0;
|
|
92
|
-
--font-letterspacing-1: 0;
|
|
93
92
|
--font-letterspacing-2: 0;
|
|
94
|
-
--font-letterspacing-3: 0;
|
|
95
93
|
--font-letterspacing-4: 0.04em;
|
|
96
94
|
--font-letterspacing-5: 0.08em;
|
|
97
95
|
--font-lineheight-1: 0.95;
|
|
98
|
-
--font-lineheight-3: 1.5;
|
|
99
|
-
--font-lineheight-4: 1.75;
|
|
100
96
|
|
|
101
97
|
/* ═══════════════════════════════════════════════
|
|
102
|
-
Animation easing
|
|
98
|
+
Animation easing (tuned — not upstream easings)
|
|
103
99
|
═══════════════════════════════════════════════ */
|
|
104
100
|
--ease-1: cubic-bezier(0.25, 0, 0.5, 1);
|
|
105
101
|
--ease-2: cubic-bezier(0.45, 0, 0.25, 1);
|
|
@@ -114,8 +110,10 @@
|
|
|
114
110
|
/* ═══════════════════════════════════════════════
|
|
115
111
|
Brand tokens
|
|
116
112
|
═══════════════════════════════════════════════ */
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
/* Light brand = violet-7: violet-6 (#8262db) put --on-brand at 4.22:1 and the
|
|
114
|
+
12px brand text at 4.21:1 on white — both under the 4.5:1 AA floor. */
|
|
115
|
+
--brand: var(--violet-7);
|
|
116
|
+
--brand-hover: var(--violet-8);
|
|
119
117
|
--brand-light: var(--violet-4);
|
|
120
118
|
--brand-pale: var(--violet-1);
|
|
121
119
|
--brand-deep: var(--violet-11);
|
|
@@ -168,7 +166,14 @@
|
|
|
168
166
|
--tab-radius: var(--radius-1);
|
|
169
167
|
|
|
170
168
|
/* Shared component recipes: primitives consume these semantic roles only. */
|
|
171
|
-
|
|
169
|
+
/* Focus ring ink: --brand. The previous mix of --brand-light with white
|
|
170
|
+
resolved to #c1acff in light mode — 1.98:1 on white, 1.88:1 on gray-0,
|
|
171
|
+
1.81:1 on the surface tint — all below the WCAG 1.4.11 non-text floor of
|
|
172
|
+
3:1, while --brand measures 6.03:1 on white. The same declaration serves
|
|
173
|
+
dark mode, where --brand flips to violet-7 (#9c7df2, 6.22:1 on the dark
|
|
174
|
+
base). Keep it on --brand so the ring and its hover/border siblings stay
|
|
175
|
+
one source (open-input.tsx already focuses with --brand). */
|
|
176
|
+
--focus-ring: var(--brand);
|
|
172
177
|
--ui-control-text: var(--text-primary);
|
|
173
178
|
--ui-control-bg: color-mix(in srgb, var(--bg-elevated) 78%, transparent);
|
|
174
179
|
--ui-control-border: color-mix(in srgb, var(--border) 72%, var(--brand));
|
|
@@ -182,8 +187,8 @@
|
|
|
182
187
|
--surface-radius: var(--radius-2);
|
|
183
188
|
--overlay-radius: var(--radius-3);
|
|
184
189
|
--surface-highlight: inset 0 1px 0 color-mix(in srgb, white 8%, transparent);
|
|
185
|
-
--surface-shadow:
|
|
186
|
-
--overlay-shadow: 0 28px 90px color-mix(in srgb, var(--
|
|
190
|
+
--surface-shadow: var(--shadow-2);
|
|
191
|
+
--overlay-shadow: 0 28px 90px color-mix(in srgb, var(--shadow-color) 48%, transparent);
|
|
187
192
|
|
|
188
193
|
/* ═══════════════════════════════════════════════
|
|
189
194
|
UI Semantic Tokens (light defaults)
|
|
@@ -191,7 +196,10 @@
|
|
|
191
196
|
═══════════════════════════════════════════════ */
|
|
192
197
|
--text-primary: var(--gray-9);
|
|
193
198
|
--text-secondary: var(--gray-8);
|
|
194
|
-
--
|
|
199
|
+
/* Muted copy must clear the 4.5:1 AA floor on --bg-base/#f9f8fc: gray-5 is
|
|
200
|
+
1.97:1. gray-7 is the lightest gray that clears it (7.74:1) and stays muted
|
|
201
|
+
against --text-secondary. Dark keeps gray-6 (5.6:1 on the dark base). */
|
|
202
|
+
--text-muted: var(--gray-7);
|
|
195
203
|
--bg-base: color-mix(in srgb, var(--violet-0) 42%, var(--gray-0));
|
|
196
204
|
--bg-surface: color-mix(in srgb, var(--violet-0) 32%, var(--gray-1));
|
|
197
205
|
--bg-card: color-mix(in srgb, var(--violet-0) 18%, var(--gray-0));
|
|
@@ -203,26 +211,31 @@
|
|
|
203
211
|
--code-text: var(--gray-2);
|
|
204
212
|
--border: var(--gray-3);
|
|
205
213
|
--border-hover: var(--gray-4);
|
|
206
|
-
--
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
--
|
|
213
|
-
--
|
|
214
|
+
/* Status colors clear the 4.5:1 AA floor on --bg-base/#f9f8fc (measured):
|
|
215
|
+
success #237032 5.8:1, warning #885b00 5.6:1, error #b12525 6.3:1,
|
|
216
|
+
info #2157cf 6.0:1. Badges paint the ink on a 10% wash of itself, which
|
|
217
|
+
lowers the ratio, so the floor is verified against that wash too (the
|
|
218
|
+
dimmest pair, warning, measures 4.9:1). The dark overrides below are
|
|
219
|
+
measured at >=4.9:1 on their wash in both themes. */
|
|
220
|
+
--error: #b12525;
|
|
221
|
+
--error-subtle: rgba(177, 37, 37, 0.1);
|
|
222
|
+
--success: #237032;
|
|
223
|
+
--success-subtle: rgba(35, 112, 50, 0.1);
|
|
224
|
+
--warning: #885b00;
|
|
225
|
+
--warning-subtle: rgba(136, 91, 0, 0.1);
|
|
226
|
+
--info: #2157cf;
|
|
227
|
+
--info-subtle: rgba(33, 87, 207, 0.1);
|
|
214
228
|
--overlay: rgba(0, 0, 0, 0.4);
|
|
215
229
|
--nav-bg: color-mix(in srgb, var(--bg-base) 86%, transparent);
|
|
216
|
-
--nav-height:
|
|
230
|
+
--nav-height: var(--size-16);
|
|
217
231
|
--nav-link-color: var(--text-primary);
|
|
218
232
|
--nav-link-hover: var(--brand);
|
|
219
233
|
--nav-link-size: var(--font-size-0);
|
|
220
234
|
|
|
221
235
|
/* ═══════════════════════════════════════════════
|
|
222
|
-
|
|
223
|
-
|
|
236
|
+
Tuned color scales (re-tuned from open-props — see file header;
|
|
237
|
+
only --indigo-6 is upstream-verbatim and injected at the anchor)
|
|
224
238
|
═══════════════════════════════════════════════ */
|
|
225
|
-
--indigo-6: #4c6ef5;
|
|
226
239
|
--green-0: #ebfbee;
|
|
227
240
|
--green-1: #d3f9d8;
|
|
228
241
|
--green-2: #b2f2bb;
|
|
@@ -278,10 +291,11 @@
|
|
|
278
291
|
}
|
|
279
292
|
|
|
280
293
|
/* ═══════════════════════════════════════════════
|
|
281
|
-
Dark Mode — matches
|
|
282
|
-
|
|
283
|
-
(
|
|
294
|
+
Dark Mode — matches the document root or a host carrying
|
|
295
|
+
data-theme="dark" (one sheet serves both), so all shadow DOMs inherit.
|
|
296
|
+
Our own inversion (open-props ships no dark mode).
|
|
284
297
|
═══════════════════════════════════════════════ */
|
|
298
|
+
:root[data-theme='dark'],
|
|
285
299
|
:host([data-theme='dark']) {
|
|
286
300
|
--gray-0: #030507;
|
|
287
301
|
--gray-1: #0d0f12;
|
|
@@ -296,13 +310,26 @@
|
|
|
296
310
|
--gray-10: #e9ecef;
|
|
297
311
|
--gray-11: #f1f3f5;
|
|
298
312
|
--gray-12: #f8f9fa;
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
313
|
+
/* Dark brand = violet-7: violet-6 (#8262db) cleared AA only on the page base
|
|
314
|
+
(4.54:1) and failed as text on the raised surfaces (4.31:1 on elevated,
|
|
315
|
+
3.92:1 on cards). violet-7 clears all three (6.38 / 6.06 / 5.51) and still
|
|
316
|
+
seats the near-black --on-brand ink (6.44:1). --on-brand flips per theme to
|
|
317
|
+
the ramp extreme — the only ink that clears AA against the fill. */
|
|
318
|
+
--brand: var(--violet-7);
|
|
319
|
+
--brand-hover: var(--violet-8);
|
|
320
|
+
/* --brand-light is a light brand tint in both themes; the dark ramp is
|
|
321
|
+
mirrored, so violet-4 (#58399e) would be a *dark* violet here. violet-8 is
|
|
322
|
+
the dark entry carrying the light theme's #b59cff. It stays a tint: never
|
|
323
|
+
an ink over a light surface (see open-button.tsx). */
|
|
324
|
+
--brand-light: var(--violet-8);
|
|
302
325
|
--brand-deep: var(--violet-12);
|
|
303
326
|
--brand-subtle: color-mix(in srgb, var(--brand) 16%, transparent);
|
|
304
327
|
--brand-glow: color-mix(in srgb, var(--brand) 22%, transparent);
|
|
305
|
-
|
|
328
|
+
/* Pale wash stays a translucent brand tint in dark: violet-1's dark-ramp
|
|
329
|
+
entry is a deep violet, which inverted the hover-wash semantics. */
|
|
330
|
+
--brand-pale: color-mix(in srgb, var(--brand) 18%, transparent);
|
|
331
|
+
--shadow-color: rgb(0 0 0);
|
|
332
|
+
--on-brand: var(--gray-0);
|
|
306
333
|
--text-primary: var(--gray-10);
|
|
307
334
|
--text-secondary: var(--gray-8);
|
|
308
335
|
--text-muted: var(--gray-6);
|