@vertesia/ui 0.80.0-dev-20251118 → 0.80.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/README.md +105 -0
- package/lib/esm/core/components/MenuList.js +2 -5
- package/lib/esm/core/components/MenuList.js.map +1 -1
- package/lib/esm/core/components/MessageBox.js +1 -1
- package/lib/esm/core/components/MessageBox.js.map +1 -1
- package/lib/esm/core/components/TagsInput.js +194 -0
- package/lib/esm/core/components/TagsInput.js.map +1 -0
- package/lib/esm/core/components/index.js +2 -1
- package/lib/esm/core/components/index.js.map +1 -1
- package/lib/esm/core/components/shadcn/dialog.js +16 -2
- package/lib/esm/core/components/shadcn/dialog.js.map +1 -1
- package/lib/esm/core/components/shadcn/filters/filter/SelectFilter.js +6 -9
- package/lib/esm/core/components/shadcn/filters/filter/SelectFilter.js.map +1 -1
- package/lib/esm/core/components/shadcn/filters/filterBar.js +1 -1
- package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -1
- package/lib/esm/core/components/shadcn/popover.js +1 -1
- package/lib/esm/core/components/shadcn/popover.js.map +1 -1
- package/lib/esm/core/components/shadcn/selectBox.js +23 -5
- package/lib/esm/core/components/shadcn/selectBox.js.map +1 -1
- package/lib/esm/core/components/shadcn/tabs.js +3 -3
- package/lib/esm/core/components/shadcn/tabs.js.map +1 -1
- package/lib/esm/env/index.js +4 -1
- package/lib/esm/env/index.js.map +1 -1
- package/lib/esm/features/agent/chat/AgentChart.js +184 -0
- package/lib/esm/features/agent/chat/AgentChart.js.map +1 -0
- package/lib/esm/features/agent/chat/ModernAgentConversation.js +87 -10
- package/lib/esm/features/agent/chat/ModernAgentConversation.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +6 -2
- package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js +4 -4
- package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js +4 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js +12 -4
- package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js +60 -56
- package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
- package/lib/esm/features/agent/chat/index.js +1 -0
- package/lib/esm/features/agent/chat/index.js.map +1 -1
- package/lib/esm/features/agent/createChartTool.js +354 -0
- package/lib/esm/features/agent/createChartTool.js.map +1 -0
- package/lib/esm/features/agent/examples.js +295 -0
- package/lib/esm/features/agent/examples.js.map +1 -0
- package/lib/esm/features/agent/index.js +2 -0
- package/lib/esm/features/agent/index.js.map +1 -1
- package/lib/esm/features/agent/visualization.js +165 -0
- package/lib/esm/features/agent/visualization.js.map +1 -0
- package/lib/esm/features/facets/CollectionsFacetsNav.js +5 -1
- package/lib/esm/features/facets/CollectionsFacetsNav.js.map +1 -1
- package/lib/esm/features/index.js +1 -0
- package/lib/esm/features/index.js.map +1 -1
- package/lib/esm/features/layout/GenericPageNavHeader.js +14 -4
- package/lib/esm/features/layout/GenericPageNavHeader.js.map +1 -1
- package/lib/esm/features/magic-pdf/AnnotatedImageSlider.js +268 -0
- package/lib/esm/features/magic-pdf/AnnotatedImageSlider.js.map +1 -0
- package/lib/esm/features/magic-pdf/DownloadPopover.js +11 -11
- package/lib/esm/features/magic-pdf/DownloadPopover.js.map +1 -1
- package/lib/esm/features/magic-pdf/ExtractedContentView.js +77 -0
- package/lib/esm/features/magic-pdf/ExtractedContentView.js.map +1 -0
- package/lib/esm/features/magic-pdf/MagicPdfProvider.js +242 -0
- package/lib/esm/features/magic-pdf/MagicPdfProvider.js.map +1 -0
- package/lib/esm/features/magic-pdf/MagicPdfView.js +41 -47
- package/lib/esm/features/magic-pdf/MagicPdfView.js.map +1 -1
- package/lib/esm/features/pdf-viewer/PdfPageRenderer.js +261 -0
- package/lib/esm/features/pdf-viewer/PdfPageRenderer.js.map +1 -0
- package/lib/esm/features/pdf-viewer/PdfPageSlider.js +276 -0
- package/lib/esm/features/pdf-viewer/PdfPageSlider.js.map +1 -0
- package/lib/esm/features/pdf-viewer/SimplePdfViewer.js +71 -0
- package/lib/esm/features/pdf-viewer/SimplePdfViewer.js.map +1 -0
- package/lib/esm/features/pdf-viewer/index.js +4 -0
- package/lib/esm/features/pdf-viewer/index.js.map +1 -0
- package/lib/esm/features/store/collections/EditCollectionView.js +19 -10
- package/lib/esm/features/store/collections/EditCollectionView.js.map +1 -1
- package/lib/esm/features/store/collections/SelectCollection.js +104 -39
- package/lib/esm/features/store/collections/SelectCollection.js.map +1 -1
- package/lib/esm/features/store/collections/SharedPropsEditor.js +39 -0
- package/lib/esm/features/store/collections/SharedPropsEditor.js.map +1 -0
- package/lib/esm/features/store/collections/SyncMemberHeadsToggle.js +35 -0
- package/lib/esm/features/store/collections/SyncMemberHeadsToggle.js.map +1 -0
- package/lib/esm/features/store/collections/index.js +2 -0
- package/lib/esm/features/store/collections/index.js.map +1 -1
- package/lib/esm/features/store/objects/DocumentSearchResults.js +0 -7
- package/lib/esm/features/store/objects/DocumentSearchResults.js.map +1 -1
- package/lib/esm/features/store/objects/components/ContentOverview.js +273 -83
- package/lib/esm/features/store/objects/components/ContentOverview.js.map +1 -1
- package/lib/esm/features/store/objects/components/useContentPanelHooks.js +153 -0
- package/lib/esm/features/store/objects/components/useContentPanelHooks.js.map +1 -0
- package/lib/esm/features/store/objects/layout/DocumentTableColumn.js +3 -3
- package/lib/esm/features/store/objects/layout/DocumentTableColumn.js.map +1 -1
- package/lib/esm/features/store/objects/layout/renderers.js +13 -0
- package/lib/esm/features/store/objects/layout/renderers.js.map +1 -1
- package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js +10 -9
- package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js.map +1 -1
- package/lib/esm/features/utils/index.js +2 -0
- package/lib/esm/features/utils/index.js.map +1 -1
- package/lib/esm/features/utils/mimeType.js +8 -0
- package/lib/esm/features/utils/mimeType.js.map +1 -1
- package/lib/esm/features/utils/print.js +181 -0
- package/lib/esm/features/utils/print.js.map +1 -0
- package/lib/esm/features/utils/workflowStatus.js +43 -0
- package/lib/esm/features/utils/workflowStatus.js.map +1 -0
- package/lib/esm/router/HistoryNavigator.js +22 -2
- package/lib/esm/router/HistoryNavigator.js.map +1 -1
- package/lib/esm/session/UserSessionProvider.js +2 -2
- package/lib/esm/session/UserSessionProvider.js.map +1 -1
- package/lib/esm/shell/apps/AppProjectSelector.js +2 -2
- package/lib/esm/shell/apps/AppProjectSelector.js.map +1 -1
- package/lib/esm/shell/login/UserInfo.js +2 -1
- package/lib/esm/shell/login/UserInfo.js.map +1 -1
- package/lib/esm/shell/login/UserSessionMenu.js +7 -1
- package/lib/esm/shell/login/UserSessionMenu.js.map +1 -1
- package/lib/esm/widgets/form/Form.js +6 -2
- package/lib/esm/widgets/form/Form.js.map +1 -1
- package/lib/esm/widgets/markdown/MarkdownRenderer.js +226 -4
- package/lib/esm/widgets/markdown/MarkdownRenderer.js.map +1 -1
- package/lib/esm/widgets/schema-editor/ManagedSchema.js +0 -3
- package/lib/esm/widgets/schema-editor/ManagedSchema.js.map +1 -1
- package/lib/esm/widgets/schema-editor/json-schema4-utils.js +1 -1
- package/lib/esm/widgets/schema-editor/json-schema4-utils.js.map +1 -1
- package/lib/esm/widgets/xml-viewer/components/XMLViewer.js +18 -9
- package/lib/esm/widgets/xml-viewer/components/XMLViewer.js.map +1 -1
- package/lib/esm/widgets/xml-viewer/constants/index.js +10 -0
- package/lib/esm/widgets/xml-viewer/constants/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/core/components/MessageBox.d.ts.map +1 -1
- package/lib/types/core/components/TagsInput.d.ts +16 -0
- package/lib/types/core/components/TagsInput.d.ts.map +1 -0
- package/lib/types/core/components/index.d.ts +2 -1
- package/lib/types/core/components/index.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/dialog.d.ts +2 -1
- package/lib/types/core/components/shadcn/dialog.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/filters/filterBar.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/popover.d.ts +7 -0
- package/lib/types/core/components/shadcn/popover.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/selectBox.d.ts +5 -1
- package/lib/types/core/components/shadcn/selectBox.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/tabs.d.ts +3 -1
- package/lib/types/core/components/shadcn/tabs.d.ts.map +1 -1
- package/lib/types/env/index.d.ts +2 -0
- package/lib/types/env/index.d.ts.map +1 -1
- package/lib/types/features/agent/chat/AgentChart.d.ts +48 -0
- package/lib/types/features/agent/chat/AgentChart.d.ts.map +1 -0
- package/lib/types/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +3 -2
- package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts +2 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.d.ts +4 -2
- package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/MessageInput.d.ts +2 -4
- package/lib/types/features/agent/chat/ModernAgentOutput/MessageInput.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
- package/lib/types/features/agent/chat/index.d.ts +1 -0
- package/lib/types/features/agent/chat/index.d.ts.map +1 -1
- package/lib/types/features/agent/createChartTool.d.ts +178 -0
- package/lib/types/features/agent/createChartTool.d.ts.map +1 -0
- package/lib/types/features/agent/examples.d.ts +59 -0
- package/lib/types/features/agent/examples.d.ts.map +1 -0
- package/lib/types/features/agent/index.d.ts +2 -0
- package/lib/types/features/agent/index.d.ts.map +1 -1
- package/lib/types/features/agent/visualization.d.ts +95 -0
- package/lib/types/features/agent/visualization.d.ts.map +1 -0
- package/lib/types/features/facets/CollectionsFacetsNav.d.ts.map +1 -1
- package/lib/types/features/index.d.ts +1 -0
- package/lib/types/features/index.d.ts.map +1 -1
- package/lib/types/features/layout/GenericPageNavHeader.d.ts.map +1 -1
- package/lib/types/features/magic-pdf/AnnotatedImageSlider.d.ts +13 -0
- package/lib/types/features/magic-pdf/AnnotatedImageSlider.d.ts.map +1 -0
- package/lib/types/features/magic-pdf/DownloadPopover.d.ts.map +1 -1
- package/lib/types/features/magic-pdf/ExtractedContentView.d.ts +8 -0
- package/lib/types/features/magic-pdf/ExtractedContentView.d.ts.map +1 -0
- package/lib/types/features/magic-pdf/MagicPdfProvider.d.ts +58 -0
- package/lib/types/features/magic-pdf/MagicPdfProvider.d.ts.map +1 -0
- package/lib/types/features/magic-pdf/MagicPdfView.d.ts +1 -1
- package/lib/types/features/magic-pdf/MagicPdfView.d.ts.map +1 -1
- package/lib/types/features/pdf-viewer/PdfPageRenderer.d.ts +83 -0
- package/lib/types/features/pdf-viewer/PdfPageRenderer.d.ts.map +1 -0
- package/lib/types/features/pdf-viewer/PdfPageSlider.d.ts +29 -0
- package/lib/types/features/pdf-viewer/PdfPageSlider.d.ts.map +1 -0
- package/lib/types/features/pdf-viewer/SimplePdfViewer.d.ts +19 -0
- package/lib/types/features/pdf-viewer/SimplePdfViewer.d.ts.map +1 -0
- package/lib/types/features/pdf-viewer/index.d.ts +4 -0
- package/lib/types/features/pdf-viewer/index.d.ts.map +1 -0
- package/lib/types/features/store/collections/EditCollectionView.d.ts.map +1 -1
- package/lib/types/features/store/collections/SelectCollection.d.ts +2 -1
- package/lib/types/features/store/collections/SelectCollection.d.ts.map +1 -1
- package/lib/types/features/store/collections/SharedPropsEditor.d.ts +7 -0
- package/lib/types/features/store/collections/SharedPropsEditor.d.ts.map +1 -0
- package/lib/types/features/store/collections/SyncMemberHeadsToggle.d.ts +7 -0
- package/lib/types/features/store/collections/SyncMemberHeadsToggle.d.ts.map +1 -0
- package/lib/types/features/store/collections/index.d.ts +2 -0
- package/lib/types/features/store/collections/index.d.ts.map +1 -1
- package/lib/types/features/store/objects/DocumentSearchResults.d.ts.map +1 -1
- package/lib/types/features/store/objects/components/ContentOverview.d.ts.map +1 -1
- package/lib/types/features/store/objects/components/useContentPanelHooks.d.ts +30 -0
- package/lib/types/features/store/objects/components/useContentPanelHooks.d.ts.map +1 -0
- package/lib/types/features/store/objects/layout/renderers.d.ts.map +1 -1
- package/lib/types/features/store/objects/upload/useSmartFileUploadProcessing.d.ts.map +1 -1
- package/lib/types/features/utils/index.d.ts +2 -0
- package/lib/types/features/utils/index.d.ts.map +1 -1
- package/lib/types/features/utils/mimeType.d.ts +1 -0
- package/lib/types/features/utils/mimeType.d.ts.map +1 -1
- package/lib/types/features/utils/print.d.ts +10 -0
- package/lib/types/features/utils/print.d.ts.map +1 -0
- package/lib/types/features/utils/workflowStatus.d.ts +10 -0
- package/lib/types/features/utils/workflowStatus.d.ts.map +1 -0
- package/lib/types/router/HistoryNavigator.d.ts +3 -0
- package/lib/types/router/HistoryNavigator.d.ts.map +1 -1
- package/lib/types/shell/login/UserInfo.d.ts.map +1 -1
- package/lib/types/shell/login/UserSessionMenu.d.ts.map +1 -1
- package/lib/types/widgets/form/Form.d.ts.map +1 -1
- package/lib/types/widgets/markdown/MarkdownRenderer.d.ts +5 -1
- package/lib/types/widgets/markdown/MarkdownRenderer.d.ts.map +1 -1
- package/lib/types/widgets/schema-editor/ManagedSchema.d.ts.map +1 -1
- package/lib/types/widgets/xml-viewer/components/XMLViewer.d.ts.map +1 -1
- package/lib/types/widgets/xml-viewer/constants/index.d.ts +10 -0
- package/lib/types/widgets/xml-viewer/constants/index.d.ts.map +1 -1
- package/lib/vertesia-ui-core.js +1 -1
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-env.js +1 -1
- package/lib/vertesia-ui-env.js.map +1 -1
- package/lib/vertesia-ui-features.js +1 -1
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-layout.js +1 -1
- package/lib/vertesia-ui-layout.js.map +1 -1
- package/lib/vertesia-ui-router.js +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +1 -1
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-shell.js +1 -1
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +1 -1
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/package.json +173 -170
- package/src/core/components/MenuList.tsx +3 -6
- package/src/core/components/MessageBox.tsx +7 -2
- package/src/core/components/SelectBox.tsx +1 -1
- package/src/core/components/shadcn/dialog.tsx +19 -1
- package/src/core/components/shadcn/filters/filter/SelectFilter.tsx +31 -31
- package/src/core/components/shadcn/filters/filterBar.tsx +1 -0
- package/src/core/components/shadcn/selectBox.tsx +32 -6
- package/src/core/components/shadcn/tabs.tsx +3 -2
- package/src/env/index.ts +6 -1
- package/src/features/agent/CHART_INSTRUCTIONS.md +228 -0
- package/src/features/agent/chat/AgentChart.tsx +601 -0
- package/src/features/agent/chat/ModernAgentConversation.tsx +123 -11
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +8 -2
- package/src/features/agent/chat/ModernAgentOutput/Header.tsx +12 -2
- package/src/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.tsx +6 -1
- package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +15 -10
- package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +122 -87
- package/src/features/agent/chat/index.ts +1 -0
- package/src/features/agent/createChartTool.ts +364 -0
- package/src/features/agent/examples.ts +321 -0
- package/src/features/agent/index.ts +2 -0
- package/src/features/agent/visualization.ts +227 -0
- package/src/features/facets/CollectionsFacetsNav.tsx +5 -1
- package/src/features/index.ts +1 -0
- package/src/features/layout/GenericPageNavHeader.tsx +15 -4
- package/src/features/magic-pdf/AnnotatedImageSlider.tsx +482 -0
- package/src/features/magic-pdf/DownloadPopover.tsx +45 -40
- package/src/features/magic-pdf/ExtractedContentView.tsx +132 -0
- package/src/features/magic-pdf/MagicPdfProvider.tsx +297 -0
- package/src/features/magic-pdf/MagicPdfView.tsx +184 -91
- package/src/features/pdf-viewer/PdfPageRenderer.tsx +612 -0
- package/src/features/pdf-viewer/PdfPageSlider.tsx +473 -0
- package/src/features/pdf-viewer/SimplePdfViewer.tsx +142 -0
- package/src/features/pdf-viewer/index.ts +3 -0
- package/src/features/store/collections/EditCollectionView.tsx +3 -5
- package/src/features/store/collections/SharedPropsEditor.tsx +1 -2
- package/src/features/store/objects/DocumentSearchResults.tsx +0 -7
- package/src/features/store/objects/components/ContentOverview.tsx +677 -210
- package/src/features/store/objects/components/useContentPanelHooks.ts +169 -0
- package/src/features/store/objects/layout/DocumentTableColumn.tsx +3 -3
- package/src/features/store/objects/layout/knowledge.md +1 -0
- package/src/features/store/objects/layout/renderers.tsx +25 -0
- package/src/features/store/objects/upload/useSmartFileUploadProcessing.ts +1 -3
- package/src/features/utils/index.ts +3 -1
- package/src/features/utils/mimeType.ts +10 -1
- package/src/features/utils/print.ts +189 -0
- package/src/features/utils/workflowStatus.ts +44 -0
- package/src/router/HistoryNavigator.ts +30 -2
- package/src/session/UserSessionProvider.tsx +2 -2
- package/src/shell/login/UserInfo.tsx +2 -0
- package/src/shell/login/UserSessionMenu.tsx +12 -1
- package/src/widgets/form/Form.tsx +8 -3
- package/src/widgets/markdown/MarkdownRenderer.tsx +350 -6
- package/src/widgets/schema-editor/ManagedSchema.ts +0 -3
- package/src/widgets/schema-editor/json-schema4-utils.ts +1 -1
- package/src/widgets/xml-viewer/components/XMLViewer.tsx +22 -10
- package/src/widgets/xml-viewer/constants/index.ts +11 -0
- package/lib/esm/features/magic-pdf/PageSlider.js +0 -70
- package/lib/esm/features/magic-pdf/PageSlider.js.map +0 -1
- package/lib/esm/features/magic-pdf/PdfPageProvider.js +0 -188
- package/lib/esm/features/magic-pdf/PdfPageProvider.js.map +0 -1
- package/lib/esm/features/magic-pdf/TextPageView.js +0 -62
- package/lib/esm/features/magic-pdf/TextPageView.js.map +0 -1
- package/lib/esm/features/magic-pdf/useResizeOnDrag.js +0 -34
- package/lib/esm/features/magic-pdf/useResizeOnDrag.js.map +0 -1
- package/lib/types/features/magic-pdf/PageSlider.d.ts +0 -9
- package/lib/types/features/magic-pdf/PageSlider.d.ts.map +0 -1
- package/lib/types/features/magic-pdf/PdfPageProvider.d.ts +0 -39
- package/lib/types/features/magic-pdf/PdfPageProvider.d.ts.map +0 -1
- package/lib/types/features/magic-pdf/TextPageView.d.ts +0 -8
- package/lib/types/features/magic-pdf/TextPageView.d.ts.map +0 -1
- package/lib/types/features/magic-pdf/useResizeOnDrag.d.ts +0 -9
- package/lib/types/features/magic-pdf/useResizeOnDrag.d.ts.map +0 -1
- package/src/features/magic-pdf/PageSlider.tsx +0 -142
- package/src/features/magic-pdf/PdfPageProvider.tsx +0 -310
- package/src/features/magic-pdf/TextPageView.tsx +0 -91
- package/src/features/magic-pdf/useResizeOnDrag.ts +0 -42
|
@@ -1,6 +1,32 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Markdown, { defaultUrlTransform } from "react-markdown";
|
|
2
3
|
import remarkGfm from "remark-gfm";
|
|
3
|
-
import { visit, SKIP } from
|
|
4
|
+
import { visit, SKIP } from "unist-util-visit";
|
|
5
|
+
import { AgentChart, type AgentChartSpec } from "../../features/agent/chat/AgentChart";
|
|
6
|
+
import { useUserSession } from "@vertesia/ui/session";
|
|
7
|
+
|
|
8
|
+
// Custom URL schemes that we handle in our components
|
|
9
|
+
const ALLOWED_CUSTOM_SCHEMES = [
|
|
10
|
+
'artifact:',
|
|
11
|
+
'image:',
|
|
12
|
+
'store:',
|
|
13
|
+
'document:',
|
|
14
|
+
'document://',
|
|
15
|
+
'collection:',
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Custom URL transform that allows our custom schemes while using
|
|
20
|
+
* the default transform for standard URLs (which sanitizes unsafe schemes).
|
|
21
|
+
*/
|
|
22
|
+
function customUrlTransform(url: string): string {
|
|
23
|
+
// Allow our custom schemes - they're handled by our custom components
|
|
24
|
+
if (ALLOWED_CUSTOM_SCHEMES.some(scheme => url.startsWith(scheme))) {
|
|
25
|
+
return url;
|
|
26
|
+
}
|
|
27
|
+
// Fall back to default sanitization for other URLs
|
|
28
|
+
return defaultUrlTransform(url);
|
|
29
|
+
}
|
|
4
30
|
|
|
5
31
|
function remarkRemoveComments() {
|
|
6
32
|
return (tree: any) => {
|
|
@@ -20,26 +46,344 @@ interface MarkdownRendererProps {
|
|
|
20
46
|
components?: any;
|
|
21
47
|
remarkPlugins?: any[];
|
|
22
48
|
removeComments?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Optional workflow run id used to resolve shorthand artifact paths (e.g. artifact:out/result.csv)
|
|
51
|
+
*/
|
|
52
|
+
artifactRunId?: string;
|
|
23
53
|
}
|
|
24
54
|
|
|
25
55
|
export function MarkdownRenderer({
|
|
26
56
|
children,
|
|
27
57
|
components,
|
|
28
58
|
remarkPlugins = [],
|
|
29
|
-
removeComments = true
|
|
59
|
+
removeComments = true,
|
|
60
|
+
artifactRunId,
|
|
30
61
|
}: MarkdownRendererProps) {
|
|
62
|
+
const { client } = useUserSession();
|
|
31
63
|
const plugins = [remarkGfm, ...remarkPlugins];
|
|
32
64
|
|
|
33
65
|
if (removeComments) {
|
|
34
66
|
plugins.push(remarkRemoveComments);
|
|
35
67
|
}
|
|
36
68
|
|
|
69
|
+
const componentsWithCharts = React.useMemo(() => {
|
|
70
|
+
const baseComponents = components || {};
|
|
71
|
+
const ExistingCode = baseComponents.code;
|
|
72
|
+
const ExistingLink = baseComponents.a;
|
|
73
|
+
const ExistingImg = baseComponents.img;
|
|
74
|
+
|
|
75
|
+
const CodeComponent = ({
|
|
76
|
+
node,
|
|
77
|
+
className,
|
|
78
|
+
children,
|
|
79
|
+
...props
|
|
80
|
+
}: {
|
|
81
|
+
node?: any;
|
|
82
|
+
className?: string;
|
|
83
|
+
children?: React.ReactNode;
|
|
84
|
+
}) => {
|
|
85
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
86
|
+
const isInline = !match;
|
|
87
|
+
const language = match ? match[1] : "";
|
|
88
|
+
|
|
89
|
+
if (!isInline && (language === "chart" || className?.includes("language-chart"))) {
|
|
90
|
+
try {
|
|
91
|
+
const raw = String(children || "").trim();
|
|
92
|
+
const spec = JSON.parse(raw) as AgentChartSpec;
|
|
93
|
+
if (spec && spec.chart && Array.isArray(spec.data)) {
|
|
94
|
+
return <AgentChart spec={spec} />;
|
|
95
|
+
}
|
|
96
|
+
} catch (e) {
|
|
97
|
+
console.warn("Failed to parse chart spec:", e);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (typeof ExistingCode === "function") {
|
|
102
|
+
return <ExistingCode node={node} className={className} {...props}>{children}</ExistingCode>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<code
|
|
107
|
+
{...props}
|
|
108
|
+
className={
|
|
109
|
+
isInline
|
|
110
|
+
? "px-1.5 py-0.5 rounded"
|
|
111
|
+
: "text-muted"
|
|
112
|
+
}
|
|
113
|
+
>
|
|
114
|
+
{children}
|
|
115
|
+
</code>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const LinkComponent = (props: { node?: any; href?: string; children?: React.ReactNode }) => {
|
|
120
|
+
const { node, href, children, ...rest } = props as any;
|
|
121
|
+
const rawHref = href || "";
|
|
122
|
+
const isArtifactLink = rawHref.startsWith("artifact:");
|
|
123
|
+
const artifactPath = isArtifactLink ? rawHref.replace(/^artifact:/, "").trim() : "";
|
|
124
|
+
const isImageLink = rawHref.startsWith("image:");
|
|
125
|
+
const imagePath = isImageLink ? rawHref.replace(/^image:/, "").trim() : "";
|
|
126
|
+
const [resolvedHref, setResolvedHref] = React.useState<string | undefined>(undefined);
|
|
127
|
+
|
|
128
|
+
React.useEffect(() => {
|
|
129
|
+
let cancelled = false;
|
|
130
|
+
const resolve = async () => {
|
|
131
|
+
if (!isArtifactLink && !isImageLink) {
|
|
132
|
+
setResolvedHref(undefined);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
if (isArtifactLink) {
|
|
137
|
+
// If we have a run id and the path looks like a shorthand (e.g. out/...), use artifact API.
|
|
138
|
+
if (artifactRunId && !artifactPath.startsWith("agents/")) {
|
|
139
|
+
const { url } = await client.files.getArtifactDownloadUrl(
|
|
140
|
+
artifactRunId,
|
|
141
|
+
artifactPath,
|
|
142
|
+
"attachment",
|
|
143
|
+
);
|
|
144
|
+
if (!cancelled) {
|
|
145
|
+
setResolvedHref(url);
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
// Otherwise, treat it as a direct file path.
|
|
149
|
+
const { url } = await client.files.getDownloadUrl(artifactPath);
|
|
150
|
+
if (!cancelled) {
|
|
151
|
+
setResolvedHref(url);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
} else if (isImageLink) {
|
|
155
|
+
// image:<path> is treated as a direct file path resolved via files API
|
|
156
|
+
const { url } = await client.files.getDownloadUrl(imagePath);
|
|
157
|
+
if (!cancelled) {
|
|
158
|
+
setResolvedHref(url);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
} catch (err) {
|
|
162
|
+
const contextPath = isArtifactLink ? artifactPath : imagePath;
|
|
163
|
+
console.error("Failed to resolve link in MarkdownRenderer:", contextPath, err);
|
|
164
|
+
if (!cancelled) {
|
|
165
|
+
setResolvedHref(undefined);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
resolve();
|
|
170
|
+
return () => {
|
|
171
|
+
cancelled = true;
|
|
172
|
+
};
|
|
173
|
+
}, [isArtifactLink, artifactPath, isImageLink, imagePath, artifactRunId, client]);
|
|
174
|
+
|
|
175
|
+
// Handle document://<id> links by mapping them to /store/objects/<id>
|
|
176
|
+
if (rawHref.startsWith("document://")) {
|
|
177
|
+
const id = rawHref.replace(/^document:\/\//, "").trim();
|
|
178
|
+
const mappedHref = id ? `/store/objects/${id}` : rawHref;
|
|
179
|
+
|
|
180
|
+
if (typeof ExistingLink === "function") {
|
|
181
|
+
return <ExistingLink node={node} href={mappedHref} {...rest}>{children}</ExistingLink>;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<a
|
|
186
|
+
href={mappedHref}
|
|
187
|
+
{...rest}
|
|
188
|
+
target="_blank"
|
|
189
|
+
rel="noopener noreferrer"
|
|
190
|
+
>
|
|
191
|
+
{children}
|
|
192
|
+
</a>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Handle store:<id> links by mapping them to /store/objects/<id>
|
|
197
|
+
if (rawHref.startsWith("store:")) {
|
|
198
|
+
const id = rawHref.replace(/^store:/, "").trim();
|
|
199
|
+
const mappedHref = id ? `/store/objects/${id}` : rawHref;
|
|
200
|
+
|
|
201
|
+
if (typeof ExistingLink === "function") {
|
|
202
|
+
return <ExistingLink node={node} href={mappedHref} {...rest}>{children}</ExistingLink>;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<a
|
|
207
|
+
href={mappedHref}
|
|
208
|
+
{...rest}
|
|
209
|
+
target="_blank"
|
|
210
|
+
rel="noopener noreferrer"
|
|
211
|
+
>
|
|
212
|
+
{children}
|
|
213
|
+
</a>
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Handle collection:<id> links by mapping them to /store/collections/<id>
|
|
218
|
+
if (rawHref.startsWith("collection:")) {
|
|
219
|
+
const id = rawHref.replace(/^collection:/, "").trim();
|
|
220
|
+
const mappedHref = id ? `/store/collections/${id}` : rawHref;
|
|
221
|
+
|
|
222
|
+
if (typeof ExistingLink === "function") {
|
|
223
|
+
return <ExistingLink node={node} href={mappedHref} {...rest}>{children}</ExistingLink>;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return (
|
|
227
|
+
<a
|
|
228
|
+
href={mappedHref}
|
|
229
|
+
{...rest}
|
|
230
|
+
target="_blank"
|
|
231
|
+
rel="noopener noreferrer"
|
|
232
|
+
>
|
|
233
|
+
{children}
|
|
234
|
+
</a>
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Defer to existing link component if provided and not an artifact: URL
|
|
239
|
+
if (!isArtifactLink && !isImageLink && typeof ExistingLink === "function") {
|
|
240
|
+
return <ExistingLink node={node} href={href} {...rest}>{children}</ExistingLink>;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Handle artifact: links generically by resolving to a signed URL when possible.
|
|
244
|
+
if (isArtifactLink) {
|
|
245
|
+
const finalHref = resolvedHref || "#";
|
|
246
|
+
|
|
247
|
+
return (
|
|
248
|
+
<a
|
|
249
|
+
href={finalHref}
|
|
250
|
+
{...rest}
|
|
251
|
+
target="_blank"
|
|
252
|
+
rel="noopener noreferrer"
|
|
253
|
+
>
|
|
254
|
+
{children}
|
|
255
|
+
</a>
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Handle image: links by resolving to a signed URL when possible.
|
|
260
|
+
if (isImageLink) {
|
|
261
|
+
const finalHref = resolvedHref || "#";
|
|
262
|
+
|
|
263
|
+
return (
|
|
264
|
+
<a
|
|
265
|
+
href={finalHref}
|
|
266
|
+
{...rest}
|
|
267
|
+
target="_blank"
|
|
268
|
+
rel="noopener noreferrer"
|
|
269
|
+
>
|
|
270
|
+
{children}
|
|
271
|
+
</a>
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Default link behavior
|
|
276
|
+
return (
|
|
277
|
+
<a
|
|
278
|
+
href={href}
|
|
279
|
+
{...rest}
|
|
280
|
+
target="_blank"
|
|
281
|
+
rel="noopener noreferrer"
|
|
282
|
+
>
|
|
283
|
+
{children}
|
|
284
|
+
</a>
|
|
285
|
+
);
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
const ImageComponent = (props: { node?: any; src?: string; alt?: string }) => {
|
|
289
|
+
const { node, src, alt, ...rest } = props as any;
|
|
290
|
+
const rawSrc = src || "";
|
|
291
|
+
const isArtifactRef = rawSrc.startsWith("artifact:");
|
|
292
|
+
const isImageRef = rawSrc.startsWith("image:");
|
|
293
|
+
const isArtifactOrImageRef = isArtifactRef || isImageRef;
|
|
294
|
+
const path = isArtifactOrImageRef ? rawSrc.replace(/^artifact:/, "").replace(/^image:/, "").trim() : "";
|
|
295
|
+
const [resolvedSrc, setResolvedSrc] = React.useState<string | undefined>(undefined);
|
|
296
|
+
|
|
297
|
+
React.useEffect(() => {
|
|
298
|
+
let cancelled = false;
|
|
299
|
+
const resolve = async () => {
|
|
300
|
+
if (!isArtifactOrImageRef) {
|
|
301
|
+
setResolvedSrc(undefined);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
try {
|
|
305
|
+
if (isArtifactRef) {
|
|
306
|
+
// Allow shorthand artifact paths when we have a run id
|
|
307
|
+
if (artifactRunId && !path.startsWith("agents/")) {
|
|
308
|
+
const { url } = await client.files.getArtifactDownloadUrl(
|
|
309
|
+
artifactRunId,
|
|
310
|
+
path,
|
|
311
|
+
"inline",
|
|
312
|
+
);
|
|
313
|
+
if (!cancelled) {
|
|
314
|
+
setResolvedSrc(url);
|
|
315
|
+
}
|
|
316
|
+
} else {
|
|
317
|
+
const { url } = await client.files.getDownloadUrl(path);
|
|
318
|
+
if (!cancelled) {
|
|
319
|
+
setResolvedSrc(url);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
} else if (isImageRef) {
|
|
323
|
+
// image:<path> is always resolved via files API
|
|
324
|
+
const { url } = await client.files.getDownloadUrl(path);
|
|
325
|
+
if (!cancelled) {
|
|
326
|
+
setResolvedSrc(url);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
} catch (err) {
|
|
330
|
+
console.error("Failed to resolve image link in MarkdownRenderer:", path, err);
|
|
331
|
+
if (!cancelled) {
|
|
332
|
+
setResolvedSrc(undefined);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
resolve();
|
|
337
|
+
return () => {
|
|
338
|
+
cancelled = true;
|
|
339
|
+
};
|
|
340
|
+
}, [isArtifactOrImageRef, path, artifactRunId, client]);
|
|
341
|
+
|
|
342
|
+
// If a custom img component was passed and this is not an artifact:/image: URL, delegate.
|
|
343
|
+
if (!isArtifactOrImageRef && typeof ExistingImg === "function") {
|
|
344
|
+
return <ExistingImg node={node} src={src} alt={alt} {...rest} />;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (isArtifactOrImageRef) {
|
|
348
|
+
if (!resolvedSrc) {
|
|
349
|
+
// Render nothing or a minimal placeholder until resolved
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
return (
|
|
354
|
+
<img
|
|
355
|
+
src={resolvedSrc}
|
|
356
|
+
alt={alt}
|
|
357
|
+
{...rest}
|
|
358
|
+
/>
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// Default image behavior
|
|
363
|
+
return (
|
|
364
|
+
<img
|
|
365
|
+
src={src}
|
|
366
|
+
alt={alt}
|
|
367
|
+
{...rest}
|
|
368
|
+
/>
|
|
369
|
+
);
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
return {
|
|
373
|
+
...baseComponents,
|
|
374
|
+
code: CodeComponent,
|
|
375
|
+
a: LinkComponent,
|
|
376
|
+
img: ImageComponent,
|
|
377
|
+
};
|
|
378
|
+
}, [components, client, artifactRunId]);
|
|
379
|
+
|
|
37
380
|
return (
|
|
38
|
-
<Markdown
|
|
381
|
+
<Markdown
|
|
39
382
|
remarkPlugins={plugins}
|
|
40
|
-
components={
|
|
383
|
+
components={componentsWithCharts}
|
|
384
|
+
urlTransform={customUrlTransform}
|
|
41
385
|
>
|
|
42
386
|
{children}
|
|
43
387
|
</Markdown>
|
|
44
388
|
);
|
|
45
|
-
}
|
|
389
|
+
}
|
|
@@ -279,16 +279,13 @@ export class SchemaNode {
|
|
|
279
279
|
if (this.schema.editor && data.editor === null) {
|
|
280
280
|
// explicitly set to null => delete current editor
|
|
281
281
|
this.schema.editor = undefined;
|
|
282
|
-
this.schema.format = undefined;
|
|
283
282
|
updated = true;
|
|
284
283
|
} else if (data.editor) { // a new editor is set
|
|
285
284
|
this.schema.editor = data.editor;
|
|
286
|
-
this.schema.format = data.editor;
|
|
287
285
|
updated = true;
|
|
288
286
|
} else if (typeChanged) {
|
|
289
287
|
// preserve editor only if the type didn't change
|
|
290
288
|
this.schema.editor = undefined;
|
|
291
|
-
this.schema.format = undefined;
|
|
292
289
|
updated = true;
|
|
293
290
|
}
|
|
294
291
|
if (data.description !== this.description) {
|
|
@@ -132,7 +132,7 @@ export function getTypeSignature(schema: JSONSchema): TypeSignature {
|
|
|
132
132
|
typeName = getItemTypeName(schema.items);
|
|
133
133
|
}
|
|
134
134
|
let displayTypeName: string = typeName;
|
|
135
|
-
switch (schema.editor
|
|
135
|
+
switch (schema.editor) {
|
|
136
136
|
case 'textarea': {
|
|
137
137
|
displayTypeName = 'text'; break;
|
|
138
138
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { isEqual } from 'lodash-es';
|
|
2
1
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { defaultTheme } from '../constants';
|
|
2
|
+
import { darkTheme, defaultTheme } from '../constants';
|
|
4
3
|
import { XMLViewerContext } from '../context/xml-viewer-context';
|
|
5
4
|
import useXMLViewer from '../hooks/useXMLViewer';
|
|
6
5
|
import { Elements } from './Elements';
|
|
@@ -17,7 +16,27 @@ export function XMLViewer(props: XMLViewerProps): React.ReactNode {
|
|
|
17
16
|
initalCollapsedDepth,
|
|
18
17
|
initialCollapsedDepth,
|
|
19
18
|
} = props;
|
|
20
|
-
|
|
19
|
+
|
|
20
|
+
// Detect dark mode from document root class (set by ThemeProvider)
|
|
21
|
+
const [isDarkMode, setIsDarkMode] = useState(() => {
|
|
22
|
+
return document.documentElement.classList.contains('dark');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const root = document.documentElement;
|
|
27
|
+
const observer = new MutationObserver(() => {
|
|
28
|
+
setIsDarkMode(root.classList.contains('dark'));
|
|
29
|
+
});
|
|
30
|
+
observer.observe(root, { attributes: true, attributeFilter: ['class'] });
|
|
31
|
+
return () => observer.disconnect();
|
|
32
|
+
}, []);
|
|
33
|
+
|
|
34
|
+
// Compute theme based on dark mode, then apply custom overrides
|
|
35
|
+
const theme = useMemo<Theme>(() => {
|
|
36
|
+
const baseTheme = isDarkMode ? darkTheme : defaultTheme;
|
|
37
|
+
return { ...baseTheme, ...customTheme };
|
|
38
|
+
}, [isDarkMode, customTheme]);
|
|
39
|
+
|
|
21
40
|
const { json, valid } = useXMLViewer(xml);
|
|
22
41
|
const context = useMemo(
|
|
23
42
|
() => ({
|
|
@@ -29,13 +48,6 @@ export function XMLViewer(props: XMLViewerProps): React.ReactNode {
|
|
|
29
48
|
[theme, collapsible, indentSize, initalCollapsedDepth, initialCollapsedDepth],
|
|
30
49
|
);
|
|
31
50
|
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
setTheme((currentTheme) => {
|
|
34
|
-
const nextTheme = { ...defaultTheme, ...customTheme };
|
|
35
|
-
return isEqual(nextTheme, currentTheme) ? currentTheme : nextTheme;
|
|
36
|
-
});
|
|
37
|
-
}, [customTheme]);
|
|
38
|
-
|
|
39
51
|
if (!valid) {
|
|
40
52
|
return invalidXml ? invalidXml : <InvalidXml />;
|
|
41
53
|
}
|
|
@@ -15,3 +15,14 @@ export const defaultTheme = {
|
|
|
15
15
|
cdataColor: '#1d781d',
|
|
16
16
|
fontFamily: 'monospace',
|
|
17
17
|
};
|
|
18
|
+
|
|
19
|
+
export const darkTheme = {
|
|
20
|
+
attributeKeyColor: '#FFD700',
|
|
21
|
+
attributeValueColor: '#FF4500',
|
|
22
|
+
tagColor: '#87CEFA',
|
|
23
|
+
textColor: '#00FF00',
|
|
24
|
+
separatorColor: '#FFD700',
|
|
25
|
+
commentColor: '#BEBEBE',
|
|
26
|
+
cdataColor: '#33CC66',
|
|
27
|
+
fontFamily: 'monospace',
|
|
28
|
+
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Center } from "@vertesia/ui/core";
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
import { AtSignIcon, ChevronsDown, ChevronsUp, ImageIcon, InfoIcon } from "lucide-react";
|
|
5
|
-
import { useRef, useState } from "react";
|
|
6
|
-
import { usePdfPagesInfo } from "./PdfPageProvider";
|
|
7
|
-
var ImageType;
|
|
8
|
-
(function (ImageType) {
|
|
9
|
-
ImageType[ImageType["default"] = 0] = "default";
|
|
10
|
-
ImageType[ImageType["original"] = 1] = "original";
|
|
11
|
-
ImageType[ImageType["instrumented"] = 2] = "instrumented";
|
|
12
|
-
ImageType[ImageType["annotated"] = 3] = "annotated";
|
|
13
|
-
})(ImageType || (ImageType = {}));
|
|
14
|
-
export function PageSlider({ className, currentPage, onChange, object }) {
|
|
15
|
-
const getProcessorType = () => {
|
|
16
|
-
if (object.metadata?.type === "document") {
|
|
17
|
-
const docMetadata = object.metadata;
|
|
18
|
-
return docMetadata.content_processor?.type || "xml";
|
|
19
|
-
}
|
|
20
|
-
return "xml"; // default
|
|
21
|
-
};
|
|
22
|
-
const getDefaultImageType = () => {
|
|
23
|
-
const processorType = getProcessorType();
|
|
24
|
-
return processorType === "markdown" ? ImageType.original : ImageType.default;
|
|
25
|
-
};
|
|
26
|
-
const [imageType, setImageType] = useState(getDefaultImageType());
|
|
27
|
-
const ref = useRef(null);
|
|
28
|
-
const { urls, originalUrls, annotatedUrls, instrumentedUrls } = usePdfPagesInfo();
|
|
29
|
-
const goPrev = () => {
|
|
30
|
-
if (currentPage > 1) {
|
|
31
|
-
onChange(currentPage - 1);
|
|
32
|
-
if (ref.current) {
|
|
33
|
-
ref.current.querySelector(`div[data-index="${currentPage - 1}"]`)?.scrollIntoView({
|
|
34
|
-
behavior: 'smooth',
|
|
35
|
-
block: 'end',
|
|
36
|
-
inline: 'center'
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const goNext = () => {
|
|
42
|
-
if (currentPage < urls.length) {
|
|
43
|
-
onChange(currentPage + 1);
|
|
44
|
-
if (ref.current) {
|
|
45
|
-
ref.current.querySelector(`div[data-index="${currentPage + 1}"]`)?.scrollIntoView({
|
|
46
|
-
behavior: 'smooth',
|
|
47
|
-
block: 'end',
|
|
48
|
-
inline: 'center'
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const actualUrls = imageType === ImageType.instrumented ? instrumentedUrls :
|
|
54
|
-
(imageType === ImageType.annotated ? annotatedUrls :
|
|
55
|
-
(imageType === ImageType.original ? originalUrls : urls));
|
|
56
|
-
return (_jsxs("div", { ref: ref, className: clsx('flex flex-col items-stretch gap-y-2', className), children: [_jsxs("div", { className: "flex h-5 items-center justify-center relative", children: [_jsx("button", { className: BTN_CLASS, onClick: goPrev, children: _jsx(ChevronsUp, { className: 'w-5 h-5' }) }), _jsx("div", { className: "absolute right-3 flex gap-x-1", children: getProcessorType() === "markdown" ? (_jsxs(_Fragment, { children: [_jsx("button", { className: getRadioButtonClass(ImageType.original, imageType), onClick: () => setImageType(ImageType.original), children: _jsx(ImageIcon, { className: "w-5 h-5 mt-1" }) }), _jsx("button", { className: getRadioButtonClass(ImageType.instrumented, imageType), onClick: () => setImageType(ImageType.instrumented), children: _jsx(InfoIcon, { className: "w-5 h-5 mt-1" }) })] })) : (_jsxs(_Fragment, { children: [_jsx("button", { className: getRadioButtonClass(ImageType.default, imageType), onClick: () => setImageType(ImageType.default), children: _jsx(ImageIcon, { className: "w-5 h-5 mt-1" }) }), _jsx("button", { className: getRadioButtonClass(ImageType.instrumented, imageType), onClick: () => setImageType(ImageType.instrumented), children: _jsx(InfoIcon, { className: "w-5 h-5 mt-1" }) }), _jsx("button", { className: getRadioButtonClass(ImageType.annotated, imageType), onClick: () => setImageType(ImageType.annotated), children: _jsx(AtSignIcon, { className: "w-5 h-5 mt-1" }) })] })) })] }), _jsx("div", { className: 'flex flex-col items-center gap-2 flex-1 overflow-y-auto px-2', children: actualUrls.map((url, index) => _jsx(PageThumbnail, { url: url, currentPage: currentPage, pageNumber: index + 1, onSelect: () => onChange(index + 1) }, index)) }), _jsx("div", { className: "flex h-5 items-center justify-center relative", children: _jsx("button", { className: BTN_CLASS, onClick: goNext, children: _jsx(ChevronsDown, { className: 'size-5' }) }) })] }));
|
|
57
|
-
}
|
|
58
|
-
function PageThumbnail({ url, pageNumber, currentPage, onSelect }) {
|
|
59
|
-
return (_jsxs("div", { className: "p-2 hover:bg-gray-200 dark:hover:bg-slate-600 rounded-md", "data-index": pageNumber - 1, children: [_jsx("div", { className: clsx('relative border-[2px] cursor-pointer', pageNumber === currentPage ? "border-blue-500 dark:border-pink-400" : "border-gray-300"), onClick: onSelect, children: _jsx("img", { src: url, alt: `Page ${pageNumber}` }) }), _jsx(Center, { className: "text-sm text-gray-500 dark:text-gray-400 pt-1 font-semibold align", children: pageNumber })] }));
|
|
60
|
-
}
|
|
61
|
-
const BTN_CLASS = "cursor-pointer text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-500 hover:font-semibold";
|
|
62
|
-
function getRadioButtonClass(type, currentType) {
|
|
63
|
-
if (type === currentType) {
|
|
64
|
-
return '${BTN_CLASS} text-pink-600';
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
return `${BTN_CLASS}`;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=PageSlider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PageSlider.js","sourceRoot":"","sources":["../../../../src/features/magic-pdf/PageSlider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,IAAK,SAKJ;AALD,WAAK,SAAS;IACV,+CAAO,CAAA;IACP,iDAAQ,CAAA;IACR,yDAAY,CAAA;IACZ,mDAAS,CAAA;AACb,CAAC,EALI,SAAS,KAAT,SAAS,QAKb;AAQD,MAAM,UAAU,UAAU,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAmB;IACpF,MAAM,gBAAgB,GAAG,GAAW,EAAE;QAClC,IAAI,MAAM,CAAC,QAAQ,EAAE,IAAI,KAAK,UAAU,EAAE,CAAC;YACvC,MAAM,WAAW,GAAG,MAAM,CAAC,QAA4B,CAAC;YACxD,OAAO,WAAW,CAAC,iBAAiB,EAAE,IAAI,IAAI,KAAK,CAAC;QACxD,CAAC;QACD,OAAO,KAAK,CAAC,CAAC,UAAU;IAC5B,CAAC,CAAC;IAEF,MAAM,mBAAmB,GAAG,GAAc,EAAE;QACxC,MAAM,aAAa,GAAG,gBAAgB,EA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