@opendikw/web-ui 0.1.0-rc.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.
Files changed (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +47 -0
  3. package/dist/auth/index.d.ts +23 -0
  4. package/dist/auth/index.js +118 -0
  5. package/dist/controls/Button.d.ts +14 -0
  6. package/dist/controls/Button.js +16 -0
  7. package/dist/controls/EmptyState.d.ts +8 -0
  8. package/dist/controls/EmptyState.js +5 -0
  9. package/dist/controls/Field.d.ts +23 -0
  10. package/dist/controls/Field.js +11 -0
  11. package/dist/controls/FrontmatterChip.d.ts +16 -0
  12. package/dist/controls/FrontmatterChip.js +16 -0
  13. package/dist/controls/IconButton.d.ts +15 -0
  14. package/dist/controls/IconButton.js +11 -0
  15. package/dist/controls/MetricCard.d.ts +16 -0
  16. package/dist/controls/MetricCard.js +11 -0
  17. package/dist/controls/Notice.d.ts +8 -0
  18. package/dist/controls/Notice.js +13 -0
  19. package/dist/controls/SegmentedControl.d.ts +27 -0
  20. package/dist/controls/SegmentedControl.js +16 -0
  21. package/dist/controls/SoftLabel.d.ts +15 -0
  22. package/dist/controls/SoftLabel.js +14 -0
  23. package/dist/controls/StatusPill.d.ts +6 -0
  24. package/dist/controls/StatusPill.js +8 -0
  25. package/dist/controls/cx.d.ts +6 -0
  26. package/dist/controls/cx.js +8 -0
  27. package/dist/controls/index.d.ts +11 -0
  28. package/dist/controls/index.js +11 -0
  29. package/dist/hooks/index.d.ts +4 -0
  30. package/dist/hooks/index.js +3 -0
  31. package/dist/hooks/useAsyncResource.d.ts +7 -0
  32. package/dist/hooks/useAsyncResource.js +36 -0
  33. package/dist/hooks/useBilingualReader.d.ts +40 -0
  34. package/dist/hooks/useBilingualReader.js +154 -0
  35. package/dist/hooks/usePreviewTranslation.d.ts +24 -0
  36. package/dist/hooks/usePreviewTranslation.js +43 -0
  37. package/dist/reader/BilingualView.d.ts +32 -0
  38. package/dist/reader/BilingualView.js +75 -0
  39. package/dist/reader/MarkdownView.d.ts +12 -0
  40. package/dist/reader/MarkdownView.js +94 -0
  41. package/dist/reader/chart-spec.d.ts +17 -0
  42. package/dist/reader/chart-spec.js +174 -0
  43. package/dist/reader/index.d.ts +5 -0
  44. package/dist/reader/index.js +4 -0
  45. package/dist/reader/markdown-runtime.d.ts +37 -0
  46. package/dist/reader/markdown-runtime.js +701 -0
  47. package/dist/styles/controls.css +546 -0
  48. package/dist/styles/reader.css +701 -0
  49. package/dist/styles/tokens.css +200 -0
  50. package/dist/styles.d.ts +1 -0
  51. package/dist/theme/index.d.ts +12 -0
  52. package/dist/theme/index.js +40 -0
  53. package/package.json +71 -0
@@ -0,0 +1,546 @@
1
+ .button-row {
2
+ display: flex;
3
+ align-items: end;
4
+ gap: 10px;
5
+ }
6
+
7
+ .metric-card {
8
+ border: 1px solid var(--line);
9
+ border-radius: var(--radius);
10
+ background: var(--surface);
11
+ box-shadow: var(--shadow);
12
+ }
13
+
14
+ .metric-card {
15
+ min-height: 104px;
16
+ padding: 13px;
17
+ }
18
+
19
+ .metric-card__label,
20
+ .field span {
21
+ color: var(--muted);
22
+ font-size: 11px;
23
+ font-weight: 600;
24
+ letter-spacing: 0;
25
+ text-transform: uppercase;
26
+ }
27
+
28
+ .metric-card__value {
29
+ margin-top: 12px;
30
+ color: var(--text);
31
+ font-size: 27px;
32
+ font-weight: 600;
33
+ line-height: 1;
34
+ }
35
+
36
+ .metric-card__detail {
37
+ margin-top: 8px;
38
+ color: var(--muted);
39
+ font-size: 13px;
40
+ }
41
+
42
+ .field {
43
+ display: grid;
44
+ gap: 6px;
45
+ }
46
+
47
+ .field--grow {
48
+ flex: 1;
49
+ min-width: 220px;
50
+ }
51
+
52
+ .field--small {
53
+ width: 92px;
54
+ }
55
+
56
+ .field--inline {
57
+ grid-template-columns: auto minmax(160px, 260px);
58
+ align-items: center;
59
+ }
60
+
61
+ .field--token input {
62
+ max-width: 180px;
63
+ }
64
+
65
+ /* Keyboard focus: one branded ring across interactive controls that don't
66
+ already define their own :focus-visible. Zero-specificity :where() so the
67
+ existing per-element focus rules (graph nodes, reader controls, resizer)
68
+ still win. Text fields keep their softer box-shadow ring above. */
69
+ :where(button, a[href], [role="button"], summary, [tabindex]:not([tabindex="-1"])):focus-visible {
70
+ outline: var(--focus-outline);
71
+ outline-offset: 2px;
72
+ }
73
+
74
+ .primary-button,
75
+ .secondary-button,
76
+ .icon-button {
77
+ display: inline-flex;
78
+ align-items: center;
79
+ justify-content: center;
80
+ gap: 8px;
81
+ min-height: 36px;
82
+ border-radius: 7px;
83
+ font-weight: 500;
84
+ transition:
85
+ background-color 120ms ease,
86
+ border-color 120ms ease,
87
+ color 120ms ease;
88
+ }
89
+
90
+ .primary-button {
91
+ border: 1px solid var(--accent-strong);
92
+ background: var(--accent);
93
+ color: #ffffff;
94
+ padding: 0 14px;
95
+ }
96
+
97
+ .primary-button:hover {
98
+ background: var(--accent-strong);
99
+ }
100
+
101
+ .secondary-button {
102
+ border: 1px solid var(--line-strong);
103
+ background: var(--surface);
104
+ color: var(--text);
105
+ padding: 0 12px;
106
+ }
107
+
108
+ .secondary-button:hover,
109
+ .icon-button:hover {
110
+ border-color: var(--accent-border-hover);
111
+ background: var(--surface-soft);
112
+ }
113
+
114
+ .icon-button {
115
+ width: 38px;
116
+ border: 1px solid var(--line-strong);
117
+ background: var(--surface);
118
+ color: var(--text);
119
+ }
120
+
121
+ .status-pill {
122
+ display: inline-flex;
123
+ align-items: center;
124
+ gap: 5px;
125
+ width: fit-content;
126
+ max-width: 100%;
127
+ padding: 4px 8px;
128
+ border-radius: 999px;
129
+ font-size: var(--type-body-sm-size);
130
+ font-weight: 600;
131
+ white-space: nowrap;
132
+ }
133
+
134
+ /* Pill text mixes the signal color toward --text: in light that darkens it
135
+ (passing 4.5:1 on the tint), in dark it lightens — raising contrast against
136
+ the tinted background in both themes. ok #2f7a4d / info #2f6aa8 were just
137
+ under AA at 12px/600 on their own 16% tint. */
138
+ .status-pill--ok {
139
+ background: color-mix(in srgb, var(--green) 16%, transparent);
140
+ color: color-mix(in srgb, var(--green) 80%, var(--text));
141
+ }
142
+
143
+ .status-pill--info {
144
+ background: color-mix(in srgb, var(--blue) 16%, transparent);
145
+ color: color-mix(in srgb, var(--blue) 80%, var(--text));
146
+ }
147
+
148
+ .status-pill--warn {
149
+ background: color-mix(in srgb, var(--amber) 18%, transparent);
150
+ color: var(--amber);
151
+ }
152
+
153
+ .status-pill--bad {
154
+ background: color-mix(in srgb, var(--red) 16%, transparent);
155
+ color: var(--red);
156
+ }
157
+
158
+ .status-pill--muted {
159
+ background: var(--surface-2);
160
+ color: var(--muted);
161
+ }
162
+
163
+ .notice {
164
+ display: flex;
165
+ gap: 10px;
166
+ padding: 12px 13px;
167
+ border: 1px solid var(--line);
168
+ border-radius: var(--radius);
169
+ background: var(--surface);
170
+ }
171
+
172
+ .notice--bad {
173
+ border-color: color-mix(in srgb, var(--red) 56%, var(--line));
174
+ background: color-mix(in srgb, var(--red) 9%, var(--surface));
175
+ color: var(--red);
176
+ }
177
+
178
+ .notice--warn {
179
+ border-color: color-mix(in srgb, var(--amber) 56%, var(--line));
180
+ background: color-mix(in srgb, var(--amber) 9%, var(--surface));
181
+ color: var(--amber);
182
+ }
183
+
184
+ .notice--info {
185
+ border-color: color-mix(in srgb, var(--blue) 48%, var(--line));
186
+ background: color-mix(in srgb, var(--blue) 8%, var(--surface));
187
+ color: var(--blue);
188
+ }
189
+
190
+ .notice__title {
191
+ margin-bottom: 2px;
192
+ color: var(--text);
193
+ font-weight: 600;
194
+ }
195
+
196
+ .notice__code {
197
+ margin-bottom: 3px;
198
+ font-size: var(--type-body-sm-size);
199
+ font-weight: 600;
200
+ }
201
+
202
+ .empty-state {
203
+ display: flex;
204
+ align-items: center;
205
+ gap: 10px;
206
+ min-height: 84px;
207
+ padding: 14px;
208
+ border: 1px dashed var(--line-strong);
209
+ border-radius: var(--radius);
210
+ background: var(--surface-soft);
211
+ color: var(--muted);
212
+ }
213
+
214
+ .empty-state__title {
215
+ color: var(--text);
216
+ font-weight: 600;
217
+ }
218
+
219
+ .empty-state__detail {
220
+ margin-top: 2px;
221
+ font-size: 13px;
222
+ }
223
+
224
+ .secondary-button--danger {
225
+ color: var(--danger);
226
+ }
227
+
228
+ .soft-label {
229
+ display: inline-flex;
230
+ align-items: center;
231
+ width: fit-content;
232
+ max-width: 100%;
233
+ padding: 3px 7px;
234
+ border: 1px solid var(--line);
235
+ border-radius: 999px;
236
+ color: var(--muted);
237
+ font-size: var(--type-body-sm-size);
238
+ font-weight: 500;
239
+ overflow-wrap: anywhere;
240
+ }
241
+
242
+ .frontmatter-chip {
243
+ display: inline-flex;
244
+ align-items: center;
245
+ gap: 5px;
246
+ max-width: 100%;
247
+ padding: 4px 8px;
248
+ border: 1px solid var(--line);
249
+ border-radius: 6px;
250
+ background: var(--surface-2);
251
+ color: var(--text);
252
+ font-size: var(--type-body-sm-size);
253
+ line-height: 1.25;
254
+ overflow-wrap: anywhere;
255
+ }
256
+
257
+ .frontmatter-chip strong {
258
+ color: var(--muted);
259
+ font-weight: 600;
260
+ text-transform: uppercase;
261
+ }
262
+
263
+ .frontmatter-chip--tag {
264
+ color: var(--accent-strong);
265
+ }
266
+
267
+ .frontmatter-chip--source {
268
+ border-radius: 6px;
269
+ font-family: var(--font-mono);
270
+ }
271
+
272
+ .segmented-control {
273
+ display: inline-flex;
274
+ align-items: center;
275
+ gap: 2px;
276
+ padding: 3px;
277
+ border: 1px solid var(--line);
278
+ border-radius: 8px;
279
+ background: var(--surface-soft);
280
+ }
281
+
282
+ .segmented-control button {
283
+ min-height: 28px;
284
+ padding: 0 10px;
285
+ border: 1px solid transparent;
286
+ border-radius: 6px;
287
+ background: transparent;
288
+ color: var(--muted);
289
+ font-size: var(--type-body-sm-size);
290
+ font-weight: 600;
291
+ }
292
+
293
+ /* Hover and selected must read differently: a hovered non-selected option gets
294
+ only a faint fill, while the selected one is a raised surface chip with a
295
+ petrol border — so selected ≠ hovered regardless of pointer position. */
296
+ .segmented-control button:not(.is-active):hover {
297
+ background: var(--overlay-hover);
298
+ color: var(--accent-strong);
299
+ }
300
+
301
+ .segmented-control button.is-active {
302
+ border-color: var(--accent-border-hover);
303
+ background: var(--surface);
304
+ color: var(--accent-strong);
305
+ }
306
+
307
+ .segmented-control--settings {
308
+ width: fit-content;
309
+ }
310
+
311
+ /* Touch devices enlarge the compact toggles that are mouse-comfortable but
312
+ finger-fiddly to a 44px tap target (WCAG 2.5.5). Fine pointers (desktop
313
+ mouse) keep the dense sizing. */
314
+ @media (pointer: coarse) {
315
+ .segmented-control button {
316
+ min-height: 44px;
317
+ }
318
+ }
319
+
320
+ .event-tape__pagination .secondary-button {
321
+ min-width: 72px;
322
+ justify-content: center;
323
+ }
324
+
325
+ html[data-theme="dark"] .metric-card {
326
+ background-color: var(--surface);
327
+ }
328
+
329
+ html[data-theme="dark"] .metric-card__value {
330
+ color: var(--text);
331
+ }
332
+
333
+ @media (max-width: 900px) {
334
+ .field--inline {
335
+ grid-template-columns: 1fr;
336
+ }
337
+ }
338
+
339
+ @media (max-width: 640px) {
340
+ .button-row {
341
+ align-items: stretch;
342
+ flex-direction: column;
343
+ }
344
+
345
+ .field--small {
346
+ width: 100%;
347
+ }
348
+
349
+ .metric-card__value {
350
+ font-size: 22px;
351
+ }
352
+ }
353
+
354
+ /* ============================================================
355
+ PR1 · Type role overrides
356
+ ─ Big headings + numeric metrics use editorial serif
357
+ ─ Labels / IDs / paths use mono uppercase
358
+ ─ Status pills lose 800 weight, gain hairline edge
359
+ ============================================================ */
360
+
361
+ /* The editorial serif is used in exactly three places: the document reader prose
362
+ (`.markdown-body h1/h2`, fallback + reader-header title), the assistant reply
363
+ prose (agent markdown headings), and the two stat-number tiers (27 hero metric
364
+ value, 18 summary stat). Page H1s and all panel/card/detail headings stay sans
365
+ (title role) so the serif moment stays special to reading. See DESIGN.md §3. */
366
+ .metric-card__value {
367
+ font-family: var(--font-serif);
368
+ font-weight: 600;
369
+ letter-spacing: -0.005em;
370
+ }
371
+
372
+ /* Mono uppercase on all eyebrow labels */
373
+ .metric-card__label,
374
+ .field span,
375
+ .frontmatter-chip strong {
376
+ font-family: var(--font-mono);
377
+ font-size: 11px;
378
+ font-weight: 500;
379
+ letter-spacing: 0.04em;
380
+ text-transform: uppercase;
381
+ }
382
+
383
+ /* Cards: drop heavy shadow, keep hairline border only */
384
+ .metric-card {
385
+ box-shadow: none;
386
+ }
387
+
388
+ /* Status pills: hairline edge + dot, no more 800 weight */
389
+ .status-pill {
390
+ font-weight: 500;
391
+ border: 1px solid transparent;
392
+ }
393
+ .status-pill--ok {
394
+ border-color: color-mix(in srgb, var(--green) 25%, transparent);
395
+ }
396
+ .status-pill--info {
397
+ border-color: color-mix(in srgb, var(--blue) 25%, transparent);
398
+ }
399
+ .status-pill--warn {
400
+ border-color: color-mix(in srgb, var(--amber) 25%, transparent);
401
+ }
402
+ .status-pill--bad {
403
+ border-color: color-mix(in srgb, var(--red) 25%, transparent);
404
+ }
405
+ .status-pill--muted {
406
+ border-color: var(--line);
407
+ }
408
+
409
+ /* Frontmatter chip: square corners + mono — looks like a data tag, not a button */
410
+ .frontmatter-chip {
411
+ border-radius: 4px;
412
+ font-family: var(--font-mono);
413
+ font-size: var(--type-body-sm-size);
414
+ }
415
+
416
+ /* Tabular numerals everywhere a number is displayed */
417
+ .metric-card__value {
418
+ font-variant-numeric: tabular-nums;
419
+ }
420
+
421
+ .metric-card__label {
422
+ /* PR3 ramp — mono labels feel like column headers, not bold UI text */
423
+ margin-bottom: 2px;
424
+ }
425
+ .metric-card__value {
426
+ margin-top: 12px;
427
+ /* Size is the 27px hero-number role from the base rule (DESIGN.md §3) — this
428
+ block only owns the grid placement, not a competing size. */
429
+ line-height: 1;
430
+ align-self: end;
431
+ }
432
+ .metric-card__detail {
433
+ margin-top: 10px;
434
+ align-self: end;
435
+ }
436
+
437
+ /* MetricCard renders bare <dt>/<dd> (it lives inside a <dl>); kill the UA dd
438
+ inline indent so values stay flush wherever the card is used (block margins
439
+ above are unchanged). */
440
+ .metric-card dt,
441
+ .metric-card dd {
442
+ margin-inline: 0;
443
+ }
444
+
445
+ /* Clickable metric → quiet stretched link covering the whole cell (no button
446
+ chrome): value keeps the ink color, a subtle hover tint signals it acts. */
447
+ .metric-card--link {
448
+ position: relative;
449
+ }
450
+ .metric-card__link {
451
+ color: inherit;
452
+ text-decoration: none;
453
+ }
454
+ .metric-card__link::after {
455
+ content: "";
456
+ position: absolute;
457
+ inset: 0;
458
+ }
459
+ .metric-card--link:hover {
460
+ background: var(--surface-soft);
461
+ }
462
+ .metric-card__link:focus-visible {
463
+ outline: none;
464
+ }
465
+ .metric-card__link:focus-visible::after {
466
+ outline: var(--focus-outline);
467
+ outline-offset: -2px;
468
+ }
469
+
470
+ /* Loading skeletons: value + detail placeholders that hold the strip/panel
471
+ height so real data swaps in without a layout pop-in. Pulses opacity only. */
472
+ .metric-skeleton {
473
+ display: block;
474
+ width: 3.25rem;
475
+ height: 1.5rem;
476
+ border-radius: 4px;
477
+ background: var(--surface-2);
478
+ animation: metric-skeleton-pulse 1.4s var(--ease-standard) infinite;
479
+ }
480
+ .metric-card__detail .metric-skeleton,
481
+ .detail-list .metric-skeleton {
482
+ width: 6rem;
483
+ height: 0.8rem;
484
+ }
485
+ @keyframes metric-skeleton-pulse {
486
+ 0%,
487
+ 100% {
488
+ opacity: 0.5;
489
+ }
490
+ 50% {
491
+ opacity: 0.85;
492
+ }
493
+ }
494
+ @media (prefers-reduced-motion: reduce) {
495
+ .metric-skeleton {
496
+ animation: none;
497
+ }
498
+ }
499
+ .soft-label {
500
+ font-family: var(--font-mono);
501
+ font-size: var(--type-label-size);
502
+ font-weight: 500;
503
+ letter-spacing: var(--type-label-ls);
504
+ text-transform: uppercase;
505
+ }
506
+
507
+ .reader-back-to-top:focus-visible {
508
+ outline: 2px solid var(--reader-link);
509
+ outline-offset: 2px;
510
+ }
511
+
512
+ .status-pill--wisdom-draft {
513
+ background: color-mix(in srgb, var(--amber) 14%, transparent);
514
+ color: var(--amber);
515
+ }
516
+
517
+ .status-pill--wisdom-published {
518
+ background: color-mix(in srgb, var(--green) 14%, transparent);
519
+ color: var(--green);
520
+ }
521
+
522
+ .status-pill--wisdom-favorite {
523
+ background: color-mix(in srgb, var(--accent) 16%, transparent);
524
+ color: var(--accent-strong);
525
+ }
526
+
527
+ .status-pill--wisdom-archived {
528
+ background: var(--surface-2);
529
+ color: var(--muted);
530
+ }
531
+
532
+ .trace-session:focus-visible {
533
+ outline: 2px solid var(--accent);
534
+ outline-offset: 2px;
535
+ }
536
+
537
+ .trace-span-row__label:focus-visible {
538
+ outline: 2px solid var(--accent);
539
+ outline-offset: 2px;
540
+ }
541
+ input:focus,
542
+ select:focus,
543
+ textarea:focus {
544
+ border-color: var(--accent);
545
+ box-shadow: var(--focus-ring);
546
+ }