@krizaka/ui 3.20.0 → 3.22.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 (263) hide show
  1. package/README.md +1 -0
  2. package/dist/action-bar.js +4 -4
  3. package/dist/app-shell.js +1 -1
  4. package/dist/argument-card.js +4 -4
  5. package/dist/blocks.css +1 -1
  6. package/dist/button.js +3 -2
  7. package/dist/card.js +3 -3
  8. package/dist/{chunk-5MH64NIL.js → chunk-2L67YTNV.js} +2 -2
  9. package/dist/{chunk-2NB27LM7.js → chunk-3IN6TOPM.js} +4 -4
  10. package/dist/{chunk-VDR2EP6K.js → chunk-4QN5YJ3D.js} +17 -5
  11. package/dist/chunk-4QN5YJ3D.js.map +1 -0
  12. package/dist/chunk-AQSZJJAJ.js +126 -0
  13. package/dist/chunk-AQSZJJAJ.js.map +1 -0
  14. package/dist/{chunk-3GODX3D6.js → chunk-QDXV544C.js} +2 -2
  15. package/dist/chunk-QDXV544C.js.map +1 -0
  16. package/dist/chunk-R6NK6ZNY.js +1080 -0
  17. package/dist/chunk-R6NK6ZNY.js.map +1 -0
  18. package/dist/chunk-TDG7ED2W.js +1 -0
  19. package/dist/chunk-TDG7ED2W.js.map +1 -0
  20. package/dist/{chunk-LIPK4UCS.js → chunk-YCIBJ6OQ.js} +140 -209
  21. package/dist/chunk-YCIBJ6OQ.js.map +1 -0
  22. package/dist/code-block.js +17 -5
  23. package/dist/code-block.js.map +1 -1
  24. package/dist/comparison-table.d.ts +44 -0
  25. package/dist/comparison-table.js +84 -0
  26. package/dist/comparison-table.js.map +1 -0
  27. package/dist/data-table.js +19 -1066
  28. package/dist/data-table.js.map +1 -1
  29. package/dist/date-picker.js +5 -5
  30. package/dist/date-picker.js.map +1 -1
  31. package/dist/force-update-screen.d.ts +80 -0
  32. package/dist/force-update-screen.js +38 -0
  33. package/dist/force-update-screen.js.map +1 -0
  34. package/dist/genui.d.ts +219 -0
  35. package/dist/genui.js +506 -0
  36. package/dist/genui.js.map +1 -0
  37. package/dist/index.d.ts +17 -24
  38. package/dist/index.js +1 -1
  39. package/dist/maintenance-screen.d.ts +68 -0
  40. package/dist/maintenance-screen.js +35 -0
  41. package/dist/maintenance-screen.js.map +1 -0
  42. package/dist/marketing-layout.js +1 -1
  43. package/dist/marketing-layout.js.map +1 -1
  44. package/dist/media-grid.js +44 -152
  45. package/dist/media-grid.js.map +1 -1
  46. package/dist/meta-row.d.ts +54 -0
  47. package/dist/meta-row.js +35 -0
  48. package/dist/meta-row.js.map +1 -0
  49. package/dist/native.d.ts +92 -16
  50. package/dist/native.js +873 -814
  51. package/dist/native.js.map +1 -1
  52. package/dist/nav-bar.d.ts +30 -7
  53. package/dist/nav-bar.js +71 -17
  54. package/dist/nav-bar.js.map +1 -1
  55. package/dist/page-hero.js +5 -5
  56. package/dist/radio-group.js +1 -1
  57. package/dist/settings-layout.js +1 -1
  58. package/dist/settings-layout.js.map +1 -1
  59. package/dist/site-footer.js +2 -2
  60. package/dist/skip-link.js +1 -1
  61. package/dist/step-showcase.d.ts +62 -0
  62. package/dist/step-showcase.js +227 -0
  63. package/dist/step-showcase.js.map +1 -0
  64. package/dist/tabs.js +2 -2
  65. package/dist/tabs.js.map +1 -1
  66. package/dist/update-prompt.d.ts +86 -0
  67. package/dist/update-prompt.js +41 -0
  68. package/dist/update-prompt.js.map +1 -0
  69. package/dist/video-player.d.ts +1 -1
  70. package/dist/video-player.js +16 -3
  71. package/dist/video-player.js.map +1 -1
  72. package/package.json +108 -9
  73. package/registry/achievement.json +1 -1
  74. package/registry/action-bar.json +1 -1
  75. package/registry/activity-feed.json +1 -1
  76. package/registry/alert.json +1 -1
  77. package/registry/app-shell.json +1 -1
  78. package/registry/argument-card.json +1 -1
  79. package/registry/audio-player.json +1 -1
  80. package/registry/auth-layout.json +1 -1
  81. package/registry/avatar.json +1 -1
  82. package/registry/badge.json +1 -1
  83. package/registry/button.json +1 -1
  84. package/registry/card-grid.json +1 -1
  85. package/registry/card.json +1 -1
  86. package/registry/catalogue-page.json +1 -1
  87. package/registry/changelog-page.json +1 -1
  88. package/registry/chat.json +1 -1
  89. package/registry/checkbox.json +1 -1
  90. package/registry/chip-link.json +1 -1
  91. package/registry/chip.json +1 -1
  92. package/registry/choice-grid.json +1 -1
  93. package/registry/code-block.json +1 -1
  94. package/registry/combobox.json +1 -1
  95. package/registry/command.json +1 -1
  96. package/registry/comparison-table.json +207 -0
  97. package/registry/component-page.json +1 -1
  98. package/registry/confirm-button.json +1 -1
  99. package/registry/contact-page.json +1 -1
  100. package/registry/continue-prompt.json +1 -1
  101. package/registry/countdown.json +1 -1
  102. package/registry/cta-panel.json +1 -1
  103. package/registry/dashboard-layout.json +1 -1
  104. package/registry/data-table.json +1 -1
  105. package/registry/date-picker.json +3 -3
  106. package/registry/decision-list.json +1 -1
  107. package/registry/description-list.json +1 -1
  108. package/registry/detail-layout.json +1 -1
  109. package/registry/dialog.json +1 -1
  110. package/registry/docs-article-page.json +1 -1
  111. package/registry/docs-hub-page.json +1 -1
  112. package/registry/docs-layout.json +1 -1
  113. package/registry/document-viewer.json +1 -1
  114. package/registry/dropdown-menu.json +1 -1
  115. package/registry/empty-state.json +1 -1
  116. package/registry/error-page.json +1 -1
  117. package/registry/examples/comparison-table/versus.d.ts +4 -0
  118. package/registry/examples/comparison-table/versus.js +28 -0
  119. package/registry/examples/comparison-table/versus.tsx +20 -0
  120. package/registry/examples/dialog/native/sheet.dark.png +0 -0
  121. package/registry/examples/dialog/native/sheet.light.png +0 -0
  122. package/registry/examples/force-update-screen/default.d.ts +4 -0
  123. package/registry/examples/force-update-screen/default.js +25 -0
  124. package/registry/examples/force-update-screen/default.tsx +19 -0
  125. package/registry/examples/force-update-screen/native/default.d.ts +4 -0
  126. package/registry/examples/force-update-screen/native/default.dark.png +0 -0
  127. package/registry/examples/force-update-screen/native/default.js +24 -0
  128. package/registry/examples/force-update-screen/native/default.light.png +0 -0
  129. package/registry/examples/force-update-screen/native/default.tsx +18 -0
  130. package/registry/examples/genui/streaming.d.ts +4 -0
  131. package/registry/examples/genui/streaming.js +18 -0
  132. package/registry/examples/genui/streaming.tsx +14 -0
  133. package/registry/examples/genui/table.d.ts +4 -0
  134. package/registry/examples/genui/table.js +19 -0
  135. package/registry/examples/genui/table.tsx +14 -0
  136. package/registry/examples/maintenance-screen/default.d.ts +4 -0
  137. package/registry/examples/maintenance-screen/default.js +22 -0
  138. package/registry/examples/maintenance-screen/default.tsx +16 -0
  139. package/registry/examples/maintenance-screen/native/default.d.ts +4 -0
  140. package/registry/examples/maintenance-screen/native/default.dark.png +0 -0
  141. package/registry/examples/maintenance-screen/native/default.js +21 -0
  142. package/registry/examples/maintenance-screen/native/default.light.png +0 -0
  143. package/registry/examples/maintenance-screen/native/default.tsx +15 -0
  144. package/registry/examples/meta-row/native/video.d.ts +4 -0
  145. package/registry/examples/meta-row/native/video.dark.png +0 -0
  146. package/registry/examples/meta-row/native/video.js +11 -0
  147. package/registry/examples/meta-row/native/video.light.png +0 -0
  148. package/registry/examples/meta-row/native/video.tsx +5 -0
  149. package/registry/examples/meta-row/status.d.ts +4 -0
  150. package/registry/examples/meta-row/status.js +12 -0
  151. package/registry/examples/meta-row/status.tsx +7 -0
  152. package/registry/examples/meta-row/video.d.ts +4 -0
  153. package/registry/examples/meta-row/video.js +12 -0
  154. package/registry/examples/meta-row/video.tsx +7 -0
  155. package/registry/examples/nav-bar/family-product.js +16 -13
  156. package/registry/examples/nav-bar/family-product.tsx +19 -19
  157. package/registry/examples/step-showcase/desktop.d.ts +4 -0
  158. package/registry/examples/step-showcase/desktop.js +24 -0
  159. package/registry/examples/step-showcase/desktop.tsx +19 -0
  160. package/registry/examples/step-showcase/phone.d.ts +4 -0
  161. package/registry/examples/step-showcase/phone.js +24 -0
  162. package/registry/examples/step-showcase/phone.tsx +19 -0
  163. package/registry/examples/update-prompt/default.d.ts +4 -0
  164. package/registry/examples/update-prompt/default.js +24 -0
  165. package/registry/examples/update-prompt/default.tsx +18 -0
  166. package/registry/examples/update-prompt/native/default.d.ts +4 -0
  167. package/registry/examples/update-prompt/native/default.dark.png +0 -0
  168. package/registry/examples/update-prompt/native/default.js +23 -0
  169. package/registry/examples/update-prompt/native/default.light.png +0 -0
  170. package/registry/examples/update-prompt/native/default.tsx +17 -0
  171. package/registry/field.json +1 -1
  172. package/registry/file-upload.json +1 -1
  173. package/registry/filter-bar.json +1 -1
  174. package/registry/force-update-screen.json +323 -0
  175. package/registry/form.json +1 -1
  176. package/registry/gallery-page.json +1 -1
  177. package/registry/genui.json +409 -0
  178. package/registry/glow-card.json +1 -1
  179. package/registry/goal-gauge.json +1 -1
  180. package/registry/how-it-works-page.json +1 -1
  181. package/registry/image-cropper.json +1 -1
  182. package/registry/index.json +223 -4
  183. package/registry/iso.json +1 -1
  184. package/registry/kanban.json +1 -1
  185. package/registry/kbd.json +1 -1
  186. package/registry/landing-page.json +1 -1
  187. package/registry/landscape.json +1 -1
  188. package/registry/legal-page.json +1 -1
  189. package/registry/link-card.json +1 -1
  190. package/registry/list.json +1 -1
  191. package/registry/loader.json +1 -1
  192. package/registry/longform-page.json +1 -1
  193. package/registry/maintenance-screen.json +259 -0
  194. package/registry/map.json +2 -2
  195. package/registry/markdown.json +1 -1
  196. package/registry/marketing-layout.json +1 -1
  197. package/registry/marquee.json +1 -1
  198. package/registry/mascot-quote.json +1 -1
  199. package/registry/mascot-state.json +1 -1
  200. package/registry/mascots.json +1 -1
  201. package/registry/match-dialog.json +1 -1
  202. package/registry/media-capture.json +1 -1
  203. package/registry/media-grid.json +2 -2
  204. package/registry/meta-row.json +215 -0
  205. package/registry/meter.json +1 -1
  206. package/registry/nav-bar.json +58 -25
  207. package/registry/number-ticker.json +1 -1
  208. package/registry/page-header.json +1 -1
  209. package/registry/page-hero.json +1 -1
  210. package/registry/page.json +1 -1
  211. package/registry/pagination.json +1 -1
  212. package/registry/photo-grid.json +1 -1
  213. package/registry/pointer-light.json +1 -1
  214. package/registry/popover.json +1 -1
  215. package/registry/pricing-page.json +1 -1
  216. package/registry/product-page.json +1 -1
  217. package/registry/profile-card.json +1 -1
  218. package/registry/progress.json +1 -1
  219. package/registry/promise-card.json +1 -1
  220. package/registry/radio-group.json +2 -2
  221. package/registry/recipes.json +1 -1
  222. package/registry/scroll-stage.json +1 -1
  223. package/registry/search-field.json +1 -1
  224. package/registry/section-backdrop.json +1 -1
  225. package/registry/separator.json +1 -1
  226. package/registry/settings-layout.json +2 -2
  227. package/registry/showcase.json +1 -1
  228. package/registry/site-footer.json +13 -13
  229. package/registry/sites.json +1 -1
  230. package/registry/skeleton.json +1 -1
  231. package/registry/skip-link.json +2 -2
  232. package/registry/slider.json +1 -1
  233. package/registry/slot.json +1 -1
  234. package/registry/spinner.json +1 -1
  235. package/registry/split-view.json +1 -1
  236. package/registry/stage-banner.json +1 -1
  237. package/registry/stat.json +1 -1
  238. package/registry/status-page.json +1 -1
  239. package/registry/step-progress.json +1 -1
  240. package/registry/step-showcase.json +296 -0
  241. package/registry/stepper.json +1 -1
  242. package/registry/swipe-deck.json +1 -1
  243. package/registry/switch.json +1 -1
  244. package/registry/tabs.json +3 -3
  245. package/registry/tag-input.json +1 -1
  246. package/registry/tag-selector.json +1 -1
  247. package/registry/terminal-replay.json +1 -1
  248. package/registry/theme.json +1 -1
  249. package/registry/toast.json +1 -1
  250. package/registry/toc.json +1 -1
  251. package/registry/tooltip.json +1 -1
  252. package/registry/tree-view.json +1 -1
  253. package/registry/update-prompt.json +316 -0
  254. package/registry/verified-badge.json +1 -1
  255. package/registry/vertical-video.json +1 -1
  256. package/registry/video-player.json +4 -4
  257. package/registry/video-trimmer.json +1 -1
  258. package/registry/virtual.json +1 -1
  259. package/dist/chunk-3GODX3D6.js.map +0 -1
  260. package/dist/chunk-LIPK4UCS.js.map +0 -1
  261. package/dist/chunk-VDR2EP6K.js.map +0 -1
  262. /package/dist/{chunk-5MH64NIL.js.map → chunk-2L67YTNV.js.map} +0 -0
  263. /package/dist/{chunk-2NB27LM7.js.map → chunk-3IN6TOPM.js.map} +0 -0
@@ -0,0 +1,80 @@
1
+ import * as tailwind_variants from 'tailwind-variants';
2
+ import * as React from 'react';
3
+
4
+ declare const forceUpdateScreen: tailwind_variants.TVReturnType<{
5
+ [key: string]: {
6
+ [key: string]: tailwind_variants.ClassValue | {
7
+ mark?: tailwind_variants.ClassValue;
8
+ title?: tailwind_variants.ClassValue;
9
+ version?: tailwind_variants.ClassValue;
10
+ root?: tailwind_variants.ClassValue;
11
+ message?: tailwind_variants.ClassValue;
12
+ actions?: tailwind_variants.ClassValue;
13
+ };
14
+ };
15
+ } | {
16
+ [x: string]: {
17
+ [x: string]: tailwind_variants.ClassValue | {
18
+ mark?: tailwind_variants.ClassValue;
19
+ title?: tailwind_variants.ClassValue;
20
+ version?: tailwind_variants.ClassValue;
21
+ root?: tailwind_variants.ClassValue;
22
+ message?: tailwind_variants.ClassValue;
23
+ actions?: tailwind_variants.ClassValue;
24
+ };
25
+ };
26
+ } | {}, {
27
+ root: string;
28
+ mark: string;
29
+ title: string;
30
+ message: string;
31
+ version: string;
32
+ actions: string;
33
+ }, undefined, {
34
+ [key: string]: {
35
+ [key: string]: tailwind_variants.ClassValue | {
36
+ mark?: tailwind_variants.ClassValue;
37
+ title?: tailwind_variants.ClassValue;
38
+ version?: tailwind_variants.ClassValue;
39
+ root?: tailwind_variants.ClassValue;
40
+ message?: tailwind_variants.ClassValue;
41
+ actions?: tailwind_variants.ClassValue;
42
+ };
43
+ };
44
+ } | {}, {
45
+ root: string;
46
+ mark: string;
47
+ title: string;
48
+ message: string;
49
+ version: string;
50
+ actions: string;
51
+ }, tailwind_variants.TVReturnTypeLike<unknown, {
52
+ root: string;
53
+ mark: string;
54
+ title: string;
55
+ message: string;
56
+ version: string;
57
+ actions: string;
58
+ }>>;
59
+ type ForceUpdateScreenProps = Omit<React.ComponentProps<"main">, "title"> & {
60
+ /** The headline (“Update to keep going”). */
61
+ title: React.ReactNode;
62
+ /** Why, in a sentence — the backend's localized `message`. */
63
+ message?: React.ReactNode;
64
+ /** The versions, in words and mono (“You have 1.1.0 · 1.2.0 or later is required”). */
65
+ versionLabel?: React.ReactNode;
66
+ /** The product's mark or mascot (decorative). */
67
+ mark?: React.ReactNode;
68
+ /** The button that updates (“Update the app”). */
69
+ updateLabel: string;
70
+ /** Opens the store page. */
71
+ onUpdate: () => void;
72
+ /** A secondary way (“Check again”) once the update is installed — optional. */
73
+ retryLabel?: string;
74
+ /** Checks the backend again. */
75
+ onRetry?: () => void;
76
+ };
77
+ /** The forced update: one thing to do, and the way to do it. */
78
+ declare function ForceUpdateScreen({ title, message, versionLabel, mark, updateLabel, onUpdate, retryLabel, onRetry, className, ...props }: ForceUpdateScreenProps): React.JSX.Element;
79
+
80
+ export { ForceUpdateScreen, type ForceUpdateScreenProps, forceUpdateScreen };
@@ -0,0 +1,38 @@
1
+ import "./chunk-TDG7ED2W.js";
2
+ import {
3
+ Button
4
+ } from "./chunk-3IN6TOPM.js";
5
+ import "./chunk-43PTCDTL.js";
6
+ import "./chunk-2VNYHG4E.js";
7
+
8
+ // src/force-update-screen/force-update-screen.tsx
9
+ import { tv } from "tailwind-variants";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ var forceUpdateScreen = tv({
12
+ slots: {
13
+ root: "mx-auto flex min-h-dvh w-full max-w-md flex-col items-center justify-center gap-4 px-6 py-12 text-center text-fg",
14
+ mark: "flex h-24 w-24 items-center justify-center [&>svg]:h-24 [&>svg]:w-24",
15
+ title: "text-2xl font-semibold text-fg",
16
+ message: "text-fg-secondary",
17
+ version: "font-mono text-xs text-fg-tertiary",
18
+ actions: "mt-2 flex w-full flex-col gap-2"
19
+ }
20
+ });
21
+ function ForceUpdateScreen({ title, message, versionLabel, mark, updateLabel, onUpdate, retryLabel, onRetry, className, ...props }) {
22
+ const s = forceUpdateScreen();
23
+ return /* @__PURE__ */ jsxs("main", { "data-kind": "update-force", className: s.root({ className }), ...props, children: [
24
+ mark && /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: s.mark(), children: mark }),
25
+ /* @__PURE__ */ jsx("h1", { className: s.title(), children: title }),
26
+ message && /* @__PURE__ */ jsx("p", { className: s.message(), children: message }),
27
+ versionLabel && /* @__PURE__ */ jsx("p", { className: s.version(), children: versionLabel }),
28
+ /* @__PURE__ */ jsxs("div", { className: s.actions(), children: [
29
+ /* @__PURE__ */ jsx(Button, { variant: "primary", size: "lg", shape: "cut", shimmer: true, autoFocus: true, onClick: onUpdate, children: updateLabel }),
30
+ retryLabel && onRetry && /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: onRetry, children: retryLabel })
31
+ ] })
32
+ ] });
33
+ }
34
+ export {
35
+ ForceUpdateScreen,
36
+ forceUpdateScreen
37
+ };
38
+ //# sourceMappingURL=force-update-screen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/force-update-screen/force-update-screen.tsx"],"sourcesContent":["// Server-safe. The blocking screen: this version can no longer run. It replaces the app, it is not laid over it —\n// nothing behind it is reachable. Every word is a prop; the store URL and the versions come from the backend.\nimport { Button } from \"@krizaka/ui/button\";\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nexport const forceUpdateScreen = tv({\n slots: {\n root: \"mx-auto flex min-h-dvh w-full max-w-md flex-col items-center justify-center gap-4 px-6 py-12 text-center text-fg\",\n mark: \"flex h-24 w-24 items-center justify-center [&>svg]:h-24 [&>svg]:w-24\",\n title: \"text-2xl font-semibold text-fg\",\n message: \"text-fg-secondary\",\n version: \"font-mono text-xs text-fg-tertiary\",\n actions: \"mt-2 flex w-full flex-col gap-2\",\n },\n});\n\nexport type ForceUpdateScreenProps = Omit<React.ComponentProps<\"main\">, \"title\"> & {\n /** The headline (“Update to keep going”). */\n title: React.ReactNode;\n /** Why, in a sentence — the backend's localized `message`. */\n message?: React.ReactNode;\n /** The versions, in words and mono (“You have 1.1.0 · 1.2.0 or later is required”). */\n versionLabel?: React.ReactNode;\n /** The product's mark or mascot (decorative). */\n mark?: React.ReactNode;\n /** The button that updates (“Update the app”). */\n updateLabel: string;\n /** Opens the store page. */\n onUpdate: () => void;\n /** A secondary way (“Check again”) once the update is installed — optional. */\n retryLabel?: string;\n /** Checks the backend again. */\n onRetry?: () => void;\n};\n\n/** The forced update: one thing to do, and the way to do it. */\nexport function ForceUpdateScreen({ title, message, versionLabel, mark, updateLabel, onUpdate, retryLabel, onRetry, className, ...props }: ForceUpdateScreenProps) {\n const s = forceUpdateScreen();\n return (\n <main data-kind=\"update-force\" className={s.root({ className })} {...props}>\n {mark && (\n <div aria-hidden className={s.mark()}>\n {mark}\n </div>\n )}\n <h1 className={s.title()}>{title}</h1>\n {message && <p className={s.message()}>{message}</p>}\n {versionLabel && <p className={s.version()}>{versionLabel}</p>}\n <div className={s.actions()}>\n <Button variant=\"primary\" size=\"lg\" shape=\"cut\" shimmer autoFocus onClick={onUpdate}>\n {updateLabel}\n </Button>\n {retryLabel && onRetry && (\n <Button variant=\"ghost\" onClick={onRetry}>\n {retryLabel}\n </Button>\n )}\n </div>\n </main>\n );\n}\n"],"mappings":";;;;;;;;AAIA,SAAS,UAAU;AAsCX,cAOF,YAPE;AApCD,IAAM,oBAAoB,GAAG;AAAA,EAClC,OAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AACF,CAAC;AAsBM,SAAS,kBAAkB,EAAE,OAAO,SAAS,cAAc,MAAM,aAAa,UAAU,YAAY,SAAS,WAAW,GAAG,MAAM,GAA2B;AACjK,QAAM,IAAI,kBAAkB;AAC5B,SACE,qBAAC,UAAK,aAAU,gBAAe,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,GAAI,GAAG,OAClE;AAAA,YACC,oBAAC,SAAI,eAAW,MAAC,WAAW,EAAE,KAAK,GAChC,gBACH;AAAA,IAEF,oBAAC,QAAG,WAAW,EAAE,MAAM,GAAI,iBAAM;AAAA,IAChC,WAAW,oBAAC,OAAE,WAAW,EAAE,QAAQ,GAAI,mBAAQ;AAAA,IAC/C,gBAAgB,oBAAC,OAAE,WAAW,EAAE,QAAQ,GAAI,wBAAa;AAAA,IAC1D,qBAAC,SAAI,WAAW,EAAE,QAAQ,GACxB;AAAA,0BAAC,UAAO,SAAQ,WAAU,MAAK,MAAK,OAAM,OAAM,SAAO,MAAC,WAAS,MAAC,SAAS,UACxE,uBACH;AAAA,MACC,cAAc,WACb,oBAAC,UAAO,SAAQ,SAAQ,SAAS,SAC9B,sBACH;AAAA,OAEJ;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,219 @@
1
+ import * as React from 'react';
2
+
3
+ /** The protocol version every message carries. */
4
+ declare const GENUI_VERSION = "v0.9";
5
+ /** The catalog a surface must name: the Krizaka components, version 1. */
6
+ declare const GENUI_CATALOG_ID = "krizaka:genui/v1";
7
+ /** The bounds of a surface — what a model may ask for, at most. */
8
+ declare const GENUI_LIMITS: {
9
+ /** Components per surface. */
10
+ readonly components: 300;
11
+ /** Nesting depth from the root. */
12
+ readonly depth: 12;
13
+ /** Characters in one string. */
14
+ readonly string: 4000;
15
+ /** Items in one array of the data model. */
16
+ readonly array: 1000;
17
+ /** Nesting depth of a data model value. */
18
+ readonly dataDepth: 12;
19
+ /** Values (objects, arrays, scalars) in one data model update. */
20
+ readonly dataNodes: 50000;
21
+ /** Segments of a data path. */
22
+ readonly pathSegments: 16;
23
+ };
24
+ /** One component as the model writes it: an id, the catalog name, its properties. */
25
+ type GenUiComponent = {
26
+ readonly id: string;
27
+ readonly component: string;
28
+ } & Readonly<Record<string, unknown>>;
29
+ /** A value bound to the data model: `{ "path": "/rows" }`. */
30
+ type GenUiBinding = {
31
+ readonly path: string;
32
+ };
33
+ /** The four messages of A2UI v0.9. */
34
+ type GenUiMessage = {
35
+ readonly version: typeof GENUI_VERSION;
36
+ readonly createSurface: {
37
+ readonly surfaceId: string;
38
+ readonly catalogId: string;
39
+ };
40
+ } | {
41
+ readonly version: typeof GENUI_VERSION;
42
+ readonly updateComponents: {
43
+ readonly surfaceId: string;
44
+ readonly components: readonly GenUiComponent[];
45
+ };
46
+ } | {
47
+ readonly version: typeof GENUI_VERSION;
48
+ readonly updateDataModel: {
49
+ readonly surfaceId: string;
50
+ readonly path: string;
51
+ readonly value?: unknown;
52
+ };
53
+ } | {
54
+ readonly version: typeof GENUI_VERSION;
55
+ readonly deleteSurface: {
56
+ readonly surfaceId: string;
57
+ };
58
+ };
59
+ /** What validating a message says. */
60
+ type GenUiResult<T> = {
61
+ readonly ok: true;
62
+ readonly value: T;
63
+ } | {
64
+ readonly ok: false;
65
+ readonly error: string;
66
+ };
67
+ /** How a catalog entry checks a component's own properties: `null` when they are fine, else why not. */
68
+ type GenUiPropsCheck = (component: GenUiComponent) => string | null;
69
+ /** An id of a surface or a component, or why not. */
70
+ declare function checkId(value: unknown, where: string): string | null;
71
+ /** The segments of a JSON pointer (`/a/b/0`), or why it is refused — `__proto__` and friends never pass. */
72
+ declare function parsePath(path: unknown): GenUiResult<readonly string[]>;
73
+ /** `true` when the value is a binding `{ path }` (and only that). */
74
+ declare function isBinding(value: unknown): value is GenUiBinding;
75
+ /**
76
+ * A copy of a data model value that is plain JSON within the limits — strings, finite numbers, booleans, null, arrays
77
+ * and plain objects — or why it is refused. The copy has a null prototype for every object: nothing it holds can
78
+ * reach `Object.prototype`.
79
+ */
80
+ declare function sanitizeData(value: unknown): GenUiResult<unknown>;
81
+ /**
82
+ * A message as the model sent it — parsed and checked against the spec and the catalog, or why it is refused. A
83
+ * component's own properties are checked by its catalog entry; a component the catalog does not hold is refused.
84
+ */
85
+ declare function validateMessage(input: unknown, catalog: Readonly<Record<string, {
86
+ readonly check: GenUiPropsCheck;
87
+ }>>): GenUiResult<GenUiMessage>;
88
+ /** Why the component's keys are refused, or null: only `id`, `component` and the entry's own keys. */
89
+ declare function allowKeys(component: GenUiComponent, keys: readonly string[]): string | null;
90
+ /** A short text (or a binding to one), required or not. */
91
+ declare function checkText(value: unknown, name: string, required: boolean): string | null;
92
+ /** A value among a closed list. */
93
+ declare function checkEnum(value: unknown, name: string, allowed: readonly string[], required?: boolean): string | null;
94
+ /** A list of child ids. */
95
+ declare function checkChildren(value: unknown, name?: string): string | null;
96
+ /** A binding to the data model (required). */
97
+ declare function checkBinding(value: unknown, name: string): string | null;
98
+ /** A number, or a binding to one. */
99
+ declare function checkNumber(value: unknown, name: string, required: boolean): string | null;
100
+ /** The value formats a model may name. */
101
+ declare const GENUI_FORMATS: readonly ["number", "integer", "compact", "percent", "money"];
102
+ type GenUiFormat = (typeof GENUI_FORMATS)[number];
103
+ /** A three-letter currency code. */
104
+ declare function checkCurrency(value: unknown, required: boolean): string | null;
105
+
106
+ /** One surface: its components by id, and its data model. */
107
+ type GenUiSurfaceState = {
108
+ readonly id: string;
109
+ readonly components: ReadonlyMap<string, GenUiComponent>;
110
+ readonly data: unknown;
111
+ };
112
+ /** Every surface of a stream, and what was refused on the way. */
113
+ type GenUiState = {
114
+ readonly surfaces: ReadonlyMap<string, GenUiSurfaceState>;
115
+ /** The order surfaces were created in. */
116
+ readonly order: readonly string[];
117
+ /** Why messages were dropped, in order (a dropped message leaves the rest of the surface as it was). */
118
+ readonly errors: readonly string[];
119
+ };
120
+ declare const emptyGenUiState: GenUiState;
121
+ /** The value at a JSON pointer of the data model, `undefined` when there is none. */
122
+ declare function readPath(data: unknown, path: string): unknown;
123
+ /** The state after one validated message. */
124
+ declare function applyMessage(state: GenUiState, message: GenUiMessage): GenUiState;
125
+ /** The state after a line of JSON (one message), the line refused with its reason when it is not valid. */
126
+ declare function applyLine(state: GenUiState, line: string, catalog: Readonly<Record<string, {
127
+ readonly check: GenUiPropsCheck;
128
+ }>>): GenUiState;
129
+ /** Where a fenced `a2ui` block sits in a text: its JSON Lines so far, whether it is closed, and the prose around it. */
130
+ type GenUiExtract = {
131
+ readonly lines: readonly string[];
132
+ readonly closed: boolean;
133
+ readonly prose: string;
134
+ readonly found: boolean;
135
+ };
136
+ /**
137
+ * Splits a model's answer — complete or still arriving — into its prose and the complete lines of its `a2ui` fence.
138
+ * A line still being written (no newline yet, the fence open) is left for the next call: the surface grows message by
139
+ * message as the answer streams.
140
+ */
141
+ declare function extractGenUi(text: string): GenUiExtract;
142
+ /** The state of every surface a model's answer describes so far. */
143
+ declare function readStream(text: string, catalog: Readonly<Record<string, {
144
+ readonly check: GenUiPropsCheck;
145
+ }>>): GenUiState & {
146
+ readonly prose: string;
147
+ readonly found: boolean;
148
+ };
149
+
150
+ /** What an entry gets to draw a component. */
151
+ type GenUiRenderContext = {
152
+ /** A child by id: drawn, a skeleton while it has not arrived, nothing when refused. */
153
+ child: (id: unknown) => React.ReactNode;
154
+ /** Children by id, in order. */
155
+ children: (ids: unknown) => React.ReactNode[];
156
+ /** A literal, or the value a binding `{ path }` points at in the data model. */
157
+ resolve: (value: unknown) => unknown;
158
+ /** The words of the surface. */
159
+ labels: GenUiLabels;
160
+ /** The locale numbers and dates are written in. */
161
+ locale: string;
162
+ };
163
+ /** One component of a catalog: how its properties are checked, how it is drawn. */
164
+ type GenUiEntry = {
165
+ /** `null` when the component's own properties are fine, else why not (the message is refused). */
166
+ readonly check: GenUiPropsCheck;
167
+ /** Draws the component. */
168
+ readonly render: (component: GenUiComponent, context: GenUiRenderContext) => React.ReactNode;
169
+ };
170
+ /** The components a model may use, by name: `baseGenUiCatalog`, merged with `chartsGenUiCatalog` of @krizaka/charts. */
171
+ type GenUiCatalog = Readonly<Record<string, GenUiEntry>>;
172
+ /** The surface's own words (passed translated). */
173
+ type GenUiLabels = {
174
+ /** Announced while the surface is still arriving. */
175
+ loading: string;
176
+ /** The accessible name of the surface. */
177
+ surface: string;
178
+ /** Under a table whose data has not arrived or is not a list. */
179
+ noData: string;
180
+ };
181
+ declare const genUiLabels: GenUiLabels;
182
+ type GenUiSurfaceProps = {
183
+ /** The surface to draw (from `readStream` or `applyMessage`). */
184
+ surface: GenUiSurfaceState;
185
+ /** The components it may use. */
186
+ catalog: GenUiCatalog;
187
+ /** The answer is still arriving: missing children are skeletons and the surface is busy. */
188
+ streaming?: boolean;
189
+ /** The surface's words. */
190
+ labels?: Partial<GenUiLabels>;
191
+ /** The locale numbers are written in. Default `en`. */
192
+ locale?: string;
193
+ /** Called with what could not be drawn (a cycle, a missing child once the answer is complete). */
194
+ onError?: (error: string) => void;
195
+ /** Extra classes on the frame. */
196
+ className?: string;
197
+ };
198
+ /** One surface, drawn from its root. */
199
+ declare function GenUiSurface({ surface, catalog, streaming, labels, locale, onError, className }: GenUiSurfaceProps): React.JSX.Element;
200
+ type GenUiStreamProps = Omit<GenUiSurfaceProps, "surface"> & {
201
+ /** A model's answer, complete or still arriving: its prose and its `a2ui` fence. */
202
+ text: string;
203
+ /** Draws the prose (markdown in a chat); default: paragraphs of text. */
204
+ renderProse?: (prose: string) => React.ReactNode;
205
+ /** What to show when the answer holds no valid surface: the answer itself, as text (the fallback). */
206
+ fallback?: (text: string) => React.ReactNode;
207
+ };
208
+ /**
209
+ * A model's answer with its generated view: the prose, then every surface of its `a2ui` fence, growing as the answer
210
+ * streams. An answer without a valid surface falls back to its text.
211
+ */
212
+ declare function GenUiStream({ text, catalog, streaming, renderProse, fallback, onError, ...rest }: GenUiStreamProps): React.JSX.Element;
213
+
214
+ /** A number written in one of the closed formats. */
215
+ declare function formatGenUiValue(value: unknown, format: GenUiFormat | undefined, locale: string, currency?: string): string;
216
+ /** `Column`, `Row`, `Text`, `Card`, `Callout`, `Table` — the catalog @krizaka/ui draws on its own. */
217
+ declare const baseGenUiCatalog: GenUiCatalog;
218
+
219
+ export { GENUI_CATALOG_ID, GENUI_FORMATS, GENUI_LIMITS, GENUI_VERSION, type GenUiBinding, type GenUiCatalog, type GenUiComponent, type GenUiEntry, type GenUiExtract, type GenUiFormat, type GenUiLabels, type GenUiMessage, type GenUiPropsCheck, type GenUiRenderContext, type GenUiResult, type GenUiState, GenUiStream, type GenUiStreamProps, GenUiSurface, type GenUiSurfaceProps, type GenUiSurfaceState, allowKeys, applyLine, applyMessage, baseGenUiCatalog, checkBinding, checkChildren, checkCurrency, checkEnum, checkId, checkNumber, checkText, emptyGenUiState, extractGenUi, formatGenUiValue, genUiLabels, isBinding, parsePath, readPath, readStream, sanitizeData, validateMessage };