@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.
- package/LICENSE +201 -0
- package/README.md +379 -2
- package/dist/PdfAnnotationCanvas.client-S64VRLUN.css +193 -0
- package/dist/PdfAnnotationCanvas.client-V7R4NXFO.js +799 -0
- package/dist/ar-AIV7P4FL.js +594 -0
- package/dist/bn-J2OR57PB.js +594 -0
- package/dist/chunk-4L3TYOIV.js +172 -0
- package/dist/chunk-BM76QBIO.js +594 -0
- package/dist/chunk-D2O46PZQ.js +240 -0
- package/dist/chunk-O23TLLXW.js +42 -0
- package/dist/chunk-WGTUIB6C.js +304 -0
- package/dist/cs-JNEAMHFB.js +594 -0
- package/dist/da-UY5ZRVTZ.js +594 -0
- package/dist/de-EETVXC42.js +594 -0
- package/dist/el-S5YKDMTL.js +594 -0
- package/dist/en-3YQWF45H.js +61 -0
- package/dist/es-GHA7S27R.js +594 -0
- package/dist/fa-JTR3GF6I.js +594 -0
- package/dist/fi-CQZ7BW57.js +594 -0
- package/dist/fr-OJH2WIY7.js +594 -0
- package/dist/he-2DBXWA2V.js +594 -0
- package/dist/hi-NZP7B55I.js +594 -0
- package/dist/id-4KXFKWOI.js +594 -0
- package/dist/index.css +4134 -0
- package/dist/index.d.ts +4040 -0
- package/dist/index.js +29638 -0
- package/dist/it-XBMYGKKY.js +594 -0
- package/dist/ja-OVHZS3EH.js +594 -0
- package/dist/ko-NW2MVM5L.js +594 -0
- package/dist/ms-RXLPBZLK.js +594 -0
- package/dist/nl-77CTBEDA.js +594 -0
- package/dist/no-RAPO56SE.js +594 -0
- package/dist/pl-XCFXZCTT.js +594 -0
- package/dist/pt-EMBE27IS.js +594 -0
- package/dist/ro-M7QLJBYN.js +594 -0
- package/dist/sv-ST6CITQY.js +594 -0
- package/dist/test-utils.css +112 -0
- package/dist/test-utils.d.ts +126 -0
- package/dist/test-utils.js +13119 -0
- package/dist/th-EEQGL3G7.js +594 -0
- package/dist/tr-5FYHZQKD.js +594 -0
- package/dist/uk-VTWDC467.js +594 -0
- package/dist/vi-ISBKJ66X.js +594 -0
- package/dist/zh-2AW2N66Z.js +594 -0
- package/package.json +129 -4
- package/src/components/Button/Button.tsx +188 -0
- package/src/components/Button/__tests__/Button.test.tsx +449 -0
- package/src/components/CodeMirrorRenderer.tsx +536 -0
- package/src/components/DelegateProgress.tsx +308 -0
- package/src/components/ErrorBoundary.tsx +174 -0
- package/src/components/ItemFoundLog.tsx +42 -0
- package/src/components/LiveRegion.tsx +261 -0
- package/src/components/ProtectedErrorBoundary.css +121 -0
- package/src/components/ProtectedErrorBoundary.tsx +114 -0
- package/src/components/ResizeHandle.tsx +167 -0
- package/src/components/ResourceTagsInline.tsx +120 -0
- package/src/components/SessionExpiryBanner.css +67 -0
- package/src/components/SessionExpiryBanner.tsx +74 -0
- package/src/components/SessionTimer.tsx +17 -0
- package/src/components/StatusDisplay.css +439 -0
- package/src/components/StatusDisplay.tsx +131 -0
- package/src/components/Toast.css +136 -0
- package/src/components/Toast.tsx +217 -0
- package/src/components/Toolbar.tsx +194 -0
- package/src/components/UserMenuSkeleton.tsx +13 -0
- package/src/components/__tests__/DelegateProgress.denominator.test.tsx +102 -0
- package/src/components/__tests__/DelegateProgress.test.tsx +649 -0
- package/src/components/__tests__/ErrorBoundary.test.tsx +565 -0
- package/src/components/__tests__/LiveRegion.a11y.test.tsx +258 -0
- package/src/components/__tests__/LiveRegion.hooks.test.tsx +140 -0
- package/src/components/__tests__/ProtectedErrorBoundary.test.tsx +225 -0
- package/src/components/__tests__/ResizeHandle.test.tsx +159 -0
- package/src/components/__tests__/ResourceTagsInline.test.tsx +325 -0
- package/src/components/__tests__/SessionExpiryBanner.test.tsx +124 -0
- package/src/components/__tests__/SessionTimer.test.tsx +199 -0
- package/src/components/__tests__/StatusDisplay.test.tsx +179 -0
- package/src/components/__tests__/Toast.test.tsx +96 -0
- package/src/components/__tests__/Toolbar.test.tsx +111 -0
- package/src/components/__tests__/UserMenuSkeleton.test.tsx +182 -0
- package/src/components/annotation/AnchoredTextNotice.tsx +36 -0
- package/src/components/annotation/AnnotateToolbar.tsx +531 -0
- package/src/components/annotation/__tests__/AnnotateToolbar.display.test.tsx +127 -0
- package/src/components/annotation/__tests__/AnnotateToolbar.test.tsx +304 -0
- package/src/components/annotation/annotation-entries.css +138 -0
- package/src/components/annotation/annotations.css +93 -0
- package/src/components/annotation/references.css +300 -0
- package/src/components/annotation-popups/JsonLdView.tsx +127 -0
- package/src/components/annotation-popups/SharedPopupElements.tsx +131 -0
- package/src/components/annotation-popups/__tests__/JsonLdView.test.tsx +432 -0
- package/src/components/annotation-popups/__tests__/SharedPopupElements.test.tsx +297 -0
- package/src/components/branding/Branding.css +129 -0
- package/src/components/branding/XynologBranding.tsx +41 -0
- package/src/components/branding/__tests__/XynologBranding.test.tsx +383 -0
- package/src/components/error-states/ResourceErrorState.tsx +30 -0
- package/src/components/error-states/__tests__/ResourceErrorState.test.tsx +102 -0
- package/src/components/error-states/errors.css +34 -0
- package/src/components/image-annotation/AnnotationOverlay.tsx +307 -0
- package/src/components/image-annotation/SvgDrawingCanvas.tsx +514 -0
- package/src/components/image-annotation/__tests__/AnnotationOverlay.click.test.tsx +169 -0
- package/src/components/image-annotation/__tests__/AnnotationOverlay.hover.test.tsx +83 -0
- package/src/components/image-annotation/__tests__/SvgDrawingCanvas.annotate-gate.test.tsx +228 -0
- package/src/components/image-annotation/__tests__/SvgDrawingCanvas.click.test.tsx +204 -0
- package/src/components/layout/Header.css +99 -0
- package/src/components/layout/LeftSidebar.css +115 -0
- package/src/components/layout/LeftSidebar.tsx +150 -0
- package/src/components/layout/PageLayout.tsx +49 -0
- package/src/components/layout/ResizeHandle.css +110 -0
- package/src/components/layout/SkipLinks.css +84 -0
- package/src/components/layout/SkipLinks.tsx +36 -0
- package/src/components/layout/UnifiedHeader.tsx +151 -0
- package/src/components/layout/__tests__/LeftSidebar.test.tsx +426 -0
- package/src/components/layout/__tests__/PageLayout.test.tsx +311 -0
- package/src/components/layout/__tests__/SkipLinks.a11y.test.tsx +218 -0
- package/src/components/layout/__tests__/UnifiedHeader.test.tsx +555 -0
- package/src/components/loading-states/ComposeLoadingState.tsx +19 -0
- package/src/components/loading-states/ResourceLoadingState.tsx +13 -0
- package/src/components/loading-states/__tests__/ComposeLoadingState.test.tsx +37 -0
- package/src/components/loading-states/__tests__/ResourceLoadingState.test.tsx +31 -0
- package/src/components/loading-states/loading.css +42 -0
- package/src/components/modals/ComposeStep.tsx +245 -0
- package/src/components/modals/ConfigureGatherStep.tsx +110 -0
- package/src/components/modals/ConfigureGenerationStep.tsx +458 -0
- package/src/components/modals/ConfigureSearchStep.tsx +124 -0
- package/src/components/modals/ContextSummary.tsx +317 -0
- package/src/components/modals/CorpusPane.tsx +96 -0
- package/src/components/modals/DiscardPrompt.tsx +44 -0
- package/src/components/modals/GatherContextStep.tsx +480 -0
- package/src/components/modals/KbIdentityConflictModal.tsx +122 -0
- package/src/components/modals/KeyboardShortcutsHelpModal.tsx +238 -0
- package/src/components/modals/PermissionDeniedModal.tsx +207 -0
- package/src/components/modals/ReferenceWizardModal.tsx +656 -0
- package/src/components/modals/ResourceGenerateModal.tsx +457 -0
- package/src/components/modals/SearchModal.css +1019 -0
- package/src/components/modals/SearchModal.tsx +334 -0
- package/src/components/modals/SearchResultsStep.tsx +117 -0
- package/src/components/modals/SessionEndedModal.tsx +148 -0
- package/src/components/modals/WizardFooter.tsx +72 -0
- package/src/components/modals/__tests__/ComposeStep.test.tsx +187 -0
- package/src/components/modals/__tests__/ConfigureGatherStep.test.tsx +92 -0
- package/src/components/modals/__tests__/ConfigureGenerationStep.test.tsx +574 -0
- package/src/components/modals/__tests__/ConfigureSearchStep.test.tsx +124 -0
- package/src/components/modals/__tests__/GatherContextStep.resource.test.tsx +702 -0
- package/src/components/modals/__tests__/KbIdentityConflictModal.test.tsx +102 -0
- package/src/components/modals/__tests__/KeyboardShortcutsHelpModal.test.tsx +115 -0
- package/src/components/modals/__tests__/PermissionDeniedModal.test.tsx +218 -0
- package/src/components/modals/__tests__/ReferenceWizardModal.test.tsx +936 -0
- package/src/components/modals/__tests__/ResourceGenerateModal.test.tsx +532 -0
- package/src/components/modals/__tests__/SearchModal.accessibility.test.tsx +95 -0
- package/src/components/modals/__tests__/SearchModal.basic.test.tsx +84 -0
- package/src/components/modals/__tests__/SearchModal.keyboard.test.tsx +162 -0
- package/src/components/modals/__tests__/SearchModal.search-wiring.test.tsx +237 -0
- package/src/components/modals/__tests__/SearchModal.translations.test.tsx +91 -0
- package/src/components/modals/__tests__/SearchResultsStep.test.tsx +95 -0
- package/src/components/modals/__tests__/SessionEndedModal.test.tsx +171 -0
- package/src/components/modals/__tests__/WizardFooter.test.tsx +446 -0
- package/src/components/modals/__tests__/search-modal-harness.ts +82 -0
- package/src/components/modals/modals.css +655 -0
- package/src/components/navigation/CollapsibleResourceNavigation.css +10 -0
- package/src/components/navigation/CollapsibleResourceNavigation.tsx +364 -0
- package/src/components/navigation/NavigationMenu.css +59 -0
- package/src/components/navigation/NavigationMenu.tsx +66 -0
- package/src/components/navigation/NavigationTabs.css +466 -0
- package/src/components/navigation/ObservableLink.tsx +90 -0
- package/src/components/navigation/SimpleNavigation.css +9 -0
- package/src/components/navigation/SimpleNavigation.tsx +169 -0
- package/src/components/navigation/SortableResourceTab.tsx +122 -0
- package/src/components/navigation/__tests__/NavigationMenu.a11y.test.tsx +302 -0
- package/src/components/navigation/__tests__/NavigationMenu.test.tsx +399 -0
- package/src/components/navigation/__tests__/ObservableLink.test.tsx +85 -0
- package/src/components/navigation/__tests__/SimpleNavigation.test.tsx +193 -0
- package/src/components/navigation/__tests__/SortableResourceTab.test.tsx +421 -0
- package/src/components/pdf-annotation/PdfAnnotationCanvas.client.tsx +10 -0
- package/src/components/pdf-annotation/PdfAnnotationCanvas.css +288 -0
- package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +632 -0
- package/src/components/pdf-annotation/PdfPageView.tsx +527 -0
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.annotate-gate.test.tsx +295 -0
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.pixels-before-anchoring.test.tsx +166 -0
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +1719 -0
- package/src/components/pdf-annotation/__tests__/estimate-slot-height.test.ts +61 -0
- package/src/components/pdf-annotation/__tests__/rects-for-page.test.ts +110 -0
- package/src/components/pdf-annotation/estimate-slot-height.ts +31 -0
- package/src/components/pdf-annotation/rects-for-page.ts +50 -0
- package/src/components/resource/AnnotateView.tsx +373 -0
- package/src/components/resource/AnnotationHistory.tsx +169 -0
- package/src/components/resource/BrowseView.tsx +440 -0
- package/src/components/resource/DownloadFileLink.tsx +53 -0
- package/src/components/resource/HistoryEvent.tsx +186 -0
- package/src/components/resource/ResourceViewer.tsx +617 -0
- package/src/components/resource/__tests__/AnnotateView.code-point-offsets.test.tsx +482 -0
- package/src/components/resource/__tests__/AnnotateView.embeddable.test.tsx +78 -0
- package/src/components/resource/__tests__/AnnotateView.focus.test.tsx +147 -0
- package/src/components/resource/__tests__/AnnotateView.registry.test.tsx +143 -0
- package/src/components/resource/__tests__/AnnotationHistory.test.tsx +257 -0
- package/src/components/resource/__tests__/BrowseView.code-point-offsets.test.tsx +123 -0
- package/src/components/resource/__tests__/BrowseView.embeddable.test.tsx +76 -0
- package/src/components/resource/__tests__/BrowseView.links.test.tsx +84 -0
- package/src/components/resource/__tests__/BrowseView.overlay-async.test.tsx +165 -0
- package/src/components/resource/__tests__/BrowseView.reference-hover.test.tsx +200 -0
- package/src/components/resource/__tests__/BrowseView.registry.test.tsx +57 -0
- package/src/components/resource/__tests__/BrowseView.test.tsx +915 -0
- package/src/components/resource/__tests__/HistoryEvent.test.tsx +571 -0
- package/src/components/resource/__tests__/ResourceViewer.delete-failure.test.tsx +103 -0
- package/src/components/resource/__tests__/ResourceViewer.embeddable.test.tsx +250 -0
- package/src/components/resource/__tests__/ResourceViewer.mode-switch.test.tsx +262 -0
- package/src/components/resource/__tests__/ResourceViewer.multi-mount-invalidation.test.tsx +166 -0
- package/src/components/resource/__tests__/ResourceViewer.registry.test.tsx +112 -0
- package/src/components/resource/__tests__/ResourceViewer.toolbar-opt-out.test.tsx +207 -0
- package/src/components/resource/__tests__/ResourceViewer.toolbar-prefs.test.tsx +274 -0
- package/src/components/resource/__tests__/annotation-interactions.test.tsx +116 -0
- package/src/components/resource/__tests__/browse-renderers.dispatch.test.tsx +183 -0
- package/src/components/resource/__tests__/browse-renderers.test.tsx +47 -0
- package/src/components/resource/__tests__/download-link.test.tsx +171 -0
- package/src/components/resource/__tests__/event-formatting.test.ts +379 -0
- package/src/components/resource/__tests__/inline-embedding.test.tsx +133 -0
- package/src/components/resource/__tests__/media-completeness.test.tsx +144 -0
- package/src/components/resource/annotate-renderers.tsx +186 -0
- package/src/components/resource/browse-renderers.tsx +133 -0
- package/src/components/resource/event-formatting.ts +393 -0
- package/src/components/resource/panels/AssessmentEntry.tsx +127 -0
- package/src/components/resource/panels/AssessmentPanel.tsx +309 -0
- package/src/components/resource/panels/CollaborationPanel.css +184 -0
- package/src/components/resource/panels/CollaborationPanel.tsx +228 -0
- package/src/components/resource/panels/CommentEntry.tsx +242 -0
- package/src/components/resource/panels/CommentsPanel.tsx +320 -0
- package/src/components/resource/panels/DelegateSection.css +330 -0
- package/src/components/resource/panels/DelegateSection.tsx +282 -0
- package/src/components/resource/panels/DelegateShell.tsx +134 -0
- package/src/components/resource/panels/HighlightEntry.tsx +83 -0
- package/src/components/resource/panels/HighlightPanel.tsx +212 -0
- package/src/components/resource/panels/JsonLdPanel.css +37 -0
- package/src/components/resource/panels/JsonLdPanel.tsx +119 -0
- package/src/components/resource/panels/PanelHeader.tsx +22 -0
- package/src/components/resource/panels/ReferenceEntry.tsx +232 -0
- package/src/components/resource/panels/ReferencesPanel.css +108 -0
- package/src/components/resource/panels/ReferencesPanel.tsx +626 -0
- package/src/components/resource/panels/ResourceInfoPanel.css +183 -0
- package/src/components/resource/panels/ResourceInfoPanel.tsx +433 -0
- package/src/components/resource/panels/StatisticsPanel.css +127 -0
- package/src/components/resource/panels/StatisticsPanel.tsx +145 -0
- package/src/components/resource/panels/TagEntry.tsx +87 -0
- package/src/components/resource/panels/TaggingPanel.tsx +554 -0
- package/src/components/resource/panels/UnifiedAnnotationsPanel.css +129 -0
- package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +384 -0
- package/src/components/resource/panels/__tests__/AssessmentEntry.test.tsx +292 -0
- package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +685 -0
- package/src/components/resource/panels/__tests__/CollaborationPanel.test.tsx +685 -0
- package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +750 -0
- package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +877 -0
- package/src/components/resource/panels/__tests__/DelegateSection.test.tsx +623 -0
- package/src/components/resource/panels/__tests__/DelegateShell.test.tsx +212 -0
- package/src/components/resource/panels/__tests__/HighlightEntry.test.tsx +236 -0
- package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +506 -0
- package/src/components/resource/panels/__tests__/HighlightPanel.out-of-order.test.tsx +132 -0
- package/src/components/resource/panels/__tests__/JsonLdPanel.test.tsx +230 -0
- package/src/components/resource/panels/__tests__/PanelHeader.test.tsx +54 -0
- package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +578 -0
- package/src/components/resource/panels/__tests__/ReferencesPanel.headless.test.tsx +193 -0
- package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +193 -0
- package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +1080 -0
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +812 -0
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.text-layer.test.tsx +106 -0
- package/src/components/resource/panels/__tests__/StatisticsPanel.test.tsx +329 -0
- package/src/components/resource/panels/__tests__/TagEntry.test.tsx +250 -0
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +772 -0
- package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.delegated-job.test.tsx +207 -0
- package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.failure.test.tsx +89 -0
- package/src/components/resource/panels/__tests__/agent-label.test.ts +136 -0
- package/src/components/resource/panels/agent-label.ts +35 -0
- package/src/components/settings/SettingsPanel.css +92 -0
- package/src/components/settings/SettingsPanel.tsx +251 -0
- package/src/components/settings/__tests__/SettingsPanel.test.tsx +260 -0
- package/src/components/toolbar/Toolbar.css +245 -0
- package/src/components/viewers/ImageViewer.tsx +18 -0
- package/src/components/viewers/__tests__/ImageViewer.test.tsx +57 -0
- package/src/components/viewers/index.ts +1 -0
- package/src/features/auth/__tests__/AuthErrorDisplay.test.tsx +181 -0
- package/src/features/auth/auth.css +120 -0
- package/src/features/auth/components/AuthErrorDisplay.tsx +89 -0
- package/src/features/moderate-entity-tags/__tests__/EntityTagsPage.test.tsx +387 -0
- package/src/features/moderate-entity-tags/components/EntityTagsPage.tsx +161 -0
- package/src/features/moderate-entity-tags/state/__tests__/entity-tags-state-unit.test.ts +183 -0
- package/src/features/moderate-entity-tags/state/entity-tags-state-unit.ts +73 -0
- package/src/features/moderate-recent/__tests__/RecentDocumentsPage.test.tsx +422 -0
- package/src/features/moderate-recent/components/RecentDocumentsPage.tsx +117 -0
- package/src/features/moderate-tag-schemas/__tests__/TagSchemasPage.test.tsx +481 -0
- package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +161 -0
- package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +600 -0
- package/src/features/resource-compose/__tests__/UploadProgressBar.test.tsx +256 -0
- package/src/features/resource-compose/components/ResourceComposePage.tsx +809 -0
- package/src/features/resource-compose/components/UploadProgressBar.tsx +125 -0
- package/src/features/resource-compose/state/__tests__/compose-page-state-unit.test.ts +195 -0
- package/src/features/resource-compose/state/compose-page-state-unit.ts +187 -0
- package/src/features/resource-discovery/__tests__/ResourceCard.test.tsx +338 -0
- package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +449 -0
- package/src/features/resource-discovery/components/ResourceCard.tsx +80 -0
- package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +330 -0
- package/src/features/resource-discovery/state/__tests__/discover-state-unit.test.ts +477 -0
- package/src/features/resource-discovery/state/discover-state-unit.ts +162 -0
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.content-loading.test.tsx +260 -0
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +570 -0
- package/src/features/resource-viewer/__tests__/generation-params.test.ts +49 -0
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +1058 -0
- package/src/features/resource-viewer/generation-params.ts +23 -0
- package/src/features/resource-viewer/hooks/__tests__/useResourceViewedReport.test.tsx +77 -0
- package/src/features/resource-viewer/hooks/useResourceViewedReport.ts +38 -0
- package/src/features/resource-viewer/state/__tests__/resource-loader-state-unit.test.ts +178 -0
- package/src/features/resource-viewer/state/__tests__/resource-viewer-page-state-unit.test.ts +505 -0
- package/src/features/resource-viewer/state/resource-loader-state-unit.ts +93 -0
- package/src/features/resource-viewer/state/resource-viewer-page-state-unit.ts +156 -0
- package/src/styles/base/reset.css +105 -0
- package/src/styles/base/utilities.css +35 -0
- package/src/styles/core/badges.css +17 -0
- package/src/styles/core/buttons.css +772 -0
- package/src/styles/core/checkboxes.css +85 -0
- package/src/styles/core/forms.css +237 -0
- package/src/styles/core/index.css +43 -0
- package/src/styles/core/indicators.css +24 -0
- package/src/styles/core/inputs.css +164 -0
- package/src/styles/core/progress.css +85 -0
- package/src/styles/core/selects.css +119 -0
- package/src/styles/core/sliders.css +180 -0
- package/src/styles/core/tags.css +86 -0
- package/src/styles/core/textareas.css +104 -0
- package/src/styles/core/toggles.css +82 -0
- package/src/styles/features/compose.css +341 -0
- package/src/styles/features/entity-tags.css +140 -0
- package/src/styles/features/recent-docs.css +97 -0
- package/src/styles/features/resource-discovery.css +349 -0
- package/src/styles/features/resource-viewer.css +609 -0
- package/src/styles/features/resource.css +483 -0
- package/src/styles/features/schemas.css +222 -0
- package/src/styles/index.css +84 -0
- package/src/styles/layout/layout.css +28 -0
- package/src/styles/motivations/motivation-assessment.css +179 -0
- package/src/styles/motivations/motivation-comment.css +164 -0
- package/src/styles/motivations/motivation-highlight.css +132 -0
- package/src/styles/motivations/motivation-reference.css +167 -0
- package/src/styles/motivations/motivation-tag.css +182 -0
- package/src/styles/panels/history-panel.css +212 -0
- package/src/styles/panels/user-panel.css +21 -0
- package/src/styles/patterns/cards.css +26 -0
- package/src/styles/patterns/panel-helpers.css +32 -0
- package/src/styles/patterns/panels-base.css +272 -0
- package/src/styles/utilities/contrast.css +280 -0
- package/src/styles/utilities/focus-extended.css +276 -0
- package/src/styles/utilities/focus.css +41 -0
- package/src/styles/utilities/motion-overrides.css +286 -0
- package/src/styles/utilities/motion.css +184 -0
- package/src/styles/utilities/semantic-indicators.css +254 -0
- package/src/styles/variables.css +410 -0
- package/translations/ar.json +534 -0
- package/translations/bn.json +534 -0
- package/translations/cs.json +534 -0
- package/translations/da.json +534 -0
- package/translations/de.json +534 -0
- package/translations/el.json +534 -0
- package/translations/en.json +534 -0
- package/translations/es.json +534 -0
- package/translations/fa.json +534 -0
- package/translations/fi.json +534 -0
- package/translations/fr.json +534 -0
- package/translations/he.json +534 -0
- package/translations/hi.json +534 -0
- package/translations/id.json +534 -0
- package/translations/it.json +534 -0
- package/translations/ja.json +534 -0
- package/translations/ko.json +534 -0
- package/translations/ms.json +534 -0
- package/translations/nl.json +534 -0
- package/translations/no.json +534 -0
- package/translations/pl.json +534 -0
- package/translations/pt.json +534 -0
- package/translations/ro.json +534 -0
- package/translations/sv.json +534 -0
- package/translations/th.json +534 -0
- package/translations/tr.json +534 -0
- package/translations/uk.json +534 -0
- package/translations/vi.json +534 -0
- package/translations/zh.json +534 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4040 @@
|
|
|
1
|
+
import * as _xynolog_react_ui from '@xynolog/react-ui';
|
|
2
|
+
import { ToolbarPanelsProps as ToolbarPanelsProps$1, BrowseMediaRenderers as BrowseMediaRenderers$1, AnnotateMediaRenderers as AnnotateMediaRenderers$1 } from '@xynolog/react-ui';
|
|
3
|
+
import { Annotation, Motivation as Motivation$2, ResourceId, Selector, components, ResourceDescriptor, TextOffsets, ValidationResult, StateUnit, EngineWithLimits, UnscopedChannel, EventMap, DiscoveredKB, ResourceScopedChannel, AnnotationId, LocaleCode, AnchorStrategy, AnchorConfidence, JobId, RenderMode, AttributedEvent, ConnectionState, YieldJobDone, GenerationJobParams, GatheredContext, AccessToken } from '@xynolog/core';
|
|
4
|
+
export { Annotation } from '@xynolog/core';
|
|
5
|
+
import * as React$1 from 'react';
|
|
6
|
+
import React__default, { ComponentType, ReactNode, KeyboardEvent as KeyboardEvent$1, Component, ErrorInfo, MouseEvent, Ref, ComponentProps } from 'react';
|
|
7
|
+
import * as _codemirror_state from '@codemirror/state';
|
|
8
|
+
import { HighlightStyle } from '@codemirror/language';
|
|
9
|
+
import { WidgetType } from '@codemirror/view';
|
|
10
|
+
import { XynologClient, XynologSession, DiscoveryTransport, DiscoveryState, XynologBrowser, SessionStorage, SessionFactory, MarkStateUnit, PendingAnnotation, OpenResource, ResourceGatherOptions, TagSchema, UploadProgress, BeckonStateUnit, GatherStateUnit, YieldStateUnit, ReferencedByEntry } from '@xynolog/sdk';
|
|
11
|
+
export { BeckonStateUnit, GatherStateUnit, HOVER_DELAY_MS, HoverDwell, MarkStateUnit, MatchStateUnit, PendingAnnotation, SearchPipeline, SearchPipelineOptions, SearchState, TagSchema, YieldStateUnit, createBeckonStateUnit, createGatherStateUnit, createHoverDwell, createMarkStateUnit, createMatchStateUnit, createSearchPipeline, createYieldStateUnit } from '@xynolog/sdk';
|
|
12
|
+
import { Observable } from 'rxjs';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Collection of all annotation types for a resource.
|
|
16
|
+
*/
|
|
17
|
+
interface AnnotationsCollection {
|
|
18
|
+
highlights: Annotation[];
|
|
19
|
+
references: Annotation[];
|
|
20
|
+
assessments: Annotation[];
|
|
21
|
+
comments: Annotation[];
|
|
22
|
+
tags: Annotation[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Event handlers for annotation interactions.
|
|
26
|
+
* Groups multiple click and hover handlers into a single interface.
|
|
27
|
+
*/
|
|
28
|
+
interface AnnotationHandlers {
|
|
29
|
+
/** Unified click handler - routes based on annotation type and current mode */
|
|
30
|
+
onClick?: (annotation: Annotation, event?: React.MouseEvent) => void;
|
|
31
|
+
/** Unified hover handler for all annotation types */
|
|
32
|
+
onHover?: (annotationId: string | null) => void;
|
|
33
|
+
/** Hover handler specifically for comment panel highlighting */
|
|
34
|
+
onCommentHover?: (commentId: string | null) => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* UI state for annotation toolbar and interactions.
|
|
38
|
+
* Groups multiple UI state props into a single object.
|
|
39
|
+
*/
|
|
40
|
+
interface AnnotationUIState {
|
|
41
|
+
/** Currently selected annotation motivation (linking, highlighting, etc.) */
|
|
42
|
+
selectedMotivation: Motivation$2 | null;
|
|
43
|
+
/** Currently selected click mode (detail, follow, delete, jsonld) */
|
|
44
|
+
selectedClick: _xynolog_react_ui.ClickAction;
|
|
45
|
+
/** Currently selected shape for image annotations */
|
|
46
|
+
selectedShape: _xynolog_react_ui.ShapeType;
|
|
47
|
+
/** ID of currently hovered annotation (optional - only set when hovering) */
|
|
48
|
+
hoveredAnnotationId?: string | null;
|
|
49
|
+
/** ID of annotation to scroll to (optional - only set when scrolling needed) */
|
|
50
|
+
scrollToAnnotationId?: string | null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Configuration options for annotation views.
|
|
54
|
+
* Groups feature flags and settings.
|
|
55
|
+
*/
|
|
56
|
+
interface AnnotationConfig {
|
|
57
|
+
/** Whether content is editable */
|
|
58
|
+
editable?: boolean;
|
|
59
|
+
/** Whether to show annotation widgets (entity types, reference buttons) */
|
|
60
|
+
enableWidgets?: boolean;
|
|
61
|
+
/** Whether to show line numbers in code view */
|
|
62
|
+
showLineNumbers?: boolean;
|
|
63
|
+
/** Whether view is in annotate mode or browse mode */
|
|
64
|
+
annotateMode?: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Parameters for creating an annotation
|
|
69
|
+
*/
|
|
70
|
+
interface CreateAnnotationParams {
|
|
71
|
+
rUri: ResourceId;
|
|
72
|
+
motivation: Motivation$2;
|
|
73
|
+
selector: Selector | Selector[];
|
|
74
|
+
body?: Annotation['body'];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Parameters for deleting an annotation
|
|
78
|
+
*/
|
|
79
|
+
interface DeleteAnnotationParams {
|
|
80
|
+
annotationId: string;
|
|
81
|
+
rUri: ResourceId;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Annotation Manager Interface
|
|
85
|
+
*
|
|
86
|
+
* Framework-agnostic interface for annotation mutations.
|
|
87
|
+
* Apps provide implementations via AnnotationProvider.
|
|
88
|
+
*
|
|
89
|
+
* Example implementation:
|
|
90
|
+
* ```typescript
|
|
91
|
+
* function useAnnotationManager(client: XynologClient): AnnotationManager {
|
|
92
|
+
* return {
|
|
93
|
+
* markAnnotation: async (params) => {
|
|
94
|
+
* const result = await client.mark.annotation({ target: { source: params.rUri, ... }, ... });
|
|
95
|
+
* return result.annotation;
|
|
96
|
+
* },
|
|
97
|
+
* deleteAnnotation: async (params) => {
|
|
98
|
+
* await client.mark.delete(params.rUri, params.annotationId);
|
|
99
|
+
* }
|
|
100
|
+
* };
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
interface AnnotationManager {
|
|
105
|
+
/**
|
|
106
|
+
* Create a new annotation
|
|
107
|
+
* @param params - Creation parameters (rUri, motivation, selector, body)
|
|
108
|
+
* @returns Promise resolving to the created annotation, or undefined if creation fails
|
|
109
|
+
*/
|
|
110
|
+
markAnnotation: (params: CreateAnnotationParams) => Promise<Annotation | undefined>;
|
|
111
|
+
/**
|
|
112
|
+
* Delete an annotation
|
|
113
|
+
* @param params - Deletion parameters (annotationId, rUri)
|
|
114
|
+
* @returns Promise resolving when deletion completes
|
|
115
|
+
*/
|
|
116
|
+
deleteAnnotation: (params: DeleteAnnotationParams) => Promise<void>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Represents a single navigation item
|
|
121
|
+
*/
|
|
122
|
+
interface NavigationItem {
|
|
123
|
+
/** Display name for the navigation item */
|
|
124
|
+
name: string;
|
|
125
|
+
/** Target URL/path for the navigation item */
|
|
126
|
+
href: string;
|
|
127
|
+
/** Icon component to display */
|
|
128
|
+
icon: ComponentType<{
|
|
129
|
+
className?: string;
|
|
130
|
+
}>;
|
|
131
|
+
/** Optional description/tooltip text */
|
|
132
|
+
description?: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Translation management interface
|
|
137
|
+
* Apps implement this to provide translations using their preferred i18n library
|
|
138
|
+
*/
|
|
139
|
+
interface TranslationManager {
|
|
140
|
+
/**
|
|
141
|
+
* Translate a key within a namespace
|
|
142
|
+
* @param namespace - Translation namespace (e.g., 'Toolbar', 'ResourceViewer')
|
|
143
|
+
* @param key - Translation key within the namespace
|
|
144
|
+
* @param params - Optional parameters for interpolation
|
|
145
|
+
* @returns Translated string
|
|
146
|
+
*/
|
|
147
|
+
t: (namespace: string, key: string, params?: Record<string, unknown>) => string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Type definitions for resource viewer feature
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
type XynologResource$1 = ResourceDescriptor;
|
|
155
|
+
type Motivation$1 = components['schemas']['Motivation'];
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Centralized annotation type registry
|
|
159
|
+
*
|
|
160
|
+
* Single source of truth for W3C annotation motivation metadata including:
|
|
161
|
+
* - Visual styling (CSS class, icon)
|
|
162
|
+
* - Type guards (motivation matching)
|
|
163
|
+
* - Accessibility (screen reader announcements)
|
|
164
|
+
*
|
|
165
|
+
* This is the ONLY place to define annotation type metadata: one decision
|
|
166
|
+
* lives in one place. No aliasing, wrappers, or compatibility layers elsewhere.
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Annotator: the metadata of one annotation type - how its annotations are
|
|
171
|
+
* recognized, displayed and announced
|
|
172
|
+
*/
|
|
173
|
+
interface Annotator {
|
|
174
|
+
motivation: Motivation$2;
|
|
175
|
+
internalType: string;
|
|
176
|
+
displayName: string;
|
|
177
|
+
className: string;
|
|
178
|
+
iconEmoji?: string;
|
|
179
|
+
matchesAnnotation: (annotation: Annotation) => boolean;
|
|
180
|
+
announceOnCreate: string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Static annotator definitions - single source of truth
|
|
184
|
+
*/
|
|
185
|
+
declare const ANNOTATORS: {
|
|
186
|
+
highlight: {
|
|
187
|
+
motivation: "highlighting";
|
|
188
|
+
internalType: string;
|
|
189
|
+
displayName: string;
|
|
190
|
+
className: string;
|
|
191
|
+
iconEmoji: string;
|
|
192
|
+
matchesAnnotation: (ann: Annotation) => boolean;
|
|
193
|
+
announceOnCreate: string;
|
|
194
|
+
};
|
|
195
|
+
comment: {
|
|
196
|
+
motivation: "commenting";
|
|
197
|
+
internalType: string;
|
|
198
|
+
displayName: string;
|
|
199
|
+
className: string;
|
|
200
|
+
iconEmoji: string;
|
|
201
|
+
matchesAnnotation: (ann: Annotation) => boolean;
|
|
202
|
+
announceOnCreate: string;
|
|
203
|
+
};
|
|
204
|
+
assessment: {
|
|
205
|
+
motivation: "assessing";
|
|
206
|
+
internalType: string;
|
|
207
|
+
displayName: string;
|
|
208
|
+
className: string;
|
|
209
|
+
iconEmoji: string;
|
|
210
|
+
matchesAnnotation: (ann: Annotation) => boolean;
|
|
211
|
+
announceOnCreate: string;
|
|
212
|
+
};
|
|
213
|
+
reference: {
|
|
214
|
+
motivation: "linking";
|
|
215
|
+
internalType: string;
|
|
216
|
+
displayName: string;
|
|
217
|
+
className: string;
|
|
218
|
+
iconEmoji: string;
|
|
219
|
+
matchesAnnotation: (ann: Annotation) => boolean;
|
|
220
|
+
announceOnCreate: string;
|
|
221
|
+
};
|
|
222
|
+
tag: {
|
|
223
|
+
motivation: "tagging";
|
|
224
|
+
internalType: string;
|
|
225
|
+
displayName: string;
|
|
226
|
+
className: string;
|
|
227
|
+
iconEmoji: string;
|
|
228
|
+
matchesAnnotation: (ann: Annotation) => boolean;
|
|
229
|
+
announceOnCreate: string;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
/** Keys of the annotator registry — also the annotations panel's tab keys. */
|
|
233
|
+
type AnnotatorKey = keyof typeof ANNOTATORS;
|
|
234
|
+
/**
|
|
235
|
+
* Annotator key (= panel tab key) for a motivation — derived from
|
|
236
|
+
* {@link ANNOTATORS}, the single motivation↔annotator source, so no second
|
|
237
|
+
* hand-written map can drift. Takes `string`, not `Motivation`: the schemas
|
|
238
|
+
* type motivation properly (`BrowsePanelOpenEvent.motivation` is a `Motivation`
|
|
239
|
+
* `$ref`), but `panel:open` is not wire-validated at runtime, so loose strings
|
|
240
|
+
* can still arrive — callers at that boundary must handle `undefined`.
|
|
241
|
+
*/
|
|
242
|
+
declare function annotatorKeyForMotivation(motivation: string): AnnotatorKey | undefined;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Centralized button styles matching Figma design
|
|
246
|
+
* Two primary styles from authenticated home page:
|
|
247
|
+
* 1. Primary (cyan/blue gradient) - for main CTAs
|
|
248
|
+
* 2. Secondary (gray with black outline) - for secondary actions
|
|
249
|
+
*/
|
|
250
|
+
declare const buttonStyles: {
|
|
251
|
+
readonly primary: {
|
|
252
|
+
readonly base: "xynolog-button xynolog-button--primary";
|
|
253
|
+
readonly large: "xynolog-button xynolog-button--primary xynolog-button--large";
|
|
254
|
+
};
|
|
255
|
+
readonly secondary: {
|
|
256
|
+
readonly base: "xynolog-button xynolog-button--secondary";
|
|
257
|
+
readonly withScale: "xynolog-button xynolog-button--secondary xynolog-button--scale";
|
|
258
|
+
};
|
|
259
|
+
readonly tertiary: {
|
|
260
|
+
readonly base: "xynolog-button xynolog-button--tertiary";
|
|
261
|
+
};
|
|
262
|
+
readonly danger: {
|
|
263
|
+
readonly base: "xynolog-button xynolog-button--danger";
|
|
264
|
+
};
|
|
265
|
+
readonly warning: {
|
|
266
|
+
readonly base: "xynolog-button xynolog-button--warning";
|
|
267
|
+
};
|
|
268
|
+
readonly combine: (...classes: string[]) => string;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
declare const jsonTheme: _codemirror_state.Extension;
|
|
272
|
+
declare const jsonHighlightStyle: HighlightStyle;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* CodeMirror Inline Widgets
|
|
276
|
+
*
|
|
277
|
+
* Custom widgets for enhancing the document editing experience:
|
|
278
|
+
* - Reference resolution indicators (resolved 🔗, generating ✨, stub ❓)
|
|
279
|
+
*
|
|
280
|
+
* Event handling uses delegation — no per-widget listeners.
|
|
281
|
+
* Data attributes on the container enable CodeMirrorRenderer to handle
|
|
282
|
+
* clicks and hovers via a single set of delegated handlers.
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Reference Resolution Widget
|
|
287
|
+
* Shows a small indicator next to references with hover preview.
|
|
288
|
+
*
|
|
289
|
+
* All event handling is delegated — the widget sets data attributes
|
|
290
|
+
* and CodeMirrorRenderer handles events via container-level listeners.
|
|
291
|
+
*/
|
|
292
|
+
declare class ReferenceResolutionWidget extends WidgetType {
|
|
293
|
+
readonly annotation: Annotation;
|
|
294
|
+
readonly targetDocumentName?: string | undefined;
|
|
295
|
+
readonly isGenerating?: boolean | undefined;
|
|
296
|
+
constructor(annotation: Annotation, targetDocumentName?: string | undefined, isGenerating?: boolean | undefined);
|
|
297
|
+
eq(other: ReferenceResolutionWidget): boolean;
|
|
298
|
+
toDOM(): HTMLSpanElement;
|
|
299
|
+
ignoreEvent(event: Event): boolean;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Show a tooltip preview on a widget container.
|
|
303
|
+
* Called from delegated mouseenter handler in CodeMirrorRenderer.
|
|
304
|
+
*/
|
|
305
|
+
declare function showWidgetPreview(container: HTMLElement, documentName: string): void;
|
|
306
|
+
/**
|
|
307
|
+
* Hide the tooltip preview from a widget container.
|
|
308
|
+
* Called from delegated mouseleave handler in CodeMirrorRenderer.
|
|
309
|
+
*/
|
|
310
|
+
declare function hideWidgetPreview(container: HTMLElement): void;
|
|
311
|
+
|
|
312
|
+
type ClickAction = 'detail' | 'follow' | 'jsonld' | 'deleting';
|
|
313
|
+
type ShapeType = 'rectangle' | 'circle' | 'polygon';
|
|
314
|
+
/** The bar's composable controls, in fixed render order. */
|
|
315
|
+
type ToolbarPart = 'clickAction' | 'mode' | 'selection' | 'shape';
|
|
316
|
+
interface AnnotateToolbarProps {
|
|
317
|
+
selectedMotivation: Motivation$2 | null;
|
|
318
|
+
selectedClick: ClickAction;
|
|
319
|
+
showDeleteButton?: boolean;
|
|
320
|
+
selectedShape?: ShapeType;
|
|
321
|
+
mediaType?: string | null;
|
|
322
|
+
annotateMode: boolean;
|
|
323
|
+
annotators: Record<string, Annotator>;
|
|
324
|
+
/**
|
|
325
|
+
* Which controls to render (composition over CSS hiding). Default: all four.
|
|
326
|
+
* Order is fixed (click, mode, selection, shape); shape stays media-gated.
|
|
327
|
+
*/
|
|
328
|
+
parts?: ToolbarPart[];
|
|
329
|
+
/**
|
|
330
|
+
* Purely presentational: each control reports the chosen value via its
|
|
331
|
+
* callback; the owner (viewer instance or host) applies it. The bar holds no
|
|
332
|
+
* pref state, emits no bus events, and touches no storage.
|
|
333
|
+
*/
|
|
334
|
+
onModeChange?: (mode: boolean) => void;
|
|
335
|
+
onClickActionChange?: (action: ClickAction) => void;
|
|
336
|
+
onSelectionChange?: (motivation: Motivation$2 | null) => void;
|
|
337
|
+
onShapeChange?: (shape: ShapeType) => void;
|
|
338
|
+
compact?: boolean;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Toolbar for annotation controls with mode, selection, click, and shape options.
|
|
342
|
+
* Purely presentational: renders the given values for the given `parts` and
|
|
343
|
+
* reports choices via the on*Change callbacks — no bus, no storage.
|
|
344
|
+
*/
|
|
345
|
+
declare function AnnotateToolbar({ selectedMotivation, selectedClick, showDeleteButton, selectedShape, mediaType, annotateMode, annotators, parts, onModeChange, onClickActionChange, onSelectionChange, onShapeChange, compact, }: AnnotateToolbarProps): React__default.JSX.Element;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Media Type Shape Support
|
|
349
|
+
*
|
|
350
|
+
* Defines which annotation shapes are supported for each media type.
|
|
351
|
+
* Shapes are tracked per selector type (FragmentSelector, SvgSelector).
|
|
352
|
+
*/
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Selector types that support shape selection
|
|
356
|
+
*/
|
|
357
|
+
type SelectorType = 'fragment' | 'svg' | 'text';
|
|
358
|
+
/**
|
|
359
|
+
* Get supported annotation shapes for a given media type.
|
|
360
|
+
*
|
|
361
|
+
* This set is the host-facing CONTRACT for "which shapes can this medium
|
|
362
|
+
* draw" — gate shape UI on it directly.
|
|
363
|
+
*
|
|
364
|
+
* The registry's anchoring model decides, never the type name: a spatially
|
|
365
|
+
* anchored medium draws what its renderer can carry — rectangles only for
|
|
366
|
+
* PDF (FragmentSelector, RFC 3778 viewrect; circle and polygon would need an
|
|
367
|
+
* SvgSelector, which loses page context), all three for images (SvgSelector).
|
|
368
|
+
* Everything else draws nothing — text media anchor by offsets into their text and
|
|
369
|
+
* no selector there can carry a shape, and storage-tier rows are not
|
|
370
|
+
* annotated at all.
|
|
371
|
+
*
|
|
372
|
+
* @param mediaType - MIME type of the resource (e.g., 'application/pdf', 'image/png')
|
|
373
|
+
* @returns Array of supported shape types for annotation
|
|
374
|
+
*/
|
|
375
|
+
declare function getSupportedShapes(mediaType: string | undefined | null): ShapeType[];
|
|
376
|
+
/**
|
|
377
|
+
* Check if a shape type is supported for a given media type
|
|
378
|
+
*
|
|
379
|
+
* @param mediaType - MIME type of the resource
|
|
380
|
+
* @param shape - Shape type to check
|
|
381
|
+
* @returns true if the shape is supported for this media type
|
|
382
|
+
*/
|
|
383
|
+
declare function isShapeSupported(mediaType: string | undefined | null, shape: ShapeType): boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Get the selector type used for a given media type.
|
|
386
|
+
*
|
|
387
|
+
* Keyed off the registry's anchoring model, in step with
|
|
388
|
+
* `getSupportedShapes`: spatial + PDF render → FragmentSelector (RFC 3778),
|
|
389
|
+
* spatial + image render → SvgSelector.
|
|
390
|
+
*
|
|
391
|
+
* Everything else answers 'text' — text media because they genuinely anchor
|
|
392
|
+
* by offset into their text, storage-tier rows and registry misses because
|
|
393
|
+
* `SelectorType` has no "not annotatable" member. That catch-all is harmless
|
|
394
|
+
* rather than a claim: `getSupportedShapes` offers those types no shapes, and
|
|
395
|
+
* the write path refuses them outright.
|
|
396
|
+
*
|
|
397
|
+
* @param mediaType - MIME type of the resource
|
|
398
|
+
* @returns Selector type (fragment, svg, or text)
|
|
399
|
+
*/
|
|
400
|
+
declare function getSelectorType(mediaType: string | undefined | null): SelectorType;
|
|
401
|
+
/**
|
|
402
|
+
* Get the selected shape for a given selector type from localStorage
|
|
403
|
+
*
|
|
404
|
+
* @param selectorType - The selector type
|
|
405
|
+
* @returns The selected shape, or default for that selector type
|
|
406
|
+
*/
|
|
407
|
+
declare function getSelectedShapeForSelectorType(selectorType: SelectorType): ShapeType;
|
|
408
|
+
/**
|
|
409
|
+
* Save the selected shape for a given selector type to localStorage
|
|
410
|
+
*
|
|
411
|
+
* @param selectorType - The selector type
|
|
412
|
+
* @param shape - The shape to save
|
|
413
|
+
*/
|
|
414
|
+
declare function saveSelectedShapeForSelectorType(selectorType: SelectorType, shape: ShapeType): void;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* The URL for a resource's raw bytes — the one shape `GET /api/resources/:id`
|
|
418
|
+
* accepts from a browser. Pair with `useMediaToken`, which mints (and keeps
|
|
419
|
+
* refreshing) the token.
|
|
420
|
+
*
|
|
421
|
+
* Two things a hand-written `/api/resources/${id}` gets wrong, both of them
|
|
422
|
+
* silent until the byte never arrives:
|
|
423
|
+
*
|
|
424
|
+
* - **It must carry `?token=`.** That route is the browser-facing alias of the
|
|
425
|
+
* pipe, and exists only as the auth affordance for `<img>`, PDF.js and
|
|
426
|
+
* `<a download>` — none of which can attach an Authorization header. Auth is
|
|
427
|
+
* bearer + `?token=` only, no cookie, so a bare URL 401s.
|
|
428
|
+
* - **It must be absolute.** react-ui embeds into a host app with its own
|
|
429
|
+
* origin, so a relative path resolves against the HOST, not the gateway.
|
|
430
|
+
*
|
|
431
|
+
* Returns `undefined` when either input is missing — no client, or a token
|
|
432
|
+
* that has not landed yet. There is no partially-correct URL worth rendering;
|
|
433
|
+
* callers show a not-yet-ready affordance instead of a known-bad link.
|
|
434
|
+
*/
|
|
435
|
+
declare function mediaUrl(client: XynologClient | null | undefined, id: ResourceId, token: string | undefined): string | undefined;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Annotation overlay: decouples annotation highlighting from markdown rendering.
|
|
439
|
+
*
|
|
440
|
+
* Instead of weaving annotations into the markdown AST via remark/rehype plugins
|
|
441
|
+
* (which forces O(ASTnodes × annotations) work on every render), this module:
|
|
442
|
+
*
|
|
443
|
+
* 1. Builds a source→rendered position map once after the markdown DOM paints
|
|
444
|
+
* 2. Resolves W3C TextPositionSelector offsets to stretches of the rendered text
|
|
445
|
+
* 3. Rebuilds each annotated text node ONCE, off-DOM, into segments wrapped by
|
|
446
|
+
* <span> elements carrying data-annotation-* attributes
|
|
447
|
+
*
|
|
448
|
+
* Two counts meet here. A selector's offsets count the source's Unicode code
|
|
449
|
+
* points. The source string and the rendered DOM text are both indexed in
|
|
450
|
+
* UTF-16 code units, where a character outside the Basic Multilingual Plane
|
|
451
|
+
* is two: the map and every stretch of the rendered text are in those. An
|
|
452
|
+
* offset is converted where it is looked up in the map, and nowhere else.
|
|
453
|
+
*
|
|
454
|
+
* Markdown renders once (cached by React.memo). Annotation changes only touch
|
|
455
|
+
* the overlay spans — no markdown re-parse, no AST walk.
|
|
456
|
+
*
|
|
457
|
+
* The application step deliberately never uses live DOM Ranges. Resolving
|
|
458
|
+
* every annotation to a Range up front and wrapping them one `surroundContents`
|
|
459
|
+
* at a time fails on overlap: each wrap is a DOM mutation, and DOM mutations
|
|
460
|
+
* re-target every OTHER still-live Range, so overlapping annotations — the
|
|
461
|
+
* normal result of repeated annotation on the same passage — have their
|
|
462
|
+
* ranges collapsed or inflated by earlier wraps, painting whole paragraphs and
|
|
463
|
+
* fragmenting text nodes so hard that 36 annotations produce 2,554 wraps and
|
|
464
|
+
* a 10-second main-thread freeze. Working in positions of the rendered text
|
|
465
|
+
* against the pristine text-node index makes overlap geometry exact, and costs
|
|
466
|
+
* one `replaceChild` per annotated text node.
|
|
467
|
+
*/
|
|
468
|
+
|
|
469
|
+
interface OverlayAnnotation {
|
|
470
|
+
id: string;
|
|
471
|
+
exact: string;
|
|
472
|
+
/** The offset into the source the annotation starts at, in code points. */
|
|
473
|
+
offset: number;
|
|
474
|
+
/** How many code points of the source it is. */
|
|
475
|
+
length: number;
|
|
476
|
+
type: string;
|
|
477
|
+
source: string | null;
|
|
478
|
+
}
|
|
479
|
+
interface TextNodeEntry {
|
|
480
|
+
node: Text;
|
|
481
|
+
start: number;
|
|
482
|
+
end: number;
|
|
483
|
+
}
|
|
484
|
+
/** An annotation resolved to a stretch of the rendered text: `[start, end)`, in UTF-16 code units. */
|
|
485
|
+
interface ResolvedAnnotationSpan {
|
|
486
|
+
annotation: OverlayAnnotation;
|
|
487
|
+
start: number;
|
|
488
|
+
end: number;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Build a map from positions in the markdown source string to positions in
|
|
492
|
+
* the rendered text, both in UTF-16 code units.
|
|
493
|
+
* Unit-by-unit alignment: walks source and rendered text in parallel,
|
|
494
|
+
* matching code units and skipping markdown syntax in the source.
|
|
495
|
+
*
|
|
496
|
+
* Complexity: O(sourceLength) — runs once per content change.
|
|
497
|
+
*/
|
|
498
|
+
declare function buildSourceToRenderedMap(markdownSource: string, container: HTMLElement): Map<number, number>;
|
|
499
|
+
/**
|
|
500
|
+
* Build a sorted array of text nodes, each with where it starts and ends in
|
|
501
|
+
* the rendered text.
|
|
502
|
+
*
|
|
503
|
+
* Complexity: O(textNodes) — runs once per overlay application.
|
|
504
|
+
*/
|
|
505
|
+
declare function buildTextNodeIndex(container: HTMLElement): TextNodeEntry[];
|
|
506
|
+
/**
|
|
507
|
+
* Resolve annotations to stretches of the rendered text. `offsets` is the
|
|
508
|
+
* source's own conversions (`textOffsets(source)`) and `sourceToRendered` the
|
|
509
|
+
* map `buildSourceToRenderedMap` made of the same source.
|
|
510
|
+
*
|
|
511
|
+
* An annotation's two offsets are taken to positions in the source string,
|
|
512
|
+
* and its first and last code units are looked up in the map. Annotations
|
|
513
|
+
* that are not at offsets of the source (content changed under them) or whose
|
|
514
|
+
* ends don't map are skipped, as are empty ones.
|
|
515
|
+
*
|
|
516
|
+
* Complexity: O(annotations).
|
|
517
|
+
*/
|
|
518
|
+
declare function resolveAnnotationSpans(annotations: OverlayAnnotation[], offsets: TextOffsets, sourceToRendered: Map<number, number>): ResolvedAnnotationSpan[];
|
|
519
|
+
/**
|
|
520
|
+
* Wrap annotated stretches of text with styled <span> elements.
|
|
521
|
+
*
|
|
522
|
+
* Each text node the spans touch is rebuilt off-DOM as a run of segments —
|
|
523
|
+
* one per distinct overlap region — and swapped in with a single
|
|
524
|
+
* `replaceChild`. A segment covered by several annotations gets nested spans,
|
|
525
|
+
* one per annotation; the later annotation in the input order ends up
|
|
526
|
+
* innermost, so `closest('[data-annotation-id]')` resolves to it (interactive
|
|
527
|
+
* types — references, comments, tags — are listed after plain highlights).
|
|
528
|
+
* An annotation cut by segment or node boundaries yields sibling spans
|
|
529
|
+
* sharing its data-annotation-id.
|
|
530
|
+
*
|
|
531
|
+
* Complexity: O(textNodes × spans) comparisons, O(annotated nodes) mutations.
|
|
532
|
+
*/
|
|
533
|
+
declare function applyHighlights(spans: ResolvedAnnotationSpan[], textNodeIndex: TextNodeEntry[]): void;
|
|
534
|
+
/**
|
|
535
|
+
* Remove all annotation highlight spans, restoring the original DOM.
|
|
536
|
+
* Unwraps every span, then merges adjacent text nodes in one pass.
|
|
537
|
+
*/
|
|
538
|
+
declare function clearHighlights(container: HTMLElement): void;
|
|
539
|
+
/**
|
|
540
|
+
* Convert W3C Annotations to the simplified overlay format.
|
|
541
|
+
* Extracts TextPositionSelector offsets, in code points as the selector has
|
|
542
|
+
* them, and annotation type.
|
|
543
|
+
*/
|
|
544
|
+
declare function toOverlayAnnotations(annotations: Annotation[]): OverlayAnnotation[];
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Resource utilities
|
|
548
|
+
* Shared helper functions for resource display and metadata
|
|
549
|
+
*/
|
|
550
|
+
/**
|
|
551
|
+
* Get icon emoji based on media type.
|
|
552
|
+
*
|
|
553
|
+
* The icon is a pure file-kind UI concern — there is no icon field in the
|
|
554
|
+
* core registry, and it intentionally does NOT track render capability:
|
|
555
|
+
* every image gets the image glyph whether or not we can preview it. Only
|
|
556
|
+
* the base type matters, normalized via the registry's `baseMediaType`.
|
|
557
|
+
*/
|
|
558
|
+
declare function getResourceIcon(mediaType: string | undefined): string;
|
|
559
|
+
/**
|
|
560
|
+
* Check if a resource supports text-based AI detection features.
|
|
561
|
+
*
|
|
562
|
+
* Detection anchors on text selectors (offsets into a text), so the gate is the
|
|
563
|
+
* registry's anchoring model: true exactly for the text-selector types
|
|
564
|
+
* (markdown, plain, html, json). Registry misses (imported foreign types)
|
|
565
|
+
* are not offered detection in the UI.
|
|
566
|
+
*
|
|
567
|
+
* @param mediaType - The media type string (e.g., 'text/plain', 'text/markdown')
|
|
568
|
+
* @returns true if the resource supports AI detection features
|
|
569
|
+
*/
|
|
570
|
+
declare function supportsDetection(mediaType: string | undefined): boolean;
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* The interpolation every translation string goes through.
|
|
574
|
+
*
|
|
575
|
+
* - `{count, plural, =0 {text} one {text} other {text}}` becomes one of its
|
|
576
|
+
* branches: the exact match (`=N`) first, then the plural category the count
|
|
577
|
+
* falls in (`zero`, `one`, `two`, `few`, `many`), then `other`. `locale` is
|
|
578
|
+
* the language the string is written in; its rules decide the category.
|
|
579
|
+
* `#` in a branch stands for the count, and a branch may hold placeholders
|
|
580
|
+
* and further plural expressions.
|
|
581
|
+
* - `{{paramKey}}` becomes the param's value.
|
|
582
|
+
*
|
|
583
|
+
* What cannot be resolved is left as written: a placeholder or plural whose
|
|
584
|
+
* param is missing, a plural with no branch for the count, and a plural that
|
|
585
|
+
* never closes together with what follows it.
|
|
586
|
+
*/
|
|
587
|
+
declare function interpolateTranslation(translation: string, params: Record<string, unknown>, locale: string): string;
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Browser PDF.js — bundled from the npm `pdfjs-dist` (v6) package, loaded
|
|
591
|
+
* lazily.
|
|
592
|
+
*
|
|
593
|
+
* pdf.js (the ~300 kB display layer) is pulled in via a dynamic `import()` the
|
|
594
|
+
* first time a PDF is actually opened, so it is code-split out of the main app
|
|
595
|
+
* bundle. Only the pdf.js *types* are imported statically (erased at build
|
|
596
|
+
* time, zero runtime cost).
|
|
597
|
+
*
|
|
598
|
+
* The worker can't be resolved inside this tsup-built library (Vite's `?url`
|
|
599
|
+
* lives in the app), so the host hands us the worker URL via `setPdfWorkerSrc`
|
|
600
|
+
* once at startup; it is applied to `GlobalWorkerOptions` when pdf.js loads.
|
|
601
|
+
* See `images/browser/src/main.tsx`.
|
|
602
|
+
*/
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Supply the (Vite-resolved) pdf.js worker URL. Call once at app startup,
|
|
606
|
+
* before any PDF is opened.
|
|
607
|
+
*/
|
|
608
|
+
declare function setPdfWorkerSrc(src: string): void;
|
|
609
|
+
/**
|
|
610
|
+
* Supply the directory URL (trailing slash) where pdf.js's wasm side-files
|
|
611
|
+
* are served — `openjpeg.wasm`, `jbig2.wasm`, `qcms_bg.wasm` and their JS
|
|
612
|
+
* fallbacks, under their ORIGINAL names: pdf.js builds each fetch URL as
|
|
613
|
+
* `wasmUrl + filename` itself, so a bundler-hashed asset can never be found.
|
|
614
|
+
* The host stages them (images/browser: `scripts/copy-pdf-wasm.js` →
|
|
615
|
+
* `public/pdfjs/wasm/`) for the same reason the worker URL is handed in:
|
|
616
|
+
* this tsup-built library cannot resolve assets.
|
|
617
|
+
*
|
|
618
|
+
* Without it, pdf.js v6 cannot decode JPEG 2000 or JBIG2 images at all —
|
|
619
|
+
* scanned PDFs render without their images, and a page can wedge on the
|
|
620
|
+
* failed decode ("Dependent image isn't ready yet").
|
|
621
|
+
*/
|
|
622
|
+
declare function setPdfWasmUrl(url: string): void;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Image-URL validation for the browser, with security checks.
|
|
626
|
+
*/
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Image URL validation with security checks (browser-specific)
|
|
630
|
+
*
|
|
631
|
+
* Validates image URLs for use in browser environments with XSS prevention.
|
|
632
|
+
* Only allows HTTPS for external images, blocks suspicious patterns.
|
|
633
|
+
*/
|
|
634
|
+
declare const ImageURLSchema: {
|
|
635
|
+
parse(url: unknown): string;
|
|
636
|
+
safeParse(url: unknown): ValidationResult<string>;
|
|
637
|
+
};
|
|
638
|
+
/**
|
|
639
|
+
* URL sanitization for images (browser-specific security)
|
|
640
|
+
*
|
|
641
|
+
* Sanitizes image URLs by validating and reconstructing with only safe parts.
|
|
642
|
+
* Returns null if validation fails.
|
|
643
|
+
*
|
|
644
|
+
* @param url - Image URL to sanitize
|
|
645
|
+
* @returns Sanitized URL or null if invalid
|
|
646
|
+
*/
|
|
647
|
+
declare function sanitizeImageURL(url: string): string | null;
|
|
648
|
+
|
|
649
|
+
declare function useStateUnit<T extends StateUnit>(factory: () => T): T;
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Construct a state unit whose lifetime is bound to a live `XynologSession`
|
|
653
|
+
* (the session gate as API shape).
|
|
654
|
+
*
|
|
655
|
+
* Contract, in the order the KB-switch bug family demands it:
|
|
656
|
+
* - one construction per live session, however often the component rerenders;
|
|
657
|
+
* - on session swap, the OLD unit's `dispose()` runs strictly BEFORE the new
|
|
658
|
+
* factory — a unit must never coexist with its successor, or it keeps
|
|
659
|
+
* serving a disposed client's inert (B16) caches;
|
|
660
|
+
* - no session → no construction, and the `T | undefined` return makes the
|
|
661
|
+
* caller handle it — the null-check lives at exactly this one layer, not
|
|
662
|
+
* inside `!`-asserted factories (the auth/welcome production crash);
|
|
663
|
+
* - unmount disposes.
|
|
664
|
+
*
|
|
665
|
+
* Keying is by session OBJECT identity, which coincides with `session.id`:
|
|
666
|
+
* successive sessions are distinct objects with distinct ids by construction
|
|
667
|
+
* (`XynologSession`'s instance counter exists for exactly this).
|
|
668
|
+
*
|
|
669
|
+
* The unit is created inside the effect, not during render — render stays
|
|
670
|
+
* pure (StrictMode-safe: its probe mount cleanly disposes the probe unit),
|
|
671
|
+
* and React's cleanup-before-next-effect ordering is what GUARANTEES
|
|
672
|
+
* dispose-before-create on swap. Consequence: the unit is `undefined` on the
|
|
673
|
+
* very first render frame; session-gated pages already render a loading
|
|
674
|
+
* state for exactly that frame.
|
|
675
|
+
*
|
|
676
|
+
* The factory is read through a ref so the effect keys ONLY on the session —
|
|
677
|
+
* an inline-closure factory (the universal call-site idiom) must not retrigger
|
|
678
|
+
* construction on every render.
|
|
679
|
+
*/
|
|
680
|
+
declare function useSessionStateUnit<T extends StateUnit>(session: XynologSession | undefined, factory: (session: XynologSession) => T): T | undefined;
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Creates a debounced version of a callback function
|
|
684
|
+
*
|
|
685
|
+
* @param callback - The function to debounce
|
|
686
|
+
* @param delay - Debounce delay in milliseconds
|
|
687
|
+
* @returns Debounced function
|
|
688
|
+
*
|
|
689
|
+
* @example
|
|
690
|
+
* const debouncedSearch = useDebouncedCallback(
|
|
691
|
+
* (query) => performSearch(query),
|
|
692
|
+
* 500
|
|
693
|
+
* );
|
|
694
|
+
*/
|
|
695
|
+
declare function useDebouncedCallback<A extends unknown[]>(callback: (...args: A) => unknown, delay: number): (...args: A) => void;
|
|
696
|
+
/**
|
|
697
|
+
* useDebounce Hook
|
|
698
|
+
*
|
|
699
|
+
* Custom hook for debouncing values (e.g., search input).
|
|
700
|
+
* Returns a debounced value that updates after the specified delay.
|
|
701
|
+
*
|
|
702
|
+
* @param value - The value to debounce
|
|
703
|
+
* @param delay - Debounce delay in milliseconds
|
|
704
|
+
* @returns Debounced value
|
|
705
|
+
*
|
|
706
|
+
* @example
|
|
707
|
+
* const debouncedQuery = useDebounce(searchQuery, 500);
|
|
708
|
+
*/
|
|
709
|
+
declare function useDebounce<T>(value: T, delay: number): T;
|
|
710
|
+
|
|
711
|
+
declare function formatTime(milliseconds: number | null): string | null;
|
|
712
|
+
|
|
713
|
+
interface KeyboardShortcut {
|
|
714
|
+
key: string;
|
|
715
|
+
ctrlOrCmd?: boolean;
|
|
716
|
+
shift?: boolean;
|
|
717
|
+
alt?: boolean;
|
|
718
|
+
handler: (event: KeyboardEvent) => void;
|
|
719
|
+
description?: string;
|
|
720
|
+
enabled?: boolean;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Hook for managing keyboard shortcuts
|
|
724
|
+
* Handles platform differences (Cmd on Mac, Ctrl on Windows/Linux)
|
|
725
|
+
* Prevents conflicts with browser shortcuts
|
|
726
|
+
*/
|
|
727
|
+
declare function useKeyboardShortcuts(shortcuts: KeyboardShortcut[]): void;
|
|
728
|
+
/**
|
|
729
|
+
* Hook for double key press detection (e.g., double Escape)
|
|
730
|
+
*/
|
|
731
|
+
declare function useDoubleKeyPress(key: string, handler: () => void, timeout?: number): void;
|
|
732
|
+
/**
|
|
733
|
+
* Get keyboard shortcut display text based on platform
|
|
734
|
+
*/
|
|
735
|
+
declare function getShortcutDisplay(shortcut: KeyboardShortcut): string;
|
|
736
|
+
/**
|
|
737
|
+
* Hook to check if user is currently typing in an input field
|
|
738
|
+
* Keyboard shortcuts should generally be disabled when typing
|
|
739
|
+
*/
|
|
740
|
+
declare function useIsTyping(): boolean;
|
|
741
|
+
|
|
742
|
+
interface LineNumbersContextValue {
|
|
743
|
+
showLineNumbers: boolean;
|
|
744
|
+
toggleLineNumbers: () => void;
|
|
745
|
+
}
|
|
746
|
+
declare function LineNumbersProvider({ children, value, onToggle, }: {
|
|
747
|
+
children: ReactNode;
|
|
748
|
+
/** Optional controlled value for hosts that persist preferences outside localStorage. */
|
|
749
|
+
value?: boolean;
|
|
750
|
+
onToggle?: () => void;
|
|
751
|
+
}): React$1.JSX.Element;
|
|
752
|
+
declare function useLineNumbers(): LineNumbersContextValue;
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* Hook to manage hover delay setting with localStorage persistence
|
|
756
|
+
*/
|
|
757
|
+
declare function useHoverDelay(): {
|
|
758
|
+
hoverDelayMs: number;
|
|
759
|
+
setHoverDelayMs: (delayMs: number) => void;
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Generic router interface - works with any router that has push/replace methods
|
|
764
|
+
* (Next.js App Router, Next.js Pages Router, React Router, etc.)
|
|
765
|
+
*/
|
|
766
|
+
interface Router {
|
|
767
|
+
push: (path: string) => void;
|
|
768
|
+
replace?: (path: string) => void;
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Hook that wraps any router with event emission for observability
|
|
772
|
+
*
|
|
773
|
+
* Use this to wrap your router (Next.js, React Router, etc.) when you want
|
|
774
|
+
* navigation actions to be observable through the NavigationEventBus.
|
|
775
|
+
*
|
|
776
|
+
* @emits nav:push - Router navigation requested. Payload: { path: string, reason?: string }
|
|
777
|
+
*
|
|
778
|
+
* @example
|
|
779
|
+
* ```typescript
|
|
780
|
+
* // Next.js App Router
|
|
781
|
+
* import { useRouter } from 'next/navigation';
|
|
782
|
+
* const nextRouter = useRouter();
|
|
783
|
+
* const router = useObservableRouter(nextRouter);
|
|
784
|
+
* router.push('/know/discover', { reason: 'resource-closed' });
|
|
785
|
+
*
|
|
786
|
+
* // React Router
|
|
787
|
+
* import { useNavigate } from 'react-router';
|
|
788
|
+
* const navigate = useNavigate();
|
|
789
|
+
* const router = useObservableRouter({ push: navigate });
|
|
790
|
+
* router.push('/know/discover', { reason: 'resource-closed' });
|
|
791
|
+
* ```
|
|
792
|
+
*/
|
|
793
|
+
declare function useObservableRouter<T extends Router>(baseRouter: T): T;
|
|
794
|
+
/**
|
|
795
|
+
* Request navigation with event emission
|
|
796
|
+
*
|
|
797
|
+
* This hook emits a navigation request event. The app must subscribe to
|
|
798
|
+
* 'nav:external' and perform the actual navigation using
|
|
799
|
+
* its router (Next.js, React Router, etc.) to enable client-side routing.
|
|
800
|
+
*
|
|
801
|
+
* If no subscriber handles the event, falls back to window.location.href
|
|
802
|
+
* after a brief delay to allow for event handling.
|
|
803
|
+
*
|
|
804
|
+
* @emits nav:external - External navigation requested. Payload: { url: string, resourceId?: string, cancelFallback: () => void }
|
|
805
|
+
*
|
|
806
|
+
* The payload includes a `cancelFallback` function that subscribers must call to
|
|
807
|
+
* prevent the window.location fallback from firing. Subscribers that handle the
|
|
808
|
+
* navigation (e.g. via client-side routing) should always call cancelFallback().
|
|
809
|
+
*
|
|
810
|
+
* @example
|
|
811
|
+
* ```typescript
|
|
812
|
+
* // In component (react-ui package)
|
|
813
|
+
* const navigate = useObservableExternalNavigation();
|
|
814
|
+
* navigate('/know/resource/123', { resourceId: '123' });
|
|
815
|
+
*
|
|
816
|
+
* // In app (frontend package) - subscribe, cancel fallback, and handle with Next.js router
|
|
817
|
+
* const router = useRouter();
|
|
818
|
+
* useEventSubscriptions({
|
|
819
|
+
* 'nav:external': ({ url, cancelFallback }) => {
|
|
820
|
+
* cancelFallback(); // Prevent window.location fallback
|
|
821
|
+
* router.push(url); // Client-side navigation
|
|
822
|
+
* },
|
|
823
|
+
* });
|
|
824
|
+
* ```
|
|
825
|
+
*/
|
|
826
|
+
declare function useObservableExternalNavigation(): (url: string, metadata?: {
|
|
827
|
+
resourceId?: ResourceId;
|
|
828
|
+
}) => void;
|
|
829
|
+
|
|
830
|
+
interface UsePanelWidthOptions {
|
|
831
|
+
defaultWidth?: number;
|
|
832
|
+
minWidth?: number;
|
|
833
|
+
maxWidth?: number;
|
|
834
|
+
storageKey?: string;
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Custom hook for managing resizable panel width with localStorage persistence
|
|
838
|
+
*
|
|
839
|
+
* @param options Configuration options for panel width behavior
|
|
840
|
+
* @param options.defaultWidth Default width in pixels (default: 384px / 24rem)
|
|
841
|
+
* @param options.minWidth Minimum allowed width in pixels (default: 256px / 16rem)
|
|
842
|
+
* @param options.maxWidth Maximum allowed width in pixels (default: 800px / 50rem)
|
|
843
|
+
* @param options.storageKey localStorage key for persistence (default: 'xynolog-panel-width')
|
|
844
|
+
*
|
|
845
|
+
* @returns Object containing current width, setter function, and constraints
|
|
846
|
+
*
|
|
847
|
+
* @example
|
|
848
|
+
* ```tsx
|
|
849
|
+
* const { width, setWidth, minWidth, maxWidth } = usePanelWidth();
|
|
850
|
+
*
|
|
851
|
+
* <div style={{ width: `${width}px` }}>
|
|
852
|
+
* <ResizeHandle onResize={setWidth} minWidth={minWidth} maxWidth={maxWidth} />
|
|
853
|
+
* </div>
|
|
854
|
+
* ```
|
|
855
|
+
*/
|
|
856
|
+
declare function usePanelWidth({ defaultWidth, // 24rem
|
|
857
|
+
minWidth, // 16rem
|
|
858
|
+
maxWidth, // 50rem
|
|
859
|
+
storageKey, }?: UsePanelWidthOptions): {
|
|
860
|
+
width: number;
|
|
861
|
+
setWidth: (newWidth: number) => void;
|
|
862
|
+
minWidth: number;
|
|
863
|
+
maxWidth: number;
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
interface UseRovingTabIndexOptions {
|
|
867
|
+
orientation?: 'horizontal' | 'vertical' | 'grid';
|
|
868
|
+
loop?: boolean;
|
|
869
|
+
cols?: number;
|
|
870
|
+
}
|
|
871
|
+
declare function useRovingTabIndex<T extends HTMLElement>(itemCount: number, options?: UseRovingTabIndexOptions): {
|
|
872
|
+
containerRef: React$1.RefObject<T | null>;
|
|
873
|
+
handleKeyDown: (event: KeyboardEvent$1) => void;
|
|
874
|
+
focusItem: (index: number) => void;
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* Tracks the time remaining on the active KB session's JWT and whether it's
|
|
879
|
+
* expiring soon (< 5 minutes). Reads the session's `expiresAt` getter (which
|
|
880
|
+
* derives from the current `token$` value) and re-derives once per second.
|
|
881
|
+
*/
|
|
882
|
+
declare function useSessionExpiry(): {
|
|
883
|
+
timeRemaining: number | null;
|
|
884
|
+
isExpiringSoon: boolean;
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
/** The theme a person chooses: what `settings:theme-changed` carries. */
|
|
888
|
+
type Theme = components['schemas']['SettingsThemeChangedEvent']['theme'];
|
|
889
|
+
/** The theme a page is drawn in: the chosen one, or the system's when the choice is `system`. */
|
|
890
|
+
type ResolvedTheme = Exclude<Theme, 'system'>;
|
|
891
|
+
interface ThemeContextValue {
|
|
892
|
+
theme: Theme;
|
|
893
|
+
setTheme: (theme: Theme) => void;
|
|
894
|
+
resolvedTheme: ResolvedTheme;
|
|
895
|
+
systemTheme: ResolvedTheme;
|
|
896
|
+
}
|
|
897
|
+
declare function ThemeProvider({ children }: {
|
|
898
|
+
children: ReactNode;
|
|
899
|
+
}): React$1.JSX.Element;
|
|
900
|
+
declare function useTheme(): ThemeContextValue;
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Hook for managing dropdown/menu visibility with click outside handling
|
|
904
|
+
*/
|
|
905
|
+
declare function useDropdown(): {
|
|
906
|
+
isOpen: boolean;
|
|
907
|
+
toggle: () => void;
|
|
908
|
+
open: () => void;
|
|
909
|
+
close: () => void;
|
|
910
|
+
dropdownRef: React$1.RefObject<HTMLDivElement | null>;
|
|
911
|
+
};
|
|
912
|
+
/**
|
|
913
|
+
* Hook for managing loading states with minimum display time
|
|
914
|
+
*/
|
|
915
|
+
declare function useLoadingState(minLoadingTime?: number): {
|
|
916
|
+
isLoading: boolean;
|
|
917
|
+
showLoading: boolean;
|
|
918
|
+
startLoading: () => void;
|
|
919
|
+
stopLoading: () => void;
|
|
920
|
+
};
|
|
921
|
+
/**
|
|
922
|
+
* Hook for local storage with SSR safety
|
|
923
|
+
*/
|
|
924
|
+
declare function useLocalStorage<T>(key: string, initialValue: T): [T, (value: T | ((val: T) => T)) => void];
|
|
925
|
+
|
|
926
|
+
interface UseResourceContentResult {
|
|
927
|
+
/**
|
|
928
|
+
* The decoded text, or `undefined` until it has loaded. A zero-byte document
|
|
929
|
+
* loads as `''`, so "is it loaded?" is `content !== undefined` — never a
|
|
930
|
+
* length check, which gets every empty document wrong.
|
|
931
|
+
*/
|
|
932
|
+
content: string | undefined;
|
|
933
|
+
loading: boolean;
|
|
934
|
+
error: Error | null;
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Fetch + decode a resource's primary representation from a bare client — the
|
|
938
|
+
* content sibling of `useResourceLoader`/`useMediaToken` (bring-your-own-client;
|
|
939
|
+
* `null` → idle). Headless: errors are RETURNED, never toasted — the host
|
|
940
|
+
* decides chrome (the Browser page toasts; an embedded host may render inline
|
|
941
|
+
* or ignore). `enabled=false` fetches nothing (the binary/media-token path).
|
|
942
|
+
*/
|
|
943
|
+
declare function useResourceContent(client: XynologClient | null, rUri: ResourceId, resource: ResourceDescriptor, enabled?: boolean): UseResourceContentResult;
|
|
944
|
+
|
|
945
|
+
interface UseResourceLoaderResult {
|
|
946
|
+
resource: ResourceDescriptor | undefined;
|
|
947
|
+
annotations: AnnotationsCollection;
|
|
948
|
+
loading: boolean;
|
|
949
|
+
error: Error | null;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Load a resource + its annotations from a bare client — no page, no composite
|
|
953
|
+
* state unit, no providers. The lightweight alternative to `ResourceViewerPage`
|
|
954
|
+
* for a bring-your-own-session host; feed the result straight into `<ResourceViewer>`,
|
|
955
|
+
* beside the language it requires.
|
|
956
|
+
*
|
|
957
|
+
* `loading` is true until BOTH the resource and its annotation list have first
|
|
958
|
+
* emitted; `annotations` is bucketed via the shared `groupAnnotations`. A null
|
|
959
|
+
* client subscribes to nothing (stays loading) and re-subscribes when one arrives.
|
|
960
|
+
*/
|
|
961
|
+
declare function useResourceLoader(client: XynologClient | null, resourceId: ResourceId): UseResourceLoaderResult;
|
|
962
|
+
|
|
963
|
+
interface UseMediaTokenResult {
|
|
964
|
+
token: string | undefined;
|
|
965
|
+
loading: boolean;
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Mint (and periodically refresh) a short-lived authed media token for a
|
|
969
|
+
* resource — the query param that makes `<img>` / PDF URLs load. Takes the
|
|
970
|
+
* client explicitly (not `useXynolog()`), so a bring-your-own-session host can
|
|
971
|
+
* use it with a bare session; the batteries-included page passes `session.client`.
|
|
972
|
+
*/
|
|
973
|
+
declare function useMediaToken(client: XynologClient | null, id: ResourceId): UseMediaTokenResult;
|
|
974
|
+
|
|
975
|
+
interface UseEnginesResult {
|
|
976
|
+
engines: EngineWithLimits[];
|
|
977
|
+
loading: boolean;
|
|
978
|
+
error: Error | null;
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* The KB's engines — each a provider and a model, with the jobs the KB's
|
|
982
|
+
* Inference document has it used for and, when discovery could answer, its
|
|
983
|
+
* context and output ceilings.
|
|
984
|
+
*
|
|
985
|
+
* Takes the client explicitly rather than reaching for `useXynolog()`, matching
|
|
986
|
+
* `useMediaToken(client)`: a bring-your-own-session host can use it with a bare
|
|
987
|
+
* session, and the batteries-included page passes `session.client`.
|
|
988
|
+
*
|
|
989
|
+
* SUBSCRIBES rather than fetching once. `browse.engines()` is a `CacheObservable`
|
|
990
|
+
* whose only refresh triggers are its stream reopening after a drop and an
|
|
991
|
+
* explicit `fresh()` — a gateway restart with changed engines presents as a
|
|
992
|
+
* drop, so a one-shot read would pin the UI to engines that no longer exist. Awaiting
|
|
993
|
+
* it instead would also force a network round trip on every mount, which is
|
|
994
|
+
* exactly what the cache exists to avoid.
|
|
995
|
+
*
|
|
996
|
+
* `error` is surfaced but empty-on-failure is the display contract: engines
|
|
997
|
+
* that cannot be read show as no engines, never as a broken panel.
|
|
998
|
+
*/
|
|
999
|
+
declare function useEngines(client: XynologClient | null): UseEnginesResult;
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* Subscribe to session-scoped bus events on an explicit `XynologSession` — the
|
|
1003
|
+
* provider-free counterpart to `useEventSubscriptions`. The embeddable viewer
|
|
1004
|
+
* path takes its session as a prop (bring-your-own-session), so it can't reach
|
|
1005
|
+
* the app-scoped `XynologBrowser` bus; every channel it needs (`mark:*`,
|
|
1006
|
+
* `browse:click`) is session-scoped anyway and reaches it on the session's client.
|
|
1007
|
+
* The channels of a resource's scope are not among them: those are read for
|
|
1008
|
+
* one resource.
|
|
1009
|
+
*
|
|
1010
|
+
* Same stable-handler / stable-key semantics as `useEventSubscriptions`:
|
|
1011
|
+
* handlers may change every render without re-subscribing; re-subscription
|
|
1012
|
+
* happens only when the set of channel names or the session changes. A null
|
|
1013
|
+
* session subscribes to nothing, and cleanly re-subscribes when one arrives.
|
|
1014
|
+
*/
|
|
1015
|
+
declare function useSessionEventSubscriptions(session: XynologSession | null, subscriptions: {
|
|
1016
|
+
[K in UnscopedChannel]?: (payload: EventMap[K]) => void;
|
|
1017
|
+
}): void;
|
|
1018
|
+
|
|
1019
|
+
interface ToolbarPrefs {
|
|
1020
|
+
annotateMode: boolean;
|
|
1021
|
+
setAnnotateMode: (mode: boolean) => void;
|
|
1022
|
+
clickAction: ClickAction;
|
|
1023
|
+
setClickAction: (action: ClickAction) => void;
|
|
1024
|
+
selectionMotivation: Motivation$2 | null;
|
|
1025
|
+
setSelectionMotivation: (motivation: Motivation$2 | null) => void;
|
|
1026
|
+
shape: ShapeType;
|
|
1027
|
+
setShape: (shape: ShapeType) => void;
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* The POLICY layer for toolbar preferences: one shared, localStorage-persisted
|
|
1031
|
+
* prefs state — the Xynolog Browser's global-toolbar UX, relocated from inside
|
|
1032
|
+
* the components to a visible page-layer hook. Feed the returned values/setters
|
|
1033
|
+
* to every viewer you compose (as its controlled props) and they stay in
|
|
1034
|
+
* lockstep and survive remounts. The components themselves hold no persistence
|
|
1035
|
+
* and no cross-instance sync; this hook is the one legitimate home for both.
|
|
1036
|
+
* Keys are the historical ones, so existing users' prefs carry over.
|
|
1037
|
+
*
|
|
1038
|
+
* `selectorType` scopes the SHAPE pref exactly as before: per selector type
|
|
1039
|
+
* (persisted only for 'svg'; 'fragment' is always rectangle).
|
|
1040
|
+
*/
|
|
1041
|
+
declare function useToolbarPrefs(selectorType?: SelectorType): ToolbarPrefs;
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* A claimed `mark:requested` — the typed event payload (selector + motivation +
|
|
1045
|
+
* source), re-exported rather than a parallel shape.
|
|
1046
|
+
*/
|
|
1047
|
+
type PendingCreation = EventMap['mark:requested'];
|
|
1048
|
+
/**
|
|
1049
|
+
* The consuming half of the viewer's capture/policy split.
|
|
1050
|
+
*
|
|
1051
|
+
* The viewer captures gestures and emits source-scoped `mark:requested`; this
|
|
1052
|
+
* hook claims them for ONE viewer: an event is claimed iff
|
|
1053
|
+
* `enabled && event.source === resourceId` — N mounted hooks on one session each
|
|
1054
|
+
* claim only their own (the multi-mount contract: every `mark:requested`
|
|
1055
|
+
* carries its source resource id). A new request for the same resource REPLACES
|
|
1056
|
+
* an unresolved pending (the user reselected; the stale pending is abandoned).
|
|
1057
|
+
*
|
|
1058
|
+
* Headless by contract: no creation call, no UI, no toast in here — resolution
|
|
1059
|
+
* (chooser flows, body forms, `mark.annotation`) is host policy. Session-first
|
|
1060
|
+
* like every subscribing primitive (it reads its channel on the session's
|
|
1061
|
+
* client, through `useSessionEventSubscriptions`); `null` → inert.
|
|
1062
|
+
*
|
|
1063
|
+
* @param session Session whose bus carries this viewer's events; null → inert.
|
|
1064
|
+
* @param resourceId Claim only events whose `source` is this resource.
|
|
1065
|
+
* @param enabled The host's annotate-mode gate — browse-mode viewers never claim.
|
|
1066
|
+
*/
|
|
1067
|
+
declare function usePendingCreation(session: XynologSession | null, resourceId: ResourceId, enabled: boolean): {
|
|
1068
|
+
pending: PendingCreation | null;
|
|
1069
|
+
clearPending: () => void;
|
|
1070
|
+
};
|
|
1071
|
+
|
|
1072
|
+
interface KBDiscoveryOptions {
|
|
1073
|
+
/** Pause entirely (e.g. the KB panel is closed). Default true. */
|
|
1074
|
+
enabled?: boolean;
|
|
1075
|
+
/** Poll interval, forwarded to the sdk subscription (sdk default applies when omitted). */
|
|
1076
|
+
intervalMs?: number;
|
|
1077
|
+
/** Transport override (tests, non-default URL). Default: same-origin `httpDiscovery()`. */
|
|
1078
|
+
transport?: DiscoveryTransport;
|
|
1079
|
+
}
|
|
1080
|
+
interface KBDiscoveryResult {
|
|
1081
|
+
/**
|
|
1082
|
+
* Last known discovery state; `null` before the first emission. While
|
|
1083
|
+
* paused (disabled or hidden) the last known state is retained — a resumed
|
|
1084
|
+
* subscription's immediate poll replaces it promptly.
|
|
1085
|
+
*/
|
|
1086
|
+
state: DiscoveryState | null;
|
|
1087
|
+
/** Convenience projection: the managed list, `[]` otherwise. */
|
|
1088
|
+
kbs: DiscoveredKB[];
|
|
1089
|
+
}
|
|
1090
|
+
declare function useKBDiscovery(options?: KBDiscoveryOptions): KBDiscoveryResult;
|
|
1091
|
+
|
|
1092
|
+
interface XynologProviderProps {
|
|
1093
|
+
/** Inject a fully-constructed browser (tests, embedded hosts that build their own). Omit to use the default. */
|
|
1094
|
+
browser?: XynologBrowser;
|
|
1095
|
+
/** Override the default `WebBrowserStorage`. Useful for non-browser hosts (Electron/Tauri filesystem-backed adapters). */
|
|
1096
|
+
storage?: SessionStorage;
|
|
1097
|
+
/** Override the default HTTP session factory. Useful for non-HTTP transports. */
|
|
1098
|
+
sessionFactory?: SessionFactory;
|
|
1099
|
+
children: ReactNode;
|
|
1100
|
+
}
|
|
1101
|
+
declare function XynologProvider({ browser, storage, sessionFactory, children, }: XynologProviderProps): React$1.JSX.Element;
|
|
1102
|
+
declare function useXynolog(): XynologBrowser;
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* WebBrowserStorage — browser-backed `SessionStorage` implementation.
|
|
1106
|
+
* Wraps `localStorage` for reads/writes and `window`'s `storage` event
|
|
1107
|
+
* for cross-tab change notifications.
|
|
1108
|
+
*
|
|
1109
|
+
* Construction requires a browser context. The guard matches the
|
|
1110
|
+
* existing registry behavior: server rendering that accidentally
|
|
1111
|
+
* instantiates this gets a loud error rather than a silent no-op
|
|
1112
|
+
* that would mask token leaks.
|
|
1113
|
+
*/
|
|
1114
|
+
|
|
1115
|
+
declare class WebBrowserStorage implements SessionStorage {
|
|
1116
|
+
constructor();
|
|
1117
|
+
get(key: string): string | null;
|
|
1118
|
+
set(key: string, value: string): void;
|
|
1119
|
+
delete(key: string): void;
|
|
1120
|
+
/** Read and written in one synchronous step, so nothing this page runs falls between them. */
|
|
1121
|
+
update(key: string, change: (stored: string | null) => string | null): void;
|
|
1122
|
+
subscribe(handler: (key: string, newValue: string | null) => void): () => void;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
interface AnnotationProviderProps {
|
|
1126
|
+
annotationManager: AnnotationManager;
|
|
1127
|
+
children: React__default.ReactNode;
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Annotation Provider
|
|
1131
|
+
*
|
|
1132
|
+
* Provides annotation mutation capabilities (create, delete) via the Provider Pattern.
|
|
1133
|
+
* Apps inject their own AnnotationManager implementation.
|
|
1134
|
+
*
|
|
1135
|
+
* Example usage:
|
|
1136
|
+
* ```typescript
|
|
1137
|
+
* function useAnnotationManager(client: XynologClient): AnnotationManager {
|
|
1138
|
+
* return {
|
|
1139
|
+
* markAnnotation: async (params) => {
|
|
1140
|
+
* const result = await client.mark.annotation({
|
|
1141
|
+
* motivation: params.motivation,
|
|
1142
|
+
* target: { source: params.rUri, selector: params.selector },
|
|
1143
|
+
* body: params.body,
|
|
1144
|
+
* });
|
|
1145
|
+
* return result.annotation;
|
|
1146
|
+
* },
|
|
1147
|
+
* deleteAnnotation: async (params) => {
|
|
1148
|
+
* await client.mark.delete(params.rUri, params.annotationId);
|
|
1149
|
+
* }
|
|
1150
|
+
* };
|
|
1151
|
+
* }
|
|
1152
|
+
*
|
|
1153
|
+
* // In app layout
|
|
1154
|
+
* const annotationManager = useAnnotationManager();
|
|
1155
|
+
* <AnnotationProvider annotationManager={annotationManager}>
|
|
1156
|
+
* <YourComponents />
|
|
1157
|
+
* </AnnotationProvider>
|
|
1158
|
+
* ```
|
|
1159
|
+
*/
|
|
1160
|
+
declare function AnnotationProvider({ annotationManager, children, }: AnnotationProviderProps): React__default.JSX.Element;
|
|
1161
|
+
/**
|
|
1162
|
+
* Hook to access the AnnotationManager
|
|
1163
|
+
*
|
|
1164
|
+
* @throws Error if used outside AnnotationProvider
|
|
1165
|
+
* @returns AnnotationManager instance
|
|
1166
|
+
*/
|
|
1167
|
+
declare function useAnnotationManager(): AnnotationManager;
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* Subscribe to a bus event with automatic cleanup.
|
|
1171
|
+
*
|
|
1172
|
+
* Two buses exist: the app-scoped bus on `XynologBrowser` (panel, shell,
|
|
1173
|
+
* tabs, nav, settings — events that must work without a KB session) and
|
|
1174
|
+
* the per-session bus on `XynologClient` (mark, beckon, gather,
|
|
1175
|
+
* match, bind, yield, browse — events tied to a live KB). This hook
|
|
1176
|
+
* subscribes to BOTH so components don't need to know which scope a
|
|
1177
|
+
* channel is on. Each channel only fires on one bus, so there's no
|
|
1178
|
+
* double-delivery.
|
|
1179
|
+
*
|
|
1180
|
+
* A channel of a resource's scope (`mark:added` and the other events of the
|
|
1181
|
+
* record) is not one of these: it is read for one resource, with
|
|
1182
|
+
* `useResourceEventSubscriptions`.
|
|
1183
|
+
*
|
|
1184
|
+
* Stable-handler pattern: the ref-wrapped handler means `handler` itself
|
|
1185
|
+
* can change on every render without causing a re-subscription.
|
|
1186
|
+
*
|
|
1187
|
+
* @example
|
|
1188
|
+
* ```tsx
|
|
1189
|
+
* useEventSubscription('mark:create-ok', ({ annotationId }) => {
|
|
1190
|
+
* triggerSparkleAnimation(annotationId);
|
|
1191
|
+
* });
|
|
1192
|
+
* ```
|
|
1193
|
+
*/
|
|
1194
|
+
declare function useEventSubscription<K extends UnscopedChannel>(eventName: K, handler: (payload: EventMap[K]) => void): void;
|
|
1195
|
+
/**
|
|
1196
|
+
* Subscribe to multiple bus events at once. Same semantics as
|
|
1197
|
+
* `useEventSubscription`, batched — each channel is subscribed on both
|
|
1198
|
+
* the app bus (`XynologBrowser`) and the session bus
|
|
1199
|
+
* (`XynologClient`, when a session is active).
|
|
1200
|
+
*
|
|
1201
|
+
* @example
|
|
1202
|
+
* ```tsx
|
|
1203
|
+
* useEventSubscriptions({
|
|
1204
|
+
* 'mark:create-ok': ({ annotationId }) => handleCreated(annotationId),
|
|
1205
|
+
* 'panel:toggle': ({ panel }) => console.log('toggled', panel),
|
|
1206
|
+
* });
|
|
1207
|
+
* ```
|
|
1208
|
+
*/
|
|
1209
|
+
declare function useEventSubscriptions(subscriptions: {
|
|
1210
|
+
[K in UnscopedChannel]?: (payload: EventMap[K]) => void;
|
|
1211
|
+
}): void;
|
|
1212
|
+
/**
|
|
1213
|
+
* Subscribe to the events of one resource: the channels of a resource's
|
|
1214
|
+
* scope (`mark:added`, `mark:body-updated` and the other events of the
|
|
1215
|
+
* record), on the active session.
|
|
1216
|
+
*
|
|
1217
|
+
* The subscriptions hold the resource's scope for as long as the component
|
|
1218
|
+
* is mounted, and each handler is given that resource's events and no
|
|
1219
|
+
* other's. Same stable-handler and stable-key semantics as
|
|
1220
|
+
* `useEventSubscriptions`.
|
|
1221
|
+
*
|
|
1222
|
+
* @example
|
|
1223
|
+
* ```tsx
|
|
1224
|
+
* useResourceEventSubscriptions(resourceId, {
|
|
1225
|
+
* 'mark:added': (stored) => triggerSparkleAnimation(stored.payload.annotation.id),
|
|
1226
|
+
* });
|
|
1227
|
+
* ```
|
|
1228
|
+
*/
|
|
1229
|
+
declare function useResourceEventSubscriptions(resourceId: ResourceId, subscriptions: {
|
|
1230
|
+
[K in ResourceScopedChannel]?: (payload: EventMap[K]) => void;
|
|
1231
|
+
}): void;
|
|
1232
|
+
|
|
1233
|
+
interface ResourceAnnotationsContextType {
|
|
1234
|
+
sparkleAnnotationIds: Set<string>;
|
|
1235
|
+
markAnnotation: (rUri: ResourceId, motivation: Motivation$2, selector: Selector | Selector[], body?: Annotation['body']) => Promise<string | undefined>;
|
|
1236
|
+
clearSparkle: (id: AnnotationId) => void;
|
|
1237
|
+
triggerSparkleAnimation: (annotationId: string) => void;
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* @emits mark:create-request - Create an annotation of a resource. Payload: MarkCreateRequest
|
|
1241
|
+
*/
|
|
1242
|
+
declare function ResourceAnnotationsProvider({ children, }: {
|
|
1243
|
+
children: React__default.ReactNode;
|
|
1244
|
+
}): React__default.JSX.Element;
|
|
1245
|
+
declare function useResourceAnnotations(): ResourceAnnotationsContextType;
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* Standard Link component interface
|
|
1249
|
+
* Compatible with Next.js Link, React Router Link, etc.
|
|
1250
|
+
*
|
|
1251
|
+
* Components accept Link as a prop to remain framework-agnostic.
|
|
1252
|
+
* Apps provide their framework-specific Link component (Next.js, React Router, etc.)
|
|
1253
|
+
*/
|
|
1254
|
+
interface LinkComponentProps {
|
|
1255
|
+
href: string;
|
|
1256
|
+
children: React__default.ReactNode;
|
|
1257
|
+
className?: string;
|
|
1258
|
+
title?: string;
|
|
1259
|
+
onClick?: (e: React__default.MouseEvent) => void;
|
|
1260
|
+
'aria-label'?: string;
|
|
1261
|
+
'aria-current'?: 'page';
|
|
1262
|
+
}
|
|
1263
|
+
/**
|
|
1264
|
+
* Route builder interface
|
|
1265
|
+
* Apps provide concrete implementations for their routing scheme
|
|
1266
|
+
*
|
|
1267
|
+
* Components accept routes as a prop to build URLs without framework dependencies.
|
|
1268
|
+
*
|
|
1269
|
+
* @example
|
|
1270
|
+
* ```tsx
|
|
1271
|
+
* // In the app (images/browser/src/lib/routing.tsx)
|
|
1272
|
+
* export const routes: RouteBuilder = {
|
|
1273
|
+
* resourceDetail: (id) => `/know/resource/${id}`,
|
|
1274
|
+
* knowledge: () => '/know',
|
|
1275
|
+
* moderate: () => '/moderate',
|
|
1276
|
+
* };
|
|
1277
|
+
*
|
|
1278
|
+
* // Pass to components as props
|
|
1279
|
+
* <MyComponent Link={Link} routes={routes} />
|
|
1280
|
+
* ```
|
|
1281
|
+
*/
|
|
1282
|
+
interface RouteBuilder {
|
|
1283
|
+
/** Resource detail page */
|
|
1284
|
+
resourceDetail: (id: string) => string;
|
|
1285
|
+
/** Knowledge base page */
|
|
1286
|
+
knowledge?: () => string;
|
|
1287
|
+
/** Moderation dashboard */
|
|
1288
|
+
moderate?: () => string;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* Where a subtree's strings come from: a whole `TranslationManager` the host
|
|
1293
|
+
* built, or one of react-ui's own locales. Exactly one, and no default:
|
|
1294
|
+
* react-ui assumes no language. `TranslationProvider` takes it, and so does
|
|
1295
|
+
* every component a host can mount on its own, which mounts its own provider
|
|
1296
|
+
* from it.
|
|
1297
|
+
*/
|
|
1298
|
+
type TranslationSource = {
|
|
1299
|
+
/** A complete TranslationManager implementation */
|
|
1300
|
+
translationManager: TranslationManager;
|
|
1301
|
+
locale?: never;
|
|
1302
|
+
loadingComponent?: never;
|
|
1303
|
+
} | {
|
|
1304
|
+
/** Built-in translations for this locale */
|
|
1305
|
+
locale: LocaleCode;
|
|
1306
|
+
/** Shown while the locale's translations are first being loaded */
|
|
1307
|
+
loadingComponent?: ReactNode;
|
|
1308
|
+
translationManager?: never;
|
|
1309
|
+
};
|
|
1310
|
+
type TranslationProviderProps = TranslationSource & {
|
|
1311
|
+
children: ReactNode;
|
|
1312
|
+
};
|
|
1313
|
+
/**
|
|
1314
|
+
* Provider for translation management
|
|
1315
|
+
*
|
|
1316
|
+
* Two modes of operation, and no language is assumed in either:
|
|
1317
|
+
* 1. With translationManager: uses that translation implementation
|
|
1318
|
+
* 2. With locale: dynamically loads the built-in translations for that locale.
|
|
1319
|
+
* A locale whose translations cannot be loaded is an error. Once a locale's
|
|
1320
|
+
* strings are loaded, every provider of that locale renders at once.
|
|
1321
|
+
*/
|
|
1322
|
+
declare function TranslationProvider(props: TranslationProviderProps): React$1.JSX.Element;
|
|
1323
|
+
/**
|
|
1324
|
+
* Hook to access translations within a namespace
|
|
1325
|
+
*
|
|
1326
|
+
* Reads the manager of the nearest TranslationProvider, and throws when there
|
|
1327
|
+
* is none.
|
|
1328
|
+
*
|
|
1329
|
+
* @param namespace - Translation namespace (e.g., 'Toolbar', 'ResourceViewer')
|
|
1330
|
+
* @returns Function to translate keys within the namespace
|
|
1331
|
+
*/
|
|
1332
|
+
declare function useTranslations(namespace: string): (key: string, params?: Record<string, unknown>) => string;
|
|
1333
|
+
/**
|
|
1334
|
+
* The nearest TranslationProvider's manager, for a component that hands the
|
|
1335
|
+
* language on to a view that takes it as a prop, as `ResourceViewerPage` hands
|
|
1336
|
+
* it to `ResourceViewer`. Throws when there is none, as `useTranslations` does.
|
|
1337
|
+
*/
|
|
1338
|
+
declare function useTranslationManager(): TranslationManager;
|
|
1339
|
+
/**
|
|
1340
|
+
* Hook to preload translations for a locale
|
|
1341
|
+
* Useful for preloading translations before navigation
|
|
1342
|
+
*/
|
|
1343
|
+
declare function usePreloadTranslations(): {
|
|
1344
|
+
preload: (locale: string) => Promise<boolean>;
|
|
1345
|
+
isLoaded: (locale: string) => boolean;
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1348
|
+
/**
|
|
1349
|
+
* Pure logic for CodeMirrorRenderer
|
|
1350
|
+
*
|
|
1351
|
+
* These functions have zero dependency on CodeMirror's DOM or React.
|
|
1352
|
+
* They handle the conversion between the content's offsets and the
|
|
1353
|
+
* document's positions, tooltip generation, and decoration metadata.
|
|
1354
|
+
*/
|
|
1355
|
+
|
|
1356
|
+
interface TextSegment {
|
|
1357
|
+
exact: string;
|
|
1358
|
+
annotation?: Annotation;
|
|
1359
|
+
/**
|
|
1360
|
+
* Where the segment starts and where it ends. From
|
|
1361
|
+
* `segmentTextWithAnnotations` these are offsets into the content, in
|
|
1362
|
+
* Unicode code points; `convertSegmentPositions` answers the same segments
|
|
1363
|
+
* with positions in CodeMirror's document, which is what the decorations
|
|
1364
|
+
* are built from.
|
|
1365
|
+
*/
|
|
1366
|
+
start: number;
|
|
1367
|
+
end: number;
|
|
1368
|
+
/** How `segmentTextWithAnnotations` resolved the anchor. Present only on
|
|
1369
|
+
* annotated segments — background text has no strategy. */
|
|
1370
|
+
strategy?: AnchorStrategy;
|
|
1371
|
+
/** Confidence of the anchor classification. `'high'` is the no-ambiguity
|
|
1372
|
+
* path; `'medium'` / `'low'` warrant the visual affordance and a one-
|
|
1373
|
+
* shot warning log. */
|
|
1374
|
+
confidence?: AnchorConfidence;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
interface Props$b {
|
|
1378
|
+
content: string;
|
|
1379
|
+
/** Optional - only needed for annotation rendering. Each is from one offset into `content` to another, in code points. */
|
|
1380
|
+
segments?: TextSegment[];
|
|
1381
|
+
onChange?: (content: string) => void;
|
|
1382
|
+
editable?: boolean;
|
|
1383
|
+
sparkleAnnotationIds?: Set<string>;
|
|
1384
|
+
hoveredAnnotationId?: string | null;
|
|
1385
|
+
scrollToAnnotationId?: string | null;
|
|
1386
|
+
sourceView?: boolean;
|
|
1387
|
+
showLineNumbers?: boolean;
|
|
1388
|
+
enableWidgets?: boolean;
|
|
1389
|
+
session?: XynologSession | null | undefined;
|
|
1390
|
+
getTargetResourceName?: (resourceId: string) => string | undefined;
|
|
1391
|
+
generatingReferenceId?: string | null;
|
|
1392
|
+
hoverDelayMs: number;
|
|
1393
|
+
}
|
|
1394
|
+
/**
|
|
1395
|
+
* @emits beckon:hover - Annotation in the text hovered or unhovered. Payload: { annotationId: string | null }
|
|
1396
|
+
*/
|
|
1397
|
+
declare function CodeMirrorRenderer({ content, segments, onChange, editable, sparkleAnnotationIds, hoveredAnnotationId, scrollToAnnotationId, sourceView, showLineNumbers, enableWidgets, session, getTargetResourceName, generatingReferenceId, hoverDelayMs, }: Props$b): React$1.JSX.Element;
|
|
1398
|
+
|
|
1399
|
+
type JobProgress$9 = components['schemas']['JobProgress'];
|
|
1400
|
+
type JobProgressMessage = components['schemas']['JobProgressMessage'];
|
|
1401
|
+
/**
|
|
1402
|
+
* Every string this component renders. Required by default and with NO English
|
|
1403
|
+
* fallbacks: a `tr.x || 'X'` default turns a forgotten key into English text in
|
|
1404
|
+
* a Japanese UI, silently and only at runtime. Required keys make the same
|
|
1405
|
+
* mistake a type error at the call site.
|
|
1406
|
+
*
|
|
1407
|
+
* The wire codes collapse to ONE required function rather than a key apiece:
|
|
1408
|
+
* the code→copy switch belongs in one place, and threading a string per code
|
|
1409
|
+
* through every call site would put a copy of it at each. Build it with
|
|
1410
|
+
* `delegateProgressCopy(t)`.
|
|
1411
|
+
*/
|
|
1412
|
+
interface DelegateProgressTranslations {
|
|
1413
|
+
/** Control label while the run is in flight. */
|
|
1414
|
+
cancel: string;
|
|
1415
|
+
/** Control label once it has been pressed to cancel, until the run ends. */
|
|
1416
|
+
cancelling: string;
|
|
1417
|
+
/** Status line once the run has ended cancelled. */
|
|
1418
|
+
cancelled: string;
|
|
1419
|
+
/** Control label once the run has ended. */
|
|
1420
|
+
close: string;
|
|
1421
|
+
/** Localized copy for a progress code. */
|
|
1422
|
+
message: (m: JobProgressMessage) => string;
|
|
1423
|
+
/**
|
|
1424
|
+
* Shown when the event carries no code — a pure liveness heartbeat, or a
|
|
1425
|
+
* producer that sends none. `JobProgress.message` is optional for exactly
|
|
1426
|
+
* these cases.
|
|
1427
|
+
*/
|
|
1428
|
+
inProgress: string;
|
|
1429
|
+
/**
|
|
1430
|
+
* The subject line: what is being worked on, with its position when known.
|
|
1431
|
+
* Takes the wire's `{ kind, value }` — the localized name for `kind` is the
|
|
1432
|
+
* translation layer's business, not this component's.
|
|
1433
|
+
*/
|
|
1434
|
+
subject: (current: NonNullable<JobProgress$9['current']>, done?: number, total?: number) => string;
|
|
1435
|
+
/**
|
|
1436
|
+
* Localized NAME for an echoed request parameter. The wire sends a code
|
|
1437
|
+
* (`instructions`, `tone`, …); the VALUE beside it is the user's own words
|
|
1438
|
+
* and is never translated.
|
|
1439
|
+
*/
|
|
1440
|
+
paramLabel: (code: NonNullable<JobProgress$9['requestParams']>[number]['label']) => string;
|
|
1441
|
+
/** Completed entity-type log line (reference flow only). */
|
|
1442
|
+
found?: (count: number) => string;
|
|
1443
|
+
/**
|
|
1444
|
+
* The found-of-~expected tally (reference flow only). Rendered only
|
|
1445
|
+
* when the wire carries BOTH counts: `entitiesExpected` absent means the
|
|
1446
|
+
* provider priced nothing — no claim — and a denominator is never
|
|
1447
|
+
* manufactured from it. The ~ is the copy's to render: the wire calls the
|
|
1448
|
+
* number approximate and the words should too.
|
|
1449
|
+
*/
|
|
1450
|
+
tally?: (found: number, expected: number) => string;
|
|
1451
|
+
}
|
|
1452
|
+
/**
|
|
1453
|
+
* The CSS `data-type` hook: the annotator registry's keys plus generation. A
|
|
1454
|
+
* closed set, so it is typed as one — a typo in a bare string produces unstyled
|
|
1455
|
+
* chrome, silently.
|
|
1456
|
+
*/
|
|
1457
|
+
type DelegateDataType = AnnotatorKey | 'generation';
|
|
1458
|
+
interface DelegateProgressProps {
|
|
1459
|
+
progress: JobProgress$9;
|
|
1460
|
+
dataType: DelegateDataType;
|
|
1461
|
+
/**
|
|
1462
|
+
* What the finished run produced, offered as a link in the ended frame. The
|
|
1463
|
+
* label is the artifact's own name — user content, never translated. Rendered
|
|
1464
|
+
* only once the run has completed: mid-run there is no outcome to offer, and a
|
|
1465
|
+
* cancelled run made none, whatever the caller has wired.
|
|
1466
|
+
*/
|
|
1467
|
+
outcome?: {
|
|
1468
|
+
label: string;
|
|
1469
|
+
onOpen: () => void;
|
|
1470
|
+
} | undefined;
|
|
1471
|
+
/**
|
|
1472
|
+
* The owner's terminal sentence, rendered in place of the payload message
|
|
1473
|
+
* once the run has completed. The producer's final frame is a fire-and-forget
|
|
1474
|
+
* emit that can lose the race with `job:complete`, so an ended frame must not
|
|
1475
|
+
* trust the last payload to describe the ending — the owner, which signalled
|
|
1476
|
+
* `ended`, supplies the words too. Inert while the run is live, and for a
|
|
1477
|
+
* cancelled run, whose sentence is `translations.cancelled`.
|
|
1478
|
+
*/
|
|
1479
|
+
endedMessage?: string;
|
|
1480
|
+
/**
|
|
1481
|
+
* Whether the run has ENDED, and how: `false` while it runs, `'completed'`
|
|
1482
|
+
* once it has completed, `'cancelled'` once it was cancelled. The owner's
|
|
1483
|
+
* fact, not the payload's: terminality is signalled on `job:complete` /
|
|
1484
|
+
* `job:fail`, which `DelegateShell` already observes via `isDelegating`, and
|
|
1485
|
+
* a cancellation is learnt from the job's status. `JobProgress` carries no
|
|
1486
|
+
* terminal marker for this component to read.
|
|
1487
|
+
*
|
|
1488
|
+
* A cancelled job's commits stand, so its display stays, at the point it
|
|
1489
|
+
* stopped: no ✅, the bar where the last report left it, no outcome, and
|
|
1490
|
+
* `translations.cancelled` on the status line.
|
|
1491
|
+
*
|
|
1492
|
+
* REQUIRED. Nothing about a progress payload can tell this component the run
|
|
1493
|
+
* is over, or that it was cancelled, so the owner must say. Were it optional,
|
|
1494
|
+
* a call site that forgot it would have a flow that can never reach the ended
|
|
1495
|
+
* state — a default of `false` is a wrong answer, not a safe one.
|
|
1496
|
+
*/
|
|
1497
|
+
ended: false | 'completed' | 'cancelled';
|
|
1498
|
+
/**
|
|
1499
|
+
* Cancel the job this display follows. `DelegateShell` passes the one its
|
|
1500
|
+
* `controls` hold, which is absent until the queue has named the job: a
|
|
1501
|
+
* pending job is cancelled, a running one is stopped by its worker.
|
|
1502
|
+
*
|
|
1503
|
+
* Resolves with whether the queue acted on it, and rejects when the request
|
|
1504
|
+
* was refused. From the click the control reads as cancelling and cannot be
|
|
1505
|
+
* pressed again, until the run ends; an answer of `false`, or a refusal,
|
|
1506
|
+
* gives it back.
|
|
1507
|
+
*/
|
|
1508
|
+
onCancel?: () => Promise<boolean>;
|
|
1509
|
+
/** Dismiss the display, once the job has ended. `DelegateShell` passes its `controls`' dismiss. */
|
|
1510
|
+
onDismiss?: () => void;
|
|
1511
|
+
translations: DelegateProgressTranslations;
|
|
1512
|
+
}
|
|
1513
|
+
/**
|
|
1514
|
+
* The one job-progress renderer, for all five motivations.
|
|
1515
|
+
*
|
|
1516
|
+
* Presentational and provider-free: no session, no context — cancel/dismiss
|
|
1517
|
+
* arrive as callbacks, so it renders identically on the page and in embeddable
|
|
1518
|
+
* (bring-your-own-session) hosts.
|
|
1519
|
+
*
|
|
1520
|
+
* One shape for every flow. What varies is DATA, not flags: a bar appears
|
|
1521
|
+
* because there is a fraction to fill it, a subject line appears because there
|
|
1522
|
+
* is a subject. Per-flow opt-in flags (a title, a percent bar) would give
|
|
1523
|
+
* unrelated layouts from one component, and with them duplicate renders and
|
|
1524
|
+
* doubled chrome.
|
|
1525
|
+
*/
|
|
1526
|
+
declare function DelegateProgress({ progress, dataType, ended, outcome, endedMessage, onCancel, onDismiss, translations: tr, }: DelegateProgressProps): React$1.JSX.Element;
|
|
1527
|
+
|
|
1528
|
+
/**
|
|
1529
|
+
* What a delegated job's progress display does when its one control is
|
|
1530
|
+
* pressed: cancel while the job runs, dismiss once it has ended.
|
|
1531
|
+
*
|
|
1532
|
+
* Its private fields make the type nominal. An object literal is not one, so
|
|
1533
|
+
* `DelegateShell`, which takes nothing else, cannot be composed with
|
|
1534
|
+
* callbacks written in place: only {@link delegatedJobControls}, which is
|
|
1535
|
+
* given the job's id, makes one.
|
|
1536
|
+
*/
|
|
1537
|
+
declare class Controls {
|
|
1538
|
+
#private;
|
|
1539
|
+
constructor(jobId: JobId | null, onCancel: (() => Promise<boolean>) | undefined, onDismiss: (() => void) | undefined);
|
|
1540
|
+
/** The job the display follows; `null` until the queue has named it. */
|
|
1541
|
+
get jobId(): JobId | null;
|
|
1542
|
+
/** Resolves with whether the queue acted on the cancel; rejects when the request was refused. */
|
|
1543
|
+
get onCancel(): (() => Promise<boolean>) | undefined;
|
|
1544
|
+
get onDismiss(): (() => void) | undefined;
|
|
1545
|
+
}
|
|
1546
|
+
type DelegatedJobControls = Controls;
|
|
1547
|
+
/**
|
|
1548
|
+
* The controls of the display that follows the job `jobId`. With no id yet,
|
|
1549
|
+
* because the queue has not answered the job's creation, or with no session
|
|
1550
|
+
* to send it on, there is no cancel and the display shows no control while
|
|
1551
|
+
* the job runs.
|
|
1552
|
+
*
|
|
1553
|
+
* @emits job:cancel-requested - Cancel the delegated job, by its id: pending, it is cancelled; running, the worker that holds it stops its work and settles it as cancelled. Payload: { jobId: JobId }
|
|
1554
|
+
*/
|
|
1555
|
+
declare function delegatedJobControls(session: XynologSession | null, jobId: JobId | null, onDismiss: (() => void) | undefined): DelegatedJobControls;
|
|
1556
|
+
/**
|
|
1557
|
+
* The controls of a `mark` job's display: its dismiss clears the progress
|
|
1558
|
+
* of the resource's mark unit.
|
|
1559
|
+
*/
|
|
1560
|
+
declare function markJobControls(session: XynologSession | null, mark: MarkStateUnit | undefined, jobId: JobId | null): DelegatedJobControls;
|
|
1561
|
+
|
|
1562
|
+
type JobProgress$8 = components['schemas']['JobProgress'];
|
|
1563
|
+
interface DelegateShellProps {
|
|
1564
|
+
/** localStorage persist-key suffix and CSS `data-type`. */
|
|
1565
|
+
delegateType: DelegateDataType;
|
|
1566
|
+
/** Collapsible section title (already translated). */
|
|
1567
|
+
title: string;
|
|
1568
|
+
isDelegating: boolean;
|
|
1569
|
+
/**
|
|
1570
|
+
* The job ended cancelled. Its commits stand, so its display stays, in its
|
|
1571
|
+
* cancelled form, until it is dismissed. Read only once the job is no longer
|
|
1572
|
+
* delegating. Required for the reason `DelegateProgress`'s `ended` is: a
|
|
1573
|
+
* default of `false` would show a cancelled job as completed.
|
|
1574
|
+
*/
|
|
1575
|
+
cancelled: boolean;
|
|
1576
|
+
progress: JobProgress$8 | null | undefined;
|
|
1577
|
+
/** The per-motivation form (fields + submit) — shown when no progress is displayed. */
|
|
1578
|
+
form: ReactNode;
|
|
1579
|
+
/**
|
|
1580
|
+
* The job this display follows, and what its control does: cancel while
|
|
1581
|
+
* the job runs, dismiss once it has ended. Made by `delegatedJobControls`
|
|
1582
|
+
* or `markJobControls`, never written in place, so no display can be
|
|
1583
|
+
* composed without naming its job. Dismiss policy lives HERE: the shell
|
|
1584
|
+
* offers the dismiss only once the delegated job is no longer running.
|
|
1585
|
+
*/
|
|
1586
|
+
controls: DelegatedJobControls;
|
|
1587
|
+
/**
|
|
1588
|
+
* Pass-through config for the progress renderer (translations, outcome,
|
|
1589
|
+
* ended sentence). It carries no callbacks: those are `controls`.
|
|
1590
|
+
*
|
|
1591
|
+
* Required because `translations` is: the shell renders the progress display
|
|
1592
|
+
* itself, so a caller that omitted this would render untranslated chrome —
|
|
1593
|
+
* the failure the widget's required translations exist to make impossible.
|
|
1594
|
+
*/
|
|
1595
|
+
progressProps: Omit<DelegateProgressProps, 'progress' | 'dataType' | 'ended' | 'onCancel' | 'onDismiss'>;
|
|
1596
|
+
}
|
|
1597
|
+
/**
|
|
1598
|
+
* The one delegate-section chrome: collapsible header with persisted expand
|
|
1599
|
+
* state, the delegating wrapper, and the form-vs-progress switch. Every
|
|
1600
|
+
* motivation's panel composes this shell with its own fields — the fields
|
|
1601
|
+
* differ per motivation by design (instructions/tone/density vs entity chips
|
|
1602
|
+
* vs schema+categories), so the shell owns only what is genuinely shared.
|
|
1603
|
+
*/
|
|
1604
|
+
declare function DelegateShell({ delegateType, title, isDelegating, cancelled, progress, form, controls, progressProps, }: DelegateShellProps): React$1.JSX.Element;
|
|
1605
|
+
|
|
1606
|
+
interface Props$a {
|
|
1607
|
+
children: ReactNode;
|
|
1608
|
+
fallback?: (error: Error, reset: () => void) => ReactNode;
|
|
1609
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
1610
|
+
}
|
|
1611
|
+
interface State {
|
|
1612
|
+
hasError: boolean;
|
|
1613
|
+
error: Error | null;
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Generic Error Boundary component that catches JavaScript errors
|
|
1617
|
+
* in child components and displays a fallback UI.
|
|
1618
|
+
*/
|
|
1619
|
+
declare class ErrorBoundary extends Component<Props$a, State> {
|
|
1620
|
+
constructor(props: Props$a);
|
|
1621
|
+
static getDerivedStateFromError(error: Error): State;
|
|
1622
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
1623
|
+
handleReset: () => void;
|
|
1624
|
+
render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | React$1.JSX.Element | null | undefined;
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* Specialized error boundary for async components
|
|
1628
|
+
*/
|
|
1629
|
+
declare function AsyncErrorBoundary({ children }: {
|
|
1630
|
+
children: ReactNode;
|
|
1631
|
+
}): React$1.JSX.Element;
|
|
1632
|
+
|
|
1633
|
+
interface ProtectedErrorBoundaryProps {
|
|
1634
|
+
children: React__default.ReactNode;
|
|
1635
|
+
/**
|
|
1636
|
+
* Values that, when any change, reset the boundary back to its non-error
|
|
1637
|
+
* state. Apps typically pass `[location.pathname]` so navigating away from
|
|
1638
|
+
* a crashed page automatically recovers.
|
|
1639
|
+
*/
|
|
1640
|
+
resetKeys?: unknown[];
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* Error boundary for protected (authenticated) routes.
|
|
1644
|
+
*
|
|
1645
|
+
* Catches unexpected render-time crashes inside the protected tree and
|
|
1646
|
+
* shows a generic "something went wrong" fallback with a refresh option.
|
|
1647
|
+
*
|
|
1648
|
+
* NOT auth-specific. Auth state changes (sign-in, sign-out, expiry) flow
|
|
1649
|
+
* through the active session's observables, not exceptions — so this
|
|
1650
|
+
* boundary will never catch an "auth error" in normal operation. Its job
|
|
1651
|
+
* is purely to keep a render bug from blanking the screen.
|
|
1652
|
+
*
|
|
1653
|
+
* The optional `resetKeys` prop lets callers wire automatic recovery on
|
|
1654
|
+
* navigation (e.g. `resetKeys={[location.pathname]}`).
|
|
1655
|
+
*/
|
|
1656
|
+
declare function ProtectedErrorBoundary({ children, resetKeys, }: ProtectedErrorBoundaryProps): React__default.JSX.Element;
|
|
1657
|
+
|
|
1658
|
+
interface LiveRegionContextType {
|
|
1659
|
+
announce: (message: string, priority?: 'polite' | 'assertive') => void;
|
|
1660
|
+
}
|
|
1661
|
+
declare function useLiveRegion(): LiveRegionContextType;
|
|
1662
|
+
interface LiveRegionProviderProps {
|
|
1663
|
+
children: React__default.ReactNode;
|
|
1664
|
+
}
|
|
1665
|
+
declare function LiveRegionProvider({ children }: LiveRegionProviderProps): React__default.JSX.Element;
|
|
1666
|
+
declare function useSearchAnnouncements(): {
|
|
1667
|
+
announceSearchResults: (count: number, query: string) => void;
|
|
1668
|
+
announceSearching: () => void;
|
|
1669
|
+
};
|
|
1670
|
+
declare function useDocumentAnnouncements(annotators: Record<string, Annotator>): {
|
|
1671
|
+
announceDocumentSaved: () => void;
|
|
1672
|
+
announceDocumentDeleted: () => void;
|
|
1673
|
+
announceAnnotationCreated: (annotation: Annotation) => void;
|
|
1674
|
+
announceAnnotationDeleted: () => void;
|
|
1675
|
+
announceAnnotationUpdated: (annotation: Annotation) => void;
|
|
1676
|
+
announceError: (message: string) => void;
|
|
1677
|
+
};
|
|
1678
|
+
declare function useResourceLoadingAnnouncements(): {
|
|
1679
|
+
announceResourceLoading: (resourceName: string) => void;
|
|
1680
|
+
announceResourceLoaded: (resourceName: string) => void;
|
|
1681
|
+
announceResourceLoadError: (resourceName: string) => void;
|
|
1682
|
+
announceResourceUpdating: (resourceName: string) => void;
|
|
1683
|
+
};
|
|
1684
|
+
declare function useFormAnnouncements(): {
|
|
1685
|
+
announceFormSubmitting: () => void;
|
|
1686
|
+
announceFormSuccess: (message: string) => void;
|
|
1687
|
+
announceFormError: (message: string) => void;
|
|
1688
|
+
announceFormValidationError: (fieldCount: number) => void;
|
|
1689
|
+
};
|
|
1690
|
+
declare function useLanguageChangeAnnouncements(): {
|
|
1691
|
+
announceLanguageChanging: (newLanguage: string) => void;
|
|
1692
|
+
announceLanguageChanged: (newLanguage: string) => void;
|
|
1693
|
+
};
|
|
1694
|
+
|
|
1695
|
+
interface ResizeHandleProps {
|
|
1696
|
+
/** Callback fired when resize occurs */
|
|
1697
|
+
onResize: (newWidth: number) => void;
|
|
1698
|
+
/** Current width in pixels of the panel the handle resizes */
|
|
1699
|
+
width: number;
|
|
1700
|
+
/** Minimum allowed width in pixels */
|
|
1701
|
+
minWidth: number;
|
|
1702
|
+
/** Maximum allowed width in pixels */
|
|
1703
|
+
maxWidth: number;
|
|
1704
|
+
/** Position of handle - left or right edge */
|
|
1705
|
+
position?: 'left' | 'right';
|
|
1706
|
+
/** Accessible name of the handle */
|
|
1707
|
+
ariaLabel: string;
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* Draggable resize handle for panels and sidebars
|
|
1711
|
+
*
|
|
1712
|
+
* Features:
|
|
1713
|
+
* - Mouse drag to resize
|
|
1714
|
+
* - Keyboard navigation (Arrow keys: ±10px, Shift+Arrow: ±50px)
|
|
1715
|
+
* - Enforces min/max constraints
|
|
1716
|
+
* - Visual feedback on hover and drag
|
|
1717
|
+
* - A focusable separator whose value is the width, between min and max
|
|
1718
|
+
*
|
|
1719
|
+
* @example
|
|
1720
|
+
* ```tsx
|
|
1721
|
+
* <div className="panel" style={{ width: `${width}px` }}>
|
|
1722
|
+
* <ResizeHandle
|
|
1723
|
+
* onResize={setWidth}
|
|
1724
|
+
* width={width}
|
|
1725
|
+
* minWidth={256}
|
|
1726
|
+
* maxWidth={800}
|
|
1727
|
+
* position="left"
|
|
1728
|
+
* ariaLabel={t('resizePanel')}
|
|
1729
|
+
* />
|
|
1730
|
+
* <div>Panel content</div>
|
|
1731
|
+
* </div>
|
|
1732
|
+
* ```
|
|
1733
|
+
*/
|
|
1734
|
+
declare function ResizeHandle({ onResize, width, minWidth, maxWidth, position, ariaLabel, }: ResizeHandleProps): React__default.JSX.Element;
|
|
1735
|
+
|
|
1736
|
+
interface ResourceTagsInlineProps {
|
|
1737
|
+
resourceId: string;
|
|
1738
|
+
tags: string[];
|
|
1739
|
+
isEditing: boolean;
|
|
1740
|
+
/**
|
|
1741
|
+
* Commit: called ONCE per edit with the FULL new tag set (the host diffs —
|
|
1742
|
+
* its SDK call takes `(current, updated)`). Awaited; the editor renders
|
|
1743
|
+
* inert while the returned promise is pending.
|
|
1744
|
+
*/
|
|
1745
|
+
onUpdate: (tags: string[]) => Promise<void>;
|
|
1746
|
+
disabled?: boolean;
|
|
1747
|
+
/**
|
|
1748
|
+
* The KB's registered entity types — the CONTROLLED VOCABULARY, host-supplied
|
|
1749
|
+
* (the component is session-less; hosts fetch via `browse.entityTypes()`).
|
|
1750
|
+
* Adds are a picker constrained to it: no free-text minting. Without it the
|
|
1751
|
+
* editor is REMOVAL-ONLY (it cannot offer valid candidates). Removal is never
|
|
1752
|
+
* vocabulary-gated — stale/unregistered tags must stay removable.
|
|
1753
|
+
*/
|
|
1754
|
+
vocabulary?: string[];
|
|
1755
|
+
}
|
|
1756
|
+
declare function ResourceTagsInline({ tags, isEditing, onUpdate, disabled, vocabulary, }: ResourceTagsInlineProps): React$1.JSX.Element | null;
|
|
1757
|
+
|
|
1758
|
+
type ToastType = 'success' | 'error' | 'info' | 'warning';
|
|
1759
|
+
interface ToastMessage {
|
|
1760
|
+
id: string;
|
|
1761
|
+
message: string;
|
|
1762
|
+
type: ToastType;
|
|
1763
|
+
duration?: number;
|
|
1764
|
+
}
|
|
1765
|
+
interface ToastContainerProps {
|
|
1766
|
+
toasts: ToastMessage[];
|
|
1767
|
+
onClose: (id: string) => void;
|
|
1768
|
+
}
|
|
1769
|
+
declare function ToastContainer({ toasts, onClose }: ToastContainerProps): React__default.ReactPortal | null;
|
|
1770
|
+
interface ToastContextType {
|
|
1771
|
+
showToast: (message: string, type?: ToastType, duration?: number) => void;
|
|
1772
|
+
showSuccess: (message: string, duration?: number) => void;
|
|
1773
|
+
showError: (message: string, duration?: number) => void;
|
|
1774
|
+
showWarning: (message: string, duration?: number) => void;
|
|
1775
|
+
showInfo: (message: string, duration?: number) => void;
|
|
1776
|
+
}
|
|
1777
|
+
declare function ToastProvider({ children }: {
|
|
1778
|
+
children: React__default.ReactNode;
|
|
1779
|
+
}): React__default.JSX.Element;
|
|
1780
|
+
declare function useToast(): ToastContextType;
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* ShellStateUnit — app-shell state: which toolbar panel is open, tab-bar
|
|
1784
|
+
* coordination helpers, scroll-to-annotation signals. Lives on
|
|
1785
|
+
* `XynologBrowser`'s app-scoped bus (not the per-session client bus)
|
|
1786
|
+
* because panel toggles and shell chrome must work regardless of
|
|
1787
|
+
* whether a KB session is active.
|
|
1788
|
+
*
|
|
1789
|
+
* Channels: `panel:toggle`, `panel:open`, `panel:close`.
|
|
1790
|
+
*/
|
|
1791
|
+
|
|
1792
|
+
type ToolbarPanelType = 'history' | 'info' | 'annotations' | 'settings' | 'collaboration' | 'user' | 'jsonld' | 'knowledge-base';
|
|
1793
|
+
declare const COMMON_PANELS: readonly ToolbarPanelType[];
|
|
1794
|
+
declare const RESOURCE_PANELS: readonly ToolbarPanelType[];
|
|
1795
|
+
interface ShellStateUnit extends StateUnit {
|
|
1796
|
+
activePanel$: Observable<ToolbarPanelType | null>;
|
|
1797
|
+
scrollToAnnotationId$: Observable<string | null>;
|
|
1798
|
+
panelInitialTab$: Observable<{
|
|
1799
|
+
tab: AnnotatorKey;
|
|
1800
|
+
generation: number;
|
|
1801
|
+
} | null>;
|
|
1802
|
+
openPanel(panel: string): void;
|
|
1803
|
+
closePanel(): void;
|
|
1804
|
+
togglePanel(panel: string): void;
|
|
1805
|
+
onScrollCompleted(): void;
|
|
1806
|
+
}
|
|
1807
|
+
interface ShellStateUnitOptions {
|
|
1808
|
+
initialPanel?: ToolbarPanelType | null;
|
|
1809
|
+
onPanelChange?: (panel: ToolbarPanelType | null) => void;
|
|
1810
|
+
}
|
|
1811
|
+
/**
|
|
1812
|
+
* @emits panel:open - Open a panel. Payload: { panel: string }
|
|
1813
|
+
* @emits panel:close - Close the open panel. Payload: undefined
|
|
1814
|
+
* @emits panel:toggle - Open a panel, or close it when it is the open one. Payload: { panel: string }
|
|
1815
|
+
*/
|
|
1816
|
+
declare function createShellStateUnit(browser: XynologBrowser, options?: ShellStateUnitOptions): ShellStateUnit;
|
|
1817
|
+
|
|
1818
|
+
type ToolbarContext = 'document' | 'simple';
|
|
1819
|
+
interface ToolbarProps<T extends string = string> {
|
|
1820
|
+
context: ToolbarContext;
|
|
1821
|
+
activePanel: T | null;
|
|
1822
|
+
isArchived?: boolean;
|
|
1823
|
+
}
|
|
1824
|
+
/**
|
|
1825
|
+
* What a page renders the host's panel container with (its `ToolbarPanels`
|
|
1826
|
+
* prop): the open panel, the theme setting, and the page's own panels.
|
|
1827
|
+
*/
|
|
1828
|
+
interface ToolbarPanelsProps {
|
|
1829
|
+
activePanel: ToolbarPanelType | null;
|
|
1830
|
+
theme: Theme;
|
|
1831
|
+
children?: ReactNode;
|
|
1832
|
+
}
|
|
1833
|
+
/**
|
|
1834
|
+
* Toolbar component for panel navigation
|
|
1835
|
+
*
|
|
1836
|
+
* @emits panel:toggle - Toggle panel visibility. Payload: { panel: string }
|
|
1837
|
+
*/
|
|
1838
|
+
declare function Toolbar<T extends string = string>({ context, activePanel, isArchived, }: ToolbarProps<T>): React$1.JSX.Element;
|
|
1839
|
+
|
|
1840
|
+
interface SettingsPanelProps {
|
|
1841
|
+
theme: Theme;
|
|
1842
|
+
locale: string;
|
|
1843
|
+
isPendingLocaleChange?: boolean;
|
|
1844
|
+
hoverDelayMs: number;
|
|
1845
|
+
/**
|
|
1846
|
+
* What the About section shows and links to.
|
|
1847
|
+
*
|
|
1848
|
+
* REQUIRED, not optional: react-ui cannot know the host's build version or
|
|
1849
|
+
* reach its keyboard-shortcuts context, so the host must answer — and there
|
|
1850
|
+
* is exactly one host (ToolbarPanels). An optional prop here would be a seam
|
|
1851
|
+
* with nothing behind it.
|
|
1852
|
+
*/
|
|
1853
|
+
version: string;
|
|
1854
|
+
sourceCodeUrl: string;
|
|
1855
|
+
onOpenKeyboardHelp: () => void;
|
|
1856
|
+
}
|
|
1857
|
+
/**
|
|
1858
|
+
* Settings panel for application preferences
|
|
1859
|
+
*
|
|
1860
|
+
* @emits settings:locale-changed - Locale changed by user. Payload: { locale: string }
|
|
1861
|
+
* @emits settings:line-numbers-toggled - Line numbers toggled on/off. Payload: undefined
|
|
1862
|
+
* @emits settings:theme-changed - Theme changed by user. Payload: SettingsThemeChangedEvent
|
|
1863
|
+
* @emits settings:hover-delay-changed - Hover delay changed by user. Payload: { hoverDelayMs: number }
|
|
1864
|
+
*/
|
|
1865
|
+
declare function SettingsPanel({ theme, locale, isPendingLocaleChange, hoverDelayMs, version, sourceCodeUrl, onOpenKeyboardHelp, }: SettingsPanelProps): React__default.JSX.Element;
|
|
1866
|
+
|
|
1867
|
+
interface JsonLdViewProps {
|
|
1868
|
+
annotation: Annotation;
|
|
1869
|
+
onBack: () => void;
|
|
1870
|
+
/** Whether the editor numbers its lines: the viewer's own setting, handed down. */
|
|
1871
|
+
showLineNumbers: boolean;
|
|
1872
|
+
}
|
|
1873
|
+
/**
|
|
1874
|
+
* An annotation as W3C Web Annotation JSON-LD, read-only. It reads no
|
|
1875
|
+
* provider: its line numbers come from the viewer that opens it, and its
|
|
1876
|
+
* colours from the page's theme, through the CSS variables the JSON theme is
|
|
1877
|
+
* written in.
|
|
1878
|
+
*/
|
|
1879
|
+
declare function JsonLdView({ annotation, onBack, showLineNumbers, }: JsonLdViewProps): React$1.JSX.Element;
|
|
1880
|
+
|
|
1881
|
+
interface SelectedTextDisplayProps {
|
|
1882
|
+
exact: string;
|
|
1883
|
+
}
|
|
1884
|
+
declare function SelectedTextDisplay({ exact }: SelectedTextDisplayProps): React__default.JSX.Element;
|
|
1885
|
+
interface EntityTypeBadgesProps {
|
|
1886
|
+
entityTypes: string;
|
|
1887
|
+
}
|
|
1888
|
+
declare function EntityTypeBadges({ entityTypes }: EntityTypeBadgesProps): React__default.JSX.Element | null;
|
|
1889
|
+
interface PopupHeaderProps {
|
|
1890
|
+
title: string;
|
|
1891
|
+
selectedText?: string;
|
|
1892
|
+
onClose: () => void;
|
|
1893
|
+
}
|
|
1894
|
+
declare function PopupHeader({ title, selectedText, onClose, }: PopupHeaderProps): React__default.JSX.Element;
|
|
1895
|
+
interface PopupContainerProps {
|
|
1896
|
+
children: React__default.ReactNode;
|
|
1897
|
+
position: {
|
|
1898
|
+
x: number;
|
|
1899
|
+
y: number;
|
|
1900
|
+
};
|
|
1901
|
+
onClose: () => void;
|
|
1902
|
+
isOpen: boolean;
|
|
1903
|
+
wide?: boolean;
|
|
1904
|
+
}
|
|
1905
|
+
declare function PopupContainer({ children, position, onClose, isOpen, wide, }: PopupContainerProps): React__default.JSX.Element;
|
|
1906
|
+
|
|
1907
|
+
interface AnnotationOverlayProps {
|
|
1908
|
+
annotations: Annotation[];
|
|
1909
|
+
imageWidth: number;
|
|
1910
|
+
imageHeight: number;
|
|
1911
|
+
displayWidth: number;
|
|
1912
|
+
displayHeight: number;
|
|
1913
|
+
session?: XynologSession | null | undefined;
|
|
1914
|
+
hoveredAnnotationId?: string | null;
|
|
1915
|
+
selectedAnnotationId?: string | null;
|
|
1916
|
+
hoverDelayMs: number;
|
|
1917
|
+
}
|
|
1918
|
+
/**
|
|
1919
|
+
* Render annotation overlay - displays existing annotations as SVG shapes
|
|
1920
|
+
*
|
|
1921
|
+
* @emits browse:click - Annotation clicked. Payload: { annotationId: string, anchorRect?: AnchorRect }
|
|
1922
|
+
*/
|
|
1923
|
+
declare function AnnotationOverlay({ annotations, imageWidth, imageHeight, displayWidth, displayHeight, session, hoveredAnnotationId, selectedAnnotationId, hoverDelayMs, }: AnnotationOverlayProps): React$1.JSX.Element;
|
|
1924
|
+
|
|
1925
|
+
type DrawingMode = 'rectangle' | 'polygon' | 'circle' | 'freeform' | null;
|
|
1926
|
+
interface SvgDrawingCanvasProps {
|
|
1927
|
+
imageUrl: string;
|
|
1928
|
+
/** The '@id' of the annotated resource — stamped as `source` on mark:requested (multi-viewer routing). */
|
|
1929
|
+
resourceUri: ResourceId;
|
|
1930
|
+
existingAnnotations?: Annotation[];
|
|
1931
|
+
drawingMode: DrawingMode;
|
|
1932
|
+
selectedMotivation?: Motivation$2 | null;
|
|
1933
|
+
session?: XynologSession | null | undefined;
|
|
1934
|
+
hoveredAnnotationId?: string | null;
|
|
1935
|
+
selectedAnnotationId?: string | null;
|
|
1936
|
+
hoverDelayMs?: number;
|
|
1937
|
+
/** Zoom applied by the resource renderer around this canvas. */
|
|
1938
|
+
zoom?: number;
|
|
1939
|
+
}
|
|
1940
|
+
/**
|
|
1941
|
+
* SVG-based drawing canvas for creating image annotations with shapes
|
|
1942
|
+
*
|
|
1943
|
+
* The canvas asks for the image's anchored text as soon as it has a session,
|
|
1944
|
+
* and takes a drawing only while it holds that text: whatever `drawingMode`
|
|
1945
|
+
* it is given, a drag draws nothing until then. It says which it is on its
|
|
1946
|
+
* own element, as `data-annotate-deferred`.
|
|
1947
|
+
*
|
|
1948
|
+
* @emits browse:click - Annotation clicked on canvas. Payload: { annotationId: string, anchorRect?: AnchorRect }
|
|
1949
|
+
* @emits mark:requested - New annotation drawn on canvas. Payload: { source: ResourceId, selector: SvgSelector, motivation: Motivation }
|
|
1950
|
+
*/
|
|
1951
|
+
declare function SvgDrawingCanvas({ imageUrl, resourceUri, existingAnnotations, drawingMode, selectedMotivation, session, hoveredAnnotationId, selectedAnnotationId, zoom, }: SvgDrawingCanvasProps): React__default.JSX.Element;
|
|
1952
|
+
|
|
1953
|
+
interface KeyboardShortcutsHelpModalProps {
|
|
1954
|
+
isOpen: boolean;
|
|
1955
|
+
onClose: () => void;
|
|
1956
|
+
}
|
|
1957
|
+
declare function KeyboardShortcutsHelpModal({ isOpen, onClose, }: KeyboardShortcutsHelpModalProps): React__default.JSX.Element;
|
|
1958
|
+
|
|
1959
|
+
/**
|
|
1960
|
+
* Modal that surfaces when a 403 forbidden error is reported via
|
|
1961
|
+
* the active session's `signals.notifyPermissionDenied(...)`.
|
|
1962
|
+
*
|
|
1963
|
+
* Its own copy is in the person's language. Beneath it is the refusal's own
|
|
1964
|
+
* message, unaltered and marked as the knowledge base's: it is the only part
|
|
1965
|
+
* that names what was refused, and a client cannot translate it.
|
|
1966
|
+
*
|
|
1967
|
+
* Reads `permissionDenied$` from the active `SessionSignals`. The signals instance clears the
|
|
1968
|
+
* flag when the user dismisses the modal. Modal state lives on
|
|
1969
|
+
* signals (not the session itself) so headless sessions
|
|
1970
|
+
* (workers/CLIs) don't carry dead observables.
|
|
1971
|
+
*/
|
|
1972
|
+
declare function PermissionDeniedModal(): React$1.JSX.Element;
|
|
1973
|
+
|
|
1974
|
+
/**
|
|
1975
|
+
* Modal that surfaces when the active KB's session has ended: it expired,
|
|
1976
|
+
* or the knowledge base did not accept the sign-in. The notice's reason
|
|
1977
|
+
* says which; the title is true of either. Every word is the person's
|
|
1978
|
+
* language: the notice carries a reason, never a sentence.
|
|
1979
|
+
*
|
|
1980
|
+
* Reads `sessionEnded$` from the active `SessionSignals`.
|
|
1981
|
+
* When the user dismisses the modal, the signals instance clears the
|
|
1982
|
+
* flag. Modal state lives on signals (not the session itself) so
|
|
1983
|
+
* headless sessions (workers/CLIs) don't carry dead observables.
|
|
1984
|
+
*/
|
|
1985
|
+
declare function SessionEndedModal(): React$1.JSX.Element;
|
|
1986
|
+
|
|
1987
|
+
/**
|
|
1988
|
+
* A registered KB's address answered with a DIFFERENT did at activation. By
|
|
1989
|
+
* the time this renders, the SDK has already voided the tab list and
|
|
1990
|
+
* last-viewed state that claimed to be about the old KB — this modal only
|
|
1991
|
+
* TELLS, honestly: the entry the user registered and the identity that
|
|
1992
|
+
* answered are two distinct facts, both dids verbatim, and the newcomer is
|
|
1993
|
+
* never presented under the registered label. The forward route is the
|
|
1994
|
+
* Knowledge Base panel, which owns re-registration; the registry entry itself
|
|
1995
|
+
* is left exactly as the user wrote it — it is the evidence.
|
|
1996
|
+
*
|
|
1997
|
+
* Third member of the signals-modal family (SessionEndedModal,
|
|
1998
|
+
* PermissionDeniedModal): reads the active `SessionSignals`, dismiss
|
|
1999
|
+
* acknowledges. Like them it is fully translated — new strings go through
|
|
2000
|
+
* the census gate.
|
|
2001
|
+
*
|
|
2002
|
+
* @emits panel:open - Open the knowledge-base panel. Payload: { panel: 'knowledge-base' }
|
|
2003
|
+
*/
|
|
2004
|
+
declare function KbIdentityConflictModal(): React$1.JSX.Element | null;
|
|
2005
|
+
|
|
2006
|
+
/**
|
|
2007
|
+
* Common props for an ANNOTATING media renderer. The read-only sibling is
|
|
2008
|
+
* `MediaRendererProps` in `browse-renderers.tsx`; this one additionally
|
|
2009
|
+
* carries the active tool, because annotating is an interaction, not a paint.
|
|
2010
|
+
*
|
|
2011
|
+
* `content` is decoded text for the text renderer, or a media URL for the
|
|
2012
|
+
* image / PDF renderers. `annotations` is the FLAT list — a renderer derives
|
|
2013
|
+
* whatever shape it needs (the text one segments it), so a custom renderer is
|
|
2014
|
+
* never handed a projection only one implementation can use.
|
|
2015
|
+
*/
|
|
2016
|
+
interface AnnotateMediaRendererProps {
|
|
2017
|
+
content: string;
|
|
2018
|
+
mimeType: string;
|
|
2019
|
+
/** Resource zoom. The PDF renderer applies it to pages while keeping its page rail fixed. */
|
|
2020
|
+
zoom?: number;
|
|
2021
|
+
resourceUri: ResourceId;
|
|
2022
|
+
annotations: Annotation[];
|
|
2023
|
+
/** Session for interaction routing — the canvases emit via `session.client`. */
|
|
2024
|
+
session: XynologSession | null;
|
|
2025
|
+
/** Active drawing tool, or null when nothing is selected (read-only paint). */
|
|
2026
|
+
drawingMode: ShapeType | null;
|
|
2027
|
+
selectedMotivation: Motivation$2 | null;
|
|
2028
|
+
hoveredAnnotationId?: string | null;
|
|
2029
|
+
hoverDelayMs?: number;
|
|
2030
|
+
sparkleAnnotationIds?: Set<string>;
|
|
2031
|
+
scrollToAnnotationId?: string | null;
|
|
2032
|
+
showLineNumbers?: boolean;
|
|
2033
|
+
enableWidgets?: boolean;
|
|
2034
|
+
getTargetResourceName?: (resourceId: string) => string | undefined;
|
|
2035
|
+
generatingReferenceId?: string | null;
|
|
2036
|
+
}
|
|
2037
|
+
/** Annotating media dispatch, keyed by the registry render mode. */
|
|
2038
|
+
type AnnotateMediaRenderers = Partial<Record<string, ComponentType<AnnotateMediaRendererProps>>>;
|
|
2039
|
+
declare function TextAnnotateRenderer({ content, annotations, session, sparkleAnnotationIds, hoveredAnnotationId, scrollToAnnotationId, showLineNumbers, hoverDelayMs, enableWidgets, getTargetResourceName, generatingReferenceId, }: AnnotateMediaRendererProps): React$1.JSX.Element;
|
|
2040
|
+
declare function ImageAnnotateRenderer({ content, resourceUri, annotations, session, drawingMode, selectedMotivation, hoveredAnnotationId, hoverDelayMs, zoom, }: AnnotateMediaRendererProps): React$1.JSX.Element | null;
|
|
2041
|
+
declare function PdfAnnotateRenderer({ content, resourceUri, annotations, session, drawingMode, selectedMotivation, hoveredAnnotationId, hoverDelayMs, zoom, }: AnnotateMediaRendererProps): React$1.JSX.Element | null;
|
|
2042
|
+
/**
|
|
2043
|
+
* Default annotating media renderers. `AnnotateView` merges a caller's
|
|
2044
|
+
* `renderers` override on top of these, so a host can swap one renderer (its
|
|
2045
|
+
* own PDF viewer, say) or add a mode without forking the view — the same seam
|
|
2046
|
+
* `defaultBrowseRenderers` gives the read-only path.
|
|
2047
|
+
*/
|
|
2048
|
+
declare const defaultAnnotateRenderers: Record<Exclude<RenderMode, 'none'>, ComponentType<AnnotateMediaRendererProps>>;
|
|
2049
|
+
|
|
2050
|
+
interface Props$9 {
|
|
2051
|
+
content: string;
|
|
2052
|
+
mimeType?: string;
|
|
2053
|
+
/** The '@id' of the shown resource — stamped as `source` on mark:requested (multi-viewer routing). */
|
|
2054
|
+
resourceUri: ResourceId;
|
|
2055
|
+
annotations: AnnotationsCollection;
|
|
2056
|
+
/** Zoom the rendered resource content, leaving the annotation toolbar at its normal size. */
|
|
2057
|
+
zoom?: number;
|
|
2058
|
+
uiState: AnnotationUIState;
|
|
2059
|
+
onUIStateChange?: (state: Partial<AnnotationUIState>) => void;
|
|
2060
|
+
editable?: boolean;
|
|
2061
|
+
enableWidgets?: boolean;
|
|
2062
|
+
getTargetResourceName?: (resourceId: string) => string | undefined;
|
|
2063
|
+
generatingReferenceId?: string | null;
|
|
2064
|
+
showLineNumbers?: boolean;
|
|
2065
|
+
hoverDelayMs?: number;
|
|
2066
|
+
annotateMode: boolean;
|
|
2067
|
+
/** Session for the shown resource — its client emits mark:* / mark.request; its bus feeds toolbar + beckon events. */
|
|
2068
|
+
session: XynologSession | null;
|
|
2069
|
+
/** Recently-created annotation ids to sparkle (host-provided). */
|
|
2070
|
+
sparkleAnnotationIds?: Set<string>;
|
|
2071
|
+
/** The bar's Mode control reports the chosen mode here (the owner applies it). */
|
|
2072
|
+
onModeChange?: (mode: boolean) => void;
|
|
2073
|
+
/** Render the built-in bar (default). false → no bar; selection capture and drawing stay live. */
|
|
2074
|
+
showToolbar?: boolean;
|
|
2075
|
+
/** Override the annotating media renderers (render mode → renderer); merged over the defaults. */
|
|
2076
|
+
renderers?: AnnotateMediaRenderers;
|
|
2077
|
+
}
|
|
2078
|
+
/**
|
|
2079
|
+
* The annotating view, given its language: it mounts the translation provider
|
|
2080
|
+
* its subtree reads. Inside `ResourceViewer` it is handed the viewer's own.
|
|
2081
|
+
*/
|
|
2082
|
+
declare function AnnotateView(props: Props$9 & TranslationSource): React$1.JSX.Element;
|
|
2083
|
+
|
|
2084
|
+
interface Props$8 {
|
|
2085
|
+
/**
|
|
2086
|
+
* The resource's stored events, and how their load is going. Supplied by the
|
|
2087
|
+
* owner (which already holds them on its state unit) rather than fetched
|
|
2088
|
+
* here: a self-fetching panel can only model (value | not-yet), so a
|
|
2089
|
+
* terminal failure (B15) is indistinguishable from a request still in
|
|
2090
|
+
* flight and the panel says "Loading..." for ever.
|
|
2091
|
+
*/
|
|
2092
|
+
events: AttributedEvent[];
|
|
2093
|
+
eventsLoading?: boolean;
|
|
2094
|
+
eventsError?: Error | null;
|
|
2095
|
+
onRetryEvents?: () => void;
|
|
2096
|
+
/** Annotations for the same resource — used to resolve event → annotation. */
|
|
2097
|
+
annotations?: Annotation[];
|
|
2098
|
+
hoveredAnnotationId?: string | null;
|
|
2099
|
+
onEventHover?: (annotationId: AnnotationId | null) => void;
|
|
2100
|
+
onEventClick?: (annotationId: AnnotationId | null) => void;
|
|
2101
|
+
Link: React__default.ComponentType<LinkComponentProps>;
|
|
2102
|
+
routes: RouteBuilder;
|
|
2103
|
+
}
|
|
2104
|
+
declare function AnnotationHistory({ events: eventsData, eventsLoading, eventsError, onRetryEvents, annotations, hoveredAnnotationId, onEventHover, onEventClick, Link, routes, }: Props$8): React__default.JSX.Element | null;
|
|
2105
|
+
|
|
2106
|
+
/**
|
|
2107
|
+
* Common props for a read-only ("browse") media renderer. `content` is decoded
|
|
2108
|
+
* text for the text renderer, or a media URL for the image / PDF renderers.
|
|
2109
|
+
* A consumer can implement this interface to swap in a custom renderer.
|
|
2110
|
+
*/
|
|
2111
|
+
interface MediaRendererProps {
|
|
2112
|
+
content: string;
|
|
2113
|
+
mimeType: string;
|
|
2114
|
+
/** Resource zoom. The PDF renderer applies it to pages while keeping its page rail fixed. */
|
|
2115
|
+
zoom?: number;
|
|
2116
|
+
/** PDF-only: the renderer owns scrolling in pane views; inline hosts own it. */
|
|
2117
|
+
ownsScrollport?: boolean;
|
|
2118
|
+
resourceUri: ResourceId;
|
|
2119
|
+
annotations: Annotation[];
|
|
2120
|
+
/**
|
|
2121
|
+
* Session for interaction routing inside annotation-bearing renderers — the
|
|
2122
|
+
* canvases emit clicks/hover via `session.client.browse/beckon`. Absent/null
|
|
2123
|
+
* → the annotations still PAINT, but are inert (paint-only). Threaded by
|
|
2124
|
+
* BrowseView's dispatch; custom renderers may ignore it.
|
|
2125
|
+
*/
|
|
2126
|
+
session?: XynologSession | null;
|
|
2127
|
+
}
|
|
2128
|
+
/** Read-only media dispatch, keyed by the registry render mode. */
|
|
2129
|
+
type BrowseMediaRenderers = Partial<Record<string, ComponentType<MediaRendererProps>>>;
|
|
2130
|
+
declare function TextBrowseRenderer({ content }: MediaRendererProps): React$1.JSX.Element;
|
|
2131
|
+
declare function ImageBrowseRenderer({ content, resourceUri, annotations, session, zoom, }: MediaRendererProps): React$1.JSX.Element;
|
|
2132
|
+
declare function PdfBrowseRenderer({ content, resourceUri, annotations, session, zoom, ownsScrollport, }: MediaRendererProps): React$1.JSX.Element;
|
|
2133
|
+
/**
|
|
2134
|
+
* Default read-only media renderers. `BrowseView` merges a caller's `renderers`
|
|
2135
|
+
* override on top of these, so a host can swap one renderer (e.g. its own PDF
|
|
2136
|
+
* viewer) or add a mode without forking the view.
|
|
2137
|
+
*/
|
|
2138
|
+
declare const defaultBrowseRenderers: Record<Exclude<RenderMode, 'none'>, ComponentType<MediaRendererProps>>;
|
|
2139
|
+
|
|
2140
|
+
interface Props$7 {
|
|
2141
|
+
content: string;
|
|
2142
|
+
mimeType: string;
|
|
2143
|
+
resourceUri: ResourceId;
|
|
2144
|
+
annotations: AnnotationsCollection;
|
|
2145
|
+
/** Zoom the rendered resource content, leaving the browse toolbar at its normal size. */
|
|
2146
|
+
zoom?: number;
|
|
2147
|
+
hoveredAnnotationId?: string | null;
|
|
2148
|
+
selectedClick?: ClickAction;
|
|
2149
|
+
annotateMode: boolean;
|
|
2150
|
+
hoverDelayMs?: number;
|
|
2151
|
+
/** Session for the shown resource — emits browse:click / beckon:hover; its bus feeds beckon events. */
|
|
2152
|
+
session: XynologSession | null;
|
|
2153
|
+
/** Recently-created annotation ids to sparkle (host-provided). */
|
|
2154
|
+
sparkleAnnotationIds?: Set<string>;
|
|
2155
|
+
/** Override the read-only media renderers (render mode → renderer); merged over the defaults. */
|
|
2156
|
+
renderers?: BrowseMediaRenderers;
|
|
2157
|
+
/** A content link (`<a href>` in the rendered content) was clicked. The viewer preventDefaults and
|
|
2158
|
+
* delegates; it never navigates on its own. Omit → the click is still blocked (nothing happens). */
|
|
2159
|
+
onLinkClick?: (link: {
|
|
2160
|
+
href: string;
|
|
2161
|
+
event: MouseEvent;
|
|
2162
|
+
}) => void;
|
|
2163
|
+
/** A RESOLVED reference span is hovered: fires after the dwell AND the referent's cached descriptor
|
|
2164
|
+
* resolves; `null` on leave (only if a hover fired — stubs stay silent). Host renders its own preview. */
|
|
2165
|
+
onReferenceHover?: (hover: ReferenceHover | null) => void;
|
|
2166
|
+
/** Inline display variant: auto-height to content, no inner scroll container, no pane chrome —
|
|
2167
|
+
* drops into a chat bubble / card / list item. Default: fill-the-pane. */
|
|
2168
|
+
inline?: boolean;
|
|
2169
|
+
/** The bar's Mode control reports the chosen mode here (the owner applies it). */
|
|
2170
|
+
onModeChange?: (mode: boolean) => void;
|
|
2171
|
+
/** The bar's Click control reports the chosen action here (the owner applies it). */
|
|
2172
|
+
onClickActionChange?: (action: ClickAction) => void;
|
|
2173
|
+
/** Render the built-in bar (default). false → no bar; all other seams stay live. */
|
|
2174
|
+
showToolbar?: boolean;
|
|
2175
|
+
}
|
|
2176
|
+
/** Payload for `onReferenceHover` — the hovered linking annotation, its resolved referent, and where the span is. */
|
|
2177
|
+
interface ReferenceHover {
|
|
2178
|
+
annotation: Annotation;
|
|
2179
|
+
referent: ResourceDescriptor;
|
|
2180
|
+
anchorRect: DOMRect;
|
|
2181
|
+
}
|
|
2182
|
+
/**
|
|
2183
|
+
* The read-only view, given its language: it mounts the translation provider
|
|
2184
|
+
* its subtree reads. Inside `ResourceViewer` it is handed the viewer's own.
|
|
2185
|
+
*/
|
|
2186
|
+
declare const BrowseView: React$1.MemoExoticComponent<(props: Props$7 & TranslationSource) => React$1.JSX.Element>;
|
|
2187
|
+
|
|
2188
|
+
interface Props$6 {
|
|
2189
|
+
/** The '@id' of the resource whose bytes to offer. */
|
|
2190
|
+
resourceUri: ResourceId;
|
|
2191
|
+
/** Session for that resource — its client mints the media token and supplies the gateway origin. */
|
|
2192
|
+
session: XynologSession | null;
|
|
2193
|
+
}
|
|
2194
|
+
/**
|
|
2195
|
+
* The "Download File" affordance on the unsupported-media fallback, shared by
|
|
2196
|
+
* the browse and annotate views.
|
|
2197
|
+
*
|
|
2198
|
+
* Its own component rather than inline markup for two reasons. The token is a
|
|
2199
|
+
* hook, and this fallback is a branch — mounting the component only in that
|
|
2200
|
+
* branch keeps every text/image/PDF view from minting a media token it will
|
|
2201
|
+
* never use. And the URL rule (absolute + `?token=`) lives in `mediaUrl`,
|
|
2202
|
+
* where both views and the viewer page read the same one.
|
|
2203
|
+
*
|
|
2204
|
+
* Before the token lands the anchor renders as a disabled button: a tokenless
|
|
2205
|
+
* URL is a guaranteed 401, and a link that silently fails is worse than one
|
|
2206
|
+
* visibly not ready yet. A client with no `auth` namespace (a host on a bare
|
|
2207
|
+
* transport) stays in that state permanently, which is the honest answer —
|
|
2208
|
+
* it cannot mint tokens at all.
|
|
2209
|
+
*/
|
|
2210
|
+
declare function DownloadFileLink({ resourceUri, session }: Props$6): React$1.JSX.Element;
|
|
2211
|
+
|
|
2212
|
+
type TranslateFn$1 = (key: string, params?: Record<string, string | number>) => string;
|
|
2213
|
+
interface Props$5 {
|
|
2214
|
+
event: AttributedEvent;
|
|
2215
|
+
annotations: Annotation[];
|
|
2216
|
+
allEvents: components['schemas']['StoredEventResponse'][];
|
|
2217
|
+
isRelated: boolean;
|
|
2218
|
+
t: TranslateFn$1;
|
|
2219
|
+
Link: React__default.ComponentType<LinkComponentProps>;
|
|
2220
|
+
routes: RouteBuilder;
|
|
2221
|
+
onEventRef?: (annotationId: AnnotationId | null, element: HTMLElement | null) => void;
|
|
2222
|
+
onEventClick?: (annotationId: AnnotationId | null) => void;
|
|
2223
|
+
onEventHover?: (annotationId: AnnotationId | null) => void;
|
|
2224
|
+
}
|
|
2225
|
+
declare function HistoryEvent({ event, annotations, allEvents, isRelated, t, Link, routes, onEventRef, onEventClick, onEventHover, }: Props$5): React__default.JSX.Element;
|
|
2226
|
+
|
|
2227
|
+
/**
|
|
2228
|
+
* ResourceViewer - Display and interact with resource content and annotations
|
|
2229
|
+
*
|
|
2230
|
+
* Real-time updates arrive through the sdk, not through this component:
|
|
2231
|
+
* the client's BrowseNamespace invalidates the right resource's annotation
|
|
2232
|
+
* list on mark:added/mark:removed (payload-keyed) and patches
|
|
2233
|
+
* mark:body-updated in place, so the live queries feeding `annotations`
|
|
2234
|
+
* refresh on their own. The viewer subscribes only to `browse:click`
|
|
2235
|
+
* (annotation-click routing).
|
|
2236
|
+
*
|
|
2237
|
+
* Bring-your-own-session: the `session` (XynologSession) and the host's
|
|
2238
|
+
* navigation / panel callbacks come in as props — no XynologProvider required.
|
|
2239
|
+
* Every event it subscribes to is session-scoped and reaches it on
|
|
2240
|
+
* `session.client`. Its language is a required prop, a `locale` or the host's
|
|
2241
|
+
* `translationManager`: react-ui assumes none, and the viewer mounts its own
|
|
2242
|
+
* TranslationProvider from it. Caching flows through `session.client.browse.*`.
|
|
2243
|
+
*
|
|
2244
|
+
* Event flow:
|
|
2245
|
+
* Archivist → event log → SSE → EventBus → sdk cache invalidation → live queries
|
|
2246
|
+
*/
|
|
2247
|
+
interface Props$4 {
|
|
2248
|
+
resource: ResourceDescriptor & {
|
|
2249
|
+
content: string;
|
|
2250
|
+
};
|
|
2251
|
+
annotations: AnnotationsCollection;
|
|
2252
|
+
/** Session for the shown resource — its client mutates/invalidates, its bus feeds annotation events. */
|
|
2253
|
+
session: XynologSession | null;
|
|
2254
|
+
/** Host-owned navigation: a resolved reference was followed. Omit for a view with no follow behavior. */
|
|
2255
|
+
onOpenResource?: (resourceId: ResourceId) => void;
|
|
2256
|
+
/** Host-owned panel control (annotation clicks open a panel). Omit for hosts without side panels. */
|
|
2257
|
+
onOpenPanel?: (event: EventMap['panel:open']) => void;
|
|
2258
|
+
/** A content link in the rendered content was clicked — the viewer preventDefaults and delegates; it never navigates on its own. */
|
|
2259
|
+
onLinkClick?: (link: {
|
|
2260
|
+
href: string;
|
|
2261
|
+
event: React__default.MouseEvent;
|
|
2262
|
+
}) => void;
|
|
2263
|
+
/** A resolved reference span is hovered (after dwell + referent descriptor resolve); `null` on leave. Host renders its own preview. */
|
|
2264
|
+
onReferenceHover?: (hover: ReferenceHover | null) => void;
|
|
2265
|
+
/** Inline display variant: auto-height, no inner scroll, no pane chrome (browse path). Default: fill-the-pane. */
|
|
2266
|
+
inline?: boolean;
|
|
2267
|
+
/** Recently-created annotation ids to sparkle (threaded to the browse/annotate subtree). */
|
|
2268
|
+
sparkleAnnotationIds?: Set<string>;
|
|
2269
|
+
generatingReferenceId?: string | null;
|
|
2270
|
+
showLineNumbers?: boolean;
|
|
2271
|
+
hoverDelayMs?: number;
|
|
2272
|
+
hoveredAnnotationId?: string | null;
|
|
2273
|
+
/** Zoom the resource content without scaling surrounding viewer controls. */
|
|
2274
|
+
zoom?: number;
|
|
2275
|
+
/**
|
|
2276
|
+
* Toolbar preferences as controlled props. Supply a value to own that pref: the
|
|
2277
|
+
* instance renders it and reports intents via the callback — it never
|
|
2278
|
+
* self-mutates, never persists, never listens to other instances. Omit for a
|
|
2279
|
+
* plain uncontrolled default (false / 'detail' / 'linking' / 'rectangle').
|
|
2280
|
+
* Hosts wanting the shared+persisted Browser UX compose `useToolbarPrefs()`.
|
|
2281
|
+
*/
|
|
2282
|
+
annotateMode?: boolean;
|
|
2283
|
+
onAnnotateModeChange?: (mode: boolean) => void;
|
|
2284
|
+
clickAction?: ClickAction;
|
|
2285
|
+
onClickActionChange?: (action: ClickAction) => void;
|
|
2286
|
+
selectionMotivation?: Motivation$2 | null;
|
|
2287
|
+
onSelectionMotivationChange?: (motivation: Motivation$2 | null) => void;
|
|
2288
|
+
shape?: ShapeType;
|
|
2289
|
+
onShapeChange?: (shape: ShapeType) => void;
|
|
2290
|
+
/**
|
|
2291
|
+
* Render the built-in AnnotateToolbar (default true). `false` → no bar at
|
|
2292
|
+
* any internal site (browse + every annotate render mode), while every seam
|
|
2293
|
+
* stays live: annotate-mode selection capture, image/pdf drawing,
|
|
2294
|
+
* `mark.request` emission, and the controlled props. Hosts that compose
|
|
2295
|
+
* their own controls from the controlled props get that opt-out as a
|
|
2296
|
+
* contract instead of a CSS override.
|
|
2297
|
+
*/
|
|
2298
|
+
showToolbar?: boolean;
|
|
2299
|
+
/**
|
|
2300
|
+
* Override the read-only / annotating media renderers respectively; each is
|
|
2301
|
+
* merged over its defaults by the view below.
|
|
2302
|
+
*
|
|
2303
|
+
* Two flat props rather than one nested object: the registries are
|
|
2304
|
+
* separately typed (`MediaRendererProps` vs `AnnotateMediaRendererProps`)
|
|
2305
|
+
* and nesting them would imply an interchangeability that does not exist.
|
|
2306
|
+
*
|
|
2307
|
+
* Forwarding them is what makes the registries reachable at all for a host
|
|
2308
|
+
* that imports `ResourceViewer` — the documented entry point. Without it,
|
|
2309
|
+
* reaching `BrowseView`'s `renderers` means dropping to `BrowseView`
|
|
2310
|
+
* directly and reimplementing the browse/annotate switching this component
|
|
2311
|
+
* exists to provide.
|
|
2312
|
+
*/
|
|
2313
|
+
browseRenderers?: BrowseMediaRenderers;
|
|
2314
|
+
annotateRenderers?: AnnotateMediaRenderers;
|
|
2315
|
+
}
|
|
2316
|
+
/**
|
|
2317
|
+
* The viewer, given its language: it mounts the translation provider its own
|
|
2318
|
+
* subtree reads, and hands the same language to the view it renders.
|
|
2319
|
+
*/
|
|
2320
|
+
declare function ResourceViewer(props: Props$4 & TranslationSource): React__default.JSX.Element;
|
|
2321
|
+
|
|
2322
|
+
interface AssessmentEntryProps {
|
|
2323
|
+
/** Session for interaction routing (browse.click etc.); the panel threads it. */
|
|
2324
|
+
session: XynologSession | null;
|
|
2325
|
+
assessment: Annotation;
|
|
2326
|
+
isFocused: boolean;
|
|
2327
|
+
isHovered?: boolean;
|
|
2328
|
+
ref?: Ref<HTMLDivElement>;
|
|
2329
|
+
}
|
|
2330
|
+
/**
|
|
2331
|
+
* @emits browse:click - This entry clicked. Payload: { annotationId: string }
|
|
2332
|
+
*/
|
|
2333
|
+
declare function AssessmentEntry({ session, assessment, isFocused, isHovered, ref, }: AssessmentEntryProps): React$1.JSX.Element;
|
|
2334
|
+
|
|
2335
|
+
type JobProgress$7 = components['schemas']['JobProgress'];
|
|
2336
|
+
interface AssessmentPanelProps {
|
|
2337
|
+
/** Session carrying the client and event bus; null renders inert. */
|
|
2338
|
+
session: XynologSession | null;
|
|
2339
|
+
/** The resource's mark unit, which delegations, cancels and dismissals are asked of; undefined renders inert. */
|
|
2340
|
+
mark: MarkStateUnit | undefined;
|
|
2341
|
+
/** The '@id' of the panel's resource — stamped as `source` on mark:submit (multi-viewer routing). */
|
|
2342
|
+
resourceId: ResourceId;
|
|
2343
|
+
annotations: Annotation[];
|
|
2344
|
+
pendingAnnotation: PendingAnnotation | null;
|
|
2345
|
+
isDelegating?: boolean;
|
|
2346
|
+
progress?: JobProgress$7 | null;
|
|
2347
|
+
/**
|
|
2348
|
+
* The id of the delegated job (`mark.jobId$`): what the cancel control
|
|
2349
|
+
* names. Null until the queue has answered the job's creation and once the
|
|
2350
|
+
* job is over, and then there is no control.
|
|
2351
|
+
*/
|
|
2352
|
+
jobId: JobId | null;
|
|
2353
|
+
/**
|
|
2354
|
+
* The delegated job ended cancelled (`mark.failure$` holds a
|
|
2355
|
+
* `JobCancelledError`): its display stays, in its cancelled form.
|
|
2356
|
+
*/
|
|
2357
|
+
cancelled: boolean;
|
|
2358
|
+
locale?: string;
|
|
2359
|
+
/** BCP-47 tag of the resource being analyzed — forwarded to the delegated job. */
|
|
2360
|
+
sourceLanguage?: string;
|
|
2361
|
+
annotateMode?: boolean;
|
|
2362
|
+
scrollToAnnotationId?: string | null;
|
|
2363
|
+
onScrollCompleted?: () => void;
|
|
2364
|
+
hoveredAnnotationId?: string | null;
|
|
2365
|
+
}
|
|
2366
|
+
/**
|
|
2367
|
+
* Panel for managing assessment annotations with text input
|
|
2368
|
+
*
|
|
2369
|
+
* @emits mark:submit - Create new assessment annotation. Payload: MarkSubmitEvent with motivation 'assessing', and a TextualBody when there is text
|
|
2370
|
+
* @subscribes browse:click - Annotation clicked. Payload: { annotationId: string }
|
|
2371
|
+
*/
|
|
2372
|
+
declare function AssessmentPanel({ session, mark, resourceId, annotations, pendingAnnotation, isDelegating, progress, jobId, cancelled, locale, sourceLanguage, annotateMode, scrollToAnnotationId, onScrollCompleted, hoveredAnnotationId, }: AssessmentPanelProps): React$1.JSX.Element;
|
|
2373
|
+
|
|
2374
|
+
interface Props$3 {
|
|
2375
|
+
/**
|
|
2376
|
+
* The state of the client's connection to the bus, as its transport
|
|
2377
|
+
* reports it (`ConnectionState`, in `@xynolog/core`).
|
|
2378
|
+
*
|
|
2379
|
+
* UI mapping:
|
|
2380
|
+
* `open` | `reconnecting` | `initial` | `connecting`
|
|
2381
|
+
* → treated as "healthy" (green dot, "Live" label, event count visible).
|
|
2382
|
+
* `reconnecting` is specifically INCLUDED in healthy because a
|
|
2383
|
+
* quick blip shouldn't alarm the user: the first retry is
|
|
2384
|
+
* sub-second, which makes `reconnecting` a transient state.
|
|
2385
|
+
* `degraded` | `closed`
|
|
2386
|
+
* → treated as "disconnected" (red dot, "Disconnected" label).
|
|
2387
|
+
* `degraded` is the 3 s threshold at which the state machine
|
|
2388
|
+
* decides the disconnect is sustained; this is the UI-banner
|
|
2389
|
+
* trigger.
|
|
2390
|
+
*/
|
|
2391
|
+
state: ConnectionState;
|
|
2392
|
+
eventCount: number;
|
|
2393
|
+
lastEventTimestamp?: string;
|
|
2394
|
+
knowledgeBaseName?: string;
|
|
2395
|
+
/**
|
|
2396
|
+
* The KB's engines (`client.browse.engines()`, typically via
|
|
2397
|
+
* `useEngines`). Optional so hosts that never wire it — including
|
|
2398
|
+
* external consumers of this package — render without the engines section.
|
|
2399
|
+
*
|
|
2400
|
+
* Each entry's `limits` is absent whenever discovery could not answer *right
|
|
2401
|
+
* now*, so a missing ceiling is normal and shows as no ceiling rather than as
|
|
2402
|
+
* an error.
|
|
2403
|
+
*/
|
|
2404
|
+
engines?: EngineWithLimits[];
|
|
2405
|
+
}
|
|
2406
|
+
declare function CollaborationPanel({ state, eventCount, lastEventTimestamp, knowledgeBaseName, engines, }: Props$3): React$1.JSX.Element;
|
|
2407
|
+
|
|
2408
|
+
interface CommentEntryProps {
|
|
2409
|
+
/** Session for interaction routing (browse.click etc.); the panel threads it. */
|
|
2410
|
+
session: XynologSession | null;
|
|
2411
|
+
comment: Annotation;
|
|
2412
|
+
isFocused: boolean;
|
|
2413
|
+
isHovered?: boolean;
|
|
2414
|
+
annotateMode?: boolean;
|
|
2415
|
+
ref?: Ref<HTMLDivElement>;
|
|
2416
|
+
}
|
|
2417
|
+
/**
|
|
2418
|
+
* @emits browse:click - This entry clicked. Payload: { annotationId: string }
|
|
2419
|
+
* @emits bind:update-body - Save an edit: replace the comment body item with one holding the edited text. Payload: BindUpdateBodyCommand
|
|
2420
|
+
*/
|
|
2421
|
+
declare function CommentEntry({ session, comment, isFocused, isHovered, annotateMode, ref, }: CommentEntryProps): React$1.JSX.Element;
|
|
2422
|
+
|
|
2423
|
+
type JobProgress$6 = components['schemas']['JobProgress'];
|
|
2424
|
+
interface CommentsPanelProps {
|
|
2425
|
+
/** Session carrying the client and event bus; null renders inert. */
|
|
2426
|
+
session: XynologSession | null;
|
|
2427
|
+
/** The resource's mark unit, which delegations, cancels and dismissals are asked of; undefined renders inert. */
|
|
2428
|
+
mark: MarkStateUnit | undefined;
|
|
2429
|
+
/** The '@id' of the panel's resource — stamped as `source` on mark:submit (multi-viewer routing). */
|
|
2430
|
+
resourceId: ResourceId;
|
|
2431
|
+
annotations: Annotation[];
|
|
2432
|
+
pendingAnnotation: PendingAnnotation | null;
|
|
2433
|
+
annotateMode?: boolean;
|
|
2434
|
+
isDelegating?: boolean;
|
|
2435
|
+
progress?: JobProgress$6 | null;
|
|
2436
|
+
/**
|
|
2437
|
+
* The id of the delegated job (`mark.jobId$`): what the cancel control
|
|
2438
|
+
* names. Null until the queue has answered the job's creation and once the
|
|
2439
|
+
* job is over, and then there is no control.
|
|
2440
|
+
*/
|
|
2441
|
+
jobId: JobId | null;
|
|
2442
|
+
/**
|
|
2443
|
+
* The delegated job ended cancelled (`mark.failure$` holds a
|
|
2444
|
+
* `JobCancelledError`): its display stays, in its cancelled form.
|
|
2445
|
+
*/
|
|
2446
|
+
cancelled: boolean;
|
|
2447
|
+
locale?: string;
|
|
2448
|
+
/** BCP-47 tag of the resource being analyzed — forwarded to the delegated job. */
|
|
2449
|
+
sourceLanguage?: string;
|
|
2450
|
+
scrollToAnnotationId?: string | null;
|
|
2451
|
+
onScrollCompleted?: () => void;
|
|
2452
|
+
hoveredAnnotationId?: string | null;
|
|
2453
|
+
}
|
|
2454
|
+
/**
|
|
2455
|
+
* Panel for managing comment annotations with text input
|
|
2456
|
+
*
|
|
2457
|
+
* @emits mark:submit - Create new comment annotation. Payload: MarkSubmitEvent with motivation 'commenting' and the comment as a TextualBody
|
|
2458
|
+
* @subscribes browse:click - Annotation clicked. Payload: { annotationId: string }
|
|
2459
|
+
*/
|
|
2460
|
+
declare function CommentsPanel({ session, mark, resourceId, annotations, pendingAnnotation, annotateMode, isDelegating, progress, jobId, cancelled, locale, sourceLanguage, scrollToAnnotationId, onScrollCompleted, hoveredAnnotationId, }: CommentsPanelProps): React$1.JSX.Element;
|
|
2461
|
+
|
|
2462
|
+
type JobProgress$5 = components['schemas']['JobProgress'];
|
|
2463
|
+
/** `Part` itself, held to `Whole`: a member of `Part` that is no member of `Whole` does not compile. */
|
|
2464
|
+
type Subset<Whole, Part extends Whole> = Part;
|
|
2465
|
+
interface DelegateSectionProps {
|
|
2466
|
+
/** Session carrying the client and event bus; null renders inert. */
|
|
2467
|
+
session: XynologSession | null;
|
|
2468
|
+
/** The resource's mark unit, which delegations, cancels and dismissals are asked of; undefined renders inert. */
|
|
2469
|
+
mark: MarkStateUnit | undefined;
|
|
2470
|
+
annotationType: Subset<AnnotatorKey, 'highlight' | 'assessment' | 'comment'>;
|
|
2471
|
+
isDelegating: boolean;
|
|
2472
|
+
/** User UI locale — written into the annotation body's `language` field for comment/assessment. */
|
|
2473
|
+
locale?: string;
|
|
2474
|
+
/** BCP-47 tag of the resource being analyzed. Forwarded to the prompt so the LLM analyzes non-English source correctly. */
|
|
2475
|
+
sourceLanguage?: string;
|
|
2476
|
+
progress?: JobProgress$5 | null | undefined;
|
|
2477
|
+
/** The id of the delegated job: what the cancel control names. Null until the queue has named it. */
|
|
2478
|
+
jobId: JobId | null;
|
|
2479
|
+
/** The delegated job ended cancelled: its display stays, in its cancelled form. */
|
|
2480
|
+
cancelled: boolean;
|
|
2481
|
+
}
|
|
2482
|
+
/**
|
|
2483
|
+
* The delegate form for the text motivations (highlight, assessment, comment):
|
|
2484
|
+
* instructions, tone (comment/assessment), density — composed into the shared
|
|
2485
|
+
* DelegateShell chrome. Reference and tag panels compose the same shell with
|
|
2486
|
+
* their own fields (entity chips; schema + categories).
|
|
2487
|
+
*/
|
|
2488
|
+
declare function DelegateSection({ session, mark, annotationType, isDelegating, locale, sourceLanguage, progress, jobId, cancelled, }: DelegateSectionProps): React$1.JSX.Element;
|
|
2489
|
+
|
|
2490
|
+
interface HighlightEntryProps {
|
|
2491
|
+
/** Session for interaction routing (browse.click etc.); the panel threads it. */
|
|
2492
|
+
session: XynologSession | null;
|
|
2493
|
+
highlight: Annotation;
|
|
2494
|
+
isFocused: boolean;
|
|
2495
|
+
isHovered?: boolean;
|
|
2496
|
+
ref?: Ref<HTMLDivElement>;
|
|
2497
|
+
}
|
|
2498
|
+
/**
|
|
2499
|
+
* @emits browse:click - This entry clicked. Payload: { annotationId: string }
|
|
2500
|
+
*/
|
|
2501
|
+
declare function HighlightEntry({ session, highlight, isFocused, isHovered, ref, }: HighlightEntryProps): React$1.JSX.Element;
|
|
2502
|
+
|
|
2503
|
+
type JobProgress$4 = components['schemas']['JobProgress'];
|
|
2504
|
+
interface HighlightPanelProps {
|
|
2505
|
+
/** Session carrying the client and event bus; null renders inert. */
|
|
2506
|
+
session: XynologSession | null;
|
|
2507
|
+
/** The resource's mark unit, which delegations, cancels and dismissals are asked of; undefined renders inert. */
|
|
2508
|
+
mark: MarkStateUnit | undefined;
|
|
2509
|
+
/** The '@id' of the panel's resource — stamped as `source` on mark:submit (multi-viewer routing). */
|
|
2510
|
+
resourceId: ResourceId;
|
|
2511
|
+
annotations: Annotation[];
|
|
2512
|
+
pendingAnnotation: PendingAnnotation | null;
|
|
2513
|
+
isDelegating?: boolean;
|
|
2514
|
+
progress?: JobProgress$4 | null;
|
|
2515
|
+
/**
|
|
2516
|
+
* The id of the delegated job (`mark.jobId$`): what the cancel control
|
|
2517
|
+
* names. Null until the queue has answered the job's creation and once the
|
|
2518
|
+
* job is over, and then there is no control.
|
|
2519
|
+
*/
|
|
2520
|
+
jobId: JobId | null;
|
|
2521
|
+
/**
|
|
2522
|
+
* The delegated job ended cancelled (`mark.failure$` holds a
|
|
2523
|
+
* `JobCancelledError`): its display stays, in its cancelled form.
|
|
2524
|
+
*/
|
|
2525
|
+
cancelled: boolean;
|
|
2526
|
+
annotateMode?: boolean;
|
|
2527
|
+
scrollToAnnotationId?: string | null;
|
|
2528
|
+
onScrollCompleted?: () => void;
|
|
2529
|
+
hoveredAnnotationId?: string | null;
|
|
2530
|
+
/** BCP-47 tag of the resource being analyzed — forwarded to the delegated job so the LLM analyzes non-English source correctly. */
|
|
2531
|
+
sourceLanguage?: string;
|
|
2532
|
+
}
|
|
2533
|
+
/**
|
|
2534
|
+
* Panel for managing highlight annotations with auto-creation
|
|
2535
|
+
*
|
|
2536
|
+
* @emits mark:submit - Create new highlight annotation (auto-triggered). Payload: MarkSubmitEvent with motivation 'highlighting' and no body
|
|
2537
|
+
* @subscribes browse:click - Annotation clicked. Payload: { annotationId: string }
|
|
2538
|
+
*/
|
|
2539
|
+
declare function HighlightPanel({ session, mark, resourceId, annotations, pendingAnnotation, isDelegating, progress, jobId, cancelled, annotateMode, scrollToAnnotationId, onScrollCompleted, hoveredAnnotationId, sourceLanguage, }: HighlightPanelProps): React$1.JSX.Element;
|
|
2540
|
+
|
|
2541
|
+
interface Props$2 {
|
|
2542
|
+
resourceId: ResourceId;
|
|
2543
|
+
}
|
|
2544
|
+
/**
|
|
2545
|
+
* Dereferences the resource's LD face (`GET /resources/:id/jsonld` via
|
|
2546
|
+
* `browse.resourceGraph`) and pretty-prints the full graph — descriptor +
|
|
2547
|
+
* annotations — read-only. This is exactly what
|
|
2548
|
+
* an external linked-data client gets when dereferencing the resource's
|
|
2549
|
+
* `describedby` URI, so the panel doubles as a living end-to-end test of the
|
|
2550
|
+
* LD face.
|
|
2551
|
+
*/
|
|
2552
|
+
declare function JsonLdPanel({ resourceId }: Props$2): React$1.JSX.Element;
|
|
2553
|
+
|
|
2554
|
+
interface PanelHeaderProps {
|
|
2555
|
+
count: number;
|
|
2556
|
+
title: string;
|
|
2557
|
+
}
|
|
2558
|
+
/**
|
|
2559
|
+
* Shared header for annotation panels
|
|
2560
|
+
*
|
|
2561
|
+
* Displays the translated title and the count in a consistent format
|
|
2562
|
+
*/
|
|
2563
|
+
declare function PanelHeader({ count, title }: PanelHeaderProps): React$1.JSX.Element;
|
|
2564
|
+
|
|
2565
|
+
interface ReferenceEntryProps {
|
|
2566
|
+
/** Session for interaction routing (browse.click etc.); the panel threads it. */
|
|
2567
|
+
session: XynologSession | null;
|
|
2568
|
+
reference: Annotation;
|
|
2569
|
+
isFocused: boolean;
|
|
2570
|
+
isHovered?: boolean;
|
|
2571
|
+
/** Host-owned navigation: called with the resolved resource id when the entry's link opens. */
|
|
2572
|
+
onOpenResource?: (resourceId: ResourceId) => void;
|
|
2573
|
+
annotateMode?: boolean;
|
|
2574
|
+
isGenerating?: boolean;
|
|
2575
|
+
/** The reference just got attention-worthy (created or resolved) — glow the icon, like its document span. */
|
|
2576
|
+
sparkle?: boolean;
|
|
2577
|
+
ref?: Ref<HTMLDivElement>;
|
|
2578
|
+
}
|
|
2579
|
+
/**
|
|
2580
|
+
* @emits browse:click - This entry clicked. Payload: { annotationId: string }
|
|
2581
|
+
* @emits bind:initiate - Start resolving this reference. Payload: BindInitiateCommand
|
|
2582
|
+
* @emits bind:update-body - Unlink this reference from the resource it resolves to. Payload: BindUpdateBodyCommand
|
|
2583
|
+
* @emits bind:body-error - Report an unlink that was refused. Payload: { resourceId: string, message: string }
|
|
2584
|
+
*/
|
|
2585
|
+
declare function ReferenceEntry({ session, reference, isFocused, isHovered, onOpenResource, annotateMode, isGenerating, sparkle, ref, }: ReferenceEntryProps): React$1.JSX.Element;
|
|
2586
|
+
|
|
2587
|
+
type JobProgress$3 = components['schemas']['JobProgress'];
|
|
2588
|
+
|
|
2589
|
+
type ReferencedBy = components['schemas']['GetReferencedByResponse']['referencedBy'][number];
|
|
2590
|
+
interface Props$1 {
|
|
2591
|
+
/** Session carrying the client and event bus; null renders inert. */
|
|
2592
|
+
session: XynologSession | null;
|
|
2593
|
+
/** The resource's mark unit, which delegations, cancels and dismissals are asked of; undefined renders inert. */
|
|
2594
|
+
mark: MarkStateUnit | undefined;
|
|
2595
|
+
/** Host-owned navigation: called with the resolved resource id when a reference entry opens. */
|
|
2596
|
+
onOpenResource?: (resourceId: ResourceId) => void;
|
|
2597
|
+
/** The '@id' of the panel's resource — stamped as `source` on mark:submit (multi-viewer routing). */
|
|
2598
|
+
resourceId: ResourceId;
|
|
2599
|
+
annotations?: Annotation[];
|
|
2600
|
+
isDelegating: boolean;
|
|
2601
|
+
progress: JobProgress$3 | null;
|
|
2602
|
+
/**
|
|
2603
|
+
* The id of the delegated job (`mark.jobId$`): what the cancel control
|
|
2604
|
+
* names. Null until the queue has answered the job's creation and once the
|
|
2605
|
+
* job is over, and then there is no control.
|
|
2606
|
+
*/
|
|
2607
|
+
jobId: JobId | null;
|
|
2608
|
+
/**
|
|
2609
|
+
* The delegated job ended cancelled (`mark.failure$` holds a
|
|
2610
|
+
* `JobCancelledError`): its display stays, in its cancelled form.
|
|
2611
|
+
*/
|
|
2612
|
+
cancelled: boolean;
|
|
2613
|
+
annotateMode?: boolean;
|
|
2614
|
+
Link: React__default.ComponentType<LinkComponentProps>;
|
|
2615
|
+
routes: RouteBuilder;
|
|
2616
|
+
allEntityTypes: string[];
|
|
2617
|
+
/**
|
|
2618
|
+
* The entity-type list failed to load. Without it the picker's empty branch
|
|
2619
|
+
* asserts "no entity types available" — a claim about the knowledge base
|
|
2620
|
+
* that a failed load cannot support.
|
|
2621
|
+
*/
|
|
2622
|
+
entityTypesError?: Error | null;
|
|
2623
|
+
generatingReferenceId?: string | null;
|
|
2624
|
+
referencedBy?: ReferencedBy[];
|
|
2625
|
+
referencedByLoading?: boolean;
|
|
2626
|
+
/**
|
|
2627
|
+
* The incoming-references load failed terminally (B15). Distinct from
|
|
2628
|
+
* `referencedByLoading` — without it a dead request is indistinguishable
|
|
2629
|
+
* from one still in flight, and the panel says "Loading..." forever.
|
|
2630
|
+
*/
|
|
2631
|
+
referencedByError?: Error | null;
|
|
2632
|
+
/** Retry the failed incoming-references load. */
|
|
2633
|
+
onRetryReferencedBy?: () => void;
|
|
2634
|
+
pendingAnnotation: PendingAnnotation | null;
|
|
2635
|
+
scrollToAnnotationId?: string | null;
|
|
2636
|
+
onScrollCompleted?: () => void;
|
|
2637
|
+
hoveredAnnotationId?: string | null;
|
|
2638
|
+
/** Annotations currently sparkling (recently created or resolved) — entries in the set glow their icon. */
|
|
2639
|
+
sparkleAnnotationIds?: Set<string>;
|
|
2640
|
+
/** User UI locale — stamped on the unresolved-reference body's `language` field. */
|
|
2641
|
+
locale?: string;
|
|
2642
|
+
/** BCP-47 tag of the resource being analyzed — fed into the prompt for source-aware analysis. */
|
|
2643
|
+
sourceLanguage?: string;
|
|
2644
|
+
}
|
|
2645
|
+
/**
|
|
2646
|
+
* Panel for managing reference annotations with entity type annotation
|
|
2647
|
+
*
|
|
2648
|
+
* @emits mark:submit - Create new reference annotation. Payload: MarkSubmitEvent with motivation 'linking', and the chosen entity types as a TextualBody when any are chosen
|
|
2649
|
+
* @subscribes browse:click - Annotation clicked. Payload: { annotationId: string }
|
|
2650
|
+
*/
|
|
2651
|
+
declare function ReferencesPanel({ session, mark, onOpenResource, resourceId, annotations, isDelegating, progress, jobId, cancelled, annotateMode, Link, routes, allEntityTypes, entityTypesError, generatingReferenceId, referencedBy, referencedByLoading, referencedByError, onRetryReferencedBy, pendingAnnotation, scrollToAnnotationId, onScrollCompleted, hoveredAnnotationId, sparkleAnnotationIds, locale, sourceLanguage, }: Props$1): React__default.JSX.Element;
|
|
2652
|
+
|
|
2653
|
+
type Agent = components['schemas']['Agent'];
|
|
2654
|
+
type JobProgress$2 = components['schemas']['JobProgress'];
|
|
2655
|
+
interface Props {
|
|
2656
|
+
/** Session carrying the client and event bus; null renders inert. */
|
|
2657
|
+
session: XynologSession | null;
|
|
2658
|
+
resourceId: ResourceId;
|
|
2659
|
+
documentEntityTypes: string[];
|
|
2660
|
+
documentLocale?: string | undefined;
|
|
2661
|
+
primaryMediaType?: string | undefined;
|
|
2662
|
+
primaryByteSize?: number | undefined;
|
|
2663
|
+
storageUri?: string | undefined;
|
|
2664
|
+
isArchived?: boolean;
|
|
2665
|
+
dateCreated?: string | undefined;
|
|
2666
|
+
dateModified?: string | undefined;
|
|
2667
|
+
wasAttributedTo?: Agent | Agent[] | undefined;
|
|
2668
|
+
wasDerivedFrom?: components['schemas']['ResourceDescriptor']['wasDerivedFrom'];
|
|
2669
|
+
generator?: Agent | Agent[] | undefined;
|
|
2670
|
+
/**
|
|
2671
|
+
* Open the resource-generate flow. UI-only — the SDK isn't involved in
|
|
2672
|
+
* *opening* the display (if collaborative gather ever lands, this graduates
|
|
2673
|
+
* to a verb). Omit to hide the Generate action.
|
|
2674
|
+
*/
|
|
2675
|
+
onGenerate?: () => void;
|
|
2676
|
+
/**
|
|
2677
|
+
* Generation lifecycle, page-held (`yield.isGenerating$` / `yield.progress$`
|
|
2678
|
+
* / `yield.outcome$`): this panel is generation's progress surface — the
|
|
2679
|
+
* run reports where it was started.
|
|
2680
|
+
*/
|
|
2681
|
+
isGenerating?: boolean;
|
|
2682
|
+
generationProgress?: JobProgress$2 | null;
|
|
2683
|
+
/**
|
|
2684
|
+
* The id of the generation job (`yield.jobId$`): what the cancel control
|
|
2685
|
+
* names. Null until the queue has answered the job's creation and once the
|
|
2686
|
+
* job is over, and then there is no control.
|
|
2687
|
+
*/
|
|
2688
|
+
generationJobId?: JobId | null;
|
|
2689
|
+
/** The finished run's result; the ended frame links it by name. */
|
|
2690
|
+
generationOutcome?: YieldJobDone | null;
|
|
2691
|
+
/**
|
|
2692
|
+
* The run ended cancelled (`yield.failure$` holds a `JobCancelledError`):
|
|
2693
|
+
* its display stays, in its cancelled form, until dismissed.
|
|
2694
|
+
*/
|
|
2695
|
+
generationCancelled?: boolean;
|
|
2696
|
+
/** Clear the finished display — wires `yield.dismissProgress()`. */
|
|
2697
|
+
onDismissProgress?: () => void;
|
|
2698
|
+
}
|
|
2699
|
+
/**
|
|
2700
|
+
* Panel for displaying resource metadata and management actions
|
|
2701
|
+
*
|
|
2702
|
+
* @emits yield:clone - Clone this resource
|
|
2703
|
+
* @emits mark:unarchive - Unarchive this resource
|
|
2704
|
+
* @emits mark:archive - Archive this resource
|
|
2705
|
+
* @emits browse:resource-open - Open a resource this panel links to, the generated one among them. Payload: { resourceId: string }
|
|
2706
|
+
*/
|
|
2707
|
+
declare function ResourceInfoPanel({ session, resourceId, documentEntityTypes, documentLocale, primaryMediaType, primaryByteSize, storageUri, isArchived, dateCreated, dateModified, wasAttributedTo, wasDerivedFrom, generator, onGenerate, isGenerating, generationProgress, generationJobId, generationOutcome, generationCancelled, onDismissProgress, }: Props): React$1.JSX.Element;
|
|
2708
|
+
|
|
2709
|
+
interface StatisticsPanelProps {
|
|
2710
|
+
highlights: Annotation[];
|
|
2711
|
+
comments: Annotation[];
|
|
2712
|
+
assessments: Annotation[];
|
|
2713
|
+
references: Annotation[];
|
|
2714
|
+
tags: Annotation[];
|
|
2715
|
+
}
|
|
2716
|
+
declare function StatisticsPanel({ highlights, comments, assessments, references, tags, }: StatisticsPanelProps): React$1.JSX.Element;
|
|
2717
|
+
|
|
2718
|
+
interface TagEntryProps {
|
|
2719
|
+
/** Session for interaction routing (browse.click, tag schemas); the panel threads it. */
|
|
2720
|
+
session: XynologSession | null;
|
|
2721
|
+
tag: Annotation;
|
|
2722
|
+
isFocused: boolean;
|
|
2723
|
+
isHovered?: boolean;
|
|
2724
|
+
ref?: Ref<HTMLDivElement>;
|
|
2725
|
+
}
|
|
2726
|
+
/**
|
|
2727
|
+
* @emits browse:click - This entry clicked. Payload: { annotationId: string }
|
|
2728
|
+
*/
|
|
2729
|
+
declare function TagEntry({ session, tag, isFocused, isHovered, ref, }: TagEntryProps): React$1.JSX.Element;
|
|
2730
|
+
|
|
2731
|
+
type JobProgress$1 = components['schemas']['JobProgress'];
|
|
2732
|
+
interface TaggingPanelProps {
|
|
2733
|
+
/** Session carrying the client and event bus; null renders inert. */
|
|
2734
|
+
session: XynologSession | null;
|
|
2735
|
+
/** The resource's mark unit, which delegations, cancels and dismissals are asked of; undefined renders inert. */
|
|
2736
|
+
mark: MarkStateUnit | undefined;
|
|
2737
|
+
/** The '@id' of the panel's resource — stamped as `source` on mark:submit (multi-viewer routing). */
|
|
2738
|
+
resourceId: ResourceId;
|
|
2739
|
+
annotations: Annotation[];
|
|
2740
|
+
annotateMode?: boolean;
|
|
2741
|
+
isDelegating?: boolean;
|
|
2742
|
+
progress?: JobProgress$1 | null;
|
|
2743
|
+
/**
|
|
2744
|
+
* The id of the delegated job (`mark.jobId$`): what the cancel control
|
|
2745
|
+
* names. Null until the queue has answered the job's creation and once the
|
|
2746
|
+
* job is over, and then there is no control.
|
|
2747
|
+
*/
|
|
2748
|
+
jobId: JobId | null;
|
|
2749
|
+
/**
|
|
2750
|
+
* The delegated job ended cancelled (`mark.failure$` holds a
|
|
2751
|
+
* `JobCancelledError`): its display stays, in its cancelled form.
|
|
2752
|
+
*/
|
|
2753
|
+
cancelled: boolean;
|
|
2754
|
+
pendingAnnotation: PendingAnnotation | null;
|
|
2755
|
+
scrollToAnnotationId?: string | null;
|
|
2756
|
+
onScrollCompleted?: () => void;
|
|
2757
|
+
hoveredAnnotationId?: string | null;
|
|
2758
|
+
/** User UI locale — stamped on the tagging body's `language` field. */
|
|
2759
|
+
locale?: string;
|
|
2760
|
+
/** BCP-47 tag of the resource being analyzed — fed into the prompt for source-aware analysis. */
|
|
2761
|
+
sourceLanguage?: string;
|
|
2762
|
+
}
|
|
2763
|
+
/**
|
|
2764
|
+
* Panel for managing tag annotations with schema-based annotation
|
|
2765
|
+
*
|
|
2766
|
+
* @emits mark:submit - Create new tag annotation. Payload: MarkSubmitEvent with motivation 'tagging' and two TextualBody items, the category and the schema's id
|
|
2767
|
+
* @subscribes browse:click - Annotation clicked. Payload: { annotationId: string }
|
|
2768
|
+
*/
|
|
2769
|
+
declare function TaggingPanel({ session, mark, resourceId, annotations, annotateMode, isDelegating, progress, jobId, cancelled, pendingAnnotation, scrollToAnnotationId, onScrollCompleted, hoveredAnnotationId, locale, sourceLanguage, }: TaggingPanelProps): React$1.JSX.Element;
|
|
2770
|
+
|
|
2771
|
+
type JobProgress = components['schemas']['JobProgress'];
|
|
2772
|
+
|
|
2773
|
+
type Motivation = components['schemas']['Motivation'];
|
|
2774
|
+
type TabKey = 'statistics' | AnnotatorKey;
|
|
2775
|
+
/**
|
|
2776
|
+
* The annotations side panel: a statistics tab plus one tab per annotator,
|
|
2777
|
+
* all fed from a single annotations array grouped internally by motivation.
|
|
2778
|
+
*/
|
|
2779
|
+
interface UnifiedAnnotationsPanelProps {
|
|
2780
|
+
/** Session carrying the client and event bus; null renders inert. */
|
|
2781
|
+
session: XynologSession | null;
|
|
2782
|
+
/** The resource's mark unit, which delegations, cancels and dismissals are asked of; undefined renders inert. */
|
|
2783
|
+
mark: MarkStateUnit | undefined;
|
|
2784
|
+
/** Host-owned navigation: called with the resolved resource id when a reference entry opens. */
|
|
2785
|
+
onOpenResource?: (resourceId: ResourceId) => void;
|
|
2786
|
+
annotations: Annotation[];
|
|
2787
|
+
/**
|
|
2788
|
+
* The annotations load failed terminally (B15). Every tab here derives from
|
|
2789
|
+
* the one `annotations` array, so without this the panel presents an empty
|
|
2790
|
+
* array as fact — "no highlights" for a resource that may be full of them.
|
|
2791
|
+
*/
|
|
2792
|
+
annotationsError?: Error | null;
|
|
2793
|
+
onRetryAnnotations?: () => void;
|
|
2794
|
+
annotators: Record<string, Annotator>;
|
|
2795
|
+
annotateMode?: boolean;
|
|
2796
|
+
delegatingMotivation?: Motivation | null;
|
|
2797
|
+
progress?: JobProgress | null;
|
|
2798
|
+
/**
|
|
2799
|
+
* The motivation the progress is of (`mark.progressMotivation$`): the panel
|
|
2800
|
+
* it goes to. It outlasts `delegatingMotivation`, which is null once the job
|
|
2801
|
+
* has ended, so the ended display stays where the run was until dismissed.
|
|
2802
|
+
*/
|
|
2803
|
+
progressMotivation?: Motivation | null;
|
|
2804
|
+
/** The id of the delegated job (`mark.jobId$`); it goes where the progress goes. */
|
|
2805
|
+
jobId?: JobId | null;
|
|
2806
|
+
/** The delegated job ended cancelled (`mark.failure$`); it goes where the progress goes. */
|
|
2807
|
+
cancelled?: boolean;
|
|
2808
|
+
pendingAnnotation: PendingAnnotation | null;
|
|
2809
|
+
allEntityTypes?: string[];
|
|
2810
|
+
generatingReferenceId?: string | null;
|
|
2811
|
+
referencedBy?: React__default.ComponentProps<typeof ReferencesPanel>['referencedBy'];
|
|
2812
|
+
referencedByLoading?: boolean;
|
|
2813
|
+
entityTypesError?: Error | null;
|
|
2814
|
+
referencedByError?: Error | null;
|
|
2815
|
+
onRetryReferencedBy?: () => void;
|
|
2816
|
+
/** Annotations currently sparkling (recently created or resolved); their reference entries glow. */
|
|
2817
|
+
sparkleAnnotationIds?: Set<string>;
|
|
2818
|
+
resourceId: ResourceId;
|
|
2819
|
+
initialTab?: TabKey;
|
|
2820
|
+
initialTabGeneration?: number;
|
|
2821
|
+
scrollToAnnotationId?: string | null;
|
|
2822
|
+
onScrollCompleted?: () => void;
|
|
2823
|
+
hoveredAnnotationId?: string | null;
|
|
2824
|
+
locale?: string;
|
|
2825
|
+
/**
|
|
2826
|
+
* BCP-47 tag of the resource being analyzed (source-resource locale).
|
|
2827
|
+
* Independent from `locale` — a German user can analyze a French source
|
|
2828
|
+
* and get German bodies back. Fed into detection prompts.
|
|
2829
|
+
*/
|
|
2830
|
+
sourceLanguage?: string;
|
|
2831
|
+
Link: React__default.ComponentType<LinkComponentProps>;
|
|
2832
|
+
routes: RouteBuilder;
|
|
2833
|
+
}
|
|
2834
|
+
declare function UnifiedAnnotationsPanel(props: UnifiedAnnotationsPanelProps): React__default.JSX.Element;
|
|
2835
|
+
|
|
2836
|
+
interface ImageViewerProps {
|
|
2837
|
+
imageUrl: string;
|
|
2838
|
+
mimeType: string;
|
|
2839
|
+
alt: string;
|
|
2840
|
+
}
|
|
2841
|
+
declare function ImageViewer({ imageUrl, alt }: ImageViewerProps): React$1.JSX.Element;
|
|
2842
|
+
|
|
2843
|
+
/**
|
|
2844
|
+
* The translation a framework-agnostic component is handed: a key of the
|
|
2845
|
+
* host's section for it, and the string. No such component interpolates.
|
|
2846
|
+
*/
|
|
2847
|
+
type TranslateFn = (key: string) => string;
|
|
2848
|
+
|
|
2849
|
+
interface NavigationMenuProps {
|
|
2850
|
+
Link: React__default.ComponentType<LinkComponentProps>;
|
|
2851
|
+
routes: Partial<RouteBuilder>;
|
|
2852
|
+
t: TranslateFn;
|
|
2853
|
+
brandingLink?: string;
|
|
2854
|
+
onItemClick?: () => void;
|
|
2855
|
+
className?: string;
|
|
2856
|
+
currentPath?: string;
|
|
2857
|
+
}
|
|
2858
|
+
declare function NavigationMenu({ Link, routes, t, onItemClick, className, currentPath, }: NavigationMenuProps): React__default.JSX.Element;
|
|
2859
|
+
|
|
2860
|
+
/**
|
|
2861
|
+
* Props for ObservableLink component
|
|
2862
|
+
*
|
|
2863
|
+
* Accepts any props that a standard anchor element accepts,
|
|
2864
|
+
* plus optional navigation metadata for event emission.
|
|
2865
|
+
*/
|
|
2866
|
+
interface ObservableLinkProps extends React__default.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
2867
|
+
/** The URL to navigate to */
|
|
2868
|
+
href: string;
|
|
2869
|
+
/** Optional label for the link (used in event metadata) */
|
|
2870
|
+
label?: string;
|
|
2871
|
+
/** Children to render inside the link */
|
|
2872
|
+
children: React__default.ReactNode;
|
|
2873
|
+
}
|
|
2874
|
+
/**
|
|
2875
|
+
* Link component that emits navigation events for observability
|
|
2876
|
+
*
|
|
2877
|
+
* Use this instead of Next.js <Link> when you want link clicks to be
|
|
2878
|
+
* observable through the NavigationEventBus. This is useful for:
|
|
2879
|
+
* - Analytics tracking
|
|
2880
|
+
* - State coordination before navigation
|
|
2881
|
+
* - Logging navigation flows
|
|
2882
|
+
*
|
|
2883
|
+
* The component emits 'nav:link-clicked' event before allowing
|
|
2884
|
+
* the browser to follow the link.
|
|
2885
|
+
*
|
|
2886
|
+
* @example
|
|
2887
|
+
* ```typescript
|
|
2888
|
+
* <ObservableLink
|
|
2889
|
+
* href="/know/discover"
|
|
2890
|
+
* label="Discover"
|
|
2891
|
+
* >
|
|
2892
|
+
* Discover Resources
|
|
2893
|
+
* </ObservableLink>
|
|
2894
|
+
* ```
|
|
2895
|
+
*
|
|
2896
|
+
* @example With Next.js Link integration
|
|
2897
|
+
* ```typescript
|
|
2898
|
+
* import Link from 'next/link';
|
|
2899
|
+
*
|
|
2900
|
+
* <Link href="/know/discover" legacyBehavior passHref>
|
|
2901
|
+
* <ObservableLink label="Discover">
|
|
2902
|
+
* Discover Resources
|
|
2903
|
+
* </ObservableLink>
|
|
2904
|
+
* </Link>
|
|
2905
|
+
* ```
|
|
2906
|
+
*
|
|
2907
|
+
* @emits nav:link-clicked - Link clicked by user. Payload: { href: string, label?: string }
|
|
2908
|
+
*/
|
|
2909
|
+
declare function ObservableLink({ href, label, onClick, children, ...anchorProps }: ObservableLinkProps): React__default.JSX.Element;
|
|
2910
|
+
|
|
2911
|
+
interface SimpleNavigationItem {
|
|
2912
|
+
name: string;
|
|
2913
|
+
href: string;
|
|
2914
|
+
icon: React__default.ComponentType<{
|
|
2915
|
+
className?: string;
|
|
2916
|
+
}>;
|
|
2917
|
+
description?: string;
|
|
2918
|
+
}
|
|
2919
|
+
interface SimpleNavigationProps {
|
|
2920
|
+
title: string;
|
|
2921
|
+
items: SimpleNavigationItem[];
|
|
2922
|
+
currentPath: string;
|
|
2923
|
+
Link: React__default.ComponentType<LinkComponentProps>;
|
|
2924
|
+
dropdownContent?: (onClose: () => void) => React__default.ReactNode;
|
|
2925
|
+
isCollapsed: boolean;
|
|
2926
|
+
icons: {
|
|
2927
|
+
chevronLeft: React__default.ComponentType<{
|
|
2928
|
+
className?: string;
|
|
2929
|
+
}>;
|
|
2930
|
+
bars: React__default.ComponentType<{
|
|
2931
|
+
className?: string;
|
|
2932
|
+
}>;
|
|
2933
|
+
};
|
|
2934
|
+
collapseSidebarLabel: string;
|
|
2935
|
+
expandSidebarLabel: string;
|
|
2936
|
+
}
|
|
2937
|
+
/**
|
|
2938
|
+
* Simple navigation component for Admin and Moderation modes.
|
|
2939
|
+
* Renders a section header with optional dropdown and static navigation tabs.
|
|
2940
|
+
*
|
|
2941
|
+
* @emits shell:sidebar-toggle - Toggle sidebar collapsed/expanded state. Payload: undefined
|
|
2942
|
+
*/
|
|
2943
|
+
declare function SimpleNavigation({ title, items, currentPath, Link, dropdownContent, isCollapsed, icons, collapseSidebarLabel, expandSidebarLabel, }: SimpleNavigationProps): React__default.JSX.Element;
|
|
2944
|
+
|
|
2945
|
+
/**
|
|
2946
|
+
* Props for the sortable resource tab component
|
|
2947
|
+
*/
|
|
2948
|
+
interface SortableResourceTabProps {
|
|
2949
|
+
resource: OpenResource;
|
|
2950
|
+
isCollapsed: boolean;
|
|
2951
|
+
isActive: boolean;
|
|
2952
|
+
href: string;
|
|
2953
|
+
onClose: (id: ResourceId, e: React.MouseEvent) => void;
|
|
2954
|
+
onReorder?: (resourceId: ResourceId, direction: 'up' | 'down') => void;
|
|
2955
|
+
index?: number;
|
|
2956
|
+
totalCount?: number;
|
|
2957
|
+
Link: ComponentType<LinkComponentProps>;
|
|
2958
|
+
isDragging?: boolean;
|
|
2959
|
+
translations: {
|
|
2960
|
+
dragToReorder?: string;
|
|
2961
|
+
dragToReorderDoc?: string;
|
|
2962
|
+
closeResource: string;
|
|
2963
|
+
moveUp?: string;
|
|
2964
|
+
moveDown?: string;
|
|
2965
|
+
};
|
|
2966
|
+
}
|
|
2967
|
+
/**
|
|
2968
|
+
* Props for the collapsible resource navigation component
|
|
2969
|
+
*/
|
|
2970
|
+
interface CollapsibleResourceNavigationProps {
|
|
2971
|
+
fixedItems: Array<{
|
|
2972
|
+
name: string;
|
|
2973
|
+
href: string;
|
|
2974
|
+
icon: ComponentType<{
|
|
2975
|
+
className?: string;
|
|
2976
|
+
}>;
|
|
2977
|
+
description?: string;
|
|
2978
|
+
}>;
|
|
2979
|
+
resources: OpenResource[];
|
|
2980
|
+
isCollapsed: boolean;
|
|
2981
|
+
currentPath: string;
|
|
2982
|
+
Link: ComponentType<LinkComponentProps>;
|
|
2983
|
+
onNavigate?: (path: string) => void;
|
|
2984
|
+
getResourceHref: (resourceId: string) => string;
|
|
2985
|
+
className?: string;
|
|
2986
|
+
translations: {
|
|
2987
|
+
title?: string;
|
|
2988
|
+
collapseSidebar?: string;
|
|
2989
|
+
expandSidebar?: string;
|
|
2990
|
+
dragToReorder?: string;
|
|
2991
|
+
dragToReorderDoc?: string;
|
|
2992
|
+
closeResource?: string;
|
|
2993
|
+
dragInstructions?: string;
|
|
2994
|
+
};
|
|
2995
|
+
icons: {
|
|
2996
|
+
chevronLeft: ComponentType<{
|
|
2997
|
+
className?: string;
|
|
2998
|
+
}>;
|
|
2999
|
+
bars: ComponentType<{
|
|
3000
|
+
className?: string;
|
|
3001
|
+
}>;
|
|
3002
|
+
};
|
|
3003
|
+
navigationMenu?: ((onClose: () => void) => ReactNode) | undefined;
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
/**
|
|
3007
|
+
* A comprehensive collapsible navigation component with fixed items and dynamic resource tabs.
|
|
3008
|
+
* Supports drag and drop for resource reordering when expanded.
|
|
3009
|
+
* Platform-agnostic design for use across different React environments.
|
|
3010
|
+
*
|
|
3011
|
+
* @emits tabs:reorder - Resource tab reordered. Payload: { oldIndex: number, newIndex: number }
|
|
3012
|
+
* @emits tabs:close - Resource tab closed. Payload: { resourceId: ResourceId }
|
|
3013
|
+
* @emits shell:sidebar-toggle - Toggle sidebar collapsed/expanded state. Payload: undefined
|
|
3014
|
+
*/
|
|
3015
|
+
declare function CollapsibleResourceNavigation({ fixedItems, resources, isCollapsed, currentPath, Link, onNavigate, getResourceHref, className, translations, icons, navigationMenu, }: CollapsibleResourceNavigationProps): React__default.JSX.Element;
|
|
3016
|
+
|
|
3017
|
+
/**
|
|
3018
|
+
* A sortable tab for an open resource in the navigation sidebar.
|
|
3019
|
+
* Supports drag and drop when expanded, and compact icon-only view when collapsed.
|
|
3020
|
+
*/
|
|
3021
|
+
declare function SortableResourceTab({ resource, isCollapsed, isActive, href, onClose, onReorder, index, totalCount, Link, translations, isDragging, }: SortableResourceTabProps): React__default.JSX.Element;
|
|
3022
|
+
|
|
3023
|
+
/**
|
|
3024
|
+
* What this form fills in. Named here, but TYPED by the SDK.
|
|
3025
|
+
*
|
|
3026
|
+
* `storageUri` is on this list rather than a local `storagePath: string`
|
|
3027
|
+
* because a second name for the same thing is tied to nothing and diverges.
|
|
3028
|
+
* Under the job's own name, the page forwards the submitted config by spread,
|
|
3029
|
+
* so no field-by-field copy can drop one.
|
|
3030
|
+
*/
|
|
3031
|
+
type FormFilled = 'title' | 'storageUri' | 'language' | 'maxTokens' | 'outputMediaType';
|
|
3032
|
+
/**
|
|
3033
|
+
* The submitted payload: a `yield` job's own params (`GenerationJobParams`),
|
|
3034
|
+
* DERIVED rather than restated, the grounding context among them.
|
|
3035
|
+
*
|
|
3036
|
+
* A hand-written interface listing the same fields with independent types
|
|
3037
|
+
* would be a second copy of a shape the spec owns, and such a copy drifts:
|
|
3038
|
+
* every consumer re-maps it by hand and silently drops whatever the mapping
|
|
3039
|
+
* forgets. Deriving means a rename or retype in `GenerationJobParams` is a
|
|
3040
|
+
* compile error here instead of a quiet gap at the wire.
|
|
3041
|
+
*
|
|
3042
|
+
* NARROWED on purpose: the job also takes `task`, `structure` and `cite`,
|
|
3043
|
+
* which this form does not collect, and a payload type that advertised them
|
|
3044
|
+
* would promise more than the UI delivers. Surfacing one later is a one-word
|
|
3045
|
+
* edit to `FormFilled` plus its control — the door is unlocked, not open.
|
|
3046
|
+
*
|
|
3047
|
+
* `Required` because the form always fills these, even where the job lets
|
|
3048
|
+
* them be absent; `prompt` stays optional, because a blank instruction field
|
|
3049
|
+
* is omitted rather than sent empty.
|
|
3050
|
+
*/
|
|
3051
|
+
type GenerationConfig = Required<Pick<GenerationJobParams, FormFilled>> & Pick<GenerationJobParams, 'prompt' | 'temperature' | 'context'>;
|
|
3052
|
+
|
|
3053
|
+
interface ComposeParams$1 {
|
|
3054
|
+
name: string;
|
|
3055
|
+
/** Full file:// URI. */
|
|
3056
|
+
storagePath: string;
|
|
3057
|
+
content: string;
|
|
3058
|
+
entityTypes: string[];
|
|
3059
|
+
language: string;
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
interface ReferenceWizardModalProps {
|
|
3063
|
+
/**
|
|
3064
|
+
* The engine used for `yield` jobs, forwarded to ConfigureGenerationStep so
|
|
3065
|
+
* the max-length control is bounded by the model's real output ceiling.
|
|
3066
|
+
* Optional: absent means the default bounds, never an error.
|
|
3067
|
+
*/
|
|
3068
|
+
generationEngine?: EngineWithLimits;
|
|
3069
|
+
isOpen: boolean;
|
|
3070
|
+
onClose: () => void;
|
|
3071
|
+
/** The annotation being resolved */
|
|
3072
|
+
annotationId: AnnotationId | null;
|
|
3073
|
+
/** The resource containing the annotation */
|
|
3074
|
+
resourceId: ResourceId | null;
|
|
3075
|
+
/** Default title (selected text) */
|
|
3076
|
+
defaultTitle: string;
|
|
3077
|
+
/** Folder of the source resource, so new files land beside it. */
|
|
3078
|
+
defaultFolder?: string;
|
|
3079
|
+
/** Entity types from the annotation */
|
|
3080
|
+
entityTypes: string[];
|
|
3081
|
+
/**
|
|
3082
|
+
* The source resource's display name — a page fact (the wizard opens FROM
|
|
3083
|
+
* that resource), shown in the gather skeleton's source line before the
|
|
3084
|
+
* gathered context can say it itself.
|
|
3085
|
+
*/
|
|
3086
|
+
resourceName?: string;
|
|
3087
|
+
/** Current locale for generation defaults */
|
|
3088
|
+
locale: string;
|
|
3089
|
+
/** Gathered context state */
|
|
3090
|
+
context: GatheredContext | null;
|
|
3091
|
+
contextLoading: boolean;
|
|
3092
|
+
contextError: Error | null;
|
|
3093
|
+
/** Callbacks */
|
|
3094
|
+
onGenerateSubmit: (referenceId: AnnotationId, config: GenerationConfig) => void;
|
|
3095
|
+
onLinkResource: (referenceId: AnnotationId, targetResourceId: ResourceId) => void;
|
|
3096
|
+
/**
|
|
3097
|
+
* Create-and-link, inside the modal: the host runs `yield.resource` then
|
|
3098
|
+
* `bind.body` and settles the promise; rejection keeps the modal open with
|
|
3099
|
+
* the compose footer re-enabled.
|
|
3100
|
+
*/
|
|
3101
|
+
onComposeSubmit: (referenceId: AnnotationId, params: ComposeParams$1) => Promise<void>;
|
|
3102
|
+
/** Picker vocabulary for compose when the reference fixed no entity types. */
|
|
3103
|
+
entityTypeOptions?: string[];
|
|
3104
|
+
/** Editor hover delay for the compose step's CodeMirror. */
|
|
3105
|
+
hoverDelayMs?: number;
|
|
3106
|
+
/** Translation strings */
|
|
3107
|
+
translations: {
|
|
3108
|
+
/** The ONE title, all steps — the flow is resolving a reference; the
|
|
3109
|
+
strategy band below says where in it you are. */
|
|
3110
|
+
resolveTitle: string;
|
|
3111
|
+
sourceContextLabel: string;
|
|
3112
|
+
connectionsLabel: string;
|
|
3113
|
+
citedByLabel: string;
|
|
3114
|
+
graphPaneTitle: string;
|
|
3115
|
+
graphEmpty: string;
|
|
3116
|
+
resourceLinkLabel: string;
|
|
3117
|
+
corpusPaneTitle: string;
|
|
3118
|
+
corpusEmpty: string;
|
|
3119
|
+
excludedReceipt: string;
|
|
3120
|
+
machineRead: string;
|
|
3121
|
+
userHintLabel: string;
|
|
3122
|
+
userHintEffect: string;
|
|
3123
|
+
userHintPlaceholder: string;
|
|
3124
|
+
loadingContext: string;
|
|
3125
|
+
failedContext: string;
|
|
3126
|
+
search: string;
|
|
3127
|
+
searching: string;
|
|
3128
|
+
generate: string;
|
|
3129
|
+
compose: string;
|
|
3130
|
+
resolutionStrategyLabel: string;
|
|
3131
|
+
back: string;
|
|
3132
|
+
link: string;
|
|
3133
|
+
score: string;
|
|
3134
|
+
noResults: string;
|
|
3135
|
+
resourceTitle: string;
|
|
3136
|
+
resourceTitlePlaceholder: string;
|
|
3137
|
+
saveLocation: string;
|
|
3138
|
+
additionalInstructions: string;
|
|
3139
|
+
additionalInstructionsPlaceholder: string;
|
|
3140
|
+
language: string;
|
|
3141
|
+
languageHelp: string;
|
|
3142
|
+
creativity: string;
|
|
3143
|
+
creativityFocused: string;
|
|
3144
|
+
creativityCreative: string;
|
|
3145
|
+
maxLength: string;
|
|
3146
|
+
maxLengthHelp: string;
|
|
3147
|
+
maxLengthCeiling: string;
|
|
3148
|
+
outputFormat: string;
|
|
3149
|
+
formatExtensionMismatch: string;
|
|
3150
|
+
maxResults: string;
|
|
3151
|
+
semanticScoring: string;
|
|
3152
|
+
semanticScoringHelp: string;
|
|
3153
|
+
searchFailed: string;
|
|
3154
|
+
entityTypes: string;
|
|
3155
|
+
contentLabel: string;
|
|
3156
|
+
createAndLink: string;
|
|
3157
|
+
creatingAndLinking: string;
|
|
3158
|
+
discardDraftPrompt: string;
|
|
3159
|
+
discardDraft: string;
|
|
3160
|
+
keepEditing: string;
|
|
3161
|
+
};
|
|
3162
|
+
}
|
|
3163
|
+
declare function ReferenceWizardModal({ isOpen, onClose, annotationId, resourceId, defaultTitle, defaultFolder, entityTypes, resourceName, locale, context, contextLoading, contextError, onGenerateSubmit, onLinkResource, onComposeSubmit, entityTypeOptions, hoverDelayMs, translations: t, generationEngine, }: ReferenceWizardModalProps): React$1.JSX.Element;
|
|
3164
|
+
|
|
3165
|
+
interface ResourceGenerateModalTranslations {
|
|
3166
|
+
/** The ONE modal title — names the flow, not a step. */
|
|
3167
|
+
title: string;
|
|
3168
|
+
gatherIntro: string;
|
|
3169
|
+
includeContent: string;
|
|
3170
|
+
includeSummary: string;
|
|
3171
|
+
gatherDepth: string;
|
|
3172
|
+
gatherMaxResources: string;
|
|
3173
|
+
gatherButton: string;
|
|
3174
|
+
/** Labels the recall chips: every type included until deselected. */
|
|
3175
|
+
recallLabel: string;
|
|
3176
|
+
/** Affordance on the post-gather receipt row (title/tooltip). */
|
|
3177
|
+
editGather: string;
|
|
3178
|
+
loadingContext: string;
|
|
3179
|
+
failedContext: string;
|
|
3180
|
+
sourceContextLabel: string;
|
|
3181
|
+
connectionsLabel: string;
|
|
3182
|
+
citedByLabel: string;
|
|
3183
|
+
graphPaneTitle: string;
|
|
3184
|
+
graphEmpty: string;
|
|
3185
|
+
resourceLinkLabel: string;
|
|
3186
|
+
corpusPaneTitle: string;
|
|
3187
|
+
corpusEmpty: string;
|
|
3188
|
+
excludedReceipt: string;
|
|
3189
|
+
machineRead: string;
|
|
3190
|
+
score: string;
|
|
3191
|
+
resourceTitle: string;
|
|
3192
|
+
resourceTitlePlaceholder: string;
|
|
3193
|
+
saveLocation: string;
|
|
3194
|
+
additionalInstructions: string;
|
|
3195
|
+
additionalInstructionsPlaceholder: string;
|
|
3196
|
+
language: string;
|
|
3197
|
+
languageHelp: string;
|
|
3198
|
+
creativity: string;
|
|
3199
|
+
creativityFocused: string;
|
|
3200
|
+
creativityCreative: string;
|
|
3201
|
+
maxLength: string;
|
|
3202
|
+
maxLengthHelp: string;
|
|
3203
|
+
maxLengthCeiling: string;
|
|
3204
|
+
outputFormat: string;
|
|
3205
|
+
formatExtensionMismatch: string;
|
|
3206
|
+
generate: string;
|
|
3207
|
+
discardDraftPrompt: string;
|
|
3208
|
+
discardDraft: string;
|
|
3209
|
+
keepEditing: string;
|
|
3210
|
+
}
|
|
3211
|
+
interface ResourceGenerateModalProps {
|
|
3212
|
+
/**
|
|
3213
|
+
* The engine used for `yield` jobs, forwarded to ConfigureGenerationStep so
|
|
3214
|
+
* the max-length control is bounded by the model's real output ceiling.
|
|
3215
|
+
* Optional: absent means the default bounds, never an error.
|
|
3216
|
+
*/
|
|
3217
|
+
generationEngine?: EngineWithLimits;
|
|
3218
|
+
isOpen: boolean;
|
|
3219
|
+
onClose: () => void;
|
|
3220
|
+
resourceId: string;
|
|
3221
|
+
defaultTitle: string;
|
|
3222
|
+
/** Folder of the source resource, so the artifact lands beside it. */
|
|
3223
|
+
defaultFolder?: string;
|
|
3224
|
+
locale: string;
|
|
3225
|
+
/**
|
|
3226
|
+
* Entity types offered in the exclusion picker. Owner-supplied so the
|
|
3227
|
+
* modal cannot present a failed load as an empty vocabulary.
|
|
3228
|
+
*/
|
|
3229
|
+
entityTypeOptions?: string[];
|
|
3230
|
+
/**
|
|
3231
|
+
* Emit the chosen generation config. The parent runs the job
|
|
3232
|
+
* (`client.yield.delegate(…)`) — mirrors how the
|
|
3233
|
+
* annotation wizard delegates generation to its parent.
|
|
3234
|
+
*/
|
|
3235
|
+
onGenerateSubmit: (resourceId: string, config: GenerationConfig) => void;
|
|
3236
|
+
/**
|
|
3237
|
+
* Resource-gather state, verbatim from the SDK's gather unit slots
|
|
3238
|
+
* (`gather.resourceContext$` / `resourceLoading$` / `resourceError$`) — the
|
|
3239
|
+
* page reads the observables and threads them here, the same shape the
|
|
3240
|
+
* reference wizard takes. The modal renders this state; it never owns it.
|
|
3241
|
+
*/
|
|
3242
|
+
gatherContext: GatheredContext | null;
|
|
3243
|
+
gatherLoading: boolean;
|
|
3244
|
+
gatherError: Error | null;
|
|
3245
|
+
/**
|
|
3246
|
+
* Run the gather — the page wires `gather.gatherResource(resourceId, …)`.
|
|
3247
|
+
* No resourceId in the payload: the owner already holds it. `gatherResource`
|
|
3248
|
+
* clears its slots at start, so no reset threading is needed.
|
|
3249
|
+
*/
|
|
3250
|
+
onGather: (options: ResourceGatherOptions) => void;
|
|
3251
|
+
translations: ResourceGenerateModalTranslations;
|
|
3252
|
+
}
|
|
3253
|
+
/**
|
|
3254
|
+
* Resource-generate flow, opened by the Resource Info panel's Generate button:
|
|
3255
|
+
* one composite stack in a single scroll pane — the gather controls at the
|
|
3256
|
+
* top, the gathered `GatheredContext` below them once gather fires, and the
|
|
3257
|
+
* generation params beneath the evidence once context arrives. Re-gathering
|
|
3258
|
+
* is scroll-up → tweak → Gather; `gatherResource` clears its slots at start,
|
|
3259
|
+
* so the evidence refreshes in place. [gather zone] → [evidence] → [act
|
|
3260
|
+
* zone]: the same grammar the resolve wizard expresses, whose gather zone
|
|
3261
|
+
* happens to be automatic and whose act zone has a strategy choice.
|
|
3262
|
+
*/
|
|
3263
|
+
declare function ResourceGenerateModal({ isOpen, onClose, resourceId, defaultTitle, defaultFolder, locale, entityTypeOptions, onGenerateSubmit, gatherContext, gatherLoading, gatherError, onGather, translations: t, generationEngine, }: ResourceGenerateModalProps): React$1.JSX.Element;
|
|
3264
|
+
|
|
3265
|
+
interface SearchModalProps {
|
|
3266
|
+
isOpen: boolean;
|
|
3267
|
+
onClose: () => void;
|
|
3268
|
+
onNavigate: (type: 'resource' | 'entity', id: string) => void;
|
|
3269
|
+
/** Every string the modal shows; it has none of its own. */
|
|
3270
|
+
translations: {
|
|
3271
|
+
/** The dialog's name and its search box's, as assistive technology says them. */
|
|
3272
|
+
title: string;
|
|
3273
|
+
placeholder: string;
|
|
3274
|
+
searching: string;
|
|
3275
|
+
noResults: string;
|
|
3276
|
+
startTyping: string;
|
|
3277
|
+
navigate: string;
|
|
3278
|
+
select: string;
|
|
3279
|
+
close: string;
|
|
3280
|
+
enter: string;
|
|
3281
|
+
esc: string;
|
|
3282
|
+
};
|
|
3283
|
+
}
|
|
3284
|
+
declare function SearchModal({ isOpen, onClose, onNavigate, translations, }: SearchModalProps): React__default.JSX.Element;
|
|
3285
|
+
|
|
3286
|
+
/**
|
|
3287
|
+
* Skip link for keyboard navigation accessibility
|
|
3288
|
+
* The link is visually hidden but becomes visible when focused
|
|
3289
|
+
* It lets keyboard users jump past the page's chrome to its MainContent
|
|
3290
|
+
*/
|
|
3291
|
+
declare function SkipLinks(): React$1.JSX.Element;
|
|
3292
|
+
/**
|
|
3293
|
+
* The page's main landmark, and the element the skip link lands on.
|
|
3294
|
+
* `tabIndex={-1}` lets it take focus from the link without joining the tab order.
|
|
3295
|
+
*/
|
|
3296
|
+
declare function MainContent(props: Omit<ComponentProps<'main'>, 'id' | 'tabIndex'>): React$1.JSX.Element;
|
|
3297
|
+
|
|
3298
|
+
interface StatusDisplayProps {
|
|
3299
|
+
isFullyAuthenticated?: boolean;
|
|
3300
|
+
isAuthenticated?: boolean;
|
|
3301
|
+
hasValidGatewayToken?: boolean;
|
|
3302
|
+
}
|
|
3303
|
+
declare function StatusDisplay({ isFullyAuthenticated, isAuthenticated, hasValidGatewayToken, }: StatusDisplayProps): React$1.JSX.Element;
|
|
3304
|
+
|
|
3305
|
+
declare function SessionTimer(): React$1.JSX.Element | null;
|
|
3306
|
+
|
|
3307
|
+
declare function SessionExpiryBanner(): React$1.JSX.Element | null;
|
|
3308
|
+
|
|
3309
|
+
declare function UserMenuSkeleton(): React$1.JSX.Element;
|
|
3310
|
+
|
|
3311
|
+
interface XynologBrandingProps {
|
|
3312
|
+
t: TranslateFn;
|
|
3313
|
+
className?: string;
|
|
3314
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
3315
|
+
showTagline?: boolean;
|
|
3316
|
+
animated?: boolean;
|
|
3317
|
+
compactTagline?: boolean;
|
|
3318
|
+
}
|
|
3319
|
+
declare function XynologBranding({ t, className, size, showTagline, animated, compactTagline, }: XynologBrandingProps): React$1.JSX.Element;
|
|
3320
|
+
|
|
3321
|
+
interface UnifiedHeaderProps {
|
|
3322
|
+
Link: React__default.ComponentType<LinkComponentProps>;
|
|
3323
|
+
routes: RouteBuilder;
|
|
3324
|
+
t: TranslateFn;
|
|
3325
|
+
tHome: TranslateFn;
|
|
3326
|
+
showBranding?: boolean;
|
|
3327
|
+
brandingLink?: string;
|
|
3328
|
+
variant?: 'standalone' | 'embedded' | 'floating';
|
|
3329
|
+
isAuthenticated?: boolean;
|
|
3330
|
+
currentPath?: string;
|
|
3331
|
+
}
|
|
3332
|
+
declare function UnifiedHeader({ Link, routes, t, tHome, showBranding, brandingLink, variant, isAuthenticated, currentPath, }: UnifiedHeaderProps): React__default.JSX.Element;
|
|
3333
|
+
|
|
3334
|
+
interface NavigationMenuHelper {
|
|
3335
|
+
(onClose: () => void): React__default.ReactNode;
|
|
3336
|
+
}
|
|
3337
|
+
interface LeftSidebarProps {
|
|
3338
|
+
Link: React__default.ComponentType<LinkComponentProps>;
|
|
3339
|
+
routes: RouteBuilder;
|
|
3340
|
+
t: TranslateFn;
|
|
3341
|
+
tHome: TranslateFn;
|
|
3342
|
+
children: React__default.ReactNode | ((isCollapsed: boolean, toggleCollapsed: () => void, navigationMenu: NavigationMenuHelper) => React__default.ReactNode);
|
|
3343
|
+
brandingLink?: string;
|
|
3344
|
+
collapsible?: boolean;
|
|
3345
|
+
storageKey?: string;
|
|
3346
|
+
isAuthenticated?: boolean;
|
|
3347
|
+
currentPath?: string;
|
|
3348
|
+
}
|
|
3349
|
+
declare function LeftSidebar({ Link, routes, t, tHome, children, brandingLink, collapsible, storageKey, currentPath, }: LeftSidebarProps): React__default.JSX.Element;
|
|
3350
|
+
|
|
3351
|
+
interface PageLayoutProps {
|
|
3352
|
+
Link: React__default.ComponentType<LinkComponentProps>;
|
|
3353
|
+
routes: RouteBuilder;
|
|
3354
|
+
tNav: TranslateFn;
|
|
3355
|
+
tHome: TranslateFn;
|
|
3356
|
+
children: React__default.ReactNode;
|
|
3357
|
+
className?: string;
|
|
3358
|
+
}
|
|
3359
|
+
declare function PageLayout({ Link, routes, tNav, tHome, children, className, }: PageLayoutProps): React__default.JSX.Element;
|
|
3360
|
+
|
|
3361
|
+
/**
|
|
3362
|
+
* CSS-Agnostic Button Component
|
|
3363
|
+
*
|
|
3364
|
+
* This button uses data attributes instead of hardcoded Tailwind classes,
|
|
3365
|
+
* allowing users to style it with any CSS solution.
|
|
3366
|
+
*/
|
|
3367
|
+
|
|
3368
|
+
interface ButtonProps extends React__default.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3369
|
+
/**
|
|
3370
|
+
* Ref forwarded to the underlying button element
|
|
3371
|
+
*/
|
|
3372
|
+
ref?: React__default.Ref<HTMLButtonElement>;
|
|
3373
|
+
/**
|
|
3374
|
+
* The visual variant of the button
|
|
3375
|
+
*/
|
|
3376
|
+
variant?: 'primary' | 'secondary' | 'tertiary' | 'danger' | 'warning' | 'ghost';
|
|
3377
|
+
/**
|
|
3378
|
+
* The size of the button
|
|
3379
|
+
*/
|
|
3380
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3381
|
+
/**
|
|
3382
|
+
* Whether the button should take full width of its container
|
|
3383
|
+
*/
|
|
3384
|
+
fullWidth?: boolean;
|
|
3385
|
+
/**
|
|
3386
|
+
* Whether the button is in a loading state
|
|
3387
|
+
*/
|
|
3388
|
+
loading?: boolean;
|
|
3389
|
+
/**
|
|
3390
|
+
* Icon to display before the button text
|
|
3391
|
+
*/
|
|
3392
|
+
leftIcon?: React__default.ReactNode;
|
|
3393
|
+
/**
|
|
3394
|
+
* Icon to display after the button text
|
|
3395
|
+
*/
|
|
3396
|
+
rightIcon?: React__default.ReactNode;
|
|
3397
|
+
/**
|
|
3398
|
+
* Whether the button should only show an icon (no text padding)
|
|
3399
|
+
*/
|
|
3400
|
+
iconOnly?: boolean;
|
|
3401
|
+
/**
|
|
3402
|
+
* Whether to show the button in an active/pressed state
|
|
3403
|
+
*/
|
|
3404
|
+
active?: boolean;
|
|
3405
|
+
}
|
|
3406
|
+
declare function Button({ variant, size, fullWidth, loading, leftIcon, rightIcon, iconOnly, active, className, disabled, children, type, ref, ...props }: ButtonProps): React__default.JSX.Element;
|
|
3407
|
+
/**
|
|
3408
|
+
* Button Group Component
|
|
3409
|
+
*
|
|
3410
|
+
* Groups multiple buttons together
|
|
3411
|
+
*/
|
|
3412
|
+
interface ButtonGroupProps {
|
|
3413
|
+
children: React__default.ReactNode;
|
|
3414
|
+
/**
|
|
3415
|
+
* How to arrange the buttons
|
|
3416
|
+
*/
|
|
3417
|
+
orientation?: 'horizontal' | 'vertical';
|
|
3418
|
+
/**
|
|
3419
|
+
* Whether buttons should be connected (no gap between them)
|
|
3420
|
+
*/
|
|
3421
|
+
attached?: boolean;
|
|
3422
|
+
/**
|
|
3423
|
+
* Size of the gap between buttons (when not attached)
|
|
3424
|
+
*/
|
|
3425
|
+
spacing?: 'xs' | 'sm' | 'md' | 'lg';
|
|
3426
|
+
className?: string;
|
|
3427
|
+
}
|
|
3428
|
+
declare const ButtonGroup: React__default.FC<ButtonGroupProps>;
|
|
3429
|
+
|
|
3430
|
+
/**
|
|
3431
|
+
* ComposeLoadingState Component
|
|
3432
|
+
*
|
|
3433
|
+
* Simple loading state display for the compose page.
|
|
3434
|
+
*/
|
|
3435
|
+
interface ComposeLoadingStateProps {
|
|
3436
|
+
message: string;
|
|
3437
|
+
}
|
|
3438
|
+
declare function ComposeLoadingState({ message }: ComposeLoadingStateProps): React$1.JSX.Element;
|
|
3439
|
+
|
|
3440
|
+
/**
|
|
3441
|
+
* ResourceLoadingState - Loading state component for resource viewer
|
|
3442
|
+
*
|
|
3443
|
+
* Pure React component - no Next.js dependencies.
|
|
3444
|
+
*/
|
|
3445
|
+
declare function ResourceLoadingState(): React$1.JSX.Element;
|
|
3446
|
+
|
|
3447
|
+
/**
|
|
3448
|
+
* ResourceErrorState - Error state component for resource viewer
|
|
3449
|
+
*
|
|
3450
|
+
* Pure React component - no Next.js dependencies.
|
|
3451
|
+
*/
|
|
3452
|
+
interface ResourceErrorStateProps {
|
|
3453
|
+
error: unknown;
|
|
3454
|
+
onRetry: () => void;
|
|
3455
|
+
}
|
|
3456
|
+
declare function ResourceErrorState({ error, onRetry, }: ResourceErrorStateProps): React$1.JSX.Element;
|
|
3457
|
+
|
|
3458
|
+
/**
|
|
3459
|
+
* AuthErrorDisplay - Pure React component for displaying authentication errors
|
|
3460
|
+
*
|
|
3461
|
+
* No Next.js dependencies - receives error type and translations via props.
|
|
3462
|
+
*/
|
|
3463
|
+
|
|
3464
|
+
interface AuthErrorDisplayProps {
|
|
3465
|
+
/**
|
|
3466
|
+
* Link component for routing - passed from parent
|
|
3467
|
+
*/
|
|
3468
|
+
Link: React__default.ComponentType<LinkComponentProps>;
|
|
3469
|
+
/**
|
|
3470
|
+
* Error type from URL parameter
|
|
3471
|
+
*/
|
|
3472
|
+
errorType: string | null;
|
|
3473
|
+
/**
|
|
3474
|
+
* Translation strings
|
|
3475
|
+
*/
|
|
3476
|
+
translations: {
|
|
3477
|
+
pageTitle: string;
|
|
3478
|
+
tryAgain: string;
|
|
3479
|
+
errorConfiguration: string;
|
|
3480
|
+
errorAccessDenied: string;
|
|
3481
|
+
errorVerification: string;
|
|
3482
|
+
errorGeneric: string;
|
|
3483
|
+
};
|
|
3484
|
+
}
|
|
3485
|
+
/**
|
|
3486
|
+
* AuthErrorDisplay component
|
|
3487
|
+
*
|
|
3488
|
+
* Displays authentication error messages with a link to try again.
|
|
3489
|
+
*/
|
|
3490
|
+
declare function AuthErrorDisplay({ errorType, Link, translations: t, }: AuthErrorDisplayProps): React__default.JSX.Element;
|
|
3491
|
+
|
|
3492
|
+
/**
|
|
3493
|
+
* EntityTagsPage Component
|
|
3494
|
+
*
|
|
3495
|
+
* Pure React component for managing entity tags.
|
|
3496
|
+
* All dependencies passed as props - no Next.js hooks!
|
|
3497
|
+
*/
|
|
3498
|
+
|
|
3499
|
+
interface EntityTagsPageProps {
|
|
3500
|
+
entityTypes: string[];
|
|
3501
|
+
isLoading: boolean;
|
|
3502
|
+
error: string;
|
|
3503
|
+
newTag: string;
|
|
3504
|
+
onNewTagChange: (value: string) => void;
|
|
3505
|
+
onAddTag: () => void;
|
|
3506
|
+
isAddingTag: boolean;
|
|
3507
|
+
theme: Theme;
|
|
3508
|
+
activePanel: ToolbarPanelType | null;
|
|
3509
|
+
translations: {
|
|
3510
|
+
pageTitle: string;
|
|
3511
|
+
pageDescription: string;
|
|
3512
|
+
sectionTitle: string;
|
|
3513
|
+
sectionDescription: string;
|
|
3514
|
+
inputPlaceholder: string;
|
|
3515
|
+
addTag: string;
|
|
3516
|
+
adding: string;
|
|
3517
|
+
};
|
|
3518
|
+
ToolbarPanels: React__default.ComponentType<ToolbarPanelsProps>;
|
|
3519
|
+
Toolbar: React__default.ComponentType<ToolbarProps<ToolbarPanelType>>;
|
|
3520
|
+
}
|
|
3521
|
+
declare function EntityTagsPage({ entityTypes, error, newTag, onNewTagChange, onAddTag, isAddingTag, theme, activePanel, translations: t, ToolbarPanels, Toolbar, }: EntityTagsPageProps): React__default.JSX.Element;
|
|
3522
|
+
|
|
3523
|
+
/**
|
|
3524
|
+
* RecentDocumentsPage Component
|
|
3525
|
+
*
|
|
3526
|
+
* Pure React component for viewing recent documents.
|
|
3527
|
+
* All dependencies passed as props - no Next.js hooks!
|
|
3528
|
+
*/
|
|
3529
|
+
|
|
3530
|
+
interface RecentDocumentsPageProps {
|
|
3531
|
+
isLoading: boolean;
|
|
3532
|
+
theme: Theme;
|
|
3533
|
+
activePanel: ToolbarPanelType | null;
|
|
3534
|
+
translations: {
|
|
3535
|
+
pageTitle: string;
|
|
3536
|
+
pageDescription: string;
|
|
3537
|
+
sectionTitle: string;
|
|
3538
|
+
sectionDescription: string;
|
|
3539
|
+
noDocuments: string;
|
|
3540
|
+
activityWillAppear: string;
|
|
3541
|
+
loading: string;
|
|
3542
|
+
};
|
|
3543
|
+
ToolbarPanels: React__default.ComponentType<ToolbarPanelsProps>;
|
|
3544
|
+
Toolbar: React__default.ComponentType<ToolbarProps<ToolbarPanelType>>;
|
|
3545
|
+
}
|
|
3546
|
+
declare function RecentDocumentsPage({ isLoading, theme, activePanel, translations: t, ToolbarPanels, Toolbar, }: RecentDocumentsPageProps): React__default.JSX.Element;
|
|
3547
|
+
|
|
3548
|
+
/**
|
|
3549
|
+
* TagSchemasPage Component
|
|
3550
|
+
*
|
|
3551
|
+
* Pure React component for viewing tag schemas.
|
|
3552
|
+
* All dependencies passed as props - no Next.js hooks!
|
|
3553
|
+
*/
|
|
3554
|
+
|
|
3555
|
+
interface TagSchemasPageProps {
|
|
3556
|
+
schemas: TagSchema[];
|
|
3557
|
+
isLoading: boolean;
|
|
3558
|
+
theme: Theme;
|
|
3559
|
+
activePanel: ToolbarPanelType | null;
|
|
3560
|
+
translations: {
|
|
3561
|
+
pageTitle: string;
|
|
3562
|
+
pageDescription: string;
|
|
3563
|
+
categories: string;
|
|
3564
|
+
loading: string;
|
|
3565
|
+
};
|
|
3566
|
+
ToolbarPanels: React__default.ComponentType<ToolbarPanelsProps>;
|
|
3567
|
+
Toolbar: React__default.ComponentType<ToolbarProps<ToolbarPanelType>>;
|
|
3568
|
+
}
|
|
3569
|
+
declare function TagSchemasPage({ schemas, isLoading, theme, activePanel, translations: t, ToolbarPanels, Toolbar, }: TagSchemasPageProps): React__default.JSX.Element;
|
|
3570
|
+
|
|
3571
|
+
/**
|
|
3572
|
+
* A cache-backed list in its real states.
|
|
3573
|
+
*
|
|
3574
|
+
* `loading$` is true only until THIS subscription's first value; once a value
|
|
3575
|
+
* has arrived it never re-enters — even `retry()` routes through
|
|
3576
|
+
* `revalidating$` then — so a blocking spinner keyed on it structurally
|
|
3577
|
+
* cannot latch over rendered rows. The one deliberate exception is BEFORE any
|
|
3578
|
+
* value: `retry()` on a never-loaded list returns to the blocking state,
|
|
3579
|
+
* because there is nothing to render behind a non-blocking indicator.
|
|
3580
|
+
* `revalidating$` is the non-blocking sibling: the thunk's chain has moved to
|
|
3581
|
+
* a cache key that is not resolved yet (the cache emits `undefined` for it)
|
|
3582
|
+
* while `value$` still holds the previous key's rows. Views keep rendering the
|
|
3583
|
+
* stale list; a subtle indicator is optional.
|
|
3584
|
+
*
|
|
3585
|
+
* Why two signals instead of routing a late `undefined` back into `loading$`:
|
|
3586
|
+
* a stable cache key can never go value→undefined (`invalidate()` keeps the
|
|
3587
|
+
* value per B7; `remove()` is not used on list caches), so a late `undefined`
|
|
3588
|
+
* only ever means "new key, fetch in flight". Treating that as blocking
|
|
3589
|
+
* turns a routine filter switch into a full-page spinner — and if the fetch
|
|
3590
|
+
* is lost, into a spinner that never resolves. The failure path stays B14 →
|
|
3591
|
+
* B15 → `error$`, which views check before either signal.
|
|
3592
|
+
*/
|
|
3593
|
+
interface ListState<T> {
|
|
3594
|
+
value$: Observable<T>;
|
|
3595
|
+
/**
|
|
3596
|
+
* True until the first value. Never re-enters after one — a `retry()`
|
|
3597
|
+
* before any value (nothing to render) is the sole way back in.
|
|
3598
|
+
*/
|
|
3599
|
+
loading$: Observable<boolean>;
|
|
3600
|
+
/** True while a NEW key's fetch is pending behind a stale `value$`. */
|
|
3601
|
+
revalidating$: Observable<boolean>;
|
|
3602
|
+
error$: Observable<Error | null>;
|
|
3603
|
+
/** Re-subscribe: B15 clears the failure marker on a fresh `observe()`. */
|
|
3604
|
+
retry(): void;
|
|
3605
|
+
}
|
|
3606
|
+
|
|
3607
|
+
type ComposeMode = 'new' | 'clone';
|
|
3608
|
+
interface ComposeParams {
|
|
3609
|
+
mode?: string | undefined;
|
|
3610
|
+
token?: string | undefined;
|
|
3611
|
+
}
|
|
3612
|
+
interface CloneData {
|
|
3613
|
+
sourceResource: ResourceDescriptor;
|
|
3614
|
+
sourceContent: string;
|
|
3615
|
+
}
|
|
3616
|
+
interface SaveResourceParams$1 {
|
|
3617
|
+
mode: ComposeMode;
|
|
3618
|
+
name: string;
|
|
3619
|
+
storageUri: string;
|
|
3620
|
+
content?: string;
|
|
3621
|
+
file?: File;
|
|
3622
|
+
format?: string;
|
|
3623
|
+
charset?: string;
|
|
3624
|
+
entityTypes?: string[];
|
|
3625
|
+
language: string;
|
|
3626
|
+
archiveOriginal?: boolean;
|
|
3627
|
+
}
|
|
3628
|
+
interface ComposePageStateUnit extends StateUnit {
|
|
3629
|
+
browse: ShellStateUnit;
|
|
3630
|
+
mode$: Observable<ComposeMode>;
|
|
3631
|
+
loading$: Observable<boolean>;
|
|
3632
|
+
cloneData$: Observable<CloneData | null>;
|
|
3633
|
+
entityTypes: ListState<string[]>;
|
|
3634
|
+
/**
|
|
3635
|
+
* Live upload-progress for the in-flight `save(...)` call. Emits the
|
|
3636
|
+
* full `UploadProgress` lifecycle (started → finished) while a save is
|
|
3637
|
+
* underway; resets to `null` between saves and after completion. UI
|
|
3638
|
+
* components can subscribe to render an upload-in-progress indicator.
|
|
3639
|
+
*/
|
|
3640
|
+
uploadProgress$: Observable<UploadProgress | null>;
|
|
3641
|
+
save(params: SaveResourceParams$1): Promise<string>;
|
|
3642
|
+
}
|
|
3643
|
+
declare function createComposePageStateUnit(session: XynologSession, browse: ShellStateUnit, params: ComposeParams, auth?: AccessToken): ComposePageStateUnit;
|
|
3644
|
+
|
|
3645
|
+
/**
|
|
3646
|
+
* ResourceComposePage Component
|
|
3647
|
+
*
|
|
3648
|
+
* Pure React component for creating and editing resources.
|
|
3649
|
+
* Supports two modes: new resource and clone. (Reference completion moved
|
|
3650
|
+
* into the resolve wizard, as its in-modal compose step.)
|
|
3651
|
+
* All dependencies passed as props - no Next.js hooks!
|
|
3652
|
+
*/
|
|
3653
|
+
|
|
3654
|
+
interface ResourceComposePageProps {
|
|
3655
|
+
mode: 'new' | 'clone';
|
|
3656
|
+
cloneData?: CloneData | null;
|
|
3657
|
+
availableEntityTypes: string[];
|
|
3658
|
+
initialLocale: string;
|
|
3659
|
+
theme: ResolvedTheme;
|
|
3660
|
+
hoverDelayMs: number;
|
|
3661
|
+
activePanel: ToolbarPanelType | null;
|
|
3662
|
+
onSaveResource: (params: SaveResourceParams) => Promise<void>;
|
|
3663
|
+
onCancel: () => void;
|
|
3664
|
+
/** Choose a destination directory and return its path relative to the KB root. */
|
|
3665
|
+
onChooseStorageDirectory?: (suggestedDirectory: string) => Promise<string | null>;
|
|
3666
|
+
/**
|
|
3667
|
+
* Live upload-progress for the in-flight save. Resolved by the route
|
|
3668
|
+
* shell from `composeVM.uploadProgress$`. `null` between saves and
|
|
3669
|
+
* after completion. When non-null, the form disables Save and the
|
|
3670
|
+
* inline `<UploadProgressBar />` below the action buttons renders.
|
|
3671
|
+
*/
|
|
3672
|
+
uploadProgress?: UploadProgress | null;
|
|
3673
|
+
translations: {
|
|
3674
|
+
title: string;
|
|
3675
|
+
titleEditClone: string;
|
|
3676
|
+
subtitleClone: string;
|
|
3677
|
+
resourceName: string;
|
|
3678
|
+
resourceNamePlaceholder: string;
|
|
3679
|
+
entityTypes: string;
|
|
3680
|
+
language: string;
|
|
3681
|
+
contentSource: string;
|
|
3682
|
+
uploadFile: string;
|
|
3683
|
+
uploadFileDescription: string;
|
|
3684
|
+
writeContent: string;
|
|
3685
|
+
writeContentDescription: string;
|
|
3686
|
+
dropFileOrClick: string;
|
|
3687
|
+
supportedFormats: string;
|
|
3688
|
+
mediaType: string;
|
|
3689
|
+
autoDetected: string;
|
|
3690
|
+
format: string;
|
|
3691
|
+
content: string;
|
|
3692
|
+
resourceContent: string;
|
|
3693
|
+
encoding: string;
|
|
3694
|
+
archiveOriginal: string;
|
|
3695
|
+
cancel: string;
|
|
3696
|
+
saving: string;
|
|
3697
|
+
creating: string;
|
|
3698
|
+
saveClonedResource: string;
|
|
3699
|
+
createResource: string;
|
|
3700
|
+
chooseFolder?: string;
|
|
3701
|
+
locationHint?: string;
|
|
3702
|
+
};
|
|
3703
|
+
ToolbarPanels: React__default.ComponentType<ToolbarPanelsProps>;
|
|
3704
|
+
Toolbar: React__default.ComponentType<ToolbarProps<ToolbarPanelType>>;
|
|
3705
|
+
}
|
|
3706
|
+
interface SaveResourceParams {
|
|
3707
|
+
mode: 'new' | 'clone';
|
|
3708
|
+
name: string;
|
|
3709
|
+
storageUri: string;
|
|
3710
|
+
content?: string;
|
|
3711
|
+
file?: File;
|
|
3712
|
+
format?: string;
|
|
3713
|
+
charset?: string;
|
|
3714
|
+
entityTypes?: string[];
|
|
3715
|
+
language: string;
|
|
3716
|
+
archiveOriginal?: boolean;
|
|
3717
|
+
}
|
|
3718
|
+
declare function ResourceComposePage({ mode, cloneData, availableEntityTypes, initialLocale, theme, hoverDelayMs, activePanel, onSaveResource, onCancel, onChooseStorageDirectory, uploadProgress, translations: t, ToolbarPanels, Toolbar, }: ResourceComposePageProps): React__default.JSX.Element;
|
|
3719
|
+
|
|
3720
|
+
/**
|
|
3721
|
+
* Inline upload-progress affordance for the compose page.
|
|
3722
|
+
*
|
|
3723
|
+
* Subscribes (via prop) to a `UploadProgress | null` value derived from
|
|
3724
|
+
* `composeVM.uploadProgress$`. Renders nothing when null; renders an
|
|
3725
|
+
* indeterminate state on `started`; renders a labeled bar with byte
|
|
3726
|
+
* counts on `progress`; renders a brief "Uploaded" success state on
|
|
3727
|
+
* `finished` (cleared by the state unit's `null` push on complete).
|
|
3728
|
+
*
|
|
3729
|
+
* Designed to live below the Save button in the compose form so the
|
|
3730
|
+
* visual association with the action that triggered the upload is
|
|
3731
|
+
* direct. Uses the existing `.xynolog-progress` styles in
|
|
3732
|
+
* `typescript/react-ui/src/styles/core/progress.css`.
|
|
3733
|
+
*/
|
|
3734
|
+
|
|
3735
|
+
interface UploadProgressBarProps {
|
|
3736
|
+
progress: UploadProgress | null;
|
|
3737
|
+
/** What is being uploaded, named at the head of each line. */
|
|
3738
|
+
label: string;
|
|
3739
|
+
}
|
|
3740
|
+
declare function UploadProgressBar({ progress, label, }: UploadProgressBarProps): React__default.ReactElement | null;
|
|
3741
|
+
|
|
3742
|
+
/**
|
|
3743
|
+
* ResourceDiscoveryPage Component
|
|
3744
|
+
*
|
|
3745
|
+
* Pure React component for resource discovery and search.
|
|
3746
|
+
* All dependencies passed as props - no Next.js hooks!
|
|
3747
|
+
*/
|
|
3748
|
+
|
|
3749
|
+
interface ResourceDiscoveryPageProps {
|
|
3750
|
+
recentDocuments: ResourceDescriptor[];
|
|
3751
|
+
searchDocuments: ResourceDescriptor[];
|
|
3752
|
+
entityTypes: string[];
|
|
3753
|
+
isLoadingRecent: boolean;
|
|
3754
|
+
/**
|
|
3755
|
+
* The recent-resources load failed terminally (B15). Without it, "loading"
|
|
3756
|
+
* derived from an absent value never resolves and this route freezes.
|
|
3757
|
+
*/
|
|
3758
|
+
recentError?: Error | null;
|
|
3759
|
+
onRetryRecent?: () => void;
|
|
3760
|
+
isSearching: boolean;
|
|
3761
|
+
/**
|
|
3762
|
+
* How the current search answer was produced — `'lexical'` (title/metadata
|
|
3763
|
+
* matching) or `'semantic'` (the vector fallback that runs only when lexical
|
|
3764
|
+
* matching returned nothing). Undefined before the first answer, and on the
|
|
3765
|
+
* no-query view where `recent` renders and no label describes it.
|
|
3766
|
+
*
|
|
3767
|
+
* Optional so hosts that never wire it — including external consumers —
|
|
3768
|
+
* render exactly as before.
|
|
3769
|
+
*/
|
|
3770
|
+
searchMatchKind?: components['schemas']['MatchResourcesResponse']['matchKind'];
|
|
3771
|
+
searchQuery: string;
|
|
3772
|
+
onSearchQueryChange: (query: string) => void;
|
|
3773
|
+
selectedEntityType: string;
|
|
3774
|
+
onSelectedEntityTypeChange: (entityType: string) => void;
|
|
3775
|
+
theme: ResolvedTheme;
|
|
3776
|
+
activePanel: ToolbarPanelType | null;
|
|
3777
|
+
onNavigateToResource: (resourceId: string) => void;
|
|
3778
|
+
onNavigateToCompose: () => void;
|
|
3779
|
+
translations: {
|
|
3780
|
+
title: string;
|
|
3781
|
+
subtitle: string;
|
|
3782
|
+
searchPlaceholder: string;
|
|
3783
|
+
searchButton: string;
|
|
3784
|
+
searching: string;
|
|
3785
|
+
semanticFallbackNotice: string;
|
|
3786
|
+
filterByEntityType: string;
|
|
3787
|
+
all: string;
|
|
3788
|
+
recentResources: string;
|
|
3789
|
+
searchResults: (count: number) => string;
|
|
3790
|
+
documentsTaggedWith: (entityType: string) => string;
|
|
3791
|
+
noResultsFound: (query: string) => string;
|
|
3792
|
+
noResourcesAvailable: string;
|
|
3793
|
+
composeFirstResource: string;
|
|
3794
|
+
archived: string;
|
|
3795
|
+
created: string;
|
|
3796
|
+
loadingKnowledgeBase: string;
|
|
3797
|
+
recentFailed: string;
|
|
3798
|
+
retry: string;
|
|
3799
|
+
};
|
|
3800
|
+
ToolbarPanels: React__default.ComponentType<ToolbarPanelsProps>;
|
|
3801
|
+
}
|
|
3802
|
+
declare function ResourceDiscoveryPage({ recentDocuments, searchDocuments, entityTypes, isLoadingRecent, recentError, onRetryRecent, isSearching, searchMatchKind, searchQuery, onSearchQueryChange, selectedEntityType, onSelectedEntityTypeChange, theme, activePanel, onNavigateToResource, onNavigateToCompose, translations: t, ToolbarPanels, }: ResourceDiscoveryPageProps): React__default.JSX.Element;
|
|
3803
|
+
|
|
3804
|
+
/**
|
|
3805
|
+
* ResourceCard Component
|
|
3806
|
+
*
|
|
3807
|
+
* Pure component for displaying a single resource in the discovery grid.
|
|
3808
|
+
* Handles keyboard navigation and accessibility.
|
|
3809
|
+
*/
|
|
3810
|
+
|
|
3811
|
+
interface ResourceCardProps {
|
|
3812
|
+
resource: ResourceDescriptor;
|
|
3813
|
+
onOpen: (resource: ResourceDescriptor) => void;
|
|
3814
|
+
tabIndex?: number;
|
|
3815
|
+
archivedLabel: string;
|
|
3816
|
+
createdLabel: string;
|
|
3817
|
+
}
|
|
3818
|
+
declare const ResourceCard: React__default.MemoExoticComponent<({ resource, onOpen, tabIndex, archivedLabel, createdLabel, }: ResourceCardProps) => React__default.JSX.Element>;
|
|
3819
|
+
|
|
3820
|
+
/**
|
|
3821
|
+
* ResourceViewerPage - Self-contained resource viewer component
|
|
3822
|
+
*
|
|
3823
|
+
* Handles all data loading, event subscriptions, and side effects internally.
|
|
3824
|
+
* Only requires minimal props from the framework layer (routing, modals).
|
|
3825
|
+
*/
|
|
3826
|
+
|
|
3827
|
+
type XynologResource = ResourceDescriptor;
|
|
3828
|
+
interface ResourceViewerPageProps {
|
|
3829
|
+
/**
|
|
3830
|
+
* The resource to display
|
|
3831
|
+
*/
|
|
3832
|
+
resource: XynologResource;
|
|
3833
|
+
/**
|
|
3834
|
+
* Resource URI
|
|
3835
|
+
*/
|
|
3836
|
+
rUri: ResourceId;
|
|
3837
|
+
/**
|
|
3838
|
+
* Current locale
|
|
3839
|
+
*/
|
|
3840
|
+
locale: string;
|
|
3841
|
+
/**
|
|
3842
|
+
* Link component for routing
|
|
3843
|
+
*/
|
|
3844
|
+
Link: React__default.ComponentType<LinkComponentProps>;
|
|
3845
|
+
/**
|
|
3846
|
+
* Routes configuration
|
|
3847
|
+
*/
|
|
3848
|
+
routes: RouteBuilder;
|
|
3849
|
+
/**
|
|
3850
|
+
* Component dependencies - passed from framework layer
|
|
3851
|
+
*/
|
|
3852
|
+
ToolbarPanels: React__default.ComponentType<ToolbarPanelsProps$1>;
|
|
3853
|
+
/**
|
|
3854
|
+
* Callback to refetch document from parent
|
|
3855
|
+
*/
|
|
3856
|
+
refetchDocument: () => Promise<unknown>;
|
|
3857
|
+
/**
|
|
3858
|
+
* Bus connection state for the active workspace. Six-valued state
|
|
3859
|
+
* machine from `actor.state$`; CollaborationPanel maps it to the
|
|
3860
|
+
* "Live" / "Disconnected" visual.
|
|
3861
|
+
*/
|
|
3862
|
+
streamStatus: ConnectionState;
|
|
3863
|
+
/**
|
|
3864
|
+
* Name of the active knowledge base (for display in panels)
|
|
3865
|
+
*/
|
|
3866
|
+
knowledgeBaseName?: string | undefined;
|
|
3867
|
+
/**
|
|
3868
|
+
* Media-renderer overrides, forwarded to `ResourceViewer`. Present at this
|
|
3869
|
+
* tier too so a host embedding the whole page — not just the viewer — can
|
|
3870
|
+
* still swap a renderer.
|
|
3871
|
+
*/
|
|
3872
|
+
browseRenderers?: BrowseMediaRenderers$1;
|
|
3873
|
+
annotateRenderers?: AnnotateMediaRenderers$1;
|
|
3874
|
+
}
|
|
3875
|
+
/**
|
|
3876
|
+
* ResourceViewerPage - Main component
|
|
3877
|
+
*
|
|
3878
|
+
* Uses hooks directly (NO containers, NO render props, NO content wrapper)
|
|
3879
|
+
*
|
|
3880
|
+
* @emits nav:push - Navigate to a resource or filtered view
|
|
3881
|
+
* @emits beckon:sparkle - Trigger sparkle animation on an annotation
|
|
3882
|
+
* @emits bind:update-body - Update annotation body content
|
|
3883
|
+
* @emits mark:archive - Archive the current resource on the knowledge base
|
|
3884
|
+
* @emits mark:unarchive - Unarchive the current resource on the knowledge base
|
|
3885
|
+
* @emits panel:open - Open a panel: the one the viewer asks for, or the annotations panel for a pending or newly generated annotation
|
|
3886
|
+
* @subscribes mark:archive - Archive the current resource
|
|
3887
|
+
* @subscribes mark:unarchive - Unarchive the current resource
|
|
3888
|
+
* @subscribes yield:clone - Clone the current resource
|
|
3889
|
+
* @subscribes beckon:sparkle - Trigger sparkle animation
|
|
3890
|
+
* @subscribes mark:added - Annotation was created (sparkle)
|
|
3891
|
+
* @subscribes mark:body-updated - Reference resolved via a linking-add operation (sparkle, both loci)
|
|
3892
|
+
* @subscribes browse:resource-open - Open a resource in the viewer (local links + the launcher's tour verbs)
|
|
3893
|
+
* @subscribes browse:entity-type-clicked - Navigate filtered by entity type
|
|
3894
|
+
*
|
|
3895
|
+
* Outcome-notification channels (mark:create-error, mark:delete-error,
|
|
3896
|
+
* bind:body-error, job:complete, job:fail, mark:delegate-timeout) are
|
|
3897
|
+
* subscribed by useOutcomeToasts.
|
|
3898
|
+
*/
|
|
3899
|
+
declare function ResourceViewerPage({ resource, rUri, locale, Link, routes, ToolbarPanels, refetchDocument, streamStatus, knowledgeBaseName, browseRenderers, annotateRenderers, }: ResourceViewerPageProps): React__default.JSX.Element;
|
|
3900
|
+
|
|
3901
|
+
interface HoverEmitterProps {
|
|
3902
|
+
onMouseEnter: () => void;
|
|
3903
|
+
onMouseLeave: () => void;
|
|
3904
|
+
}
|
|
3905
|
+
/** The pointer's dwell on one annotation's entry, as the entry's mouse handlers. */
|
|
3906
|
+
declare function useHoverEmitter(session: XynologSession | null, annotationId: AnnotationId, hoverDelayMs?: number): HoverEmitterProps;
|
|
3907
|
+
|
|
3908
|
+
interface AnnotationGroups {
|
|
3909
|
+
highlights: Annotation[];
|
|
3910
|
+
comments: Annotation[];
|
|
3911
|
+
assessments: Annotation[];
|
|
3912
|
+
references: Annotation[];
|
|
3913
|
+
tags: Annotation[];
|
|
3914
|
+
}
|
|
3915
|
+
interface WizardState {
|
|
3916
|
+
open: boolean;
|
|
3917
|
+
annotationId: AnnotationId | null;
|
|
3918
|
+
resourceId: ResourceId | null;
|
|
3919
|
+
defaultTitle: string;
|
|
3920
|
+
entityTypes: string[];
|
|
3921
|
+
}
|
|
3922
|
+
interface ResourceViewerPageStateUnit extends StateUnit {
|
|
3923
|
+
beckon: BeckonStateUnit;
|
|
3924
|
+
browse: ShellStateUnit;
|
|
3925
|
+
mark: MarkStateUnit;
|
|
3926
|
+
gather: GatherStateUnit;
|
|
3927
|
+
yield: YieldStateUnit;
|
|
3928
|
+
annotations: ListState<Annotation[]>;
|
|
3929
|
+
entityTypes: ListState<string[]>;
|
|
3930
|
+
events: ListState<AttributedEvent[]>;
|
|
3931
|
+
referencedBy: ListState<ReferencedByEntry[]>;
|
|
3932
|
+
/** Derived from `annotations.value$`; failure/loading live on `annotations`. */
|
|
3933
|
+
annotationGroups$: Observable<AnnotationGroups>;
|
|
3934
|
+
wizard$: Observable<WizardState>;
|
|
3935
|
+
closeWizard(): void;
|
|
3936
|
+
}
|
|
3937
|
+
declare function createResourceViewerPageStateUnit(session: XynologSession, resourceId: ResourceId, locale: string, browse: ShellStateUnit): ResourceViewerPageStateUnit;
|
|
3938
|
+
|
|
3939
|
+
interface ResourceLoaderStateUnit extends StateUnit {
|
|
3940
|
+
resource$: Observable<ResourceDescriptor | undefined>;
|
|
3941
|
+
isLoading$: Observable<boolean>;
|
|
3942
|
+
/** Terminal load failure (B15), or null. Cleared by any value or `invalidate()`. */
|
|
3943
|
+
error$: Observable<Error | null>;
|
|
3944
|
+
invalidate(): void;
|
|
3945
|
+
}
|
|
3946
|
+
/**
|
|
3947
|
+
* Load one resource, in three states: loading, loaded, failed.
|
|
3948
|
+
*
|
|
3949
|
+
* The third state is not optional. `browse.resource()` delivers a terminal
|
|
3950
|
+
* failure as an RxJS *error* notification (B15) when the B14 retry is
|
|
3951
|
+
* exhausted with nothing cached — and a key that failed has no value either,
|
|
3952
|
+
* so a (value | no value) model reports a dead request as an eternal spinner
|
|
3953
|
+
* and drops the reason entirely. This unit catches the notification here so
|
|
3954
|
+
* that (a) consumers can render the failure and retry it, and (b) it never
|
|
3955
|
+
* escapes to RxJS as an unhandled rethrow.
|
|
3956
|
+
*/
|
|
3957
|
+
declare function createResourceLoaderStateUnit(session: XynologSession, resourceId: ResourceId): ResourceLoaderStateUnit;
|
|
3958
|
+
|
|
3959
|
+
interface DiscoverSearchPipeline {
|
|
3960
|
+
query$: Observable<string>;
|
|
3961
|
+
/**
|
|
3962
|
+
* The page AND the label that describes it, as one value. `matchKind` is
|
|
3963
|
+
* carried here rather than beside it because the rule that a label and the
|
|
3964
|
+
* resources it describes arrive as one value (semantic-fallback axiom S10)
|
|
3965
|
+
* is tier-agnostic: two separately-observable pieces of state let a render
|
|
3966
|
+
* pair this query's label with the previous query's list. Undefined only
|
|
3967
|
+
* before the first answer (and while a query is empty), never as a third
|
|
3968
|
+
* kind.
|
|
3969
|
+
*/
|
|
3970
|
+
state$: Observable<{
|
|
3971
|
+
results: ResourceDescriptor[];
|
|
3972
|
+
isSearching: boolean;
|
|
3973
|
+
matchKind?: components['schemas']['MatchResourcesResponse']['matchKind'];
|
|
3974
|
+
}>;
|
|
3975
|
+
setQuery(value: string): void;
|
|
3976
|
+
}
|
|
3977
|
+
interface DiscoverStateUnit extends StateUnit {
|
|
3978
|
+
browse: ShellStateUnit;
|
|
3979
|
+
search: DiscoverSearchPipeline;
|
|
3980
|
+
recent: ListState<ResourceDescriptor[]>;
|
|
3981
|
+
entityTypes: ListState<string[]>;
|
|
3982
|
+
selectedEntityType$: Observable<string>;
|
|
3983
|
+
setSelectedEntityType(value: string): void;
|
|
3984
|
+
}
|
|
3985
|
+
declare function createDiscoverStateUnit(session: XynologSession, browse: ShellStateUnit): DiscoverStateUnit;
|
|
3986
|
+
|
|
3987
|
+
interface EntityTagsStateUnit extends StateUnit {
|
|
3988
|
+
browse: ShellStateUnit;
|
|
3989
|
+
entityTypes: ListState<string[]>;
|
|
3990
|
+
newTag$: Observable<string>;
|
|
3991
|
+
error$: Observable<string>;
|
|
3992
|
+
isAdding$: Observable<boolean>;
|
|
3993
|
+
setNewTag(value: string): void;
|
|
3994
|
+
addTag(): Promise<void>;
|
|
3995
|
+
}
|
|
3996
|
+
/**
|
|
3997
|
+
* @emits frame:add-entity-type - Add the tag typed to the vocabulary. Payload: { tag: string }
|
|
3998
|
+
*/
|
|
3999
|
+
declare function createEntityTagsStateUnit(session: XynologSession, browse: ShellStateUnit): EntityTagsStateUnit;
|
|
4000
|
+
|
|
4001
|
+
/**
|
|
4002
|
+
* `ShellStateUnit` is app-scoped — it owns toolbar panel state and lives on
|
|
4003
|
+
* the `XynologBrowser`'s own bus. Unlike session-scoped VMs, this hook
|
|
4004
|
+
* does not need to wait for an active KB session; `useXynolog()`
|
|
4005
|
+
* always returns the module-scoped `XynologBrowser` singleton.
|
|
4006
|
+
*/
|
|
4007
|
+
declare function useShellStateUnit(): ShellStateUnit;
|
|
4008
|
+
|
|
4009
|
+
/**
|
|
4010
|
+
* Subscribe to an RxJS Observable and return its current value as React state.
|
|
4011
|
+
*
|
|
4012
|
+
* - For a `BehaviorSubject` (or anything with a `getValue()` method), returns
|
|
4013
|
+
* its current value synchronously at the first render. This matters for
|
|
4014
|
+
* callers that build derived objects in a `useState(factory)` initializer
|
|
4015
|
+
* at first render — they need the subject's value present immediately, not
|
|
4016
|
+
* after a second render triggered by the useEffect subscribe.
|
|
4017
|
+
*
|
|
4018
|
+
* We duck-type on `.getValue` rather than using `instanceof BehaviorSubject`
|
|
4019
|
+
* because rxjs can be loaded through multiple module realms in tests (e.g.
|
|
4020
|
+
* a bundled CJS copy inside `@xynolog/react-ui/dist` vs a fresh ESM import
|
|
4021
|
+
* in the test file), which makes `instanceof` unreliable.
|
|
4022
|
+
* - For non-BehaviorSubject Observables, starts at `undefined` and emits
|
|
4023
|
+
* asynchronously after the subscribe.
|
|
4024
|
+
* - Accepts `undefined`/`null` for cases where the observable's source isn't
|
|
4025
|
+
* ready yet (e.g. `xynolog?.browse.events(rUri)` when the active session is
|
|
4026
|
+
* still loading). In that case the hook is a no-op and returns undefined.
|
|
4027
|
+
* - Unsubscribes automatically on unmount or when `obs$` changes.
|
|
4028
|
+
* - A source ERROR is terminal absence: the hook keeps its last value and
|
|
4029
|
+
* reports the reason. It does not surface the error as state — a hook whose
|
|
4030
|
+
* whole contract is "the current value" has nowhere to put one. Callers that
|
|
4031
|
+
* must RENDER a failure need it modelled by the thing they observe (see
|
|
4032
|
+
* `createResourceLoaderStateUnit`'s `error$`); this handler exists so the
|
|
4033
|
+
* error is not left unhandled, which RxJS rethrows asynchronously — the
|
|
4034
|
+
* `Uncaught BusRequestError` seen in the field whenever a cache key
|
|
4035
|
+
* exhausted its B14 retry with nothing stored (B15).
|
|
4036
|
+
*/
|
|
4037
|
+
declare function useObservable<T>(obs$: Observable<T> | null | undefined): T | undefined;
|
|
4038
|
+
|
|
4039
|
+
export { ANNOTATORS, AnnotateToolbar, AnnotateView, AnnotationHistory, AnnotationOverlay, AnnotationProvider, AssessmentEntry, AssessmentPanel, AsyncErrorBoundary, AuthErrorDisplay, BrowseView, Button, ButtonGroup, COMMON_PANELS, CodeMirrorRenderer, CollaborationPanel, CollapsibleResourceNavigation, CommentEntry, CommentsPanel, ComposeLoadingState, DelegateProgress, DelegateSection, DelegateShell, DownloadFileLink, EntityTagsPage, EntityTypeBadges, ErrorBoundary, HighlightEntry, HighlightPanel, HistoryEvent, ImageAnnotateRenderer, ImageBrowseRenderer, ImageURLSchema, ImageViewer, JsonLdPanel, JsonLdView, KbIdentityConflictModal, KeyboardShortcutsHelpModal, LeftSidebar, LineNumbersProvider, LiveRegionProvider, MainContent, NavigationMenu, ObservableLink, PageLayout, PanelHeader, PdfAnnotateRenderer, PdfBrowseRenderer, PermissionDeniedModal, PopupContainer, PopupHeader, ProtectedErrorBoundary, RESOURCE_PANELS, RecentDocumentsPage, ReferenceEntry, ReferenceResolutionWidget, ReferenceWizardModal, ReferencesPanel, ResizeHandle, ResourceAnnotationsProvider, ResourceCard, ResourceComposePage, ResourceDiscoveryPage, ResourceErrorState, ResourceGenerateModal, ResourceInfoPanel, ResourceLoadingState, ResourceTagsInline, ResourceViewer, ResourceViewerPage, SearchModal, SelectedTextDisplay, SessionEndedModal, SessionExpiryBanner, SessionTimer, SettingsPanel, SimpleNavigation, SkipLinks, SortableResourceTab, StatisticsPanel, StatusDisplay, SvgDrawingCanvas, TagEntry, TagSchemasPage, TaggingPanel, TextAnnotateRenderer, TextBrowseRenderer, ThemeProvider, ToastContainer, ToastProvider, Toolbar, TranslationProvider, UnifiedAnnotationsPanel, UnifiedHeader, UploadProgressBar, UserMenuSkeleton, WebBrowserStorage, XynologBranding, XynologProvider, annotatorKeyForMotivation, applyHighlights, buildSourceToRenderedMap, buildTextNodeIndex, buttonStyles, clearHighlights, createComposePageStateUnit, createDiscoverStateUnit, createEntityTagsStateUnit, createResourceLoaderStateUnit, createResourceViewerPageStateUnit, createShellStateUnit, defaultAnnotateRenderers, defaultBrowseRenderers, delegatedJobControls, formatTime, getResourceIcon, getSelectedShapeForSelectorType, getSelectorType, getShortcutDisplay, getSupportedShapes, hideWidgetPreview, interpolateTranslation, isShapeSupported, jsonHighlightStyle, jsonTheme, markJobControls, mediaUrl, resolveAnnotationSpans, sanitizeImageURL, saveSelectedShapeForSelectorType, setPdfWasmUrl, setPdfWorkerSrc, showWidgetPreview, supportsDetection, toOverlayAnnotations, useAnnotationManager, useDebounce, useDebouncedCallback, useDocumentAnnouncements, useDoubleKeyPress, useDropdown, useEngines, useEventSubscription, useEventSubscriptions, useFormAnnouncements, useHoverDelay, useHoverEmitter, useIsTyping, useKBDiscovery, useKeyboardShortcuts, useLanguageChangeAnnouncements, useLineNumbers, useLiveRegion, useLoadingState, useLocalStorage, useMediaToken, useObservable, useObservableExternalNavigation, useObservableRouter, usePanelWidth, usePendingCreation, usePreloadTranslations, useResourceAnnotations, useResourceContent, useResourceEventSubscriptions, useResourceLoader, useResourceLoadingAnnouncements, useRovingTabIndex, useSearchAnnouncements, useSessionEventSubscriptions, useSessionExpiry, useSessionStateUnit, useShellStateUnit, useStateUnit, useTheme, useToast, useToolbarPrefs, useTranslationManager, useTranslations, useXynolog };
|
|
4040
|
+
export type { AnnotateMediaRendererProps, AnnotateMediaRenderers, AnnotationConfig, AnnotationGroups, AnnotationHandlers, AnnotationManager, AnnotationProviderProps, AnnotationUIState, AnnotationsCollection, Annotator, AnnotatorKey, AuthErrorDisplayProps, BrowseMediaRenderers, ButtonGroupProps, ButtonProps, ClickAction, CloneData, CollapsibleResourceNavigationProps, ComposeLoadingStateProps, ComposeMode, ComposePageStateUnit, ComposeParams, CreateAnnotationParams, DelegateDataType, DelegateProgressProps, DelegateProgressTranslations, DelegateShellProps, DelegatedJobControls, DeleteAnnotationParams, DiscoverStateUnit, DrawingMode, EntityTagsPageProps, EntityTagsStateUnit, HoverEmitterProps, KBDiscoveryOptions, KBDiscoveryResult, KeyboardShortcut, LinkComponentProps, MediaRendererProps, Motivation$1 as Motivation, NavigationItem, NavigationMenuHelper, ObservableLinkProps, OverlayAnnotation, PendingCreation, RecentDocumentsPageProps, ReferenceHover, ReferenceWizardModalProps, ResolvedAnnotationSpan, ResolvedTheme, ResourceCardProps, ResourceComposePageProps, ResourceDiscoveryPageProps, ResourceErrorStateProps, ResourceGenerateModalProps, ResourceGenerateModalTranslations, ResourceLoaderStateUnit, ResourceViewerPageProps, ResourceViewerPageStateUnit, RouteBuilder, SaveResourceParams$1 as SaveResourceParams, SearchModalProps, SelectorType, ShapeType, ShellStateUnit, ShellStateUnitOptions, SimpleNavigationItem, SimpleNavigationProps, SortableResourceTabProps, TagSchemasPageProps, TextNodeEntry, TextSegment, Theme, ToastMessage, ToastType, ToolbarPanelType, ToolbarPanelsProps, ToolbarPart, ToolbarPrefs, ToolbarProps, TranslationManager, TranslationProviderProps, TranslationSource, UploadProgressBarProps, UseEnginesResult, UseMediaTokenResult, UseResourceContentResult, UseResourceLoaderResult, WizardState, XynologProviderProps, XynologResource$1 as XynologResource };
|