@zonsh/ui 0.2.0 → 0.4.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 (180) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +19 -13
  3. package/dist/components/alert-dialog.js +1 -1
  4. package/dist/components/ascii-field.d.ts +1 -1
  5. package/dist/components/bottom-nav.d.ts +86 -0
  6. package/dist/components/bottom-nav.js +175 -0
  7. package/dist/components/breadcrumb.d.ts +9 -0
  8. package/dist/components/breadcrumb.js +6 -1
  9. package/dist/components/button-group.d.ts +1 -1
  10. package/dist/components/button-group.js +2 -2
  11. package/dist/components/calendar.d.ts +1 -1
  12. package/dist/components/calendar.js +18 -3
  13. package/dist/components/carousel.d.ts +22 -3
  14. package/dist/components/carousel.js +25 -7
  15. package/dist/components/chart.d.ts +9 -0
  16. package/dist/components/chart.js +40 -3
  17. package/dist/components/code-block.d.ts +20 -10
  18. package/dist/components/code-block.js +54 -12
  19. package/dist/components/collapsible.js +2 -2
  20. package/dist/components/color-picker.d.ts +30 -8
  21. package/dist/components/color-picker.js +48 -27
  22. package/dist/components/combobox.d.ts +21 -3
  23. package/dist/components/combobox.js +79 -7
  24. package/dist/components/command.d.ts +23 -3
  25. package/dist/components/command.js +61 -16
  26. package/dist/components/conversation.d.ts +10 -1
  27. package/dist/components/conversation.js +14 -4
  28. package/dist/components/copy-button.d.ts +15 -6
  29. package/dist/components/copy-button.js +20 -5
  30. package/dist/components/data-table.d.ts +66 -6
  31. package/dist/components/data-table.js +376 -23
  32. package/dist/components/date-picker.d.ts +73 -4
  33. package/dist/components/date-picker.js +138 -7
  34. package/dist/components/dialog.d.ts +10 -1
  35. package/dist/components/dialog.js +6 -3
  36. package/dist/components/drawer.d.ts +10 -1
  37. package/dist/components/drawer.js +6 -3
  38. package/dist/components/feature-list.js +2 -2
  39. package/dist/components/field.d.ts +27 -8
  40. package/dist/components/field.js +49 -4
  41. package/dist/components/file-drop.d.ts +26 -4
  42. package/dist/components/file-drop.js +125 -64
  43. package/dist/components/filter-bar.d.ts +50 -3
  44. package/dist/components/filter-bar.js +71 -33
  45. package/dist/components/form.d.ts +4 -2
  46. package/dist/components/form.js +24 -2
  47. package/dist/components/graph.d.ts +41 -0
  48. package/dist/components/graph.js +84 -45
  49. package/dist/components/illustration.js +1 -1
  50. package/dist/components/input-group.d.ts +16 -5
  51. package/dist/components/input-group.js +35 -15
  52. package/dist/components/input.d.ts +2 -2
  53. package/dist/components/input.js +3 -3
  54. package/dist/components/kbd.d.ts +17 -0
  55. package/dist/components/kbd.js +8 -1
  56. package/dist/components/lightbox.d.ts +100 -0
  57. package/dist/components/lightbox.js +439 -0
  58. package/dist/components/locale.d.ts +44 -0
  59. package/dist/components/locale.js +37 -0
  60. package/dist/components/logo.js +1 -1
  61. package/dist/components/menu.js +3 -1
  62. package/dist/components/message.d.ts +3 -3
  63. package/dist/components/message.js +10 -7
  64. package/dist/components/meter.js +3 -1
  65. package/dist/components/money-input.d.ts +80 -0
  66. package/dist/components/money-input.js +253 -0
  67. package/dist/components/number-field.d.ts +21 -2
  68. package/dist/components/number-field.js +27 -16
  69. package/dist/components/otp-field.d.ts +14 -1
  70. package/dist/components/otp-field.js +10 -2
  71. package/dist/components/pagination.d.ts +13 -7
  72. package/dist/components/pagination.js +18 -7
  73. package/dist/components/pdf-viewer.d.ts +67 -2
  74. package/dist/components/pdf-viewer.js +88 -21
  75. package/dist/components/phone-input.d.ts +79 -0
  76. package/dist/components/phone-input.js +282 -0
  77. package/dist/components/popover.js +1 -1
  78. package/dist/components/progress.js +3 -1
  79. package/dist/components/prompt-input.d.ts +34 -9
  80. package/dist/components/prompt-input.js +28 -16
  81. package/dist/components/rating.d.ts +73 -0
  82. package/dist/components/rating.js +124 -0
  83. package/dist/components/reasoning.d.ts +16 -1
  84. package/dist/components/reasoning.js +10 -7
  85. package/dist/components/resizable.d.ts +10 -1
  86. package/dist/components/resizable.js +4 -1
  87. package/dist/components/response.d.ts +14 -3
  88. package/dist/components/response.js +36 -8
  89. package/dist/components/scroll-area.d.ts +1 -1
  90. package/dist/components/select.js +14 -3
  91. package/dist/components/separator.js +1 -1
  92. package/dist/components/sidebar.d.ts +20 -4
  93. package/dist/components/sidebar.js +34 -18
  94. package/dist/components/site-header.d.ts +46 -12
  95. package/dist/components/site-header.js +73 -19
  96. package/dist/components/slider.js +3 -1
  97. package/dist/components/sortable.d.ts +178 -0
  98. package/dist/components/sortable.js +1258 -0
  99. package/dist/components/sources.d.ts +17 -2
  100. package/dist/components/sources.js +11 -4
  101. package/dist/components/spinner.d.ts +13 -1
  102. package/dist/components/spinner.js +5 -2
  103. package/dist/components/stat.d.ts +91 -0
  104. package/dist/components/stat.js +141 -0
  105. package/dist/components/stepper.d.ts +71 -0
  106. package/dist/components/stepper.js +101 -0
  107. package/dist/components/switch.d.ts +2 -2
  108. package/dist/components/switch.js +2 -2
  109. package/dist/components/table.d.ts +12 -2
  110. package/dist/components/table.js +176 -39
  111. package/dist/components/tags-input.d.ts +18 -2
  112. package/dist/components/tags-input.js +65 -33
  113. package/dist/components/theme.d.ts +16 -2
  114. package/dist/components/theme.js +15 -7
  115. package/dist/components/time-field.d.ts +22 -3
  116. package/dist/components/time-field.js +19 -6
  117. package/dist/components/timeline.d.ts +18 -2
  118. package/dist/components/timeline.js +13 -4
  119. package/dist/components/tippy.d.ts +48 -0
  120. package/dist/components/tippy.js +648 -0
  121. package/dist/components/toast.d.ts +18 -2
  122. package/dist/components/toast.js +12 -3
  123. package/dist/components/tool-call.d.ts +19 -8
  124. package/dist/components/tool-call.js +18 -7
  125. package/dist/components/toolbar.js +6 -1
  126. package/dist/components/tour.d.ts +127 -0
  127. package/dist/components/tour.js +648 -0
  128. package/dist/components/tree.js +17 -4
  129. package/dist/components/video-player.d.ts +10 -2
  130. package/dist/components/video-player.js +73 -33
  131. package/dist/illustration.d.ts +2 -0
  132. package/dist/illustration.js +7 -0
  133. package/dist/index.d.ts +11 -3
  134. package/dist/index.js +11 -3
  135. package/dist/lib/code-highlight.d.ts +3 -16
  136. package/dist/lib/code-highlight.js +160 -10
  137. package/dist/lib/code-theme.js +3 -3
  138. package/dist/lib/digit-roll.js +8 -8
  139. package/dist/lib/field-errors.d.ts +28 -0
  140. package/dist/lib/field-errors.js +24 -0
  141. package/dist/lib/field-value.d.ts +13 -0
  142. package/dist/lib/field-value.js +44 -0
  143. package/dist/lib/graph-layout.js +11 -2
  144. package/dist/lib/money.d.ts +73 -0
  145. package/dist/lib/money.js +343 -0
  146. package/dist/lib/phone-countries.d.ts +1 -0
  147. package/dist/lib/phone-countries.js +281 -0
  148. package/dist/lib/phone.d.ts +90 -0
  149. package/dist/lib/phone.js +286 -0
  150. package/dist/lib/platform.d.ts +8 -3
  151. package/dist/lib/platform.js +13 -6
  152. package/dist/lib/row-index.d.ts +15 -0
  153. package/dist/lib/row-index.js +136 -0
  154. package/dist/lib/table-fit.js +23 -4
  155. package/dist/lib/theme-script.d.ts +15 -2
  156. package/dist/lib/theme-script.js +23 -3
  157. package/dist/lib/tippy/pixels.d.ts +47 -0
  158. package/dist/lib/tippy/pixels.js +187 -0
  159. package/dist/lib/tippy/sprite.d.ts +86 -0
  160. package/dist/lib/tippy/sprite.js +753 -0
  161. package/dist/messages/de.d.ts +12 -0
  162. package/dist/messages/de.js +326 -0
  163. package/dist/styles/expressive.css +20 -5
  164. package/dist/styles/index.css +3 -2
  165. package/dist/styles/material.css +7 -3
  166. package/dist/styles/parts/ai.css +2 -1
  167. package/dist/styles/parts/controls.css +62 -13
  168. package/dist/styles/parts/feedback.css +68 -1
  169. package/dist/styles/parts/foundations.css +1 -1
  170. package/dist/styles/parts/navigation.css +194 -2
  171. package/dist/styles/parts/overlays.css +7 -7
  172. package/dist/styles/tokens.css +12 -3
  173. package/dist/vite.d.ts +0 -50
  174. package/dist/vite.js +0 -100
  175. package/package.json +28 -33
  176. package/dist/components/code-highlight.d.ts +0 -13
  177. package/dist/components/code-highlight.js +0 -107
  178. package/dist/components/whiteboard.d.ts +0 -80
  179. package/dist/components/whiteboard.js +0 -389
  180. package/dist/styles/parts/whiteboard.css +0 -855
@@ -181,10 +181,10 @@
181
181
  width: calc(var(--sidebar-width) - 8px);
182
182
  }
183
183
  [data-slot="sidebar-shell"][data-variant="floating"][data-side="left"] > [data-slot="sidebar"] {
184
- left: 8px;
184
+ inset-inline-start: 8px;
185
185
  }
186
186
  [data-slot="sidebar-shell"][data-variant="floating"][data-side="right"] > [data-slot="sidebar"] {
187
- right: 8px;
187
+ inset-inline-end: 8px;
188
188
  }
189
189
  [data-slot="sidebar-shell"][data-variant="floating"][data-collapsible="icon"] {
190
190
  width: calc(var(--sidebar-width-icon) + 8px);
@@ -230,3 +230,195 @@
230
230
  border-width: 2px;
231
231
  }
232
232
  }
233
+
234
+ /* ── SiteHeader once scrolled: the page ground ─────────────────────────────────
235
+ * A flat fill would be a band of its own: nearly black in dark mode, against a page the grain
236
+ * lifts. So the scrolled bar is the page ground itself — --background with the faint light from
237
+ * above, and the two grain layers over it, all fixed to the viewport like the body's
238
+ * (expressive.css) so they line up with the page's. The fill is opaque on purpose: the grain
239
+ * blends with it as with the body, where a see-through fill would let the raw noise through and
240
+ * turn the bar lighter than the page.
241
+ *
242
+ * The ground (with its grain) and the hairline follow --site-header-ground: 0 until the page has
243
+ * scrolled --site-header-from (the component's scrollThreshold), 1 once it has scrolled the bar's
244
+ * height (--site-header-span) more. Where the browser ties animations to the scroll (Chrome 115+,
245
+ * Safari 26), one animation of that number follows the scroll position; elsewhere the component
246
+ * writes it once a frame. The number is a registered property on purpose: its animation runs on
247
+ * the main thread, where every frame reads one scroll position. Animated on the compositor
248
+ * (opacity), the bar now and then drew a frame from an older scroll offset — see-through over
249
+ * content that had already moved — after it had turned solid. No transition either, which would
250
+ * leave the bar behind the content it covers; only a forced `scrolled` eases. */
251
+
252
+ @property --site-header-ground {
253
+ syntax: "<number>";
254
+ inherits: true;
255
+ initial-value: 0;
256
+ }
257
+
258
+ @layer components {
259
+ [data-slot="site-header"] {
260
+ --site-header-span: 4rem;
261
+ isolation: isolate;
262
+ /* Under the status bar on a page that draws there (viewport-fit=cover, an iPhone home-screen
263
+ app): the bar keeps its links clear of it, and its ground runs up behind it. */
264
+ padding-top: env(safe-area-inset-top, 0px);
265
+ border-bottom-color: color-mix(in oklab, var(--border) calc(60% * var(--site-header-ground)), transparent);
266
+ }
267
+ /* The ground and its grain are one layer, isolated and opaque inside, that fades as a whole:
268
+ partly in, the bar is a mix of the content behind it and the finished ground, never lighter
269
+ than either (grain fading over a half-clear fill would let the raw noise through). */
270
+ [data-slot="site-header-ground"] {
271
+ position: absolute;
272
+ inset: 0;
273
+ z-index: -1;
274
+ pointer-events: none;
275
+ isolation: isolate;
276
+ background-color: var(--background);
277
+ background-image: radial-gradient(110% 65% at 50% -10%, var(--page-glow), transparent 60%);
278
+ background-attachment: fixed;
279
+ opacity: var(--site-header-ground);
280
+ }
281
+ [data-slot="site-header-ground"]::before,
282
+ [data-slot="site-header-ground"]::after {
283
+ content: "";
284
+ position: absolute;
285
+ inset: 0;
286
+ background-image: var(--grain-noise);
287
+ background-size: 200px auto;
288
+ background-attachment: fixed;
289
+ }
290
+ [data-slot="site-header-ground"]::before {
291
+ mix-blend-mode: var(--page-grain-blend);
292
+ opacity: var(--page-grain-opacity);
293
+ }
294
+ [data-slot="site-header-ground"]::after {
295
+ mix-blend-mode: screen;
296
+ opacity: calc(var(--grain-opacity) * 0.35);
297
+ background-position: 97px 61px;
298
+ }
299
+
300
+ /* A forced state changes at a time of its own, so it eases (instant under reduced motion). */
301
+ [data-slot="site-header"][data-forced] {
302
+ transition: border-color var(--duration) var(--ease);
303
+ }
304
+ [data-slot="site-header"][data-forced] > [data-slot="site-header-ground"] {
305
+ transition: opacity var(--duration) var(--ease);
306
+ }
307
+
308
+ @supports (animation-timeline: scroll()) {
309
+ [data-slot="site-header"]:not([data-forced]) {
310
+ animation-name: ep-site-header-ground;
311
+ animation-duration: auto;
312
+ animation-timing-function: linear;
313
+ animation-fill-mode: both;
314
+ animation-timeline: scroll(root block);
315
+ animation-range: var(--site-header-from, 8px) calc(var(--site-header-from, 8px) + var(--site-header-span));
316
+ }
317
+ }
318
+ }
319
+
320
+ @keyframes ep-site-header-ground {
321
+ from {
322
+ --site-header-ground: 0;
323
+ }
324
+ to {
325
+ --site-header-ground: 1;
326
+ }
327
+ }
328
+
329
+ /* ── BottomNav ────────────────────────────────────────────────────────────────
330
+ * The bar is 12px taller than a prominent control: a 46px tile in the middle of it. While a fixed
331
+ * bar is on screen the page reserves it as --bottom-nav-h — the bar, its hairline and the safe
332
+ * area under it — and scrolls focused things clear of it (WCAG 2.4.11). Zero where it is hidden
333
+ * (its breakpoint) or contained in a preview, so `pb-(--bottom-nav-h)` is always safe to write. */
334
+
335
+ :root {
336
+ --bottom-nav-bar: calc(var(--control-h-lg) + 12px);
337
+ --bottom-nav-h: 0px;
338
+ }
339
+ :root:has([data-slot="bottom-nav"][data-position="fixed"]) {
340
+ --bottom-nav-h: calc(var(--bottom-nav-bar) + 1px + env(safe-area-inset-bottom, 0px));
341
+ scroll-padding-bottom: var(--bottom-nav-h);
342
+ }
343
+ @media (width >= 40rem) {
344
+ :root:has([data-slot="bottom-nav"][data-position="fixed"][data-breakpoint="sm"]) {
345
+ --bottom-nav-h: 0px;
346
+ }
347
+ }
348
+ @media (width >= 48rem) {
349
+ :root:has([data-slot="bottom-nav"][data-position="fixed"]:is([data-breakpoint="sm"], [data-breakpoint="md"])) {
350
+ --bottom-nav-h: 0px;
351
+ }
352
+ }
353
+ @media (width >= 64rem) {
354
+ :root:has([data-slot="bottom-nav"][data-position="fixed"][data-breakpoint]) {
355
+ --bottom-nav-h: 0px;
356
+ }
357
+ }
358
+
359
+ @layer components {
360
+ /* The page ground, as under a scrolled SiteHeader: --background and the two grain layers,
361
+ fixed to the viewport so they line up with the page's. Opaque, so content scrolling under
362
+ the bar never shows through the grain. */
363
+ [data-slot="bottom-nav-ground"] {
364
+ position: absolute;
365
+ inset: 0;
366
+ z-index: -1;
367
+ pointer-events: none;
368
+ isolation: isolate;
369
+ background-color: var(--background);
370
+ }
371
+ [data-slot="bottom-nav-ground"]::before,
372
+ [data-slot="bottom-nav-ground"]::after {
373
+ content: "";
374
+ position: absolute;
375
+ inset: 0;
376
+ background-image: var(--grain-noise);
377
+ background-size: 200px auto;
378
+ background-attachment: fixed;
379
+ }
380
+ [data-slot="bottom-nav-ground"]::before {
381
+ mix-blend-mode: var(--page-grain-blend);
382
+ opacity: var(--page-grain-opacity);
383
+ }
384
+ [data-slot="bottom-nav-ground"]::after {
385
+ mix-blend-mode: screen;
386
+ opacity: calc(var(--grain-opacity) * 0.35);
387
+ background-position: 97px 61px;
388
+ }
389
+
390
+ /* An item rests in the muted ink; hovered or current, in the full one. */
391
+ [data-slot="bottom-nav-item-tile"] {
392
+ color: var(--muted-foreground);
393
+ transition:
394
+ color var(--duration) var(--ease),
395
+ background-color var(--duration) var(--ease),
396
+ box-shadow var(--duration) var(--ease);
397
+ }
398
+ @media (hover: hover) {
399
+ [data-slot="bottom-nav-item"]:not([aria-disabled="true"]):hover > [data-slot="bottom-nav-item-tile"] {
400
+ color: var(--foreground);
401
+ }
402
+ }
403
+ [data-slot="bottom-nav-item"][aria-current="page"] > [data-slot="bottom-nav-item-tile"] {
404
+ color: var(--foreground);
405
+ }
406
+ /* Until the gliding indicator has measured (server-rendered HTML), the current tile is raised
407
+ itself, like a secondary button. */
408
+ [data-slot="bottom-nav"]:not([data-indicator])
409
+ [data-slot="bottom-nav-item"][aria-current="page"]
410
+ > [data-slot="bottom-nav-item-tile"] {
411
+ background-color: var(--control-surface);
412
+ background-image: linear-gradient(180deg, var(--control-inner-edge), transparent);
413
+ box-shadow:
414
+ 0 0 0 1px var(--control-edge),
415
+ inset 0 1px 0 var(--control-highlight),
416
+ inset 0 0 0 1px var(--control-inner-edge);
417
+ }
418
+ @media (forced-colors: active) {
419
+ [data-slot="bottom-nav-indicator"] {
420
+ forced-color-adjust: none;
421
+ border: 2px solid Highlight;
422
+ }
423
+ }
424
+ }
@@ -12,14 +12,14 @@
12
12
 
13
13
  [data-slot="drawer-backdrop"] {
14
14
  opacity: calc(1 - var(--drawer-swipe-progress, 0));
15
- transition: opacity calc(var(--duration) * 3) var(--ease);
15
+ transition: opacity calc(var(--duration) * 2) var(--ease);
16
16
 
17
17
  &[data-starting-style],
18
18
  &[data-ending-style] {
19
19
  opacity: 0;
20
20
  }
21
21
  &[data-ending-style] {
22
- transition-duration: calc(var(--drawer-swipe-strength, 1) * var(--duration) * 3);
22
+ transition-duration: calc(var(--drawer-swipe-strength, 1) * var(--duration) * 2);
23
23
  }
24
24
  &[data-swiping] {
25
25
  transition-duration: 0ms;
@@ -29,8 +29,8 @@
29
29
  [data-slot="drawer-content"] {
30
30
  --drawer-bleed: 3rem;
31
31
  transition:
32
- transform calc(var(--duration) * 3) var(--ease),
33
- padding-bottom calc(var(--duration) * 3) var(--ease);
32
+ transform calc(var(--duration) * 2) var(--ease),
33
+ padding-bottom calc(var(--duration) * 2) var(--ease);
34
34
 
35
35
  /* Fills the gap behind the panel when it is pulled past its resting edge. */
36
36
  &::after {
@@ -45,7 +45,7 @@
45
45
  user-select: none;
46
46
  }
47
47
  &[data-ending-style] {
48
- transition-duration: calc(var(--drawer-swipe-strength, 1) * var(--duration) * 3);
48
+ transition-duration: calc(var(--drawer-swipe-strength, 1) * var(--duration) * 2);
49
49
  }
50
50
 
51
51
  /*
@@ -142,8 +142,8 @@
142
142
  scale(var(--scale));
143
143
  user-select: none;
144
144
  transition:
145
- transform calc(var(--duration) * 3) var(--ease),
146
- opacity calc(var(--duration) * 3) var(--ease),
145
+ transform calc(var(--duration) * 2) var(--ease),
146
+ opacity calc(var(--duration) * 2) var(--ease),
147
147
  height var(--duration) var(--ease);
148
148
 
149
149
  /* Bridges the gap between expanded toasts so hover doesn't flicker. */
@@ -67,9 +67,11 @@
67
67
  --control-thumb-on: #ffffff; /* thumb on a primary-filled (checked) track */
68
68
 
69
69
  /* Internal geometry: controls nested inside a field (steppers, clear buttons, chips, addon
70
- buttons). Not steps on the 30/38/46 scale — they are the field height minus its inset. */
71
- --control-inset: 30px; /* inside a 38px field (3px inset + 1px border) */
72
- --control-inset-sm: 24px; /* inside a 30px dense field */
70
+ buttons). Not steps on the 30/38/46 scale — they are the field height minus its inset, so a
71
+ theme that changes the heights moves them too. A theme that sets the heights on part of a page
72
+ sets these there as well: computed here, they follow only the heights on :root. */
73
+ --control-inset: calc(var(--control-h) - 8px); /* 30px inside a 38px field (3px inset + 1px border) */
74
+ --control-inset-sm: calc(var(--control-h-sm) - 6px); /* 24px inside a 30px dense field */
73
75
 
74
76
  /* ── Material: fields (recessed) ──────────────────────────── */
75
77
  --field-surface: #ffffff;
@@ -104,6 +106,11 @@
104
106
  /* Overlay and screen vanish on a light ground: the page grain multiplies there instead. */
105
107
  --page-grain-blend: multiply;
106
108
  --page-grain-opacity: 0.1;
109
+ /* The page ground as one flat colour: what the grain over --background averages to. The
110
+ browser's own bars take it (theme-color, kept in step by themeScript and ThemeProvider), and
111
+ so does whatever of the page the browser shows past its edges. Re-measure when the
112
+ background or the grain changes. */
113
+ --page-tone: #f9f9f9;
107
114
 
108
115
  /* ── Isometric illustrations (<Illustration name="iso/…">) ───────────── */
109
116
 
@@ -225,6 +232,7 @@
225
232
  --page-glow: rgb(255 255 255 / 0.035);
226
233
  --page-grain-blend: overlay;
227
234
  --page-grain-opacity: calc(var(--grain-opacity) * 1.5);
235
+ --page-tone: #141414;
228
236
 
229
237
  /* re-declared so var(--background) resolves inside dark regions, not at :root */
230
238
 
@@ -276,6 +284,7 @@
276
284
  --page-glow: rgb(255 255 255 / 0.035);
277
285
  --page-grain-blend: overlay;
278
286
  --page-grain-opacity: calc(var(--grain-opacity) * 1.5);
287
+ --page-tone: #0f0f0f;
279
288
 
280
289
  --logo: #f6f6f4;
281
290
  }
package/dist/vite.d.ts CHANGED
@@ -64,53 +64,3 @@ export declare function zonFonts(options?: {
64
64
  };
65
65
  };
66
66
  };
67
- /**
68
- * The Licht face each of Excalidraw's drawing fonts is drawn in, by Excalidraw's font folder.
69
- * Text on the canvas — and in its SVG and PNG exports — is set in Licht: Soft for normal text
70
- * (the default), Serif in place of the handwriting, Mono for code, Sans for the rest.
71
- */
72
- export declare const EXCALIDRAW_LICHT: Record<string, string>;
73
- /**
74
- * Vite helper: serves Excalidraw's fonts — for Whiteboard (`@zonsh/ui/whiteboard`) — from the
75
- * app's own origin, at /excalidraw/fonts/*, instead of the CDN Excalidraw would use. In
76
- * development they stream from node_modules; a build writes them beside your assets.
77
- *
78
- * import { excalidrawAssets, zonFonts } from "@zonsh/ui/vite";
79
- * export default defineConfig({ plugins: [react(), tailwindcss(), zonFonts(), excalidrawAssets()] });
80
- *
81
- * Its drawing fonts are swapped for Licht (see EXCALIDRAW_LICHT): their requests go to
82
- * /licht/fonts/*, the same proxy zonFonts() sets up and your host mirrors in production. Only
83
- * Xiaolai, the CJK fallback, stays Excalidraw's.
84
- *
85
- * Pass the same folder to Whiteboard's `assetPath` (default `/excalidraw/`, plus your Vite
86
- * `base` if the app is not served from the root). Only the fonts a drawing uses are downloaded.
87
- */
88
- export declare function excalidrawAssets(options?: {
89
- path?: string;
90
- }): {
91
- name: string;
92
- configResolved(config: {
93
- root: string;
94
- }): void;
95
- configureServer(server: {
96
- middlewares: {
97
- use: (handler: (req: {
98
- url?: string;
99
- }, res: {
100
- setHeader: (name: string, value: string) => void;
101
- statusCode: number;
102
- } & NodeJS.WritableStream, next: () => void) => void) => void;
103
- };
104
- }): void;
105
- transform(code: string, id: string): {
106
- code: string;
107
- map: null;
108
- } | null;
109
- generateBundle(this: {
110
- emitFile: (file: {
111
- type: "asset";
112
- fileName: string;
113
- source: Uint8Array;
114
- }) => void;
115
- }): void;
116
- };
package/dist/vite.js CHANGED
@@ -1,6 +1,3 @@
1
- import { createReadStream, existsSync, readdirSync, readFileSync, statSync } from "node:fs";
2
- import { createRequire } from "node:module";
3
- import { dirname, join, sep } from "node:path";
4
1
  /**
5
2
  * Vite helper: proxies the Licht faces (Licht, Licht Sans, Licht Mono …) from zon.sh to the app's own origin.
6
3
  *
@@ -30,100 +27,3 @@ export function zonFonts(options = {}) {
30
27
  },
31
28
  };
32
29
  }
33
- /**
34
- * The Licht face each of Excalidraw's drawing fonts is drawn in, by Excalidraw's font folder.
35
- * Text on the canvas — and in its SVG and PNG exports — is set in Licht: Soft for normal text
36
- * (the default), Serif in place of the handwriting, Mono for code, Sans for the rest.
37
- */
38
- export const EXCALIDRAW_LICHT = {
39
- Nunito: "LichtSoft-Regular",
40
- Virgil: "LichtSoft-Regular",
41
- Excalifont: "LichtSerif-Regular",
42
- Lilita: "LichtSans-Regular",
43
- Liberation: "LichtSans-Regular",
44
- ComicShanns: "LichtMono-Regular",
45
- Cascadia: "LichtMono-Regular",
46
- };
47
- /**
48
- * Vite helper: serves Excalidraw's fonts — for Whiteboard (`@zonsh/ui/whiteboard`) — from the
49
- * app's own origin, at /excalidraw/fonts/*, instead of the CDN Excalidraw would use. In
50
- * development they stream from node_modules; a build writes them beside your assets.
51
- *
52
- * import { excalidrawAssets, zonFonts } from "@zonsh/ui/vite";
53
- * export default defineConfig({ plugins: [react(), tailwindcss(), zonFonts(), excalidrawAssets()] });
54
- *
55
- * Its drawing fonts are swapped for Licht (see EXCALIDRAW_LICHT): their requests go to
56
- * /licht/fonts/*, the same proxy zonFonts() sets up and your host mirrors in production. Only
57
- * Xiaolai, the CJK fallback, stays Excalidraw's.
58
- *
59
- * Pass the same folder to Whiteboard's `assetPath` (default `/excalidraw/`, plus your Vite
60
- * `base` if the app is not served from the root). Only the fonts a drawing uses are downloaded.
61
- */
62
- export function excalidrawAssets(options = {}) {
63
- const folder = (options.path ?? "excalidraw").replace(/^\/+|\/+$/g, "");
64
- const marker = `/${folder}/fonts/`;
65
- let fonts = "";
66
- const swapped = new RegExp(`"\\./fonts/(${Object.keys(EXCALIDRAW_LICHT).join("|")})/[^"]+\\.woff2"`, "g");
67
- /** Excalidraw's font folder, found from the app or, failing that, from this package. */
68
- const locate = (root) => {
69
- for (const from of [join(root, "package.json"), import.meta.url]) {
70
- try {
71
- const dir = join(dirname(createRequire(from).resolve("@excalidraw/excalidraw")), "fonts");
72
- if (existsSync(dir))
73
- return dir;
74
- }
75
- catch {
76
- // Not resolvable from here: try the next place.
77
- }
78
- }
79
- return "";
80
- };
81
- return {
82
- name: "zon-excalidraw-assets",
83
- configResolved(config) {
84
- fonts = locate(config.root);
85
- },
86
- configureServer(server) {
87
- server.middlewares.use((req, res, next) => {
88
- const url = (req.url ?? "").split("?")[0];
89
- const at = url.indexOf(marker);
90
- if (!fonts || at === -1)
91
- return next();
92
- const rest = decodeURIComponent(url.slice(at + marker.length));
93
- // A drawing font: its Licht face, through the /licht/fonts proxy.
94
- const licht = EXCALIDRAW_LICHT[rest.split("/")[0]];
95
- if (licht) {
96
- res.statusCode = 302;
97
- res.setHeader("Location", `/licht/fonts/${licht}.woff2`);
98
- res.end();
99
- return;
100
- }
101
- const file = join(fonts, rest);
102
- if (!file.startsWith(fonts) || !existsSync(file) || !statSync(file).isFile())
103
- return next();
104
- res.setHeader("Content-Type", file.endsWith(".woff2") ? "font/woff2" : "application/octet-stream");
105
- res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
106
- createReadStream(file).pipe(res);
107
- });
108
- },
109
- // In a build, Excalidraw asks for its drawing fonts at their Licht address directly. (In
110
- // development its prebundled code keeps its own paths, and the middleware above answers them.)
111
- transform(code, id) {
112
- if (!id.includes("excalidraw") || !code.includes('"./fonts/'))
113
- return null;
114
- const next = code.replace(swapped, (_, family) => `(location.origin+"/licht/fonts/${EXCALIDRAW_LICHT[family]}.woff2")`);
115
- return next === code ? null : { code: next, map: null };
116
- },
117
- generateBundle() {
118
- if (!fonts)
119
- return;
120
- for (const name of readdirSync(fonts, { recursive: true })) {
121
- const full = join(fonts, name);
122
- // Fonts Licht stands in for are never asked for.
123
- if (EXCALIDRAW_LICHT[name.split(sep)[0]] || !statSync(full).isFile())
124
- continue;
125
- this.emitFile({ type: "asset", fileName: `${folder}/fonts/${name.split(sep).join("/")}`, source: readFileSync(full) });
126
- }
127
- },
128
- };
129
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zonsh/ui",
3
- "version": "0.2.0",
3
+ "version": "0.4.1",
4
4
  "description": "zon component library — Base UI primitives in the zon material.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -44,10 +44,6 @@
44
44
  "types": "./dist/components/chart.d.ts",
45
45
  "default": "./dist/components/chart.js"
46
46
  },
47
- "./code-highlight": {
48
- "types": "./dist/components/code-highlight.d.ts",
49
- "default": "./dist/components/code-highlight.js"
50
- },
51
47
  "./data-table": {
52
48
  "types": "./dist/components/data-table.d.ts",
53
49
  "default": "./dist/components/data-table.js"
@@ -72,9 +68,17 @@
72
68
  "types": "./dist/components/graph.d.ts",
73
69
  "default": "./dist/components/graph.js"
74
70
  },
75
- "./whiteboard": {
76
- "types": "./dist/components/whiteboard.d.ts",
77
- "default": "./dist/components/whiteboard.js"
71
+ "./illustration": {
72
+ "types": "./dist/illustration.d.ts",
73
+ "default": "./dist/illustration.js"
74
+ },
75
+ "./tippy": {
76
+ "types": "./dist/components/tippy.d.ts",
77
+ "default": "./dist/components/tippy.js"
78
+ },
79
+ "./messages/de": {
80
+ "types": "./dist/messages/de.d.ts",
81
+ "default": "./dist/messages/de.js"
78
82
  },
79
83
  "./styles.css": "./dist/styles/index.css",
80
84
  "./tokens.css": "./dist/styles/tokens.css",
@@ -96,7 +100,6 @@
96
100
  },
97
101
  "peerDependencies": {
98
102
  "@dagrejs/dagre": "^3.1.1",
99
- "@excalidraw/excalidraw": "^0.18.1",
100
103
  "@tanstack/react-table": "^9.2.6",
101
104
  "@xyflow/react": "^12.12.0",
102
105
  "d3-force": "^3.0.0",
@@ -108,7 +111,6 @@
108
111
  "react-dom": ">=19",
109
112
  "react-resizable-panels": "^4.14.2",
110
113
  "recharts": "^3.10.1",
111
- "shiki": "^4.5.0",
112
114
  "tailwindcss": "^4.1.15",
113
115
  "vite": ">=6"
114
116
  },
@@ -116,9 +118,6 @@
116
118
  "@dagrejs/dagre": {
117
119
  "optional": true
118
120
  },
119
- "@excalidraw/excalidraw": {
120
- "optional": true
121
- },
122
121
  "@tanstack/react-table": {
123
122
  "optional": true
124
123
  },
@@ -146,43 +145,39 @@
146
145
  "recharts": {
147
146
  "optional": true
148
147
  },
149
- "shiki": {
150
- "optional": true
151
- },
152
148
  "vite": {
153
149
  "optional": true
154
150
  }
155
151
  },
156
152
  "dependencies": {
157
- "@base-ui/react": "^1.8.0",
158
- "@tanstack/react-virtual": "^3.14.19",
153
+ "@base-ui/react": "^1.9.0",
154
+ "@tanstack/react-virtual": "^3.14.26",
159
155
  "clsx": "^2.1.1",
160
- "lucide-react": "^1.49.0",
161
- "marked": "^18.1.2",
156
+ "lucide-react": "^1.67.0",
157
+ "marked": "^18.1.3",
158
+ "shiki": "^4.6.0",
162
159
  "tailwind-merge": "^3.7.0"
163
160
  },
164
161
  "devDependencies": {
165
- "@dagrejs/dagre": "^3.1.1",
166
- "@excalidraw/excalidraw": "^0.18.1",
167
- "@tanstack/react-table": "^9.2.6",
162
+ "@dagrejs/dagre": "^3.1.3",
163
+ "@tanstack/react-table": "^9.3.1",
168
164
  "@types/d3-force": "3.0.10",
169
- "@types/node": "^26.6.3",
165
+ "@types/node": "^26.6.6",
170
166
  "@types/react": "^19.3.0",
171
167
  "@types/react-dom": "^19.3.0",
172
- "@xyflow/react": "^12.12.0",
173
- "d3-force": "^3.0.0",
168
+ "@xyflow/react": "^12.12.1",
169
+ "d3-force": "^3.0.1",
174
170
  "date-fns": "^4.4.0",
175
171
  "embla-carousel-react": "^8.6.0",
176
- "pdfjs-dist": "^6.4.299",
177
- "react": "^19.3.0",
172
+ "pdfjs-dist": "^6.5.438",
173
+ "react": "^19.3.1",
178
174
  "react-day-picker": "^10.0.2",
179
- "react-dom": "^19.3.0",
180
- "react-resizable-panels": "^4.14.2",
175
+ "react-dom": "^19.3.1",
176
+ "react-resizable-panels": "^4.17.0",
181
177
  "recharts": "^3.10.1",
182
- "shiki": "4.5.0",
183
- "tailwindcss": "^4.3.3",
178
+ "tailwindcss": "^4.3.4",
184
179
  "typescript": "^7.0.2",
185
- "vite": "^8.3.2"
180
+ "vite": "^8.3.5"
186
181
  },
187
182
  "scripts": {
188
183
  "gen:index": "node ../../scripts/gen-index.mjs",
@@ -1,13 +0,0 @@
1
- import * as React from "react";
2
- import { zonCodeTheme } from "../lib/code-theme.js";
3
- export { zonCodeTheme };
4
- /**
5
- * CodeHighlightProvider — lets CodeBlocks inside it colour their code: a block with `highlight`
6
- * and a `language` is tokenised with Shiki, VS Code's own grammars, in the zon theme. Shiki and
7
- * each language load the first time a block needs them; until then, and for a language Shiki does
8
- * not know, the block stays plain mono. It is its own entry (`@zonsh/ui/code-highlight`) so the
9
- * main entry never pulls Shiki in; install `shiki` to use it.
10
- */
11
- export declare function CodeHighlightProvider({ children }: {
12
- children?: React.ReactNode;
13
- }): React.JSX.Element;