@flanksource/clicky-ui 0.3.1 → 0.3.3
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/dist/comments/CommentAuthor.cjs +58 -0
- package/dist/comments/CommentAuthor.cjs.map +1 -0
- package/dist/comments/CommentAuthor.d.ts +17 -0
- package/dist/comments/CommentAuthor.d.ts.map +1 -0
- package/dist/comments/CommentAuthor.js +58 -0
- package/dist/comments/CommentAuthor.js.map +1 -0
- package/dist/comments/CommentCard.cjs +343 -0
- package/dist/comments/CommentCard.cjs.map +1 -0
- package/dist/comments/CommentCard.d.ts +27 -0
- package/dist/comments/CommentCard.d.ts.map +1 -0
- package/dist/comments/CommentCard.js +343 -0
- package/dist/comments/CommentCard.js.map +1 -0
- package/dist/comments/CommentComposer.cjs +207 -0
- package/dist/comments/CommentComposer.cjs.map +1 -0
- package/dist/comments/CommentComposer.d.ts +23 -0
- package/dist/comments/CommentComposer.d.ts.map +1 -0
- package/dist/comments/CommentComposer.js +207 -0
- package/dist/comments/CommentComposer.js.map +1 -0
- package/dist/comments/CommentFilterBar.cjs +145 -0
- package/dist/comments/CommentFilterBar.cjs.map +1 -0
- package/dist/comments/CommentFilterBar.d.ts +15 -0
- package/dist/comments/CommentFilterBar.d.ts.map +1 -0
- package/dist/comments/CommentFilterBar.js +145 -0
- package/dist/comments/CommentFilterBar.js.map +1 -0
- package/dist/comments/CommentMarkdown.cjs +156 -0
- package/dist/comments/CommentMarkdown.cjs.map +1 -0
- package/dist/comments/CommentMarkdown.d.ts +13 -0
- package/dist/comments/CommentMarkdown.d.ts.map +1 -0
- package/dist/comments/CommentMarkdown.js +156 -0
- package/dist/comments/CommentMarkdown.js.map +1 -0
- package/dist/comments/CommentProgress.cjs +86 -0
- package/dist/comments/CommentProgress.cjs.map +1 -0
- package/dist/comments/CommentProgress.d.ts +16 -0
- package/dist/comments/CommentProgress.d.ts.map +1 -0
- package/dist/comments/CommentProgress.js +86 -0
- package/dist/comments/CommentProgress.js.map +1 -0
- package/dist/comments/CommentProvider.cjs +99 -0
- package/dist/comments/CommentProvider.cjs.map +1 -0
- package/dist/comments/CommentProvider.d.ts +19 -0
- package/dist/comments/CommentProvider.d.ts.map +1 -0
- package/dist/comments/CommentProvider.js +99 -0
- package/dist/comments/CommentProvider.js.map +1 -0
- package/dist/comments/CommentSidePanel.cjs +219 -0
- package/dist/comments/CommentSidePanel.cjs.map +1 -0
- package/dist/comments/CommentSidePanel.d.ts +16 -0
- package/dist/comments/CommentSidePanel.d.ts.map +1 -0
- package/dist/comments/CommentSidePanel.js +219 -0
- package/dist/comments/CommentSidePanel.js.map +1 -0
- package/dist/comments/CommentThread.cjs +57 -0
- package/dist/comments/CommentThread.cjs.map +1 -0
- package/dist/comments/CommentThread.d.ts +24 -0
- package/dist/comments/CommentThread.d.ts.map +1 -0
- package/dist/comments/CommentThread.js +57 -0
- package/dist/comments/CommentThread.js.map +1 -0
- package/dist/comments/CommentThreadList.cjs +124 -0
- package/dist/comments/CommentThreadList.cjs.map +1 -0
- package/dist/comments/CommentThreadList.d.ts +25 -0
- package/dist/comments/CommentThreadList.d.ts.map +1 -0
- package/dist/comments/CommentThreadList.js +124 -0
- package/dist/comments/CommentThreadList.js.map +1 -0
- package/dist/comments/GroupedComments.cjs +74 -0
- package/dist/comments/GroupedComments.cjs.map +1 -0
- package/dist/comments/GroupedComments.d.ts +18 -0
- package/dist/comments/GroupedComments.d.ts.map +1 -0
- package/dist/comments/GroupedComments.js +74 -0
- package/dist/comments/GroupedComments.js.map +1 -0
- package/dist/comments/MentionTextarea.cjs +253 -0
- package/dist/comments/MentionTextarea.cjs.map +1 -0
- package/dist/comments/MentionTextarea.d.ts +28 -0
- package/dist/comments/MentionTextarea.d.ts.map +1 -0
- package/dist/comments/MentionTextarea.js +253 -0
- package/dist/comments/MentionTextarea.js.map +1 -0
- package/dist/comments/comment-context.cjs +33 -0
- package/dist/comments/comment-context.cjs.map +1 -0
- package/dist/comments/comment-context.d.ts +32 -0
- package/dist/comments/comment-context.d.ts.map +1 -0
- package/dist/comments/comment-context.js +33 -0
- package/dist/comments/comment-context.js.map +1 -0
- package/dist/comments/comment-fixtures.d.ts +11 -0
- package/dist/comments/comment-fixtures.d.ts.map +1 -0
- package/dist/comments/comment-types.cjs +19 -0
- package/dist/comments/comment-types.cjs.map +1 -0
- package/dist/comments/comment-types.d.ts +170 -0
- package/dist/comments/comment-types.d.ts.map +1 -0
- package/dist/comments/comment-types.js +19 -0
- package/dist/comments/comment-types.js.map +1 -0
- package/dist/comments/comment-utils.cjs +216 -0
- package/dist/comments/comment-utils.cjs.map +1 -0
- package/dist/comments/comment-utils.d.ts +59 -0
- package/dist/comments/comment-utils.d.ts.map +1 -0
- package/dist/comments/comment-utils.js +216 -0
- package/dist/comments/comment-utils.js.map +1 -0
- package/dist/comments.cjs +57 -0
- package/dist/comments.cjs.map +1 -0
- package/dist/comments.d.ts +16 -0
- package/dist/comments.d.ts.map +1 -0
- package/dist/comments.js +57 -0
- package/dist/comments.js.map +1 -0
- package/dist/components/FilterBar.cjs +13 -3
- package/dist/components/FilterBar.cjs.map +1 -1
- package/dist/components/FilterBar.js +13 -3
- package/dist/components/FilterBar.js.map +1 -1
- package/dist/components/JsonSchemaForm.cjs +20 -6
- package/dist/components/JsonSchemaForm.cjs.map +1 -1
- package/dist/components/JsonSchemaForm.d.ts +1 -1
- package/dist/components/JsonSchemaForm.d.ts.map +1 -1
- package/dist/components/JsonSchemaForm.js +22 -8
- package/dist/components/JsonSchemaForm.js.map +1 -1
- package/dist/components/NamespacePicker.cjs +52 -0
- package/dist/components/NamespacePicker.cjs.map +1 -0
- package/dist/components/NamespacePicker.d.ts +17 -0
- package/dist/components/NamespacePicker.d.ts.map +1 -0
- package/dist/components/NamespacePicker.js +52 -0
- package/dist/components/NamespacePicker.js.map +1 -0
- package/dist/components/form-lookup-context.cjs +36 -0
- package/dist/components/form-lookup-context.cjs.map +1 -0
- package/dist/components/form-lookup-context.d.ts +9 -0
- package/dist/components/form-lookup-context.d.ts.map +1 -0
- package/dist/components/form-lookup-context.js +36 -0
- package/dist/components/form-lookup-context.js.map +1 -0
- package/dist/components/json-schema-form-discriminator.cjs +67 -0
- package/dist/components/json-schema-form-discriminator.cjs.map +1 -0
- package/dist/components/json-schema-form-discriminator.d.ts +10 -0
- package/dist/components/json-schema-form-discriminator.d.ts.map +1 -0
- package/dist/components/json-schema-form-discriminator.js +67 -0
- package/dist/components/json-schema-form-discriminator.js.map +1 -0
- package/dist/components/json-schema-form-fields.cjs +66 -1
- package/dist/components/json-schema-form-fields.cjs.map +1 -1
- package/dist/components/json-schema-form-fields.d.ts +7 -0
- package/dist/components/json-schema-form-fields.d.ts.map +1 -1
- package/dist/components/json-schema-form-fields.js +66 -1
- package/dist/components/json-schema-form-fields.js.map +1 -1
- package/dist/components/json-schema-form-grid.cjs +92 -0
- package/dist/components/json-schema-form-grid.cjs.map +1 -0
- package/dist/components/json-schema-form-grid.d.ts +9 -0
- package/dist/components/json-schema-form-grid.d.ts.map +1 -0
- package/dist/components/json-schema-form-grid.js +92 -0
- package/dist/components/json-schema-form-grid.js.map +1 -0
- package/dist/components/json-schema-form-render.cjs +20 -3
- package/dist/components/json-schema-form-render.cjs.map +1 -1
- package/dist/components/json-schema-form-render.d.ts.map +1 -1
- package/dist/components/json-schema-form-render.js +22 -5
- package/dist/components/json-schema-form-render.js.map +1 -1
- package/dist/components/json-schema-form-resolve.cjs +24 -2
- package/dist/components/json-schema-form-resolve.cjs.map +1 -1
- package/dist/components/json-schema-form-resolve.d.ts.map +1 -1
- package/dist/components/json-schema-form-resolve.js +24 -2
- package/dist/components/json-schema-form-resolve.js.map +1 -1
- package/dist/components/json-schema-form-types.d.ts +37 -2
- package/dist/components/json-schema-form-types.d.ts.map +1 -1
- package/dist/components/json-schema-form-utils.cjs +8 -0
- package/dist/components/json-schema-form-utils.cjs.map +1 -1
- package/dist/components/json-schema-form-utils.d.ts +1 -0
- package/dist/components/json-schema-form-utils.d.ts.map +1 -1
- package/dist/components/json-schema-form-utils.js +8 -0
- package/dist/components/json-schema-form-utils.js.map +1 -1
- package/dist/components/workload-picker-utils.cjs.map +1 -1
- package/dist/components/workload-picker-utils.d.ts +11 -1
- package/dist/components/workload-picker-utils.d.ts.map +1 -1
- package/dist/components/workload-picker-utils.js.map +1 -1
- package/dist/components.cjs +6 -0
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.ts +4 -2
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +6 -0
- package/dist/components.js.map +1 -1
- package/dist/data/Clicky.cjs +225 -60
- package/dist/data/Clicky.cjs.map +1 -1
- package/dist/data/Clicky.d.ts +7 -1
- package/dist/data/Clicky.d.ts.map +1 -1
- package/dist/data/Clicky.fixtures.d.ts +3 -1
- package/dist/data/Clicky.fixtures.d.ts.map +1 -1
- package/dist/data/Clicky.js +226 -61
- package/dist/data/Clicky.js.map +1 -1
- package/dist/data/ExecutionTree.cjs +68 -0
- package/dist/data/ExecutionTree.cjs.map +1 -0
- package/dist/data/ExecutionTree.d.ts +40 -0
- package/dist/data/ExecutionTree.d.ts.map +1 -0
- package/dist/data/ExecutionTree.js +68 -0
- package/dist/data/ExecutionTree.js.map +1 -0
- package/dist/data/GaugeHoverCard.cjs +35 -0
- package/dist/data/GaugeHoverCard.cjs.map +1 -0
- package/dist/data/GaugeHoverCard.d.ts +25 -0
- package/dist/data/GaugeHoverCard.d.ts.map +1 -0
- package/dist/data/GaugeHoverCard.js +35 -0
- package/dist/data/GaugeHoverCard.js.map +1 -0
- package/dist/data/MarkdownEditor.cjs +616 -0
- package/dist/data/MarkdownEditor.cjs.map +1 -0
- package/dist/data/MarkdownEditor.d.ts +61 -0
- package/dist/data/MarkdownEditor.d.ts.map +1 -0
- package/dist/data/MarkdownEditor.js +616 -0
- package/dist/data/MarkdownEditor.js.map +1 -0
- package/dist/data/MarkdownEditor.model.cjs +27 -0
- package/dist/data/MarkdownEditor.model.cjs.map +1 -0
- package/dist/data/MarkdownEditor.model.d.ts +38 -0
- package/dist/data/MarkdownEditor.model.d.ts.map +1 -0
- package/dist/data/MarkdownEditor.model.js +27 -0
- package/dist/data/MarkdownEditor.model.js.map +1 -0
- package/dist/data/ObjectGraph.cjs +44 -0
- package/dist/data/ObjectGraph.cjs.map +1 -0
- package/dist/data/ObjectGraph.d.ts +39 -0
- package/dist/data/ObjectGraph.d.ts.map +1 -0
- package/dist/data/ObjectGraph.js +44 -0
- package/dist/data/ObjectGraph.js.map +1 -0
- package/dist/data/SchemaViewer.cjs +152 -0
- package/dist/data/SchemaViewer.cjs.map +1 -0
- package/dist/data/SchemaViewer.d.ts +27 -0
- package/dist/data/SchemaViewer.d.ts.map +1 -0
- package/dist/data/SchemaViewer.js +152 -0
- package/dist/data/SchemaViewer.js.map +1 -0
- package/dist/data/TimeseriesCoreBars.cjs +51 -12
- package/dist/data/TimeseriesCoreBars.cjs.map +1 -1
- package/dist/data/TimeseriesCoreBars.d.ts +32 -5
- package/dist/data/TimeseriesCoreBars.d.ts.map +1 -1
- package/dist/data/TimeseriesCoreBars.js +51 -12
- package/dist/data/TimeseriesCoreBars.js.map +1 -1
- package/dist/data/TimeseriesCoreBars.model.cjs +5 -5
- package/dist/data/TimeseriesCoreBars.model.cjs.map +1 -1
- package/dist/data/TimeseriesCoreBars.model.d.ts +4 -4
- package/dist/data/TimeseriesCoreBars.model.d.ts.map +1 -1
- package/dist/data/TimeseriesCoreBars.model.js +5 -5
- package/dist/data/TimeseriesCoreBars.model.js.map +1 -1
- package/dist/data/TimeseriesGauge.cjs +103 -65
- package/dist/data/TimeseriesGauge.cjs.map +1 -1
- package/dist/data/TimeseriesGauge.d.ts +10 -1
- package/dist/data/TimeseriesGauge.d.ts.map +1 -1
- package/dist/data/TimeseriesGauge.js +104 -66
- package/dist/data/TimeseriesGauge.js.map +1 -1
- package/dist/data/WorkloadCard.cjs +4 -4
- package/dist/data/WorkloadCard.cjs.map +1 -1
- package/dist/data/WorkloadCard.d.ts +3 -2
- package/dist/data/WorkloadCard.d.ts.map +1 -1
- package/dist/data/WorkloadCard.js +4 -4
- package/dist/data/WorkloadCard.js.map +1 -1
- package/dist/data/ai/ChatWindow.cjs +11 -19
- package/dist/data/ai/ChatWindow.cjs.map +1 -1
- package/dist/data/ai/ChatWindow.d.ts +1 -7
- package/dist/data/ai/ChatWindow.d.ts.map +1 -1
- package/dist/data/ai/ChatWindow.js +11 -19
- package/dist/data/ai/ChatWindow.js.map +1 -1
- package/dist/data/ai/ChatWindowRequestBody.cjs +20 -0
- package/dist/data/ai/ChatWindowRequestBody.cjs.map +1 -0
- package/dist/data/ai/ChatWindowRequestBody.d.ts +9 -0
- package/dist/data/ai/ChatWindowRequestBody.d.ts.map +1 -0
- package/dist/data/ai/ChatWindowRequestBody.js +20 -0
- package/dist/data/ai/ChatWindowRequestBody.js.map +1 -0
- package/dist/data/chat/Chat.cjs +12 -0
- package/dist/data/chat/Chat.cjs.map +1 -1
- package/dist/data/chat/Chat.d.ts +8 -1
- package/dist/data/chat/Chat.d.ts.map +1 -1
- package/dist/data/chat/Chat.js +12 -0
- package/dist/data/chat/Chat.js.map +1 -1
- package/dist/data/gauge-stats.cjs +19 -0
- package/dist/data/gauge-stats.cjs.map +1 -0
- package/dist/data/gauge-stats.d.ts +15 -0
- package/dist/data/gauge-stats.d.ts.map +1 -0
- package/dist/data/gauge-stats.js +19 -0
- package/dist/data/gauge-stats.js.map +1 -0
- package/dist/data/schema-viewer-model.cjs +436 -0
- package/dist/data/schema-viewer-model.cjs.map +1 -0
- package/dist/data/schema-viewer-model.d.ts +64 -0
- package/dist/data/schema-viewer-model.d.ts.map +1 -0
- package/dist/data/schema-viewer-model.js +436 -0
- package/dist/data/schema-viewer-model.js.map +1 -0
- package/dist/data/version-info.cjs +2 -2
- package/dist/data/version-info.js +2 -2
- package/dist/data.cjs +23 -0
- package/dist/data.cjs.map +1 -1
- package/dist/data.d.ts +11 -3
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +23 -0
- package/dist/data.js.map +1 -1
- package/dist/index.cjs +87 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +87 -2
- package/dist/index.js.map +1 -1
- package/dist/rpc/EntityExplorerApp.cjs +102 -143
- package/dist/rpc/EntityExplorerApp.cjs.map +1 -1
- package/dist/rpc/EntityExplorerApp.d.ts +34 -1
- package/dist/rpc/EntityExplorerApp.d.ts.map +1 -1
- package/dist/rpc/EntityExplorerApp.js +105 -146
- package/dist/rpc/EntityExplorerApp.js.map +1 -1
- package/dist/rpc/OperationActionBar.cjs +135 -0
- package/dist/rpc/OperationActionBar.cjs.map +1 -0
- package/dist/rpc/OperationActionBar.d.ts +20 -0
- package/dist/rpc/OperationActionBar.d.ts.map +1 -0
- package/dist/rpc/OperationActionBar.js +135 -0
- package/dist/rpc/OperationActionBar.js.map +1 -0
- package/dist/rpc/OperationCatalog.cjs +79 -116
- package/dist/rpc/OperationCatalog.cjs.map +1 -1
- package/dist/rpc/OperationCatalog.d.ts +8 -1
- package/dist/rpc/OperationCatalog.d.ts.map +1 -1
- package/dist/rpc/OperationCatalog.js +80 -117
- package/dist/rpc/OperationCatalog.js.map +1 -1
- package/dist/rpc/OperationCommandPage.cjs +134 -223
- package/dist/rpc/OperationCommandPage.cjs.map +1 -1
- package/dist/rpc/OperationCommandPage.d.ts +1 -1
- package/dist/rpc/OperationCommandPage.d.ts.map +1 -1
- package/dist/rpc/OperationCommandPage.js +135 -224
- package/dist/rpc/OperationCommandPage.js.map +1 -1
- package/dist/rpc/OperationEntityPage.cjs +49 -100
- package/dist/rpc/OperationEntityPage.cjs.map +1 -1
- package/dist/rpc/OperationEntityPage.d.ts +6 -1
- package/dist/rpc/OperationEntityPage.d.ts.map +1 -1
- package/dist/rpc/OperationEntityPage.js +50 -101
- package/dist/rpc/OperationEntityPage.js.map +1 -1
- package/dist/rpc/OperationResultView.cjs +43 -0
- package/dist/rpc/OperationResultView.cjs.map +1 -0
- package/dist/rpc/OperationResultView.d.ts +30 -0
- package/dist/rpc/OperationResultView.d.ts.map +1 -0
- package/dist/rpc/OperationResultView.js +43 -0
- package/dist/rpc/OperationResultView.js.map +1 -0
- package/dist/rpc/SchemaActionForm.cjs +102 -0
- package/dist/rpc/SchemaActionForm.cjs.map +1 -0
- package/dist/rpc/SchemaActionForm.d.ts +23 -0
- package/dist/rpc/SchemaActionForm.d.ts.map +1 -0
- package/dist/rpc/SchemaActionForm.js +102 -0
- package/dist/rpc/SchemaActionForm.js.map +1 -0
- package/dist/rpc/accept-options.cjs.map +1 -1
- package/dist/rpc/accept-options.d.ts +0 -1
- package/dist/rpc/accept-options.d.ts.map +1 -1
- package/dist/rpc/accept-options.js.map +1 -1
- package/dist/rpc/apiClient.cjs +34 -2
- package/dist/rpc/apiClient.cjs.map +1 -1
- package/dist/rpc/apiClient.d.ts +4 -1
- package/dist/rpc/apiClient.d.ts.map +1 -1
- package/dist/rpc/apiClient.js +34 -2
- package/dist/rpc/apiClient.js.map +1 -1
- package/dist/rpc/clickyMetadata.cjs +4 -4
- package/dist/rpc/clickyMetadata.cjs.map +1 -1
- package/dist/rpc/clickyMetadata.d.ts +0 -1
- package/dist/rpc/clickyMetadata.d.ts.map +1 -1
- package/dist/rpc/clickyMetadata.js +4 -4
- package/dist/rpc/clickyMetadata.js.map +1 -1
- package/dist/rpc/formMetadata.cjs +1 -0
- package/dist/rpc/formMetadata.cjs.map +1 -1
- package/dist/rpc/formMetadata.d.ts +6 -1
- package/dist/rpc/formMetadata.d.ts.map +1 -1
- package/dist/rpc/formMetadata.js +1 -0
- package/dist/rpc/formMetadata.js.map +1 -1
- package/dist/rpc/rowNavigation.cjs +86 -0
- package/dist/rpc/rowNavigation.cjs.map +1 -0
- package/dist/rpc/rowNavigation.d.ts +14 -0
- package/dist/rpc/rowNavigation.d.ts.map +1 -0
- package/dist/rpc/rowNavigation.js +86 -0
- package/dist/rpc/rowNavigation.js.map +1 -0
- package/dist/rpc/schemaActionPath.cjs +22 -0
- package/dist/rpc/schemaActionPath.cjs.map +1 -0
- package/dist/rpc/schemaActionPath.d.ts +4 -0
- package/dist/rpc/schemaActionPath.d.ts.map +1 -0
- package/dist/rpc/schemaActionPath.js +22 -0
- package/dist/rpc/schemaActionPath.js.map +1 -0
- package/dist/rpc/surfaceIconMap.cjs +35 -0
- package/dist/rpc/surfaceIconMap.cjs.map +1 -0
- package/dist/rpc/surfaceIconMap.d.ts +3 -0
- package/dist/rpc/surfaceIconMap.d.ts.map +1 -0
- package/dist/rpc/surfaceIconMap.js +35 -0
- package/dist/rpc/surfaceIconMap.js.map +1 -0
- package/dist/rpc/types.cjs.map +1 -1
- package/dist/rpc/types.d.ts +2 -0
- package/dist/rpc/types.d.ts.map +1 -1
- package/dist/rpc/types.js.map +1 -1
- package/dist/rpc/useOperations.cjs.map +1 -1
- package/dist/rpc/useOperations.d.ts +4 -1
- package/dist/rpc/useOperations.d.ts.map +1 -1
- package/dist/rpc/useOperations.js.map +1 -1
- package/dist/rpc.cjs +4 -2
- package/dist/rpc.cjs.map +1 -1
- package/dist/rpc.d.ts +7 -6
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +4 -2
- package/dist/rpc.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -1
- package/dist/rpc/AcceptPicker.cjs +0 -137
- package/dist/rpc/AcceptPicker.cjs.map +0 -1
- package/dist/rpc/AcceptPicker.d.ts +0 -12
- package/dist/rpc/AcceptPicker.d.ts.map +0 -1
- package/dist/rpc/AcceptPicker.js +0 -137
- package/dist/rpc/AcceptPicker.js.map +0 -1
|
@@ -0,0 +1,616 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const react = require("react");
|
|
5
|
+
const button = require("../components/button.cjs");
|
|
6
|
+
const IconButton = require("../components/IconButton.cjs");
|
|
7
|
+
const SegmentedControl = require("../components/SegmentedControl.cjs");
|
|
8
|
+
const utils = require("../lib/utils.cjs");
|
|
9
|
+
const Clicky = require("./Clicky.cjs");
|
|
10
|
+
const Icon = require("./Icon.cjs");
|
|
11
|
+
const JsonView = require("./JsonView.cjs");
|
|
12
|
+
const Markdown = require("./Markdown.cjs");
|
|
13
|
+
const MarkdownEditor_model = require("./MarkdownEditor.model.cjs");
|
|
14
|
+
const UiFileSpreadsheet = require("../icons/components/UiFileSpreadsheet.cjs");
|
|
15
|
+
const UiJson = require("../icons/components/UiJson.cjs");
|
|
16
|
+
const UiFileText = require("../icons/components/UiFileText.cjs");
|
|
17
|
+
const UiMarkdown = require("../icons/components/UiMarkdown.cjs");
|
|
18
|
+
const UiFileCode = require("../icons/components/UiFileCode.cjs");
|
|
19
|
+
const UiEye = require("../icons/components/UiEye.cjs");
|
|
20
|
+
const UiEdit = require("../icons/components/UiEdit.cjs");
|
|
21
|
+
const UiRefresh = require("../icons/components/UiRefresh.cjs");
|
|
22
|
+
const UiCopy = require("../icons/components/UiCopy.cjs");
|
|
23
|
+
const FORMAT_META = {
|
|
24
|
+
react: {
|
|
25
|
+
label: "React",
|
|
26
|
+
icon: UiEye.UiEye
|
|
27
|
+
},
|
|
28
|
+
html: {
|
|
29
|
+
label: "HTML",
|
|
30
|
+
icon: UiFileCode.UiFileCode
|
|
31
|
+
},
|
|
32
|
+
markdown: {
|
|
33
|
+
label: "Markdown",
|
|
34
|
+
icon: UiMarkdown.UiMarkdown
|
|
35
|
+
},
|
|
36
|
+
pdf: {
|
|
37
|
+
label: "PDF",
|
|
38
|
+
icon: UiFileText.UiFileText,
|
|
39
|
+
iconClassName: "text-rose-600 dark:text-rose-400"
|
|
40
|
+
},
|
|
41
|
+
json: {
|
|
42
|
+
label: "JSON",
|
|
43
|
+
icon: UiJson.UiJson
|
|
44
|
+
},
|
|
45
|
+
csv: {
|
|
46
|
+
label: "CSV",
|
|
47
|
+
icon: UiFileSpreadsheet.UiFileSpreadsheet,
|
|
48
|
+
iconClassName: "text-emerald-600 dark:text-emerald-400"
|
|
49
|
+
},
|
|
50
|
+
excel: {
|
|
51
|
+
label: "Excel",
|
|
52
|
+
icon: UiFileSpreadsheet.UiFileSpreadsheet,
|
|
53
|
+
iconClassName: "text-emerald-700 dark:text-emerald-300"
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
function MarkdownEditor({
|
|
57
|
+
value,
|
|
58
|
+
defaultValue = "",
|
|
59
|
+
onChange,
|
|
60
|
+
label = "Markdown",
|
|
61
|
+
placeholder = "Write markdown...",
|
|
62
|
+
previewFormats,
|
|
63
|
+
previewFormat,
|
|
64
|
+
defaultPreviewFormat,
|
|
65
|
+
onPreviewFormatChange,
|
|
66
|
+
previewEndpoint,
|
|
67
|
+
previewMethod = "POST",
|
|
68
|
+
previewHeaders,
|
|
69
|
+
buildPreviewUrl,
|
|
70
|
+
loadPreview,
|
|
71
|
+
clickyData,
|
|
72
|
+
previewDebounceMs = 350,
|
|
73
|
+
minHeight = 420,
|
|
74
|
+
disabled = false,
|
|
75
|
+
readOnly = false,
|
|
76
|
+
className,
|
|
77
|
+
editorClassName,
|
|
78
|
+
previewClassName,
|
|
79
|
+
toolbar
|
|
80
|
+
}) {
|
|
81
|
+
const editorId = react.useId();
|
|
82
|
+
const formats = react.useMemo(
|
|
83
|
+
() => normalizePreviewFormats(previewFormats),
|
|
84
|
+
[previewFormats]
|
|
85
|
+
);
|
|
86
|
+
const firstFormat = formats[0] ?? "react";
|
|
87
|
+
const [draft, setDraft] = react.useState(defaultValue);
|
|
88
|
+
const markdown = value ?? draft;
|
|
89
|
+
const [internalFormat, setInternalFormat] = react.useState(
|
|
90
|
+
() => normalizeInitialFormat(defaultPreviewFormat, formats) ?? firstFormat
|
|
91
|
+
);
|
|
92
|
+
const activeFormat = formats.includes(previewFormat ?? internalFormat) ? previewFormat ?? internalFormat : firstFormat;
|
|
93
|
+
const [refreshKey, setRefreshKey] = react.useState(0);
|
|
94
|
+
const [previewState, setPreviewState] = react.useState({
|
|
95
|
+
status: "idle"
|
|
96
|
+
});
|
|
97
|
+
const contentStyle = react.useMemo(
|
|
98
|
+
() => ({ minHeight: cssSize(minHeight) }),
|
|
99
|
+
[minHeight]
|
|
100
|
+
);
|
|
101
|
+
const remoteEnabled = Boolean(loadPreview || previewEndpoint || buildPreviewUrl);
|
|
102
|
+
const currentMeta = FORMAT_META[activeFormat];
|
|
103
|
+
const segmentOptions = react.useMemo(
|
|
104
|
+
() => formats.map((format) => {
|
|
105
|
+
const meta = FORMAT_META[format];
|
|
106
|
+
return {
|
|
107
|
+
id: format,
|
|
108
|
+
label: meta.label,
|
|
109
|
+
icon: meta.icon,
|
|
110
|
+
title: `${meta.label} preview`
|
|
111
|
+
};
|
|
112
|
+
}),
|
|
113
|
+
[formats]
|
|
114
|
+
);
|
|
115
|
+
react.useEffect(() => {
|
|
116
|
+
if (formats.includes(activeFormat)) return;
|
|
117
|
+
setInternalFormat(firstFormat);
|
|
118
|
+
}, [activeFormat, firstFormat, formats]);
|
|
119
|
+
react.useEffect(() => {
|
|
120
|
+
if (!remoteEnabled) {
|
|
121
|
+
setPreviewState({ status: "idle" });
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const controller = new AbortController();
|
|
125
|
+
const timeout = window.setTimeout(() => {
|
|
126
|
+
setPreviewState(
|
|
127
|
+
(current) => current.status === "success" ? { status: "loading", result: current.result } : { status: "loading" }
|
|
128
|
+
);
|
|
129
|
+
resolvePreview({
|
|
130
|
+
markdown,
|
|
131
|
+
format: activeFormat,
|
|
132
|
+
signal: controller.signal,
|
|
133
|
+
previewEndpoint,
|
|
134
|
+
previewMethod,
|
|
135
|
+
previewHeaders,
|
|
136
|
+
buildPreviewUrl,
|
|
137
|
+
loadPreview
|
|
138
|
+
}).then((result) => {
|
|
139
|
+
if (!controller.signal.aborted) {
|
|
140
|
+
setPreviewState({ status: "success", result });
|
|
141
|
+
}
|
|
142
|
+
}).catch((error) => {
|
|
143
|
+
if (controller.signal.aborted) return;
|
|
144
|
+
setPreviewState((current) => ({
|
|
145
|
+
status: "error",
|
|
146
|
+
error: error instanceof Error ? error.message : "Preview failed",
|
|
147
|
+
...current.status === "loading" && current.result ? { result: current.result } : {}
|
|
148
|
+
}));
|
|
149
|
+
});
|
|
150
|
+
}, Math.max(0, previewDebounceMs));
|
|
151
|
+
return () => {
|
|
152
|
+
window.clearTimeout(timeout);
|
|
153
|
+
controller.abort();
|
|
154
|
+
};
|
|
155
|
+
}, [
|
|
156
|
+
activeFormat,
|
|
157
|
+
buildPreviewUrl,
|
|
158
|
+
loadPreview,
|
|
159
|
+
markdown,
|
|
160
|
+
previewDebounceMs,
|
|
161
|
+
previewEndpoint,
|
|
162
|
+
previewHeaders,
|
|
163
|
+
previewMethod,
|
|
164
|
+
refreshKey,
|
|
165
|
+
remoteEnabled
|
|
166
|
+
]);
|
|
167
|
+
const updateMarkdown = (next) => {
|
|
168
|
+
if (value === void 0) setDraft(next);
|
|
169
|
+
onChange == null ? void 0 : onChange(next);
|
|
170
|
+
};
|
|
171
|
+
const updateFormat = (next) => {
|
|
172
|
+
if (previewFormat === void 0) setInternalFormat(next);
|
|
173
|
+
onPreviewFormatChange == null ? void 0 : onPreviewFormatChange(next);
|
|
174
|
+
};
|
|
175
|
+
const copySource = () => {
|
|
176
|
+
var _a;
|
|
177
|
+
const clipboard = (_a = globalThis.navigator) == null ? void 0 : _a.clipboard;
|
|
178
|
+
if (clipboard == null ? void 0 : clipboard.writeText) {
|
|
179
|
+
void clipboard.writeText(markdown).catch(() => void 0);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils.cn("rounded-md border border-border bg-card", className), children: [
|
|
183
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-density-2 border-b border-border px-density-3 py-density-2", children: [
|
|
184
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
185
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { icon: UiEdit.UiEdit, className: "text-base text-muted-foreground" }),
|
|
186
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
187
|
+
"label",
|
|
188
|
+
{
|
|
189
|
+
htmlFor: editorId,
|
|
190
|
+
className: "truncate text-sm font-medium text-card-foreground",
|
|
191
|
+
children: label
|
|
192
|
+
}
|
|
193
|
+
),
|
|
194
|
+
previewState.status === "loading" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: "Refreshing..." })
|
|
195
|
+
] }),
|
|
196
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-wrap items-center justify-end gap-2", children: [
|
|
197
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
198
|
+
SegmentedControl.SegmentedControl,
|
|
199
|
+
{
|
|
200
|
+
value: activeFormat,
|
|
201
|
+
options: segmentOptions,
|
|
202
|
+
onChange: updateFormat,
|
|
203
|
+
size: "sm",
|
|
204
|
+
"aria-label": "Markdown preview format",
|
|
205
|
+
className: "max-w-full flex-wrap"
|
|
206
|
+
}
|
|
207
|
+
),
|
|
208
|
+
remoteEnabled && /* @__PURE__ */ jsxRuntime.jsx(
|
|
209
|
+
IconButton.IconButton,
|
|
210
|
+
{
|
|
211
|
+
icon: UiRefresh.UiRefresh,
|
|
212
|
+
label: "Refresh preview",
|
|
213
|
+
disabled,
|
|
214
|
+
onClick: () => setRefreshKey((current) => current + 1)
|
|
215
|
+
}
|
|
216
|
+
),
|
|
217
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconButton.IconButton, { icon: UiCopy.UiCopy, label: "Copy markdown", onClick: copySource }),
|
|
218
|
+
toolbar
|
|
219
|
+
] })
|
|
220
|
+
] }),
|
|
221
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-density-3 p-density-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]", children: [
|
|
222
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 overflow-hidden rounded-md border border-border bg-background", children: [
|
|
223
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-border px-density-3 py-density-2 text-xs font-medium text-muted-foreground", children: "Source" }),
|
|
224
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
225
|
+
"textarea",
|
|
226
|
+
{
|
|
227
|
+
id: editorId,
|
|
228
|
+
value: markdown,
|
|
229
|
+
placeholder,
|
|
230
|
+
disabled,
|
|
231
|
+
readOnly,
|
|
232
|
+
spellCheck: true,
|
|
233
|
+
onChange: (event) => updateMarkdown(event.currentTarget.value),
|
|
234
|
+
className: utils.cn(
|
|
235
|
+
"block w-full resize-y border-0 bg-transparent px-density-3 py-density-3 font-mono text-sm leading-6 text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-60",
|
|
236
|
+
editorClassName
|
|
237
|
+
),
|
|
238
|
+
style: contentStyle
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
] }),
|
|
242
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 overflow-hidden rounded-md border border-border bg-background", children: [
|
|
243
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 border-b border-border px-density-3 py-density-2 text-xs font-medium text-muted-foreground", children: [
|
|
244
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
245
|
+
Icon.Icon,
|
|
246
|
+
{
|
|
247
|
+
icon: currentMeta.icon,
|
|
248
|
+
className: utils.cn("text-sm", currentMeta.iconClassName)
|
|
249
|
+
}
|
|
250
|
+
),
|
|
251
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: currentMeta.label })
|
|
252
|
+
] }),
|
|
253
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
254
|
+
"div",
|
|
255
|
+
{
|
|
256
|
+
className: utils.cn(
|
|
257
|
+
"overflow-auto px-density-3 py-density-3",
|
|
258
|
+
previewClassName
|
|
259
|
+
),
|
|
260
|
+
style: contentStyle,
|
|
261
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
262
|
+
MarkdownEditorPreview,
|
|
263
|
+
{
|
|
264
|
+
format: activeFormat,
|
|
265
|
+
markdown,
|
|
266
|
+
state: previewState,
|
|
267
|
+
clickyData
|
|
268
|
+
}
|
|
269
|
+
)
|
|
270
|
+
}
|
|
271
|
+
)
|
|
272
|
+
] })
|
|
273
|
+
] })
|
|
274
|
+
] });
|
|
275
|
+
}
|
|
276
|
+
function MarkdownEditorPreview({
|
|
277
|
+
format,
|
|
278
|
+
markdown,
|
|
279
|
+
state,
|
|
280
|
+
clickyData
|
|
281
|
+
}) {
|
|
282
|
+
const result = state.status === "success" || state.status === "loading" || state.status === "error" ? state.result : void 0;
|
|
283
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-density-3", children: [
|
|
284
|
+
state.status === "error" && /* @__PURE__ */ jsxRuntime.jsx(PreviewNotice, { title: "Preview failed", message: state.error, tone: "danger" }),
|
|
285
|
+
result ? /* @__PURE__ */ jsxRuntime.jsx(PreviewResult, { format, result }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
286
|
+
LocalPreview,
|
|
287
|
+
{
|
|
288
|
+
format,
|
|
289
|
+
markdown,
|
|
290
|
+
clickyData
|
|
291
|
+
}
|
|
292
|
+
)
|
|
293
|
+
] });
|
|
294
|
+
}
|
|
295
|
+
function LocalPreview({
|
|
296
|
+
format,
|
|
297
|
+
markdown,
|
|
298
|
+
clickyData
|
|
299
|
+
}) {
|
|
300
|
+
if (format === "react") {
|
|
301
|
+
const data = typeof clickyData === "function" ? clickyData(markdown) : clickyData;
|
|
302
|
+
return data === void 0 ? /* @__PURE__ */ jsxRuntime.jsx(Markdown.Markdown, { text: markdown }) : /* @__PURE__ */ jsxRuntime.jsx(Clicky.Clicky, { data });
|
|
303
|
+
}
|
|
304
|
+
if (format === "markdown") {
|
|
305
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TextPreview, { label: "Markdown source", text: markdown });
|
|
306
|
+
}
|
|
307
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
308
|
+
PreviewNotice,
|
|
309
|
+
{
|
|
310
|
+
title: `${FORMAT_META[format].label} preview not configured`,
|
|
311
|
+
message: "Pass previewEndpoint or loadPreview to render this format from Clicky."
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
function PreviewResult({
|
|
316
|
+
format,
|
|
317
|
+
result
|
|
318
|
+
}) {
|
|
319
|
+
switch (result.kind) {
|
|
320
|
+
case "clicky":
|
|
321
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Clicky.Clicky, { data: result.data });
|
|
322
|
+
case "html":
|
|
323
|
+
return /* @__PURE__ */ jsxRuntime.jsx(HtmlPreview, { html: result.html });
|
|
324
|
+
case "json":
|
|
325
|
+
return /* @__PURE__ */ jsxRuntime.jsx(JsonView.JsonView, { data: result.data });
|
|
326
|
+
case "url":
|
|
327
|
+
return /* @__PURE__ */ jsxRuntime.jsx(UrlPreview, { format, url: result.url });
|
|
328
|
+
case "blob":
|
|
329
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BlobPreview, { format, result });
|
|
330
|
+
case "text":
|
|
331
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TextResult, { format, result });
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
function TextResult({
|
|
335
|
+
format,
|
|
336
|
+
result
|
|
337
|
+
}) {
|
|
338
|
+
if (format === "react") {
|
|
339
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Clicky.Clicky, { data: result.text });
|
|
340
|
+
}
|
|
341
|
+
if (format === "html" || isHtmlContent(result.contentType)) {
|
|
342
|
+
return /* @__PURE__ */ jsxRuntime.jsx(HtmlPreview, { html: result.text });
|
|
343
|
+
}
|
|
344
|
+
if (format === "json" || isJsonContent(result.contentType)) {
|
|
345
|
+
const parsed = parseJson(result.text);
|
|
346
|
+
return parsed.ok ? /* @__PURE__ */ jsxRuntime.jsx(JsonView.JsonView, { data: parsed.value }) : /* @__PURE__ */ jsxRuntime.jsx(TextPreview, { label: "JSON output", text: result.text });
|
|
347
|
+
}
|
|
348
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
349
|
+
TextPreview,
|
|
350
|
+
{
|
|
351
|
+
label: `${FORMAT_META[format].label} output`,
|
|
352
|
+
text: result.text
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
function UrlPreview({
|
|
357
|
+
format,
|
|
358
|
+
url
|
|
359
|
+
}) {
|
|
360
|
+
if (format === "react") {
|
|
361
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Clicky.Clicky, { url, view: ["clicky"], download: { all: false } });
|
|
362
|
+
}
|
|
363
|
+
if (format === "html") {
|
|
364
|
+
return /* @__PURE__ */ jsxRuntime.jsx(HtmlPreview, { src: url });
|
|
365
|
+
}
|
|
366
|
+
if (format === "pdf") {
|
|
367
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FramePreview, { title: "PDF preview", src: url });
|
|
368
|
+
}
|
|
369
|
+
if (format === "excel") {
|
|
370
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DownloadPreview, { label: "Open Excel workbook", href: url });
|
|
371
|
+
}
|
|
372
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TextPreview, { label: `${FORMAT_META[format].label} URL`, text: url });
|
|
373
|
+
}
|
|
374
|
+
function BlobPreview({
|
|
375
|
+
format,
|
|
376
|
+
result
|
|
377
|
+
}) {
|
|
378
|
+
const [url, setUrl] = react.useState();
|
|
379
|
+
react.useEffect(() => {
|
|
380
|
+
const next = URL.createObjectURL(result.blob);
|
|
381
|
+
setUrl(next);
|
|
382
|
+
return () => URL.revokeObjectURL(next);
|
|
383
|
+
}, [result.blob]);
|
|
384
|
+
if (!url) {
|
|
385
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PreviewNotice, { title: "Preparing preview", message: "Creating object URL." });
|
|
386
|
+
}
|
|
387
|
+
if (format === "pdf") {
|
|
388
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FramePreview, { title: "PDF preview", src: url });
|
|
389
|
+
}
|
|
390
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
391
|
+
DownloadPreview,
|
|
392
|
+
{
|
|
393
|
+
label: `Open ${FORMAT_META[format].label}`,
|
|
394
|
+
href: url,
|
|
395
|
+
...result.filename ? { download: result.filename } : {}
|
|
396
|
+
}
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
function HtmlPreview({
|
|
400
|
+
html,
|
|
401
|
+
src
|
|
402
|
+
}) {
|
|
403
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
404
|
+
FramePreview,
|
|
405
|
+
{
|
|
406
|
+
title: "HTML preview",
|
|
407
|
+
...src ? { src } : {},
|
|
408
|
+
...html ? { srcDoc: html } : {},
|
|
409
|
+
sandbox: "allow-same-origin"
|
|
410
|
+
}
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
function FramePreview({
|
|
414
|
+
title,
|
|
415
|
+
src,
|
|
416
|
+
srcDoc,
|
|
417
|
+
sandbox
|
|
418
|
+
}) {
|
|
419
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-md border border-border bg-background", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
420
|
+
"iframe",
|
|
421
|
+
{
|
|
422
|
+
title,
|
|
423
|
+
...src ? { src } : {},
|
|
424
|
+
...srcDoc ? { srcDoc } : {},
|
|
425
|
+
...sandbox ? { sandbox } : {},
|
|
426
|
+
className: "h-[720px] w-full bg-background"
|
|
427
|
+
}
|
|
428
|
+
) });
|
|
429
|
+
}
|
|
430
|
+
function DownloadPreview({
|
|
431
|
+
label,
|
|
432
|
+
href,
|
|
433
|
+
download
|
|
434
|
+
}) {
|
|
435
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
436
|
+
PreviewNotice,
|
|
437
|
+
{
|
|
438
|
+
title: "Inline preview unavailable",
|
|
439
|
+
message: /* @__PURE__ */ jsxRuntime.jsx(button.Button, { asChild: true, variant: "outline", size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
440
|
+
"a",
|
|
441
|
+
{
|
|
442
|
+
href,
|
|
443
|
+
target: "_blank",
|
|
444
|
+
rel: "noreferrer",
|
|
445
|
+
...download ? { download } : {},
|
|
446
|
+
children: label
|
|
447
|
+
}
|
|
448
|
+
) })
|
|
449
|
+
}
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
function TextPreview({ label, text }) {
|
|
453
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
454
|
+
"pre",
|
|
455
|
+
{
|
|
456
|
+
"aria-label": label,
|
|
457
|
+
className: "overflow-auto whitespace-pre-wrap break-words rounded-md border border-border bg-muted/30 px-density-3 py-density-3 font-mono text-xs text-foreground",
|
|
458
|
+
children: text || "No content"
|
|
459
|
+
}
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
function PreviewNotice({
|
|
463
|
+
title,
|
|
464
|
+
message,
|
|
465
|
+
tone = "default"
|
|
466
|
+
}) {
|
|
467
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
468
|
+
"div",
|
|
469
|
+
{
|
|
470
|
+
className: utils.cn(
|
|
471
|
+
"rounded-md border p-density-3",
|
|
472
|
+
tone === "danger" ? "border-destructive/30 bg-destructive/5" : "border-border bg-muted/30"
|
|
473
|
+
),
|
|
474
|
+
children: [
|
|
475
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
476
|
+
"div",
|
|
477
|
+
{
|
|
478
|
+
className: utils.cn(
|
|
479
|
+
"text-sm font-medium",
|
|
480
|
+
tone === "danger" && "text-destructive"
|
|
481
|
+
),
|
|
482
|
+
children: title
|
|
483
|
+
}
|
|
484
|
+
),
|
|
485
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 text-xs text-muted-foreground", children: message })
|
|
486
|
+
]
|
|
487
|
+
}
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
function normalizePreviewFormats(formats) {
|
|
491
|
+
const seen = /* @__PURE__ */ new Set();
|
|
492
|
+
const source = formats && formats.length > 0 ? formats : MarkdownEditor_model.MARKDOWN_EDITOR_PREVIEW_FORMATS;
|
|
493
|
+
for (const format of source) {
|
|
494
|
+
seen.add(format);
|
|
495
|
+
}
|
|
496
|
+
return [...seen];
|
|
497
|
+
}
|
|
498
|
+
function normalizeInitialFormat(format, formats) {
|
|
499
|
+
return format && formats.includes(format) ? format : void 0;
|
|
500
|
+
}
|
|
501
|
+
function cssSize(size) {
|
|
502
|
+
return typeof size === "number" ? `${size}px` : size;
|
|
503
|
+
}
|
|
504
|
+
async function resolvePreview({
|
|
505
|
+
markdown,
|
|
506
|
+
format,
|
|
507
|
+
signal,
|
|
508
|
+
previewEndpoint,
|
|
509
|
+
previewMethod,
|
|
510
|
+
previewHeaders,
|
|
511
|
+
buildPreviewUrl,
|
|
512
|
+
loadPreview
|
|
513
|
+
}) {
|
|
514
|
+
if (loadPreview) {
|
|
515
|
+
return loadPreview({ markdown, format, signal });
|
|
516
|
+
}
|
|
517
|
+
const url = (buildPreviewUrl == null ? void 0 : buildPreviewUrl({ markdown, format })) ?? (previewEndpoint ? MarkdownEditor_model.buildMarkdownPreviewUrl(previewEndpoint, format) : void 0);
|
|
518
|
+
if (!url) {
|
|
519
|
+
throw new Error("No preview endpoint configured");
|
|
520
|
+
}
|
|
521
|
+
const headers = new Headers(
|
|
522
|
+
typeof previewHeaders === "function" ? previewHeaders({ markdown, format }) : previewHeaders
|
|
523
|
+
);
|
|
524
|
+
headers.set("Accept", previewAccept(format));
|
|
525
|
+
const init = {
|
|
526
|
+
method: previewMethod,
|
|
527
|
+
headers,
|
|
528
|
+
signal
|
|
529
|
+
};
|
|
530
|
+
if (previewMethod !== "GET") {
|
|
531
|
+
headers.set("Content-Type", "text/markdown; charset=utf-8");
|
|
532
|
+
init.body = markdown;
|
|
533
|
+
}
|
|
534
|
+
const response = await fetch(url, init);
|
|
535
|
+
if (!response.ok) {
|
|
536
|
+
throw new Error(
|
|
537
|
+
`Preview failed with ${response.status} ${response.statusText}`.trim()
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
const contentType = response.headers.get("Content-Type") ?? "";
|
|
541
|
+
if (format === "pdf" || format === "excel" || isBinaryContent(contentType)) {
|
|
542
|
+
return {
|
|
543
|
+
kind: "blob",
|
|
544
|
+
blob: await response.blob(),
|
|
545
|
+
contentType,
|
|
546
|
+
filename: previewFilename(format)
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
const text = await response.text();
|
|
550
|
+
if (format === "react") {
|
|
551
|
+
return { kind: "clicky", data: text };
|
|
552
|
+
}
|
|
553
|
+
if (format === "html" || isHtmlContent(contentType)) {
|
|
554
|
+
return { kind: "html", html: text };
|
|
555
|
+
}
|
|
556
|
+
if (format === "json" || isJsonContent(contentType)) {
|
|
557
|
+
const parsed = parseJson(text);
|
|
558
|
+
return parsed.ok ? { kind: "json", data: parsed.value } : { kind: "text", text, contentType };
|
|
559
|
+
}
|
|
560
|
+
return { kind: "text", text, contentType };
|
|
561
|
+
}
|
|
562
|
+
function previewAccept(format) {
|
|
563
|
+
switch (format) {
|
|
564
|
+
case "react":
|
|
565
|
+
return "application/json+clicky, application/clicky+json;q=0.9, application/json;q=0.8,*/*;q=0.7";
|
|
566
|
+
case "html":
|
|
567
|
+
return "text/html, */*;q=0.7";
|
|
568
|
+
case "markdown":
|
|
569
|
+
return "text/markdown, text/plain;q=0.8,*/*;q=0.7";
|
|
570
|
+
case "pdf":
|
|
571
|
+
return "application/pdf, */*;q=0.7";
|
|
572
|
+
case "json":
|
|
573
|
+
return "application/json, text/plain;q=0.8,*/*;q=0.7";
|
|
574
|
+
case "csv":
|
|
575
|
+
return "text/csv, text/plain;q=0.8,*/*;q=0.7";
|
|
576
|
+
case "excel":
|
|
577
|
+
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, */*;q=0.7";
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
function previewFilename(format) {
|
|
581
|
+
switch (format) {
|
|
582
|
+
case "react":
|
|
583
|
+
return "preview.clicky.json";
|
|
584
|
+
case "html":
|
|
585
|
+
return "preview.html";
|
|
586
|
+
case "markdown":
|
|
587
|
+
return "preview.md";
|
|
588
|
+
case "pdf":
|
|
589
|
+
return "preview.pdf";
|
|
590
|
+
case "json":
|
|
591
|
+
return "preview.json";
|
|
592
|
+
case "csv":
|
|
593
|
+
return "preview.csv";
|
|
594
|
+
case "excel":
|
|
595
|
+
return "preview.xlsx";
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
function parseJson(text) {
|
|
599
|
+
try {
|
|
600
|
+
return { ok: true, value: JSON.parse(text) };
|
|
601
|
+
} catch {
|
|
602
|
+
return { ok: false };
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
function isJsonContent(contentType) {
|
|
606
|
+
return (contentType == null ? void 0 : contentType.toLowerCase().includes("json")) ?? false;
|
|
607
|
+
}
|
|
608
|
+
function isHtmlContent(contentType) {
|
|
609
|
+
return (contentType == null ? void 0 : contentType.toLowerCase().includes("html")) ?? false;
|
|
610
|
+
}
|
|
611
|
+
function isBinaryContent(contentType) {
|
|
612
|
+
const normalized = (contentType == null ? void 0 : contentType.toLowerCase()) ?? "";
|
|
613
|
+
return normalized.includes("application/pdf") || normalized.includes("spreadsheetml") || normalized.includes("application/vnd.ms-excel");
|
|
614
|
+
}
|
|
615
|
+
exports.MarkdownEditor = MarkdownEditor;
|
|
616
|
+
//# sourceMappingURL=MarkdownEditor.cjs.map
|