@xynolog/react-ui 0.0.0-stage → 0.8.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 (379) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +379 -2
  3. package/dist/PdfAnnotationCanvas.client-S64VRLUN.css +193 -0
  4. package/dist/PdfAnnotationCanvas.client-V7R4NXFO.js +799 -0
  5. package/dist/ar-AIV7P4FL.js +594 -0
  6. package/dist/bn-J2OR57PB.js +594 -0
  7. package/dist/chunk-4L3TYOIV.js +172 -0
  8. package/dist/chunk-BM76QBIO.js +594 -0
  9. package/dist/chunk-D2O46PZQ.js +240 -0
  10. package/dist/chunk-O23TLLXW.js +42 -0
  11. package/dist/chunk-WGTUIB6C.js +304 -0
  12. package/dist/cs-JNEAMHFB.js +594 -0
  13. package/dist/da-UY5ZRVTZ.js +594 -0
  14. package/dist/de-EETVXC42.js +594 -0
  15. package/dist/el-S5YKDMTL.js +594 -0
  16. package/dist/en-3YQWF45H.js +61 -0
  17. package/dist/es-GHA7S27R.js +594 -0
  18. package/dist/fa-JTR3GF6I.js +594 -0
  19. package/dist/fi-CQZ7BW57.js +594 -0
  20. package/dist/fr-OJH2WIY7.js +594 -0
  21. package/dist/he-2DBXWA2V.js +594 -0
  22. package/dist/hi-NZP7B55I.js +594 -0
  23. package/dist/id-4KXFKWOI.js +594 -0
  24. package/dist/index.css +4134 -0
  25. package/dist/index.d.ts +4040 -0
  26. package/dist/index.js +29638 -0
  27. package/dist/it-XBMYGKKY.js +594 -0
  28. package/dist/ja-OVHZS3EH.js +594 -0
  29. package/dist/ko-NW2MVM5L.js +594 -0
  30. package/dist/ms-RXLPBZLK.js +594 -0
  31. package/dist/nl-77CTBEDA.js +594 -0
  32. package/dist/no-RAPO56SE.js +594 -0
  33. package/dist/pl-XCFXZCTT.js +594 -0
  34. package/dist/pt-EMBE27IS.js +594 -0
  35. package/dist/ro-M7QLJBYN.js +594 -0
  36. package/dist/sv-ST6CITQY.js +594 -0
  37. package/dist/test-utils.css +112 -0
  38. package/dist/test-utils.d.ts +126 -0
  39. package/dist/test-utils.js +13119 -0
  40. package/dist/th-EEQGL3G7.js +594 -0
  41. package/dist/tr-5FYHZQKD.js +594 -0
  42. package/dist/uk-VTWDC467.js +594 -0
  43. package/dist/vi-ISBKJ66X.js +594 -0
  44. package/dist/zh-2AW2N66Z.js +594 -0
  45. package/package.json +129 -4
  46. package/src/components/Button/Button.tsx +188 -0
  47. package/src/components/Button/__tests__/Button.test.tsx +449 -0
  48. package/src/components/CodeMirrorRenderer.tsx +536 -0
  49. package/src/components/DelegateProgress.tsx +308 -0
  50. package/src/components/ErrorBoundary.tsx +174 -0
  51. package/src/components/ItemFoundLog.tsx +42 -0
  52. package/src/components/LiveRegion.tsx +261 -0
  53. package/src/components/ProtectedErrorBoundary.css +121 -0
  54. package/src/components/ProtectedErrorBoundary.tsx +114 -0
  55. package/src/components/ResizeHandle.tsx +167 -0
  56. package/src/components/ResourceTagsInline.tsx +120 -0
  57. package/src/components/SessionExpiryBanner.css +67 -0
  58. package/src/components/SessionExpiryBanner.tsx +74 -0
  59. package/src/components/SessionTimer.tsx +17 -0
  60. package/src/components/StatusDisplay.css +439 -0
  61. package/src/components/StatusDisplay.tsx +131 -0
  62. package/src/components/Toast.css +136 -0
  63. package/src/components/Toast.tsx +217 -0
  64. package/src/components/Toolbar.tsx +194 -0
  65. package/src/components/UserMenuSkeleton.tsx +13 -0
  66. package/src/components/__tests__/DelegateProgress.denominator.test.tsx +102 -0
  67. package/src/components/__tests__/DelegateProgress.test.tsx +649 -0
  68. package/src/components/__tests__/ErrorBoundary.test.tsx +565 -0
  69. package/src/components/__tests__/LiveRegion.a11y.test.tsx +258 -0
  70. package/src/components/__tests__/LiveRegion.hooks.test.tsx +140 -0
  71. package/src/components/__tests__/ProtectedErrorBoundary.test.tsx +225 -0
  72. package/src/components/__tests__/ResizeHandle.test.tsx +159 -0
  73. package/src/components/__tests__/ResourceTagsInline.test.tsx +325 -0
  74. package/src/components/__tests__/SessionExpiryBanner.test.tsx +124 -0
  75. package/src/components/__tests__/SessionTimer.test.tsx +199 -0
  76. package/src/components/__tests__/StatusDisplay.test.tsx +179 -0
  77. package/src/components/__tests__/Toast.test.tsx +96 -0
  78. package/src/components/__tests__/Toolbar.test.tsx +111 -0
  79. package/src/components/__tests__/UserMenuSkeleton.test.tsx +182 -0
  80. package/src/components/annotation/AnchoredTextNotice.tsx +36 -0
  81. package/src/components/annotation/AnnotateToolbar.tsx +531 -0
  82. package/src/components/annotation/__tests__/AnnotateToolbar.display.test.tsx +127 -0
  83. package/src/components/annotation/__tests__/AnnotateToolbar.test.tsx +304 -0
  84. package/src/components/annotation/annotation-entries.css +138 -0
  85. package/src/components/annotation/annotations.css +93 -0
  86. package/src/components/annotation/references.css +300 -0
  87. package/src/components/annotation-popups/JsonLdView.tsx +127 -0
  88. package/src/components/annotation-popups/SharedPopupElements.tsx +131 -0
  89. package/src/components/annotation-popups/__tests__/JsonLdView.test.tsx +432 -0
  90. package/src/components/annotation-popups/__tests__/SharedPopupElements.test.tsx +297 -0
  91. package/src/components/branding/Branding.css +129 -0
  92. package/src/components/branding/XynologBranding.tsx +41 -0
  93. package/src/components/branding/__tests__/XynologBranding.test.tsx +383 -0
  94. package/src/components/error-states/ResourceErrorState.tsx +30 -0
  95. package/src/components/error-states/__tests__/ResourceErrorState.test.tsx +102 -0
  96. package/src/components/error-states/errors.css +34 -0
  97. package/src/components/image-annotation/AnnotationOverlay.tsx +307 -0
  98. package/src/components/image-annotation/SvgDrawingCanvas.tsx +514 -0
  99. package/src/components/image-annotation/__tests__/AnnotationOverlay.click.test.tsx +169 -0
  100. package/src/components/image-annotation/__tests__/AnnotationOverlay.hover.test.tsx +83 -0
  101. package/src/components/image-annotation/__tests__/SvgDrawingCanvas.annotate-gate.test.tsx +228 -0
  102. package/src/components/image-annotation/__tests__/SvgDrawingCanvas.click.test.tsx +204 -0
  103. package/src/components/layout/Header.css +99 -0
  104. package/src/components/layout/LeftSidebar.css +115 -0
  105. package/src/components/layout/LeftSidebar.tsx +150 -0
  106. package/src/components/layout/PageLayout.tsx +49 -0
  107. package/src/components/layout/ResizeHandle.css +110 -0
  108. package/src/components/layout/SkipLinks.css +84 -0
  109. package/src/components/layout/SkipLinks.tsx +36 -0
  110. package/src/components/layout/UnifiedHeader.tsx +151 -0
  111. package/src/components/layout/__tests__/LeftSidebar.test.tsx +426 -0
  112. package/src/components/layout/__tests__/PageLayout.test.tsx +311 -0
  113. package/src/components/layout/__tests__/SkipLinks.a11y.test.tsx +218 -0
  114. package/src/components/layout/__tests__/UnifiedHeader.test.tsx +555 -0
  115. package/src/components/loading-states/ComposeLoadingState.tsx +19 -0
  116. package/src/components/loading-states/ResourceLoadingState.tsx +13 -0
  117. package/src/components/loading-states/__tests__/ComposeLoadingState.test.tsx +37 -0
  118. package/src/components/loading-states/__tests__/ResourceLoadingState.test.tsx +31 -0
  119. package/src/components/loading-states/loading.css +42 -0
  120. package/src/components/modals/ComposeStep.tsx +245 -0
  121. package/src/components/modals/ConfigureGatherStep.tsx +110 -0
  122. package/src/components/modals/ConfigureGenerationStep.tsx +458 -0
  123. package/src/components/modals/ConfigureSearchStep.tsx +124 -0
  124. package/src/components/modals/ContextSummary.tsx +317 -0
  125. package/src/components/modals/CorpusPane.tsx +96 -0
  126. package/src/components/modals/DiscardPrompt.tsx +44 -0
  127. package/src/components/modals/GatherContextStep.tsx +480 -0
  128. package/src/components/modals/KbIdentityConflictModal.tsx +122 -0
  129. package/src/components/modals/KeyboardShortcutsHelpModal.tsx +238 -0
  130. package/src/components/modals/PermissionDeniedModal.tsx +207 -0
  131. package/src/components/modals/ReferenceWizardModal.tsx +656 -0
  132. package/src/components/modals/ResourceGenerateModal.tsx +457 -0
  133. package/src/components/modals/SearchModal.css +1019 -0
  134. package/src/components/modals/SearchModal.tsx +334 -0
  135. package/src/components/modals/SearchResultsStep.tsx +117 -0
  136. package/src/components/modals/SessionEndedModal.tsx +148 -0
  137. package/src/components/modals/WizardFooter.tsx +72 -0
  138. package/src/components/modals/__tests__/ComposeStep.test.tsx +187 -0
  139. package/src/components/modals/__tests__/ConfigureGatherStep.test.tsx +92 -0
  140. package/src/components/modals/__tests__/ConfigureGenerationStep.test.tsx +574 -0
  141. package/src/components/modals/__tests__/ConfigureSearchStep.test.tsx +124 -0
  142. package/src/components/modals/__tests__/GatherContextStep.resource.test.tsx +702 -0
  143. package/src/components/modals/__tests__/KbIdentityConflictModal.test.tsx +102 -0
  144. package/src/components/modals/__tests__/KeyboardShortcutsHelpModal.test.tsx +115 -0
  145. package/src/components/modals/__tests__/PermissionDeniedModal.test.tsx +218 -0
  146. package/src/components/modals/__tests__/ReferenceWizardModal.test.tsx +936 -0
  147. package/src/components/modals/__tests__/ResourceGenerateModal.test.tsx +532 -0
  148. package/src/components/modals/__tests__/SearchModal.accessibility.test.tsx +95 -0
  149. package/src/components/modals/__tests__/SearchModal.basic.test.tsx +84 -0
  150. package/src/components/modals/__tests__/SearchModal.keyboard.test.tsx +162 -0
  151. package/src/components/modals/__tests__/SearchModal.search-wiring.test.tsx +237 -0
  152. package/src/components/modals/__tests__/SearchModal.translations.test.tsx +91 -0
  153. package/src/components/modals/__tests__/SearchResultsStep.test.tsx +95 -0
  154. package/src/components/modals/__tests__/SessionEndedModal.test.tsx +171 -0
  155. package/src/components/modals/__tests__/WizardFooter.test.tsx +446 -0
  156. package/src/components/modals/__tests__/search-modal-harness.ts +82 -0
  157. package/src/components/modals/modals.css +655 -0
  158. package/src/components/navigation/CollapsibleResourceNavigation.css +10 -0
  159. package/src/components/navigation/CollapsibleResourceNavigation.tsx +364 -0
  160. package/src/components/navigation/NavigationMenu.css +59 -0
  161. package/src/components/navigation/NavigationMenu.tsx +66 -0
  162. package/src/components/navigation/NavigationTabs.css +466 -0
  163. package/src/components/navigation/ObservableLink.tsx +90 -0
  164. package/src/components/navigation/SimpleNavigation.css +9 -0
  165. package/src/components/navigation/SimpleNavigation.tsx +169 -0
  166. package/src/components/navigation/SortableResourceTab.tsx +122 -0
  167. package/src/components/navigation/__tests__/NavigationMenu.a11y.test.tsx +302 -0
  168. package/src/components/navigation/__tests__/NavigationMenu.test.tsx +399 -0
  169. package/src/components/navigation/__tests__/ObservableLink.test.tsx +85 -0
  170. package/src/components/navigation/__tests__/SimpleNavigation.test.tsx +193 -0
  171. package/src/components/navigation/__tests__/SortableResourceTab.test.tsx +421 -0
  172. package/src/components/pdf-annotation/PdfAnnotationCanvas.client.tsx +10 -0
  173. package/src/components/pdf-annotation/PdfAnnotationCanvas.css +288 -0
  174. package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +632 -0
  175. package/src/components/pdf-annotation/PdfPageView.tsx +527 -0
  176. package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.annotate-gate.test.tsx +295 -0
  177. package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.pixels-before-anchoring.test.tsx +166 -0
  178. package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +1719 -0
  179. package/src/components/pdf-annotation/__tests__/estimate-slot-height.test.ts +61 -0
  180. package/src/components/pdf-annotation/__tests__/rects-for-page.test.ts +110 -0
  181. package/src/components/pdf-annotation/estimate-slot-height.ts +31 -0
  182. package/src/components/pdf-annotation/rects-for-page.ts +50 -0
  183. package/src/components/resource/AnnotateView.tsx +373 -0
  184. package/src/components/resource/AnnotationHistory.tsx +169 -0
  185. package/src/components/resource/BrowseView.tsx +440 -0
  186. package/src/components/resource/DownloadFileLink.tsx +53 -0
  187. package/src/components/resource/HistoryEvent.tsx +186 -0
  188. package/src/components/resource/ResourceViewer.tsx +617 -0
  189. package/src/components/resource/__tests__/AnnotateView.code-point-offsets.test.tsx +482 -0
  190. package/src/components/resource/__tests__/AnnotateView.embeddable.test.tsx +78 -0
  191. package/src/components/resource/__tests__/AnnotateView.focus.test.tsx +147 -0
  192. package/src/components/resource/__tests__/AnnotateView.registry.test.tsx +143 -0
  193. package/src/components/resource/__tests__/AnnotationHistory.test.tsx +257 -0
  194. package/src/components/resource/__tests__/BrowseView.code-point-offsets.test.tsx +123 -0
  195. package/src/components/resource/__tests__/BrowseView.embeddable.test.tsx +76 -0
  196. package/src/components/resource/__tests__/BrowseView.links.test.tsx +84 -0
  197. package/src/components/resource/__tests__/BrowseView.overlay-async.test.tsx +165 -0
  198. package/src/components/resource/__tests__/BrowseView.reference-hover.test.tsx +200 -0
  199. package/src/components/resource/__tests__/BrowseView.registry.test.tsx +57 -0
  200. package/src/components/resource/__tests__/BrowseView.test.tsx +915 -0
  201. package/src/components/resource/__tests__/HistoryEvent.test.tsx +571 -0
  202. package/src/components/resource/__tests__/ResourceViewer.delete-failure.test.tsx +103 -0
  203. package/src/components/resource/__tests__/ResourceViewer.embeddable.test.tsx +250 -0
  204. package/src/components/resource/__tests__/ResourceViewer.mode-switch.test.tsx +262 -0
  205. package/src/components/resource/__tests__/ResourceViewer.multi-mount-invalidation.test.tsx +166 -0
  206. package/src/components/resource/__tests__/ResourceViewer.registry.test.tsx +112 -0
  207. package/src/components/resource/__tests__/ResourceViewer.toolbar-opt-out.test.tsx +207 -0
  208. package/src/components/resource/__tests__/ResourceViewer.toolbar-prefs.test.tsx +274 -0
  209. package/src/components/resource/__tests__/annotation-interactions.test.tsx +116 -0
  210. package/src/components/resource/__tests__/browse-renderers.dispatch.test.tsx +183 -0
  211. package/src/components/resource/__tests__/browse-renderers.test.tsx +47 -0
  212. package/src/components/resource/__tests__/download-link.test.tsx +171 -0
  213. package/src/components/resource/__tests__/event-formatting.test.ts +379 -0
  214. package/src/components/resource/__tests__/inline-embedding.test.tsx +133 -0
  215. package/src/components/resource/__tests__/media-completeness.test.tsx +144 -0
  216. package/src/components/resource/annotate-renderers.tsx +186 -0
  217. package/src/components/resource/browse-renderers.tsx +133 -0
  218. package/src/components/resource/event-formatting.ts +393 -0
  219. package/src/components/resource/panels/AssessmentEntry.tsx +127 -0
  220. package/src/components/resource/panels/AssessmentPanel.tsx +309 -0
  221. package/src/components/resource/panels/CollaborationPanel.css +184 -0
  222. package/src/components/resource/panels/CollaborationPanel.tsx +228 -0
  223. package/src/components/resource/panels/CommentEntry.tsx +242 -0
  224. package/src/components/resource/panels/CommentsPanel.tsx +320 -0
  225. package/src/components/resource/panels/DelegateSection.css +330 -0
  226. package/src/components/resource/panels/DelegateSection.tsx +282 -0
  227. package/src/components/resource/panels/DelegateShell.tsx +134 -0
  228. package/src/components/resource/panels/HighlightEntry.tsx +83 -0
  229. package/src/components/resource/panels/HighlightPanel.tsx +212 -0
  230. package/src/components/resource/panels/JsonLdPanel.css +37 -0
  231. package/src/components/resource/panels/JsonLdPanel.tsx +119 -0
  232. package/src/components/resource/panels/PanelHeader.tsx +22 -0
  233. package/src/components/resource/panels/ReferenceEntry.tsx +232 -0
  234. package/src/components/resource/panels/ReferencesPanel.css +108 -0
  235. package/src/components/resource/panels/ReferencesPanel.tsx +626 -0
  236. package/src/components/resource/panels/ResourceInfoPanel.css +183 -0
  237. package/src/components/resource/panels/ResourceInfoPanel.tsx +433 -0
  238. package/src/components/resource/panels/StatisticsPanel.css +127 -0
  239. package/src/components/resource/panels/StatisticsPanel.tsx +145 -0
  240. package/src/components/resource/panels/TagEntry.tsx +87 -0
  241. package/src/components/resource/panels/TaggingPanel.tsx +554 -0
  242. package/src/components/resource/panels/UnifiedAnnotationsPanel.css +129 -0
  243. package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +384 -0
  244. package/src/components/resource/panels/__tests__/AssessmentEntry.test.tsx +292 -0
  245. package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +685 -0
  246. package/src/components/resource/panels/__tests__/CollaborationPanel.test.tsx +685 -0
  247. package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +750 -0
  248. package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +877 -0
  249. package/src/components/resource/panels/__tests__/DelegateSection.test.tsx +623 -0
  250. package/src/components/resource/panels/__tests__/DelegateShell.test.tsx +212 -0
  251. package/src/components/resource/panels/__tests__/HighlightEntry.test.tsx +236 -0
  252. package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +506 -0
  253. package/src/components/resource/panels/__tests__/HighlightPanel.out-of-order.test.tsx +132 -0
  254. package/src/components/resource/panels/__tests__/JsonLdPanel.test.tsx +230 -0
  255. package/src/components/resource/panels/__tests__/PanelHeader.test.tsx +54 -0
  256. package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +578 -0
  257. package/src/components/resource/panels/__tests__/ReferencesPanel.headless.test.tsx +193 -0
  258. package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +193 -0
  259. package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +1080 -0
  260. package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +812 -0
  261. package/src/components/resource/panels/__tests__/ResourceInfoPanel.text-layer.test.tsx +106 -0
  262. package/src/components/resource/panels/__tests__/StatisticsPanel.test.tsx +329 -0
  263. package/src/components/resource/panels/__tests__/TagEntry.test.tsx +250 -0
  264. package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +772 -0
  265. package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.delegated-job.test.tsx +207 -0
  266. package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.failure.test.tsx +89 -0
  267. package/src/components/resource/panels/__tests__/agent-label.test.ts +136 -0
  268. package/src/components/resource/panels/agent-label.ts +35 -0
  269. package/src/components/settings/SettingsPanel.css +92 -0
  270. package/src/components/settings/SettingsPanel.tsx +251 -0
  271. package/src/components/settings/__tests__/SettingsPanel.test.tsx +260 -0
  272. package/src/components/toolbar/Toolbar.css +245 -0
  273. package/src/components/viewers/ImageViewer.tsx +18 -0
  274. package/src/components/viewers/__tests__/ImageViewer.test.tsx +57 -0
  275. package/src/components/viewers/index.ts +1 -0
  276. package/src/features/auth/__tests__/AuthErrorDisplay.test.tsx +181 -0
  277. package/src/features/auth/auth.css +120 -0
  278. package/src/features/auth/components/AuthErrorDisplay.tsx +89 -0
  279. package/src/features/moderate-entity-tags/__tests__/EntityTagsPage.test.tsx +387 -0
  280. package/src/features/moderate-entity-tags/components/EntityTagsPage.tsx +161 -0
  281. package/src/features/moderate-entity-tags/state/__tests__/entity-tags-state-unit.test.ts +183 -0
  282. package/src/features/moderate-entity-tags/state/entity-tags-state-unit.ts +73 -0
  283. package/src/features/moderate-recent/__tests__/RecentDocumentsPage.test.tsx +422 -0
  284. package/src/features/moderate-recent/components/RecentDocumentsPage.tsx +117 -0
  285. package/src/features/moderate-tag-schemas/__tests__/TagSchemasPage.test.tsx +481 -0
  286. package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +161 -0
  287. package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +600 -0
  288. package/src/features/resource-compose/__tests__/UploadProgressBar.test.tsx +256 -0
  289. package/src/features/resource-compose/components/ResourceComposePage.tsx +809 -0
  290. package/src/features/resource-compose/components/UploadProgressBar.tsx +125 -0
  291. package/src/features/resource-compose/state/__tests__/compose-page-state-unit.test.ts +195 -0
  292. package/src/features/resource-compose/state/compose-page-state-unit.ts +187 -0
  293. package/src/features/resource-discovery/__tests__/ResourceCard.test.tsx +338 -0
  294. package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +449 -0
  295. package/src/features/resource-discovery/components/ResourceCard.tsx +80 -0
  296. package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +330 -0
  297. package/src/features/resource-discovery/state/__tests__/discover-state-unit.test.ts +477 -0
  298. package/src/features/resource-discovery/state/discover-state-unit.ts +162 -0
  299. package/src/features/resource-viewer/__tests__/ResourceViewerPage.content-loading.test.tsx +260 -0
  300. package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +570 -0
  301. package/src/features/resource-viewer/__tests__/generation-params.test.ts +49 -0
  302. package/src/features/resource-viewer/components/ResourceViewerPage.tsx +1058 -0
  303. package/src/features/resource-viewer/generation-params.ts +23 -0
  304. package/src/features/resource-viewer/hooks/__tests__/useResourceViewedReport.test.tsx +77 -0
  305. package/src/features/resource-viewer/hooks/useResourceViewedReport.ts +38 -0
  306. package/src/features/resource-viewer/state/__tests__/resource-loader-state-unit.test.ts +178 -0
  307. package/src/features/resource-viewer/state/__tests__/resource-viewer-page-state-unit.test.ts +505 -0
  308. package/src/features/resource-viewer/state/resource-loader-state-unit.ts +93 -0
  309. package/src/features/resource-viewer/state/resource-viewer-page-state-unit.ts +156 -0
  310. package/src/styles/base/reset.css +105 -0
  311. package/src/styles/base/utilities.css +35 -0
  312. package/src/styles/core/badges.css +17 -0
  313. package/src/styles/core/buttons.css +772 -0
  314. package/src/styles/core/checkboxes.css +85 -0
  315. package/src/styles/core/forms.css +237 -0
  316. package/src/styles/core/index.css +43 -0
  317. package/src/styles/core/indicators.css +24 -0
  318. package/src/styles/core/inputs.css +164 -0
  319. package/src/styles/core/progress.css +85 -0
  320. package/src/styles/core/selects.css +119 -0
  321. package/src/styles/core/sliders.css +180 -0
  322. package/src/styles/core/tags.css +86 -0
  323. package/src/styles/core/textareas.css +104 -0
  324. package/src/styles/core/toggles.css +82 -0
  325. package/src/styles/features/compose.css +341 -0
  326. package/src/styles/features/entity-tags.css +140 -0
  327. package/src/styles/features/recent-docs.css +97 -0
  328. package/src/styles/features/resource-discovery.css +349 -0
  329. package/src/styles/features/resource-viewer.css +609 -0
  330. package/src/styles/features/resource.css +483 -0
  331. package/src/styles/features/schemas.css +222 -0
  332. package/src/styles/index.css +84 -0
  333. package/src/styles/layout/layout.css +28 -0
  334. package/src/styles/motivations/motivation-assessment.css +179 -0
  335. package/src/styles/motivations/motivation-comment.css +164 -0
  336. package/src/styles/motivations/motivation-highlight.css +132 -0
  337. package/src/styles/motivations/motivation-reference.css +167 -0
  338. package/src/styles/motivations/motivation-tag.css +182 -0
  339. package/src/styles/panels/history-panel.css +212 -0
  340. package/src/styles/panels/user-panel.css +21 -0
  341. package/src/styles/patterns/cards.css +26 -0
  342. package/src/styles/patterns/panel-helpers.css +32 -0
  343. package/src/styles/patterns/panels-base.css +272 -0
  344. package/src/styles/utilities/contrast.css +280 -0
  345. package/src/styles/utilities/focus-extended.css +276 -0
  346. package/src/styles/utilities/focus.css +41 -0
  347. package/src/styles/utilities/motion-overrides.css +286 -0
  348. package/src/styles/utilities/motion.css +184 -0
  349. package/src/styles/utilities/semantic-indicators.css +254 -0
  350. package/src/styles/variables.css +410 -0
  351. package/translations/ar.json +534 -0
  352. package/translations/bn.json +534 -0
  353. package/translations/cs.json +534 -0
  354. package/translations/da.json +534 -0
  355. package/translations/de.json +534 -0
  356. package/translations/el.json +534 -0
  357. package/translations/en.json +534 -0
  358. package/translations/es.json +534 -0
  359. package/translations/fa.json +534 -0
  360. package/translations/fi.json +534 -0
  361. package/translations/fr.json +534 -0
  362. package/translations/he.json +534 -0
  363. package/translations/hi.json +534 -0
  364. package/translations/id.json +534 -0
  365. package/translations/it.json +534 -0
  366. package/translations/ja.json +534 -0
  367. package/translations/ko.json +534 -0
  368. package/translations/ms.json +534 -0
  369. package/translations/nl.json +534 -0
  370. package/translations/no.json +534 -0
  371. package/translations/pl.json +534 -0
  372. package/translations/pt.json +534 -0
  373. package/translations/ro.json +534 -0
  374. package/translations/sv.json +534 -0
  375. package/translations/th.json +534 -0
  376. package/translations/tr.json +534 -0
  377. package/translations/uk.json +534 -0
  378. package/translations/vi.json +534 -0
  379. package/translations/zh.json +534 -0
@@ -0,0 +1,1058 @@
1
+ /**
2
+ * ResourceViewerPage - Self-contained resource viewer component
3
+ *
4
+ * Handles all data loading, event subscriptions, and side effects internally.
5
+ * Only requires minimal props from the framework layer (routing, modals).
6
+ */
7
+
8
+ import type { AnnotationId } from '@xynolog/core';
9
+ import React, { useState, useEffect, useCallback } from 'react';
10
+ import { useResourceViewedReport } from '../hooks/useResourceViewedReport';
11
+ import type {
12
+ components,
13
+ ResourceDescriptor,
14
+ ResourceId,
15
+ EventMap,
16
+ } from '@xynolog/core';
17
+ import type { ConnectionState, RenderMode } from '@xynolog/core';
18
+ import { folderOf } from '@xynolog/core';
19
+ import type { ComposeParams } from '../../../components/modals/ComposeStep';
20
+ import {
21
+ getLanguage,
22
+ getPrimaryRepresentation,
23
+ getPrimaryMediaType,
24
+ getStorageUri,
25
+ capabilitiesOf,
26
+ extensionForMediaType,
27
+ } from '@xynolog/core';
28
+ import { ANNOTATORS } from '@xynolog/react-ui';
29
+ import { ErrorBoundary } from '@xynolog/react-ui';
30
+ import { AnnotationHistory } from '@xynolog/react-ui';
31
+ import { UnifiedAnnotationsPanel } from '@xynolog/react-ui';
32
+ import { ResourceInfoPanel } from '@xynolog/react-ui';
33
+ import { CollaborationPanel } from '@xynolog/react-ui';
34
+ import { JsonLdPanel } from '@xynolog/react-ui';
35
+ import { Toolbar } from '@xynolog/react-ui';
36
+ import { useResourceLoadingAnnouncements } from '@xynolog/react-ui';
37
+ import { ResourceViewer } from '@xynolog/react-ui';
38
+ import type {
39
+ BrowseMediaRenderers,
40
+ AnnotateMediaRenderers,
41
+ ToolbarPanelsProps,
42
+ } from '@xynolog/react-ui';
43
+ import { useObservable } from '@xynolog/react-ui';
44
+ import { JobCancelledError } from '@xynolog/sdk';
45
+ import { useResourceContent } from '../../../hooks/useResourceContent';
46
+ import { useMediaToken } from '../../../hooks/useMediaToken';
47
+ import { useEngines } from '../../../hooks/useEngines';
48
+ import { mediaUrl } from '../../../lib/media-url';
49
+ import { useToast } from '../../../components/Toast';
50
+ import { useOutcomeToasts } from '../../../hooks/useOutcomeToasts';
51
+ import { useGenerationArrival } from '../../../hooks/useGenerationArrival';
52
+ import { useTheme } from '../../../contexts/ThemeContext';
53
+ import { useLineNumbers } from '../../../contexts/LineNumbersContext';
54
+ import { useHoverDelay } from '../../../hooks/useHoverDelay';
55
+ import {
56
+ useEventSubscriptions,
57
+ useResourceEventSubscriptions,
58
+ } from '../../../contexts/useEventSubscription';
59
+ import { useObservableExternalNavigation } from '../../../hooks/useObservableBrowse';
60
+ import { useToolbarPrefs } from '../../../hooks/useToolbarPrefs';
61
+ import { getSelectorType } from '../../../lib/media-shapes';
62
+ import { useResourceAnnotations } from '../../../contexts/ResourceAnnotationsContext';
63
+ import { useXynolog } from '../../../session/XynologProvider';
64
+ import { createResourceViewerPageStateUnit } from '../state/resource-viewer-page-state-unit';
65
+ import { useSessionStateUnit } from '../../../hooks/useSessionStateUnit';
66
+ import { useShellStateUnit } from '../../../hooks/useShellStateUnit';
67
+ import {
68
+ useTranslationManager,
69
+ useTranslations,
70
+ } from '../../../contexts/TranslationContext';
71
+ import { ReferenceWizardModal } from '../../../components/modals/ReferenceWizardModal';
72
+ import { ResourceGenerateModal } from '../../../components/modals/ResourceGenerateModal';
73
+ import type { GenerationConfig } from '../../../components/modals/ConfigureGenerationStep';
74
+ import type {
75
+ LinkComponentProps,
76
+ RouteBuilder,
77
+ } from '../../../contexts/RoutingContext';
78
+ import { toGenerationParams } from '../generation-params';
79
+
80
+ type XynologResource = ResourceDescriptor;
81
+
82
+ /**
83
+ * What the page loads for the view each render mode mounts. Exhaustive over
84
+ * `RenderMode` on purpose: a new mode fails to compile here until someone
85
+ * decides what its view reads, so it cannot default into a download.
86
+ */
87
+ type ContentSource = 'text' | 'media-url' | 'none';
88
+
89
+ const CONTENT_SOURCE: Record<RenderMode, ContentSource> = {
90
+ text: 'text',
91
+ image: 'media-url',
92
+ pdf: 'media-url',
93
+ none: 'none',
94
+ };
95
+
96
+ export interface ResourceViewerPageProps {
97
+ /**
98
+ * The resource to display
99
+ */
100
+ resource: XynologResource;
101
+
102
+ /**
103
+ * Resource URI
104
+ */
105
+ rUri: ResourceId;
106
+
107
+ /**
108
+ * Current locale
109
+ */
110
+ locale: string;
111
+
112
+ /**
113
+ * Link component for routing
114
+ */
115
+ Link: React.ComponentType<LinkComponentProps>;
116
+
117
+ /**
118
+ * Routes configuration
119
+ */
120
+ routes: RouteBuilder;
121
+
122
+ /**
123
+ * Component dependencies - passed from framework layer
124
+ */
125
+ ToolbarPanels: React.ComponentType<ToolbarPanelsProps>;
126
+
127
+ /**
128
+ * Callback to refetch document from parent
129
+ */
130
+ refetchDocument: () => Promise<unknown>;
131
+
132
+ /**
133
+ * Bus connection state for the active workspace. Six-valued state
134
+ * machine from `actor.state$`; CollaborationPanel maps it to the
135
+ * "Live" / "Disconnected" visual.
136
+ */
137
+ streamStatus: ConnectionState;
138
+
139
+ /**
140
+ * Name of the active knowledge base (for display in panels)
141
+ */
142
+ knowledgeBaseName?: string | undefined;
143
+
144
+ /**
145
+ * Media-renderer overrides, forwarded to `ResourceViewer`. Present at this
146
+ * tier too so a host embedding the whole page — not just the viewer — can
147
+ * still swap a renderer.
148
+ */
149
+ browseRenderers?: BrowseMediaRenderers;
150
+ annotateRenderers?: AnnotateMediaRenderers;
151
+ }
152
+
153
+ /**
154
+ * ResourceViewerPage - Main component
155
+ *
156
+ * Uses hooks directly (NO containers, NO render props, NO content wrapper)
157
+ *
158
+ * @emits nav:push - Navigate to a resource or filtered view
159
+ * @emits beckon:sparkle - Trigger sparkle animation on an annotation
160
+ * @emits bind:update-body - Update annotation body content
161
+ * @emits mark:archive - Archive the current resource on the knowledge base
162
+ * @emits mark:unarchive - Unarchive the current resource on the knowledge base
163
+ * @emits panel:open - Open a panel: the one the viewer asks for, or the annotations panel for a pending or newly generated annotation
164
+ * @subscribes mark:archive - Archive the current resource
165
+ * @subscribes mark:unarchive - Unarchive the current resource
166
+ * @subscribes yield:clone - Clone the current resource
167
+ * @subscribes beckon:sparkle - Trigger sparkle animation
168
+ * @subscribes mark:added - Annotation was created (sparkle)
169
+ * @subscribes mark:body-updated - Reference resolved via a linking-add operation (sparkle, both loci)
170
+ * @subscribes browse:resource-open - Open a resource in the viewer (local links + the launcher's tour verbs)
171
+ * @subscribes browse:entity-type-clicked - Navigate filtered by entity type
172
+ *
173
+ * Outcome-notification channels (mark:create-error, mark:delete-error,
174
+ * bind:body-error, job:complete, job:fail, mark:delegate-timeout) are
175
+ * subscribed by useOutcomeToasts.
176
+ */
177
+ export function ResourceViewerPage({
178
+ resource,
179
+ rUri,
180
+ locale,
181
+ Link,
182
+ routes,
183
+ ToolbarPanels,
184
+ refetchDocument,
185
+ streamStatus,
186
+ knowledgeBaseName,
187
+ browseRenderers,
188
+ annotateRenderers,
189
+ }: ResourceViewerPageProps) {
190
+ // Translations
191
+ const tw = useTranslations('ReferenceWizard');
192
+ const tg = useTranslations('ResourceGenerate');
193
+ // The viewer takes its language as a prop; the page hands it the host's own.
194
+ const translationManager = useTranslationManager();
195
+
196
+ const browser = useXynolog();
197
+ const session = useObservable(browser.activeSession$);
198
+ const xynolog = session?.client;
199
+ const navigateExternal = useObservableExternalNavigation();
200
+
201
+ // The KB's engines, for the Collaboration panel's engine rows and the
202
+ // generation ceiling. Subscribed unconditionally at the top level (hooks
203
+ // ordering) even though only some views read it; the underlying cache is a
204
+ // KB-wide singleton, so this costs one shared subscription, not one per panel open.
205
+ const { engines } = useEngines(xynolog ?? null);
206
+
207
+ // At most one engine is used for `yield` jobs — the Inference document names
208
+ // one engine under `engines.jobs.yield` — so `find` is exact, not a first-wins guess.
209
+ const generationEngine = engines.find((entry) =>
210
+ entry.jobs?.some((filter) => filter.jobType === 'yield'),
211
+ );
212
+
213
+ // ResourceViewer is bring-your-own-session: feed it the active session plus
214
+ // host-owned navigation (reference follow) and panel control (app-scoped bus).
215
+ const handleViewerOpenResource = useCallback(
216
+ (id: ResourceId) => {
217
+ navigateExternal(`/know/resource/${id}`, { resourceId: id });
218
+ },
219
+ [navigateExternal],
220
+ );
221
+
222
+ const handleViewerOpenPanel = useCallback(
223
+ (event: EventMap['panel:open']) => {
224
+ browser.emit('panel:open', event);
225
+ },
226
+ [browser],
227
+ );
228
+
229
+ // UI state hooks
230
+ const { showError, showSuccess } = useToast();
231
+ const { theme } = useTheme();
232
+ const { showLineNumbers } = useLineNumbers();
233
+ const { hoverDelayMs } = useHoverDelay();
234
+ const { triggerSparkleAnimation, clearSparkle, sparkleAnnotationIds } =
235
+ useResourceAnnotations();
236
+
237
+ // The view the viewer mounts decides what the page loads: decoded text for a
238
+ // text view, a media-token URL for an image or PDF view, and nothing for a
239
+ // type with no preview — that fallback reads no content, and its download
240
+ // link mints its own token. A registry miss has no preview either, the same
241
+ // reading BrowseView and AnnotateView take.
242
+ const resourceMediaType = getPrimaryMediaType(resource) || 'text/plain';
243
+
244
+ // Toolbar prefs: the POLICY layer. The page owns the Browser's global-toolbar
245
+ // UX — shared values, localStorage persistence — and feeds the viewer its
246
+ // controlled props; the components hold no pref state policy.
247
+ const toolbarPrefs = useToolbarPrefs(getSelectorType(resourceMediaType));
248
+ const annotateMode = toolbarPrefs.annotateMode;
249
+ const contentSource =
250
+ CONTENT_SOURCE[capabilitiesOf(resourceMediaType)?.render ?? 'none'];
251
+
252
+ // Headless hook returns the error; the page (chrome tier) owns the toast.
253
+ const {
254
+ content: textContent,
255
+ loading: textLoading,
256
+ error: contentError,
257
+ } = useResourceContent(
258
+ xynolog ?? null,
259
+ rUri,
260
+ resource,
261
+ contentSource === 'text',
262
+ );
263
+
264
+ useEffect(() => {
265
+ if (contentError) showError('Failed to load resource representation');
266
+ }, [contentError, showError]);
267
+
268
+ // A null client mints nothing: only a view that loads by URL needs a token.
269
+ const { token: mediaToken, loading: mediaTokenLoading } = useMediaToken(
270
+ contentSource === 'media-url' ? (xynolog ?? null) : null,
271
+ rUri,
272
+ );
273
+
274
+ const tokenUrl = mediaUrl(xynolog, rUri, mediaToken);
275
+
276
+ // Each source says what the view reads, whether it is still arriving, and
277
+ // whether the view has it. Loaded is a fact of the source — the text landed,
278
+ // the URL exists, there is nothing to load — never inferred from a non-empty
279
+ // string, which answers "never" for a zero-byte document and for a view that
280
+ // reads no content.
281
+ const loadedBy: Record<
282
+ ContentSource,
283
+ { content: string; contentLoading: boolean; contentLoaded: boolean }
284
+ > = {
285
+ text: {
286
+ content: textContent ?? '',
287
+ contentLoading: textLoading,
288
+ contentLoaded: textContent !== undefined,
289
+ },
290
+ 'media-url': {
291
+ content: tokenUrl ?? '',
292
+ contentLoading: mediaTokenLoading,
293
+ contentLoaded: tokenUrl !== undefined,
294
+ },
295
+ none: { content: '', contentLoading: false, contentLoaded: true },
296
+ };
297
+ const { content, contentLoading, contentLoaded } = loadedBy[contentSource];
298
+
299
+ // Composite state unit — owns all flow VMs, wizard state, annotations, entity types
300
+ const browseStateUnit = useShellStateUnit();
301
+ // Session-typed + session-keyed: no `!`, no construction without a session,
302
+ // dispose-first rebuild on session swap.
303
+ const stateUnit = useSessionStateUnit(session ?? undefined, (s) =>
304
+ createResourceViewerPageStateUnit(s, rUri, locale, browseStateUnit),
305
+ );
306
+
307
+ const annotations = useObservable(stateUnit?.annotations.value$) ?? [];
308
+ const annotationsError = useObservable(stateUnit?.annotations.error$) ?? null;
309
+ const groups = useObservable(stateUnit?.annotationGroups$);
310
+ const allEntityTypes = useObservable(stateUnit?.entityTypes.value$) ?? [];
311
+ const entityTypesError = useObservable(stateUnit?.entityTypes.error$) ?? null;
312
+ // Three states, not two: a terminally failed list has no value EITHER, so
313
+ // deriving "loading" from `undefined` leaves a dead request spinning for
314
+ // ever.
315
+ const referencedBy = useObservable(stateUnit?.referencedBy.value$) ?? [];
316
+ const referencedByLoading =
317
+ useObservable(stateUnit?.referencedBy.loading$) ?? true;
318
+ const referencedByError =
319
+ useObservable(stateUnit?.referencedBy.error$) ?? null;
320
+ const events = useObservable(stateUnit?.events.value$) ?? [];
321
+ const eventsLoading = useObservable(stateUnit?.events.loading$) ?? true;
322
+ const eventsError = useObservable(stateUnit?.events.error$) ?? null;
323
+ const hoveredAnnotationId =
324
+ useObservable(stateUnit?.beckon.hoveredAnnotationId$) ?? null;
325
+ const pendingAnnotation =
326
+ useObservable(stateUnit?.mark.pendingAnnotation$) ?? null;
327
+ const delegatingMotivation =
328
+ useObservable(stateUnit?.mark.delegatingMotivation$) ?? null;
329
+ const progress = useObservable(stateUnit?.mark.progress$) ?? null;
330
+ const progressMotivation =
331
+ useObservable(stateUnit?.mark.progressMotivation$) ?? null;
332
+ const delegatedJobId = useObservable(stateUnit?.mark.jobId$) ?? null;
333
+ const delegationFailure = useObservable(stateUnit?.mark.failure$) ?? null;
334
+ const activePanel = useObservable(stateUnit?.browse.activePanel$) ?? null;
335
+ const scrollToAnnotationId =
336
+ useObservable(stateUnit?.browse.scrollToAnnotationId$) ?? null;
337
+ const panelInitialTab =
338
+ useObservable(stateUnit?.browse.panelInitialTab$) ?? null;
339
+ const onScrollCompleted = stateUnit?.browse.onScrollCompleted;
340
+ const generationProgress = useObservable(stateUnit?.yield.progress$) ?? null;
341
+ const isGenerating = useObservable(stateUnit?.yield.isGenerating$) ?? false;
342
+ const generationJobId = useObservable(stateUnit?.yield.jobId$) ?? null;
343
+ const generationOutcome = useObservable(stateUnit?.yield.outcome$) ?? null;
344
+ const generationFailure = useObservable(stateUnit?.yield.failure$) ?? null;
345
+ // The reference whose generation is running. Only while it runs: a
346
+ // cancelled run's progress is kept, and its reference is still unresolved.
347
+ const generatingReferenceId = isGenerating
348
+ ? (generationProgress?.annotationId ?? null)
349
+ : null;
350
+
351
+ // A completion witnessed on this page reveals the derivation edge the worker
352
+ // minted — the annotations panel opens on References, scrolls to the
353
+ // provenance reference, and its sparkle is re-armed (the mark:added glow
354
+ // burned its window unseen). Never navigates; a held outcome on remount
355
+ // stays quiet (inside the hook).
356
+ const handleGenerationArrival = useCallback(
357
+ (annId: AnnotationId) => {
358
+ browser.emit('panel:open', {
359
+ panel: 'annotations',
360
+ scrollToAnnotationId: annId,
361
+ motivation: 'linking',
362
+ });
363
+ triggerSparkleAnimation(annId);
364
+ },
365
+ [browser, triggerSparkleAnimation],
366
+ );
367
+ useGenerationArrival(generationOutcome, annotations, handleGenerationArrival);
368
+
369
+ const gatherContext = useObservable(stateUnit?.gather.context$) ?? null;
370
+ const gatherLoading = useObservable(stateUnit?.gather.loading$) ?? false;
371
+ const gatherError = useObservable(stateUnit?.gather.error$) ?? null;
372
+ // Resource-gather slots (separate from the annotation slots above — the two
373
+ // gathers can be live at once).
374
+ const resourceGatherContext =
375
+ useObservable(stateUnit?.gather.resourceContext$) ?? null;
376
+ const resourceGatherLoading =
377
+ useObservable(stateUnit?.gather.resourceLoading$) ?? false;
378
+ const resourceGatherError =
379
+ useObservable(stateUnit?.gather.resourceError$) ?? null;
380
+ const wizardState = useObservable(stateUnit?.wizard$);
381
+ const wizardOpen = wizardState?.open ?? false;
382
+ const wizardAnnotationId = wizardState?.annotationId ?? null;
383
+ const wizardResourceId = wizardState?.resourceId ?? null;
384
+ const wizardDefaultTitle = wizardState?.defaultTitle ?? '';
385
+ const wizardEntityTypes = wizardState?.entityTypes ?? [];
386
+ const [generateOpen, setGenerateOpen] = useState(false);
387
+
388
+ const handleWizardClose = useCallback(() => {
389
+ stateUnit?.closeWizard();
390
+ }, [stateUnit]);
391
+
392
+ const handleWizardGenerateSubmit = useCallback(
393
+ (referenceId: AnnotationId, config: GenerationConfig) => {
394
+ clearSparkle(referenceId);
395
+ // Forwarded by spread in ONE place, so a knob added to the form is
396
+ // never dropped on the way to the wire. `sourceLanguage` is the viewed
397
+ // resource's language — a page fact the form cannot know.
398
+ stateUnit?.yield.generate(
399
+ toGenerationParams(config, getLanguage(resource)),
400
+ );
401
+ },
402
+ [stateUnit, clearSparkle, resource],
403
+ );
404
+
405
+ // Resource-generate flow, from the Generate button: drive the SAME yield
406
+ // progress$ the annotation path uses so the full `DelegateProgress` widget
407
+ // shows — NOT a toast. Both paths are one `generate(params)`: the focus of
408
+ // the params' context (resource here, annotation above) decides the shape.
409
+ const handleResourceGenerateSubmit = useCallback(
410
+ (_resourceId: string, config: GenerationConfig) => {
411
+ stateUnit?.yield.generate(
412
+ toGenerationParams(config, getLanguage(resource)),
413
+ );
414
+ },
415
+ [stateUnit, resource],
416
+ );
417
+
418
+ const handleWizardLinkResource = useCallback(
419
+ async (referenceId: AnnotationId, targetResourceId: ResourceId) => {
420
+ if (!xynolog) return;
421
+ try {
422
+ await xynolog.bind.body(rUri, referenceId, [
423
+ {
424
+ op: 'add',
425
+ item: {
426
+ type: 'SpecificResource' as const,
427
+ source: targetResourceId,
428
+ purpose: 'linking' as const,
429
+ },
430
+ },
431
+ ]);
432
+ showSuccess('Reference linked successfully');
433
+ } catch (error) {
434
+ showError(
435
+ `Failed to link reference: ${error instanceof Error ? error.message : String(error)}`,
436
+ );
437
+ }
438
+ },
439
+ [rUri, xynolog, showSuccess, showError],
440
+ );
441
+
442
+ // The wizard's compose handler: create-and-link, in place. The modal
443
+ // already holds the context, so nothing is stashed in sessionStorage and
444
+ // nothing navigates to the compose page. Text-only by design — uploads stay
445
+ // on the standalone compose page.
446
+ const handleWizardComposeSubmit = useCallback(
447
+ async (referenceId: AnnotationId, params: ComposeParams) => {
448
+ if (!xynolog) throw new Error('No active session');
449
+ try {
450
+ const format = 'text/markdown';
451
+ const file = new File(
452
+ [new Blob([params.content], { type: format })],
453
+ params.name + extensionForMediaType(format),
454
+ { type: format },
455
+ );
456
+ const newResourceId = await new Promise<ResourceId>(
457
+ (resolve, reject) => {
458
+ xynolog.yield
459
+ .resource({
460
+ name: params.name,
461
+ file,
462
+ format,
463
+ entityTypes: params.entityTypes,
464
+ language: params.language,
465
+ storageUri: params.storagePath,
466
+ })
467
+ .subscribe({
468
+ next: (event) => {
469
+ if (event.phase === 'finished') resolve(event.resourceId);
470
+ },
471
+ error: reject,
472
+ });
473
+ },
474
+ );
475
+ await xynolog.bind.body(rUri, referenceId, [
476
+ {
477
+ op: 'add',
478
+ item: {
479
+ type: 'SpecificResource' as const,
480
+ source: newResourceId,
481
+ purpose: 'linking' as const,
482
+ },
483
+ },
484
+ ]);
485
+ showSuccess('Reference successfully linked to the new resource');
486
+ } catch (error) {
487
+ showError(
488
+ `Failed to compose resource: ${error instanceof Error ? error.message : String(error)}`,
489
+ );
490
+ throw error; // ComposeStep re-enables its footer on rejection
491
+ }
492
+ },
493
+ [xynolog, rUri, showSuccess, showError],
494
+ );
495
+
496
+ // Add resource to open tabs when it loads, and record it as this KB's
497
+ // last-viewed for the /know landing route to resume from. Both are per-KB
498
+ // state owned by the browser — a global last-viewed id sends that redirect
499
+ // into the previously active KB's resource after a switch.
500
+ useEffect(() => {
501
+ if (resource && rUri) {
502
+ const mediaType = getPrimaryMediaType(resource);
503
+ browser.addOpenResource(
504
+ rUri,
505
+ resource.name,
506
+ mediaType || undefined,
507
+ getStorageUri(resource),
508
+ );
509
+ browser.setLastViewedResource(rUri);
510
+ }
511
+ }, [resource, rUri, browser]);
512
+
513
+ // Bridge: when the mark state unit produces a pending annotation, open the
514
+ // annotations panel. The mark state unit (session-scoped) can't emit `panel:open`
515
+ // (app-scoped) directly — the React tree is the natural seam between
516
+ // the two buses.
517
+ useEffect(() => {
518
+ if (pendingAnnotation) {
519
+ browser.emit('panel:open', { panel: 'annotations' });
520
+ }
521
+ }, [pendingAnnotation, browser]);
522
+
523
+ // Domain events flow through the bus gateway (ActorStateUnit → local EventBus).
524
+ // BrowseNamespace cache invalidation handles annotation/resource updates.
525
+ // Resource-scoped freshness follows observation: subscribing to the
526
+ // resource's `browse.*` live queries acquires its scope (which bridges scoped
527
+ // domain events into the local EventBus) and releases it on teardown.
528
+
529
+ const handleResourceArchive = useCallback(async () => {
530
+ if (!xynolog) return;
531
+ try {
532
+ await xynolog.mark.archive(rUri);
533
+ await refetchDocument();
534
+ } catch (err) {
535
+ console.error('Failed to archive document:', err);
536
+ showError('Failed to archive document');
537
+ }
538
+ }, [xynolog, rUri, refetchDocument, showError]);
539
+
540
+ const handleResourceUnarchive = useCallback(async () => {
541
+ if (!xynolog) return;
542
+ try {
543
+ await xynolog.mark.unarchive(rUri);
544
+ await refetchDocument();
545
+ } catch (err) {
546
+ console.error('Failed to unarchive document:', err);
547
+ showError('Failed to unarchive document');
548
+ }
549
+ }, [xynolog, rUri, refetchDocument, showError]);
550
+
551
+ const handleResourceClone = useCallback(async () => {
552
+ if (!xynolog) return;
553
+ try {
554
+ const result = await xynolog.yield.cloneToken(rUri);
555
+ const token = result.token;
556
+ browser.emit('nav:push', {
557
+ path: `/know/compose?mode=clone&token=${token}`,
558
+ reason: 'clone',
559
+ });
560
+ } catch (err) {
561
+ console.error('Failed to generate clone token:', err);
562
+ showError('Failed to generate clone link');
563
+ }
564
+ }, [xynolog, rUri, showError, browser]);
565
+
566
+ const handleAnnotationSparkle = useCallback(
567
+ ({ annotationId }: { annotationId: string }) => {
568
+ triggerSparkleAnimation(annotationId);
569
+ },
570
+ [triggerSparkleAnimation],
571
+ );
572
+
573
+ const handleAnnotationAdded = useCallback(
574
+ (stored: EventMap['mark:added']) => {
575
+ triggerSparkleAnimation(stored.payload.annotation.id);
576
+ },
577
+ [triggerSparkleAnimation],
578
+ );
579
+
580
+ // A reference resolving — Compose, Search → Link, a Generate job landing, or
581
+ // another principal's edit — is a body update whose operations add a linking
582
+ // SpecificResource. Exactly that sparkles; an unlink (remove) or an
583
+ // entity-tag body change stays dark.
584
+ const handleAnnotationBodyUpdated = useCallback(
585
+ (stored: EventMap['mark:body-updated']) => {
586
+ const resolves = stored.payload.operations.some(
587
+ (op) =>
588
+ op.op === 'add' &&
589
+ op.item.type === 'SpecificResource' &&
590
+ op.item.purpose === 'linking',
591
+ );
592
+ if (resolves) {
593
+ triggerSparkleAnimation(stored.payload.annotationId);
594
+ }
595
+ },
596
+ [triggerSparkleAnimation],
597
+ );
598
+
599
+ const handleResourceOpen = useCallback(
600
+ ({ resourceId }: { resourceId: string }) => {
601
+ browser.emit('nav:push', {
602
+ path: routes.resourceDetail(resourceId),
603
+ reason: 'reference-link',
604
+ });
605
+ },
606
+ [routes.resourceDetail, browser],
607
+ );
608
+
609
+ // A host without a knowledge page has nowhere to filter to.
610
+ const handleEntityTypeClicked = useCallback(
611
+ ({ entityType }: { entityType: string }) => {
612
+ if (!routes.knowledge) return;
613
+ const path = `${routes.knowledge()}?entityType=${encodeURIComponent(entityType)}`;
614
+ browser.emit('nav:push', { path, reason: 'entity-type-filter' });
615
+ },
616
+ [routes.knowledge, browser],
617
+ );
618
+
619
+ // Outcome notifications (annotation CRUD failures, job success/decline/fail,
620
+ // a delegated job gone quiet) live in useOutcomeToasts — they need only the resource id
621
+ // and the toast surface. The registration below keeps the handlers that need
622
+ // page-local dependencies (SDK actions, sparkles, settings, navigation).
623
+ useOutcomeToasts(rUri);
624
+
625
+ // Single useEventSubscriptions call per file (enforced by
626
+ // typescript/scripts/compliance/audit-hooks-ordering.mts); hooks like useOutcomeToasts
627
+ // own their channels in their own files.
628
+ useEventSubscriptions({
629
+ 'mark:archive': handleResourceArchive,
630
+ 'mark:unarchive': handleResourceUnarchive,
631
+ 'yield:clone': handleResourceClone,
632
+ 'beckon:sparkle': handleAnnotationSparkle,
633
+ 'browse:resource-open': handleResourceOpen,
634
+ 'browse:entity-type-clicked': handleEntityTypeClicked,
635
+ });
636
+
637
+ // This resource's own events, on its scope.
638
+ useResourceEventSubscriptions(rUri, {
639
+ 'mark:added': handleAnnotationAdded,
640
+ 'mark:body-updated': handleAnnotationBodyUpdated,
641
+ });
642
+
643
+ // Resource loading announcements
644
+ const { announceResourceLoading, announceResourceLoaded } =
645
+ useResourceLoadingAnnouncements();
646
+
647
+ // Announce content loading state changes (app-level)
648
+ useEffect(() => {
649
+ if (contentLoading) {
650
+ announceResourceLoading(resource.name);
651
+ } else if (contentLoaded) {
652
+ announceResourceLoaded(resource.name);
653
+ }
654
+ }, [
655
+ contentLoading,
656
+ contentLoaded,
657
+ resource.name,
658
+ announceResourceLoading,
659
+ announceResourceLoaded,
660
+ ]);
661
+
662
+ // Report the arrival on the wire (browse:resource-viewed) — same
663
+ // load-complete condition the announcement uses, so "viewed" means the
664
+ // view is actually on screen.
665
+ useResourceViewedReport(rUri, contentLoaded);
666
+
667
+ // Derived state
668
+ const documentEntityTypes = resource.entityTypes || [];
669
+
670
+ // Get primary representation metadata
671
+ const primaryRep = getPrimaryRepresentation(resource);
672
+ const primaryMediaType = primaryRep?.mediaType;
673
+ const primaryByteSize = primaryRep?.byteSize;
674
+
675
+ // Combine resource with content
676
+ const resourceWithContent = { ...resource, content };
677
+
678
+ // Handlers for AnnotationHistory
679
+ const handleEventHover = useCallback(
680
+ (id: AnnotationId | null) => {
681
+ if (id) {
682
+ session?.client.beckon.sparkle(id);
683
+ }
684
+ },
685
+ [session],
686
+ );
687
+
688
+ // Clicking a history row reveals that annotation in the content. HistoryEvent
689
+ // renders these rows as buttons labelled "View annotation" — focusable,
690
+ // screen-reader-announced controls, so the click must do what the label says.
691
+ // `beckon:focus` is the "scroll to and highlight" contract, used rather than
692
+ // a prop chain — BrowseView and AnnotateView both subscribe to it.
693
+ const handleEventClick = useCallback(
694
+ (id: AnnotationId | null) => {
695
+ if (id) {
696
+ stateUnit?.beckon.focus(id);
697
+ }
698
+ },
699
+ [stateUnit],
700
+ );
701
+
702
+ // Document rendering
703
+ return (
704
+ <div
705
+ className={`xynolog-document-viewer${activePanel ? ' xynolog-document-viewer--panel-open' : ''}`}
706
+ >
707
+ {/* Main Content - Fills remaining height */}
708
+ <div className="xynolog-document-viewer__main">
709
+ {/* Document Content - Left Side */}
710
+ <div className="xynolog-document-viewer__content">
711
+ {/* Document Header - Only spans document content width */}
712
+ <div className="xynolog-document-viewer__header">
713
+ <div className="xynolog-document-viewer__header-inner">
714
+ <h2 className="xynolog-document-viewer__title">
715
+ {resource.name}
716
+ </h2>
717
+ </div>
718
+ </div>
719
+ {/* Scrollable body wrapper - contains document content, header is sibling above */}
720
+ <div
721
+ className="xynolog-document-viewer__scrollable-body"
722
+ lang={getLanguage(resource) || undefined}
723
+ >
724
+ <ErrorBoundary
725
+ fallback={(error, reset) => (
726
+ <div className="xynolog-document-viewer__error">
727
+ <h3 className="xynolog-document-viewer__error-title">
728
+ Error loading document viewer
729
+ </h3>
730
+ <p className="xynolog-document-viewer__error-message">
731
+ {error.message}
732
+ </p>
733
+ <button
734
+ onClick={reset}
735
+ className="xynolog-document-viewer__error-button"
736
+ >
737
+ Try again
738
+ </button>
739
+ </div>
740
+ )}
741
+ >
742
+ {contentLoading ? (
743
+ <div className="xynolog-document-viewer__loading">
744
+ Loading document content...
745
+ </div>
746
+ ) : (
747
+ <ResourceViewer
748
+ translationManager={translationManager}
749
+ resource={resourceWithContent}
750
+ annotations={
751
+ groups ?? {
752
+ highlights: [],
753
+ comments: [],
754
+ assessments: [],
755
+ references: [],
756
+ tags: [],
757
+ }
758
+ }
759
+ session={session ?? null}
760
+ onOpenResource={handleViewerOpenResource}
761
+ onOpenPanel={handleViewerOpenPanel}
762
+ annotateMode={toolbarPrefs.annotateMode}
763
+ onAnnotateModeChange={toolbarPrefs.setAnnotateMode}
764
+ clickAction={toolbarPrefs.clickAction}
765
+ onClickActionChange={toolbarPrefs.setClickAction}
766
+ selectionMotivation={toolbarPrefs.selectionMotivation}
767
+ onSelectionMotivationChange={
768
+ toolbarPrefs.setSelectionMotivation
769
+ }
770
+ shape={toolbarPrefs.shape}
771
+ onShapeChange={toolbarPrefs.setShape}
772
+ sparkleAnnotationIds={sparkleAnnotationIds}
773
+ generatingReferenceId={generatingReferenceId}
774
+ showLineNumbers={showLineNumbers}
775
+ hoverDelayMs={hoverDelayMs}
776
+ hoveredAnnotationId={hoveredAnnotationId}
777
+ {...(browseRenderers && { browseRenderers })}
778
+ {...(annotateRenderers && { annotateRenderers })}
779
+ />
780
+ )}
781
+ </ErrorBoundary>
782
+ </div>
783
+ </div>
784
+
785
+ {/* Sidebar */}
786
+ <div className="xynolog-document-viewer__sidebar">
787
+ {/* Right Panel - Conditional based on active toolbar panel */}
788
+ <ToolbarPanels activePanel={activePanel} theme={theme}>
789
+ {/* Archived Status */}
790
+ {annotateMode && resource.archived && (
791
+ <div className="xynolog-document-viewer__archived-status">
792
+ <div className="xynolog-document-viewer__archived-text">
793
+ 📦 Archived
794
+ </div>
795
+ </div>
796
+ )}
797
+
798
+ {/* Unified Annotations Panel */}
799
+ {activePanel === 'annotations' && !resource.archived && (
800
+ <UnifiedAnnotationsPanel
801
+ session={session ?? null}
802
+ mark={stateUnit?.mark}
803
+ onOpenResource={handleViewerOpenResource}
804
+ annotations={annotations}
805
+ annotators={ANNOTATORS}
806
+ annotateMode={annotateMode}
807
+ delegatingMotivation={delegatingMotivation}
808
+ progress={progress}
809
+ progressMotivation={progressMotivation}
810
+ jobId={delegatedJobId}
811
+ // A cancelled job's commits stand: its display stays, to say so.
812
+ cancelled={delegationFailure instanceof JobCancelledError}
813
+ pendingAnnotation={pendingAnnotation}
814
+ allEntityTypes={allEntityTypes}
815
+ annotationsError={annotationsError}
816
+ onRetryAnnotations={stateUnit?.annotations.retry}
817
+ entityTypesError={entityTypesError}
818
+ generatingReferenceId={generatingReferenceId}
819
+ sparkleAnnotationIds={sparkleAnnotationIds}
820
+ referencedBy={referencedBy}
821
+ referencedByLoading={referencedByLoading}
822
+ referencedByError={referencedByError}
823
+ onRetryReferencedBy={stateUnit?.referencedBy.retry}
824
+ resourceId={rUri}
825
+ locale={locale}
826
+ sourceLanguage={getLanguage(resource)}
827
+ scrollToAnnotationId={scrollToAnnotationId}
828
+ hoveredAnnotationId={hoveredAnnotationId}
829
+ onScrollCompleted={onScrollCompleted}
830
+ initialTab={panelInitialTab?.tab}
831
+ initialTabGeneration={panelInitialTab?.generation}
832
+ Link={Link}
833
+ routes={routes}
834
+ />
835
+ )}
836
+
837
+ {/* History Panel */}
838
+ {activePanel === 'history' && (
839
+ <AnnotationHistory
840
+ events={events}
841
+ eventsLoading={eventsLoading}
842
+ eventsError={eventsError}
843
+ onRetryEvents={stateUnit?.events.retry}
844
+ annotations={annotations}
845
+ hoveredAnnotationId={hoveredAnnotationId}
846
+ onEventHover={handleEventHover}
847
+ onEventClick={handleEventClick}
848
+ Link={Link}
849
+ routes={routes}
850
+ />
851
+ )}
852
+
853
+ {/* Document Info Panel */}
854
+ {activePanel === 'info' && (
855
+ <ResourceInfoPanel
856
+ session={session ?? null}
857
+ resourceId={rUri}
858
+ documentEntityTypes={documentEntityTypes}
859
+ documentLocale={getLanguage(resource)}
860
+ primaryMediaType={primaryMediaType}
861
+ primaryByteSize={primaryByteSize}
862
+ storageUri={getStorageUri(resource)}
863
+ isArchived={resource.archived ?? false}
864
+ dateCreated={resource.dateCreated}
865
+ dateModified={resource.dateModified}
866
+ wasAttributedTo={resource.wasAttributedTo}
867
+ wasDerivedFrom={resource.wasDerivedFrom}
868
+ generator={
869
+ resource.generator as
870
+ | components['schemas']['Agent']
871
+ | components['schemas']['Agent'][]
872
+ | undefined
873
+ }
874
+ onGenerate={() => setGenerateOpen(true)}
875
+ // The panel is generation's progress surface; no annotationId
876
+ // ⇒ a resource-gen job — the annotation path's frame renders
877
+ // in the reference wizard.
878
+ isGenerating={isGenerating}
879
+ generationProgress={
880
+ generationProgress && !generationProgress.annotationId
881
+ ? generationProgress
882
+ : null
883
+ }
884
+ generationJobId={generationJobId}
885
+ generationOutcome={generationOutcome}
886
+ generationCancelled={
887
+ generationFailure instanceof JobCancelledError
888
+ }
889
+ onDismissProgress={() => stateUnit?.yield.dismissProgress()}
890
+ />
891
+ )}
892
+
893
+ {/* Collaboration Panel */}
894
+ {activePanel === 'collaboration' && (
895
+ <CollaborationPanel
896
+ state={streamStatus}
897
+ eventCount={0}
898
+ knowledgeBaseName={knowledgeBaseName}
899
+ engines={engines}
900
+ />
901
+ )}
902
+
903
+ {/* JSON-LD Panel */}
904
+ {activePanel === 'jsonld' && <JsonLdPanel resourceId={rUri} />}
905
+ </ToolbarPanels>
906
+
907
+ {/* Toolbar - Always visible on the right */}
908
+ <Toolbar
909
+ context="document"
910
+ activePanel={activePanel}
911
+ isArchived={resource.archived ?? false}
912
+ />
913
+ </div>
914
+ </div>
915
+
916
+ {/* Reference Resolution Wizard */}
917
+ <ReferenceWizardModal
918
+ {...(generationEngine ? { generationEngine } : {})}
919
+ isOpen={wizardOpen}
920
+ onClose={handleWizardClose}
921
+ annotationId={wizardAnnotationId}
922
+ resourceId={wizardResourceId}
923
+ defaultTitle={wizardDefaultTitle}
924
+ defaultFolder={folderOf(getStorageUri(resource))}
925
+ entityTypes={wizardEntityTypes}
926
+ resourceName={resource.name}
927
+ locale={locale}
928
+ context={gatherContext}
929
+ contextLoading={gatherLoading}
930
+ contextError={gatherError}
931
+ onGenerateSubmit={handleWizardGenerateSubmit}
932
+ onLinkResource={handleWizardLinkResource}
933
+ onComposeSubmit={handleWizardComposeSubmit}
934
+ entityTypeOptions={allEntityTypes}
935
+ hoverDelayMs={hoverDelayMs}
936
+ translations={{
937
+ resolveTitle: tw('resolveTitle'),
938
+ sourceContextLabel: tw('sourceContextLabel'),
939
+ connectionsLabel: tw('connectionsLabel'),
940
+ citedByLabel: tw('citedByLabel'),
941
+ userHintLabel: tw('userHintLabel'),
942
+ userHintEffect: tw('userHintEffect'),
943
+ userHintPlaceholder: tw('userHintPlaceholder'),
944
+ graphPaneTitle: tw('graphPaneTitle'),
945
+ graphEmpty: tw('graphEmpty'),
946
+ resourceLinkLabel: tw('resourceLinkLabel'),
947
+ corpusPaneTitle: tw('corpusPaneTitle'),
948
+ corpusEmpty: tw('corpusEmpty'),
949
+ excludedReceipt: tw('excludedReceipt'),
950
+ machineRead: tw('machineRead'),
951
+ loadingContext: tw('loadingContext'),
952
+ failedContext: tw('failedContext'),
953
+ search: tw('search'),
954
+ searching: tw('searching'),
955
+ generate: tw('generate'),
956
+ compose: tw('compose'),
957
+ resolutionStrategyLabel: tw('resolutionStrategyLabel'),
958
+ back: tw('back'),
959
+ link: tw('link'),
960
+ score: tw('score'),
961
+ noResults: tw('noResults'),
962
+ resourceTitle: tw('resourceTitle'),
963
+ resourceTitlePlaceholder: tw('resourceTitlePlaceholder'),
964
+ saveLocation: tw('saveLocation'),
965
+ additionalInstructions: tw('additionalInstructions'),
966
+ additionalInstructionsPlaceholder: tw(
967
+ 'additionalInstructionsPlaceholder',
968
+ ),
969
+ language: tw('language'),
970
+ languageHelp: tw('languageHelp'),
971
+ creativity: tw('creativity'),
972
+ creativityFocused: tw('creativityFocused'),
973
+ creativityCreative: tw('creativityCreative'),
974
+ maxLength: tw('maxLength'),
975
+ maxLengthHelp: tw('maxLengthHelp'),
976
+ maxLengthCeiling: tw('maxLengthCeiling'),
977
+ outputFormat: tw('outputFormat'),
978
+ formatExtensionMismatch: tw('formatExtensionMismatch'),
979
+ maxResults: tw('maxResults'),
980
+ semanticScoring: tw('semanticScoring'),
981
+ semanticScoringHelp: tw('semanticScoringHelp'),
982
+ searchFailed: tw('searchFailed'),
983
+ entityTypes: tw('entityTypes'),
984
+ contentLabel: tw('contentLabel'),
985
+ createAndLink: tw('createAndLink'),
986
+ creatingAndLinking: tw('creatingAndLinking'),
987
+ discardDraftPrompt: tw('discardDraftPrompt'),
988
+ discardDraft: tw('discardDraft'),
989
+ keepEditing: tw('keepEditing'),
990
+ }}
991
+ />
992
+
993
+ {/* Resource-generate flow, opened by the Generate button */}
994
+ <ResourceGenerateModal
995
+ {...(generationEngine ? { generationEngine } : {})}
996
+ isOpen={generateOpen}
997
+ onClose={() => setGenerateOpen(false)}
998
+ resourceId={rUri}
999
+ // Seed the proposed title from the source resource's name; the field
1000
+ // stays editable and required.
1001
+ defaultTitle={resource.name}
1002
+ defaultFolder={folderOf(getStorageUri(resource))}
1003
+ locale={locale}
1004
+ entityTypeOptions={allEntityTypes}
1005
+ onGenerateSubmit={handleResourceGenerateSubmit}
1006
+ gatherContext={resourceGatherContext}
1007
+ gatherLoading={resourceGatherLoading}
1008
+ gatherError={resourceGatherError}
1009
+ onGather={(options) => stateUnit?.gather.gatherResource(rUri, options)}
1010
+ translations={{
1011
+ title: tg('title'),
1012
+ gatherIntro: tg('gatherIntro'),
1013
+ includeContent: tg('includeContent'),
1014
+ includeSummary: tg('includeSummary'),
1015
+ gatherDepth: tg('gatherDepth'),
1016
+ gatherMaxResources: tg('gatherMaxResources'),
1017
+ gatherButton: tg('gatherButton'),
1018
+ editGather: tg('editGather'),
1019
+ recallLabel: tg('recallLabel'),
1020
+ loadingContext: tg('loadingContext'),
1021
+ failedContext: tg('failedContext'),
1022
+ sourceContextLabel: tg('sourceContextLabel'),
1023
+ connectionsLabel: tg('connectionsLabel'),
1024
+ citedByLabel: tg('citedByLabel'),
1025
+ graphPaneTitle: tg('graphPaneTitle'),
1026
+ graphEmpty: tg('graphEmpty'),
1027
+ resourceLinkLabel: tg('resourceLinkLabel'),
1028
+ corpusPaneTitle: tg('corpusPaneTitle'),
1029
+ corpusEmpty: tg('corpusEmpty'),
1030
+ excludedReceipt: tg('excludedReceipt'),
1031
+ machineRead: tg('machineRead'),
1032
+ score: tg('score'),
1033
+ resourceTitle: tg('resourceTitle'),
1034
+ resourceTitlePlaceholder: tg('resourceTitlePlaceholder'),
1035
+ saveLocation: tg('saveLocation'),
1036
+ additionalInstructions: tg('additionalInstructions'),
1037
+ additionalInstructionsPlaceholder: tg(
1038
+ 'additionalInstructionsPlaceholder',
1039
+ ),
1040
+ language: tg('language'),
1041
+ languageHelp: tg('languageHelp'),
1042
+ creativity: tg('creativity'),
1043
+ creativityFocused: tg('creativityFocused'),
1044
+ creativityCreative: tg('creativityCreative'),
1045
+ maxLength: tg('maxLength'),
1046
+ maxLengthHelp: tg('maxLengthHelp'),
1047
+ maxLengthCeiling: tg('maxLengthCeiling'),
1048
+ outputFormat: tg('outputFormat'),
1049
+ formatExtensionMismatch: tg('formatExtensionMismatch'),
1050
+ generate: tg('generate'),
1051
+ discardDraftPrompt: tg('discardDraftPrompt'),
1052
+ discardDraft: tg('discardDraft'),
1053
+ keepEditing: tg('keepEditing'),
1054
+ }}
1055
+ />
1056
+ </div>
1057
+ );
1058
+ }