@openelement/ui 1.0.0-alpha.8 → 1.0.0-alpha.9

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.
@@ -1,464 +0,0 @@
1
- import { StyleSheet } from "@openelement/element";
2
- //#region src/open-props-tokens.ts
3
- /**
4
- * GENERATED — do not edit; source: open-props@1.7.23 (MIT) + semantic-tokens.css.
5
- * Regenerate with: pnpm --filter @openelement/ui run generate:ui-tokens
6
- */
7
- const OPEN_PROPS_TOKEN_CSS = `/**
8
- * GENERATED — do not edit; source: open-props@1.7.23 (MIT) + semantic-tokens.css.
9
- * Regenerate with: pnpm --filter @openelement/ui run generate:ui-tokens
10
- */
11
-
12
- /**
13
- * @openelement/ui - semantic token layer (hand-maintained single source).
14
- *
15
- * Everything here is OURS: tuned primitives, semantic roles, light/dark
16
- * themes, the :host structural fallback, and the CJK font stacks. Tokens that
17
- * match upstream open-props verbatim (gray ramp, indigo-6, border sizes,
18
- * font weights, two line-heights) are NOT listed here — they are injected at
19
- * the @upstream-tokens anchor below by the ui tokens generator
20
- * (deno task generate:ui-tokens), which reads them from the real
21
- * open-props npm dependency. Do not re-add them here: the generator fails on
22
- * any duplication.
23
- *
24
- * Intentional divergences from open-props (do not "fix" by copying upstream):
25
- * - violet/green/red/orange scales are re-tuned (brand AA on light and dark
26
- * surfaces; upstream dark entries would invert shadow/hover semantics).
27
- * - --size-* is a px step scale (upstream is rem-based and larger).
28
- * - --radius-*, --font-size-*, --font-letterspacing-*, --ease-*, --shadow-*
29
- * are tuned for the component layer (upstream values differ).
30
- * - dark ramps are our own inversion (open-props ships no dark mode).
31
- *
32
- * The token block selects :root, :host so one generated sheet serves both
33
- * the document root and shadow adoption; only the structural fallback is
34
- * :host-exclusive (display/containment must never land on <html>).
35
- */
36
-
37
- :host {
38
- display: block;
39
- min-height: 1px;
40
- contain: layout style;
41
- }
42
-
43
- :root,
44
- :host {
45
- /* src/props.colors.js (Gray) — open-props@1.7.23 (MIT), verbatim */
46
- --gray-0: #f8f9fa;
47
- --gray-1: #f1f3f5;
48
- --gray-2: #e9ecef;
49
- --gray-3: #dee2e6;
50
- --gray-4: #ced4da;
51
- --gray-5: #adb5bd;
52
- --gray-6: #868e96;
53
- --gray-7: #495057;
54
- --gray-8: #343a40;
55
- --gray-9: #212529;
56
- --gray-10: #16191d;
57
- --gray-11: #0d0f12;
58
- --gray-12: #030507;
59
-
60
- /* src/props.colors.js (Indigo) — open-props@1.7.23 (MIT), verbatim */
61
- --indigo-6: #4c6ef5;
62
-
63
- /* src/props.borders.js — open-props@1.7.23 (MIT), verbatim */
64
- --border-size-1: 1px;
65
- --border-size-2: 2px;
66
-
67
- /* src/props.fonts.js — open-props@1.7.23 (MIT), verbatim */
68
- --font-weight-4: 400;
69
- --font-weight-5: 500;
70
- --font-weight-6: 600;
71
- --font-weight-7: 700;
72
- --font-weight-8: 800;
73
- --font-weight-9: 900;
74
- --font-lineheight-3: 1.5;
75
- --font-lineheight-4: 1.75;
76
-
77
- /* ═══════════════════════════════════════════════
78
- Spacing scale (tuned px steps — not upstream rem sizes)
79
- ═══════════════════════════════════════════════ */
80
- --size-1: 4px;
81
- --size-2: 8px;
82
- --size-3: 12px;
83
- --size-4: 16px;
84
- --size-5: 20px;
85
- --size-6: 24px;
86
- --size-7: 28px;
87
- --size-8: 32px;
88
- --size-9: 36px;
89
- --size-10: 40px;
90
- --size-12: 48px;
91
- --size-16: 64px;
92
-
93
- /* ═══════════════════════════════════════════════
94
- Border radius (tuned — not upstream radii)
95
- ═══════════════════════════════════════════════ */
96
- --radius-1: 6px;
97
- --radius-2: 8px;
98
- --radius-3: 12px;
99
- --radius-4: 20px;
100
- --radius-round: 9999px;
101
-
102
- /* ═══════════════════════════════════════════════
103
- Shadows
104
- ═══════════════════════════════════════════════ */
105
- /* Shadows read as ink, so the color must flip per theme: gray-12 is a dark
106
- ink in light mode but flips to near-white in dark mode, which turned every
107
- large shadow into a white glow. --shadow-color carries the theme-aware
108
- ink; --shadow-2 is the elevation-2 ambient built on it. */
109
- --shadow-1: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
110
- --shadow-color: var(--violet-12);
111
- --shadow-2: 0 20px 60px color-mix(in srgb, var(--shadow-color) 20%, transparent);
112
-
113
- /* ═══════════════════════════════════════════════
114
- Typography (tuned stacks/sizes/spacing; weights + lineheight 3/4 are
115
- upstream-verbatim and injected at the anchor above)
116
- ═══════════════════════════════════════════════ */
117
- --font-sans: 'JetBrains Mono', monospace;
118
- /* CJK fallbacks: the Latin-only faces render CJK glyphs as tofu/system
119
- substitution with mismatched metrics. Serif gets Songti/Noto Serif CJK so
120
- zh italic accents stay serif, not synthetic-slanted sans. */
121
- --font-mono: 'JetBrains Mono', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace;
122
- --font-serif: 'Instrument Serif', 'Songti SC', 'Noto Serif CJK SC', serif;
123
- --font-size-00: 0.75rem;
124
- --font-size-0: 0.875rem;
125
- --font-size-1: 1rem;
126
- --font-size-2: 1.25rem;
127
- --font-size-3: 1.5rem;
128
- --font-size-4: 2rem;
129
- --font-size-5: 2.5rem;
130
- --font-size-6: 3.125rem;
131
- --font-size-7: 4rem;
132
- --font-size-8: 5.5rem;
133
- --font-letterspacing-2: 0;
134
- --font-letterspacing-4: 0.04em;
135
- --font-letterspacing-5: 0.08em;
136
- --font-lineheight-1: 0.95;
137
-
138
- /* ═══════════════════════════════════════════════
139
- Animation easing (tuned — not upstream easings)
140
- ═══════════════════════════════════════════════ */
141
- --ease-1: cubic-bezier(0.25, 0, 0.5, 1);
142
- --ease-2: cubic-bezier(0.45, 0, 0.25, 1);
143
- --ease-3: cubic-bezier(0.5, 0, 0, 1);
144
- --duration-2: 200ms;
145
- --motion-fast: 160ms;
146
- --motion-medium: 320ms;
147
- --motion-standard: cubic-bezier(.2,.8,.2,1);
148
- --focus-size: 2px;
149
- --focus-offset: 3px;
150
-
151
- /* ═══════════════════════════════════════════════
152
- Brand tokens
153
- ═══════════════════════════════════════════════ */
154
- /* Light brand = violet-7: violet-6 (#8262db) put --on-brand at 4.22:1 and the
155
- 12px brand text at 4.21:1 on white — both under the 4.5:1 AA floor. */
156
- --brand: var(--violet-7);
157
- --brand-hover: var(--violet-8);
158
- --brand-light: var(--violet-4);
159
- --brand-pale: var(--violet-1);
160
- --brand-deep: var(--violet-11);
161
- --brand-subtle: color-mix(in srgb, var(--brand) 12%, transparent);
162
- --brand-glow: color-mix(in srgb, var(--brand) 24%, transparent);
163
- --on-brand: var(--gray-0);
164
- --site-container: 1120px;
165
- --site-container-wide: 1240px;
166
- --site-container-reading: 760px;
167
- --site-section-block: var(--size-16);
168
- --site-section-gap: var(--size-8);
169
-
170
- /* ═══════════════════════════════════════════════
171
- Component semantic defaults
172
- ═══════════════════════════════════════════════ */
173
- --btn-padding-x: var(--size-4);
174
- --btn-padding-y: var(--size-2);
175
- --btn-radius: var(--radius-1);
176
- --btn-font-size: var(--font-size-0);
177
- --btn-font-weight: var(--font-weight-7);
178
- --btn-text-case: none;
179
- --card-padding: var(--size-6);
180
- --card-radius: var(--radius-1);
181
- --badge-padding-x: var(--size-2);
182
- --badge-padding-y: 2px;
183
- --badge-radius: var(--radius-1);
184
- --badge-font-size: var(--font-size-00);
185
- --alert-padding: var(--size-4);
186
- --alert-radius: var(--radius-2);
187
- --input-padding-x: var(--size-3);
188
- --input-padding-y: var(--size-2);
189
- --input-radius: var(--radius-1);
190
- --input-font-size: var(--font-size-0);
191
- --input-border-color: var(--border);
192
- --divider-margin: var(--size-4) 0;
193
- --divider-color: var(--border);
194
- --tooltip-bg: var(--gray-9);
195
- --tooltip-color: var(--gray-0);
196
- --tooltip-radius: var(--radius-1);
197
- --tooltip-padding: var(--size-1) var(--size-2);
198
- --modal-bg: var(--bg-elevated);
199
- --modal-radius: var(--radius-3);
200
- --modal-padding: var(--size-6);
201
- --menu-padding: var(--size-2);
202
- --menu-radius: var(--radius-2);
203
- --menu-item-padding: var(--size-2) var(--size-4);
204
- --dropdown-bg: var(--bg-elevated);
205
- --dropdown-radius: var(--radius-2);
206
- --tab-padding: var(--size-2) var(--size-4);
207
- --tab-radius: var(--radius-1);
208
-
209
- /* Shared component recipes: primitives consume these semantic roles only. */
210
- /* Focus ring ink: --brand. The previous mix of --brand-light with white
211
- resolved to #c1acff in light mode — 1.98:1 on white, 1.88:1 on gray-0,
212
- 1.81:1 on the surface tint — all below the WCAG 1.4.11 non-text floor of
213
- 3:1, while --brand measures 6.03:1 on white. The same declaration serves
214
- dark mode, where --brand flips to violet-7 (#9c7df2, 6.22:1 on the dark
215
- base). Keep it on --brand so the ring and its hover/border siblings stay
216
- one source (open-input.tsx already focuses with --brand). */
217
- --focus-ring: var(--brand);
218
- --ui-control-text: var(--text-primary);
219
- --ui-control-bg: color-mix(in srgb, var(--bg-elevated) 78%, transparent);
220
- --ui-control-border: color-mix(in srgb, var(--border) 72%, var(--brand));
221
- --ui-control-border-hover: color-mix(in srgb, var(--brand-light) 74%, var(--border));
222
- --ui-control-radius: var(--radius-1);
223
- --ui-control-highlight: inset 0 1px 0 color-mix(in srgb, white 12%, transparent);
224
- --surface-glass: linear-gradient(145deg, color-mix(in srgb, var(--brand) 9%, var(--bg-card)), color-mix(in srgb, var(--bg-card) 90%, transparent));
225
- --surface-overlay: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
226
- --surface-border: color-mix(in srgb, var(--border) 78%, var(--brand));
227
- --surface-border-strong: color-mix(in srgb, var(--border-hover) 62%, var(--brand));
228
- --surface-radius: var(--radius-2);
229
- --overlay-radius: var(--radius-3);
230
- --surface-highlight: inset 0 1px 0 color-mix(in srgb, white 8%, transparent);
231
- --surface-shadow: var(--shadow-2);
232
- --overlay-shadow: 0 28px 90px color-mix(in srgb, var(--shadow-color) 48%, transparent);
233
-
234
- /* ═══════════════════════════════════════════════
235
- UI Semantic Tokens (light defaults)
236
- Dark mode overrides via :root[data-theme="dark"] in SSG
237
- ═══════════════════════════════════════════════ */
238
- --text-primary: var(--gray-9);
239
- --text-secondary: var(--gray-8);
240
- /* Muted copy must clear the 4.5:1 AA floor on --bg-base/#f9f8fc: gray-5 is
241
- 1.97:1. gray-7 is the lightest gray that clears it (7.74:1) and stays muted
242
- against --text-secondary. Dark keeps gray-6 (5.6:1 on the dark base). */
243
- --text-muted: var(--gray-7);
244
- --bg-base: color-mix(in srgb, var(--violet-0) 42%, var(--gray-0));
245
- --bg-surface: color-mix(in srgb, var(--violet-0) 32%, var(--gray-1));
246
- --bg-card: color-mix(in srgb, var(--violet-0) 18%, var(--gray-0));
247
- --bg-elevated: #ffffff;
248
- --bg-hover: var(--gray-2);
249
- --bg-muted: var(--gray-1);
250
- --bg-code: var(--gray-11);
251
- --code-border: var(--gray-8);
252
- --code-text: var(--gray-2);
253
- --border: var(--gray-3);
254
- --border-hover: var(--gray-4);
255
- /* Status colors clear the 4.5:1 AA floor on --bg-base/#f9f8fc (measured):
256
- success #237032 5.8:1, warning #885b00 5.6:1, error #b12525 6.3:1,
257
- info #2157cf 6.0:1. Badges paint the ink on a 10% wash of itself, which
258
- lowers the ratio, so the floor is verified against that wash too (the
259
- dimmest pair, warning, measures 4.9:1). The dark overrides below are
260
- measured at >=4.9:1 on their wash in both themes. */
261
- --error: #b12525;
262
- --error-subtle: rgba(177, 37, 37, 0.1);
263
- --success: #237032;
264
- --success-subtle: rgba(35, 112, 50, 0.1);
265
- --warning: #885b00;
266
- --warning-subtle: rgba(136, 91, 0, 0.1);
267
- --info: #2157cf;
268
- --info-subtle: rgba(33, 87, 207, 0.1);
269
- --overlay: rgba(0, 0, 0, 0.4);
270
- --nav-bg: color-mix(in srgb, var(--bg-base) 86%, transparent);
271
- --nav-height: var(--size-16);
272
- --nav-link-color: var(--text-primary);
273
- --nav-link-hover: var(--brand);
274
- --nav-link-size: var(--font-size-0);
275
-
276
- /* ═══════════════════════════════════════════════
277
- Tuned color scales (re-tuned from open-props — see file header;
278
- only --indigo-6 is upstream-verbatim and injected at the anchor)
279
- ═══════════════════════════════════════════════ */
280
- --green-0: #ebfbee;
281
- --green-1: #d3f9d8;
282
- --green-2: #b2f2bb;
283
- --green-3: #8ce99a;
284
- --green-4: #69db7c;
285
- --green-5: #51cf66;
286
- --green-6: #40c057;
287
- --green-7: #37b24d;
288
- --green-8: #2f9e44;
289
- --green-9: #2b8a3e;
290
- --green-10: #226231;
291
- --green-11: #1a4725;
292
- --green-12: #0f2d18;
293
- --red-0: #fff5f5;
294
- --red-1: #ffe3e3;
295
- --red-2: #ffc9c9;
296
- --red-3: #ffa8a8;
297
- --red-4: #ff8787;
298
- --red-5: #ff6b6b;
299
- --red-6: #fa5252;
300
- --red-7: #f03e3e;
301
- --red-8: #e03131;
302
- --red-9: #c92a2a;
303
- --red-10: #a61e1e;
304
- --red-11: #821515;
305
- --red-12: #540d0d;
306
- --orange-0: #fff4e6;
307
- --orange-1: #ffe8cc;
308
- --orange-2: #ffd8a8;
309
- --orange-3: #ffc078;
310
- --orange-4: #ffa94d;
311
- --orange-5: #ff922b;
312
- --orange-6: #fd7e14;
313
- --orange-7: #f76707;
314
- --orange-8: #e8590c;
315
- --orange-9: #d9480f;
316
- --orange-10: #b03a00;
317
- --orange-11: #872a00;
318
- --orange-12: #5c1a00;
319
- --violet-0: #fbf7ff;
320
- --violet-1: #f3eaff;
321
- --violet-2: #e6d8ff;
322
- --violet-3: #d0bdff;
323
- --violet-4: #b59cff;
324
- --violet-5: #9c7df2;
325
- --violet-6: #8262db;
326
- --violet-7: #6d4cc4;
327
- --violet-8: #58399e;
328
- --violet-9: #422774;
329
- --violet-10: #2f1c52;
330
- --violet-11: #21143b;
331
- --violet-12: #130a22;
332
- }
333
-
334
- /* ═══════════════════════════════════════════════
335
- Dark Mode — matches the document root or a host carrying
336
- data-theme="dark" (one sheet serves both), so all shadow DOMs inherit.
337
- Our own inversion (open-props ships no dark mode).
338
- ═══════════════════════════════════════════════ */
339
- :root[data-theme='dark'],
340
- :host([data-theme='dark']) {
341
- --gray-0: #030507;
342
- --gray-1: #0d0f12;
343
- --gray-2: #16191d;
344
- --gray-3: #212529;
345
- --gray-4: #343a40;
346
- --gray-5: #495057;
347
- --gray-6: #868e96;
348
- --gray-7: #adb5bd;
349
- --gray-8: #ced4da;
350
- --gray-9: #dee2e6;
351
- --gray-10: #e9ecef;
352
- --gray-11: #f1f3f5;
353
- --gray-12: #f8f9fa;
354
- /* Dark brand = violet-7: violet-6 (#8262db) cleared AA only on the page base
355
- (4.54:1) and failed as text on the raised surfaces (4.31:1 on elevated,
356
- 3.92:1 on cards). violet-7 clears all three (6.38 / 6.06 / 5.51) and still
357
- seats the near-black --on-brand ink (6.44:1). --on-brand flips per theme to
358
- the ramp extreme — the only ink that clears AA against the fill. */
359
- --brand: var(--violet-7);
360
- --brand-hover: var(--violet-8);
361
- /* --brand-light is a light brand tint in both themes; the dark ramp is
362
- mirrored, so violet-4 (#58399e) would be a *dark* violet here. violet-8 is
363
- the dark entry carrying the light theme's #b59cff. It stays a tint: never
364
- an ink over a light surface (see open-button.tsx). */
365
- --brand-light: var(--violet-8);
366
- --brand-deep: var(--violet-12);
367
- --brand-subtle: color-mix(in srgb, var(--brand) 16%, transparent);
368
- --brand-glow: color-mix(in srgb, var(--brand) 22%, transparent);
369
- /* Pale wash stays a translucent brand tint in dark: violet-1's dark-ramp
370
- entry is a deep violet, which inverted the hover-wash semantics. */
371
- --brand-pale: color-mix(in srgb, var(--brand) 18%, transparent);
372
- --shadow-color: rgb(0 0 0);
373
- --on-brand: var(--gray-0);
374
- --text-primary: var(--gray-10);
375
- --text-secondary: var(--gray-8);
376
- --text-muted: var(--gray-6);
377
- --bg-base: color-mix(in srgb, var(--violet-0) 18%, var(--gray-0));
378
- --bg-surface: color-mix(in srgb, var(--violet-1) 14%, var(--gray-1));
379
- --bg-card: color-mix(in srgb, var(--violet-2) 10%, var(--gray-2));
380
- --bg-elevated: var(--gray-1);
381
- --bg-hover: var(--gray-3);
382
- --bg-code: var(--gray-1);
383
- --code-border: var(--gray-4);
384
- --code-text: var(--gray-10);
385
- --border: var(--gray-3);
386
- --border-hover: var(--gray-4);
387
- --error: #f87171;
388
- --error-subtle: rgba(248, 113, 113, 0.15);
389
- --success: #4ade80;
390
- --success-subtle: rgba(74, 222, 128, 0.1);
391
- --warning: #fbbf24;
392
- --warning-subtle: rgba(251, 191, 36, 0.1);
393
- --info: #60a5fa;
394
- --info-subtle: rgba(96, 165, 250, 0.1);
395
- --overlay: rgba(0, 0, 0, 0.6);
396
- --nav-bg: color-mix(in srgb, var(--bg-base) 86%, transparent);
397
- --nav-link-color: var(--text-primary);
398
- --nav-link-hover: var(--brand-light);
399
-
400
- /* Open Props Color Scales (dark mode inversion) */
401
- --indigo-6: #4c6ef5;
402
- --green-0: #0f2d18;
403
- --green-1: #1a4725;
404
- --green-2: #226231;
405
- --green-3: #2b8a3e;
406
- --green-4: #2f9e44;
407
- --green-5: #37b24d;
408
- --green-6: #40c057;
409
- --green-7: #51cf66;
410
- --green-8: #69db7c;
411
- --green-9: #8ce99a;
412
- --green-10: #b2f2bb;
413
- --green-11: #d3f9d8;
414
- --green-12: #ebfbee;
415
- --red-0: #540d0d;
416
- --red-1: #821515;
417
- --red-2: #a61e1e;
418
- --red-3: #c92a2a;
419
- --red-4: #e03131;
420
- --red-5: #f03e3e;
421
- --red-6: #fa5252;
422
- --red-7: #ff6b6b;
423
- --red-8: #ff8787;
424
- --red-9: #ffa8a8;
425
- --red-10: #ffc9c9;
426
- --red-11: #ffe3e3;
427
- --red-12: #fff5f5;
428
- --orange-0: #5c1a00;
429
- --orange-1: #872a00;
430
- --orange-2: #b03a00;
431
- --orange-3: #d9480f;
432
- --orange-4: #e8590c;
433
- --orange-5: #f76707;
434
- --orange-6: #fd7e14;
435
- --orange-7: #ff922b;
436
- --orange-8: #ffa94d;
437
- --orange-9: #ffc078;
438
- --orange-10: #ffd8a8;
439
- --orange-11: #ffe8cc;
440
- --orange-12: #fff4e6;
441
- --violet-0: #130a22;
442
- --violet-1: #21143b;
443
- --violet-2: #2f1c52;
444
- --violet-3: #422774;
445
- --violet-4: #58399e;
446
- --violet-5: #6d4cc4;
447
- --violet-6: #8262db;
448
- --violet-7: #9c7df2;
449
- --violet-8: #b59cff;
450
- --violet-9: #d0bdff;
451
- --violet-10: #e6d8ff;
452
- --violet-11: #f3eaff;
453
- --violet-12: #fbf7ff;
454
- }
455
- `;
456
- /**
457
- * The full token set as one constructable sheet. The token block selects
458
- * `:root, :host`, so the same sheet serves a document-level adoption and a
459
- * shadow-root adoption; only the structural fallback is :host-exclusive.
460
- */
461
- const openPropsTokenSheet = new StyleSheet();
462
- openPropsTokenSheet.replaceSync(OPEN_PROPS_TOKEN_CSS);
463
- //#endregion
464
- export { openPropsTokenSheet };