@jini-ai/ui 0.3.14 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/README.md +120 -26
  3. package/dist/browser/index.js +1 -1
  4. package/dist/browser/useDismissOnOutsideOrEscape.d.ts +10 -1
  5. package/dist/browser/useDismissOnOutsideOrEscape.js +7 -4
  6. package/dist/browser/useGlobalKeydown.d.ts +14 -2
  7. package/dist/browser/useGlobalKeydown.js +8 -17
  8. package/dist/features/a2ui/catalog-from-registry.d.ts +6 -3
  9. package/dist/features/a2ui/catalog-from-registry.js +1 -1
  10. package/dist/features/a2ui/index.d.ts +1 -1
  11. package/dist/features/a2ui/protocol.d.ts +1 -1
  12. package/dist/features/a2ui/renderer.js +23 -10
  13. package/dist/features/a2ui/use-a2ui-surface.d.ts +11 -6
  14. package/dist/features/a2ui/use-a2ui-surface.js +40 -10
  15. package/dist/features/admin-widgets/components/ComingSoonNotice.d.ts +11 -0
  16. package/dist/features/admin-widgets/components/ComingSoonNotice.js +7 -0
  17. package/dist/features/admin-widgets/components/ComingSoonPanel.d.ts +10 -0
  18. package/dist/features/admin-widgets/components/ComingSoonPanel.js +10 -0
  19. package/dist/features/admin-widgets/components/ImagePreviewModal.d.ts +16 -0
  20. package/dist/features/admin-widgets/components/ImagePreviewModal.hooks.d.ts +13 -0
  21. package/dist/features/admin-widgets/components/ImagePreviewModal.hooks.js +46 -0
  22. package/dist/features/admin-widgets/components/ImagePreviewModal.js +13 -0
  23. package/dist/features/admin-widgets/components/InfoTip.d.ts +18 -0
  24. package/dist/features/admin-widgets/components/InfoTip.hooks.d.ts +16 -0
  25. package/dist/features/admin-widgets/components/InfoTip.hooks.js +45 -0
  26. package/dist/features/admin-widgets/components/InfoTip.js +12 -0
  27. package/dist/features/admin-widgets/components/SeeMore/SeeMore.d.ts +41 -0
  28. package/dist/features/admin-widgets/components/SeeMore/SeeMore.hooks.d.ts +14 -0
  29. package/dist/features/admin-widgets/components/SeeMore/SeeMore.hooks.js +57 -0
  30. package/dist/features/admin-widgets/components/SeeMore/SeeMore.js +24 -0
  31. package/dist/features/admin-widgets/components/Select/Select.d.ts +39 -0
  32. package/dist/features/admin-widgets/components/Select/Select.hooks.d.ts +105 -0
  33. package/dist/features/admin-widgets/components/Select/Select.hooks.js +359 -0
  34. package/dist/features/admin-widgets/components/Select/Select.js +46 -0
  35. package/dist/features/admin-widgets/index.d.ts +20 -0
  36. package/dist/features/admin-widgets/index.js +11 -0
  37. package/dist/features/admin-widgets/styles/admin-widgets.css +2 -0
  38. package/dist/features/appearance/constants.d.ts +2 -2
  39. package/dist/features/appearance/constants.js +2 -1
  40. package/dist/features/appearance/react/components/AppearanceTab.js +5 -5
  41. package/dist/features/appearance/rules.d.ts +10 -4
  42. package/dist/features/appearance/rules.js +5 -5
  43. package/dist/features/appearance/types.d.ts +1 -1
  44. package/dist/features/appearance/types.js +1 -1
  45. package/dist/features/asset-grid/react/components/AssetGrid.js +1 -1
  46. package/dist/features/asset-grid/react/components/DeleteConfirmDialog.js +1 -1
  47. package/dist/features/asset-grid/react/hooks/useAssetGridKeyboardShortcuts.js +23 -21
  48. package/dist/features/asset-grid/react/hooks/useAssetGridLiveUpdates.d.ts +1 -1
  49. package/dist/features/asset-grid/react/hooks/useAssetGridLiveUpdates.js +1 -1
  50. package/dist/features/asset-tree-browser/ports.d.ts +3 -1
  51. package/dist/features/asset-tree-browser/react/hooks/useAssetTreeCopyLocalPath.js +1 -1
  52. package/dist/features/browser-chrome/react/components/BrowserViewportControls.js +1 -1
  53. package/dist/features/browser-chrome/types.js +1 -1
  54. package/dist/features/command-palette/ports.js +1 -1
  55. package/dist/features/connectors/ConnectorsBrowser.js +2 -2
  56. package/dist/features/connectors/components/ConnectorCard.js +3 -3
  57. package/dist/features/connectors/components/ConnectorDetailDrawer.js +1 -1
  58. package/dist/features/connectors/components/ConnectorGrid.js +2 -2
  59. package/dist/features/connectors/components/ConnectorSearchBar.js +2 -2
  60. package/dist/features/connectors/components/ProviderTabBar.js +2 -2
  61. package/dist/features/connectors/constants.d.ts +1 -1
  62. package/dist/features/connectors/constants.js +1 -1
  63. package/dist/features/connectors/hooks/useConnectorAuthorization.js +1 -1
  64. package/dist/features/connectors/rules.d.ts +2 -2
  65. package/dist/features/connectors/rules.js +1 -1
  66. package/dist/features/connectors/types.d.ts +2 -2
  67. package/dist/features/connectors/types.js +1 -1
  68. package/dist/features/execution/react/components/ByokProviderForm.js +3 -3
  69. package/dist/features/execution/react/components/ExecutionTab.js +2 -2
  70. package/dist/features/execution/react/components/LocalCliAgentCard.js +3 -3
  71. package/dist/features/execution/react/components/LocalCliAgentList.js +2 -2
  72. package/dist/features/execution/react/components/ProviderChipGroup.js +2 -2
  73. package/dist/features/execution/react/components/SearchableModelSelect.js +1 -1
  74. package/dist/features/execution/rules.js +1 -1
  75. package/dist/features/file-dropzone/react/components/FileDropzone.js +5 -3
  76. package/dist/features/file-dropzone/react/hooks/useFileDropzone.d.ts +1 -1
  77. package/dist/features/file-dropzone/react/hooks/useFileDropzone.js +1 -1
  78. package/dist/features/file-dropzone/types.d.ts +1 -1
  79. package/dist/features/file-dropzone/types.js +1 -1
  80. package/dist/features/folder-path-drop/react/hooks/useFolderPathDropCapture.js +6 -4
  81. package/dist/features/html-editor/canvas-content-wrapper.js +1 -1
  82. package/dist/features/html-editor/canvas-embed-placeholders.js +7 -7
  83. package/dist/features/html-editor/canvas-style.d.ts +4 -0
  84. package/dist/features/html-editor/canvas-style.js +6 -21
  85. package/dist/features/html-viewer/constants.d.ts +1 -1
  86. package/dist/features/html-viewer/constants.js +1 -1
  87. package/dist/features/html-viewer/react/components/PresentMenu.js +1 -1
  88. package/dist/features/html-viewer/react/components/ZoomMenu.js +1 -1
  89. package/dist/features/html-viewer/types.d.ts +1 -1
  90. package/dist/features/html-viewer/types.js +1 -1
  91. package/dist/features/i18n/dictionaries/index.d.ts +2 -3
  92. package/dist/features/i18n/dictionaries/settings-dialog.en.d.ts +1 -1
  93. package/dist/features/i18n/dictionary-translator.d.ts +16 -0
  94. package/dist/features/i18n/dictionary-translator.js +14 -0
  95. package/dist/features/i18n/index.d.ts +3 -0
  96. package/dist/features/i18n/index.js +2 -0
  97. package/dist/features/i18n/locale.d.ts +1 -1
  98. package/dist/features/i18n/template-i18n.d.ts +26 -0
  99. package/dist/features/i18n/template-i18n.js +36 -0
  100. package/dist/features/iframe-pool/react/components/IframeKeepAliveProvider.d.ts +1 -1
  101. package/dist/features/iframe-pool/react/components/IframeKeepAliveProvider.js +1 -1
  102. package/dist/features/instructions/react/components/InstructionsTab.js +1 -1
  103. package/dist/features/integrations/react/components/ClientPicker.js +4 -4
  104. package/dist/features/integrations/react/components/CodexInstallToggleButton.js +1 -1
  105. package/dist/features/integrations/react/components/IntegrationsTab.js +2 -2
  106. package/dist/features/integrations/react/components/SnippetBlock.js +1 -1
  107. package/dist/features/integrations/types.d.ts +1 -1
  108. package/dist/features/integrations/types.js +1 -1
  109. package/dist/features/interactive-ui/index.js +13 -13
  110. package/dist/features/interactive-ui/interactive-ui.css +1 -1
  111. package/dist/features/interactive-ui/providers/recharts/bar-chart.js +1 -1
  112. package/dist/features/interactive-ui/providers/recharts/line-chart.js +1 -1
  113. package/dist/features/interactive-ui/providers/recharts/pie-chart.js +2 -2
  114. package/dist/features/interactive-ui/providers/shadcn/lib/utils.d.ts +1 -1
  115. package/dist/features/interactive-ui/providers/shadcn/lib/utils.js +1 -1
  116. package/dist/features/interactive-ui/registry.d.ts +15 -4
  117. package/dist/features/interactive-ui/registry.js +5 -5
  118. package/dist/features/language/react/components/LanguageTab.js +2 -2
  119. package/dist/features/list-detail-panel/types.d.ts +1 -1
  120. package/dist/features/list-detail-panel/types.js +1 -1
  121. package/dist/features/mcp-ui/confirmation-store.js +2 -1
  122. package/dist/features/mcp-ui/surfaces/tokens.d.ts +17 -20
  123. package/dist/features/mcp-ui/surfaces/tokens.js +33 -35
  124. package/dist/features/media-providers/index.d.ts +1 -1
  125. package/dist/features/media-providers/index.js +1 -1
  126. package/dist/features/media-providers/react/components/MediaProvidersTab.js +4 -4
  127. package/dist/features/media-providers/rules.js +1 -1
  128. package/dist/features/memory/async-commit-guard.d.ts +1 -1
  129. package/dist/features/memory/constants.d.ts +1 -1
  130. package/dist/features/memory/constants.js +1 -1
  131. package/dist/features/memory/dependencies.d.ts +11 -23
  132. package/dist/features/memory/dependencies.js +116 -106
  133. package/dist/features/memory/index.d.ts +1 -1
  134. package/dist/features/memory/index.js +1 -1
  135. package/dist/features/memory/react/components/MemoryAdvancedModal.js +2 -2
  136. package/dist/features/memory/react/components/MemoryEntryCard.js +1 -1
  137. package/dist/features/memory/react/components/MemoryExtractionCard.js +1 -1
  138. package/dist/features/memory/react/components/MemoryHooksPanel.js +1 -1
  139. package/dist/features/memory/react/components/MemoryList.js +5 -5
  140. package/dist/features/memory/react/components/MemoryManualEditor.js +5 -5
  141. package/dist/features/memory/react/components/MemorySettingsPanel.js +1 -1
  142. package/dist/features/memory/react/hooks/useMemoryEntries.hooks.js +1 -1
  143. package/dist/features/memory/react/hooks/useMemoryNavigation.hooks.js +1 -1
  144. package/dist/features/memory/react/styles.js +1 -1
  145. package/dist/features/memory/rules.js +1 -1
  146. package/dist/features/memory/types.d.ts +1 -1
  147. package/dist/features/mention-autocomplete/react/hooks/useMentionAutocomplete.js +1 -1
  148. package/dist/features/notifications/react/components/NotificationsTab.js +7 -7
  149. package/dist/features/notifications/types.d.ts +1 -1
  150. package/dist/features/observability/boot-timing.js +2 -2
  151. package/dist/features/observability/stuck-run.js +1 -1
  152. package/dist/features/observability/white-screen.js +4 -4
  153. package/dist/features/panel-kit/fetch-query/adapter.react.d.ts +35 -0
  154. package/dist/features/panel-kit/fetch-query/adapter.react.js +122 -0
  155. package/dist/features/panel-kit/fetch-query/cache.d.ts +123 -0
  156. package/dist/features/panel-kit/fetch-query/cache.js +231 -0
  157. package/dist/features/panel-kit/fetch-query/environment.browser.d.ts +4 -0
  158. package/dist/features/panel-kit/fetch-query/environment.browser.js +25 -0
  159. package/dist/features/panel-kit/fetch-query/index.d.ts +4 -0
  160. package/dist/features/panel-kit/fetch-query/index.js +2 -0
  161. package/dist/features/panel-kit/fetch-query/types.d.ts +91 -0
  162. package/dist/features/panel-kit/fetch-query/types.js +2 -0
  163. package/dist/features/panel-kit/helpers/format-timestamp.d.ts +18 -0
  164. package/dist/features/panel-kit/helpers/format-timestamp.js +20 -0
  165. package/dist/features/panel-kit/helpers/permissions.d.ts +11 -0
  166. package/dist/features/panel-kit/helpers/permissions.js +10 -0
  167. package/dist/features/panel-kit/helpers/resolve-active-tab-id.d.ts +13 -0
  168. package/dist/features/panel-kit/helpers/resolve-active-tab-id.js +13 -0
  169. package/dist/features/panel-kit/helpers/retry-unreachable.d.ts +20 -0
  170. package/dist/features/panel-kit/helpers/retry-unreachable.js +39 -0
  171. package/dist/features/panel-kit/hooks/use-async-action.hooks.d.ts +13 -0
  172. package/dist/features/panel-kit/hooks/use-async-action.hooks.js +27 -0
  173. package/dist/features/panel-kit/hooks/use-dirty-guard.hooks.d.ts +18 -0
  174. package/dist/features/panel-kit/hooks/use-dirty-guard.hooks.js +33 -0
  175. package/dist/features/panel-kit/hooks/use-focus-trap.hooks.d.ts +11 -0
  176. package/dist/features/panel-kit/hooks/use-focus-trap.hooks.js +76 -0
  177. package/dist/features/panel-kit/hooks/use-serial-writes.hooks.d.ts +26 -0
  178. package/dist/features/panel-kit/hooks/use-serial-writes.hooks.js +41 -0
  179. package/dist/features/panel-kit/hooks/use-settlement-generation.hooks.d.ts +9 -0
  180. package/dist/features/panel-kit/hooks/use-settlement-generation.hooks.js +25 -0
  181. package/dist/features/panel-kit/index.d.ts +19 -0
  182. package/dist/features/panel-kit/index.js +13 -0
  183. package/dist/features/privacy/react/components/PrivacyTab.js +2 -2
  184. package/dist/features/privacy/types.d.ts +1 -1
  185. package/dist/features/privacy/types.js +1 -1
  186. package/dist/features/progress-card/reference-adapters.d.ts +1 -1
  187. package/dist/features/progress-card/rules.d.ts +1 -1
  188. package/dist/features/progress-card/rules.js +1 -1
  189. package/dist/features/progress-card/types.d.ts +1 -1
  190. package/dist/features/progress-card/types.js +1 -1
  191. package/dist/features/resource-dashboard/dependencies.d.ts +1 -1
  192. package/dist/features/resource-dashboard/ports.d.ts +1 -1
  193. package/dist/features/resource-dashboard/react/hooks/useResourceBoard.d.ts +1 -1
  194. package/dist/features/resource-dashboard/react/hooks/useResourceBoard.js +1 -1
  195. package/dist/features/resource-dashboard/rules.d.ts +1 -1
  196. package/dist/features/resource-dashboard/rules.js +2 -2
  197. package/dist/features/resource-dashboard/types.d.ts +4 -4
  198. package/dist/features/resource-dashboard/types.js +1 -1
  199. package/dist/features/schedule-picker/react/hooks/useRecurringSchedulePicker.js +1 -1
  200. package/dist/features/settings/dialog/styles/settings-dialog.css +62 -60
  201. package/dist/features/sketch-editor/constants.d.ts +1 -1
  202. package/dist/features/sketch-editor/constants.js +1 -1
  203. package/dist/features/sketch-editor/dom.d.ts +1 -1
  204. package/dist/features/sketch-editor/dom.js +1 -1
  205. package/dist/features/sketch-editor/react/hooks/useSketchDomEnhancements.d.ts +1 -1
  206. package/dist/features/sketch-editor/react/hooks/useSketchDomEnhancements.js +11 -9
  207. package/dist/features/sketch-editor/types.d.ts +1 -1
  208. package/dist/features/sketch-editor/types.js +1 -1
  209. package/dist/features/skills/react/components/SkillDraftForm.js +1 -1
  210. package/dist/features/skills/react/components/SkillRow.js +1 -1
  211. package/dist/features/skills/react/components/SkillsTab.js +2 -2
  212. package/dist/features/source-config-list/agent-handles.js +2 -2
  213. package/dist/features/source-config-list/react/hooks/useSourceConfigAddForm.d.ts +1 -1
  214. package/dist/features/source-config-list/react/hooks/useSourceConfigAddForm.js +1 -1
  215. package/dist/features/source-config-list/rules.d.ts +1 -1
  216. package/dist/features/source-config-list/rules.js +3 -3
  217. package/dist/features/source-config-list/types.d.ts +1 -1
  218. package/dist/features/source-config-list/types.js +1 -1
  219. package/dist/features/tab-launcher-menu/react/hooks/useTabLauncherMenu.js +1 -1
  220. package/dist/features/tab-strip/index.d.ts +4 -0
  221. package/dist/features/tab-strip/index.js +2 -0
  222. package/dist/features/tab-strip/react/components/TabBar.d.ts +23 -0
  223. package/dist/features/tab-strip/react/components/TabBar.hooks.d.ts +25 -0
  224. package/dist/features/tab-strip/react/components/TabBar.hooks.js +57 -0
  225. package/dist/features/tab-strip/react/components/TabBar.js +18 -0
  226. package/dist/features/tab-strip/react/components/TabStrip.js +2 -1
  227. package/dist/features/tab-strip/react/components/TabStripFrame.d.ts +3 -0
  228. package/dist/features/tab-strip/react/components/TabStripFrame.js +7 -0
  229. package/dist/features/tabbed-dialog/react/hooks/useTabbedDialog.js +1 -1
  230. package/dist/features/tabbed-dialog/styles/tabbed-dialog.css +8 -141
  231. package/dist/features/tabbed-dialog/types.d.ts +1 -1
  232. package/dist/features/tabbed-dialog/types.js +1 -1
  233. package/dist/features/version-manager/ports.d.ts +1 -1
  234. package/dist/features/version-manager/react/components/VersionPromptPopover.js +5 -3
  235. package/dist/features/version-manager/react/components/VersionRestoreControl.js +1 -1
  236. package/dist/features/version-manager/types.d.ts +1 -1
  237. package/dist/features/version-manager/types.js +1 -1
  238. package/dist/features/viewer-shell/dependencies.js +1 -1
  239. package/dist/features/viewer-shell/ports.d.ts +1 -1
  240. package/dist/features/viewer-shell/react/components/ViewportSwitcher.js +1 -1
  241. package/dist/features/viewer-shell/react/hooks/useMarkdownScrollSync.d.ts +1 -1
  242. package/dist/features/viewer-shell/react/hooks/useMarkdownScrollSync.js +1 -1
  243. package/dist/features/viewer-shell/types.d.ts +1 -1
  244. package/dist/features/viewer-shell/types.js +1 -1
  245. package/dist/index.d.ts +420 -0
  246. package/dist/index.js +421 -1
  247. package/dist/react/components/ComponentKitPreview.js +1 -1
  248. package/dist/react/components/EditorIcon.d.ts +1 -1
  249. package/dist/react/components/EditorIcon.js +22 -22
  250. package/dist/react/components/ExportDiagnosticsButton.d.ts +8 -1
  251. package/dist/react/components/ExportDiagnosticsButton.js +6 -6
  252. package/dist/react/components/PaletteTweaks.js +5 -5
  253. package/dist/react/hooks/useBrandFonts.d.ts +19 -4
  254. package/dist/react/hooks/useBrandFonts.js +11 -7
  255. package/dist/react/hooks/useDebouncedValue.d.ts +12 -1
  256. package/dist/react/hooks/useDebouncedValue.js +9 -4
  257. package/dist/react/hooks/useStableHandler.d.ts +3 -1
  258. package/dist/react/hooks/useStableHandler.js +1 -1
  259. package/dist/renderers/annotation-canvas/drawing.d.ts +4 -4
  260. package/dist/renderers/annotation-canvas/drawing.js +28 -15
  261. package/dist/renderers/annotation-canvas/react/components/AnnotationCanvas.js +2 -2
  262. package/dist/renderers/annotation-canvas/react/hooks/useAnnotationCanvas.js +4 -3
  263. package/dist/renderers/annotation-canvas/rules.d.ts +1 -1
  264. package/dist/renderers/annotation-canvas/theme.d.ts +13 -0
  265. package/dist/renderers/annotation-canvas/theme.js +16 -0
  266. package/dist/renderers/annotation-canvas/types.d.ts +1 -1
  267. package/dist/renderers/index.d.ts +1 -1
  268. package/dist/renderers/new-tab-preview.d.ts +3 -0
  269. package/dist/renderers/new-tab-preview.js +3 -1
  270. package/dist/renderers/preview-modal-shell/react/hooks/usePreviewModalShell.d.ts +1 -1
  271. package/dist/renderers/preview-modal-shell/react/hooks/usePreviewModalShell.js +1 -1
  272. package/dist/renderers/preview-modal-shell/rules.d.ts +1 -1
  273. package/dist/renderers/preview-modal-shell/types.d.ts +3 -3
  274. package/dist/renderers/preview-modal-shell/types.js +2 -2
  275. package/dist/renderers/react/components/ArtifactView.d.ts +1 -1
  276. package/dist/renderers/react/components/ArtifactView.js +1 -1
  277. package/dist/renderers/registry.d.ts +12 -6
  278. package/dist/renderers/registry.js +7 -9
  279. package/dist/renderers/renderers/html.js +2 -2
  280. package/dist/renderers/renderers/index.js +1 -1
  281. package/dist/renderers/renderers/markdown.js +2 -2
  282. package/dist/renderers/renderers/react-component.js +1 -1
  283. package/dist/renderers/renderers/svg.js +1 -1
  284. package/dist/renderers/shiki.js +1 -1
  285. package/dist/renderers/srcdoc/build.d.ts +1 -1
  286. package/dist/renderers/srcdoc/build.js +1 -1
  287. package/dist/renderers/url-load-decision.d.ts +1 -1
  288. package/dist/renderers/url-load-decision.js +1 -1
  289. package/dist/styles/admin.css +273 -0
  290. package/dist/styles/variables.css +117 -0
  291. package/dist/theme/apply.d.ts +9 -0
  292. package/dist/theme/apply.js +77 -0
  293. package/dist/theme/color-scheme.d.ts +8 -0
  294. package/dist/theme/color-scheme.js +9 -0
  295. package/dist/theme/default.d.ts +4 -0
  296. package/dist/theme/default.js +11 -0
  297. package/dist/theme/index.d.ts +6 -0
  298. package/dist/theme/index.js +5 -0
  299. package/dist/theme/stylesheet.d.ts +8 -0
  300. package/dist/theme/stylesheet.js +14 -0
  301. package/dist/theme/types.d.ts +39 -0
  302. package/dist/theme/types.js +2 -0
  303. package/dist/theme/validation.d.ts +15 -0
  304. package/dist/theme/validation.js +55 -0
  305. package/dist/utils/appearance.js +1 -1
  306. package/dist/utils/browser-request.d.ts +12 -0
  307. package/dist/utils/browser-request.js +10 -0
  308. package/dist/utils/color-math.d.ts +20 -6
  309. package/dist/utils/color-math.js +12 -12
  310. package/dist/utils/copy-to-clipboard.d.ts +19 -8
  311. package/dist/utils/copy-to-clipboard.js +15 -11
  312. package/dist/utils/dom-subscriptions.js +1 -1
  313. package/dist/utils/endpoint-policy.d.ts +9 -3
  314. package/dist/utils/endpoint-policy.js +5 -5
  315. package/dist/utils/markdown-scroll-sync.js +3 -3
  316. package/dist/utils/notifications.d.ts +1 -1
  317. package/dist/utils/notifications.js +1 -1
  318. package/dist/utils/polygon-selection.d.ts +1 -1
  319. package/dist/utils/polygon-selection.js +1 -1
  320. package/dist/utils/scroll-tabs-with-wheel.d.ts +4 -1
  321. package/dist/utils/scroll-tabs-with-wheel.js +1 -1
  322. package/dist/utils/smooth-scroll-to-top.js +1 -1
  323. package/dist/utils/sse.d.ts +3 -1
  324. package/dist/utils/sse.js +1 -1
  325. package/package.json +105 -16
  326. package/dist/features/lexical-rich-text-editor/react/test-support/lexical-harness.d.ts +0 -11
  327. package/dist/features/lexical-rich-text-editor/react/test-support/lexical-harness.js +0 -35
@@ -11,11 +11,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  import { useCallback, useEffect, useRef, useState } from 'react';
12
12
  import { Icon } from './Icon.js';
13
13
  export const PALETTE_TWEAKS_SWATCHES = [
14
- { id: 'coral', label: 'Coral - default', stripe: ['#ff5a3c', '#ff7a5c', '#fde2d6', '#171717'] },
15
- { id: 'electric', label: 'Electric', stripe: ['#7c3aed', '#a855f7', '#e9d5ff', '#171717'] },
16
- { id: 'acid-forest', label: 'Acid forest', stripe: ['#16a34a', '#22c55e', '#bbf7d0', '#0f1d14'] },
17
- { id: 'risograph', label: 'Risograph', stripe: ['#e11d48', '#2563eb', '#fde68a', '#171717'] },
18
- { id: 'mono-noir', label: 'Mono noir', stripe: ['#0a0a0a', '#262626', '#e5e5e5', '#fafafa'] },
14
+ { id: 'coral', label: 'Coral - default', stripe: ['var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)'] },
15
+ { id: 'electric', label: 'Electric', stripe: ['var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)'] },
16
+ { id: 'acid-forest', label: 'Acid forest', stripe: ['var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)'] },
17
+ { id: 'risograph', label: 'Risograph', stripe: ['var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)'] },
18
+ { id: 'mono-noir', label: 'Mono noir', stripe: ['var(--jini-text)', 'var(--jini-primary)', 'var(--jini-primary)', 'var(--jini-primary)'] },
19
19
  ];
20
20
  // --- Pure derivations (module-level, directly unit-testable) --------------
21
21
  /**
@@ -9,14 +9,29 @@ export interface BrandFontManifest {
9
9
  files?: BrandFontManifestFile[];
10
10
  }
11
11
  export interface UseBrandFontsOptions {
12
+ projectId?: string;
12
13
  /**
13
14
  * Builds the URL for a project asset path (e.g. `fonts/manifest.json`).
14
15
  * Omit to skip the self-hosted-font-manifest stage entirely — this hook
15
16
  * never hardcodes a font-service URL of its own.
16
17
  */
17
- resolveProjectAssetUrl?: (projectId: string, path: string) => string;
18
+ resolveProjectAssetUrl?: (requiredArgs: {
19
+ projectId: string;
20
+ path: string;
21
+ }) => string;
22
+ manifest?: BrandFontManifestPort;
23
+ /** Native fetch port used by the default manifest loader. */
24
+ fetch?: typeof globalThis.fetch;
25
+ document?: Document;
18
26
  }
19
- export declare function useBrandFonts(projectId: string | undefined, fonts: {
20
- googleFontsUrl?: string;
21
- }[], options?: UseBrandFontsOptions): void;
27
+ export interface BrandFontManifestPort {
28
+ load(requiredArgs: {
29
+ url: string;
30
+ }): Promise<Pick<Response, 'ok' | 'json'>>;
31
+ }
32
+ export declare function useBrandFonts({ fonts }: {
33
+ fonts: {
34
+ googleFontsUrl?: string;
35
+ }[];
36
+ }, options?: UseBrandFontsOptions): void;
22
37
  //# sourceMappingURL=useBrandFonts.d.ts.map
@@ -5,9 +5,13 @@
5
5
  // down on change. Not tied to any one feature domain — feature-local hooks
6
6
  // live inside their own `features/<domain>/react/hooks/` instead.
7
7
  import { useEffect, useMemo } from 'react';
8
- import { FETCH_TIMEOUT_MS, fetchWithTimeout } from '@jini-ai/platform/fetch-with-timeout';
9
- export function useBrandFonts(projectId, fonts, options = {}) {
10
- const { resolveProjectAssetUrl } = options;
8
+ import { requestWithTimeout } from '../../utils/browser-request.js';
9
+ export function useBrandFonts({ fonts }, options = {}) {
10
+ const { projectId, resolveProjectAssetUrl, fetch, manifest: suppliedManifest } = options;
11
+ const manifest = useMemo(() => suppliedManifest ?? {
12
+ load: ({ url }) => requestWithTimeout({ url, timeoutMs: 15_000 }, { ...(fetch === undefined ? {} : { fetch }), init: { cache: 'no-store' } }),
13
+ }, [suppliedManifest, fetch]);
14
+ const document = options.document ?? globalThis.document;
11
15
  const googleUrls = useMemo(() => {
12
16
  const urls = fonts
13
17
  .map((f) => f.googleFontsUrl)
@@ -26,7 +30,7 @@ export function useBrandFonts(projectId, fonts, options = {}) {
26
30
  for (const link of links)
27
31
  link.remove();
28
32
  };
29
- }, [googleUrls]);
33
+ }, [googleUrls, document]);
30
34
  useEffect(() => {
31
35
  if (!projectId || !resolveProjectAssetUrl)
32
36
  return;
@@ -34,7 +38,7 @@ export function useBrandFonts(projectId, fonts, options = {}) {
34
38
  let styleEl = null;
35
39
  void (async () => {
36
40
  try {
37
- const resp = await fetchWithTimeout(resolveProjectAssetUrl(projectId, 'fonts/manifest.json'), { cache: 'no-store' }, { timeoutMs: FETCH_TIMEOUT_MS.QUICK });
41
+ const resp = await manifest.load({ url: resolveProjectAssetUrl({ projectId, path: 'fonts/manifest.json' }) });
38
42
  if (!resp.ok)
39
43
  return;
40
44
  const data = (await resp.json());
@@ -43,7 +47,7 @@ export function useBrandFonts(projectId, fonts, options = {}) {
43
47
  return;
44
48
  const css = files
45
49
  .map((f) => {
46
- const url = resolveProjectAssetUrl(projectId, `fonts/${f.file}`);
50
+ const url = resolveProjectAssetUrl({ projectId, path: `fonts/${f.file}` });
47
51
  return [
48
52
  '@font-face {',
49
53
  ` font-family: '${f.family.replace(/'/g, '')}';`,
@@ -69,6 +73,6 @@ export function useBrandFonts(projectId, fonts, options = {}) {
69
73
  if (styleEl)
70
74
  styleEl.remove();
71
75
  };
72
- }, [projectId, resolveProjectAssetUrl]);
76
+ }, [projectId, resolveProjectAssetUrl, manifest, document]);
73
77
  }
74
78
  //# sourceMappingURL=useBrandFonts.js.map
@@ -1,2 +1,13 @@
1
- export declare function useDebouncedValue<T>(value: T, delayMs: number): T;
1
+ export interface DebounceSchedulerPort {
2
+ schedule(requiredArgs: {
3
+ callback: () => void;
4
+ delayMs: number;
5
+ }): () => void;
6
+ }
7
+ export declare function useDebouncedValue<T>({ value, delayMs }: {
8
+ value: T;
9
+ delayMs: number;
10
+ }, { scheduler }?: {
11
+ scheduler?: DebounceSchedulerPort;
12
+ }): T;
2
13
  //# sourceMappingURL=useDebouncedValue.d.ts.map
@@ -3,12 +3,17 @@
3
3
  // one feature domain — feature-local hooks live inside their own
4
4
  // `features/<domain>/react/hooks/` instead.
5
5
  import { useEffect, useState } from 'react';
6
- export function useDebouncedValue(value, delayMs) {
6
+ const browserScheduler = {
7
+ schedule: ({ callback, delayMs }) => {
8
+ const timer = setTimeout(callback, delayMs);
9
+ return () => clearTimeout(timer);
10
+ },
11
+ };
12
+ export function useDebouncedValue({ value, delayMs }, { scheduler = browserScheduler } = {}) {
7
13
  const [debounced, setDebounced] = useState(value);
8
14
  useEffect(() => {
9
- const timer = setTimeout(() => setDebounced(value), delayMs);
10
- return () => clearTimeout(timer);
11
- }, [value, delayMs]);
15
+ return scheduler.schedule({ callback: () => setDebounced(value), delayMs });
16
+ }, [value, delayMs, scheduler]);
12
17
  return debounced;
13
18
  }
14
19
  //# sourceMappingURL=useDebouncedValue.js.map
@@ -6,5 +6,7 @@
6
6
  * — safe for event handlers, which only fire after commit; do not call the
7
7
  * result during render).
8
8
  */
9
- export declare function useStableHandler<Args extends unknown[], Result>(handler: (...args: Args) => Result): (...args: Args) => Result;
9
+ export declare function useStableHandler<Args extends unknown[], Result>({ handler }: {
10
+ handler: (...args: Args) => Result;
11
+ }): (...args: Args) => Result;
10
12
  //# sourceMappingURL=useStableHandler.d.ts.map
@@ -7,7 +7,7 @@ import { useCallback, useEffect, useRef } from 'react';
7
7
  * — safe for event handlers, which only fire after commit; do not call the
8
8
  * result during render).
9
9
  */
10
- export function useStableHandler(handler) {
10
+ export function useStableHandler({ handler }) {
11
11
  const ref = useRef(handler);
12
12
  useEffect(() => {
13
13
  ref.current = handler;
@@ -5,17 +5,17 @@
5
5
  * layer.
6
6
  *
7
7
  * Origin: `apps/web/src/components/PreviewDrawOverlay.tsx`. See
8
- * `../source-map.md`.
8
+ * `../archived provenance ledger`.
9
9
  */
10
10
  import type { CaptureTarget, NormalizedRect, Stroke, TextMark } from './types.js';
11
- export declare const STROKE_COLOR = "#ff3b30";
11
+ export declare const STROKE_COLOR: string;
12
12
  export declare const STROKE_WIDTH = 4;
13
- export declare const TARGET_COLOR = "#1677ff";
13
+ export declare const TARGET_COLOR: string;
14
14
  /** Text-annotation glyph height as a fraction of the frame height, so a dropped label reads at a consistent size across differently-sized frames and its on-screen size matches what gets baked into an exported screenshot. */
15
15
  export declare const TEXT_FONT_FRACTION = 0.03;
16
16
  export declare const TEXT_LINE_HEIGHT = 1.25;
17
17
  export declare const TEXT_MIN_FONT_PX = 12;
18
- export declare const TEXT_FONT_FAMILY = "system-ui, -apple-system, BlinkMacSystemFont, sans-serif";
18
+ export declare const TEXT_FONT_FAMILY: string;
19
19
  export declare function textFontSizePx(frameHeight: number): number;
20
20
  export declare function drawNormalizedBox(ctx: CanvasRenderingContext2D, box: NormalizedRect, width: number, height: number): void;
21
21
  /** Redraws every committed stroke, the in-progress draft stroke, committed selection boxes, and the in-progress box draft. Called on every pointer move (rAF-coalesced by the caller) and on every history mutation. */
@@ -1,32 +1,39 @@
1
- export const STROKE_COLOR = '#ff3b30';
1
+ import { defaultAdminTheme } from '../../theme/default.js';
2
+ import { resolveAnnotationTheme } from './theme.js';
3
+ export const STROKE_COLOR = defaultAdminTheme.light.danger;
2
4
  export const STROKE_WIDTH = 4;
3
- export const TARGET_COLOR = '#1677ff';
5
+ export const TARGET_COLOR = defaultAdminTheme.light.primary;
4
6
  /** Text-annotation glyph height as a fraction of the frame height, so a dropped label reads at a consistent size across differently-sized frames and its on-screen size matches what gets baked into an exported screenshot. */
5
7
  export const TEXT_FONT_FRACTION = 0.03;
6
8
  export const TEXT_LINE_HEIGHT = 1.25;
7
9
  export const TEXT_MIN_FONT_PX = 12;
8
- export const TEXT_FONT_FAMILY = 'system-ui, -apple-system, BlinkMacSystemFont, sans-serif';
10
+ export const TEXT_FONT_FAMILY = defaultAdminTheme.fonts.body;
9
11
  export function textFontSizePx(frameHeight) {
10
12
  return Math.max(TEXT_MIN_FONT_PX, TEXT_FONT_FRACTION * frameHeight);
11
13
  }
12
14
  export function drawNormalizedBox(ctx, box, width, height) {
15
+ const theme = resolveAnnotationTheme({ canvas: ctx.canvas });
13
16
  const left = box.x * width;
14
17
  const top = box.y * height;
15
18
  const boxWidth = Math.max(1, box.width * width);
16
19
  const boxHeight = Math.max(1, box.height * height);
17
20
  ctx.save();
18
- ctx.fillStyle = 'rgba(255, 59, 48, 0.10)';
19
- ctx.strokeStyle = STROKE_COLOR;
21
+ ctx.fillStyle = theme.stroke;
22
+ const boxAlpha = ctx.globalAlpha;
23
+ ctx.globalAlpha = boxAlpha * 0.10;
24
+ ctx.strokeStyle = theme.stroke;
20
25
  ctx.lineWidth = Math.max(2, Math.round(Math.min(width, height) * 0.002));
21
26
  ctx.setLineDash([10, 6]);
22
27
  ctx.fillRect(left, top, boxWidth, boxHeight);
28
+ ctx.globalAlpha = boxAlpha;
23
29
  ctx.strokeRect(left, top, boxWidth, boxHeight);
24
30
  ctx.restore();
25
31
  }
26
32
  /** Redraws every committed stroke, the in-progress draft stroke, committed selection boxes, and the in-progress box draft. Called on every pointer move (rAF-coalesced by the caller) and on every history mutation. */
27
33
  export function redrawStrokesAndBoxes(ctx, input, width, height, dpr) {
34
+ const theme = resolveAnnotationTheme({ canvas: ctx.canvas });
28
35
  ctx.clearRect(0, 0, width, height);
29
- ctx.strokeStyle = STROKE_COLOR;
36
+ ctx.strokeStyle = theme.stroke;
30
37
  ctx.lineWidth = STROKE_WIDTH * dpr;
31
38
  ctx.lineCap = 'round';
32
39
  ctx.lineJoin = 'round';
@@ -50,14 +57,15 @@ export function redrawStrokesAndBoxes(ctx, input, width, height, dpr) {
50
57
  }
51
58
  /** Bakes the transparent on-screen text labels into an exported screenshot. Uses the same frame-height-fraction glyph size the DOM textareas use, so what the user typed lands at the same size/position in the captured image. */
52
59
  export function drawTextMarks(ctx, marks, width, height) {
60
+ const theme = resolveAnnotationTheme({ canvas: ctx.canvas });
53
61
  const fontPx = textFontSizePx(height);
54
62
  const lineHeight = fontPx * TEXT_LINE_HEIGHT;
55
63
  const topPad = (lineHeight - fontPx) / 2;
56
64
  ctx.save();
57
65
  ctx.textBaseline = 'top';
58
- ctx.font = `600 ${fontPx}px ${TEXT_FONT_FAMILY}`;
59
- ctx.fillStyle = STROKE_COLOR;
60
- ctx.shadowColor = 'rgba(255,255,255,0.75)';
66
+ ctx.font = `600 ${fontPx}px ${theme.font}`;
67
+ ctx.fillStyle = theme.stroke;
68
+ ctx.shadowColor = theme.bg;
61
69
  ctx.shadowBlur = Math.max(1, fontPx * 0.14);
62
70
  for (const mark of marks) {
63
71
  if (mark.text.trim().length === 0)
@@ -79,21 +87,25 @@ export function drawCaptureTarget(ctx, scaleX, scaleY, target) {
79
87
  return;
80
88
  if (width <= 0 || height <= 0)
81
89
  return;
90
+ const theme = resolveAnnotationTheme({ canvas: ctx.canvas });
82
91
  const left = x * scaleX;
83
92
  const top = y * scaleY;
84
93
  const boxWidth = Math.max(1, width * scaleX);
85
94
  const boxHeight = Math.max(1, height * scaleY);
86
95
  ctx.save();
87
- ctx.fillStyle = 'rgba(22, 119, 255, 0.12)';
88
- ctx.strokeStyle = TARGET_COLOR;
96
+ ctx.fillStyle = theme.target;
97
+ const targetAlpha = ctx.globalAlpha;
98
+ ctx.globalAlpha = targetAlpha * 0.12;
99
+ ctx.strokeStyle = theme.target;
89
100
  ctx.lineWidth = Math.max(2, Math.round(Math.max(scaleX, scaleY) * 2));
90
101
  ctx.setLineDash([Math.max(8, 8 * scaleX), Math.max(4, 4 * scaleX)]);
91
102
  ctx.fillRect(left, top, boxWidth, boxHeight);
103
+ ctx.globalAlpha = targetAlpha;
92
104
  ctx.strokeRect(left, top, boxWidth, boxHeight);
93
105
  const label = (target.label || target.elementId || '').trim();
94
106
  if (label) {
95
107
  const fontSize = Math.max(12, Math.round(12 * Math.max(scaleX, scaleY)));
96
- ctx.font = `600 ${fontSize}px ${TEXT_FONT_FAMILY}`;
108
+ ctx.font = `600 ${fontSize}px ${theme.font}`;
97
109
  const text = label.length > 42 ? `${label.slice(0, 39)}...` : label;
98
110
  const metrics = ctx.measureText(text);
99
111
  const padX = Math.max(6, Math.round(6 * scaleX));
@@ -102,19 +114,20 @@ export function drawCaptureTarget(ctx, scaleX, scaleY, target) {
102
114
  const labelHeight = fontSize + padY * 2;
103
115
  const labelTop = Math.max(0, top - labelHeight - Math.max(4, 4 * scaleY));
104
116
  ctx.setLineDash([]);
105
- ctx.fillStyle = TARGET_COLOR;
117
+ ctx.fillStyle = theme.target;
106
118
  ctx.fillRect(left, labelTop, labelWidth, labelHeight);
107
- ctx.fillStyle = '#fff';
119
+ ctx.fillStyle = theme.ink;
108
120
  ctx.fillText(text, left + padX, labelTop + padY + fontSize * 0.82);
109
121
  }
110
122
  ctx.restore();
111
123
  }
112
124
  /** Composites the current marks (capture-target highlight, selection boxes, strokes, text labels) onto an already-drawn background image at export resolution. */
113
125
  export function compositeMarksOntoCanvas(ctx, input, outputWidth, outputHeight, scaleX, scaleY) {
126
+ const theme = resolveAnnotationTheme({ canvas: ctx.canvas });
114
127
  drawCaptureTarget(ctx, scaleX, scaleY, input.target);
115
128
  for (const box of input.selectionBoxes)
116
129
  drawNormalizedBox(ctx, box, outputWidth, outputHeight);
117
- ctx.strokeStyle = STROKE_COLOR;
130
+ ctx.strokeStyle = theme.stroke;
118
131
  ctx.lineWidth = STROKE_WIDTH * Math.max(scaleX, scaleY);
119
132
  ctx.lineCap = 'round';
120
133
  ctx.lineJoin = 'round';
@@ -66,8 +66,8 @@ export function AnnotationCanvas(props) {
66
66
  resize: 'none',
67
67
  overflow: 'hidden',
68
68
  whiteSpace: 'pre',
69
- color: '#ff3b30',
70
- caretColor: '#ff3b30',
69
+ color: 'var(--jini-danger)',
70
+ caretColor: 'var(--jini-danger)',
71
71
  fontWeight: 600,
72
72
  fontSize: c.textFontPx,
73
73
  lineHeight: 1.25,
@@ -1,3 +1,4 @@
1
+ import { resolveAnnotationTheme } from '../../theme.js';
1
2
  /**
2
3
  * Headless controller for the annotation-canvas engine: freehand/box/text
3
4
  * drawing, undo/redo, canvas rAF/DPR redraw, the collision-avoiding floating
@@ -7,7 +8,7 @@
7
8
  * Shift+Cmd/Ctrl+Z redo; Enter in the note input submits as Queue).
8
9
  *
9
10
  * Origin: `apps/web/src/components/PreviewDrawOverlay.tsx`. See
10
- * `../../source-map.md` for the exact file-by-file port breakdown and what
11
+ * `../../archived provenance ledger` for the exact file-by-file port breakdown and what
11
12
  * was intentionally left product-side (the `window` `CustomEvent` wire
12
13
  * protocol, the compositor-iframe snapshot lookup, the composer's
13
14
  * submission semantics).
@@ -621,7 +622,7 @@ export function useAnnotationCanvas(options) {
621
622
  // ever reached via `send()`, itself only invocable from an event handler
622
623
  // on an already-mounted, hydrated component — never during an SSR render
623
624
  // pass, where `document` is provably defined. Proved dead and removed
624
- // during the coverage pass (see `source-map.md`); the guard is only
625
+ // during the coverage pass (see `archived provenance ledger`); the guard is only
625
626
  // meaningful at JSX-render time (portal / effect bodies), not inside an
626
627
  // async handler like this one.
627
628
  const out = document.createElement('canvas');
@@ -638,7 +639,7 @@ export function useAnnotationCanvas(options) {
638
639
  });
639
640
  if (!bg)
640
641
  return null;
641
- ctx.fillStyle = '#ffffff';
642
+ ctx.fillStyle = resolveAnnotationTheme({ canvas: out }).bg;
642
643
  ctx.fillRect(0, 0, out.width, out.height);
643
644
  ctx.drawImage(bg, 0, 0, snap.w, snap.h);
644
645
  const sx = snap.w / Math.max(1, frameRect.width);
@@ -6,7 +6,7 @@
6
6
  * useAnnotationCanvas.ts`) measures from the live DOM and passes in.
7
7
  *
8
8
  * Origin: `apps/web/src/components/PreviewDrawOverlay.tsx`. See
9
- * `../source-map.md`.
9
+ * `../archived provenance ledger`.
10
10
  */
11
11
  import type { AnnotationAction, CSSPropertiesLike, DockPlacement, NormalizedRect, Point, Rect } from './types.js';
12
12
  export declare function clamp(value: number, min: number, max: number): number;
@@ -0,0 +1,13 @@
1
+ /** Canvas requires resolved colors rather than var() strings. Its injected canvas owns the DOM. */
2
+ export declare function resolveAnnotationTheme({ canvas }: {
3
+ readonly canvas?: HTMLCanvasElement;
4
+ }, { getComputedStyle }?: {
5
+ readonly getComputedStyle?: (element: Element) => CSSStyleDeclaration;
6
+ }): {
7
+ stroke: string;
8
+ target: string;
9
+ bg: string;
10
+ ink: string;
11
+ font: string;
12
+ };
13
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { defaultAdminTheme } from '../../theme/default.js';
2
+ /** Canvas requires resolved colors rather than var() strings. Its injected canvas owns the DOM. */
3
+ export function resolveAnnotationTheme({ canvas }, { getComputedStyle } = {}) {
4
+ const document = canvas?.ownerDocument;
5
+ const readStyle = getComputedStyle ?? (document?.defaultView ? document.defaultView.getComputedStyle.bind(document.defaultView) : undefined);
6
+ const style = document && readStyle ? readStyle(canvas?.isConnected ? canvas : document.documentElement) : undefined;
7
+ const read = (name, fallback) => style?.getPropertyValue(name).trim() || fallback;
8
+ return {
9
+ stroke: read('--jini-danger', defaultAdminTheme.light.danger),
10
+ target: read('--jini-primary', defaultAdminTheme.light.primary),
11
+ bg: read('--jini-bg', defaultAdminTheme.light.bg),
12
+ ink: read('--jini-primary-ink', defaultAdminTheme.light.primaryInk),
13
+ font: read('--jini-font-body', defaultAdminTheme.fonts.body),
14
+ };
15
+ }
16
+ //# sourceMappingURL=theme.js.map
@@ -4,7 +4,7 @@
4
4
  * `children`), with a send/draft/queue submit-action picker.
5
5
  *
6
6
  * Origin: `apps/web/src/components/PreviewDrawOverlay.tsx` (the origin
7
- * project, 2,158 lines). See `../source-map.md` for the full port writeup.
7
+ * project, 2,158 lines). See `../archived provenance ledger` for the full port writeup.
8
8
  */
9
9
  export interface Point {
10
10
  x: number;
@@ -3,7 +3,7 @@
3
3
  * srcDoc host. See `ADS-memory/reports/jini-port/extraction-plan.md` §3 and
4
4
  * `ADS-memory/reports/jini-port/recon/r4b-webui-design.md` §1 ("@jini-ai/artifacts-react —
5
5
  * RendererRegistry", the pre-lock name for this package) for the design
6
- * this targets, and `source-map.md` for exact provenance.
6
+ * this targets, and `archived provenance ledger` for exact provenance.
7
7
  */
8
8
  export type { ArtifactFile, ArtifactManifest, ArtifactKind, ArtifactRendererId, ArtifactExportKind, ArtifactStatus } from './types.js';
9
9
  export { RendererRegistry, resolveArtifactManifest, type ArtifactRenderer, type ArtifactRendererContext, type ArtifactRenderMatch, } from './registry.js';
@@ -1,5 +1,8 @@
1
+ import type { AdminTheme, ColorScheme } from '../theme/types.js';
1
2
  import type { SandboxedDocumentOptions } from './types.js';
2
3
  export interface NewTabPreviewOptions extends SandboxedDocumentOptions {
4
+ adminTheme?: AdminTheme;
5
+ colorScheme?: ColorScheme;
3
6
  /** Allow `window.showModalDialog`-style native modals (`alert`/`confirm`/`prompt`) inside the sandboxed frame. Defaults to `false`. */
4
7
  allowModals?: boolean;
5
8
  }
@@ -1,3 +1,5 @@
1
+ import { defaultAdminTheme } from '../theme/default.js';
2
+ import { renderAdminThemeVariables } from '../theme/stylesheet.js';
1
3
  import { escapeHtmlAttribute } from './html-utils.js';
2
4
  import { buildSandboxedDocument } from './sandboxed-document.js';
3
5
  /**
@@ -18,7 +20,7 @@ export function buildSandboxedPreviewPage(html, title, options = {}) {
18
20
  <meta charset="utf-8" />
19
21
  <meta name="viewport" content="width=device-width, initial-scale=1" />
20
22
  <title>${safeTitle}</title>
21
- <style>html,body,iframe{margin:0;width:100%;height:100%;border:0}body{overflow:hidden;background:#fff}</style>
23
+ <style>${renderAdminThemeVariables({ theme: options.adminTheme ?? defaultAdminTheme }, { ...(options.colorScheme ? { colorScheme: options.colorScheme } : {}) })}html,body,iframe{margin:0;width:100%;height:100%;border:0}body{overflow:hidden;background:var(--jini-bg)}</style>
22
24
  </head>
23
25
  <body>
24
26
  <iframe title="${safeTitle}" sandbox="${sandbox}" srcdoc="${escapeHtmlAttribute(innerDoc)}"></iframe>
@@ -4,7 +4,7 @@
4
4
  * consumer.
5
5
  *
6
6
  * Origin: `apps/web/src/components/PreviewModal.tsx`'s component body (the
7
- * generic-chrome subset — see `../../source-map.md`'s classification). The
7
+ * generic-chrome subset — see `../../archived provenance ledger`'s classification). The
8
8
  * merged Share/Export popover's state (`templateShareOpen`/
9
9
  * `copyShareFeedback`/`socialShareTargets`/...) is deliberately not ported
10
10
  * here; that block is OD-specific and out of scope for this shell.
@@ -4,7 +4,7 @@
4
4
  * consumer.
5
5
  *
6
6
  * Origin: `apps/web/src/components/PreviewModal.tsx`'s component body (the
7
- * generic-chrome subset — see `../../source-map.md`'s classification). The
7
+ * generic-chrome subset — see `../../archived provenance ledger`'s classification). The
8
8
  * merged Share/Export popover's state (`templateShareOpen`/
9
9
  * `copyShareFeedback`/`socialShareTargets`/...) is deliberately not ported
10
10
  * here; that block is OD-specific and out of scope for this shell.
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Origin: `apps/web/src/components/PreviewModal.tsx`'s inline derivations
8
8
  * (the `initial` viewId ternary, `activeView`/`scale`/`scalerStyle` memos).
9
- * See `../source-map.md`.
9
+ * See `../archived provenance ledger`.
10
10
  */
11
11
  import type { PreviewModalContentStatus, PreviewModalScalerStyle, PreviewModalUnavailable } from './types.js';
12
12
  export interface PreviewModalViewLike {
@@ -4,10 +4,10 @@
4
4
  * arbitrary preview content. No React import: React-specific prop shapes
5
5
  * (anything carrying a `ReactNode`, e.g. the per-view `custom` stage or the
6
6
  * sidebar's `content`) live in `react/components/PreviewModalShell.tsx`
7
- * instead — see the React-layout policy note in `../source-map.md`.
7
+ * instead — see the React-layout policy note in `../archived provenance ledger`.
8
8
  *
9
9
  * Origin: `apps/web/src/components/PreviewModal.tsx`. See
10
- * `../source-map.md`'s `preview-modal-shell` classification section for the
10
+ * `../archived provenance ledger`'s `preview-modal-shell` classification section for the
11
11
  * full generic-vs-OD-specific breakdown.
12
12
  */
13
13
  /** One item in a split-button primary action's secondary-options menu. */
@@ -35,7 +35,7 @@ export interface PreviewModalPrimaryAction {
35
35
  * Shown in the content stage in place of the loading/error/rendered states
36
36
  * when a view genuinely has nothing to preview (generalized from the
37
37
  * origin's closed `'skill' | 'plugin' | 'template'` noun vocabulary — see
38
- * `../source-map.md`). The caller owns the copy; the shell just displays it.
38
+ * `../archived provenance ledger`). The caller owns the copy; the shell just displays it.
39
39
  */
40
40
  export interface PreviewModalUnavailable {
41
41
  message: string;
@@ -4,10 +4,10 @@
4
4
  * arbitrary preview content. No React import: React-specific prop shapes
5
5
  * (anything carrying a `ReactNode`, e.g. the per-view `custom` stage or the
6
6
  * sidebar's `content`) live in `react/components/PreviewModalShell.tsx`
7
- * instead — see the React-layout policy note in `../source-map.md`.
7
+ * instead — see the React-layout policy note in `../archived provenance ledger`.
8
8
  *
9
9
  * Origin: `apps/web/src/components/PreviewModal.tsx`. See
10
- * `../source-map.md`'s `preview-modal-shell` classification section for the
10
+ * `../archived provenance ledger`'s `preview-modal-shell` classification section for the
11
11
  * full generic-vs-OD-specific breakdown.
12
12
  */
13
13
  export {};
@@ -26,7 +26,7 @@ export interface ArtifactViewSlots {
26
26
  export interface ArtifactViewProps {
27
27
  file: ArtifactFile;
28
28
  registry: RendererRegistry;
29
- /** Passed through to `registry.resolve({ file, hints })`. */
29
+ /** Passed through to `registry.resolve({ file }, { hints })`. */
30
30
  hints?: Record<string, unknown> | undefined;
31
31
  /** Passed through to `SrcDocSandbox` for the built-in `html`/`svg` rendering. */
32
32
  srcDocOptions?: BuildSrcDocOptions | undefined;
@@ -7,7 +7,7 @@ import { SrcDocSandbox } from './SrcDocSandbox.js';
7
7
  import { AnnotationCanvas } from '../../annotation-canvas/index.js';
8
8
  export function ArtifactView({ file, registry, hints, srcDocOptions, slots, className, annotation }) {
9
9
  const t = useT();
10
- const match = useMemo(() => registry.resolve({ file, hints }), [registry, file, hints]);
10
+ const match = useMemo(() => registry.resolve({ file }, { hints }), [registry, file, hints]);
11
11
  const wrap = (node) => (annotation ? _jsx(AnnotationCanvas, { ...annotation, children: node }) : node);
12
12
  if (!match) {
13
13
  return wrap(_jsx("div", { className: className, role: "status", children: t('No renderer is registered for this artifact.') }));
@@ -8,7 +8,7 @@
8
8
  * rendering needs a host-injected postMessage bridge (see
9
9
  * `srcdoc/bridge.ts`), so a host registers its own `deck-html`
10
10
  * {@link ArtifactRenderer} into the registry instance it constructs instead
11
- * of this package shipping one. See `source-map.md`.
11
+ * of this package shipping one. See `archived provenance ledger`.
12
12
  */
13
13
  import type { ArtifactFile, ArtifactManifest } from './types.js';
14
14
  export interface ArtifactRendererContext {
@@ -27,7 +27,7 @@ export interface ArtifactRenderer {
27
27
  */
28
28
  supportsStreaming: boolean;
29
29
  renderPartial?: ((content: string) => string) | undefined;
30
- canRender: (ctx: ArtifactRendererContext) => boolean;
30
+ canRender: (required: Pick<ArtifactRendererContext, "file">, optional?: Omit<ArtifactRendererContext, "file">) => boolean;
31
31
  }
32
32
  export interface ArtifactRenderMatch {
33
33
  renderer: ArtifactRenderer;
@@ -44,14 +44,20 @@ export interface ArtifactRenderMatch {
44
44
  * resolve a manifest for the file itself — see `@jini-ai/chat`'s
45
45
  * `inferLegacyManifest` — before handing the file to this registry.
46
46
  */
47
- export declare function resolveArtifactManifest(file: ArtifactFile): ArtifactManifest | null;
47
+ export declare function resolveArtifactManifest({ file }: {
48
+ file: ArtifactFile;
49
+ }): ArtifactManifest | null;
48
50
  export declare class RendererRegistry {
49
51
  private readonly renderers;
50
- constructor(renderers: readonly ArtifactRenderer[]);
52
+ constructor({ renderers }: {
53
+ renderers: readonly ArtifactRenderer[];
54
+ });
51
55
  /** Renderers currently registered, in resolution order. */
52
56
  list(): readonly ArtifactRenderer[];
53
- resolve(ctx: ArtifactRendererContext): ArtifactRenderMatch | null;
57
+ resolve({ file }: Pick<ArtifactRendererContext, "file">, { hints }?: Omit<ArtifactRendererContext, "file">): ArtifactRenderMatch | null;
54
58
  /** Returns a new registry with `renderer` appended (or replacing an existing renderer of the same id). */
55
- register(renderer: ArtifactRenderer): RendererRegistry;
59
+ register({ renderer }: {
60
+ renderer: ArtifactRenderer;
61
+ }): RendererRegistry;
56
62
  }
57
63
  //# sourceMappingURL=registry.d.ts.map
@@ -9,31 +9,29 @@
9
9
  * resolve a manifest for the file itself — see `@jini-ai/chat`'s
10
10
  * `inferLegacyManifest` — before handing the file to this registry.
11
11
  */
12
- export function resolveArtifactManifest(file) {
12
+ export function resolveArtifactManifest({ file }) {
13
13
  return file.manifest ?? null;
14
14
  }
15
15
  export class RendererRegistry {
16
16
  renderers;
17
- constructor(renderers) {
18
- this.renderers = renderers;
19
- }
17
+ constructor({ renderers }) { this.renderers = renderers; }
20
18
  /** Renderers currently registered, in resolution order. */
21
19
  list() {
22
20
  return this.renderers;
23
21
  }
24
- resolve(ctx) {
25
- const manifest = resolveArtifactManifest(ctx.file);
22
+ resolve({ file }, { hints } = {}) {
23
+ const manifest = resolveArtifactManifest({ file });
26
24
  if (!manifest)
27
25
  return null;
28
- const renderer = this.renderers.find((item) => item.canRender(ctx));
26
+ const renderer = this.renderers.find((item) => item.canRender({ file }, { hints }));
29
27
  if (!renderer)
30
28
  return null;
31
29
  return { renderer, manifest };
32
30
  }
33
31
  /** Returns a new registry with `renderer` appended (or replacing an existing renderer of the same id). */
34
- register(renderer) {
32
+ register({ renderer }) {
35
33
  const withoutExisting = this.renderers.filter((item) => item.id !== renderer.id);
36
- return new RendererRegistry([...withoutExisting, renderer]);
34
+ return new RendererRegistry({ renderers: [...withoutExisting, renderer] });
37
35
  }
38
36
  }
39
37
  //# sourceMappingURL=registry.js.map
@@ -9,8 +9,8 @@ import { resolveArtifactManifest } from '../registry.js';
9
9
  export const HtmlRenderer = {
10
10
  id: 'html',
11
11
  supportsStreaming: false,
12
- canRender: ({ file, hints }) => {
13
- const manifest = resolveArtifactManifest(file);
12
+ canRender: ({ file }, { hints } = {}) => {
13
+ const manifest = resolveArtifactManifest({ file: file });
14
14
  if (!manifest)
15
15
  return false;
16
16
  if (manifest.kind === 'deck' || manifest.renderer === 'deck-html')
@@ -13,6 +13,6 @@ export { ReactComponentRenderer } from './react-component.js';
13
13
  * deck rendering registers its own via `.register(...)`.
14
14
  */
15
15
  export function createDefaultRendererRegistry() {
16
- return new RendererRegistry([HtmlRenderer, MarkdownRenderer, SvgRenderer, ReactComponentRenderer]);
16
+ return new RendererRegistry({ renderers: [HtmlRenderer, MarkdownRenderer, SvgRenderer, ReactComponentRenderer] });
17
17
  }
18
18
  //# sourceMappingURL=index.js.map