@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/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.delegated-job.test.tsx
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The delegated job's id goes where its progress goes: to the panel of the
|
|
3
|
+
* delegated motivation, whose cancel control names that job. Every motivation
|
|
4
|
+
* a person can delegate has the control, from the moment the queue has named
|
|
5
|
+
* the job; before that there is none.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { describe, it, expect, vi, afterEach } from 'vitest';
|
|
9
|
+
import { screen, fireEvent } from '@testing-library/react';
|
|
10
|
+
import { renderInEnglish } from '../../../../test-utils';
|
|
11
|
+
import '@testing-library/jest-dom';
|
|
12
|
+
import {
|
|
13
|
+
createMarkStateUnit,
|
|
14
|
+
type MarkStateUnit,
|
|
15
|
+
type XynologSession,
|
|
16
|
+
} from '@xynolog/sdk';
|
|
17
|
+
import { createTestSession } from '@xynolog/sdk/testing';
|
|
18
|
+
import type {
|
|
19
|
+
LinkComponentProps,
|
|
20
|
+
RouteBuilder,
|
|
21
|
+
} from '../../../../contexts/RoutingContext';
|
|
22
|
+
import { UnifiedAnnotationsPanel } from '../UnifiedAnnotationsPanel';
|
|
23
|
+
import {
|
|
24
|
+
ANNOTATORS,
|
|
25
|
+
annotatorKeyForMotivation,
|
|
26
|
+
type AnnotatorKey,
|
|
27
|
+
} from '../../../../lib/annotation-registry';
|
|
28
|
+
import { jobId, resourceId, type JobId, type Motivation } from '@xynolog/core';
|
|
29
|
+
|
|
30
|
+
const TestLink = ({ href, children, ...rest }: LinkComponentProps) => (
|
|
31
|
+
<a href={href} {...rest}>
|
|
32
|
+
{children}
|
|
33
|
+
</a>
|
|
34
|
+
);
|
|
35
|
+
const testRoutes: RouteBuilder = { resourceDetail: (id) => `/r/${id}` };
|
|
36
|
+
|
|
37
|
+
type PanelProps = React.ComponentProps<typeof UnifiedAnnotationsPanel>;
|
|
38
|
+
|
|
39
|
+
const sessions: XynologSession[] = [];
|
|
40
|
+
const marks: MarkStateUnit[] = [];
|
|
41
|
+
|
|
42
|
+
afterEach(() => {
|
|
43
|
+
vi.restoreAllMocks();
|
|
44
|
+
for (const mark of marks.splice(0)) mark.dispose();
|
|
45
|
+
for (const session of sessions.splice(0)) {
|
|
46
|
+
session.client.dispose();
|
|
47
|
+
session.dispose();
|
|
48
|
+
}
|
|
49
|
+
// The panel restores a resource's last tab from storage, over `initialTab`.
|
|
50
|
+
localStorage.clear();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
function harness() {
|
|
54
|
+
const { session, client } = createTestSession();
|
|
55
|
+
sessions.push(session);
|
|
56
|
+
const mark = createMarkStateUnit(client, resourceId('res-1'));
|
|
57
|
+
marks.push(mark);
|
|
58
|
+
const cancel = vi.spyOn(client.job, 'cancel').mockResolvedValue(true);
|
|
59
|
+
return { session, mark, cancel };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const delegating = (
|
|
63
|
+
session: XynologSession,
|
|
64
|
+
mark: MarkStateUnit,
|
|
65
|
+
motivation: Motivation,
|
|
66
|
+
tab: AnnotatorKey,
|
|
67
|
+
job: JobId | null,
|
|
68
|
+
): PanelProps => ({
|
|
69
|
+
session,
|
|
70
|
+
mark,
|
|
71
|
+
annotations: [],
|
|
72
|
+
annotators: ANNOTATORS,
|
|
73
|
+
annotateMode: true,
|
|
74
|
+
allEntityTypes: [],
|
|
75
|
+
pendingAnnotation: null,
|
|
76
|
+
delegatingMotivation: motivation,
|
|
77
|
+
progress: { percentage: 10 },
|
|
78
|
+
progressMotivation: motivation,
|
|
79
|
+
jobId: job,
|
|
80
|
+
cancelled: false,
|
|
81
|
+
resourceId: resourceId('res-1'),
|
|
82
|
+
initialTab: tab,
|
|
83
|
+
Link: TestLink,
|
|
84
|
+
routes: testRoutes,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Every motivation the registry knows is one a person can delegate.
|
|
88
|
+
const motivations = Object.values(ANNOTATORS).map(({ motivation }) => {
|
|
89
|
+
const tab = annotatorKeyForMotivation(motivation);
|
|
90
|
+
if (!tab) throw new Error(`the registry names no panel for ${motivation}`);
|
|
91
|
+
return { tab, motivation };
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('UnifiedAnnotationsPanel: the delegated job', () => {
|
|
95
|
+
it.each(motivations)(
|
|
96
|
+
"gives a $motivation job's id to its panel, whose control cancels that job",
|
|
97
|
+
({ tab, motivation }) => {
|
|
98
|
+
const { session, mark, cancel } = harness();
|
|
99
|
+
renderInEnglish(
|
|
100
|
+
<UnifiedAnnotationsPanel
|
|
101
|
+
{...delegating(session, mark, motivation, tab, jobId('job-1'))}
|
|
102
|
+
/>,
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
fireEvent.click(screen.getByTestId('xynolog-delegate-control'));
|
|
106
|
+
expect(cancel).toHaveBeenCalledExactlyOnceWith('job-1');
|
|
107
|
+
},
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
it.each(motivations)(
|
|
111
|
+
'shows a $motivation job no control before the queue has named it',
|
|
112
|
+
({ tab, motivation }) => {
|
|
113
|
+
const { session, mark } = harness();
|
|
114
|
+
renderInEnglish(
|
|
115
|
+
<UnifiedAnnotationsPanel
|
|
116
|
+
{...delegating(session, mark, motivation, tab, null)}
|
|
117
|
+
/>,
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
// The display is there; only its control is not.
|
|
121
|
+
expect(screen.getByTestId('xynolog-delegate-status')).toBeInTheDocument();
|
|
122
|
+
expect(screen.queryByTestId('xynolog-delegate-control')).toBeNull();
|
|
123
|
+
},
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
it("shows the references panel no control for another motivation's job", () => {
|
|
127
|
+
const { session, mark } = harness();
|
|
128
|
+
renderInEnglish(
|
|
129
|
+
<UnifiedAnnotationsPanel
|
|
130
|
+
{...delegating(
|
|
131
|
+
session,
|
|
132
|
+
mark,
|
|
133
|
+
'highlighting',
|
|
134
|
+
'reference',
|
|
135
|
+
jobId('job-1'),
|
|
136
|
+
)}
|
|
137
|
+
/>,
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
expect(screen.queryByTestId('xynolog-delegate-control')).toBeNull();
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* A delegated job that has ended: nothing is delegating, and its progress
|
|
146
|
+
* stays with the motivation it is of until it is dismissed.
|
|
147
|
+
*/
|
|
148
|
+
const ended = (
|
|
149
|
+
session: XynologSession,
|
|
150
|
+
mark: MarkStateUnit,
|
|
151
|
+
motivation: Motivation,
|
|
152
|
+
tab: AnnotatorKey,
|
|
153
|
+
cancelled: boolean,
|
|
154
|
+
): PanelProps => ({
|
|
155
|
+
...delegating(session, mark, motivation, tab, null),
|
|
156
|
+
delegatingMotivation: null,
|
|
157
|
+
cancelled,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
describe('UnifiedAnnotationsPanel: a delegated job that has ended', () => {
|
|
161
|
+
it.each(motivations)(
|
|
162
|
+
"keeps a finished $motivation job's display in its panel, whose Close asks the mark unit to dismiss it",
|
|
163
|
+
({ tab, motivation }) => {
|
|
164
|
+
const { session, mark } = harness();
|
|
165
|
+
const dismissProgress = vi.spyOn(mark, 'dismissProgress');
|
|
166
|
+
renderInEnglish(
|
|
167
|
+
<UnifiedAnnotationsPanel
|
|
168
|
+
{...ended(session, mark, motivation, tab, false)}
|
|
169
|
+
/>,
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
expect(screen.getByTestId('xynolog-delegate-status')).toBeInTheDocument();
|
|
173
|
+
expect(
|
|
174
|
+
screen.getByTestId('xynolog-delegate-control'),
|
|
175
|
+
).toHaveAccessibleName('Close');
|
|
176
|
+
fireEvent.click(screen.getByTestId('xynolog-delegate-control'));
|
|
177
|
+
expect(dismissProgress).toHaveBeenCalledOnce();
|
|
178
|
+
},
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
it.each(motivations)(
|
|
182
|
+
'says a cancelled $motivation job was cancelled',
|
|
183
|
+
({ tab, motivation }) => {
|
|
184
|
+
const { session, mark } = harness();
|
|
185
|
+
renderInEnglish(
|
|
186
|
+
<UnifiedAnnotationsPanel
|
|
187
|
+
{...ended(session, mark, motivation, tab, true)}
|
|
188
|
+
/>,
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
expect(screen.getByTestId('xynolog-delegate-status').textContent).toBe(
|
|
192
|
+
'Cancelled',
|
|
193
|
+
);
|
|
194
|
+
},
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
it("shows a finished job's display in no other motivation's panel", () => {
|
|
198
|
+
const { session, mark } = harness();
|
|
199
|
+
renderInEnglish(
|
|
200
|
+
<UnifiedAnnotationsPanel
|
|
201
|
+
{...ended(session, mark, 'highlighting', 'reference', false)}
|
|
202
|
+
/>,
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
expect(screen.queryByTestId('xynolog-delegate-status')).toBeNull();
|
|
206
|
+
});
|
|
207
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The annotations panel must be able to say the annotations failed to load.
|
|
3
|
+
*
|
|
4
|
+
* Every tab in this panel derives from one `annotations` array. When that load
|
|
5
|
+
* fails terminally (B15) the array is empty — indistinguishable from a
|
|
6
|
+
* resource that genuinely has no annotations, so the panel cheerfully reports
|
|
7
|
+
* "no highlights" for a resource full of them. That is the same
|
|
8
|
+
* apparent-data-loss shape as the PDF-annotations bug, arrived at from a
|
|
9
|
+
* different direction.
|
|
10
|
+
*/
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
13
|
+
import { screen, fireEvent } from '@testing-library/react';
|
|
14
|
+
import { renderInEnglish } from '../../../../test-utils';
|
|
15
|
+
import '@testing-library/jest-dom';
|
|
16
|
+
import type { XynologSession } from '@xynolog/sdk';
|
|
17
|
+
import type {
|
|
18
|
+
LinkComponentProps,
|
|
19
|
+
RouteBuilder,
|
|
20
|
+
} from '../../../../contexts/RoutingContext';
|
|
21
|
+
import { UnifiedAnnotationsPanel } from '../UnifiedAnnotationsPanel';
|
|
22
|
+
import { ANNOTATORS } from '../../../../lib/annotation-registry';
|
|
23
|
+
import { resourceId, EventBus } from '@xynolog/core';
|
|
24
|
+
|
|
25
|
+
const TestLink = ({ href, children, ...rest }: LinkComponentProps) => (
|
|
26
|
+
<a href={href} {...rest}>
|
|
27
|
+
{children}
|
|
28
|
+
</a>
|
|
29
|
+
);
|
|
30
|
+
const testRoutes: RouteBuilder = { resourceDetail: (id) => `/r/${id}` };
|
|
31
|
+
|
|
32
|
+
function fakeSession(): XynologSession {
|
|
33
|
+
return {
|
|
34
|
+
client: {
|
|
35
|
+
bus: new EventBus(),
|
|
36
|
+
browse: { click: vi.fn() },
|
|
37
|
+
beckon: { hover: vi.fn() },
|
|
38
|
+
},
|
|
39
|
+
} as unknown as XynologSession;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type PanelProps = React.ComponentProps<typeof UnifiedAnnotationsPanel>;
|
|
43
|
+
|
|
44
|
+
const base = (): PanelProps => ({
|
|
45
|
+
session: fakeSession(),
|
|
46
|
+
mark: undefined,
|
|
47
|
+
annotations: [],
|
|
48
|
+
annotators: ANNOTATORS,
|
|
49
|
+
allEntityTypes: [],
|
|
50
|
+
pendingAnnotation: null,
|
|
51
|
+
resourceId: resourceId('res-1'),
|
|
52
|
+
Link: TestLink,
|
|
53
|
+
routes: testRoutes,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('UnifiedAnnotationsPanel — annotations load failure', () => {
|
|
57
|
+
it('reports the failure rather than presenting an empty annotation set as fact', () => {
|
|
58
|
+
renderInEnglish(
|
|
59
|
+
<UnifiedAnnotationsPanel
|
|
60
|
+
{...base()}
|
|
61
|
+
annotationsError={new Error('Resource not found')}
|
|
62
|
+
/>,
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
expect(screen.getByText(/Could not load annotations/)).toBeInTheDocument();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('offers a retry that calls back', () => {
|
|
69
|
+
const onRetryAnnotations = vi.fn();
|
|
70
|
+
renderInEnglish(
|
|
71
|
+
<UnifiedAnnotationsPanel
|
|
72
|
+
{...base()}
|
|
73
|
+
annotationsError={new Error('boom')}
|
|
74
|
+
onRetryAnnotations={onRetryAnnotations}
|
|
75
|
+
/>,
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
fireEvent.click(screen.getByRole('button', { name: 'Try again' }));
|
|
79
|
+
expect(onRetryAnnotations).toHaveBeenCalledTimes(1);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('says nothing about failure when the annotations are merely empty', () => {
|
|
83
|
+
renderInEnglish(<UnifiedAnnotationsPanel {...base()} />);
|
|
84
|
+
|
|
85
|
+
expect(
|
|
86
|
+
screen.queryByText(/Could not load annotations/),
|
|
87
|
+
).not.toBeInTheDocument();
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
creatorName,
|
|
4
|
+
renderAgentLabel,
|
|
5
|
+
renderAgentLabels,
|
|
6
|
+
} from '../agent-label';
|
|
7
|
+
import type { components } from '@xynolog/core';
|
|
8
|
+
|
|
9
|
+
type Agent = components['schemas']['Agent'];
|
|
10
|
+
|
|
11
|
+
describe('renderAgentLabel', () => {
|
|
12
|
+
describe('Software peers', () => {
|
|
13
|
+
it('is labeled by its name, then the provider and model it runs', () => {
|
|
14
|
+
const agent: Agent = {
|
|
15
|
+
'@type': 'Software',
|
|
16
|
+
'@id': 'did:web:example.com:agents:xynolog-worker',
|
|
17
|
+
name: 'my-highlighter',
|
|
18
|
+
provider: 'ollama',
|
|
19
|
+
model: 'gemma2:27b',
|
|
20
|
+
};
|
|
21
|
+
expect(renderAgentLabel(agent)).toBe(
|
|
22
|
+
'my-highlighter (ollama gemma2:27b)',
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('is labeled by its name and its model when it states no provider', () => {
|
|
27
|
+
const agent: Agent = {
|
|
28
|
+
'@type': 'Software',
|
|
29
|
+
name: 'my-highlighter',
|
|
30
|
+
model: 'gpt-4',
|
|
31
|
+
};
|
|
32
|
+
expect(renderAgentLabel(agent)).toBe('my-highlighter (gpt-4)');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('is labeled by its name and its provider when it states no model', () => {
|
|
36
|
+
const agent: Agent = {
|
|
37
|
+
'@type': 'Software',
|
|
38
|
+
name: 'my-highlighter',
|
|
39
|
+
provider: 'anthropic',
|
|
40
|
+
};
|
|
41
|
+
expect(renderAgentLabel(agent)).toBe('my-highlighter (anthropic)');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('is labeled by its provider and model when it has no profile', () => {
|
|
45
|
+
const agent: Agent = {
|
|
46
|
+
'@type': 'Software',
|
|
47
|
+
'@id': 'did:web:example.com:agents:xynolog-worker',
|
|
48
|
+
provider: 'ollama',
|
|
49
|
+
model: 'gemma2:27b',
|
|
50
|
+
};
|
|
51
|
+
expect(renderAgentLabel(agent)).toBe('ollama gemma2:27b');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('is labeled by its model alone when it has no profile and states no provider', () => {
|
|
55
|
+
const agent: Agent = {
|
|
56
|
+
'@type': 'Software',
|
|
57
|
+
model: 'gpt-4',
|
|
58
|
+
};
|
|
59
|
+
expect(renderAgentLabel(agent)).toBe('gpt-4');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('falls back to name when both provider and model are absent', () => {
|
|
63
|
+
const agent: Agent = {
|
|
64
|
+
'@type': 'Software',
|
|
65
|
+
name: 'Some Software',
|
|
66
|
+
};
|
|
67
|
+
expect(renderAgentLabel(agent)).toBe('Some Software');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('falls back to its DID when it says nothing of itself, as a generator the record supplies', () => {
|
|
71
|
+
const agent: Agent = {
|
|
72
|
+
'@type': 'Software',
|
|
73
|
+
'@id': 'did:web:example.com:agents:xynolog-worker',
|
|
74
|
+
};
|
|
75
|
+
expect(renderAgentLabel(agent)).toBe(
|
|
76
|
+
'did:web:example.com:agents:xynolog-worker',
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
describe('Person and Organization peers', () => {
|
|
82
|
+
it('renders Person name', () => {
|
|
83
|
+
const agent: Agent = {
|
|
84
|
+
'@type': 'Person',
|
|
85
|
+
'@id': 'did:web:example.com:users:alice%40example.com',
|
|
86
|
+
name: 'Alice',
|
|
87
|
+
};
|
|
88
|
+
expect(renderAgentLabel(agent)).toBe('Alice');
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('renders Organization name', () => {
|
|
92
|
+
const agent: Agent = {
|
|
93
|
+
'@type': 'Organization',
|
|
94
|
+
name: 'Acme Corp',
|
|
95
|
+
};
|
|
96
|
+
expect(renderAgentLabel(agent)).toBe('Acme Corp');
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe('Degraded shapes', () => {
|
|
101
|
+
it('falls back to @id when name is empty', () => {
|
|
102
|
+
const agent = {
|
|
103
|
+
'@type': 'Person',
|
|
104
|
+
'@id': 'did:web:example.com:users:bob%40example.com',
|
|
105
|
+
name: '',
|
|
106
|
+
} as unknown as Agent;
|
|
107
|
+
expect(renderAgentLabel(agent)).toBe(
|
|
108
|
+
'did:web:example.com:users:bob%40example.com',
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('has no label when nothing identifies the agent', () => {
|
|
113
|
+
const agent = { '@type': 'Person', name: '' } as unknown as Agent;
|
|
114
|
+
expect(renderAgentLabel(agent)).toBeUndefined();
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
describe('an agent that names itself in no way', () => {
|
|
120
|
+
const nameless = { '@type': 'Person' } as Agent;
|
|
121
|
+
|
|
122
|
+
it('is left out of a list of labels', () => {
|
|
123
|
+
const alice = { '@type': 'Person', name: 'Alice' } as Agent;
|
|
124
|
+
|
|
125
|
+
expect(renderAgentLabels([alice, nameless])).toBe('Alice');
|
|
126
|
+
expect(renderAgentLabels(nameless)).toBe('');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('has no creator name', () => {
|
|
130
|
+
expect(creatorName(nameless)).toBeUndefined();
|
|
131
|
+
expect(creatorName(undefined)).toBeUndefined();
|
|
132
|
+
expect(creatorName('did:web:example.com:users:bob')).toBe(
|
|
133
|
+
'did:web:example.com:users:bob',
|
|
134
|
+
);
|
|
135
|
+
});
|
|
136
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { components } from '@xynolog/core';
|
|
2
|
+
|
|
3
|
+
type Agent = components['schemas']['Agent'];
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Compose a display label for an Agent at render time. An agent's `name`
|
|
7
|
+
* is what its profile says it is called, filled in when the record is read.
|
|
8
|
+
* A Software agent is labeled by its name followed by the provider and model
|
|
9
|
+
* it says it runs, `my-highlighter (anthropic claude-haiku-4-5)`, and by
|
|
10
|
+
* whichever of these it has when it lacks the others. Every agent falls back
|
|
11
|
+
* to its `@id`. An agent with none of these has no label.
|
|
12
|
+
*/
|
|
13
|
+
export function renderAgentLabel(agent: Agent): string | undefined {
|
|
14
|
+
if (agent['@type'] === 'Software') {
|
|
15
|
+
const engine = [agent.provider, agent.model].filter(Boolean).join(' ');
|
|
16
|
+
if (agent.name && engine) return `${agent.name} (${engine})`;
|
|
17
|
+
return agent.name || engine || agent['@id'];
|
|
18
|
+
}
|
|
19
|
+
return agent.name || agent['@id'];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The labels of one agent or of several, joined. Empty when none of them has a label. */
|
|
23
|
+
export function renderAgentLabels(agents: Agent | Agent[]): string {
|
|
24
|
+
return (Array.isArray(agents) ? agents : [agents])
|
|
25
|
+
.map(renderAgentLabel)
|
|
26
|
+
.filter((label) => label !== undefined)
|
|
27
|
+
.join(', ');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** The name an annotation's creator goes by, when it has one. */
|
|
31
|
+
export function creatorName(
|
|
32
|
+
creator: Agent | string | undefined,
|
|
33
|
+
): string | undefined {
|
|
34
|
+
return typeof creator === 'string' ? creator : creator?.name;
|
|
35
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
Settings Panel Component
|
|
3
|
+
============================================ */
|
|
4
|
+
|
|
5
|
+
.xynolog-settings-panel {
|
|
6
|
+
padding: var(--xynolog-panel-padding);
|
|
7
|
+
background: var(--xynolog-bg-primary);
|
|
8
|
+
border-radius: var(--xynolog-panel-border-radius);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.xynolog-settings-panel__title {
|
|
12
|
+
margin: 0 0 var(--xynolog-panel-header-margin-bottom);
|
|
13
|
+
font-size: var(--xynolog-panel-title-size);
|
|
14
|
+
font-weight: var(--xynolog-panel-title-weight);
|
|
15
|
+
color: var(--xynolog-text-primary);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.xynolog-settings-panel__content {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
gap: var(--xynolog-panel-section-gap);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Field Container */
|
|
25
|
+
.xynolog-settings-panel__field {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
gap: var(--xynolog-panel-field-gap);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Button Group - layout only, buttons use .xynolog-panel-button from core/buttons.css */
|
|
32
|
+
.xynolog-settings-panel__button-group {
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: 0.5rem;
|
|
35
|
+
flex-wrap: wrap;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Loading State */
|
|
39
|
+
.xynolog-settings-panel__loading {
|
|
40
|
+
margin: 0;
|
|
41
|
+
padding: 0.5rem;
|
|
42
|
+
background: var(--xynolog-bg-secondary);
|
|
43
|
+
border-left: 3px solid var(--xynolog-color-primary-500);
|
|
44
|
+
border-radius: var(--xynolog-radius-sm);
|
|
45
|
+
font-size: var(--xynolog-text-sm);
|
|
46
|
+
color: var(--xynolog-text-primary);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[data-theme="dark"] .xynolog-settings-panel__loading {
|
|
50
|
+
background: var(--xynolog-bg-secondary);
|
|
51
|
+
border-left-color: var(--xynolog-color-primary-400);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* About — the product name, tagline, version and links. */
|
|
55
|
+
.xynolog-settings-panel__about {
|
|
56
|
+
border-top: 1px solid var(--xynolog-border-primary);
|
|
57
|
+
padding-top: 0.75rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.xynolog-settings-panel__about-name {
|
|
61
|
+
margin: 0;
|
|
62
|
+
font-size: var(--xynolog-text-sm);
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
color: var(--xynolog-text-primary);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.xynolog-settings-panel__about-tagline,
|
|
68
|
+
.xynolog-settings-panel__about-version {
|
|
69
|
+
margin: 0.15rem 0 0;
|
|
70
|
+
font-size: var(--xynolog-text-xs);
|
|
71
|
+
color: var(--xynolog-text-secondary);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.xynolog-settings-panel__about-links {
|
|
75
|
+
display: flex;
|
|
76
|
+
gap: 0.75rem;
|
|
77
|
+
margin-top: 0.5rem;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.xynolog-settings-panel__about-link {
|
|
81
|
+
font-size: var(--xynolog-text-xs);
|
|
82
|
+
color: var(--xynolog-color-primary-500);
|
|
83
|
+
background: none;
|
|
84
|
+
border: none;
|
|
85
|
+
padding: 0;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
text-decoration: underline;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
[data-theme="dark"] .xynolog-settings-panel__about-link {
|
|
91
|
+
color: var(--xynolog-color-primary-400);
|
|
92
|
+
}
|