@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
|
@@ -0,0 +1,809 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ResourceComposePage Component
|
|
3
|
+
*
|
|
4
|
+
* Pure React component for creating and editing resources.
|
|
5
|
+
* Supports two modes: new resource and clone. (Reference completion moved
|
|
6
|
+
* into the resolve wizard, as its in-modal compose step.)
|
|
7
|
+
* All dependencies passed as props - no Next.js hooks!
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React, { useState, useEffect } from 'react';
|
|
11
|
+
import {
|
|
12
|
+
capabilitiesOf,
|
|
13
|
+
AUTHORABLE_MEDIA_TYPES,
|
|
14
|
+
MEDIA_TYPES,
|
|
15
|
+
mediaTypeForExtension,
|
|
16
|
+
isSupportedMediaType,
|
|
17
|
+
LOCALES,
|
|
18
|
+
folderOf,
|
|
19
|
+
proposeStoragePath,
|
|
20
|
+
getStorageUri,
|
|
21
|
+
} from '@xynolog/core';
|
|
22
|
+
import type { SupportedMediaType } from '@xynolog/core';
|
|
23
|
+
import type { UploadProgress } from '@xynolog/sdk';
|
|
24
|
+
import { type CloneData } from '../state/compose-page-state-unit';
|
|
25
|
+
import {
|
|
26
|
+
COMMON_PANELS,
|
|
27
|
+
type ToolbarPanelType,
|
|
28
|
+
} from '../../../state/shell-state-unit';
|
|
29
|
+
import {
|
|
30
|
+
type ToolbarPanelsProps,
|
|
31
|
+
type ToolbarProps,
|
|
32
|
+
} from '../../../components/Toolbar';
|
|
33
|
+
import { buttonStyles } from '../../../lib/button-styles';
|
|
34
|
+
import { CodeMirrorRenderer } from '../../../components/CodeMirrorRenderer';
|
|
35
|
+
import { useFormAnnouncements } from '../../../components/LiveRegion';
|
|
36
|
+
import { useLineNumbers } from '../../../contexts/LineNumbersContext';
|
|
37
|
+
import { UploadProgressBar } from './UploadProgressBar';
|
|
38
|
+
import type { ResolvedTheme } from '../../../contexts/ThemeContext';
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Big tent: every registry type is uploadable. The `accept` hint lists all
|
|
42
|
+
* known extensions — it's only a hint; `handleFileUpload` never rejects.
|
|
43
|
+
*/
|
|
44
|
+
const UPLOAD_ACCEPT = Object.values(MEDIA_TYPES)
|
|
45
|
+
.map((c) => c.extension)
|
|
46
|
+
.join(',');
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Detection chain for uploaded files (same spirit as the CLI):
|
|
50
|
+
* 1. the browser's `file.type`, if it names a registry member;
|
|
51
|
+
* 2. otherwise the filename extension (`file.type` is routinely empty for
|
|
52
|
+
* `.md` and friends);
|
|
53
|
+
* 3. otherwise `application/octet-stream` — itself a registry member, so
|
|
54
|
+
* under the big tent every file is uploadable.
|
|
55
|
+
*/
|
|
56
|
+
function detectUploadMediaType(file: File): string {
|
|
57
|
+
if (file.type && isSupportedMediaType(file.type)) return file.type;
|
|
58
|
+
if (file.name.includes('.')) {
|
|
59
|
+
const byExt = mediaTypeForExtension(
|
|
60
|
+
file.name.slice(file.name.lastIndexOf('.')),
|
|
61
|
+
);
|
|
62
|
+
if (byExt) return byExt;
|
|
63
|
+
}
|
|
64
|
+
return 'application/octet-stream';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface ResourceComposePageProps {
|
|
68
|
+
mode: 'new' | 'clone';
|
|
69
|
+
cloneData?: CloneData | null;
|
|
70
|
+
|
|
71
|
+
// Available options
|
|
72
|
+
availableEntityTypes: string[];
|
|
73
|
+
|
|
74
|
+
// Initial values
|
|
75
|
+
initialLocale: string;
|
|
76
|
+
|
|
77
|
+
// UI state
|
|
78
|
+
theme: ResolvedTheme;
|
|
79
|
+
hoverDelayMs: number;
|
|
80
|
+
activePanel: ToolbarPanelType | null;
|
|
81
|
+
|
|
82
|
+
// Actions
|
|
83
|
+
onSaveResource: (params: SaveResourceParams) => Promise<void>;
|
|
84
|
+
onCancel: () => void;
|
|
85
|
+
/** Choose a destination directory and return its path relative to the KB root. */
|
|
86
|
+
onChooseStorageDirectory?: (
|
|
87
|
+
suggestedDirectory: string,
|
|
88
|
+
) => Promise<string | null>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Live upload-progress for the in-flight save. Resolved by the route
|
|
92
|
+
* shell from `composeVM.uploadProgress$`. `null` between saves and
|
|
93
|
+
* after completion. When non-null, the form disables Save and the
|
|
94
|
+
* inline `<UploadProgressBar />` below the action buttons renders.
|
|
95
|
+
*/
|
|
96
|
+
uploadProgress?: UploadProgress | null;
|
|
97
|
+
|
|
98
|
+
// Translations
|
|
99
|
+
translations: {
|
|
100
|
+
title: string;
|
|
101
|
+
titleEditClone: string;
|
|
102
|
+
subtitleClone: string;
|
|
103
|
+
resourceName: string;
|
|
104
|
+
resourceNamePlaceholder: string;
|
|
105
|
+
entityTypes: string;
|
|
106
|
+
language: string;
|
|
107
|
+
contentSource: string;
|
|
108
|
+
uploadFile: string;
|
|
109
|
+
uploadFileDescription: string;
|
|
110
|
+
writeContent: string;
|
|
111
|
+
writeContentDescription: string;
|
|
112
|
+
dropFileOrClick: string;
|
|
113
|
+
supportedFormats: string;
|
|
114
|
+
mediaType: string;
|
|
115
|
+
autoDetected: string;
|
|
116
|
+
format: string;
|
|
117
|
+
content: string;
|
|
118
|
+
resourceContent: string;
|
|
119
|
+
encoding: string;
|
|
120
|
+
archiveOriginal: string;
|
|
121
|
+
cancel: string;
|
|
122
|
+
saving: string;
|
|
123
|
+
creating: string;
|
|
124
|
+
saveClonedResource: string;
|
|
125
|
+
createResource: string;
|
|
126
|
+
chooseFolder?: string;
|
|
127
|
+
locationHint?: string;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// Component dependencies
|
|
131
|
+
ToolbarPanels: React.ComponentType<ToolbarPanelsProps>;
|
|
132
|
+
Toolbar: React.ComponentType<ToolbarProps<ToolbarPanelType>>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface SaveResourceParams {
|
|
136
|
+
mode: 'new' | 'clone';
|
|
137
|
+
name: string;
|
|
138
|
+
storageUri: string;
|
|
139
|
+
content?: string;
|
|
140
|
+
file?: File;
|
|
141
|
+
format?: string;
|
|
142
|
+
charset?: string;
|
|
143
|
+
entityTypes?: string[];
|
|
144
|
+
language: string;
|
|
145
|
+
archiveOriginal?: boolean;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function ResourceComposePage({
|
|
149
|
+
mode,
|
|
150
|
+
cloneData,
|
|
151
|
+
availableEntityTypes,
|
|
152
|
+
initialLocale,
|
|
153
|
+
theme,
|
|
154
|
+
hoverDelayMs,
|
|
155
|
+
activePanel,
|
|
156
|
+
onSaveResource,
|
|
157
|
+
onCancel,
|
|
158
|
+
onChooseStorageDirectory,
|
|
159
|
+
uploadProgress = null,
|
|
160
|
+
translations: t,
|
|
161
|
+
ToolbarPanels,
|
|
162
|
+
Toolbar,
|
|
163
|
+
}: ResourceComposePageProps) {
|
|
164
|
+
// Form announcements
|
|
165
|
+
const { announceFormSubmitting, announceFormSuccess, announceFormError } =
|
|
166
|
+
useFormAnnouncements();
|
|
167
|
+
|
|
168
|
+
// Shared display setting (LineNumbersContext) — was a prop threaded from
|
|
169
|
+
// the route, which desynced it from the Settings toggle.
|
|
170
|
+
const { showLineNumbers } = useLineNumbers();
|
|
171
|
+
|
|
172
|
+
// Form state
|
|
173
|
+
const [newResourceName, setNewResourceName] = useState('');
|
|
174
|
+
const [newResourceContent, setNewResourceContent] = useState('');
|
|
175
|
+
const [selectedEntityTypes, setSelectedEntityTypes] = useState<string[]>([]);
|
|
176
|
+
const [isCreating, setIsCreating] = useState(false);
|
|
177
|
+
|
|
178
|
+
// Content input method selection
|
|
179
|
+
const [inputMethod, setInputMethod] = useState<'upload' | 'write'>('write');
|
|
180
|
+
|
|
181
|
+
// File upload state
|
|
182
|
+
const [uploadedFile, setUploadedFile] = useState<File | null>(null);
|
|
183
|
+
const [fileMimeType, setFileMimeType] = useState<string>('text/markdown');
|
|
184
|
+
const [filePreviewUrl, setFilePreviewUrl] = useState<string | null>(null);
|
|
185
|
+
const [isDragOver, setIsDragOver] = useState(false);
|
|
186
|
+
|
|
187
|
+
// Format selection for manual content entry
|
|
188
|
+
const [selectedFormat, setSelectedFormat] = useState<string>('text/markdown');
|
|
189
|
+
|
|
190
|
+
// Language selection - default to current user locale
|
|
191
|
+
const [selectedLanguage, setSelectedLanguage] =
|
|
192
|
+
useState<string>(initialLocale);
|
|
193
|
+
|
|
194
|
+
// Character encoding selection - default to UTF-8 (empty string means use default)
|
|
195
|
+
const [selectedCharset, setSelectedCharset] = useState<string>('');
|
|
196
|
+
|
|
197
|
+
// Working-tree path (bare, no protocol prefix) — converted to file:// URI on submit
|
|
198
|
+
const [storagePath, setStoragePath] = useState('');
|
|
199
|
+
const [storageDirectory, setStorageDirectory] = useState<string | null>(null);
|
|
200
|
+
const [choosingStorageDirectory, setChoosingStorageDirectory] =
|
|
201
|
+
useState(false);
|
|
202
|
+
const [storageLocationError, setStorageLocationError] = useState<
|
|
203
|
+
string | null
|
|
204
|
+
>(null);
|
|
205
|
+
|
|
206
|
+
// Archive original checkbox (for clones only)
|
|
207
|
+
const [archiveOriginal, setArchiveOriginal] = useState(true);
|
|
208
|
+
|
|
209
|
+
// The Save location starts filled and follows the title until the user
|
|
210
|
+
// takes it over; `pathTouched` is derived, so clearing restores the proposal.
|
|
211
|
+
// A clone proposes beside its source; a new resource proposes at the root.
|
|
212
|
+
const composeFormat: SupportedMediaType = isSupportedMediaType(selectedFormat)
|
|
213
|
+
? selectedFormat
|
|
214
|
+
: 'text/markdown';
|
|
215
|
+
const pathTouched = storagePath !== '';
|
|
216
|
+
const proposedPath = pathTouched
|
|
217
|
+
? storagePath
|
|
218
|
+
: proposeStoragePath(
|
|
219
|
+
mode === 'clone' && cloneData
|
|
220
|
+
? folderOf(getStorageUri(cloneData.sourceResource))
|
|
221
|
+
: '',
|
|
222
|
+
newResourceName,
|
|
223
|
+
composeFormat,
|
|
224
|
+
);
|
|
225
|
+
const proposedFilename = proposedPath.split('/').filter(Boolean).at(-1) ?? '';
|
|
226
|
+
const effectivePath =
|
|
227
|
+
onChooseStorageDirectory && storageDirectory !== null
|
|
228
|
+
? [storageDirectory, proposedFilename].filter(Boolean).join('/')
|
|
229
|
+
: proposedPath;
|
|
230
|
+
|
|
231
|
+
// Initialize form data based on mode
|
|
232
|
+
useEffect(() => {
|
|
233
|
+
if (mode === 'clone' && cloneData) {
|
|
234
|
+
setNewResourceName(cloneData.sourceResource.name);
|
|
235
|
+
setNewResourceContent(cloneData.sourceContent);
|
|
236
|
+
}
|
|
237
|
+
}, [mode, cloneData]);
|
|
238
|
+
|
|
239
|
+
// Handle file upload
|
|
240
|
+
const handleFileUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
241
|
+
const file = e.target.files?.[0];
|
|
242
|
+
if (!file) return;
|
|
243
|
+
applyUploadedFile(file);
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
// One application path for both entries into the dropzone: the file-input
|
|
247
|
+
// change (click) and a real drag-and-drop (the input is display:none, so
|
|
248
|
+
// native input drops can never land — the label owns the drop).
|
|
249
|
+
const applyUploadedFile = (file: File) => {
|
|
250
|
+
const detectedMediaType = detectUploadMediaType(file);
|
|
251
|
+
setUploadedFile(file);
|
|
252
|
+
setFileMimeType(detectedMediaType);
|
|
253
|
+
setInputMethod('upload');
|
|
254
|
+
|
|
255
|
+
// Set file name as default resource name if empty
|
|
256
|
+
if (!newResourceName) {
|
|
257
|
+
const nameWithoutExt = file.name.replace(/\.[^/.]+$/, '');
|
|
258
|
+
setNewResourceName(nameWithoutExt);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Images and PDFs get an object-URL preview; everything else reads as text.
|
|
262
|
+
const detectedRender = capabilitiesOf(detectedMediaType)?.render;
|
|
263
|
+
if (detectedRender === 'image' || detectedRender === 'pdf') {
|
|
264
|
+
const previewUrl = URL.createObjectURL(file);
|
|
265
|
+
setFilePreviewUrl(previewUrl);
|
|
266
|
+
} else {
|
|
267
|
+
// For text files, read content
|
|
268
|
+
const reader = new FileReader();
|
|
269
|
+
reader.onload = (event) => {
|
|
270
|
+
const content = event.target?.result as string;
|
|
271
|
+
setNewResourceContent(content);
|
|
272
|
+
};
|
|
273
|
+
reader.readAsText(file);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
// Cleanup preview URL on unmount
|
|
278
|
+
useEffect(() => {
|
|
279
|
+
return () => {
|
|
280
|
+
if (filePreviewUrl) {
|
|
281
|
+
URL.revokeObjectURL(filePreviewUrl);
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
}, [filePreviewUrl]);
|
|
285
|
+
|
|
286
|
+
const handleSaveResource = async (e: React.FormEvent) => {
|
|
287
|
+
e.preventDefault();
|
|
288
|
+
if (!newResourceName.trim()) return;
|
|
289
|
+
|
|
290
|
+
setIsCreating(true);
|
|
291
|
+
announceFormSubmitting();
|
|
292
|
+
|
|
293
|
+
try {
|
|
294
|
+
const params: SaveResourceParams = {
|
|
295
|
+
mode,
|
|
296
|
+
name: newResourceName,
|
|
297
|
+
storageUri: `file://${effectivePath}`,
|
|
298
|
+
content: newResourceContent,
|
|
299
|
+
format: uploadedFile ? fileMimeType : selectedFormat,
|
|
300
|
+
entityTypes: selectedEntityTypes,
|
|
301
|
+
language: selectedLanguage,
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
if (uploadedFile) {
|
|
305
|
+
params.file = uploadedFile;
|
|
306
|
+
}
|
|
307
|
+
if (selectedCharset) {
|
|
308
|
+
params.charset = selectedCharset;
|
|
309
|
+
}
|
|
310
|
+
if (mode === 'clone') {
|
|
311
|
+
params.archiveOriginal = archiveOriginal;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
await onSaveResource(params);
|
|
315
|
+
|
|
316
|
+
// Announce success based on mode
|
|
317
|
+
const successMessage =
|
|
318
|
+
mode === 'clone'
|
|
319
|
+
? 'Resource cloned successfully'
|
|
320
|
+
: 'Resource created successfully';
|
|
321
|
+
announceFormSuccess(successMessage);
|
|
322
|
+
} catch (error) {
|
|
323
|
+
announceFormError('Failed to save resource. Please try again.');
|
|
324
|
+
throw error;
|
|
325
|
+
} finally {
|
|
326
|
+
setIsCreating(false);
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
const chooseStorageDirectory = async () => {
|
|
331
|
+
if (!onChooseStorageDirectory) return;
|
|
332
|
+
setChoosingStorageDirectory(true);
|
|
333
|
+
setStorageLocationError(null);
|
|
334
|
+
try {
|
|
335
|
+
const pathParts = effectivePath.split('/');
|
|
336
|
+
pathParts.pop();
|
|
337
|
+
const chosen = await onChooseStorageDirectory(pathParts.join('/'));
|
|
338
|
+
if (chosen !== null) setStorageDirectory(chosen);
|
|
339
|
+
} catch (error) {
|
|
340
|
+
setStorageLocationError(
|
|
341
|
+
error instanceof Error ? error.message : String(error),
|
|
342
|
+
);
|
|
343
|
+
} finally {
|
|
344
|
+
setChoosingStorageDirectory(false);
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
const isClone = mode === 'clone';
|
|
349
|
+
|
|
350
|
+
return (
|
|
351
|
+
<div
|
|
352
|
+
className={`xynolog-page${activePanel && COMMON_PANELS.includes(activePanel) ? ' xynolog-page--panel-open' : ''}`}
|
|
353
|
+
>
|
|
354
|
+
{/* Main Content Area */}
|
|
355
|
+
<div className="xynolog-page__content xynolog-page__compose">
|
|
356
|
+
{/* Page Title */}
|
|
357
|
+
<div className="xynolog-page__header">
|
|
358
|
+
<h1 className="xynolog-page__title">
|
|
359
|
+
{isClone ? t.titleEditClone : t.title}
|
|
360
|
+
</h1>
|
|
361
|
+
{isClone && (
|
|
362
|
+
<p className="xynolog-page__subtitle">{t.subtitleClone}</p>
|
|
363
|
+
)}
|
|
364
|
+
</div>
|
|
365
|
+
|
|
366
|
+
{/* Create Form */}
|
|
367
|
+
<div className="xynolog-form">
|
|
368
|
+
<form
|
|
369
|
+
onSubmit={handleSaveResource}
|
|
370
|
+
className="xynolog-form__fields xynolog-compose-grid"
|
|
371
|
+
>
|
|
372
|
+
{/* Left column: metadata */}
|
|
373
|
+
<div className="xynolog-compose-grid__meta">
|
|
374
|
+
{/* Name */}
|
|
375
|
+
<div className="xynolog-form__field">
|
|
376
|
+
<label htmlFor="docName" className="xynolog-form__label">
|
|
377
|
+
{t.resourceName}
|
|
378
|
+
</label>
|
|
379
|
+
<input
|
|
380
|
+
id="docName"
|
|
381
|
+
type="text"
|
|
382
|
+
value={newResourceName}
|
|
383
|
+
onChange={(e) => setNewResourceName(e.target.value)}
|
|
384
|
+
placeholder={t.resourceNamePlaceholder}
|
|
385
|
+
className="xynolog-input"
|
|
386
|
+
required
|
|
387
|
+
disabled={isCreating}
|
|
388
|
+
/>
|
|
389
|
+
</div>
|
|
390
|
+
|
|
391
|
+
{/* Storage URI */}
|
|
392
|
+
<div className="xynolog-form__field">
|
|
393
|
+
{onChooseStorageDirectory ? (
|
|
394
|
+
<div className="xynolog-form__label">
|
|
395
|
+
Location in Knowledge Base
|
|
396
|
+
</div>
|
|
397
|
+
) : (
|
|
398
|
+
<label htmlFor="storagePath" className="xynolog-form__label">
|
|
399
|
+
Save location
|
|
400
|
+
</label>
|
|
401
|
+
)}
|
|
402
|
+
{onChooseStorageDirectory ? (
|
|
403
|
+
<div className="xynolog-form__location-picker">
|
|
404
|
+
<code id="storagePath" title={effectivePath}>
|
|
405
|
+
file://{effectivePath}
|
|
406
|
+
</code>
|
|
407
|
+
<button
|
|
408
|
+
type="button"
|
|
409
|
+
className="xynolog-form__location-button"
|
|
410
|
+
onClick={() => void chooseStorageDirectory()}
|
|
411
|
+
disabled={isCreating || choosingStorageDirectory}
|
|
412
|
+
>
|
|
413
|
+
{choosingStorageDirectory
|
|
414
|
+
? 'Choosing…'
|
|
415
|
+
: (t.chooseFolder ?? 'Choose folder…')}
|
|
416
|
+
</button>
|
|
417
|
+
</div>
|
|
418
|
+
) : (
|
|
419
|
+
<div className="xynolog-input-addon">
|
|
420
|
+
<span className="xynolog-input-addon__prefix">file://</span>
|
|
421
|
+
<input
|
|
422
|
+
id="storagePath"
|
|
423
|
+
type="text"
|
|
424
|
+
value={effectivePath}
|
|
425
|
+
onChange={(e) => setStoragePath(e.target.value)}
|
|
426
|
+
placeholder="docs/my-resource.md"
|
|
427
|
+
required
|
|
428
|
+
className="xynolog-input xynolog-input--addon"
|
|
429
|
+
disabled={isCreating}
|
|
430
|
+
/>
|
|
431
|
+
</div>
|
|
432
|
+
)}
|
|
433
|
+
{onChooseStorageDirectory && (
|
|
434
|
+
<p className="xynolog-form__location-hint">
|
|
435
|
+
{t.locationHint ??
|
|
436
|
+
'The resource name determines the filename. Choose a folder within this Knowledge Base.'}
|
|
437
|
+
</p>
|
|
438
|
+
)}
|
|
439
|
+
{storageLocationError && (
|
|
440
|
+
<p className="xynolog-form__location-error" role="alert">
|
|
441
|
+
{storageLocationError}
|
|
442
|
+
</p>
|
|
443
|
+
)}
|
|
444
|
+
</div>
|
|
445
|
+
|
|
446
|
+
{/* Entity Types Selection */}
|
|
447
|
+
{
|
|
448
|
+
<div className="xynolog-form__field xynolog-form__entity-types">
|
|
449
|
+
<div className="xynolog-form__label">{t.entityTypes}</div>
|
|
450
|
+
<div
|
|
451
|
+
className="xynolog-form__entity-type-buttons"
|
|
452
|
+
role="group"
|
|
453
|
+
aria-describedby="entity-types-description"
|
|
454
|
+
>
|
|
455
|
+
{availableEntityTypes.map((type: string) => {
|
|
456
|
+
const isSelected = selectedEntityTypes.includes(type);
|
|
457
|
+
return (
|
|
458
|
+
<button
|
|
459
|
+
key={type}
|
|
460
|
+
type="button"
|
|
461
|
+
onClick={() => {
|
|
462
|
+
setSelectedEntityTypes((prev) =>
|
|
463
|
+
prev.includes(type)
|
|
464
|
+
? prev.filter((t) => t !== type)
|
|
465
|
+
: [...prev, type],
|
|
466
|
+
);
|
|
467
|
+
}}
|
|
468
|
+
className="xynolog-form__entity-type-button"
|
|
469
|
+
data-selected={isSelected}
|
|
470
|
+
disabled={isCreating}
|
|
471
|
+
aria-pressed={isSelected}
|
|
472
|
+
aria-label={`${type} entity type, ${isSelected ? 'selected' : 'not selected'}`}
|
|
473
|
+
>
|
|
474
|
+
{type}
|
|
475
|
+
</button>
|
|
476
|
+
);
|
|
477
|
+
})}
|
|
478
|
+
</div>
|
|
479
|
+
{selectedEntityTypes.length > 0 && (
|
|
480
|
+
<div
|
|
481
|
+
className="sr-only"
|
|
482
|
+
aria-live="polite"
|
|
483
|
+
aria-atomic="true"
|
|
484
|
+
>
|
|
485
|
+
{selectedEntityTypes.length} entity type
|
|
486
|
+
{selectedEntityTypes.length !== 1
|
|
487
|
+
? 's'
|
|
488
|
+
: ''} selected: {selectedEntityTypes.join(', ')}
|
|
489
|
+
</div>
|
|
490
|
+
)}
|
|
491
|
+
</div>
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
{/* Language Selector */}
|
|
495
|
+
<div className="xynolog-form__field">
|
|
496
|
+
<label
|
|
497
|
+
htmlFor="language-select"
|
|
498
|
+
className="xynolog-form__label"
|
|
499
|
+
>
|
|
500
|
+
{t.language}
|
|
501
|
+
</label>
|
|
502
|
+
<select
|
|
503
|
+
id="language-select"
|
|
504
|
+
value={selectedLanguage}
|
|
505
|
+
onChange={(e) => setSelectedLanguage(e.target.value)}
|
|
506
|
+
disabled={isCreating}
|
|
507
|
+
className="xynolog-select"
|
|
508
|
+
>
|
|
509
|
+
{LOCALES.map((lang) => (
|
|
510
|
+
<option key={lang.code} value={lang.code}>
|
|
511
|
+
{lang.nativeName}
|
|
512
|
+
</option>
|
|
513
|
+
))}
|
|
514
|
+
</select>
|
|
515
|
+
</div>
|
|
516
|
+
</div>
|
|
517
|
+
{/* end xynolog-compose-grid__meta */}
|
|
518
|
+
|
|
519
|
+
{/* Right column: content */}
|
|
520
|
+
<div className="xynolog-compose-grid__content">
|
|
521
|
+
{/* Content Source Toggle - only show for new resources */}
|
|
522
|
+
{!isClone && (
|
|
523
|
+
<div className="xynolog-form__field">
|
|
524
|
+
<label className="xynolog-form__label">
|
|
525
|
+
{t.contentSource}
|
|
526
|
+
</label>
|
|
527
|
+
<div className="xynolog-form__content-source-toggle">
|
|
528
|
+
<button
|
|
529
|
+
type="button"
|
|
530
|
+
onClick={() => setInputMethod('upload')}
|
|
531
|
+
disabled={isCreating}
|
|
532
|
+
className="xynolog-form__content-source-button"
|
|
533
|
+
data-active={inputMethod === 'upload'}
|
|
534
|
+
>
|
|
535
|
+
<div className="xynolog-form__content-source-icon-wrapper">
|
|
536
|
+
<span className="xynolog-form__content-source-icon">
|
|
537
|
+
📎
|
|
538
|
+
</span>
|
|
539
|
+
<span className="xynolog-form__content-source-label">
|
|
540
|
+
{t.uploadFile}
|
|
541
|
+
</span>
|
|
542
|
+
</div>
|
|
543
|
+
<div className="xynolog-form__content-source-description">
|
|
544
|
+
{t.uploadFileDescription}
|
|
545
|
+
</div>
|
|
546
|
+
</button>
|
|
547
|
+
|
|
548
|
+
<button
|
|
549
|
+
type="button"
|
|
550
|
+
onClick={() => setInputMethod('write')}
|
|
551
|
+
disabled={isCreating}
|
|
552
|
+
className="xynolog-form__content-source-button"
|
|
553
|
+
data-active={inputMethod === 'write'}
|
|
554
|
+
>
|
|
555
|
+
<div className="xynolog-form__content-source-icon-wrapper">
|
|
556
|
+
<span className="xynolog-form__content-source-icon">
|
|
557
|
+
✍️
|
|
558
|
+
</span>
|
|
559
|
+
<span className="xynolog-form__content-source-label">
|
|
560
|
+
{t.writeContent}
|
|
561
|
+
</span>
|
|
562
|
+
</div>
|
|
563
|
+
<div className="xynolog-form__content-source-description">
|
|
564
|
+
{t.writeContentDescription}
|
|
565
|
+
</div>
|
|
566
|
+
</button>
|
|
567
|
+
</div>
|
|
568
|
+
</div>
|
|
569
|
+
)}
|
|
570
|
+
|
|
571
|
+
{/* Upload File Section */}
|
|
572
|
+
{!isClone && inputMethod === 'upload' && (
|
|
573
|
+
<div className="xynolog-form__upload-section">
|
|
574
|
+
<div>
|
|
575
|
+
<div className="xynolog-form__upload-container">
|
|
576
|
+
<label
|
|
577
|
+
className="xynolog-form__upload-dropzone"
|
|
578
|
+
data-drag-over={isDragOver ? 'true' : 'false'}
|
|
579
|
+
onDragOver={(e) => {
|
|
580
|
+
e.preventDefault();
|
|
581
|
+
setIsDragOver(true);
|
|
582
|
+
}}
|
|
583
|
+
onDragLeave={() => setIsDragOver(false)}
|
|
584
|
+
onDrop={(e) => {
|
|
585
|
+
e.preventDefault();
|
|
586
|
+
setIsDragOver(false);
|
|
587
|
+
const file = e.dataTransfer.files?.[0];
|
|
588
|
+
if (file && !isCreating) applyUploadedFile(file);
|
|
589
|
+
}}
|
|
590
|
+
>
|
|
591
|
+
<div className="xynolog-form__upload-area">
|
|
592
|
+
<input
|
|
593
|
+
type="file"
|
|
594
|
+
accept={UPLOAD_ACCEPT}
|
|
595
|
+
onChange={handleFileUpload}
|
|
596
|
+
className="xynolog-form__upload-input"
|
|
597
|
+
disabled={isCreating}
|
|
598
|
+
/>
|
|
599
|
+
<p className="xynolog-form__upload-text">
|
|
600
|
+
{uploadedFile
|
|
601
|
+
? uploadedFile.name
|
|
602
|
+
: t.dropFileOrClick}
|
|
603
|
+
</p>
|
|
604
|
+
<p className="xynolog-form__upload-hint">
|
|
605
|
+
{t.supportedFormats}
|
|
606
|
+
</p>
|
|
607
|
+
</div>
|
|
608
|
+
</label>
|
|
609
|
+
{uploadedFile && (
|
|
610
|
+
<button
|
|
611
|
+
type="button"
|
|
612
|
+
onClick={() => {
|
|
613
|
+
setUploadedFile(null);
|
|
614
|
+
setFilePreviewUrl(null);
|
|
615
|
+
setFileMimeType('text/markdown');
|
|
616
|
+
}}
|
|
617
|
+
className="xynolog-button xynolog-button--danger xynolog-button--small"
|
|
618
|
+
disabled={isCreating}
|
|
619
|
+
>
|
|
620
|
+
Clear
|
|
621
|
+
</button>
|
|
622
|
+
)}
|
|
623
|
+
</div>
|
|
624
|
+
</div>
|
|
625
|
+
|
|
626
|
+
{/* Media Type Display - Auto-detected */}
|
|
627
|
+
{uploadedFile && (
|
|
628
|
+
<div className="xynolog-form__media-type">
|
|
629
|
+
<span className="xynolog-form__media-type-label">
|
|
630
|
+
{t.mediaType}:
|
|
631
|
+
</span>
|
|
632
|
+
<code className="xynolog-form__media-type-value">
|
|
633
|
+
{fileMimeType}
|
|
634
|
+
</code>
|
|
635
|
+
<span
|
|
636
|
+
className="xynolog-form__media-type-lock"
|
|
637
|
+
title={t.autoDetected}
|
|
638
|
+
>
|
|
639
|
+
🔒
|
|
640
|
+
</span>
|
|
641
|
+
</div>
|
|
642
|
+
)}
|
|
643
|
+
|
|
644
|
+
{/* Image Preview */}
|
|
645
|
+
{uploadedFile &&
|
|
646
|
+
filePreviewUrl &&
|
|
647
|
+
capabilitiesOf(fileMimeType)?.render === 'image' && (
|
|
648
|
+
<div className="xynolog-form__image-preview">
|
|
649
|
+
<p className="xynolog-form__image-preview-label">
|
|
650
|
+
Preview:
|
|
651
|
+
</p>
|
|
652
|
+
<div className="xynolog-form__image-preview-container">
|
|
653
|
+
<img
|
|
654
|
+
src={filePreviewUrl}
|
|
655
|
+
alt="Upload preview"
|
|
656
|
+
className="xynolog-form__image-preview-img"
|
|
657
|
+
/>
|
|
658
|
+
</div>
|
|
659
|
+
</div>
|
|
660
|
+
)}
|
|
661
|
+
</div>
|
|
662
|
+
)}
|
|
663
|
+
|
|
664
|
+
{/* Write Content Section */}
|
|
665
|
+
{(isClone || inputMethod === 'write') && (
|
|
666
|
+
<div className="xynolog-form__write-section">
|
|
667
|
+
{/* Format Selector - only for manual entry, not clones */}
|
|
668
|
+
{!isClone && (
|
|
669
|
+
<div className="xynolog-form__field">
|
|
670
|
+
<label
|
|
671
|
+
htmlFor="format-select"
|
|
672
|
+
className="xynolog-form__label"
|
|
673
|
+
>
|
|
674
|
+
{t.format}
|
|
675
|
+
</label>
|
|
676
|
+
<select
|
|
677
|
+
id="format-select"
|
|
678
|
+
value={selectedFormat}
|
|
679
|
+
onChange={(e) => setSelectedFormat(e.target.value)}
|
|
680
|
+
disabled={isCreating}
|
|
681
|
+
className="xynolog-select"
|
|
682
|
+
>
|
|
683
|
+
{AUTHORABLE_MEDIA_TYPES.map((mt) => (
|
|
684
|
+
<option key={mt} value={mt}>
|
|
685
|
+
{capabilitiesOf(mt)?.label ?? mt} ({mt})
|
|
686
|
+
</option>
|
|
687
|
+
))}
|
|
688
|
+
</select>
|
|
689
|
+
</div>
|
|
690
|
+
)}
|
|
691
|
+
|
|
692
|
+
{/* Content Editor */}
|
|
693
|
+
<div className="xynolog-form__field xynolog-form__editor">
|
|
694
|
+
<label className="xynolog-form__label">
|
|
695
|
+
{isClone ? t.resourceContent : t.content}
|
|
696
|
+
</label>
|
|
697
|
+
<div
|
|
698
|
+
className="xynolog-form__editor-wrapper"
|
|
699
|
+
lang={selectedLanguage}
|
|
700
|
+
>
|
|
701
|
+
<CodeMirrorRenderer
|
|
702
|
+
content={newResourceContent}
|
|
703
|
+
editable={!isCreating}
|
|
704
|
+
sourceView={true}
|
|
705
|
+
showLineNumbers={showLineNumbers}
|
|
706
|
+
hoverDelayMs={hoverDelayMs}
|
|
707
|
+
onChange={(newContent) =>
|
|
708
|
+
setNewResourceContent(newContent)
|
|
709
|
+
}
|
|
710
|
+
/>
|
|
711
|
+
</div>
|
|
712
|
+
</div>
|
|
713
|
+
|
|
714
|
+
{/* Encoding Selector - only for manual text entry */}
|
|
715
|
+
{!isClone && (
|
|
716
|
+
<div className="xynolog-form__field">
|
|
717
|
+
<label
|
|
718
|
+
htmlFor="charset-select"
|
|
719
|
+
className="xynolog-form__label"
|
|
720
|
+
>
|
|
721
|
+
{t.encoding}
|
|
722
|
+
</label>
|
|
723
|
+
<select
|
|
724
|
+
id="charset-select"
|
|
725
|
+
value={selectedCharset}
|
|
726
|
+
onChange={(e) => setSelectedCharset(e.target.value)}
|
|
727
|
+
disabled={isCreating}
|
|
728
|
+
className="xynolog-select"
|
|
729
|
+
>
|
|
730
|
+
<option value="">UTF-8 (default)</option>
|
|
731
|
+
<option value="iso-8859-1">ISO-8859-1 (Latin-1)</option>
|
|
732
|
+
<option value="windows-1252">Windows-1252</option>
|
|
733
|
+
<option value="ascii">ASCII</option>
|
|
734
|
+
<option value="utf-16le">UTF-16LE</option>
|
|
735
|
+
</select>
|
|
736
|
+
</div>
|
|
737
|
+
)}
|
|
738
|
+
</div>
|
|
739
|
+
)}
|
|
740
|
+
|
|
741
|
+
{/* Archive Original Checkbox (for clones only) */}
|
|
742
|
+
{isClone && (
|
|
743
|
+
<div className="xynolog-form__checkbox-field">
|
|
744
|
+
<input
|
|
745
|
+
id="archiveOriginal"
|
|
746
|
+
type="checkbox"
|
|
747
|
+
checked={archiveOriginal}
|
|
748
|
+
onChange={(e) => setArchiveOriginal(e.target.checked)}
|
|
749
|
+
className="xynolog-checkbox"
|
|
750
|
+
disabled={isCreating}
|
|
751
|
+
/>
|
|
752
|
+
<label
|
|
753
|
+
htmlFor="archiveOriginal"
|
|
754
|
+
className="xynolog-form__checkbox-label"
|
|
755
|
+
>
|
|
756
|
+
{t.archiveOriginal}
|
|
757
|
+
</label>
|
|
758
|
+
</div>
|
|
759
|
+
)}
|
|
760
|
+
</div>
|
|
761
|
+
{/* end xynolog-compose-grid__content */}
|
|
762
|
+
|
|
763
|
+
{/* Action Buttons */}
|
|
764
|
+
<div className="xynolog-form__actions">
|
|
765
|
+
<button
|
|
766
|
+
type="button"
|
|
767
|
+
onClick={onCancel}
|
|
768
|
+
disabled={isCreating || uploadProgress !== null}
|
|
769
|
+
className={buttonStyles.tertiary.base}
|
|
770
|
+
>
|
|
771
|
+
{t.cancel}
|
|
772
|
+
</button>
|
|
773
|
+
<button
|
|
774
|
+
type="submit"
|
|
775
|
+
disabled={
|
|
776
|
+
isCreating ||
|
|
777
|
+
uploadProgress !== null ||
|
|
778
|
+
!newResourceName.trim()
|
|
779
|
+
}
|
|
780
|
+
className={buttonStyles.primary.base}
|
|
781
|
+
>
|
|
782
|
+
{isCreating
|
|
783
|
+
? isClone
|
|
784
|
+
? t.saving
|
|
785
|
+
: t.creating
|
|
786
|
+
: isClone
|
|
787
|
+
? t.saveClonedResource
|
|
788
|
+
: t.createResource}
|
|
789
|
+
</button>
|
|
790
|
+
</div>
|
|
791
|
+
|
|
792
|
+
{/* Inline upload progress — renders below the action buttons while
|
|
793
|
+
an upload is in flight. `null` between saves and after completion. */}
|
|
794
|
+
<UploadProgressBar progress={uploadProgress} label={t.uploadFile} />
|
|
795
|
+
</form>
|
|
796
|
+
</div>
|
|
797
|
+
</div>
|
|
798
|
+
|
|
799
|
+
{/* Right Sidebar - Panels and Toolbar */}
|
|
800
|
+
<div className="xynolog-page__sidebar">
|
|
801
|
+
{/* Panels Container */}
|
|
802
|
+
<ToolbarPanels activePanel={activePanel} theme={theme} />
|
|
803
|
+
|
|
804
|
+
{/* Toolbar - Always visible on the right */}
|
|
805
|
+
<Toolbar context="simple" activePanel={activePanel} />
|
|
806
|
+
</div>
|
|
807
|
+
</div>
|
|
808
|
+
);
|
|
809
|
+
}
|