@krizaka/ui 3.74.0 → 3.76.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 (286) hide show
  1. package/README.md +2 -6
  2. package/dist/blocks.css +2 -0
  3. package/dist/{chunk-GSQRSWOE.js → chunk-CEW3LQOZ.js} +520 -429
  4. package/dist/chunk-CEW3LQOZ.js.map +1 -0
  5. package/dist/{chunk-E4FMPPDL.js → chunk-WC3SO4CE.js} +2 -2
  6. package/dist/{chunk-KF7UB3LM.js → chunk-YQWYGQTV.js} +11 -9
  7. package/dist/{chunk-KF7UB3LM.js.map → chunk-YQWYGQTV.js.map} +1 -1
  8. package/dist/{chunk-M3GEYLMR.js → chunk-ZPOVOEO3.js} +1 -2
  9. package/dist/data-table.d.ts +1 -1
  10. package/dist/data-table.js +3 -3
  11. package/dist/filter-bar.d.ts +12 -4
  12. package/dist/filter-bar.js +1 -1
  13. package/dist/gallery-page.js +3 -3
  14. package/dist/genui.js +101 -35
  15. package/dist/genui.js.map +1 -1
  16. package/dist/language-switch.d.ts +9 -9
  17. package/dist/{lightbox-D5NAHFEA.js → lightbox-Q45BZ3HW.js} +3 -3
  18. package/dist/match-dialog.js +2 -2
  19. package/dist/motion.css +1 -25
  20. package/dist/native/list.js +1 -1
  21. package/dist/native/list.js.map +1 -1
  22. package/dist/native.d.ts +2 -54
  23. package/dist/native.js +464 -560
  24. package/dist/native.js.map +1 -1
  25. package/dist/nav-bar.js +1 -1
  26. package/dist/nav-bar.js.map +1 -1
  27. package/dist/product-page.js +3 -3
  28. package/dist/shop-gallery.js +1 -1
  29. package/dist/tag-selector.js +16 -10
  30. package/dist/tag-selector.js.map +1 -1
  31. package/dist/theme.d.ts +3 -1
  32. package/dist/theme.js +2 -1
  33. package/dist/theme.js.map +1 -1
  34. package/dist/vertical-video.js +1 -1
  35. package/dist/waveform.js.map +1 -1
  36. package/package.json +8 -84
  37. package/registry/account-menu.json +1 -1
  38. package/registry/account-settings.json +1 -1
  39. package/registry/achievement.json +1 -1
  40. package/registry/action-bar.json +1 -1
  41. package/registry/activity-feed.json +1 -1
  42. package/registry/agenda.json +1 -1
  43. package/registry/alert.json +1 -1
  44. package/registry/analysis-report.json +1 -1
  45. package/registry/anatomy-plate.json +1 -1
  46. package/registry/app-frame.json +2 -2
  47. package/registry/app-header.json +1 -1
  48. package/registry/app-shell.json +1 -1
  49. package/registry/argument-card.json +1 -1
  50. package/registry/auth-layout.json +1 -1
  51. package/registry/avatar.json +1 -1
  52. package/registry/badge.json +1 -1
  53. package/registry/bird-plate.json +1 -1
  54. package/registry/button.json +1 -1
  55. package/registry/captcha.json +1 -1
  56. package/registry/card-grid.json +1 -1
  57. package/registry/card.json +1 -1
  58. package/registry/catalogue-page.json +1 -1
  59. package/registry/changelog-page.json +1 -1
  60. package/registry/chapter.json +1 -1
  61. package/registry/chat.json +3 -3
  62. package/registry/checkbox.json +1 -1
  63. package/registry/chip-link.json +1 -1
  64. package/registry/chip-row.json +1 -1
  65. package/registry/chip.json +1 -1
  66. package/registry/choice-grid.json +1 -1
  67. package/registry/code-block.json +1 -1
  68. package/registry/collection-switcher.json +1 -1
  69. package/registry/combobox.json +1 -1
  70. package/registry/command.json +1 -1
  71. package/registry/comparison-table.json +1 -1
  72. package/registry/component-page.json +1 -1
  73. package/registry/confirm-button.json +1 -1
  74. package/registry/contact-page.json +1 -1
  75. package/registry/continue-prompt.json +1 -1
  76. package/registry/copy-button.json +1 -1
  77. package/registry/countdown.json +1 -1
  78. package/registry/cover-hero.json +1 -1
  79. package/registry/cta-panel.json +1 -1
  80. package/registry/dashboard-layout.json +1 -1
  81. package/registry/data-table.json +20 -20
  82. package/registry/date-picker.json +1 -1
  83. package/registry/decision-list.json +1 -1
  84. package/registry/description-list.json +1 -1
  85. package/registry/desktop-window.json +1 -1
  86. package/registry/detail-layout.json +1 -1
  87. package/registry/dialog.json +1 -1
  88. package/registry/docs-article-page.json +1 -1
  89. package/registry/docs-hub-page.json +1 -1
  90. package/registry/docs-layout.json +1 -1
  91. package/registry/docs-nav.json +1 -1
  92. package/registry/document-viewer.json +1 -1
  93. package/registry/doodle.json +1 -1
  94. package/registry/drop-overlay.json +1 -1
  95. package/registry/dropdown-menu.json +1 -1
  96. package/registry/elephant.json +1 -1
  97. package/registry/embed-facade.json +1 -1
  98. package/registry/empty-state.json +1 -1
  99. package/registry/engine-flow.json +1 -1
  100. package/registry/entity-header.json +1 -1
  101. package/registry/environment-notice.json +1 -1
  102. package/registry/error-page.json +1 -1
  103. package/registry/field.json +1 -1
  104. package/registry/file-upload.json +1 -1
  105. package/registry/filter-bar.json +2 -2
  106. package/registry/flock.json +1 -1
  107. package/registry/footnote.json +1 -1
  108. package/registry/force-update-screen.json +1 -1
  109. package/registry/form.json +1 -1
  110. package/registry/gallery-page.json +1 -1
  111. package/registry/genui.json +1 -1
  112. package/registry/glossary-term.json +1 -1
  113. package/registry/glossary.json +1 -1
  114. package/registry/glow-card.json +1 -1
  115. package/registry/goal-gauge.json +1 -1
  116. package/registry/grade-stamp.json +1 -1
  117. package/registry/image-cropper.json +1 -1
  118. package/registry/index.json +10 -185
  119. package/registry/kanban.json +1 -1
  120. package/registry/kbd.json +1 -1
  121. package/registry/kind-config-editor.json +1 -1
  122. package/registry/kpi-explained.json +1 -1
  123. package/registry/landing-page.json +1 -1
  124. package/registry/landscape.json +1 -1
  125. package/registry/language-switch.json +1 -1
  126. package/registry/legal-page.json +1 -1
  127. package/registry/link-card.json +1 -1
  128. package/registry/list.json +1 -1
  129. package/registry/loader.json +1 -1
  130. package/registry/longform-page.json +1 -1
  131. package/registry/maintenance-screen.json +1 -1
  132. package/registry/map.json +2 -2
  133. package/registry/margin-layout.json +1 -1
  134. package/registry/markdown.json +1 -1
  135. package/registry/marketing-layout.json +1 -1
  136. package/registry/mascot-quote.json +1 -1
  137. package/registry/mascot-state.json +1 -1
  138. package/registry/mascots.json +1 -1
  139. package/registry/match-dialog.json +1 -1
  140. package/registry/media-capture.json +1 -1
  141. package/registry/media-gallery.json +3 -14
  142. package/registry/meter.json +1 -1
  143. package/registry/money-input.json +1 -1
  144. package/registry/nav-bar.json +3 -3
  145. package/registry/next-actions.json +1 -1
  146. package/registry/notification-preferences.json +1 -1
  147. package/registry/number-ticker.json +1 -1
  148. package/registry/opening-hours.json +1 -1
  149. package/registry/page-header.json +1 -1
  150. package/registry/page-hero.json +1 -1
  151. package/registry/page-index.json +1 -1
  152. package/registry/page.json +1 -1
  153. package/registry/pagination.json +1 -1
  154. package/registry/pointer-light.json +1 -1
  155. package/registry/popover.json +1 -1
  156. package/registry/price-catalogue-editor.json +1 -1
  157. package/registry/pricing-page.json +1 -1
  158. package/registry/product-page.json +2 -6
  159. package/registry/profile-card.json +1 -1
  160. package/registry/progress.json +1 -1
  161. package/registry/promise-card.json +1 -1
  162. package/registry/promo-code-field.json +1 -1
  163. package/registry/proposal.json +1 -1
  164. package/registry/qr-code.json +1 -1
  165. package/registry/quota-meter.json +1 -1
  166. package/registry/radio-group.json +1 -1
  167. package/registry/rail-nav.json +2 -2
  168. package/registry/recipes.json +1 -1
  169. package/registry/retro-tv.json +2 -3
  170. package/registry/reviews.json +1 -1
  171. package/registry/router.json +1 -1
  172. package/registry/schema-form.json +1 -1
  173. package/registry/scroll-stage.json +1 -1
  174. package/registry/search-field.json +1 -1
  175. package/registry/section-backdrop.json +1 -1
  176. package/registry/separator.json +1 -1
  177. package/registry/service-card.json +1 -1
  178. package/registry/settings-layout.json +1 -1
  179. package/registry/shop-composer.json +1 -1
  180. package/registry/shop-gallery.json +3 -8
  181. package/registry/shop.json +2 -2
  182. package/registry/showcase.json +2 -7
  183. package/registry/signature.json +1 -1
  184. package/registry/site-cahier.json +1 -1
  185. package/registry/site-footer.json +2 -2
  186. package/registry/sites.json +1 -1
  187. package/registry/skeleton.json +1 -1
  188. package/registry/skip-link.json +1 -1
  189. package/registry/slider.json +1 -1
  190. package/registry/slot-picker.json +1 -1
  191. package/registry/slot.json +1 -1
  192. package/registry/specimen-tag.json +1 -1
  193. package/registry/speed-lines.json +1 -1
  194. package/registry/spinner.json +1 -1
  195. package/registry/split-view.json +1 -1
  196. package/registry/stage-banner.json +1 -1
  197. package/registry/stat.json +1 -1
  198. package/registry/status-chip.json +1 -1
  199. package/registry/status-page.json +1 -1
  200. package/registry/step-progress.json +1 -1
  201. package/registry/step-showcase.json +1 -1
  202. package/registry/stepper.json +1 -1
  203. package/registry/sticky-action.json +1 -1
  204. package/registry/stuck.json +1 -1
  205. package/registry/swipe-deck.json +3 -4
  206. package/registry/switch.json +1 -1
  207. package/registry/tabs.json +1 -1
  208. package/registry/tag-input.json +1 -1
  209. package/registry/tag-selector.json +2 -2
  210. package/registry/taped-photo.json +1 -1
  211. package/registry/terminal-replay.json +1 -1
  212. package/registry/text-style.json +1 -1
  213. package/registry/theme.json +4 -4
  214. package/registry/toast.json +1 -1
  215. package/registry/toc.json +1 -1
  216. package/registry/tooltip.json +1 -1
  217. package/registry/tree-view.json +1 -1
  218. package/registry/update-prompt.json +1 -1
  219. package/registry/upload-queue.json +1 -1
  220. package/registry/usage.json +1 -1
  221. package/registry/verified-badge.json +1 -1
  222. package/registry/versus-card.json +1 -1
  223. package/registry/vertical-video.json +2 -6
  224. package/registry/video-player.json +2 -7
  225. package/registry/video-trimmer.json +3 -4
  226. package/registry/virtual.json +1 -1
  227. package/registry/wall.json +3 -9
  228. package/registry/waveform.json +4 -9
  229. package/dist/audio-player.d.ts +0 -115
  230. package/dist/audio-player.js +0 -211
  231. package/dist/audio-player.js.map +0 -1
  232. package/dist/chunk-GSQRSWOE.js.map +0 -1
  233. package/dist/chunk-YKOLME7R.js +0 -126
  234. package/dist/chunk-YKOLME7R.js.map +0 -1
  235. package/dist/how-it-works-page.d.ts +0 -49
  236. package/dist/how-it-works-page.js +0 -28
  237. package/dist/how-it-works-page.js.map +0 -1
  238. package/dist/marquee.d.ts +0 -34
  239. package/dist/marquee.js +0 -52
  240. package/dist/marquee.js.map +0 -1
  241. package/dist/media-grid.d.ts +0 -246
  242. package/dist/media-grid.js +0 -468
  243. package/dist/media-grid.js.map +0 -1
  244. package/dist/photo-grid.d.ts +0 -123
  245. package/dist/photo-grid.js +0 -94
  246. package/dist/photo-grid.js.map +0 -1
  247. package/registry/audio-player.json +0 -300
  248. package/registry/examples/audio-player/podcast.d.ts +0 -4
  249. package/registry/examples/audio-player/podcast.js +0 -22
  250. package/registry/examples/audio-player/podcast.tsx +0 -19
  251. package/registry/examples/audio-player/voice-note.d.ts +0 -4
  252. package/registry/examples/audio-player/voice-note.js +0 -12
  253. package/registry/examples/audio-player/voice-note.tsx +0 -12
  254. package/registry/examples/how-it-works-page/orazaka.d.ts +0 -4
  255. package/registry/examples/how-it-works-page/orazaka.js +0 -30
  256. package/registry/examples/how-it-works-page/orazaka.tsx +0 -26
  257. package/registry/examples/marquee/cards.d.ts +0 -4
  258. package/registry/examples/marquee/cards.js +0 -23
  259. package/registry/examples/marquee/cards.tsx +0 -21
  260. package/registry/examples/marquee/logos.d.ts +0 -4
  261. package/registry/examples/marquee/logos.js +0 -12
  262. package/registry/examples/marquee/logos.tsx +0 -17
  263. package/registry/examples/media-grid/feed.d.ts +0 -4
  264. package/registry/examples/media-grid/feed.js +0 -31
  265. package/registry/examples/media-grid/feed.tsx +0 -30
  266. package/registry/examples/media-grid/loading.d.ts +0 -4
  267. package/registry/examples/media-grid/loading.js +0 -28
  268. package/registry/examples/media-grid/loading.tsx +0 -25
  269. package/registry/examples/media-grid/uniform.d.ts +0 -4
  270. package/registry/examples/media-grid/uniform.js +0 -29
  271. package/registry/examples/media-grid/uniform.tsx +0 -26
  272. package/registry/examples/photo-grid/native/profile-photos.d.ts +0 -4
  273. package/registry/examples/photo-grid/native/profile-photos.dark.png +0 -0
  274. package/registry/examples/photo-grid/native/profile-photos.js +0 -27
  275. package/registry/examples/photo-grid/native/profile-photos.light.png +0 -0
  276. package/registry/examples/photo-grid/native/profile-photos.tsx +0 -24
  277. package/registry/examples/photo-grid/profile-photos.d.ts +0 -4
  278. package/registry/examples/photo-grid/profile-photos.js +0 -28
  279. package/registry/examples/photo-grid/profile-photos.tsx +0 -25
  280. package/registry/how-it-works-page.json +0 -258
  281. package/registry/marquee.json +0 -241
  282. package/registry/media-grid.json +0 -1034
  283. package/registry/photo-grid.json +0 -316
  284. /package/dist/{chunk-E4FMPPDL.js.map → chunk-WC3SO4CE.js.map} +0 -0
  285. /package/dist/{chunk-M3GEYLMR.js.map → chunk-ZPOVOEO3.js.map} +0 -0
  286. /package/dist/{lightbox-D5NAHFEA.js.map → lightbox-Q45BZ3HW.js.map} +0 -0
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,cAA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AW,SAAS,MAAM,OAAO,MAAM,SAAS,OAAO,EAAG,SAAQ,KAAK;AACvE,aAAS,UAAU,MAAM,OAAO;AAAA,EAClC,GAAG,CAAC,OAAO,OAAO,CAAC;AACnB,QAAM,QAAQ,CAAC,UAAmB,cAAc,YAAY,KAAK,IAAI,MAAM,MAAM,QAAQ,EAAE,IAAI,CAAC,GAAG,MAAM,gBAAAF,KAAC,OAAW,eAAJ,CAAM,CAAI;AAC3H,QAAM,WAAW,MAAM,MAAM,IAAI,CAAC,OAAO,MAAM,SAAS,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,MAA8B,CAAC,CAAC,KAAK,EAAE,WAAW,IAAI,MAAM,CAAC;AACtI,MAAI,CAAC,MAAM,SAAU,CAAC,aAAa,SAAS,WAAW,EAAI,QAAO,gBAAAA,KAAAD,WAAA,EAAG,qBAAW,SAASG,KAAI,IAAI,MAAMA,KAAI,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 aria-hidden inert className={[\"kz-skeleton-shape\", className].filter(Boolean).join(\" \")} {...props}>\n {children}\n </div>\n );\n}\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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AAS,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,MAA8B,CAAC,CAAC,KAAK,EAAE,WAAW,IAAI,MAAM,CAAC;AACtI,MAAI,CAAC,MAAM,SAAU,CAAC,aAAa,SAAS,WAAW,EAAI,QAAO,gBAAAA,KAAAD,WAAA,EAAG,qBAAW,SAASG,KAAI,IAAI,MAAMA,KAAI,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":["tv","jsx","jsxs","tv","jsx","jsx","jsxs","card","surfaceId","surfaces","text","tv","jsx","Fragment","jsx","jsxs","text"]}
@@ -20,28 +20,28 @@ declare function languagesFor(path: string, locales?: readonly string[]): Langua
20
20
  declare const languageSwitch: tailwind_variants.TVReturnType<{
21
21
  [key: string]: {
22
22
  [key: string]: tailwind_variants.ClassValue | {
23
- root?: tailwind_variants.ClassValue;
24
- glyph?: tailwind_variants.ClassValue;
25
23
  panel?: tailwind_variants.ClassValue;
24
+ root?: tailwind_variants.ClassValue;
25
+ item?: tailwind_variants.ClassValue;
26
26
  heading?: tailwind_variants.ClassValue;
27
+ glyph?: tailwind_variants.ClassValue;
27
28
  check?: tailwind_variants.ClassValue;
28
29
  inline?: tailwind_variants.ClassValue;
29
30
  trigger?: tailwind_variants.ClassValue;
30
- item?: tailwind_variants.ClassValue;
31
31
  inlineLink?: tailwind_variants.ClassValue;
32
32
  };
33
33
  };
34
34
  } | {
35
35
  [x: string]: {
36
36
  [x: string]: tailwind_variants.ClassValue | {
37
- root?: tailwind_variants.ClassValue;
38
- glyph?: tailwind_variants.ClassValue;
39
37
  panel?: tailwind_variants.ClassValue;
38
+ root?: tailwind_variants.ClassValue;
39
+ item?: tailwind_variants.ClassValue;
40
40
  heading?: tailwind_variants.ClassValue;
41
+ glyph?: tailwind_variants.ClassValue;
41
42
  check?: tailwind_variants.ClassValue;
42
43
  inline?: tailwind_variants.ClassValue;
43
44
  trigger?: tailwind_variants.ClassValue;
44
- item?: tailwind_variants.ClassValue;
45
45
  inlineLink?: tailwind_variants.ClassValue;
46
46
  };
47
47
  };
@@ -58,14 +58,14 @@ declare const languageSwitch: tailwind_variants.TVReturnType<{
58
58
  }, undefined, {
59
59
  [key: string]: {
60
60
  [key: string]: tailwind_variants.ClassValue | {
61
- root?: tailwind_variants.ClassValue;
62
- glyph?: tailwind_variants.ClassValue;
63
61
  panel?: tailwind_variants.ClassValue;
62
+ root?: tailwind_variants.ClassValue;
63
+ item?: tailwind_variants.ClassValue;
64
64
  heading?: tailwind_variants.ClassValue;
65
+ glyph?: tailwind_variants.ClassValue;
65
66
  check?: tailwind_variants.ClassValue;
66
67
  inline?: tailwind_variants.ClassValue;
67
68
  trigger?: tailwind_variants.ClassValue;
68
- item?: tailwind_variants.ClassValue;
69
69
  inlineLink?: tailwind_variants.ClassValue;
70
70
  };
71
71
  };
@@ -2,10 +2,10 @@
2
2
  "use client";
3
3
  import {
4
4
  Dialog
5
- } from "./chunk-E4FMPPDL.js";
5
+ } from "./chunk-WC3SO4CE.js";
6
6
  import {
7
7
  IconButton
8
- } from "./chunk-M3GEYLMR.js";
8
+ } from "./chunk-ZPOVOEO3.js";
9
9
  import "./chunk-D3T54RSL.js";
10
10
  import "./chunk-NSLXEDIS.js";
11
11
 
@@ -92,4 +92,4 @@ function ShopGalleryLightbox({ photos, index, onIndexChange, onClose, label, lab
92
92
  export {
93
93
  ShopGalleryLightbox as default
94
94
  };
95
- //# sourceMappingURL=lightbox-D5NAHFEA.js.map
95
+ //# sourceMappingURL=lightbox-Q45BZ3HW.js.map
@@ -2,7 +2,7 @@
2
2
  import "./chunk-NPF3OHE2.js";
3
3
  import {
4
4
  Dialog
5
- } from "./chunk-E4FMPPDL.js";
5
+ } from "./chunk-WC3SO4CE.js";
6
6
  import {
7
7
  Avatar
8
8
  } from "./chunk-E46AEUPH.js";
@@ -12,7 +12,7 @@ import {
12
12
  import "./chunk-JXLDUDTD.js";
13
13
  import {
14
14
  Button
15
- } from "./chunk-M3GEYLMR.js";
15
+ } from "./chunk-ZPOVOEO3.js";
16
16
  import "./chunk-D3T54RSL.js";
17
17
  import "./chunk-NSLXEDIS.js";
18
18
 
package/dist/motion.css CHANGED
@@ -84,16 +84,6 @@
84
84
  50% { background-position: 100% center; }
85
85
  }
86
86
 
87
- /* Marquee (logos, feature words): two copies side by side, sliding forever. */
88
- .kz-marquee {
89
- display: flex;
90
- width: max-content;
91
- animation: kz-marquee var(--kz-marquee-duration, 40s) linear infinite;
92
- }
93
- @keyframes kz-marquee {
94
- to { transform: translateX(-50%); }
95
- }
96
-
97
87
  /* Entrances of what opens over the page — one vocabulary for every overlay, dialog, menu and swapped view.
98
88
  Opacity and transform only, `backwards` fill: nothing stays transformed once in place. */
99
89
  .kz-overlay { animation: kz-fade-in 0.22s var(--kz-ease) backwards; } /* the dimmed backdrop */
@@ -299,20 +289,6 @@ svg[data-kz-icon="ExternalIcon"] {
299
289
  from { color: var(--kz-danger-text, currentColor); }
300
290
  }
301
291
 
302
- /* ─── Marquee: a band that slides at a speed, pauses for the reader, and is a still row under reduced motion ─── */
303
- .kz-band {
304
- --kz-band-gap: 2.5rem;
305
- }
306
- .kz-band[data-fade] > .kz-band-viewport {
307
- mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
308
- }
309
- .kz-band[data-direction="right"] .kz-marquee {
310
- animation-direction: reverse;
311
- }
312
- .kz-band:is([data-paused], :hover, :focus-within) .kz-marquee {
313
- animation-play-state: paused;
314
- }
315
-
316
292
  /* ─── GlowCard: a still hairline ring of the brand gradient (krizaka-ui#393: no bloom under the pointer, no turning
317
293
  ring). Faint at rest, a step brighter under the pointer or the focus, fuller on a featured (`alive`) card. ─── */
318
294
  .kz-glow:is([data-glow="border"], [data-glow="both"])::before {
@@ -613,7 +589,7 @@ svg[data-kz-icon="ExternalIcon"] {
613
589
  @keyframes kz-grow-wipe { from { clip-path: inset(-4px 100% -4px -4px); } to { clip-path: inset(-4px -4px -4px -4px); } }
614
590
 
615
591
  @media (prefers-reduced-motion: reduce) {
616
- .kz-page, .kz-word, .kz-gradient-text, .kz-marquee, .kz-backdrop-drift, .kz-overlay, .kz-dialog, .kz-pop, .kz-fade, .kz-progress,
592
+ .kz-page, .kz-word, .kz-gradient-text, .kz-backdrop-drift, .kz-overlay, .kz-dialog, .kz-pop, .kz-fade, .kz-progress,
617
593
  .kz-skeleton, .kz-skeleton-shape *, .kz-toast::after,
618
594
  .kz-rotating > *, .kz-loop, .kz-count-roll, .kz-loader-trace, .kz-loader-node, .kz-loader-mark,
619
595
  [data-kz-status], .kz-replay-caret, .kz-month, .kz-map-user::after, .kz-flow-photon, [data-kz-marker] > [data-drop], .kz-map-pulse::before, .kz-map-pulse::after { animation: none !important; }
@@ -111,7 +111,7 @@ function useInfiniteList({
111
111
  void refetch().finally(() => setPulled(false));
112
112
  },
113
113
  onEndReached: () => {
114
- if (hasNextPage && !isFetchingNextPage && !isError) void fetchNextPage();
114
+ if (hasNextPage && !isFetchingNextPage && !isError) void fetchNextPage({ cancelRefetch: false });
115
115
  },
116
116
  loadingMore: isFetchingNextPage
117
117
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/native/list.tsx"],"sourcesContent":["// @krizaka/ui/native/list — its own entry, because it imports FlashList v2 (@shopify/flash-list) and @krizaka/query:\n// optional peers, installed only by the apps that list. The theme and the states come from @krizaka/ui/native (one\n// theme context); the server state comes from @krizaka/query (one QueryClient context — never @tanstack/* here).\nimport { type InfiniteData, useInfiniteQuery, type UseInfiniteQueryResult } from \"@krizaka/query\";\nimport { EmptyState, Skeleton, Spinner, useTheme } from \"@krizaka/ui/native\";\nimport { FlashList, type FlashListRef } from \"@shopify/flash-list\";\nimport * as React from \"react\";\nimport { RefreshControl, type StyleProp, StyleSheet, View, type ViewStyle } from \"react-native\";\n\nexport type ListProps<T> = {\n /** The items (stable: a query's data, state). */\n data: readonly T[];\n /** Draws one item. */\n renderItem: (item: T, index: number) => React.ReactElement | null;\n /** A stable key per item (an id): FlashList recycles the views by it. */\n keyExtractor: (item: T, index: number) => string;\n /** The accessible name of the list (\"Notifications\"), passed translated. */\n label: string;\n /** A hairline between items: `full` (default), `inset` (aligned with the text after an avatar), `none`. */\n separator?: \"full\" | \"inset\" | \"none\";\n /** The first page is loading: skeleton rows (`loadingRows` of them) in place of the items. */\n loading?: boolean;\n /** How many skeleton rows while loading. Default 6. */\n loadingRows?: number;\n /** A failure, shown in place of the items (an `ErrorState` with a retry). */\n error?: React.ReactNode;\n /** Shown when there is no item (an `EmptyState`, or its words: `{ title, description, action }`). */\n empty?: React.ReactNode | { title: string; description?: string; action?: React.ReactNode };\n /** The list is reloading after a pull: the system's spinner at the top. */\n refreshing?: boolean;\n /** Pull to refresh: called when the person pulls the list down. */\n onRefresh?: () => void;\n /** Called when the end comes near: load the next page. */\n onEndReached?: () => void;\n /** How far from the end `onEndReached` fires, in screens. Default 0.5. */\n endReachedThreshold?: number;\n /** The next page is loading: a spinner under the last item, named by `loadingMoreLabel`. */\n loadingMore?: boolean;\n /** The name of that spinner (\"Loading more\"), passed translated. */\n loadingMoreLabel?: string;\n /** Above the first item (a title, filters): scrolls with the list. */\n header?: React.ReactElement;\n /** Under the last item. */\n footer?: React.ReactElement;\n /** Extra data the items depend on (a selection): a change re-renders the visible items. */\n extraData?: unknown;\n /** The FlashList, for `scrollToIndex` / `scrollToOffset`. */\n ref?: React.Ref<FlashListRef<T>>;\n /** Styles of the list's content (padding). */\n contentContainerStyle?: StyleProp<ViewStyle>;\n /** Styles merged last, on the list. */\n style?: StyleProp<ViewStyle>;\n};\n\nfunction SkeletonRow() {\n return (\n <View style={styles.skeleton} aria-hidden>\n <Skeleton shape=\"circle\" width={40} height={40} />\n <View style={styles.skeletonText}>\n <Skeleton width=\"60%\" />\n <Skeleton width=\"35%\" />\n </View>\n </View>\n );\n}\n\nconst isWords = (value: unknown): value is { title: string; description?: string; action?: React.ReactNode } =>\n typeof value === \"object\" && value !== null && !React.isValidElement(value) && \"title\" in value;\n\n/**\n * A long list on FlashList v2 (recycled views, 60 fps): separators, skeleton rows while the first page loads, an empty\n * or error state in place of the items, pull to refresh tinted with the theme, the next page asked for near the end and\n * a spinner under the last item. With `useInfiniteList`, a paginated API is one hook and one component.\n */\nexport function List<T>({\n data,\n renderItem,\n keyExtractor,\n label,\n separator = \"full\",\n loading,\n loadingRows = 6,\n error,\n empty,\n refreshing = false,\n onRefresh,\n onEndReached,\n endReachedThreshold = 0.5,\n loadingMore,\n loadingMoreLabel = \"Loading more\",\n header,\n footer,\n extraData,\n ref,\n contentContainerStyle,\n style,\n}: ListProps<T>) {\n const { theme } = useTheme();\n const Separator = React.useMemo(\n () =>\n separator === \"none\"\n ? undefined\n : function ListSeparator() {\n return <View style={[styles.separator, { backgroundColor: theme.borderSubtle }, separator === \"inset\" && styles.inset]} />;\n },\n [separator, theme.borderSubtle],\n );\n\n if (loading) {\n return (\n <View role=\"group\" style={[styles.fill, style]} aria-busy accessibilityLabel={label}>\n {header}\n {Array.from({ length: loadingRows }, (_, i) => (\n <React.Fragment key={i}>\n {i > 0 && Separator ? <Separator /> : null}\n <SkeletonRow />\n </React.Fragment>\n ))}\n </View>\n );\n }\n\n const state = error ? (\n <View role=\"alert\" style={styles.state}>\n {error}\n </View>\n ) : isWords(empty) ? (\n <EmptyState title={empty.title} description={empty.description} action={empty.action} style={styles.state} />\n ) : empty ? (\n <View style={styles.state}>{empty}</View>\n ) : null;\n\n return (\n <FlashList\n ref={ref}\n accessibilityLabel={label}\n // Reachable from a keyboard (a hardware keyboard, the web): a scrolling area takes the focus to be scrolled.\n focusable\n data={error ? [] : data}\n renderItem={({ item, index }) => renderItem(item, index)}\n keyExtractor={keyExtractor}\n extraData={extraData}\n ItemSeparatorComponent={Separator}\n ListHeaderComponent={header}\n ListEmptyComponent={state}\n ListFooterComponent={\n loadingMore || footer ? (\n <View>\n {loadingMore ? (\n <View style={styles.more}>\n <Spinner label={loadingMoreLabel} />\n </View>\n ) : null}\n {footer}\n </View>\n ) : null\n }\n onEndReached={onEndReached}\n onEndReachedThreshold={endReachedThreshold}\n refreshControl={\n onRefresh ? (\n <RefreshControl refreshing={refreshing} onRefresh={onRefresh} tintColor={theme.accent} colors={[theme.accent]} progressBackgroundColor={theme.surface1} />\n ) : undefined\n }\n contentContainerStyle={contentContainerStyle as never}\n style={style}\n />\n );\n}\n\nexport type InfiniteListOptions<TPage, TItem, TParam> = {\n /** The query key (a `defineKeys` key): one cache entry for every page. */\n queryKey: readonly unknown[];\n /** Fetches one page (`krizakaFetch`), from its page parameter (a cursor, a page number). */\n queryFn: (context: { pageParam: TParam; signal: AbortSignal }) => Promise<TPage>;\n /** The parameter of the first page (`null` for a cursor, `1` for numbers). */\n initialPageParam: TParam;\n /** The parameter of the page after `lastPage`, or `undefined` / `null` when there is none. */\n getNextPageParam: (lastPage: TPage, pages: TPage[]) => TParam | undefined | null;\n /** The items of a page (`(page) => page.items`). */\n getItems: (page: TPage) => readonly TItem[];\n /** `false` to wait (a missing id). Default `true`. */\n enabled?: boolean;\n /** How long a page stays fresh, in ms (the client's default otherwise). */\n staleTime?: number;\n};\n\n/** What `useInfiniteList` gives: the props of `List` to spread, and the query itself. */\nexport type InfiniteListResult<TPage, TItem, TParam = unknown> = {\n /** `{ data, loading, refreshing, onRefresh, onEndReached, loadingMore }` — spread on `<List>`. */\n listProps: Pick<ListProps<TItem>, \"data\" | \"loading\" | \"refreshing\" | \"onRefresh\" | \"onEndReached\" | \"loadingMore\">;\n /** The failure of the first page, if any: render an `ErrorState` in `error` (a later page's failure keeps the list). */\n error: Error | null;\n /** The query of @krizaka/query (`refetch`, `status`, the pages…). */\n query: UseInfiniteQueryResult<InfiniteData<TPage, TParam>, Error>;\n};\n\n/**\n * A paginated API as a list: `useInfiniteQuery` of @krizaka/query (a list: `meta: { list: true }`, so an error stays in\n * the list), the pages flattened, the next page asked for by `onEndReached` (once at a time, only when there is one),\n * pull to refresh — spread `listProps` on `<List>`.\n */\nexport function useInfiniteList<TPage, TItem, TParam = unknown>({\n queryKey,\n queryFn,\n initialPageParam,\n getNextPageParam,\n getItems,\n enabled,\n staleTime,\n}: InfiniteListOptions<TPage, TItem, TParam>): InfiniteListResult<TPage, TItem, TParam> {\n const query = useInfiniteQuery<TPage, Error, InfiniteData<TPage, TParam>, readonly unknown[], TParam>({\n queryKey,\n queryFn: ({ pageParam, signal }) => queryFn({ pageParam: pageParam as TParam, signal }),\n initialPageParam,\n getNextPageParam: (last, pages) => getNextPageParam(last, pages) ?? undefined,\n enabled,\n staleTime,\n meta: { list: true },\n });\n const [pulled, setPulled] = React.useState(false);\n const { data: pages, hasNextPage, isFetchingNextPage, fetchNextPage, refetch, isPending, isError, isRefetching } = query;\n // eslint-disable-next-line react-hooks/exhaustive-deps -- `getItems` is a projection; the pages decide\n const data = React.useMemo(() => (pages?.pages ?? []).flatMap((page) => getItems(page)), [pages]);\n return {\n listProps: {\n data,\n loading: isPending && enabled !== false,\n refreshing: pulled && isRefetching,\n onRefresh: () => {\n setPulled(true);\n void refetch().finally(() => setPulled(false));\n },\n onEndReached: () => {\n if (hasNextPage && !isFetchingNextPage && !isError) void fetchNextPage();\n },\n loadingMore: isFetchingNextPage,\n },\n error: isError && !pages ? query.error : null,\n query,\n };\n}\n\nconst styles = StyleSheet.create({\n fill: { flex: 1 },\n separator: { height: StyleSheet.hairlineWidth },\n inset: { marginLeft: 68 },\n skeleton: { flexDirection: \"row\", alignItems: \"center\", gap: 12, paddingHorizontal: 16, paddingVertical: 14 },\n skeletonText: { flex: 1, gap: 8 },\n state: { paddingHorizontal: 16, paddingVertical: 32 },\n more: { paddingVertical: 20, alignItems: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E,iBAAiB,IAAI,YAAY,SAAS;AACpD,CAAC;","names":["pages"]}
1
+ {"version":3,"sources":["../../src/native/list.tsx"],"sourcesContent":["// @krizaka/ui/native/list — its own entry, because it imports FlashList v2 (@shopify/flash-list) and @krizaka/query:\n// optional peers, installed only by the apps that list. The theme and the states come from @krizaka/ui/native (one\n// theme context); the server state comes from @krizaka/query (one QueryClient context — never @tanstack/* here).\nimport { type InfiniteData, useInfiniteQuery, type UseInfiniteQueryResult } from \"@krizaka/query\";\nimport { EmptyState, Skeleton, Spinner, useTheme } from \"@krizaka/ui/native\";\nimport { FlashList, type FlashListRef } from \"@shopify/flash-list\";\nimport * as React from \"react\";\nimport { RefreshControl, type StyleProp, StyleSheet, View, type ViewStyle } from \"react-native\";\n\nexport type ListProps<T> = {\n /** The items (stable: a query's data, state). */\n data: readonly T[];\n /** Draws one item. */\n renderItem: (item: T, index: number) => React.ReactElement | null;\n /** A stable key per item (an id): FlashList recycles the views by it. */\n keyExtractor: (item: T, index: number) => string;\n /** The accessible name of the list (\"Notifications\"), passed translated. */\n label: string;\n /** A hairline between items: `full` (default), `inset` (aligned with the text after an avatar), `none`. */\n separator?: \"full\" | \"inset\" | \"none\";\n /** The first page is loading: skeleton rows (`loadingRows` of them) in place of the items. */\n loading?: boolean;\n /** How many skeleton rows while loading. Default 6. */\n loadingRows?: number;\n /** A failure, shown in place of the items (an `ErrorState` with a retry). */\n error?: React.ReactNode;\n /** Shown when there is no item (an `EmptyState`, or its words: `{ title, description, action }`). */\n empty?: React.ReactNode | { title: string; description?: string; action?: React.ReactNode };\n /** The list is reloading after a pull: the system's spinner at the top. */\n refreshing?: boolean;\n /** Pull to refresh: called when the person pulls the list down. */\n onRefresh?: () => void;\n /** Called when the end comes near: load the next page. */\n onEndReached?: () => void;\n /** How far from the end `onEndReached` fires, in screens. Default 0.5. */\n endReachedThreshold?: number;\n /** The next page is loading: a spinner under the last item, named by `loadingMoreLabel`. */\n loadingMore?: boolean;\n /** The name of that spinner (\"Loading more\"), passed translated. */\n loadingMoreLabel?: string;\n /** Above the first item (a title, filters): scrolls with the list. */\n header?: React.ReactElement;\n /** Under the last item. */\n footer?: React.ReactElement;\n /** Extra data the items depend on (a selection): a change re-renders the visible items. */\n extraData?: unknown;\n /** The FlashList, for `scrollToIndex` / `scrollToOffset`. */\n ref?: React.Ref<FlashListRef<T>>;\n /** Styles of the list's content (padding). */\n contentContainerStyle?: StyleProp<ViewStyle>;\n /** Styles merged last, on the list. */\n style?: StyleProp<ViewStyle>;\n};\n\nfunction SkeletonRow() {\n return (\n <View style={styles.skeleton} aria-hidden>\n <Skeleton shape=\"circle\" width={40} height={40} />\n <View style={styles.skeletonText}>\n <Skeleton width=\"60%\" />\n <Skeleton width=\"35%\" />\n </View>\n </View>\n );\n}\n\nconst isWords = (value: unknown): value is { title: string; description?: string; action?: React.ReactNode } =>\n typeof value === \"object\" && value !== null && !React.isValidElement(value) && \"title\" in value;\n\n/**\n * A long list on FlashList v2 (recycled views, 60 fps): separators, skeleton rows while the first page loads, an empty\n * or error state in place of the items, pull to refresh tinted with the theme, the next page asked for near the end and\n * a spinner under the last item. With `useInfiniteList`, a paginated API is one hook and one component.\n */\nexport function List<T>({\n data,\n renderItem,\n keyExtractor,\n label,\n separator = \"full\",\n loading,\n loadingRows = 6,\n error,\n empty,\n refreshing = false,\n onRefresh,\n onEndReached,\n endReachedThreshold = 0.5,\n loadingMore,\n loadingMoreLabel = \"Loading more\",\n header,\n footer,\n extraData,\n ref,\n contentContainerStyle,\n style,\n}: ListProps<T>) {\n const { theme } = useTheme();\n const Separator = React.useMemo(\n () =>\n separator === \"none\"\n ? undefined\n : function ListSeparator() {\n return <View style={[styles.separator, { backgroundColor: theme.borderSubtle }, separator === \"inset\" && styles.inset]} />;\n },\n [separator, theme.borderSubtle],\n );\n\n if (loading) {\n return (\n <View role=\"group\" style={[styles.fill, style]} aria-busy accessibilityLabel={label}>\n {header}\n {Array.from({ length: loadingRows }, (_, i) => (\n <React.Fragment key={i}>\n {i > 0 && Separator ? <Separator /> : null}\n <SkeletonRow />\n </React.Fragment>\n ))}\n </View>\n );\n }\n\n const state = error ? (\n <View role=\"alert\" style={styles.state}>\n {error}\n </View>\n ) : isWords(empty) ? (\n <EmptyState title={empty.title} description={empty.description} action={empty.action} style={styles.state} />\n ) : empty ? (\n <View style={styles.state}>{empty}</View>\n ) : null;\n\n return (\n <FlashList\n ref={ref}\n accessibilityLabel={label}\n // Reachable from a keyboard (a hardware keyboard, the web): a scrolling area takes the focus to be scrolled.\n focusable\n data={error ? [] : data}\n renderItem={({ item, index }) => renderItem(item, index)}\n keyExtractor={keyExtractor}\n extraData={extraData}\n ItemSeparatorComponent={Separator}\n ListHeaderComponent={header}\n ListEmptyComponent={state}\n ListFooterComponent={\n loadingMore || footer ? (\n <View>\n {loadingMore ? (\n <View style={styles.more}>\n <Spinner label={loadingMoreLabel} />\n </View>\n ) : null}\n {footer}\n </View>\n ) : null\n }\n onEndReached={onEndReached}\n onEndReachedThreshold={endReachedThreshold}\n refreshControl={\n onRefresh ? (\n <RefreshControl refreshing={refreshing} onRefresh={onRefresh} tintColor={theme.accent} colors={[theme.accent]} progressBackgroundColor={theme.surface1} />\n ) : undefined\n }\n contentContainerStyle={contentContainerStyle as never}\n style={style}\n />\n );\n}\n\nexport type InfiniteListOptions<TPage, TItem, TParam> = {\n /** The query key (a `defineKeys` key): one cache entry for every page. */\n queryKey: readonly unknown[];\n /** Fetches one page (`krizakaFetch`), from its page parameter (a cursor, a page number). */\n queryFn: (context: { pageParam: TParam; signal: AbortSignal }) => Promise<TPage>;\n /** The parameter of the first page (`null` for a cursor, `1` for numbers). */\n initialPageParam: TParam;\n /** The parameter of the page after `lastPage`, or `undefined` / `null` when there is none. */\n getNextPageParam: (lastPage: TPage, pages: TPage[]) => TParam | undefined | null;\n /** The items of a page (`(page) => page.items`). */\n getItems: (page: TPage) => readonly TItem[];\n /** `false` to wait (a missing id). Default `true`. */\n enabled?: boolean;\n /** How long a page stays fresh, in ms (the client's default otherwise). */\n staleTime?: number;\n};\n\n/** What `useInfiniteList` gives: the props of `List` to spread, and the query itself. */\nexport type InfiniteListResult<TPage, TItem, TParam = unknown> = {\n /** `{ data, loading, refreshing, onRefresh, onEndReached, loadingMore }` — spread on `<List>`. */\n listProps: Pick<ListProps<TItem>, \"data\" | \"loading\" | \"refreshing\" | \"onRefresh\" | \"onEndReached\" | \"loadingMore\">;\n /** The failure of the first page, if any: render an `ErrorState` in `error` (a later page's failure keeps the list). */\n error: Error | null;\n /** The query of @krizaka/query (`refetch`, `status`, the pages…). */\n query: UseInfiniteQueryResult<InfiniteData<TPage, TParam>, Error>;\n};\n\n/**\n * A paginated API as a list: `useInfiniteQuery` of @krizaka/query (a list: `meta: { list: true }`, so an error stays in\n * the list), the pages flattened, the next page asked for by `onEndReached` (once at a time, only when there is one),\n * pull to refresh — spread `listProps` on `<List>`.\n */\nexport function useInfiniteList<TPage, TItem, TParam = unknown>({\n queryKey,\n queryFn,\n initialPageParam,\n getNextPageParam,\n getItems,\n enabled,\n staleTime,\n}: InfiniteListOptions<TPage, TItem, TParam>): InfiniteListResult<TPage, TItem, TParam> {\n const query = useInfiniteQuery<TPage, Error, InfiniteData<TPage, TParam>, readonly unknown[], TParam>({\n queryKey,\n queryFn: ({ pageParam, signal }) => queryFn({ pageParam: pageParam as TParam, signal }),\n initialPageParam,\n getNextPageParam: (last, pages) => getNextPageParam(last, pages) ?? undefined,\n enabled,\n staleTime,\n meta: { list: true },\n });\n const [pulled, setPulled] = React.useState(false);\n const { data: pages, hasNextPage, isFetchingNextPage, fetchNextPage, refetch, isPending, isError, isRefetching } = query;\n // eslint-disable-next-line react-hooks/exhaustive-deps -- `getItems` is a projection; the pages decide\n const data = React.useMemo(() => (pages?.pages ?? []).flatMap((page) => getItems(page)), [pages]);\n return {\n listProps: {\n data,\n loading: isPending && enabled !== false,\n refreshing: pulled && isRefetching,\n onRefresh: () => {\n setPulled(true);\n void refetch().finally(() => setPulled(false));\n },\n onEndReached: () => {\n // `cancelRefetch: false`: a render's closure can be stale (FlashList asks again before the next paint), and the\n // default would cancel the page on its way and ask for it a second time.\n if (hasNextPage && !isFetchingNextPage && !isError) void fetchNextPage({ cancelRefetch: false });\n },\n loadingMore: isFetchingNextPage,\n },\n error: isError && !pages ? query.error : null,\n query,\n };\n}\n\nconst styles = StyleSheet.create({\n fill: { flex: 1 },\n separator: { height: StyleSheet.hairlineWidth },\n inset: { marginLeft: 68 },\n skeleton: { flexDirection: \"row\", alignItems: \"center\", gap: 12, paddingHorizontal: 16, paddingVertical: 14 },\n skeletonText: { flex: 1, gap: 8 },\n state: { paddingHorizontal: 16, paddingVertical: 32 },\n more: { paddingVertical: 20, alignItems: \"center\" },\n});\n"],"mappings":";AAGA,SAA4B,wBAAqD;AACjF,SAAS,YAAY,UAAU,SAAS,gBAAgB;AACxD,SAAS,iBAAoC;AAC7C,YAAY,WAAW;AACvB,SAAS,gBAAgC,YAAY,YAA4B;AAkD3E,cACA,YADA;AAHN,SAAS,cAAc;AACrB,SACE,qBAAC,QAAK,OAAO,OAAO,UAAU,eAAW,MACvC;AAAA,wBAAC,YAAS,OAAM,UAAS,OAAO,IAAI,QAAQ,IAAI;AAAA,IAChD,qBAAC,QAAK,OAAO,OAAO,cAClB;AAAA,0BAAC,YAAS,OAAM,OAAM;AAAA,MACtB,oBAAC,YAAS,OAAM,OAAM;AAAA,OACxB;AAAA,KACF;AAEJ;AAEA,IAAM,UAAU,CAAC,UACf,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAO,qBAAe,KAAK,KAAK,WAAW;AAOrF,SAAS,KAAQ;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,EACtB;AAAA,EACA,mBAAmB;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAA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