@krizaka/ui 3.73.0 → 3.75.0

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 (369) hide show
  1. package/README.md +4 -10
  2. package/dist/{RotatingWord-COSabR2c.d.ts → RotatingWord-D3tpDLE4.d.ts} +1 -1
  3. package/dist/account-menu.d.ts +1 -1
  4. package/dist/account-menu.js +1 -1
  5. package/dist/account-settings.d.ts +1 -1
  6. package/dist/account-settings.js +1 -1
  7. package/dist/app-frame.d.ts +2 -5
  8. package/dist/avatar/defaults.d.ts +2 -2
  9. package/dist/avatar/defaults.js +1 -5
  10. package/dist/avatar/defaults.js.map +1 -1
  11. package/dist/{avatar-B_na7r1U.d.ts → avatar-CNV6ld8l.d.ts} +2 -2
  12. package/dist/avatar.d.ts +2 -2
  13. package/dist/avatar.js +1 -5
  14. package/dist/avatar.js.map +1 -1
  15. package/dist/blocks.css +4 -4
  16. package/dist/chat.js +1 -1
  17. package/dist/{chunk-5MPPIGCB.js → chunk-E46AEUPH.js} +1 -5
  18. package/dist/chunk-E46AEUPH.js.map +1 -0
  19. package/dist/{chunk-TISDOZH3.js → chunk-IOTY5HYG.js} +1 -5
  20. package/dist/chunk-IOTY5HYG.js.map +1 -0
  21. package/dist/chunk-PGPNYYE2.js +286 -0
  22. package/dist/chunk-PGPNYYE2.js.map +1 -0
  23. package/dist/{chunk-GRVIZTT2.js → chunk-RI3AA2E3.js} +3 -3
  24. package/dist/{chunk-Y5YBTHVD.js → chunk-SG3QJJXE.js} +6 -12
  25. package/dist/chunk-SG3QJJXE.js.map +1 -0
  26. package/dist/{chunk-4JO5GSSD.js → chunk-VA4NPCUQ.js} +2 -2
  27. package/dist/chunk-VA4NPCUQ.js.map +1 -0
  28. package/dist/{chunk-E4FMPPDL.js → chunk-WC3SO4CE.js} +2 -2
  29. package/dist/{chunk-T5NZSKWT.js → chunk-YQWYGQTV.js} +38 -41
  30. package/dist/chunk-YQWYGQTV.js.map +1 -0
  31. package/dist/{chunk-M3GEYLMR.js → chunk-ZPOVOEO3.js} +1 -2
  32. package/dist/collection-switcher.d.ts +1 -1
  33. package/dist/data-table.js +3 -3
  34. package/dist/{default-avatar-BL0nJFti.d.ts → default-avatar-Bh4atFDo.d.ts} +2 -2
  35. package/dist/elephant.d.ts +2 -2
  36. package/dist/elephant.js +2 -3
  37. package/dist/elephant.js.map +1 -1
  38. package/dist/engine-flow.js +29 -21
  39. package/dist/engine-flow.js.map +1 -1
  40. package/dist/entity-header.d.ts +1 -1
  41. package/dist/filter-bar.d.ts +9 -1
  42. package/dist/filter-bar.js +1 -1
  43. package/dist/gallery-page.js +3 -3
  44. package/dist/genui.js +101 -35
  45. package/dist/genui.js.map +1 -1
  46. package/dist/index.d.ts +7 -51
  47. package/dist/index.js +2 -12
  48. package/dist/index.js.map +1 -1
  49. package/dist/{lightbox-D5NAHFEA.js → lightbox-Q45BZ3HW.js} +3 -3
  50. package/dist/map.js +0 -120
  51. package/dist/map.js.map +1 -1
  52. package/dist/match-dialog.js +3 -3
  53. package/dist/motion.css +3 -120
  54. package/dist/motion.d.ts +1 -1
  55. package/dist/motion.js +1 -1
  56. package/dist/native/list.js +1 -1
  57. package/dist/native/list.js.map +1 -1
  58. package/dist/native/map.js +0 -120
  59. package/dist/native/map.js.map +1 -1
  60. package/dist/native.d.ts +7 -111
  61. package/dist/native.js +988 -1436
  62. package/dist/native.js.map +1 -1
  63. package/dist/nav-bar.d.ts +1 -1
  64. package/dist/nav-bar.js +2 -2
  65. package/dist/product-page.js +3 -3
  66. package/dist/rail-nav.d.ts +2 -5
  67. package/dist/shop-gallery.js +1 -1
  68. package/dist/site-cahier.d.ts +3 -11
  69. package/dist/site-cahier.js +126 -367
  70. package/dist/site-cahier.js.map +1 -1
  71. package/dist/site-footer.d.ts +1 -1
  72. package/dist/site-footer.js +2 -2
  73. package/dist/{sites-CEnywB89.d.ts → sites-CVNSirrg.d.ts} +3 -11
  74. package/dist/sites.d.ts +7 -15
  75. package/dist/sites.js +4 -10
  76. package/dist/sites.js.map +1 -1
  77. package/dist/tag-selector.js +28 -21
  78. package/dist/tag-selector.js.map +1 -1
  79. package/dist/vertical-video.js +2 -2
  80. package/dist/waveform.js.map +1 -1
  81. package/package.json +5 -109
  82. package/registry/account-menu.json +1 -1
  83. package/registry/account-settings.json +1 -1
  84. package/registry/achievement.json +1 -1
  85. package/registry/action-bar.json +1 -1
  86. package/registry/activity-feed.json +1 -1
  87. package/registry/agenda.json +1 -1
  88. package/registry/alert.json +1 -1
  89. package/registry/analysis-report.json +1 -1
  90. package/registry/anatomy-plate.json +1 -1
  91. package/registry/app-frame.json +6 -38
  92. package/registry/app-header.json +1 -1
  93. package/registry/app-shell.json +1 -1
  94. package/registry/argument-card.json +1 -1
  95. package/registry/auth-layout.json +1 -1
  96. package/registry/avatar.json +2 -2
  97. package/registry/badge.json +1 -1
  98. package/registry/bird-plate.json +1 -1
  99. package/registry/button.json +1 -1
  100. package/registry/captcha.json +1 -1
  101. package/registry/card-grid.json +1 -1
  102. package/registry/card.json +1 -1
  103. package/registry/catalogue-page.json +1 -1
  104. package/registry/changelog-page.json +1 -1
  105. package/registry/chapter.json +1 -1
  106. package/registry/chat.json +3 -3
  107. package/registry/checkbox.json +1 -1
  108. package/registry/chip-link.json +1 -1
  109. package/registry/chip-row.json +1 -1
  110. package/registry/chip.json +1 -1
  111. package/registry/choice-grid.json +1 -1
  112. package/registry/code-block.json +1 -1
  113. package/registry/collection-switcher.json +1 -1
  114. package/registry/combobox.json +1 -1
  115. package/registry/command.json +1 -1
  116. package/registry/comparison-table.json +1 -1
  117. package/registry/component-page.json +1 -1
  118. package/registry/confirm-button.json +1 -1
  119. package/registry/contact-page.json +1 -1
  120. package/registry/continue-prompt.json +1 -1
  121. package/registry/copy-button.json +1 -1
  122. package/registry/countdown.json +1 -1
  123. package/registry/cover-hero.json +1 -1
  124. package/registry/cta-panel.json +1 -1
  125. package/registry/dashboard-layout.json +1 -1
  126. package/registry/data-table.json +1 -1
  127. package/registry/date-picker.json +1 -1
  128. package/registry/decision-list.json +1 -1
  129. package/registry/description-list.json +1 -1
  130. package/registry/desktop-window.json +1 -1
  131. package/registry/detail-layout.json +1 -1
  132. package/registry/dialog.json +1 -1
  133. package/registry/docs-article-page.json +1 -1
  134. package/registry/docs-hub-page.json +1 -1
  135. package/registry/docs-layout.json +1 -1
  136. package/registry/docs-nav.json +1 -1
  137. package/registry/document-viewer.json +1 -1
  138. package/registry/doodle.json +1 -1
  139. package/registry/drop-overlay.json +1 -1
  140. package/registry/dropdown-menu.json +1 -1
  141. package/registry/elephant.json +3 -5
  142. package/registry/embed-facade.json +1 -1
  143. package/registry/empty-state.json +1 -1
  144. package/registry/engine-flow.json +3 -4
  145. package/registry/entity-header.json +1 -1
  146. package/registry/environment-notice.json +1 -1
  147. package/registry/error-page.json +1 -1
  148. package/registry/field.json +1 -1
  149. package/registry/file-upload.json +1 -1
  150. package/registry/filter-bar.json +2 -2
  151. package/registry/flock.json +1 -1
  152. package/registry/footnote.json +1 -1
  153. package/registry/force-update-screen.json +1 -1
  154. package/registry/form.json +1 -1
  155. package/registry/gallery-page.json +1 -1
  156. package/registry/genui.json +1 -1
  157. package/registry/glossary-term.json +1 -1
  158. package/registry/glossary.json +1 -1
  159. package/registry/glow-card.json +1 -1
  160. package/registry/goal-gauge.json +1 -1
  161. package/registry/grade-stamp.json +1 -1
  162. package/registry/image-cropper.json +1 -1
  163. package/registry/index.json +11 -246
  164. package/registry/kanban.json +1 -1
  165. package/registry/kbd.json +1 -1
  166. package/registry/kind-config-editor.json +1 -1
  167. package/registry/kpi-explained.json +1 -1
  168. package/registry/landing-page.json +1 -1
  169. package/registry/landscape.json +1 -1
  170. package/registry/language-switch.json +1 -1
  171. package/registry/legal-page.json +1 -1
  172. package/registry/link-card.json +1 -1
  173. package/registry/list.json +1 -1
  174. package/registry/loader.json +1 -1
  175. package/registry/longform-page.json +1 -1
  176. package/registry/maintenance-screen.json +1 -1
  177. package/registry/map.json +2 -2
  178. package/registry/margin-layout.json +1 -1
  179. package/registry/markdown.json +1 -1
  180. package/registry/marketing-layout.json +1 -1
  181. package/registry/mascot-quote.json +1 -1
  182. package/registry/mascot-state.json +1 -1
  183. package/registry/mascots.json +1 -1
  184. package/registry/match-dialog.json +3 -3
  185. package/registry/media-capture.json +1 -1
  186. package/registry/media-gallery.json +3 -14
  187. package/registry/meter.json +1 -1
  188. package/registry/money-input.json +1 -1
  189. package/registry/nav-bar.json +6 -38
  190. package/registry/next-actions.json +1 -1
  191. package/registry/notification-preferences.json +1 -1
  192. package/registry/number-ticker.json +1 -1
  193. package/registry/opening-hours.json +3 -4
  194. package/registry/page-header.json +1 -1
  195. package/registry/page-hero.json +1 -1
  196. package/registry/page-index.json +1 -1
  197. package/registry/page.json +1 -1
  198. package/registry/pagination.json +1 -1
  199. package/registry/pointer-light.json +1 -1
  200. package/registry/popover.json +1 -1
  201. package/registry/price-catalogue-editor.json +1 -1
  202. package/registry/pricing-page.json +1 -1
  203. package/registry/product-page.json +2 -6
  204. package/registry/profile-card.json +1 -1
  205. package/registry/progress.json +1 -1
  206. package/registry/promise-card.json +1 -1
  207. package/registry/promo-code-field.json +1 -1
  208. package/registry/proposal.json +1 -1
  209. package/registry/qr-code.json +1 -1
  210. package/registry/quota-meter.json +1 -1
  211. package/registry/radio-group.json +1 -1
  212. package/registry/rail-nav.json +6 -38
  213. package/registry/recipes.json +1 -1
  214. package/registry/retro-tv.json +2 -3
  215. package/registry/reviews.json +1 -1
  216. package/registry/router.json +1 -1
  217. package/registry/schema-form.json +1 -1
  218. package/registry/scroll-stage.json +1 -1
  219. package/registry/search-field.json +1 -1
  220. package/registry/section-backdrop.json +1 -1
  221. package/registry/separator.json +1 -1
  222. package/registry/service-card.json +1 -1
  223. package/registry/settings-layout.json +1 -1
  224. package/registry/shop-composer.json +1 -1
  225. package/registry/shop-gallery.json +3 -8
  226. package/registry/shop.json +2 -2
  227. package/registry/showcase.json +2 -7
  228. package/registry/signature.json +1 -1
  229. package/registry/site-cahier.json +1 -1
  230. package/registry/site-footer.json +6 -38
  231. package/registry/sites.json +3 -3
  232. package/registry/skeleton.json +1 -1
  233. package/registry/skip-link.json +1 -1
  234. package/registry/slider.json +1 -1
  235. package/registry/slot-picker.json +1 -1
  236. package/registry/slot.json +1 -1
  237. package/registry/specimen-tag.json +1 -1
  238. package/registry/speed-lines.json +1 -1
  239. package/registry/spinner.json +1 -1
  240. package/registry/split-view.json +1 -1
  241. package/registry/stage-banner.json +1 -1
  242. package/registry/stat.json +1 -1
  243. package/registry/status-chip.json +1 -1
  244. package/registry/status-page.json +1 -1
  245. package/registry/step-progress.json +1 -1
  246. package/registry/step-showcase.json +1 -1
  247. package/registry/stepper.json +1 -1
  248. package/registry/sticky-action.json +1 -1
  249. package/registry/stuck.json +1 -1
  250. package/registry/swipe-deck.json +4 -5
  251. package/registry/switch.json +1 -1
  252. package/registry/tabs.json +1 -1
  253. package/registry/tag-input.json +1 -1
  254. package/registry/tag-selector.json +2 -2
  255. package/registry/taped-photo.json +1 -1
  256. package/registry/terminal-replay.json +1 -1
  257. package/registry/text-style.json +1 -1
  258. package/registry/theme.json +1 -1
  259. package/registry/toast.json +1 -1
  260. package/registry/toc.json +1 -1
  261. package/registry/tooltip.json +1 -1
  262. package/registry/tree-view.json +1 -1
  263. package/registry/update-prompt.json +1 -1
  264. package/registry/upload-queue.json +1 -1
  265. package/registry/usage.json +1 -1
  266. package/registry/verified-badge.json +1 -1
  267. package/registry/versus-card.json +1 -1
  268. package/registry/vertical-video.json +2 -6
  269. package/registry/video-player.json +2 -7
  270. package/registry/video-trimmer.json +3 -4
  271. package/registry/virtual.json +1 -1
  272. package/registry/wall.json +3 -9
  273. package/registry/waveform.json +4 -9
  274. package/dist/audio-player.d.ts +0 -115
  275. package/dist/audio-player.js +0 -211
  276. package/dist/audio-player.js.map +0 -1
  277. package/dist/chunk-4JO5GSSD.js.map +0 -1
  278. package/dist/chunk-5MPPIGCB.js.map +0 -1
  279. package/dist/chunk-B2HS5EAH.js +0 -527
  280. package/dist/chunk-B2HS5EAH.js.map +0 -1
  281. package/dist/chunk-T5NZSKWT.js.map +0 -1
  282. package/dist/chunk-TISDOZH3.js.map +0 -1
  283. package/dist/chunk-Y5YBTHVD.js.map +0 -1
  284. package/dist/chunk-YKOLME7R.js +0 -126
  285. package/dist/chunk-YKOLME7R.js.map +0 -1
  286. package/dist/how-it-works-page.d.ts +0 -49
  287. package/dist/how-it-works-page.js +0 -28
  288. package/dist/how-it-works-page.js.map +0 -1
  289. package/dist/iso.d.ts +0 -401
  290. package/dist/iso.js +0 -363
  291. package/dist/iso.js.map +0 -1
  292. package/dist/marquee.d.ts +0 -34
  293. package/dist/marquee.js +0 -52
  294. package/dist/marquee.js.map +0 -1
  295. package/dist/media-grid.d.ts +0 -246
  296. package/dist/media-grid.js +0 -468
  297. package/dist/media-grid.js.map +0 -1
  298. package/dist/meta-row.d.ts +0 -55
  299. package/dist/meta-row.js +0 -35
  300. package/dist/meta-row.js.map +0 -1
  301. package/dist/photo-grid.d.ts +0 -123
  302. package/dist/photo-grid.js +0 -94
  303. package/dist/photo-grid.js.map +0 -1
  304. package/registry/audio-player.json +0 -300
  305. package/registry/examples/audio-player/podcast.d.ts +0 -4
  306. package/registry/examples/audio-player/podcast.js +0 -22
  307. package/registry/examples/audio-player/podcast.tsx +0 -19
  308. package/registry/examples/audio-player/voice-note.d.ts +0 -4
  309. package/registry/examples/audio-player/voice-note.js +0 -12
  310. package/registry/examples/audio-player/voice-note.tsx +0 -12
  311. package/registry/examples/how-it-works-page/orazaka.d.ts +0 -4
  312. package/registry/examples/how-it-works-page/orazaka.js +0 -30
  313. package/registry/examples/how-it-works-page/orazaka.tsx +0 -26
  314. package/registry/examples/iso/compose.d.ts +0 -4
  315. package/registry/examples/iso/compose.js +0 -22
  316. package/registry/examples/iso/compose.tsx +0 -19
  317. package/registry/examples/iso/creator-hero.d.ts +0 -4
  318. package/registry/examples/iso/creator-hero.js +0 -29
  319. package/registry/examples/iso/creator-hero.tsx +0 -23
  320. package/registry/examples/iso/orazaka-hero.d.ts +0 -4
  321. package/registry/examples/iso/orazaka-hero.js +0 -26
  322. package/registry/examples/iso/orazaka-hero.tsx +0 -21
  323. package/registry/examples/iso/still.d.ts +0 -4
  324. package/registry/examples/iso/still.js +0 -21
  325. package/registry/examples/iso/still.tsx +0 -15
  326. package/registry/examples/marquee/cards.d.ts +0 -4
  327. package/registry/examples/marquee/cards.js +0 -23
  328. package/registry/examples/marquee/cards.tsx +0 -21
  329. package/registry/examples/marquee/logos.d.ts +0 -4
  330. package/registry/examples/marquee/logos.js +0 -12
  331. package/registry/examples/marquee/logos.tsx +0 -17
  332. package/registry/examples/media-grid/feed.d.ts +0 -4
  333. package/registry/examples/media-grid/feed.js +0 -32
  334. package/registry/examples/media-grid/feed.tsx +0 -31
  335. package/registry/examples/media-grid/loading.d.ts +0 -4
  336. package/registry/examples/media-grid/loading.js +0 -28
  337. package/registry/examples/media-grid/loading.tsx +0 -25
  338. package/registry/examples/media-grid/uniform.d.ts +0 -4
  339. package/registry/examples/media-grid/uniform.js +0 -29
  340. package/registry/examples/media-grid/uniform.tsx +0 -26
  341. package/registry/examples/meta-row/native/video.d.ts +0 -4
  342. package/registry/examples/meta-row/native/video.dark.png +0 -0
  343. package/registry/examples/meta-row/native/video.js +0 -11
  344. package/registry/examples/meta-row/native/video.light.png +0 -0
  345. package/registry/examples/meta-row/native/video.tsx +0 -5
  346. package/registry/examples/meta-row/status.d.ts +0 -4
  347. package/registry/examples/meta-row/status.js +0 -12
  348. package/registry/examples/meta-row/status.tsx +0 -7
  349. package/registry/examples/meta-row/video.d.ts +0 -4
  350. package/registry/examples/meta-row/video.js +0 -12
  351. package/registry/examples/meta-row/video.tsx +0 -7
  352. package/registry/examples/photo-grid/native/profile-photos.d.ts +0 -4
  353. package/registry/examples/photo-grid/native/profile-photos.dark.png +0 -0
  354. package/registry/examples/photo-grid/native/profile-photos.js +0 -27
  355. package/registry/examples/photo-grid/native/profile-photos.light.png +0 -0
  356. package/registry/examples/photo-grid/native/profile-photos.tsx +0 -24
  357. package/registry/examples/photo-grid/profile-photos.d.ts +0 -4
  358. package/registry/examples/photo-grid/profile-photos.js +0 -28
  359. package/registry/examples/photo-grid/profile-photos.tsx +0 -25
  360. package/registry/how-it-works-page.json +0 -258
  361. package/registry/iso.json +0 -1371
  362. package/registry/marquee.json +0 -241
  363. package/registry/media-grid.json +0 -1034
  364. package/registry/meta-row.json +0 -218
  365. package/registry/photo-grid.json +0 -316
  366. /package/dist/{chunk-GRVIZTT2.js.map → chunk-RI3AA2E3.js.map} +0 -0
  367. /package/dist/{chunk-E4FMPPDL.js.map → chunk-WC3SO4CE.js.map} +0 -0
  368. /package/dist/{chunk-M3GEYLMR.js.map → chunk-ZPOVOEO3.js.map} +0 -0
  369. /package/dist/{lightbox-D5NAHFEA.js.map → lightbox-Q45BZ3HW.js.map} +0 -0
@@ -1,9 +1,9 @@
1
- import {
2
- cn
3
- } from "./chunk-KH3JOEPY.js";
4
1
  import {
5
2
  warnDeprecated
6
3
  } from "./chunk-KGLRZMCY.js";
4
+ import {
5
+ cn
6
+ } from "./chunk-KH3JOEPY.js";
7
7
 
8
8
  // src/gallery-page/gallery-page.tsx
9
9
  import { CtaPanel } from "@krizaka/ui/cta-panel";
package/dist/genui.js CHANGED
@@ -1,20 +1,16 @@
1
1
  "use client";
2
- import {
3
- CardBody,
4
- CardRoot,
5
- CardTitle,
6
- Skeleton
7
- } from "./chunk-YKOLME7R.js";
8
2
  import {
9
3
  DataTable
10
- } from "./chunk-GRVIZTT2.js";
4
+ } from "./chunk-RI3AA2E3.js";
11
5
  import "./chunk-JXLDUDTD.js";
12
6
  import "./chunk-3X3OF4TI.js";
13
- import "./chunk-M3GEYLMR.js";
7
+ import "./chunk-ZPOVOEO3.js";
14
8
  import "./chunk-KVDB4GXV.js";
15
- import "./chunk-T5NZSKWT.js";
9
+ import "./chunk-YQWYGQTV.js";
16
10
  import "./chunk-UYGUSYIC.js";
17
- import "./chunk-D3T54RSL.js";
11
+ import {
12
+ defineRecipe
13
+ } from "./chunk-D3T54RSL.js";
18
14
  import "./chunk-J3NC6ER4.js";
19
15
  import {
20
16
  cn
@@ -61,6 +57,60 @@ function Alert({ tone = "info", icon, title, action, className, children, ...pro
61
57
  ] });
62
58
  }
63
59
 
60
+ // src/card/card.tsx
61
+ import { Slot } from "radix-ui";
62
+ import { tv as tv2 } from "tailwind-variants";
63
+
64
+ // src/card/recipe.ts
65
+ var cardRecipe = defineRecipe({
66
+ slots: {
67
+ root: "group relative flex flex-col overflow-hidden border border-border-default bg-surface-1 text-fg transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
68
+ media: "relative overflow-hidden bg-media",
69
+ image: "h-full w-full object-cover",
70
+ fallback: "flex h-full w-full items-center justify-center bg-linear-to-br from-accent/15 via-media to-accent-2/15 text-accent/60",
71
+ overlay: "absolute z-10 flex items-center gap-1.5",
72
+ body: "relative flex flex-1 flex-col gap-3",
73
+ title: "line-clamp-1 text-sm font-semibold text-fg transition-colors group-hover:text-fg-accent",
74
+ description: "line-clamp-2 text-xs text-fg-secondary",
75
+ stat: "min-w-0",
76
+ statLabel: "font-mono text-[11.5px] text-fg-secondary",
77
+ statValue: "font-display text-xl font-black tabular-nums text-fg",
78
+ footer: "relative mt-auto flex items-center gap-2 border-t border-border-subtle pt-3 text-xs text-fg-secondary"
79
+ },
80
+ variants: {
81
+ radius: { md: { root: "rounded-md" }, lg: { root: "rounded-lg" }, xl: { root: "rounded-xl" } },
82
+ tone: { default: {}, elevated: { root: "bg-surface-2 shadow-md" }, glass: { root: "bg-glass border-glass-border" } },
83
+ interactive: { true: { root: "duration-150 hover:border-border-strong hover:bg-surface-2" } },
84
+ padding: { none: { body: "p-0" }, sm: { body: "p-3" }, md: { body: "p-4" }, lg: { body: "p-6" } }
85
+ },
86
+ defaultVariants: { radius: "xl", tone: "default", padding: "md" }
87
+ });
88
+
89
+ // src/card/card.tsx
90
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
91
+ var card = tv2(cardRecipe);
92
+ var slots = card();
93
+ function CardRoot({ asChild, reveal, radius, tone, interactive, className, style, ...props }) {
94
+ const Comp = asChild ? Slot.Root : "div";
95
+ const revealStyle = reveal === void 0 ? style : { ...style, "--kz-delay": `${Math.min(Math.max(reveal, 0), 8) * 50}ms` };
96
+ return /* @__PURE__ */ jsx2(
97
+ Comp,
98
+ {
99
+ "data-reveal": reveal === void 0 ? void 0 : "",
100
+ "data-interactive": interactive ? "" : void 0,
101
+ style: revealStyle,
102
+ className: card({ radius, tone, interactive }).root({ className }),
103
+ ...props
104
+ }
105
+ );
106
+ }
107
+ function CardBody({ padding, className, ...props }) {
108
+ return /* @__PURE__ */ jsx2("div", { className: card({ padding }).body({ className }), ...props });
109
+ }
110
+ function CardTitle({ as: Tag = "h3", className, ...props }) {
111
+ return /* @__PURE__ */ jsx2(Tag, { className: slots.title({ className }), ...props });
112
+ }
113
+
64
114
  // src/genui/spec.ts
65
115
  var GENUI_VERSION = "v0.9";
66
116
  var GENUI_CATALOG_ID = "krizaka:genui/v1";
@@ -234,7 +284,7 @@ function checkCurrency(value, required) {
234
284
  }
235
285
 
236
286
  // src/genui/catalog.tsx
237
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
287
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
238
288
  var first = (...problems) => problems.find((p) => p !== null) ?? null;
239
289
  function asText(value) {
240
290
  if (typeof value === "string") return value.slice(0, GENUI_LIMITS.string);
@@ -260,31 +310,31 @@ var TONES = ["info", "success", "warning", "danger"];
260
310
  var VARIANTS = ["body", "heading", "caption"];
261
311
  var column = {
262
312
  check: (c) => first(allowKeys(c, ["children"]), checkChildren(c.children)),
263
- render: (c, ctx) => /* @__PURE__ */ jsx2("div", { className: "flex min-w-0 flex-col gap-4", children: ctx.children(c.children) })
313
+ render: (c, ctx) => /* @__PURE__ */ jsx3("div", { className: "flex min-w-0 flex-col gap-4", children: ctx.children(c.children) })
264
314
  };
265
315
  var row = {
266
316
  check: (c) => first(allowKeys(c, ["children"]), checkChildren(c.children)),
267
- render: (c, ctx) => /* @__PURE__ */ jsx2("div", { className: "grid min-w-0 gap-4 [grid-template-columns:repeat(auto-fit,minmax(12rem,1fr))]", children: ctx.children(c.children) })
317
+ render: (c, ctx) => /* @__PURE__ */ jsx3("div", { className: "grid min-w-0 gap-4 [grid-template-columns:repeat(auto-fit,minmax(12rem,1fr))]", children: ctx.children(c.children) })
268
318
  };
269
319
  var text = {
270
320
  check: (c) => first(allowKeys(c, ["text", "variant"]), checkText(c.text, "text", true), checkEnum(c.variant, "variant", VARIANTS)),
271
321
  render: (c, ctx) => {
272
322
  const value = asText(ctx.resolve(c.text));
273
- if (c.variant === "heading") return /* @__PURE__ */ jsx2("h3", { className: "text-base font-semibold text-fg", children: value });
274
- if (c.variant === "caption") return /* @__PURE__ */ jsx2("p", { className: "text-xs text-fg-muted", children: value });
275
- return /* @__PURE__ */ jsx2("p", { className: "text-sm text-fg", children: value });
323
+ if (c.variant === "heading") return /* @__PURE__ */ jsx3("h3", { className: "text-base font-semibold text-fg", children: value });
324
+ if (c.variant === "caption") return /* @__PURE__ */ jsx3("p", { className: "text-xs text-fg-muted", children: value });
325
+ return /* @__PURE__ */ jsx3("p", { className: "text-sm text-fg", children: value });
276
326
  }
277
327
  };
278
- var card = {
328
+ var card2 = {
279
329
  check: (c) => first(allowKeys(c, ["title", "child"]), checkText(c.title, "title", false), c.child === void 0 ? null : checkId(c.child, "child")),
280
- render: (c, ctx) => /* @__PURE__ */ jsx2(CardRoot, { children: /* @__PURE__ */ jsxs2(CardBody, { children: [
281
- c.title !== void 0 && /* @__PURE__ */ jsx2(CardTitle, { children: asText(ctx.resolve(c.title)) }),
282
- c.child !== void 0 && /* @__PURE__ */ jsx2("div", { className: "mt-3", children: ctx.child(c.child) })
330
+ render: (c, ctx) => /* @__PURE__ */ jsx3(CardRoot, { children: /* @__PURE__ */ jsxs3(CardBody, { children: [
331
+ c.title !== void 0 && /* @__PURE__ */ jsx3(CardTitle, { children: asText(ctx.resolve(c.title)) }),
332
+ c.child !== void 0 && /* @__PURE__ */ jsx3("div", { className: "mt-3", children: ctx.child(c.child) })
283
333
  ] }) })
284
334
  };
285
335
  var callout = {
286
336
  check: (c) => first(allowKeys(c, ["tone", "title", "text"]), checkEnum(c.tone, "tone", TONES), checkText(c.title, "title", false), checkText(c.text, "text", false)),
287
- render: (c, ctx) => /* @__PURE__ */ jsx2(Alert, { tone: c.tone ?? "info", title: c.title === void 0 ? void 0 : asText(ctx.resolve(c.title)), children: c.text === void 0 ? void 0 : asText(ctx.resolve(c.text)) })
337
+ render: (c, ctx) => /* @__PURE__ */ jsx3(Alert, { tone: c.tone ?? "info", title: c.title === void 0 ? void 0 : asText(ctx.resolve(c.title)), children: c.text === void 0 ? void 0 : asText(ctx.resolve(c.text)) })
288
338
  };
289
339
  function checkColumns(value) {
290
340
  if (!Array.isArray(value) || value.length === 0 || value.length > 12) return "columns is an array of 1 to 12";
@@ -315,14 +365,14 @@ function TableView({ c, ctx }) {
315
365
  },
316
366
  cell: (r) => formatGenUiValue(r[col.key], col.format, ctx.locale, col.currency)
317
367
  }));
318
- if (rows.length === 0) return /* @__PURE__ */ jsx2("p", { className: "text-sm text-fg-muted", children: ctx.labels.noData });
319
- return /* @__PURE__ */ jsx2(DataTable, { rows, columns: cols, getRowId: (r) => r.__genuiRow, caption: c.caption === void 0 ? ctx.labels.surface : asText(ctx.resolve(c.caption)), showCaption: c.caption !== void 0 });
368
+ if (rows.length === 0) return /* @__PURE__ */ jsx3("p", { className: "text-sm text-fg-muted", children: ctx.labels.noData });
369
+ return /* @__PURE__ */ jsx3(DataTable, { rows, columns: cols, getRowId: (r) => r.__genuiRow, caption: c.caption === void 0 ? ctx.labels.surface : asText(ctx.resolve(c.caption)), showCaption: c.caption !== void 0 });
320
370
  }
321
371
  var table = {
322
372
  check: (c) => first(allowKeys(c, ["caption", "columns", "rows"]), checkText(c.caption, "caption", false), checkColumns(c.columns), checkBinding(c.rows, "rows")),
323
- render: (c, ctx) => /* @__PURE__ */ jsx2(TableView, { c, ctx })
373
+ render: (c, ctx) => /* @__PURE__ */ jsx3(TableView, { c, ctx })
324
374
  };
325
- var baseGenUiCatalog = { Column: column, Row: row, Text: text, Card: card, Callout: callout, Table: table };
375
+ var baseGenUiCatalog = { Column: column, Row: row, Text: text, Card: card2, Callout: callout, Table: table };
326
376
 
327
377
  // src/genui/store.ts
328
378
  var emptyGenUiState = { surfaces: /* @__PURE__ */ new Map(), order: [], errors: [] };
@@ -444,7 +494,23 @@ function readStream(text2, catalog) {
444
494
 
445
495
  // src/genui/surface.tsx
446
496
  import * as React from "react";
447
- import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
497
+
498
+ // src/skeleton/skeleton.tsx
499
+ import { tv as tv3 } from "tailwind-variants";
500
+ import { jsx as jsx4 } from "react/jsx-runtime";
501
+ var skeletonVariants = tv3({
502
+ base: "kz-skeleton block bg-surface-3",
503
+ variants: {
504
+ shape: { text: "h-3 w-full rounded-sm", circle: "aspect-square h-10 rounded-full", rect: "h-24 w-full rounded-lg" }
505
+ },
506
+ defaultVariants: { shape: "text" }
507
+ });
508
+ function Skeleton({ shape, className, ...props }) {
509
+ return /* @__PURE__ */ jsx4("span", { "aria-hidden": true, "data-shape": shape ?? "text", className: skeletonVariants({ shape, className }), ...props });
510
+ }
511
+
512
+ // src/genui/surface.tsx
513
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
448
514
  var genUiLabels = { loading: "Building the view\u2026", surface: "Generated view", noData: "No data" };
449
515
  function GenUiSurface({ surface, catalog, streaming = false, labels, locale = "en", onError, className }) {
450
516
  const words = { ...genUiLabels, ...labels };
@@ -463,25 +529,25 @@ function GenUiSurface({ surface, catalog, streaming = false, labels, locale = "e
463
529
  const component = surface.components.get(id);
464
530
  if (!component) {
465
531
  if (!streaming) problems.push(`"${id}" never arrived`);
466
- return streaming ? /* @__PURE__ */ jsx3(Skeleton, { className: "h-10 w-full rounded-lg" }, id) : null;
532
+ return streaming ? /* @__PURE__ */ jsx5(Skeleton, { className: "h-10 w-full rounded-lg" }, id) : null;
467
533
  }
468
534
  const entry = Object.hasOwn(catalog, component.component) ? catalog[component.component] : void 0;
469
535
  if (!entry) return null;
470
536
  seen.add(id);
471
537
  const context = {
472
538
  child: (c) => draw(c, depth + 1),
473
- children: (ids) => Array.isArray(ids) ? ids.map((c) => /* @__PURE__ */ jsx3(React.Fragment, { children: draw(c, depth + 1) }, String(c))) : [],
539
+ children: (ids) => Array.isArray(ids) ? ids.map((c) => /* @__PURE__ */ jsx5(React.Fragment, { children: draw(c, depth + 1) }, String(c))) : [],
474
540
  resolve: (value) => isBinding(value) ? readPath(surface.data, value.path) : value,
475
541
  labels: words,
476
542
  locale
477
543
  };
478
- return /* @__PURE__ */ jsx3(React.Fragment, { children: entry.render(component, context) }, id);
544
+ return /* @__PURE__ */ jsx5(React.Fragment, { children: entry.render(component, context) }, id);
479
545
  };
480
546
  const root = draw("root", 0);
481
547
  React.useEffect(() => {
482
548
  if (onError) for (const problem of problems) onError(problem);
483
549
  }, [surface, streaming]);
484
- return /* @__PURE__ */ jsx3("section", { "aria-label": words.surface, "aria-busy": streaming || void 0, "data-genui-surface": surface.id, className: cn("flex flex-col gap-4", className), children: root ?? (streaming ? /* @__PURE__ */ jsx3(Skeleton, { className: "h-24 w-full rounded-xl" }) : null) });
550
+ return /* @__PURE__ */ jsx5("section", { "aria-label": words.surface, "aria-busy": streaming || void 0, "data-genui-surface": surface.id, className: cn("flex flex-col gap-4", className), children: root ?? (streaming ? /* @__PURE__ */ jsx5(Skeleton, { className: "h-24 w-full rounded-xl" }) : null) });
485
551
  }
486
552
  function GenUiStream({ text: text2, catalog, streaming, renderProse, fallback, onError, ...rest }) {
487
553
  const state = React.useMemo(() => readStream(text2, catalog), [text2, catalog]);
@@ -491,13 +557,13 @@ function GenUiStream({ text: text2, catalog, streaming, renderProse, fallback, o
491
557
  for (const error of state.errors.slice(reported.current)) onError(error);
492
558
  reported.current = state.errors.length;
493
559
  }, [state, onError]);
494
- const prose = (value) => renderProse ? renderProse(value) : value.split(/\n{2,}/).map((p, i) => /* @__PURE__ */ jsx3("p", { children: p }, i));
560
+ const prose = (value) => renderProse ? renderProse(value) : value.split(/\n{2,}/).map((p, i) => /* @__PURE__ */ jsx5("p", { children: p }, i));
495
561
  const surfaces = state.order.map((id) => state.surfaces.get(id)).filter((s) => !!s && s.components.has("root"));
496
- if (!state.found || !streaming && surfaces.length === 0) return /* @__PURE__ */ jsx3(Fragment2, { children: fallback ? fallback(text2) : prose(text2) });
497
- return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-4", "data-genui-stream": "", children: [
562
+ if (!state.found || !streaming && surfaces.length === 0) return /* @__PURE__ */ jsx5(Fragment2, { children: fallback ? fallback(text2) : prose(text2) });
563
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-4", "data-genui-stream": "", children: [
498
564
  state.prose && prose(state.prose),
499
- surfaces.map((surface) => /* @__PURE__ */ jsx3(GenUiSurface, { surface, catalog, streaming, onError, ...rest }, surface.id)),
500
- streaming && surfaces.length === 0 && /* @__PURE__ */ jsx3(Skeleton, { className: "h-24 w-full rounded-xl" })
565
+ surfaces.map((surface) => /* @__PURE__ */ jsx5(GenUiSurface, { surface, catalog, streaming, onError, ...rest }, surface.id)),
566
+ streaming && surfaces.length === 0 && /* @__PURE__ */ jsx5(Skeleton, { className: "h-24 w-full rounded-xl" })
501
567
  ] });
502
568
  }
503
569
  export {
package/dist/genui.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/genui/catalog.tsx","../src/alert/alert.tsx","../src/genui/spec.ts","../src/genui/store.ts","../src/genui/surface.tsx"],"sourcesContent":["// The base catalog of `krizaka:genui/v1` (ADR-082): layout, text, card, callout and table — what a model may draw with\n// @krizaka/ui alone. `KpiStat` and `ChartCard` come from @krizaka/charts (`chartsGenUiCatalog`), which depends on this\n// package, never the reverse.\nimport { formatCompact, formatMoney, formatNumber, formatPercent } from \"@krizaka/intl\";\nimport type * as React from \"react\";\n\nimport { Alert } from \"../alert\";\nimport { CardBody, CardRoot, CardTitle } from \"../card\";\nimport { DataTable, type DataTableColumn } from \"../data-table\";\nimport {\n allowKeys,\n checkBinding,\n checkChildren,\n checkCurrency,\n checkEnum,\n checkId,\n checkText,\n GENUI_FORMATS,\n GENUI_LIMITS,\n type GenUiComponent,\n type GenUiFormat,\n} from \"./spec\";\nimport type { GenUiCatalog, GenUiEntry, GenUiRenderContext } from \"./surface\";\n\nconst first = (...problems: (string | null)[]) => problems.find((p) => p !== null) ?? null;\n\n/** A resolved value as text — strings and numbers only; anything else is not drawn. */\nfunction asText(value: unknown): string {\n if (typeof value === \"string\") return value.slice(0, GENUI_LIMITS.string);\n if (typeof value === \"number\" && Number.isFinite(value)) return String(value);\n return \"\";\n}\n\n/** A number written in one of the closed formats. */\nexport function formatGenUiValue(value: unknown, format: GenUiFormat | undefined, locale: string, currency?: string): string {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return asText(value);\n switch (format) {\n case \"integer\":\n return formatNumber(Math.round(value), { locale, maximumFractionDigits: 0 });\n case \"compact\":\n return formatCompact(value, { locale });\n case \"percent\":\n return formatPercent(value, { locale, maximumFractionDigits: 1 });\n case \"money\":\n return currency ? formatMoney(Math.round(value), { currency, locale }) : formatNumber(value, { locale });\n default:\n return formatNumber(value, { locale, maximumFractionDigits: 2 });\n }\n}\n\nconst TONES = [\"info\", \"success\", \"warning\", \"danger\"] as const;\nconst VARIANTS = [\"body\", \"heading\", \"caption\"] as const;\n\nconst column: GenUiEntry = {\n check: (c) => first(allowKeys(c, [\"children\"]), checkChildren(c.children)),\n render: (c, ctx) => <div className=\"flex min-w-0 flex-col gap-4\">{ctx.children(c.children)}</div>,\n};\n\nconst row: GenUiEntry = {\n check: (c) => first(allowKeys(c, [\"children\"]), checkChildren(c.children)),\n render: (c, ctx) => <div className=\"grid min-w-0 gap-4 [grid-template-columns:repeat(auto-fit,minmax(12rem,1fr))]\">{ctx.children(c.children)}</div>,\n};\n\nconst text: GenUiEntry = {\n check: (c) => first(allowKeys(c, [\"text\", \"variant\"]), checkText(c.text, \"text\", true), checkEnum(c.variant, \"variant\", VARIANTS)),\n render: (c, ctx) => {\n const value = asText(ctx.resolve(c.text));\n if (c.variant === \"heading\") return <h3 className=\"text-base font-semibold text-fg\">{value}</h3>;\n if (c.variant === \"caption\") return <p className=\"text-xs text-fg-muted\">{value}</p>;\n return <p className=\"text-sm text-fg\">{value}</p>;\n },\n};\n\nconst card: GenUiEntry = {\n check: (c) => first(allowKeys(c, [\"title\", \"child\"]), checkText(c.title, \"title\", false), c.child === undefined ? null : checkId(c.child, \"child\")),\n render: (c, ctx) => (\n <CardRoot>\n <CardBody>\n {c.title !== undefined && <CardTitle>{asText(ctx.resolve(c.title))}</CardTitle>}\n {c.child !== undefined && <div className=\"mt-3\">{ctx.child(c.child)}</div>}\n </CardBody>\n </CardRoot>\n ),\n};\n\nconst callout: GenUiEntry = {\n check: (c) => first(allowKeys(c, [\"tone\", \"title\", \"text\"]), checkEnum(c.tone, \"tone\", TONES), checkText(c.title, \"title\", false), checkText(c.text, \"text\", false)),\n render: (c, ctx) => (\n <Alert tone={(c.tone as (typeof TONES)[number] | undefined) ?? \"info\"} title={c.title === undefined ? undefined : asText(ctx.resolve(c.title))}>\n {c.text === undefined ? undefined : asText(ctx.resolve(c.text))}\n </Alert>\n ),\n};\n\ntype Column = { key: string; label: string; format?: GenUiFormat; currency?: string };\n\nfunction checkColumns(value: unknown): string | null {\n if (!Array.isArray(value) || value.length === 0 || value.length > 12) return \"columns is an array of 1 to 12\";\n for (const raw of value) {\n if (raw === null || typeof raw !== \"object\" || Array.isArray(raw)) return \"a column is an object\";\n const col = raw as Record<string, unknown>;\n const keys = Object.keys(col).find((k) => ![\"key\", \"label\", \"format\", \"currency\"].includes(k));\n if (keys) return `a column has no key \"${keys}\"`;\n if (typeof col.key !== \"string\" || !/^[A-Za-z0-9_]{1,64}$/.test(col.key)) return \"a column key is 1-64 characters of [A-Za-z0-9_]\";\n if (typeof col.label !== \"string\" || col.label.length > 120) return \"a column label is a string\";\n const problem = first(checkEnum(col.format, \"format\", GENUI_FORMATS), checkCurrency(col.currency, col.format === \"money\"));\n if (problem) return problem;\n }\n return null;\n}\n\ntype Row = Record<string, unknown> & { __genuiRow: string };\n\nfunction TableView({ c, ctx }: { c: GenUiComponent; ctx: GenUiRenderContext }) {\n const columns = c.columns as readonly Column[];\n const raw = ctx.resolve(c.rows);\n const rows: Row[] = Array.isArray(raw)\n ? raw.slice(0, GENUI_LIMITS.array).flatMap((r, i) => (r !== null && typeof r === \"object\" && !Array.isArray(r) ? [{ ...(r as Record<string, unknown>), __genuiRow: String(i) }] : []))\n : [];\n const cols: DataTableColumn<Row>[] = columns.map((col) => ({\n id: col.key,\n header: col.label,\n sortable: true,\n type: col.format ? \"number\" : \"text\",\n value: (r) => {\n const v = r[col.key];\n return typeof v === \"number\" || typeof v === \"string\" ? v : null;\n },\n cell: (r) => formatGenUiValue(r[col.key], col.format, ctx.locale, col.currency),\n }));\n if (rows.length === 0) return <p className=\"text-sm text-fg-muted\">{ctx.labels.noData}</p>;\n return <DataTable rows={rows} columns={cols} getRowId={(r) => r.__genuiRow} caption={c.caption === undefined ? ctx.labels.surface : asText(ctx.resolve(c.caption))} showCaption={c.caption !== undefined} />;\n}\n\nconst table: GenUiEntry = {\n check: (c) => first(allowKeys(c, [\"caption\", \"columns\", \"rows\"]), checkText(c.caption, \"caption\", false), checkColumns(c.columns), checkBinding(c.rows, \"rows\")),\n render: (c, ctx): React.ReactNode => <TableView c={c} ctx={ctx} />,\n};\n\n/** `Column`, `Row`, `Text`, `Card`, `Callout`, `Table` — the catalog @krizaka/ui draws on its own. */\nexport const baseGenUiCatalog: GenUiCatalog = { Column: column, Row: row, Text: text, Card: card, Callout: callout, Table: table };\n","// Server-safe. A message in the flow of the page (not a toast): a tone, an icon, a title, a text, an action.\n// danger and warning are announced at once (role=\"alert\"); info and success politely (role=\"status\").\nimport type * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\n// Soft tones (a tint, a tinted border, a coloured icon): the text stays a text role — the invariant status tokens are\n// too light for small text on a light surface (WCAG AA).\nexport const alertVariants = tv({\n slots: {\n root: \"relative flex w-full items-start gap-3 rounded-xl border p-4 text-sm text-fg\",\n icon: \"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center [&>svg]:h-5 [&>svg]:w-5\",\n content: \"flex min-w-0 flex-1 flex-col gap-1\",\n title: \"font-semibold text-fg\",\n description: \"text-fg-secondary\",\n action: \"flex shrink-0 items-center gap-2 self-center\",\n },\n variants: {\n tone: {\n info: { root: \"border-info/40 bg-info/10\", icon: \"text-info\" },\n success: { root: \"border-success/40 bg-success/10\", icon: \"text-success\" },\n warning: { root: \"border-warning/50 bg-warning/10\", icon: \"text-warning\" },\n danger: { root: \"border-danger/50 bg-danger/10\", icon: \"text-danger\" },\n },\n },\n defaultVariants: { tone: \"info\" },\n});\n\nexport type AlertTone = NonNullable<VariantProps<typeof alertVariants>[\"tone\"]>;\n\nexport type AlertProps = Omit<React.ComponentProps<\"div\">, \"title\"> & {\n /** The tone: `danger` and `warning` are announced at once (`role=\"alert\"`), `info` and `success` politely. */\n tone?: AlertTone;\n /** A decorative icon (hidden from assistive technology). */\n icon?: React.ReactNode;\n /** The headline, in bold above the text. */\n title?: React.ReactNode;\n /** What to do: a Button, a link. */\n action?: React.ReactNode;\n};\n\nexport function Alert({ tone = \"info\", icon, title, action, className, children, ...props }: AlertProps) {\n const s = alertVariants({ tone });\n return (\n <div role={tone === \"danger\" || tone === \"warning\" ? \"alert\" : \"status\"} data-tone={tone} className={s.root({ className })} {...props}>\n {icon && (\n <span aria-hidden className={s.icon()}>\n {icon}\n </span>\n )}\n <div className={s.content()}>\n {title && <p className={s.title()}>{title}</p>}\n {children && <div className={s.description()}>{children}</div>}\n </div>\n {action && <div className={s.action()}>{action}</div>}\n </div>\n );\n}\n","// The data-driven UI spec: a strict subset of A2UI v0.9 (ADR-082, krizaka/orazaka-packs). A model describes an interface\n// as data — never code — and only with the components of a catalog the client declares. Everything here is a pure\n// function over JSON: parse, validate, apply. Nothing is evaluated, nothing is trusted.\n\n/** The protocol version every message carries. */\nexport const GENUI_VERSION = \"v0.9\";\n\n/** The catalog a surface must name: the Krizaka components, version 1. */\nexport const GENUI_CATALOG_ID = \"krizaka:genui/v1\";\n\n/** The bounds of a surface — what a model may ask for, at most. */\nexport const GENUI_LIMITS = {\n /** Components per surface. */\n components: 300,\n /** Nesting depth from the root. */\n depth: 12,\n /** Characters in one string. */\n string: 4000,\n /** Items in one array of the data model. */\n array: 1000,\n /** Nesting depth of a data model value. */\n dataDepth: 12,\n /** Values (objects, arrays, scalars) in one data model update. */\n dataNodes: 50_000,\n /** Segments of a data path. */\n pathSegments: 16,\n} as const;\n\n/** One component as the model writes it: an id, the catalog name, its properties. */\nexport type GenUiComponent = { readonly id: string; readonly component: string } & Readonly<Record<string, unknown>>;\n\n/** A value bound to the data model: `{ \"path\": \"/rows\" }`. */\nexport type GenUiBinding = { readonly path: string };\n\n/** The four messages of A2UI v0.9. */\nexport type GenUiMessage =\n | { readonly version: typeof GENUI_VERSION; readonly createSurface: { readonly surfaceId: string; readonly catalogId: string } }\n | { readonly version: typeof GENUI_VERSION; readonly updateComponents: { readonly surfaceId: string; readonly components: readonly GenUiComponent[] } }\n | { readonly version: typeof GENUI_VERSION; readonly updateDataModel: { readonly surfaceId: string; readonly path: string; readonly value?: unknown } }\n | { readonly version: typeof GENUI_VERSION; readonly deleteSurface: { readonly surfaceId: string } };\n\n/** What validating a message says. */\nexport type GenUiResult<T> = { readonly ok: true; readonly value: T } | { readonly ok: false; readonly error: string };\n\n/** How a catalog entry checks a component's own properties: `null` when they are fine, else why not. */\nexport type GenUiPropsCheck = (component: GenUiComponent) => string | null;\n\nconst ID = /^[A-Za-z0-9_-]{1,64}$/;\nconst MESSAGE_KEYS = [\"createSurface\", \"updateComponents\", \"updateDataModel\", \"deleteSurface\"] as const;\nconst FORBIDDEN_SEGMENTS = new Set([\"__proto__\", \"prototype\", \"constructor\"]);\n\nconst fail = (error: string): { ok: false; error: string } => ({ ok: false, error });\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) return false;\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n}\n\nfunction onlyKeys(value: Record<string, unknown>, allowed: readonly string[], where: string): string | null {\n for (const key of Object.keys(value)) if (!allowed.includes(key)) return `${where}: unknown key \"${key}\"`;\n return null;\n}\n\n/** An id of a surface or a component, or why not. */\nexport function checkId(value: unknown, where: string): string | null {\n return typeof value === \"string\" && ID.test(value) ? null : `${where}: an id is 1-64 characters of [A-Za-z0-9_-]`;\n}\n\n/** The segments of a JSON pointer (`/a/b/0`), or why it is refused — `__proto__` and friends never pass. */\nexport function parsePath(path: unknown): GenUiResult<readonly string[]> {\n if (typeof path !== \"string\" || (path !== \"/\" && !path.startsWith(\"/\")) || path.length > 512) return fail(\"a path is a JSON pointer: /a/b\");\n if (path === \"/\") return { ok: true, value: [] };\n const segments = path\n .slice(1)\n .split(\"/\")\n .map((s) => s.replace(/~1/g, \"/\").replace(/~0/g, \"~\"));\n if (segments.length > GENUI_LIMITS.pathSegments) return fail(`a path has at most ${GENUI_LIMITS.pathSegments} segments`);\n for (const s of segments) {\n if (s === \"\" || FORBIDDEN_SEGMENTS.has(s)) return fail(`a path may not hold the segment \"${s}\"`);\n }\n return { ok: true, value: segments };\n}\n\n/** `true` when the value is a binding `{ path }` (and only that). */\nexport function isBinding(value: unknown): value is GenUiBinding {\n return isPlainObject(value) && Object.keys(value).length === 1 && typeof value.path === \"string\";\n}\n\n/**\n * A copy of a data model value that is plain JSON within the limits — strings, finite numbers, booleans, null, arrays\n * and plain objects — or why it is refused. The copy has a null prototype for every object: nothing it holds can\n * reach `Object.prototype`.\n */\nexport function sanitizeData(value: unknown): GenUiResult<unknown> {\n let nodes = 0;\n const walk = (v: unknown, depth: number): GenUiResult<unknown> => {\n if (++nodes > GENUI_LIMITS.dataNodes) return fail(`the data holds more than ${GENUI_LIMITS.dataNodes} values`);\n if (depth > GENUI_LIMITS.dataDepth) return fail(`the data nests deeper than ${GENUI_LIMITS.dataDepth}`);\n if (v === null || typeof v === \"boolean\") return { ok: true, value: v };\n if (typeof v === \"number\") return Number.isFinite(v) ? { ok: true, value: v } : fail(\"a number must be finite\");\n if (typeof v === \"string\") return v.length <= GENUI_LIMITS.string ? { ok: true, value: v } : fail(`a string has at most ${GENUI_LIMITS.string} characters`);\n if (Array.isArray(v)) {\n if (v.length > GENUI_LIMITS.array) return fail(`an array has at most ${GENUI_LIMITS.array} items`);\n const out: unknown[] = [];\n for (const item of v) {\n const r = walk(item, depth + 1);\n if (!r.ok) return r;\n out.push(r.value);\n }\n return { ok: true, value: out };\n }\n if (isPlainObject(v)) {\n const out: Record<string, unknown> = Object.create(null);\n for (const [key, item] of Object.entries(v)) {\n if (FORBIDDEN_SEGMENTS.has(key)) return fail(`a key may not be \"${key}\"`);\n const r = walk(item, depth + 1);\n if (!r.ok) return r;\n out[key] = r.value;\n }\n return { ok: true, value: out };\n }\n return fail(\"the data is plain JSON only\");\n };\n return walk(value, 0);\n}\n\n/**\n * A message as the model sent it — parsed and checked against the spec and the catalog, or why it is refused. A\n * component's own properties are checked by its catalog entry; a component the catalog does not hold is refused.\n */\nexport function validateMessage(input: unknown, catalog: Readonly<Record<string, { readonly check: GenUiPropsCheck }>>): GenUiResult<GenUiMessage> {\n if (!isPlainObject(input)) return fail(\"a message is a JSON object\");\n if (input.version !== GENUI_VERSION) return fail(`version must be \"${GENUI_VERSION}\"`);\n const present = MESSAGE_KEYS.filter((k) => k in input);\n if (present.length !== 1) return fail(\"a message holds exactly one of createSurface, updateComponents, updateDataModel, deleteSurface\");\n const kind = present[0];\n const extra = onlyKeys(input, [\"version\", kind], \"message\");\n if (extra) return fail(extra);\n const body = input[kind];\n if (!isPlainObject(body)) return fail(`${kind} is an object`);\n const surface = checkId(body.surfaceId, `${kind}.surfaceId`);\n if (surface) return fail(surface);\n\n switch (kind) {\n case \"createSurface\": {\n const keys = onlyKeys(body, [\"surfaceId\", \"catalogId\", \"theme\", \"sendDataModel\"], kind);\n if (keys) return fail(keys);\n if (body.catalogId !== GENUI_CATALOG_ID) return fail(`catalogId must be \"${GENUI_CATALOG_ID}\"`);\n return { ok: true, value: { version: GENUI_VERSION, createSurface: { surfaceId: body.surfaceId as string, catalogId: GENUI_CATALOG_ID } } };\n }\n case \"updateComponents\": {\n const keys = onlyKeys(body, [\"surfaceId\", \"components\"], kind);\n if (keys) return fail(keys);\n if (!Array.isArray(body.components) || body.components.length > GENUI_LIMITS.components) {\n return fail(`components is an array of at most ${GENUI_LIMITS.components}`);\n }\n const components: GenUiComponent[] = [];\n for (const raw of body.components) {\n if (!isPlainObject(raw)) return fail(\"a component is an object\");\n const id = checkId(raw.id, \"component.id\");\n if (id) return fail(id);\n if (typeof raw.component !== \"string\" || !Object.hasOwn(catalog, raw.component)) {\n return fail(`component \"${String(raw.id)}\": \"${String(raw.component)}\" is not in the catalog`);\n }\n const clean = sanitizeData(raw);\n if (!clean.ok) return fail(`component \"${raw.id}\": ${clean.error}`);\n const component = { ...(clean.value as Record<string, unknown>) } as GenUiComponent;\n const problem = catalog[raw.component].check(component);\n if (problem) return fail(`component \"${raw.id}\" (${raw.component}): ${problem}`);\n components.push(component);\n }\n return { ok: true, value: { version: GENUI_VERSION, updateComponents: { surfaceId: body.surfaceId as string, components } } };\n }\n case \"updateDataModel\": {\n const keys = onlyKeys(body, [\"surfaceId\", \"path\", \"value\"], kind);\n if (keys) return fail(keys);\n const path = body.path === undefined ? \"/\" : body.path;\n const parsed = parsePath(path);\n if (!parsed.ok) return parsed;\n if (!(\"value\" in body)) return { ok: true, value: { version: GENUI_VERSION, updateDataModel: { surfaceId: body.surfaceId as string, path: path as string } } };\n const clean = sanitizeData(body.value);\n if (!clean.ok) return clean;\n return { ok: true, value: { version: GENUI_VERSION, updateDataModel: { surfaceId: body.surfaceId as string, path: path as string, value: clean.value } } };\n }\n default: {\n const keys = onlyKeys(body, [\"surfaceId\"], kind);\n if (keys) return fail(keys);\n return { ok: true, value: { version: GENUI_VERSION, deleteSurface: { surfaceId: body.surfaceId as string } } };\n }\n }\n}\n\n// ── checks the catalog entries share ─────────────────────────────────────────────────────────────────────────────\n\n/** Why the component's keys are refused, or null: only `id`, `component` and the entry's own keys. */\nexport function allowKeys(component: GenUiComponent, keys: readonly string[]): string | null {\n return onlyKeys(component, [\"id\", \"component\", ...keys], \"properties\");\n}\n\n/** A short text (or a binding to one), required or not. */\nexport function checkText(value: unknown, name: string, required: boolean): string | null {\n if (value === undefined) return required ? `${name} is required` : null;\n if (isBinding(value)) return parsePath(value.path).ok ? null : `${name}: a bad path`;\n return typeof value === \"string\" ? null : `${name} is a string`;\n}\n\n/** A value among a closed list. */\nexport function checkEnum(value: unknown, name: string, allowed: readonly string[], required = false): string | null {\n if (value === undefined) return required ? `${name} is required` : null;\n return typeof value === \"string\" && allowed.includes(value) ? null : `${name} is one of ${allowed.join(\", \")}`;\n}\n\n/** A list of child ids. */\nexport function checkChildren(value: unknown, name = \"children\"): string | null {\n if (!Array.isArray(value) || value.length > GENUI_LIMITS.components) return `${name} is an array of component ids`;\n for (const id of value) if (checkId(id, name)) return `${name} holds ids only`;\n return null;\n}\n\n/** A binding to the data model (required). */\nexport function checkBinding(value: unknown, name: string): string | null {\n if (!isBinding(value)) return `${name} is a binding { \"path\": \"/…\" }`;\n return parsePath(value.path).ok ? null : `${name}: a bad path`;\n}\n\n/** A number, or a binding to one. */\nexport function checkNumber(value: unknown, name: string, required: boolean): string | null {\n if (value === undefined) return required ? `${name} is required` : null;\n if (isBinding(value)) return parsePath(value.path).ok ? null : `${name}: a bad path`;\n return typeof value === \"number\" && Number.isFinite(value) ? null : `${name} is a number`;\n}\n\n/** The value formats a model may name. */\nexport const GENUI_FORMATS = [\"number\", \"integer\", \"compact\", \"percent\", \"money\"] as const;\nexport type GenUiFormat = (typeof GENUI_FORMATS)[number];\n\n/** A three-letter currency code. */\nexport function checkCurrency(value: unknown, required: boolean): string | null {\n if (value === undefined) return required ? \"currency is required with the money format\" : null;\n return typeof value === \"string\" && /^[A-Z]{3}$/.test(value) ? null : \"currency is a three-letter code (CAD)\";\n}\n","// The surfaces a stream of A2UI messages builds — pure: `applyMessage` returns a new state, `readStream` turns a growing\n// text (a model's answer as it arrives) into the messages it holds so far. Nothing here renders.\nimport { GENUI_LIMITS, type GenUiComponent, type GenUiMessage, type GenUiPropsCheck, parsePath, validateMessage } from \"./spec\";\n\n/** One surface: its components by id, and its data model. */\nexport type GenUiSurfaceState = {\n readonly id: string;\n readonly components: ReadonlyMap<string, GenUiComponent>;\n readonly data: unknown;\n};\n\n/** Every surface of a stream, and what was refused on the way. */\nexport type GenUiState = {\n readonly surfaces: ReadonlyMap<string, GenUiSurfaceState>;\n /** The order surfaces were created in. */\n readonly order: readonly string[];\n /** Why messages were dropped, in order (a dropped message leaves the rest of the surface as it was). */\n readonly errors: readonly string[];\n};\n\nexport const emptyGenUiState: GenUiState = { surfaces: new Map(), order: [], errors: [] };\n\nconst withError = (state: GenUiState, error: string): GenUiState => ({ ...state, errors: [...state.errors, error] });\n\nfunction setAt(root: unknown, segments: readonly string[], value: unknown, remove: boolean): unknown {\n if (segments.length === 0) return remove ? Object.create(null) : value;\n const [head, ...rest] = segments;\n if (Array.isArray(root)) {\n const index = Number(head);\n if (!Number.isInteger(index) || index < 0 || index > root.length || index >= GENUI_LIMITS.array) return root;\n const copy = [...root];\n if (remove && rest.length === 0) copy.splice(index, 1);\n else copy[index] = setAt(root[index], rest, value, remove);\n return copy;\n }\n const base: Record<string, unknown> = Object.assign(Object.create(null), root !== null && typeof root === \"object\" ? root : {});\n if (remove && rest.length === 0) delete base[head];\n else base[head] = setAt(base[head], rest, value, remove);\n return base;\n}\n\n/** The value at a JSON pointer of the data model, `undefined` when there is none. */\nexport function readPath(data: unknown, path: string): unknown {\n const parsed = parsePath(path);\n if (!parsed.ok) return undefined;\n let cursor: unknown = data;\n for (const segment of parsed.value) {\n if (cursor === null || typeof cursor !== \"object\") return undefined;\n if (!Object.hasOwn(cursor, segment)) return undefined;\n cursor = (cursor as Record<string, unknown>)[segment];\n }\n return cursor;\n}\n\n/** The state after one validated message. */\nexport function applyMessage(state: GenUiState, message: GenUiMessage): GenUiState {\n if (\"createSurface\" in message) {\n const { surfaceId } = message.createSurface;\n if (state.surfaces.has(surfaceId)) return withError(state, `surface \"${surfaceId}\" already exists`);\n const surfaces = new Map(state.surfaces);\n surfaces.set(surfaceId, { id: surfaceId, components: new Map(), data: Object.create(null) });\n return { ...state, surfaces, order: [...state.order, surfaceId] };\n }\n if (\"deleteSurface\" in message) {\n const surfaces = new Map(state.surfaces);\n surfaces.delete(message.deleteSurface.surfaceId);\n return { ...state, surfaces, order: state.order.filter((id) => id !== message.deleteSurface.surfaceId) };\n }\n const surfaceId = \"updateComponents\" in message ? message.updateComponents.surfaceId : message.updateDataModel.surfaceId;\n const surface = state.surfaces.get(surfaceId);\n if (!surface) return withError(state, `surface \"${surfaceId}\" was not created`);\n const surfaces = new Map(state.surfaces);\n if (\"updateComponents\" in message) {\n const components = new Map(surface.components);\n for (const component of message.updateComponents.components) components.set(component.id, component);\n if (components.size > GENUI_LIMITS.components) return withError(state, `surface \"${surfaceId}\" holds more than ${GENUI_LIMITS.components} components`);\n surfaces.set(surfaceId, { ...surface, components });\n } else {\n const { path, value } = message.updateDataModel;\n const parsed = parsePath(path);\n if (!parsed.ok) return withError(state, parsed.error);\n surfaces.set(surfaceId, { ...surface, data: setAt(surface.data, parsed.value, value, !(\"value\" in message.updateDataModel)) });\n }\n return { ...state, surfaces };\n}\n\n/** The first complete JSON object of a line when only stray `}` / `]` follow it, else null. Strings are skipped. */\nexport function leadingObject(text: string): string | null {\n if (!text.startsWith(\"{\")) return null;\n let depth = 0;\n let inString = false;\n for (let i = 0; i < text.length; i++) {\n const c = text[i];\n if (inString) {\n if (c === \"\\\\\") i++;\n else if (c === '\"') inString = false;\n continue;\n }\n if (c === '\"') inString = true;\n else if (c === \"{\" || c === \"[\") depth++;\n else if (c === \"}\" || c === \"]\") {\n depth--;\n if (depth === 0) return /^[\\s}\\]]*$/.test(text.slice(i + 1)) ? text.slice(0, i + 1) : null;\n }\n }\n return null;\n}\n\n/** The state after a line of JSON (one message), the line refused with its reason when it is not valid. */\nexport function applyLine(state: GenUiState, line: string, catalog: Readonly<Record<string, { readonly check: GenUiPropsCheck }>>): GenUiState {\n const text = line.trim();\n if (!text) return state;\n let json: unknown;\n try {\n json = JSON.parse(text);\n } catch {\n // Models sometimes close one brace too many: the first complete object is kept when what follows it is only\n // stray closing brackets. Anything else is not JSON and is refused. (The object is still validated as any other.)\n const head = leadingObject(text);\n if (head === null) return withError(state, \"a line is not JSON\");\n try {\n json = JSON.parse(head);\n } catch {\n return withError(state, \"a line is not JSON\");\n }\n }\n const result = validateMessage(json, catalog);\n return result.ok ? applyMessage(state, result.value) : withError(state, result.error);\n}\n\n/** Where a fenced `a2ui` block sits in a text: its JSON Lines so far, whether it is closed, and the prose around it. */\nexport type GenUiExtract = { readonly lines: readonly string[]; readonly closed: boolean; readonly prose: string; readonly found: boolean };\n\nconst FENCE = /```a2ui[^\\n]*\\n/;\n\n/**\n * Splits a model's answer — complete or still arriving — into its prose and the complete lines of its `a2ui` fence.\n * A line still being written (no newline yet, the fence open) is left for the next call: the surface grows message by\n * message as the answer streams.\n */\nexport function extractGenUi(text: string): GenUiExtract {\n const open = FENCE.exec(text);\n if (!open) return { lines: [], closed: false, prose: text, found: false };\n const start = open.index + open[0].length;\n const end = text.indexOf(\"\\n```\", start - 1);\n const closed = end >= 0;\n const body = closed ? text.slice(start, end) : text.slice(start);\n const parts = body.split(\"\\n\");\n const lines = closed ? parts : parts.slice(0, -1);\n const after = closed ? text.slice(end + 4).replace(/^[^\\n]*\\n?/, \"\") : \"\";\n const prose = [text.slice(0, open.index).trim(), after.trim()].filter(Boolean).join(\"\\n\\n\");\n return { lines: lines.filter((l) => l.trim()), closed, prose, found: true };\n}\n\n/** The state of every surface a model's answer describes so far. */\nexport function readStream(text: string, catalog: Readonly<Record<string, { readonly check: GenUiPropsCheck }>>): GenUiState & { readonly prose: string; readonly found: boolean } {\n const { lines, prose, found } = extractGenUi(text);\n const state = lines.reduce((s, line) => applyLine(s, line, catalog), emptyGenUiState);\n return { ...state, prose, found };\n}\n","// Renders a surface from its root: each component through its catalog entry, children by id, bound values from the data\n// model. A tree only — a component met twice (a cycle, two parents) or beyond the depth is not drawn — and a child still\n// to come (the answer is streaming) is a skeleton. Text is text: React escapes it, nothing is ever parsed as HTML.\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { Skeleton } from \"../skeleton\";\nimport { GENUI_LIMITS, type GenUiComponent, type GenUiPropsCheck, isBinding } from \"./spec\";\nimport { type GenUiState, type GenUiSurfaceState, readPath, readStream } from \"./store\";\n\n/** What an entry gets to draw a component. */\nexport type GenUiRenderContext = {\n /** A child by id: drawn, a skeleton while it has not arrived, nothing when refused. */\n child: (id: unknown) => React.ReactNode;\n /** Children by id, in order. */\n children: (ids: unknown) => React.ReactNode[];\n /** A literal, or the value a binding `{ path }` points at in the data model. */\n resolve: (value: unknown) => unknown;\n /** The words of the surface. */\n labels: GenUiLabels;\n /** The locale numbers and dates are written in. */\n locale: string;\n};\n\n/** One component of a catalog: how its properties are checked, how it is drawn. */\nexport type GenUiEntry = {\n /** `null` when the component's own properties are fine, else why not (the message is refused). */\n readonly check: GenUiPropsCheck;\n /** Draws the component. */\n readonly render: (component: GenUiComponent, context: GenUiRenderContext) => React.ReactNode;\n};\n\n/** The components a model may use, by name: `baseGenUiCatalog`, merged with `chartsGenUiCatalog` of @krizaka/charts. */\nexport type GenUiCatalog = Readonly<Record<string, GenUiEntry>>;\n\n/** The surface's own words (passed translated). */\nexport type GenUiLabels = {\n /** Announced while the surface is still arriving. */\n loading: string;\n /** The accessible name of the surface. */\n surface: string;\n /** Under a table whose data has not arrived or is not a list. */\n noData: string;\n};\n\nexport const genUiLabels: GenUiLabels = { loading: \"Building the view…\", surface: \"Generated view\", noData: \"No data\" };\n\nexport type GenUiSurfaceProps = {\n /** The surface to draw (from `readStream` or `applyMessage`). */\n surface: GenUiSurfaceState;\n /** The components it may use. */\n catalog: GenUiCatalog;\n /** The answer is still arriving: missing children are skeletons and the surface is busy. */\n streaming?: boolean;\n /** The surface's words. */\n labels?: Partial<GenUiLabels>;\n /** The locale numbers are written in. Default `en`. */\n locale?: string;\n /** Called with what could not be drawn (a cycle, a missing child once the answer is complete). */\n onError?: (error: string) => void;\n /** Extra classes on the frame. */\n className?: string;\n};\n\n/** One surface, drawn from its root. */\nexport function GenUiSurface({ surface, catalog, streaming = false, labels, locale = \"en\", onError, className }: GenUiSurfaceProps) {\n const words = { ...genUiLabels, ...labels };\n const problems: string[] = [];\n const seen = new Set<string>();\n\n const draw = (id: unknown, depth: number): React.ReactNode => {\n if (typeof id !== \"string\") return null;\n if (depth > GENUI_LIMITS.depth) {\n problems.push(`\"${id}\" is deeper than ${GENUI_LIMITS.depth}`);\n return null;\n }\n if (seen.has(id)) {\n problems.push(`\"${id}\" is drawn twice (a cycle or two parents)`);\n return null;\n }\n const component = surface.components.get(id);\n if (!component) {\n if (!streaming) problems.push(`\"${id}\" never arrived`);\n return streaming ? <Skeleton key={id} className=\"h-10 w-full rounded-lg\" /> : null;\n }\n const entry = Object.hasOwn(catalog, component.component) ? catalog[component.component] : undefined;\n if (!entry) return null;\n seen.add(id);\n const context: GenUiRenderContext = {\n child: (c) => draw(c, depth + 1),\n children: (ids) => (Array.isArray(ids) ? ids.map((c) => <React.Fragment key={String(c)}>{draw(c, depth + 1)}</React.Fragment>) : []),\n resolve: (value) => (isBinding(value) ? readPath(surface.data, value.path) : value),\n labels: words,\n locale,\n };\n return <React.Fragment key={id}>{entry.render(component, context)}</React.Fragment>;\n };\n\n const root = draw(\"root\", 0);\n React.useEffect(() => {\n if (onError) for (const problem of problems) onError(problem);\n // Reported once per drawn state.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [surface, streaming]);\n\n return (\n <section aria-label={words.surface} aria-busy={streaming || undefined} data-genui-surface={surface.id} className={cn(\"flex flex-col gap-4\", className)}>\n {root ?? (streaming ? <Skeleton className=\"h-24 w-full rounded-xl\" /> : null)}\n </section>\n );\n}\n\nexport type GenUiStreamProps = Omit<GenUiSurfaceProps, \"surface\"> & {\n /** A model's answer, complete or still arriving: its prose and its `a2ui` fence. */\n text: string;\n /** Draws the prose (markdown in a chat); default: paragraphs of text. */\n renderProse?: (prose: string) => React.ReactNode;\n /** What to show when the answer holds no valid surface: the answer itself, as text (the fallback). */\n fallback?: (text: string) => React.ReactNode;\n};\n\n/**\n * A model's answer with its generated view: the prose, then every surface of its `a2ui` fence, growing as the answer\n * streams. An answer without a valid surface falls back to its text.\n */\nexport function GenUiStream({ text, catalog, streaming, renderProse, fallback, onError, ...rest }: GenUiStreamProps) {\n const state = React.useMemo(() => readStream(text, catalog), [text, catalog]);\n const reported = React.useRef(0);\n React.useEffect(() => {\n if (!onError) return;\n for (const error of state.errors.slice(reported.current)) onError(error);\n reported.current = state.errors.length;\n }, [state, onError]);\n const prose = (value: string) => (renderProse ? renderProse(value) : value.split(/\\n{2,}/).map((p, i) => <p key={i}>{p}</p>));\n const surfaces = state.order.map((id) => state.surfaces.get(id)).filter((s): s is GenUiSurfaceState => !!s && s.components.has(\"root\"));\n if (!state.found || (!streaming && surfaces.length === 0)) return <>{fallback ? fallback(text) : prose(text)}</>;\n return (\n <div className=\"flex flex-col gap-4\" data-genui-stream=\"\">\n {state.prose && prose(state.prose)}\n {surfaces.map((surface) => (\n <GenUiSurface key={surface.id} surface={surface} catalog={catalog} streaming={streaming} onError={onError} {...rest} />\n ))}\n {streaming && surfaces.length === 0 && <Skeleton className=\"h-24 w-full rounded-xl\" />}\n </div>\n );\n}\n\n/** The state a list of messages builds — for a surface the app holds itself (not from a model's text). */\nexport type { GenUiState };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,eAAe,aAAa,cAAc,qBAAqB;;;ACAxE,SAAS,UAA6B;AA0C9B,cAIF,YAJE;AAtCD,IAAM,gBAAgB,GAAG;AAAA,EAC9B,OAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,OAAO;AAAA,IACP,aAAa;AAAA,IACb,QAAQ;AAAA,EACV;AAAA,EACA,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,MAAM,EAAE,MAAM,6BAA6B,MAAM,YAAY;AAAA,MAC7D,SAAS,EAAE,MAAM,mCAAmC,MAAM,eAAe;AAAA,MACzE,SAAS,EAAE,MAAM,mCAAmC,MAAM,eAAe;AAAA,MACzE,QAAQ,EAAE,MAAM,iCAAiC,MAAM,cAAc;AAAA,IACvE;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,MAAM,OAAO;AAClC,CAAC;AAeM,SAAS,MAAM,EAAE,OAAO,QAAQ,MAAM,OAAO,QAAQ,WAAW,UAAU,GAAG,MAAM,GAAe;AACvG,QAAM,IAAI,cAAc,EAAE,KAAK,CAAC;AAChC,SACE,qBAAC,SAAI,MAAM,SAAS,YAAY,SAAS,YAAY,UAAU,UAAU,aAAW,MAAM,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,GAAI,GAAG,OAC7H;AAAA,YACC,oBAAC,UAAK,eAAW,MAAC,WAAW,EAAE,KAAK,GACjC,gBACH;AAAA,IAEF,qBAAC,SAAI,WAAW,EAAE,QAAQ,GACvB;AAAA,eAAS,oBAAC,OAAE,WAAW,EAAE,MAAM,GAAI,iBAAM;AAAA,MACzC,YAAY,oBAAC,SAAI,WAAW,EAAE,YAAY,G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,GAAE;AAC7G,SACE,gBAAAD,MAAC,SAAI,WAAU,uBAAsB,qBAAkB,IACpD;AAAA,UAAM,SAAS,MAAM,MAAM,KAAK;AAAA,IAChC,SAAS,IAAI,CAAC,YACb,gBAAAD,KAAC,gBAA8B,SAAkB,SAAkB,WAAsB,SAAmB,GAAG,QAA5F,QAAQ,EAA0F,CACtH;AAAA,IACA,aAAa,SAAS,WAAW,KAAK,gBAAAA,KAAC,YAAS,WAAU,0BAAyB;AAAA,KACtF;AAEJ;","names":["jsx","jsxs","surfaceId","surfaces","text","Fragment","jsx","jsxs","text"]}
1
+ {"version":3,"sources":["../src/genui/catalog.tsx","../src/alert/alert.tsx","../src/card/card.tsx","../src/card/recipe.ts","../src/genui/spec.ts","../src/genui/store.ts","../src/genui/surface.tsx","../src/skeleton/skeleton.tsx"],"sourcesContent":["// The base catalog of `krizaka:genui/v1` (ADR-082): layout, text, card, callout and table — what a model may draw with\n// @krizaka/ui alone. `KpiStat` and `ChartCard` come from @krizaka/charts (`chartsGenUiCatalog`), which depends on this\n// package, never the reverse.\nimport { formatCompact, formatMoney, formatNumber, formatPercent } from \"@krizaka/intl\";\nimport type * as React from \"react\";\n\nimport { Alert } from \"../alert\";\nimport { CardBody, CardRoot, CardTitle } from \"../card\";\nimport { DataTable, type DataTableColumn } from \"../data-table\";\nimport {\n allowKeys,\n checkBinding,\n checkChildren,\n checkCurrency,\n checkEnum,\n checkId,\n checkText,\n GENUI_FORMATS,\n GENUI_LIMITS,\n type GenUiComponent,\n type GenUiFormat,\n} from \"./spec\";\nimport type { GenUiCatalog, GenUiEntry, GenUiRenderContext } from \"./surface\";\n\nconst first = (...problems: (string | null)[]) => problems.find((p) => p !== null) ?? null;\n\n/** A resolved value as text — strings and numbers only; anything else is not drawn. */\nfunction asText(value: unknown): string {\n if (typeof value === \"string\") return value.slice(0, GENUI_LIMITS.string);\n if (typeof value === \"number\" && Number.isFinite(value)) return String(value);\n return \"\";\n}\n\n/** A number written in one of the closed formats. */\nexport function formatGenUiValue(value: unknown, format: GenUiFormat | undefined, locale: string, currency?: string): string {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return asText(value);\n switch (format) {\n case \"integer\":\n return formatNumber(Math.round(value), { locale, maximumFractionDigits: 0 });\n case \"compact\":\n return formatCompact(value, { locale });\n case \"percent\":\n return formatPercent(value, { locale, maximumFractionDigits: 1 });\n case \"money\":\n return currency ? formatMoney(Math.round(value), { currency, locale }) : formatNumber(value, { locale });\n default:\n return formatNumber(value, { locale, maximumFractionDigits: 2 });\n }\n}\n\nconst TONES = [\"info\", \"success\", \"warning\", \"danger\"] as const;\nconst VARIANTS = [\"body\", \"heading\", \"caption\"] as const;\n\nconst column: GenUiEntry = {\n check: (c) => first(allowKeys(c, [\"children\"]), checkChildren(c.children)),\n render: (c, ctx) => <div className=\"flex min-w-0 flex-col gap-4\">{ctx.children(c.children)}</div>,\n};\n\nconst row: GenUiEntry = {\n check: (c) => first(allowKeys(c, [\"children\"]), checkChildren(c.children)),\n render: (c, ctx) => <div className=\"grid min-w-0 gap-4 [grid-template-columns:repeat(auto-fit,minmax(12rem,1fr))]\">{ctx.children(c.children)}</div>,\n};\n\nconst text: GenUiEntry = {\n check: (c) => first(allowKeys(c, [\"text\", \"variant\"]), checkText(c.text, \"text\", true), checkEnum(c.variant, \"variant\", VARIANTS)),\n render: (c, ctx) => {\n const value = asText(ctx.resolve(c.text));\n if (c.variant === \"heading\") return <h3 className=\"text-base font-semibold text-fg\">{value}</h3>;\n if (c.variant === \"caption\") return <p className=\"text-xs text-fg-muted\">{value}</p>;\n return <p className=\"text-sm text-fg\">{value}</p>;\n },\n};\n\nconst card: GenUiEntry = {\n check: (c) => first(allowKeys(c, [\"title\", \"child\"]), checkText(c.title, \"title\", false), c.child === undefined ? null : checkId(c.child, \"child\")),\n render: (c, ctx) => (\n <CardRoot>\n <CardBody>\n {c.title !== undefined && <CardTitle>{asText(ctx.resolve(c.title))}</CardTitle>}\n {c.child !== undefined && <div className=\"mt-3\">{ctx.child(c.child)}</div>}\n </CardBody>\n </CardRoot>\n ),\n};\n\nconst callout: GenUiEntry = {\n check: (c) => first(allowKeys(c, [\"tone\", \"title\", \"text\"]), checkEnum(c.tone, \"tone\", TONES), checkText(c.title, \"title\", false), checkText(c.text, \"text\", false)),\n render: (c, ctx) => (\n <Alert tone={(c.tone as (typeof TONES)[number] | undefined) ?? \"info\"} title={c.title === undefined ? undefined : asText(ctx.resolve(c.title))}>\n {c.text === undefined ? undefined : asText(ctx.resolve(c.text))}\n </Alert>\n ),\n};\n\ntype Column = { key: string; label: string; format?: GenUiFormat; currency?: string };\n\nfunction checkColumns(value: unknown): string | null {\n if (!Array.isArray(value) || value.length === 0 || value.length > 12) return \"columns is an array of 1 to 12\";\n for (const raw of value) {\n if (raw === null || typeof raw !== \"object\" || Array.isArray(raw)) return \"a column is an object\";\n const col = raw as Record<string, unknown>;\n const keys = Object.keys(col).find((k) => ![\"key\", \"label\", \"format\", \"currency\"].includes(k));\n if (keys) return `a column has no key \"${keys}\"`;\n if (typeof col.key !== \"string\" || !/^[A-Za-z0-9_]{1,64}$/.test(col.key)) return \"a column key is 1-64 characters of [A-Za-z0-9_]\";\n if (typeof col.label !== \"string\" || col.label.length > 120) return \"a column label is a string\";\n const problem = first(checkEnum(col.format, \"format\", GENUI_FORMATS), checkCurrency(col.currency, col.format === \"money\"));\n if (problem) return problem;\n }\n return null;\n}\n\ntype Row = Record<string, unknown> & { __genuiRow: string };\n\nfunction TableView({ c, ctx }: { c: GenUiComponent; ctx: GenUiRenderContext }) {\n const columns = c.columns as readonly Column[];\n const raw = ctx.resolve(c.rows);\n const rows: Row[] = Array.isArray(raw)\n ? raw.slice(0, GENUI_LIMITS.array).flatMap((r, i) => (r !== null && typeof r === \"object\" && !Array.isArray(r) ? [{ ...(r as Record<string, unknown>), __genuiRow: String(i) }] : []))\n : [];\n const cols: DataTableColumn<Row>[] = columns.map((col) => ({\n id: col.key,\n header: col.label,\n sortable: true,\n type: col.format ? \"number\" : \"text\",\n value: (r) => {\n const v = r[col.key];\n return typeof v === \"number\" || typeof v === \"string\" ? v : null;\n },\n cell: (r) => formatGenUiValue(r[col.key], col.format, ctx.locale, col.currency),\n }));\n if (rows.length === 0) return <p className=\"text-sm text-fg-muted\">{ctx.labels.noData}</p>;\n return <DataTable rows={rows} columns={cols} getRowId={(r) => r.__genuiRow} caption={c.caption === undefined ? ctx.labels.surface : asText(ctx.resolve(c.caption))} showCaption={c.caption !== undefined} />;\n}\n\nconst table: GenUiEntry = {\n check: (c) => first(allowKeys(c, [\"caption\", \"columns\", \"rows\"]), checkText(c.caption, \"caption\", false), checkColumns(c.columns), checkBinding(c.rows, \"rows\")),\n render: (c, ctx): React.ReactNode => <TableView c={c} ctx={ctx} />,\n};\n\n/** `Column`, `Row`, `Text`, `Card`, `Callout`, `Table` — the catalog @krizaka/ui draws on its own. */\nexport const baseGenUiCatalog: GenUiCatalog = { Column: column, Row: row, Text: text, Card: card, Callout: callout, Table: table };\n","// Server-safe. A message in the flow of the page (not a toast): a tone, an icon, a title, a text, an action.\n// danger and warning are announced at once (role=\"alert\"); info and success politely (role=\"status\").\nimport type * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\n// Soft tones (a tint, a tinted border, a coloured icon): the text stays a text role — the invariant status tokens are\n// too light for small text on a light surface (WCAG AA).\nexport const alertVariants = tv({\n slots: {\n root: \"relative flex w-full items-start gap-3 rounded-xl border p-4 text-sm text-fg\",\n icon: \"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center [&>svg]:h-5 [&>svg]:w-5\",\n content: \"flex min-w-0 flex-1 flex-col gap-1\",\n title: \"font-semibold text-fg\",\n description: \"text-fg-secondary\",\n action: \"flex shrink-0 items-center gap-2 self-center\",\n },\n variants: {\n tone: {\n info: { root: \"border-info/40 bg-info/10\", icon: \"text-info\" },\n success: { root: \"border-success/40 bg-success/10\", icon: \"text-success\" },\n warning: { root: \"border-warning/50 bg-warning/10\", icon: \"text-warning\" },\n danger: { root: \"border-danger/50 bg-danger/10\", icon: \"text-danger\" },\n },\n },\n defaultVariants: { tone: \"info\" },\n});\n\nexport type AlertTone = NonNullable<VariantProps<typeof alertVariants>[\"tone\"]>;\n\nexport type AlertProps = Omit<React.ComponentProps<\"div\">, \"title\"> & {\n /** The tone: `danger` and `warning` are announced at once (`role=\"alert\"`), `info` and `success` politely. */\n tone?: AlertTone;\n /** A decorative icon (hidden from assistive technology). */\n icon?: React.ReactNode;\n /** The headline, in bold above the text. */\n title?: React.ReactNode;\n /** What to do: a Button, a link. */\n action?: React.ReactNode;\n};\n\nexport function Alert({ tone = \"info\", icon, title, action, className, children, ...props }: AlertProps) {\n const s = alertVariants({ tone });\n return (\n <div role={tone === \"danger\" || tone === \"warning\" ? \"alert\" : \"status\"} data-tone={tone} className={s.root({ className })} {...props}>\n {icon && (\n <span aria-hidden className={s.icon()}>\n {icon}\n </span>\n )}\n <div className={s.content()}>\n {title && <p className={s.title()}>{title}</p>}\n {children && <div className={s.description()}>{children}</div>}\n </div>\n {action && <div className={s.action()}>{action}</div>}\n </div>\n );\n}\n","// Server-safe: no hook, no context. One `tv` definition with slots: each part takes its slot, and a product overrides\n// any part through `className` (merged last by tailwind-merge).\nimport { Slot } from \"radix-ui\";\nimport type * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\nimport { cn } from \"../cn\";\nimport { cardRecipe } from \"./recipe\";\n\nexport const card = tv(cardRecipe);\n\ntype CardVariants = VariantProps<typeof card>;\n/** The parts without a variant read the default slots: no context, so server-safe. */\nconst slots = card();\n\nexport type CardRootProps = React.ComponentProps<\"div\"> &\n Pick<CardVariants, \"radius\" | \"tone\" | \"interactive\"> & {\n /**\n * md · lg · xl.\n * @default \"xl\"\n */\n radius?: CardVariants[\"radius\"];\n /**\n * default (the base surface) · elevated (raised, a shadow) · glass (translucent, blurred).\n * @default \"default\"\n */\n tone?: CardVariants[\"tone\"];\n /** The quiet hover — the hairline and the surface one step up, nothing moves (krizaka-ui#393): for a card that is a link. */\n interactive?: CardVariants[\"interactive\"];\n /** Renders the child (a link, an article) instead of the <div>, with props, classes and ref merged. */\n asChild?: boolean;\n /** Enters on scroll (MotionObserver): the index in the grid becomes the delay (50 ms a step, 8 steps at most). */\n reveal?: number;\n };\n\nexport function CardRoot({ asChild, reveal, radius, tone, interactive, className, style, ...props }: CardRootProps) {\n const Comp = asChild ? Slot.Root : \"div\";\n const revealStyle =\n reveal === undefined ? style : ({ ...style, \"--kz-delay\": `${Math.min(Math.max(reveal, 0), 8) * 50}ms` } as React.CSSProperties);\n return (\n <Comp\n data-reveal={reveal === undefined ? undefined : \"\"}\n data-interactive={interactive ? \"\" : undefined}\n style={revealStyle}\n className={card({ radius, tone, interactive }).root({ className })}\n {...props}\n />\n );\n}\n\nconst ASPECT = { video: \"aspect-video\", square: \"aspect-square\", portrait: \"aspect-[3/4]\", auto: \"\" } as const;\nexport type CardMediaProps = React.ComponentProps<\"div\"> & {\n /** The ratio of the media: video (16:9) · square · portrait (3:4) · auto (the content's). */\n aspect?: keyof typeof ASPECT;\n};\n\nexport function CardMedia({ aspect = \"video\", className, ...props }: CardMediaProps) {\n return <div data-aspect={aspect} className={slots.media({ className: cn(ASPECT[aspect], className) })} {...props} />;\n}\n\nexport type CardImageProps = Omit<React.ComponentProps<\"img\">, \"src\"> & {\n /** The image's URL; `null` or nothing shows the `fallback`. */\n src?: string | null;\n /** Shown when there is no image: an icon, an illustration (decorative). */\n fallback?: React.ReactNode;\n /**\n * When the browser loads it: `lazy` (default, a card in a list or below the fold) or `eager` for the first cards\n * of a page — the image that is the largest contentful paint must not wait (add `fetchPriority=\"high\"`).\n * @default \"lazy\"\n */\n loading?: \"lazy\" | \"eager\";\n};\n\n/** The image of a media, or its `fallback` when there is none. `alt` is empty by default: the title names the card. */\nexport function CardImage({ src, alt = \"\", fallback, loading = \"lazy\", className, ...props }: CardImageProps) {\n if (!src) {\n return (\n <div data-fallback=\"\" aria-hidden className={slots.fallback({ className })}>\n {fallback}\n </div>\n );\n }\n return <img src={src} alt={alt} loading={loading} decoding=\"async\" className={slots.image({ className })} {...props} />;\n}\n\nconst CORNER = {\n \"top-left\": \"left-2.5 top-2.5\",\n \"top-right\": \"right-2.5 top-2.5\",\n \"bottom-left\": \"bottom-2.5 left-2.5\",\n \"bottom-right\": \"bottom-2.5 right-2.5\",\n} as const;\nexport type CardOverlayProps = React.ComponentProps<\"div\"> & {\n /** The corner of the media it sits in. */\n corner?: keyof typeof CORNER;\n};\n\n/** What sits on the media (badges, a caption). `scrim` and `fg-on-media` are invariant: nothing to do for light. */\nexport function CardOverlay({ corner = \"top-left\", className, ...props }: CardOverlayProps) {\n return <div data-corner={corner} className={slots.overlay({ className: cn(CORNER[corner], className) })} {...props} />;\n}\n\nexport type CardBodyProps = React.ComponentProps<\"div\"> & {\n /**\n * none · sm · md · lg.\n * @default \"md\"\n */\n padding?: CardVariants[\"padding\"];\n};\n\nexport function CardBody({ padding, className, ...props }: CardBodyProps) {\n return <div className={card({ padding }).body({ className })} {...props} />;\n}\n\nexport type CardTitleProps = React.ComponentProps<\"h3\"> & {\n /** The heading level, to fit the page's outline. */\n as?: \"h2\" | \"h3\" | \"h4\";\n};\n\nexport function CardTitle({ as: Tag = \"h3\", className, ...props }: CardTitleProps) {\n return <Tag className={slots.title({ className })} {...props} />;\n}\n\nexport function CardDescription({ className, ...props }: React.ComponentProps<\"p\">) {\n return <p className={slots.description({ className })} {...props} />;\n}\n\nexport type CardStatProps = React.ComponentProps<\"div\"> & {\n /** What the figure is, in small capitals above it (the figure is the children). */\n label: React.ReactNode;\n};\n\n/** A figure put forward: the label in capitals, the value in tabular digits. */\nexport function CardStat({ label, className, children, ...props }: CardStatProps) {\n return (\n <div className={slots.stat({ className })} {...props}>\n <p className={slots.statLabel()}>{label}</p>\n <p className={slots.statValue()}>{children}</p>\n </div>\n );\n}\n\nexport function CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div className={slots.footer({ className })} {...props} />;\n}\n\n/** `Card.Root/Media/Image/Overlay/Body/Title/Description/Stat/Footer`. */\nexport const Card = {\n Root: CardRoot,\n Media: CardMedia,\n Image: CardImage,\n Overlay: CardOverlay,\n Body: CardBody,\n Title: CardTitle,\n Description: CardDescription,\n Stat: CardStat,\n Footer: CardFooter,\n};\n","// The card's parts, radii, tones and paddings, written once as classes of the Krizaka tokens: the web wears them with\n// `tv(cardRecipe)`, React Native reads the same classes into styles (native/card.tsx): a part of the card that exists only\n// on the web (the hover's tint) is simply ignored there.\nimport { defineRecipe } from \"../recipes/define\";\n\nexport const cardRecipe = defineRecipe({\n slots: {\n root:\n \"group relative flex flex-col overflow-hidden border border-border-default bg-surface-1 text-fg transition-colors \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n media: \"relative overflow-hidden bg-media\",\n image: \"h-full w-full object-cover\",\n fallback: \"flex h-full w-full items-center justify-center bg-linear-to-br from-accent/15 via-media to-accent-2/15 text-accent/60\",\n overlay: \"absolute z-10 flex items-center gap-1.5\",\n body: \"relative flex flex-1 flex-col gap-3\",\n title: \"line-clamp-1 text-sm font-semibold text-fg transition-colors group-hover:text-fg-accent\",\n description: \"line-clamp-2 text-xs text-fg-secondary\",\n stat: \"min-w-0\",\n statLabel: \"font-mono text-[11.5px] text-fg-secondary\",\n statValue: \"font-display text-xl font-black tabular-nums text-fg\",\n footer: \"relative mt-auto flex items-center gap-2 border-t border-border-subtle pt-3 text-xs text-fg-secondary\",\n },\n variants: {\n radius: { md: { root: \"rounded-md\" }, lg: { root: \"rounded-lg\" }, xl: { root: \"rounded-xl\" } },\n tone: { default: {}, elevated: { root: \"bg-surface-2 shadow-md\" }, glass: { root: \"bg-glass border-glass-border\" } },\n interactive: { true: { root: \"duration-150 hover:border-border-strong hover:bg-surface-2\" } },\n padding: { none: { body: \"p-0\" }, sm: { body: \"p-3\" }, md: { body: \"p-4\" }, lg: { body: \"p-6\" } },\n },\n defaultVariants: { radius: \"xl\", tone: \"default\", padding: \"md\" },\n});\n","// The data-driven UI spec: a strict subset of A2UI v0.9 (ADR-082, krizaka/orazaka-packs). A model describes an interface\n// as data — never code — and only with the components of a catalog the client declares. Everything here is a pure\n// function over JSON: parse, validate, apply. Nothing is evaluated, nothing is trusted.\n\n/** The protocol version every message carries. */\nexport const GENUI_VERSION = \"v0.9\";\n\n/** The catalog a surface must name: the Krizaka components, version 1. */\nexport const GENUI_CATALOG_ID = \"krizaka:genui/v1\";\n\n/** The bounds of a surface — what a model may ask for, at most. */\nexport const GENUI_LIMITS = {\n /** Components per surface. */\n components: 300,\n /** Nesting depth from the root. */\n depth: 12,\n /** Characters in one string. */\n string: 4000,\n /** Items in one array of the data model. */\n array: 1000,\n /** Nesting depth of a data model value. */\n dataDepth: 12,\n /** Values (objects, arrays, scalars) in one data model update. */\n dataNodes: 50_000,\n /** Segments of a data path. */\n pathSegments: 16,\n} as const;\n\n/** One component as the model writes it: an id, the catalog name, its properties. */\nexport type GenUiComponent = { readonly id: string; readonly component: string } & Readonly<Record<string, unknown>>;\n\n/** A value bound to the data model: `{ \"path\": \"/rows\" }`. */\nexport type GenUiBinding = { readonly path: string };\n\n/** The four messages of A2UI v0.9. */\nexport type GenUiMessage =\n | { readonly version: typeof GENUI_VERSION; readonly createSurface: { readonly surfaceId: string; readonly catalogId: string } }\n | { readonly version: typeof GENUI_VERSION; readonly updateComponents: { readonly surfaceId: string; readonly components: readonly GenUiComponent[] } }\n | { readonly version: typeof GENUI_VERSION; readonly updateDataModel: { readonly surfaceId: string; readonly path: string; readonly value?: unknown } }\n | { readonly version: typeof GENUI_VERSION; readonly deleteSurface: { readonly surfaceId: string } };\n\n/** What validating a message says. */\nexport type GenUiResult<T> = { readonly ok: true; readonly value: T } | { readonly ok: false; readonly error: string };\n\n/** How a catalog entry checks a component's own properties: `null` when they are fine, else why not. */\nexport type GenUiPropsCheck = (component: GenUiComponent) => string | null;\n\nconst ID = /^[A-Za-z0-9_-]{1,64}$/;\nconst MESSAGE_KEYS = [\"createSurface\", \"updateComponents\", \"updateDataModel\", \"deleteSurface\"] as const;\nconst FORBIDDEN_SEGMENTS = new Set([\"__proto__\", \"prototype\", \"constructor\"]);\n\nconst fail = (error: string): { ok: false; error: string } => ({ ok: false, error });\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) return false;\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n}\n\nfunction onlyKeys(value: Record<string, unknown>, allowed: readonly string[], where: string): string | null {\n for (const key of Object.keys(value)) if (!allowed.includes(key)) return `${where}: unknown key \"${key}\"`;\n return null;\n}\n\n/** An id of a surface or a component, or why not. */\nexport function checkId(value: unknown, where: string): string | null {\n return typeof value === \"string\" && ID.test(value) ? null : `${where}: an id is 1-64 characters of [A-Za-z0-9_-]`;\n}\n\n/** The segments of a JSON pointer (`/a/b/0`), or why it is refused — `__proto__` and friends never pass. */\nexport function parsePath(path: unknown): GenUiResult<readonly string[]> {\n if (typeof path !== \"string\" || (path !== \"/\" && !path.startsWith(\"/\")) || path.length > 512) return fail(\"a path is a JSON pointer: /a/b\");\n if (path === \"/\") return { ok: true, value: [] };\n const segments = path\n .slice(1)\n .split(\"/\")\n .map((s) => s.replace(/~1/g, \"/\").replace(/~0/g, \"~\"));\n if (segments.length > GENUI_LIMITS.pathSegments) return fail(`a path has at most ${GENUI_LIMITS.pathSegments} segments`);\n for (const s of segments) {\n if (s === \"\" || FORBIDDEN_SEGMENTS.has(s)) return fail(`a path may not hold the segment \"${s}\"`);\n }\n return { ok: true, value: segments };\n}\n\n/** `true` when the value is a binding `{ path }` (and only that). */\nexport function isBinding(value: unknown): value is GenUiBinding {\n return isPlainObject(value) && Object.keys(value).length === 1 && typeof value.path === \"string\";\n}\n\n/**\n * A copy of a data model value that is plain JSON within the limits — strings, finite numbers, booleans, null, arrays\n * and plain objects — or why it is refused. The copy has a null prototype for every object: nothing it holds can\n * reach `Object.prototype`.\n */\nexport function sanitizeData(value: unknown): GenUiResult<unknown> {\n let nodes = 0;\n const walk = (v: unknown, depth: number): GenUiResult<unknown> => {\n if (++nodes > GENUI_LIMITS.dataNodes) return fail(`the data holds more than ${GENUI_LIMITS.dataNodes} values`);\n if (depth > GENUI_LIMITS.dataDepth) return fail(`the data nests deeper than ${GENUI_LIMITS.dataDepth}`);\n if (v === null || typeof v === \"boolean\") return { ok: true, value: v };\n if (typeof v === \"number\") return Number.isFinite(v) ? { ok: true, value: v } : fail(\"a number must be finite\");\n if (typeof v === \"string\") return v.length <= GENUI_LIMITS.string ? { ok: true, value: v } : fail(`a string has at most ${GENUI_LIMITS.string} characters`);\n if (Array.isArray(v)) {\n if (v.length > GENUI_LIMITS.array) return fail(`an array has at most ${GENUI_LIMITS.array} items`);\n const out: unknown[] = [];\n for (const item of v) {\n const r = walk(item, depth + 1);\n if (!r.ok) return r;\n out.push(r.value);\n }\n return { ok: true, value: out };\n }\n if (isPlainObject(v)) {\n const out: Record<string, unknown> = Object.create(null);\n for (const [key, item] of Object.entries(v)) {\n if (FORBIDDEN_SEGMENTS.has(key)) return fail(`a key may not be \"${key}\"`);\n const r = walk(item, depth + 1);\n if (!r.ok) return r;\n out[key] = r.value;\n }\n return { ok: true, value: out };\n }\n return fail(\"the data is plain JSON only\");\n };\n return walk(value, 0);\n}\n\n/**\n * A message as the model sent it — parsed and checked against the spec and the catalog, or why it is refused. A\n * component's own properties are checked by its catalog entry; a component the catalog does not hold is refused.\n */\nexport function validateMessage(input: unknown, catalog: Readonly<Record<string, { readonly check: GenUiPropsCheck }>>): GenUiResult<GenUiMessage> {\n if (!isPlainObject(input)) return fail(\"a message is a JSON object\");\n if (input.version !== GENUI_VERSION) return fail(`version must be \"${GENUI_VERSION}\"`);\n const present = MESSAGE_KEYS.filter((k) => k in input);\n if (present.length !== 1) return fail(\"a message holds exactly one of createSurface, updateComponents, updateDataModel, deleteSurface\");\n const kind = present[0];\n const extra = onlyKeys(input, [\"version\", kind], \"message\");\n if (extra) return fail(extra);\n const body = input[kind];\n if (!isPlainObject(body)) return fail(`${kind} is an object`);\n const surface = checkId(body.surfaceId, `${kind}.surfaceId`);\n if (surface) return fail(surface);\n\n switch (kind) {\n case \"createSurface\": {\n const keys = onlyKeys(body, [\"surfaceId\", \"catalogId\", \"theme\", \"sendDataModel\"], kind);\n if (keys) return fail(keys);\n if (body.catalogId !== GENUI_CATALOG_ID) return fail(`catalogId must be \"${GENUI_CATALOG_ID}\"`);\n return { ok: true, value: { version: GENUI_VERSION, createSurface: { surfaceId: body.surfaceId as string, catalogId: GENUI_CATALOG_ID } } };\n }\n case \"updateComponents\": {\n const keys = onlyKeys(body, [\"surfaceId\", \"components\"], kind);\n if (keys) return fail(keys);\n if (!Array.isArray(body.components) || body.components.length > GENUI_LIMITS.components) {\n return fail(`components is an array of at most ${GENUI_LIMITS.components}`);\n }\n const components: GenUiComponent[] = [];\n for (const raw of body.components) {\n if (!isPlainObject(raw)) return fail(\"a component is an object\");\n const id = checkId(raw.id, \"component.id\");\n if (id) return fail(id);\n if (typeof raw.component !== \"string\" || !Object.hasOwn(catalog, raw.component)) {\n return fail(`component \"${String(raw.id)}\": \"${String(raw.component)}\" is not in the catalog`);\n }\n const clean = sanitizeData(raw);\n if (!clean.ok) return fail(`component \"${raw.id}\": ${clean.error}`);\n const component = { ...(clean.value as Record<string, unknown>) } as GenUiComponent;\n const problem = catalog[raw.component].check(component);\n if (problem) return fail(`component \"${raw.id}\" (${raw.component}): ${problem}`);\n components.push(component);\n }\n return { ok: true, value: { version: GENUI_VERSION, updateComponents: { surfaceId: body.surfaceId as string, components } } };\n }\n case \"updateDataModel\": {\n const keys = onlyKeys(body, [\"surfaceId\", \"path\", \"value\"], kind);\n if (keys) return fail(keys);\n const path = body.path === undefined ? \"/\" : body.path;\n const parsed = parsePath(path);\n if (!parsed.ok) return parsed;\n if (!(\"value\" in body)) return { ok: true, value: { version: GENUI_VERSION, updateDataModel: { surfaceId: body.surfaceId as string, path: path as string } } };\n const clean = sanitizeData(body.value);\n if (!clean.ok) return clean;\n return { ok: true, value: { version: GENUI_VERSION, updateDataModel: { surfaceId: body.surfaceId as string, path: path as string, value: clean.value } } };\n }\n default: {\n const keys = onlyKeys(body, [\"surfaceId\"], kind);\n if (keys) return fail(keys);\n return { ok: true, value: { version: GENUI_VERSION, deleteSurface: { surfaceId: body.surfaceId as string } } };\n }\n }\n}\n\n// ── checks the catalog entries share ─────────────────────────────────────────────────────────────────────────────\n\n/** Why the component's keys are refused, or null: only `id`, `component` and the entry's own keys. */\nexport function allowKeys(component: GenUiComponent, keys: readonly string[]): string | null {\n return onlyKeys(component, [\"id\", \"component\", ...keys], \"properties\");\n}\n\n/** A short text (or a binding to one), required or not. */\nexport function checkText(value: unknown, name: string, required: boolean): string | null {\n if (value === undefined) return required ? `${name} is required` : null;\n if (isBinding(value)) return parsePath(value.path).ok ? null : `${name}: a bad path`;\n return typeof value === \"string\" ? null : `${name} is a string`;\n}\n\n/** A value among a closed list. */\nexport function checkEnum(value: unknown, name: string, allowed: readonly string[], required = false): string | null {\n if (value === undefined) return required ? `${name} is required` : null;\n return typeof value === \"string\" && allowed.includes(value) ? null : `${name} is one of ${allowed.join(\", \")}`;\n}\n\n/** A list of child ids. */\nexport function checkChildren(value: unknown, name = \"children\"): string | null {\n if (!Array.isArray(value) || value.length > GENUI_LIMITS.components) return `${name} is an array of component ids`;\n for (const id of value) if (checkId(id, name)) return `${name} holds ids only`;\n return null;\n}\n\n/** A binding to the data model (required). */\nexport function checkBinding(value: unknown, name: string): string | null {\n if (!isBinding(value)) return `${name} is a binding { \"path\": \"/…\" }`;\n return parsePath(value.path).ok ? null : `${name}: a bad path`;\n}\n\n/** A number, or a binding to one. */\nexport function checkNumber(value: unknown, name: string, required: boolean): string | null {\n if (value === undefined) return required ? `${name} is required` : null;\n if (isBinding(value)) return parsePath(value.path).ok ? null : `${name}: a bad path`;\n return typeof value === \"number\" && Number.isFinite(value) ? null : `${name} is a number`;\n}\n\n/** The value formats a model may name. */\nexport const GENUI_FORMATS = [\"number\", \"integer\", \"compact\", \"percent\", \"money\"] as const;\nexport type GenUiFormat = (typeof GENUI_FORMATS)[number];\n\n/** A three-letter currency code. */\nexport function checkCurrency(value: unknown, required: boolean): string | null {\n if (value === undefined) return required ? \"currency is required with the money format\" : null;\n return typeof value === \"string\" && /^[A-Z]{3}$/.test(value) ? null : \"currency is a three-letter code (CAD)\";\n}\n","// The surfaces a stream of A2UI messages builds — pure: `applyMessage` returns a new state, `readStream` turns a growing\n// text (a model's answer as it arrives) into the messages it holds so far. Nothing here renders.\nimport { GENUI_LIMITS, type GenUiComponent, type GenUiMessage, type GenUiPropsCheck, parsePath, validateMessage } from \"./spec\";\n\n/** One surface: its components by id, and its data model. */\nexport type GenUiSurfaceState = {\n readonly id: string;\n readonly components: ReadonlyMap<string, GenUiComponent>;\n readonly data: unknown;\n};\n\n/** Every surface of a stream, and what was refused on the way. */\nexport type GenUiState = {\n readonly surfaces: ReadonlyMap<string, GenUiSurfaceState>;\n /** The order surfaces were created in. */\n readonly order: readonly string[];\n /** Why messages were dropped, in order (a dropped message leaves the rest of the surface as it was). */\n readonly errors: readonly string[];\n};\n\nexport const emptyGenUiState: GenUiState = { surfaces: new Map(), order: [], errors: [] };\n\nconst withError = (state: GenUiState, error: string): GenUiState => ({ ...state, errors: [...state.errors, error] });\n\nfunction setAt(root: unknown, segments: readonly string[], value: unknown, remove: boolean): unknown {\n if (segments.length === 0) return remove ? Object.create(null) : value;\n const [head, ...rest] = segments;\n if (Array.isArray(root)) {\n const index = Number(head);\n if (!Number.isInteger(index) || index < 0 || index > root.length || index >= GENUI_LIMITS.array) return root;\n const copy = [...root];\n if (remove && rest.length === 0) copy.splice(index, 1);\n else copy[index] = setAt(root[index], rest, value, remove);\n return copy;\n }\n const base: Record<string, unknown> = Object.assign(Object.create(null), root !== null && typeof root === \"object\" ? root : {});\n if (remove && rest.length === 0) delete base[head];\n else base[head] = setAt(base[head], rest, value, remove);\n return base;\n}\n\n/** The value at a JSON pointer of the data model, `undefined` when there is none. */\nexport function readPath(data: unknown, path: string): unknown {\n const parsed = parsePath(path);\n if (!parsed.ok) return undefined;\n let cursor: unknown = data;\n for (const segment of parsed.value) {\n if (cursor === null || typeof cursor !== \"object\") return undefined;\n if (!Object.hasOwn(cursor, segment)) return undefined;\n cursor = (cursor as Record<string, unknown>)[segment];\n }\n return cursor;\n}\n\n/** The state after one validated message. */\nexport function applyMessage(state: GenUiState, message: GenUiMessage): GenUiState {\n if (\"createSurface\" in message) {\n const { surfaceId } = message.createSurface;\n if (state.surfaces.has(surfaceId)) return withError(state, `surface \"${surfaceId}\" already exists`);\n const surfaces = new Map(state.surfaces);\n surfaces.set(surfaceId, { id: surfaceId, components: new Map(), data: Object.create(null) });\n return { ...state, surfaces, order: [...state.order, surfaceId] };\n }\n if (\"deleteSurface\" in message) {\n const surfaces = new Map(state.surfaces);\n surfaces.delete(message.deleteSurface.surfaceId);\n return { ...state, surfaces, order: state.order.filter((id) => id !== message.deleteSurface.surfaceId) };\n }\n const surfaceId = \"updateComponents\" in message ? message.updateComponents.surfaceId : message.updateDataModel.surfaceId;\n const surface = state.surfaces.get(surfaceId);\n if (!surface) return withError(state, `surface \"${surfaceId}\" was not created`);\n const surfaces = new Map(state.surfaces);\n if (\"updateComponents\" in message) {\n const components = new Map(surface.components);\n for (const component of message.updateComponents.components) components.set(component.id, component);\n if (components.size > GENUI_LIMITS.components) return withError(state, `surface \"${surfaceId}\" holds more than ${GENUI_LIMITS.components} components`);\n surfaces.set(surfaceId, { ...surface, components });\n } else {\n const { path, value } = message.updateDataModel;\n const parsed = parsePath(path);\n if (!parsed.ok) return withError(state, parsed.error);\n surfaces.set(surfaceId, { ...surface, data: setAt(surface.data, parsed.value, value, !(\"value\" in message.updateDataModel)) });\n }\n return { ...state, surfaces };\n}\n\n/** The first complete JSON object of a line when only stray `}` / `]` follow it, else null. Strings are skipped. */\nexport function leadingObject(text: string): string | null {\n if (!text.startsWith(\"{\")) return null;\n let depth = 0;\n let inString = false;\n for (let i = 0; i < text.length; i++) {\n const c = text[i];\n if (inString) {\n if (c === \"\\\\\") i++;\n else if (c === '\"') inString = false;\n continue;\n }\n if (c === '\"') inString = true;\n else if (c === \"{\" || c === \"[\") depth++;\n else if (c === \"}\" || c === \"]\") {\n depth--;\n if (depth === 0) return /^[\\s}\\]]*$/.test(text.slice(i + 1)) ? text.slice(0, i + 1) : null;\n }\n }\n return null;\n}\n\n/** The state after a line of JSON (one message), the line refused with its reason when it is not valid. */\nexport function applyLine(state: GenUiState, line: string, catalog: Readonly<Record<string, { readonly check: GenUiPropsCheck }>>): GenUiState {\n const text = line.trim();\n if (!text) return state;\n let json: unknown;\n try {\n json = JSON.parse(text);\n } catch {\n // Models sometimes close one brace too many: the first complete object is kept when what follows it is only\n // stray closing brackets. Anything else is not JSON and is refused. (The object is still validated as any other.)\n const head = leadingObject(text);\n if (head === null) return withError(state, \"a line is not JSON\");\n try {\n json = JSON.parse(head);\n } catch {\n return withError(state, \"a line is not JSON\");\n }\n }\n const result = validateMessage(json, catalog);\n return result.ok ? applyMessage(state, result.value) : withError(state, result.error);\n}\n\n/** Where a fenced `a2ui` block sits in a text: its JSON Lines so far, whether it is closed, and the prose around it. */\nexport type GenUiExtract = { readonly lines: readonly string[]; readonly closed: boolean; readonly prose: string; readonly found: boolean };\n\nconst FENCE = /```a2ui[^\\n]*\\n/;\n\n/**\n * Splits a model's answer — complete or still arriving — into its prose and the complete lines of its `a2ui` fence.\n * A line still being written (no newline yet, the fence open) is left for the next call: the surface grows message by\n * message as the answer streams.\n */\nexport function extractGenUi(text: string): GenUiExtract {\n const open = FENCE.exec(text);\n if (!open) return { lines: [], closed: false, prose: text, found: false };\n const start = open.index + open[0].length;\n const end = text.indexOf(\"\\n```\", start - 1);\n const closed = end >= 0;\n const body = closed ? text.slice(start, end) : text.slice(start);\n const parts = body.split(\"\\n\");\n const lines = closed ? parts : parts.slice(0, -1);\n const after = closed ? text.slice(end + 4).replace(/^[^\\n]*\\n?/, \"\") : \"\";\n const prose = [text.slice(0, open.index).trim(), after.trim()].filter(Boolean).join(\"\\n\\n\");\n return { lines: lines.filter((l) => l.trim()), closed, prose, found: true };\n}\n\n/** The state of every surface a model's answer describes so far. */\nexport function readStream(text: string, catalog: Readonly<Record<string, { readonly check: GenUiPropsCheck }>>): GenUiState & { readonly prose: string; readonly found: boolean } {\n const { lines, prose, found } = extractGenUi(text);\n const state = lines.reduce((s, line) => applyLine(s, line, catalog), emptyGenUiState);\n return { ...state, prose, found };\n}\n","// Renders a surface from its root: each component through its catalog entry, children by id, bound values from the data\n// model. A tree only — a component met twice (a cycle, two parents) or beyond the depth is not drawn — and a child still\n// to come (the answer is streaming) is a skeleton. Text is text: React escapes it, nothing is ever parsed as HTML.\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { Skeleton } from \"../skeleton\";\nimport { GENUI_LIMITS, type GenUiComponent, type GenUiPropsCheck, isBinding } from \"./spec\";\nimport { type GenUiState, type GenUiSurfaceState, readPath, readStream } from \"./store\";\n\n/** What an entry gets to draw a component. */\nexport type GenUiRenderContext = {\n /** A child by id: drawn, a skeleton while it has not arrived, nothing when refused. */\n child: (id: unknown) => React.ReactNode;\n /** Children by id, in order. */\n children: (ids: unknown) => React.ReactNode[];\n /** A literal, or the value a binding `{ path }` points at in the data model. */\n resolve: (value: unknown) => unknown;\n /** The words of the surface. */\n labels: GenUiLabels;\n /** The locale numbers and dates are written in. */\n locale: string;\n};\n\n/** One component of a catalog: how its properties are checked, how it is drawn. */\nexport type GenUiEntry = {\n /** `null` when the component's own properties are fine, else why not (the message is refused). */\n readonly check: GenUiPropsCheck;\n /** Draws the component. */\n readonly render: (component: GenUiComponent, context: GenUiRenderContext) => React.ReactNode;\n};\n\n/** The components a model may use, by name: `baseGenUiCatalog`, merged with `chartsGenUiCatalog` of @krizaka/charts. */\nexport type GenUiCatalog = Readonly<Record<string, GenUiEntry>>;\n\n/** The surface's own words (passed translated). */\nexport type GenUiLabels = {\n /** Announced while the surface is still arriving. */\n loading: string;\n /** The accessible name of the surface. */\n surface: string;\n /** Under a table whose data has not arrived or is not a list. */\n noData: string;\n};\n\nexport const genUiLabels: GenUiLabels = { loading: \"Building the view…\", surface: \"Generated view\", noData: \"No data\" };\n\nexport type GenUiSurfaceProps = {\n /** The surface to draw (from `readStream` or `applyMessage`). */\n surface: GenUiSurfaceState;\n /** The components it may use. */\n catalog: GenUiCatalog;\n /** The answer is still arriving: missing children are skeletons and the surface is busy. */\n streaming?: boolean;\n /** The surface's words. */\n labels?: Partial<GenUiLabels>;\n /** The locale numbers are written in. Default `en`. */\n locale?: string;\n /** Called with what could not be drawn (a cycle, a missing child once the answer is complete). */\n onError?: (error: string) => void;\n /** Extra classes on the frame. */\n className?: string;\n};\n\n/** One surface, drawn from its root. */\nexport function GenUiSurface({ surface, catalog, streaming = false, labels, locale = \"en\", onError, className }: GenUiSurfaceProps) {\n const words = { ...genUiLabels, ...labels };\n const problems: string[] = [];\n const seen = new Set<string>();\n\n const draw = (id: unknown, depth: number): React.ReactNode => {\n if (typeof id !== \"string\") return null;\n if (depth > GENUI_LIMITS.depth) {\n problems.push(`\"${id}\" is deeper than ${GENUI_LIMITS.depth}`);\n return null;\n }\n if (seen.has(id)) {\n problems.push(`\"${id}\" is drawn twice (a cycle or two parents)`);\n return null;\n }\n const component = surface.components.get(id);\n if (!component) {\n if (!streaming) problems.push(`\"${id}\" never arrived`);\n return streaming ? <Skeleton key={id} className=\"h-10 w-full rounded-lg\" /> : null;\n }\n const entry = Object.hasOwn(catalog, component.component) ? catalog[component.component] : undefined;\n if (!entry) return null;\n seen.add(id);\n const context: GenUiRenderContext = {\n child: (c) => draw(c, depth + 1),\n children: (ids) => (Array.isArray(ids) ? ids.map((c) => <React.Fragment key={String(c)}>{draw(c, depth + 1)}</React.Fragment>) : []),\n resolve: (value) => (isBinding(value) ? readPath(surface.data, value.path) : value),\n labels: words,\n locale,\n };\n return <React.Fragment key={id}>{entry.render(component, context)}</React.Fragment>;\n };\n\n const root = draw(\"root\", 0);\n React.useEffect(() => {\n if (onError) for (const problem of problems) onError(problem);\n // Reported once per drawn state.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [surface, streaming]);\n\n return (\n <section aria-label={words.surface} aria-busy={streaming || undefined} data-genui-surface={surface.id} className={cn(\"flex flex-col gap-4\", className)}>\n {root ?? (streaming ? <Skeleton className=\"h-24 w-full rounded-xl\" /> : null)}\n </section>\n );\n}\n\nexport type GenUiStreamProps = Omit<GenUiSurfaceProps, \"surface\"> & {\n /** A model's answer, complete or still arriving: its prose and its `a2ui` fence. */\n text: string;\n /** Draws the prose (markdown in a chat); default: paragraphs of text. */\n renderProse?: (prose: string) => React.ReactNode;\n /** What to show when the answer holds no valid surface: the answer itself, as text (the fallback). */\n fallback?: (text: string) => React.ReactNode;\n};\n\n/**\n * A model's answer with its generated view: the prose, then every surface of its `a2ui` fence, growing as the answer\n * streams. An answer without a valid surface falls back to its text.\n */\nexport function GenUiStream({ text, catalog, streaming, renderProse, fallback, onError, ...rest }: GenUiStreamProps) {\n const state = React.useMemo(() => readStream(text, catalog), [text, catalog]);\n const reported = React.useRef(0);\n React.useEffect(() => {\n if (!onError) return;\n for (const error of state.errors.slice(reported.current)) onError(error);\n reported.current = state.errors.length;\n }, [state, onError]);\n const prose = (value: string) => (renderProse ? renderProse(value) : value.split(/\\n{2,}/).map((p, i) => <p key={i}>{p}</p>));\n const surfaces = state.order.map((id) => state.surfaces.get(id)).filter((s): s is GenUiSurfaceState => !!s && s.components.has(\"root\"));\n if (!state.found || (!streaming && surfaces.length === 0)) return <>{fallback ? fallback(text) : prose(text)}</>;\n return (\n <div className=\"flex flex-col gap-4\" data-genui-stream=\"\">\n {state.prose && prose(state.prose)}\n {surfaces.map((surface) => (\n <GenUiSurface key={surface.id} surface={surface} catalog={catalog} streaming={streaming} onError={onError} {...rest} />\n ))}\n {streaming && surfaces.length === 0 && <Skeleton className=\"h-24 w-full rounded-xl\" />}\n </div>\n );\n}\n\n/** The state a list of messages builds — for a surface the app holds itself (not from a model's text). */\nexport type { GenUiState };\n","// Server-safe. A placeholder for content on its way: decorative, so hidden from assistive technology. One reflection of\n// the brand light crosses every skeleton of the page together (`background-attachment: fixed`), instead of each one\n// pulsing on its own; under reduced motion they rest, tinted.\nimport type * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\nexport const skeletonVariants = tv({\n base: \"kz-skeleton block bg-surface-3\",\n variants: {\n shape: { text: \"h-3 w-full rounded-sm\", circle: \"aspect-square h-10 rounded-full\", rect: \"h-24 w-full rounded-lg\" },\n },\n defaultVariants: { shape: \"text\" },\n});\n\nexport type SkeletonProps = React.ComponentProps<\"span\"> & {\n /**\n * text (a line) · circle (an avatar; give it a height) · rect (a media; give it a height).\n * @default \"text\"\n */\n shape?: VariantProps<typeof skeletonVariants>[\"shape\"];\n};\n\n/** A shape the size of what is loading. Announce the wait elsewhere (`LoadingRegion` does it, with `aria-busy`). */\nexport function Skeleton({ shape, className, ...props }: SkeletonProps) {\n return <span aria-hidden data-shape={shape ?? \"text\"} className={skeletonVariants({ shape, className })} {...props} />;\n}\n\nexport type SkeletonTextProps = React.ComponentProps<\"span\"> & {\n /**\n * How many lines.\n * @default 3\n */\n lines?: number;\n};\n\n/** A paragraph on its way: `lines` lines, the last one shorter — like text that wraps. */\nexport function SkeletonText({ lines = 3, className, ...props }: SkeletonTextProps) {\n return (\n <span aria-hidden className={[\"flex w-full flex-col gap-2\", className].filter(Boolean).join(\" \")} {...props}>\n {Array.from({ length: lines }, (_, i) => (\n <Skeleton key={i} className={i === lines - 1 && lines > 1 ? \"w-3/5\" : undefined} />\n ))}\n </span>\n );\n}\n\nexport type SkeletonShapeProps = React.ComponentProps<\"div\">;\n\n/**\n * The skeleton of the real thing: render your component with placeholder data inside, and its text, images and icons\n * become skeleton shapes in place — the exact layout, nothing to draw twice. Inert and hidden from assistive technology.\n */\nexport function SkeletonShape({ className, children, ...props }: SkeletonShapeProps) {\n return (\n <div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