@bendyline/squisq-editor-react 2.1.0 → 2.3.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 +21 -0
- package/NOTICE.md +40 -0
- package/dist/chunk-54UGTQBO.js +862 -0
- package/dist/chunk-5JMHFAVW.js +2408 -0
- package/dist/chunk-5Q4JN4I5.js +132 -0
- package/dist/chunk-6VDYKI3L.js +49 -0
- package/dist/chunk-GS7QWYFT.js +9 -0
- package/dist/chunk-MJJK7YQB.js +949 -0
- package/dist/chunk-NITZVAXL.js +986 -0
- package/dist/chunk-TRCKHRBS.js +35234 -0
- package/dist/chunk-V44VP242.js +3256 -0
- package/dist/image-editor/index.d.ts +223 -0
- package/dist/image-editor/index.js +15 -0
- package/dist/index.d.ts +2060 -4040
- package/dist/index.js +496 -40014
- package/dist/json-editor/index.d.ts +27 -0
- package/dist/json-editor/index.js +7 -0
- package/dist/monaco.d.ts +1 -1
- package/dist/monaco.js +1 -2
- package/dist/recorder/index.d.ts +407 -0
- package/dist/recorder/index.js +43 -0
- package/dist/shell/index.d.ts +9 -0
- package/dist/shell/index.js +22 -0
- package/dist/shell-BxSCBm4H.d.ts +1064 -0
- package/dist/styles/index.css +598 -161
- package/dist/teleprompter/index.d.ts +497 -0
- package/dist/teleprompter/index.js +57 -0
- package/package.json +34 -8
- package/dist/index.js.map +0 -1
- package/dist/monaco.js.map +0 -1
- package/src/BlockCardView.tsx +0 -121
- package/src/BlockPreviewPanel.tsx +0 -69
- package/src/BlockPropertiesPopover.tsx +0 -222
- package/src/DocumentSettingsDialog.tsx +0 -272
- package/src/DropZoneOverlay.tsx +0 -137
- package/src/EditorContext.tsx +0 -1274
- package/src/EditorShell.tsx +0 -1358
- package/src/EmojiPicker.tsx +0 -332
- package/src/FolderView.tsx +0 -131
- package/src/Icon.tsx +0 -26
- package/src/ImageEditor.tsx +0 -395
- package/src/ImageNodeView.tsx +0 -284
- package/src/ImageViewer.tsx +0 -221
- package/src/InlineIcon.ts +0 -84
- package/src/InlinePreviewGutter.tsx +0 -590
- package/src/LinkDialog.tsx +0 -276
- package/src/MediaBin.tsx +0 -500
- package/src/MentionExtension.tsx +0 -261
- package/src/OutlinePanel.tsx +0 -547
- package/src/PlainHtmlPreview.tsx +0 -277
- package/src/PreviewControls.tsx +0 -1265
- package/src/PreviewPanel.tsx +0 -426
- package/src/RawEditor.tsx +0 -743
- package/src/RecorderEntry.tsx +0 -162
- package/src/StatusBar.tsx +0 -51
- package/src/TemplateAnnotation.ts +0 -167
- package/src/TemplateContentPreview.tsx +0 -56
- package/src/TemplatePicker.tsx +0 -1314
- package/src/ThemeCustomizerPanel.tsx +0 -304
- package/src/ThemePicker.tsx +0 -433
- package/src/TimelineBlockPreview.tsx +0 -37
- package/src/TimelineTrack.tsx +0 -671
- package/src/Toolbar.tsx +0 -2885
- package/src/Tooltip.tsx +0 -142
- package/src/TransitionPicker.tsx +0 -390
- package/src/VersionHistoryPanel.tsx +0 -359
- package/src/ViewMenuPanel.tsx +0 -189
- package/src/ViewSwitcher.tsx +0 -56
- package/src/WysiwygEditor.tsx +0 -806
- package/src/__tests__/blockProperties.test.ts +0 -92
- package/src/__tests__/blockPropertiesPopoverTheme.test.tsx +0 -33
- package/src/__tests__/blockRange.test.ts +0 -105
- package/src/__tests__/blockTagActivity.test.ts +0 -183
- package/src/__tests__/buildDocumentPreviewMarkdown.test.ts +0 -75
- package/src/__tests__/buildPreviewDocContent.test.ts +0 -65
- package/src/__tests__/buildPreviewDocTransition.test.ts +0 -92
- package/src/__tests__/canvasSurfaceTextEditing.test.tsx +0 -60
- package/src/__tests__/codeContextSectionView.test.tsx +0 -97
- package/src/__tests__/codeContextZoneManager.test.ts +0 -127
- package/src/__tests__/createShapeLayer.test.ts +0 -46
- package/src/__tests__/customLayoutManagerTheme.test.tsx +0 -34
- package/src/__tests__/detectMarkdown.test.ts +0 -73
- package/src/__tests__/diffContextSections.test.ts +0 -39
- package/src/__tests__/documentSettingsDialog.test.tsx +0 -197
- package/src/__tests__/drawingShapeRoundTrip.test.ts +0 -49
- package/src/__tests__/editorScrollHandoff.test.tsx +0 -102
- package/src/__tests__/editorScrollSync.test.ts +0 -65
- package/src/__tests__/editorShellCodeContext.test.tsx +0 -86
- package/src/__tests__/editorShellProps.test.tsx +0 -550
- package/src/__tests__/embeddedMedia.test.ts +0 -48
- package/src/__tests__/emojiPicker.test.tsx +0 -93
- package/src/__tests__/fileKind.test.ts +0 -112
- package/src/__tests__/findMode.test.tsx +0 -104
- package/src/__tests__/findModel.test.ts +0 -55
- package/src/__tests__/headingTransition.test.ts +0 -176
- package/src/__tests__/imageEditAffordance.test.tsx +0 -272
- package/src/__tests__/imageEditModalContract.test.tsx +0 -119
- package/src/__tests__/imageEditorShell.test.tsx +0 -94
- package/src/__tests__/imageEditorState.test.ts +0 -171
- package/src/__tests__/inlinePreviewGutter.test.tsx +0 -62
- package/src/__tests__/inlinePreviewGutterAllBlocks.test.tsx +0 -103
- package/src/__tests__/jsonEditor.test.tsx +0 -223
- package/src/__tests__/layersPanel.test.tsx +0 -167
- package/src/__tests__/layoutChildRoundTrip.test.ts +0 -71
- package/src/__tests__/linkDialogDocPicker.test.tsx +0 -137
- package/src/__tests__/majorApiTypes.test.ts +0 -26
- package/src/__tests__/markdownCodeFence.test.ts +0 -45
- package/src/__tests__/mediaAttachmentFlow.test.ts +0 -110
- package/src/__tests__/mediaBinDrop.test.tsx +0 -90
- package/src/__tests__/mediaReferences.test.ts +0 -97
- package/src/__tests__/narrationSave.test.ts +0 -148
- package/src/__tests__/outlinePanel.test.tsx +0 -169
- package/src/__tests__/outlineSource.test.ts +0 -217
- package/src/__tests__/plainHtmlPreview.test.tsx +0 -125
- package/src/__tests__/presentationMode.test.tsx +0 -290
- package/src/__tests__/previewControls.test.tsx +0 -571
- package/src/__tests__/previewPanelAudioFailure.test.tsx +0 -46
- package/src/__tests__/previewPanelPresentation.test.tsx +0 -126
- package/src/__tests__/previewPanelTransforms.test.tsx +0 -117
- package/src/__tests__/propertiesPanel.test.tsx +0 -69
- package/src/__tests__/rawEditorModelIsolation.test.ts +0 -19
- package/src/__tests__/recorderFormats.test.ts +0 -146
- package/src/__tests__/recorderMediaInsert.test.ts +0 -86
- package/src/__tests__/recorderTheme.test.tsx +0 -42
- package/src/__tests__/recorderTimingJson.test.ts +0 -41
- package/src/__tests__/resolveBlockVisual.test.ts +0 -43
- package/src/__tests__/selectionConversions.test.ts +0 -80
- package/src/__tests__/statusBar.test.tsx +0 -27
- package/src/__tests__/teleprompter.test.tsx +0 -190
- package/src/__tests__/templateAnnotationRoundTrip.test.ts +0 -99
- package/src/__tests__/templateContentPreview.test.ts +0 -101
- package/src/__tests__/templatePickerMetadata.test.ts +0 -32
- package/src/__tests__/templatePickerPortal.test.tsx +0 -62
- package/src/__tests__/timelineSource.test.ts +0 -134
- package/src/__tests__/tiptapBridge.test.ts +0 -575
- package/src/__tests__/tiptapBridgeConformance.test.ts +0 -47
- package/src/__tests__/tiptapCodeBlockRoundTrip.test.ts +0 -109
- package/src/__tests__/tiptapImageRoundTrip.test.ts +0 -73
- package/src/__tests__/toolbarSelectionConversion.test.tsx +0 -190
- package/src/__tests__/tooltip.test.tsx +0 -72
- package/src/__tests__/transformStyleId.test.ts +0 -13
- package/src/__tests__/transitionCatalog.test.ts +0 -64
- package/src/__tests__/useBlockNavigator.test.tsx +0 -67
- package/src/__tests__/useImageEditor.test.tsx +0 -226
- package/src/__tests__/useJsonEditorTokens.test.ts +0 -59
- package/src/__tests__/useMediaRecorder.test.ts +0 -302
- package/src/__tests__/useTimelineClock.test.ts +0 -21
- package/src/__tests__/versionHistory.test.tsx +0 -197
- package/src/__tests__/viewMenuPanel.test.tsx +0 -130
- package/src/__tests__/writeCanvasSettings.test.ts +0 -15
- package/src/__tests__/wysiwygImageUpload.test.ts +0 -69
- package/src/__tests__/wysiwygTemplateBadgeFocus.test.tsx +0 -56
- package/src/asciiDiagram/AsciiDiagramExtension.ts +0 -343
- package/src/asciiDiagram/AsciiDiagramWidget.tsx +0 -254
- package/src/asciiDiagram/RepairableDiagramExtension.ts +0 -200
- package/src/asciiDiagram/__tests__/AsciiDiagramExtension.test.ts +0 -164
- package/src/asciiDiagram/__tests__/RepairableDiagramExtension.test.ts +0 -159
- package/src/asciiDiagram/__tests__/asciiDiagramCommands.test.ts +0 -284
- package/src/asciiDiagram/__tests__/asciiDiagramOps.test.ts +0 -114
- package/src/asciiDiagram/__tests__/asciiPaste.test.ts +0 -43
- package/src/asciiDiagram/asciiDiagramCommands.ts +0 -174
- package/src/asciiDiagram/asciiDiagramData.ts +0 -149
- package/src/asciiDiagram/asciiDiagramOps.ts +0 -238
- package/src/asciiDiagram/asciiPaste.ts +0 -19
- package/src/blockProperties.ts +0 -88
- package/src/blockRange.ts +0 -132
- package/src/blockSlice.ts +0 -75
- package/src/blockTagActivity.ts +0 -233
- package/src/buildDocumentPreviewMarkdown.ts +0 -168
- package/src/buildPreviewDoc.ts +0 -407
- package/src/codeContext/CodeContextSectionView.tsx +0 -124
- package/src/codeContext/CodeContextZoneManager.ts +0 -149
- package/src/codeContext/CodeContextZones.tsx +0 -121
- package/src/codeContext/diffContextSections.ts +0 -38
- package/src/codeContext/types.ts +0 -75
- package/src/codeSnippet/CodeSnippetExtension.ts +0 -205
- package/src/codeSnippet/CodeSnippetWidget.tsx +0 -109
- package/src/codeSnippet/__tests__/CodeSnippetExtension.test.ts +0 -95
- package/src/codeSnippet/__tests__/codeSnippetLanguages.test.ts +0 -50
- package/src/codeSnippet/codeSnippetCommands.ts +0 -21
- package/src/codeSnippet/codeSnippetData.ts +0 -43
- package/src/codeSnippet/codeSnippetLanguages.ts +0 -216
- package/src/customTemplates/AddBin.tsx +0 -126
- package/src/customTemplates/CustomLayoutManager.tsx +0 -234
- package/src/customTemplates/CustomTemplateContext.tsx +0 -188
- package/src/customTemplates/LayerToolbar.tsx +0 -580
- package/src/customTemplates/ShapeGlyph.tsx +0 -47
- package/src/customTemplates/TemplateDesigner.tsx +0 -433
- package/src/customTemplates/__tests__/library.test.ts +0 -96
- package/src/customTemplates/__tests__/normalizePositions.test.ts +0 -109
- package/src/customTemplates/__tests__/shapeDefs.test.ts +0 -49
- package/src/customTemplates/__tests__/useMemoryLayerAdapter.test.ts +0 -108
- package/src/customTemplates/designer.css +0 -732
- package/src/customTemplates/index.ts +0 -31
- package/src/customTemplates/library.ts +0 -110
- package/src/customTemplates/normalizePositions.ts +0 -75
- package/src/customTemplates/shapeDefs.ts +0 -131
- package/src/customTemplates/thumbnail.tsx +0 -63
- package/src/customTemplates/tokenDefs.ts +0 -60
- package/src/customTemplates/useDocCustomTemplates.ts +0 -52
- package/src/customTemplates/useMemoryLayerAdapter.ts +0 -129
- package/src/customThemes/CustomThemeContext.tsx +0 -185
- package/src/customThemes/CustomThemeDialog.tsx +0 -316
- package/src/customThemes/ImportThemeSection.tsx +0 -178
- package/src/customThemes/__tests__/CustomThemeContext.test.tsx +0 -64
- package/src/customThemes/__tests__/CustomThemeDialog.test.tsx +0 -47
- package/src/customThemes/__tests__/customThemeLibrary.test.ts +0 -60
- package/src/customThemes/__tests__/importThemeSection.test.tsx +0 -192
- package/src/customThemes/customThemeLibrary.ts +0 -100
- package/src/customThemes/index.ts +0 -37
- package/src/customThemes/themeControls.tsx +0 -229
- package/src/customThemes/themeDraft.ts +0 -288
- package/src/customThemes/useDocCustomThemes.ts +0 -49
- package/src/detectMarkdown.ts +0 -62
- package/src/diagram/DiagramCanvas.tsx +0 -260
- package/src/diagram/DiagramMaximizedOverlay.tsx +0 -46
- package/src/diagram/diagramCommands.ts +0 -604
- package/src/diagram/diagramConstants.ts +0 -17
- package/src/diagram/types.ts +0 -35
- package/src/editorScrollSync.ts +0 -73
- package/src/embeddedMedia.ts +0 -78
- package/src/emojiData.ts +0 -1317
- package/src/fileKind.ts +0 -158
- package/src/find/FindHighlightExtension.ts +0 -81
- package/src/find/FindToolbar.tsx +0 -314
- package/src/find/findModel.ts +0 -77
- package/src/frontmatter.ts +0 -29
- package/src/frontmatterSettings.ts +0 -23
- package/src/headingTransition.ts +0 -291
- package/src/hooks/useFileDrop.ts +0 -266
- package/src/imageEditor/CanvasSurface.tsx +0 -703
- package/src/imageEditor/ImageVersionHistoryDropdown.tsx +0 -396
- package/src/imageEditor/LayersPanel.tsx +0 -218
- package/src/imageEditor/PropertiesPanel.tsx +0 -474
- package/src/imageEditor/Toolbar.tsx +0 -459
- package/src/imageEditor/createShapeLayer.ts +0 -280
- package/src/imageEditor/icons.tsx +0 -68
- package/src/imageEditor/image-editor.css +0 -574
- package/src/imageEditor/layers/EditorImageLayer.tsx +0 -45
- package/src/imageEditor/layers/EditorShapeLayer.tsx +0 -62
- package/src/imageEditor/layers/EditorTextLayer.tsx +0 -45
- package/src/imageEditor/layers/SelectionHandles.tsx +0 -86
- package/src/imageEditor/state.ts +0 -173
- package/src/imageEditor/useImageEditor.ts +0 -385
- package/src/imageEditor/useImageEditorTokens.ts +0 -70
- package/src/index.ts +0 -559
- package/src/jsonEditor/EmbeddedRichTextField.tsx +0 -81
- package/src/jsonEditor/JsonEditor.tsx +0 -81
- package/src/jsonEditor/JsonEditorContext.tsx +0 -81
- package/src/jsonEditor/RenderNode.tsx +0 -87
- package/src/jsonEditor/editors.tsx +0 -745
- package/src/jsonEditor/index.ts +0 -2
- package/src/jsonEditor/json-editor.css +0 -463
- package/src/jsonEditor/useJsonEditorTokens.ts +0 -33
- package/src/markdownCodeFence.ts +0 -72
- package/src/mediaDragMime.ts +0 -32
- package/src/mediaEntries.ts +0 -12
- package/src/mediaReferences.ts +0 -301
- package/src/mermaid/MermaidDiagramCanvas.tsx +0 -693
- package/src/mermaid/MermaidDiagramExtension.ts +0 -243
- package/src/mermaid/MermaidDiagramTypeThumbnail.tsx +0 -184
- package/src/mermaid/MermaidDiagramWidget.tsx +0 -653
- package/src/mermaid/MermaidShapePalette.tsx +0 -245
- package/src/mermaid/__tests__/MermaidDiagramExtension.test.ts +0 -361
- package/src/mermaid/__tests__/mermaidDiagramTypes.test.ts +0 -35
- package/src/mermaid/__tests__/mermaidRenderer.test.ts +0 -49
- package/src/mermaid/__tests__/mermaidSourceOps.test.ts +0 -213
- package/src/mermaid/__tests__/mermaidSyntax.test.ts +0 -71
- package/src/mermaid/mermaidCommands.ts +0 -34
- package/src/mermaid/mermaidData.ts +0 -31
- package/src/mermaid/mermaidDiagramTypes.ts +0 -325
- package/src/mermaid/mermaidModel.ts +0 -31
- package/src/mermaid/mermaidRenderer.ts +0 -181
- package/src/mermaid/mermaidShapes.ts +0 -113
- package/src/mermaid/mermaidSourceOps.ts +0 -454
- package/src/monaco.ts +0 -35
- package/src/monacoWorkers.ts +0 -89
- package/src/outlineSource.ts +0 -171
- package/src/presentation/PresentationMode.tsx +0 -596
- package/src/rawEditorIsolation.ts +0 -18
- package/src/recorder/RecorderButton.tsx +0 -80
- package/src/recorder/RecorderModal.tsx +0 -706
- package/src/recorder/RecorderPanel.tsx +0 -77
- package/src/recorder/formats.ts +0 -159
- package/src/recorder/hooks/useMediaRecorder.ts +0 -436
- package/src/recorder/hooks/useStreamPreview.ts +0 -47
- package/src/recorder/insertMediaBlock.ts +0 -30
- package/src/recorder/sources/cameraStream.ts +0 -32
- package/src/recorder/sources/micStream.ts +0 -25
- package/src/recorder/sources/screenStream.ts +0 -162
- package/src/recorder/timingJson.ts +0 -66
- package/src/resolveBlockVisual.ts +0 -39
- package/src/scene/Scene.tsx +0 -647
- package/src/scene/SceneBlockExtension.ts +0 -205
- package/src/scene/SceneBlockToolbar.tsx +0 -216
- package/src/scene/SceneBlockWidget.tsx +0 -441
- package/src/scene/ScenePropsBar.tsx +0 -85
- package/src/scene/SceneSelection.tsx +0 -111
- package/src/scene/SceneSideToolbar.tsx +0 -89
- package/src/scene/SceneViewControls.tsx +0 -43
- package/src/scene/SceneViewport.tsx +0 -106
- package/src/scene/ShapePalette.tsx +0 -196
- package/src/scene/__tests__/DiagramAdapter.test.ts +0 -142
- package/src/scene/__tests__/SceneBlockExtension.test.ts +0 -33
- package/src/scene/__tests__/bezierEdit.test.ts +0 -85
- package/src/scene/__tests__/blockLayers.test.ts +0 -57
- package/src/scene/__tests__/fitScale.test.ts +0 -19
- package/src/scene/__tests__/sceneIsolation.test.tsx +0 -119
- package/src/scene/__tests__/shapeLayers.test.ts +0 -106
- package/src/scene/__tests__/useSceneHitTest.test.ts +0 -90
- package/src/scene/__tests__/useScenePanZoom.test.ts +0 -130
- package/src/scene/adapters/DiagramAdapter.ts +0 -79
- package/src/scene/adapters/DrawingAdapter.ts +0 -420
- package/src/scene/adapters/LayoutAdapter.ts +0 -313
- package/src/scene/adapters/blockLayers.ts +0 -159
- package/src/scene/commands/SceneCommand.ts +0 -84
- package/src/scene/commands/drawingCommands.ts +0 -318
- package/src/scene/commands/layoutCommands.ts +0 -301
- package/src/scene/fitScale.ts +0 -17
- package/src/scene/hooks/useSceneHitTest.ts +0 -105
- package/src/scene/hooks/useScenePanZoom.ts +0 -154
- package/src/scene/hooks/useSceneSelection.ts +0 -62
- package/src/scene/index.ts +0 -90
- package/src/scene/layers/DiagramEdges.tsx +0 -142
- package/src/scene/layers/edgeGeometry.ts +0 -104
- package/src/scene/layers/nodeCard.tsx +0 -164
- package/src/scene/layers/renderLayer.tsx +0 -70
- package/src/scene/layers/shapeLayers.ts +0 -201
- package/src/scene/paths/bezierEdit.ts +0 -208
- package/src/scene/scene.css +0 -874
- package/src/scene/text/SceneTextOverlay.tsx +0 -161
- package/src/scene/text/sceneTextChannel.ts +0 -46
- package/src/scene/text/sceneTextConfig.ts +0 -31
- package/src/scene/text/sceneTiptap.ts +0 -36
- package/src/scene/text/useSceneTextEditing.ts +0 -39
- package/src/scene/tools/ConnectTool.ts +0 -209
- package/src/scene/tools/DrawingConnectTool.ts +0 -231
- package/src/scene/tools/PathTool.ts +0 -158
- package/src/scene/tools/PlaceTool.ts +0 -47
- package/src/scene/tools/SceneTool.ts +0 -85
- package/src/scene/tools/SelectTool.ts +0 -300
- package/src/scene/tools/ShapeTool.ts +0 -143
- package/src/scene/tools/TextTool.ts +0 -72
- package/src/scene/tools/TokenTool.ts +0 -95
- package/src/scene/tools/createDrawShapeTool.ts +0 -82
- package/src/selectionConversions.ts +0 -155
- package/src/styles/ascii-diagram.css +0 -79
- package/src/styles/ascii-timeline.css +0 -596
- package/src/styles/code-context.css +0 -155
- package/src/styles/code-snippet.css +0 -76
- package/src/styles/diagram.css +0 -183
- package/src/styles/editor.css +0 -7131
- package/src/styles/folder-view.css +0 -210
- package/src/styles/image-edit-affordance.css +0 -201
- package/src/styles/index.css +0 -20
- package/src/styles/mermaid-diagram.css +0 -487
- package/src/styles/tree-view.css +0 -189
- package/src/teleprompter/TeleprompterControls.tsx +0 -218
- package/src/teleprompter/TeleprompterSelfView.tsx +0 -22
- package/src/teleprompter/TeleprompterSurface.tsx +0 -267
- package/src/teleprompter/TeleprompterView.tsx +0 -338
- package/src/teleprompter/canvasRenderer.ts +0 -161
- package/src/teleprompter/floatingWindow.ts +0 -352
- package/src/teleprompter/index.ts +0 -61
- package/src/teleprompter/pcmWorklet.ts +0 -62
- package/src/teleprompter/recording/insertPreamble.ts +0 -80
- package/src/teleprompter/recording/narrationSave.ts +0 -134
- package/src/teleprompter/recording/useNarrationRecorder.ts +0 -367
- package/src/teleprompter/scrollModel.ts +0 -85
- package/src/teleprompter/teleprompterTheme.ts +0 -303
- package/src/teleprompter/types.ts +0 -38
- package/src/teleprompter/useFloatingWindow.ts +0 -74
- package/src/teleprompter/useMicAnalysis.ts +0 -211
- package/src/teleprompter/useTeleprompter.ts +0 -421
- package/src/templateContentPreviewResolver.ts +0 -360
- package/src/timeline/TimelineEditorWidget.tsx +0 -861
- package/src/timeline/TimelineViewExtension.ts +0 -252
- package/src/timeline/__tests__/TimelineEditorWidget.test.tsx +0 -414
- package/src/timeline/__tests__/TimelineViewExtension.test.ts +0 -163
- package/src/timeline/__tests__/timelineCommands.test.ts +0 -359
- package/src/timeline/__tests__/timelineOps.test.ts +0 -277
- package/src/timeline/__tests__/timelinePaste.test.ts +0 -34
- package/src/timeline/timelineCommands.ts +0 -421
- package/src/timeline/timelineData.ts +0 -54
- package/src/timeline/timelineOps.ts +0 -381
- package/src/timeline/timelinePaste.ts +0 -8
- package/src/timelineSource.ts +0 -244
- package/src/tiptap/TiptapAudio.tsx +0 -86
- package/src/tiptap/TiptapVideo.tsx +0 -119
- package/src/tiptap/useResolvedMediaSrc.ts +0 -47
- package/src/tiptapBridge.ts +0 -986
- package/src/tooltipPlacement.ts +0 -13
- package/src/transformStyleId.ts +0 -17
- package/src/transitionCatalog.ts +0 -159
- package/src/treeview/TreeOutlineWidget.tsx +0 -390
- package/src/treeview/TreeViewExtension.ts +0 -250
- package/src/treeview/__tests__/TreeOutlineWidget.test.tsx +0 -156
- package/src/treeview/__tests__/TreeViewExtension.test.ts +0 -122
- package/src/treeview/__tests__/treeOps.test.ts +0 -177
- package/src/treeview/__tests__/treePaste.test.ts +0 -40
- package/src/treeview/__tests__/treeViewCommands.test.ts +0 -179
- package/src/treeview/treeOps.ts +0 -231
- package/src/treeview/treePaste.ts +0 -13
- package/src/treeview/treeViewCommands.ts +0 -99
- package/src/treeview/treeViewData.ts +0 -41
- package/src/types/monaco-shims.d.ts +0 -10
- package/src/useBlockNavigator.ts +0 -153
- package/src/useHeadingLayout.ts +0 -294
- package/src/useMonacoLoader.ts +0 -82
- package/src/useTimelineClock.ts +0 -76
- package/src/utils/collectInlineFontAwesomeCss.ts +0 -69
- package/src/utils/dropUtils.ts +0 -136
- package/src/utils/normalizeMalformedAssetUrl.ts +0 -22
- package/src/writeCanvasSettings.ts +0 -30
- package/src/wysiwygImageUpload.ts +0 -113
|
@@ -0,0 +1,862 @@
|
|
|
1
|
+
import {
|
|
2
|
+
markdownToTiptap,
|
|
3
|
+
tiptapToMarkdown
|
|
4
|
+
} from "./chunk-NITZVAXL.js";
|
|
5
|
+
|
|
6
|
+
// src/jsonEditor/JsonEditorContext.tsx
|
|
7
|
+
import { createContext, useContext, useEffect, useMemo } from "react";
|
|
8
|
+
import { setByPointer } from "@bendyline/squisq/jsonForm";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var JsonEditorContext = createContext(null);
|
|
11
|
+
function JsonEditorProvider(props) {
|
|
12
|
+
const { rootSchema, rootData, onRootChange, density, validate, onValidate, children } = props;
|
|
13
|
+
const validationErrors = useMemo(
|
|
14
|
+
() => validate ? validate(rootData, rootSchema) : [],
|
|
15
|
+
[validate, rootData, rootSchema]
|
|
16
|
+
);
|
|
17
|
+
const errors = useMemo(() => {
|
|
18
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
19
|
+
for (const e of validationErrors) {
|
|
20
|
+
const arr = grouped.get(e.path) ?? [];
|
|
21
|
+
arr.push(e);
|
|
22
|
+
grouped.set(e.path, arr);
|
|
23
|
+
}
|
|
24
|
+
return grouped;
|
|
25
|
+
}, [validationErrors]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!onValidate) return;
|
|
28
|
+
onValidate(validationErrors);
|
|
29
|
+
}, [validationErrors, onValidate]);
|
|
30
|
+
const setAtPath = useMemo(
|
|
31
|
+
() => (pointer, value2) => {
|
|
32
|
+
const next = setByPointer(rootData, pointer, value2);
|
|
33
|
+
onRootChange(next);
|
|
34
|
+
},
|
|
35
|
+
[rootData, onRootChange]
|
|
36
|
+
);
|
|
37
|
+
const value = useMemo(
|
|
38
|
+
() => ({ rootSchema, rootData, setAtPath, density, errors }),
|
|
39
|
+
[rootSchema, rootData, setAtPath, density, errors]
|
|
40
|
+
);
|
|
41
|
+
return /* @__PURE__ */ jsx(JsonEditorContext.Provider, { value, children });
|
|
42
|
+
}
|
|
43
|
+
function useJsonEditor() {
|
|
44
|
+
const ctx = useContext(JsonEditorContext);
|
|
45
|
+
if (!ctx) throw new Error("useJsonEditor must be used inside <JsonEditor>");
|
|
46
|
+
return ctx;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/jsonEditor/RenderNode.tsx
|
|
50
|
+
import {
|
|
51
|
+
chooseControl,
|
|
52
|
+
resolveFlag,
|
|
53
|
+
resolveRef
|
|
54
|
+
} from "@bendyline/squisq/jsonForm";
|
|
55
|
+
import { useId as useId2 } from "react";
|
|
56
|
+
|
|
57
|
+
// src/jsonEditor/editors.tsx
|
|
58
|
+
import { useEffect as useEffect3, useId, useRef as useRef2, useState } from "react";
|
|
59
|
+
import {
|
|
60
|
+
appendPointer,
|
|
61
|
+
arrayItemKind
|
|
62
|
+
} from "@bendyline/squisq/jsonForm";
|
|
63
|
+
|
|
64
|
+
// src/jsonEditor/EmbeddedRichTextField.tsx
|
|
65
|
+
import { useEffect as useEffect2, useRef } from "react";
|
|
66
|
+
import { useEditor, EditorContent } from "@tiptap/react";
|
|
67
|
+
import StarterKit from "@tiptap/starter-kit";
|
|
68
|
+
import Table from "@tiptap/extension-table";
|
|
69
|
+
import TableRow from "@tiptap/extension-table-row";
|
|
70
|
+
import TableCell from "@tiptap/extension-table-cell";
|
|
71
|
+
import TableHeader from "@tiptap/extension-table-header";
|
|
72
|
+
import TaskList from "@tiptap/extension-task-list";
|
|
73
|
+
import TaskItem from "@tiptap/extension-task-item";
|
|
74
|
+
import Placeholder from "@tiptap/extension-placeholder";
|
|
75
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
76
|
+
function EmbeddedRichTextField(props) {
|
|
77
|
+
const { value, onChange, readOnly = false, placeholder, className } = props;
|
|
78
|
+
const isExternalUpdate = useRef(false);
|
|
79
|
+
const lastValueRef = useRef(value);
|
|
80
|
+
const editor = useEditor({
|
|
81
|
+
editable: !readOnly,
|
|
82
|
+
extensions: [
|
|
83
|
+
StarterKit.configure({
|
|
84
|
+
codeBlock: { HTMLAttributes: { class: "squisq-code-block" } }
|
|
85
|
+
}),
|
|
86
|
+
Table.configure({ resizable: false }),
|
|
87
|
+
TableRow,
|
|
88
|
+
TableCell,
|
|
89
|
+
TableHeader,
|
|
90
|
+
TaskList,
|
|
91
|
+
TaskItem.configure({ nested: true }),
|
|
92
|
+
Placeholder.configure({ placeholder: placeholder ?? "" })
|
|
93
|
+
],
|
|
94
|
+
content: markdownToTiptap(value),
|
|
95
|
+
onUpdate: ({ editor: ed }) => {
|
|
96
|
+
if (isExternalUpdate.current) return;
|
|
97
|
+
const html = ed.getHTML();
|
|
98
|
+
const md = tiptapToMarkdown(html);
|
|
99
|
+
lastValueRef.current = md;
|
|
100
|
+
onChange(md);
|
|
101
|
+
},
|
|
102
|
+
editorProps: {
|
|
103
|
+
attributes: {
|
|
104
|
+
class: "squisq-jf-richtext-prose"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
useEffect2(() => {
|
|
109
|
+
if (!editor) return;
|
|
110
|
+
if (value === lastValueRef.current) return;
|
|
111
|
+
isExternalUpdate.current = true;
|
|
112
|
+
try {
|
|
113
|
+
editor.commands.setContent(markdownToTiptap(value), false);
|
|
114
|
+
lastValueRef.current = value;
|
|
115
|
+
} finally {
|
|
116
|
+
isExternalUpdate.current = false;
|
|
117
|
+
}
|
|
118
|
+
}, [editor, value]);
|
|
119
|
+
useEffect2(() => {
|
|
120
|
+
if (editor) editor.setEditable(!readOnly);
|
|
121
|
+
}, [editor, readOnly]);
|
|
122
|
+
const cls = "squisq-jf-richtext" + (className ? ` ${className}` : "");
|
|
123
|
+
return /* @__PURE__ */ jsx2(EditorContent, { editor, className: cls });
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// src/jsonEditor/editors.tsx
|
|
127
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
128
|
+
function accessibilityProps(props) {
|
|
129
|
+
return {
|
|
130
|
+
id: props.controlId,
|
|
131
|
+
"aria-labelledby": props.labelledBy,
|
|
132
|
+
"aria-describedby": props.describedBy,
|
|
133
|
+
"aria-invalid": props.invalid || void 0
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function asString(v) {
|
|
137
|
+
if (v === void 0 || v === null) return "";
|
|
138
|
+
return String(v);
|
|
139
|
+
}
|
|
140
|
+
function asNumber(v) {
|
|
141
|
+
if (v === void 0 || v === null || v === "") return "";
|
|
142
|
+
const n = Number(v);
|
|
143
|
+
return Number.isFinite(n) ? n : "";
|
|
144
|
+
}
|
|
145
|
+
function TextEditor(props) {
|
|
146
|
+
const { value, schema, pointer, disabled } = props;
|
|
147
|
+
const { setAtPath } = useJsonEditor();
|
|
148
|
+
return /* @__PURE__ */ jsx3(
|
|
149
|
+
"input",
|
|
150
|
+
{
|
|
151
|
+
...accessibilityProps(props),
|
|
152
|
+
type: "text",
|
|
153
|
+
className: "squisq-jf-input",
|
|
154
|
+
value: asString(value),
|
|
155
|
+
placeholder: schema.squisq?.placeholder,
|
|
156
|
+
disabled,
|
|
157
|
+
onChange: (e) => setAtPath(pointer, e.target.value)
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
function MultilineEditor(props) {
|
|
162
|
+
const { value, schema, pointer, disabled } = props;
|
|
163
|
+
const { setAtPath } = useJsonEditor();
|
|
164
|
+
const ref = useRef2(null);
|
|
165
|
+
useEffect3(() => {
|
|
166
|
+
const ta = ref.current;
|
|
167
|
+
if (!ta) return;
|
|
168
|
+
ta.style.height = "auto";
|
|
169
|
+
ta.style.height = `${ta.scrollHeight + 2}px`;
|
|
170
|
+
}, [value]);
|
|
171
|
+
return /* @__PURE__ */ jsx3(
|
|
172
|
+
"textarea",
|
|
173
|
+
{
|
|
174
|
+
...accessibilityProps(props),
|
|
175
|
+
ref,
|
|
176
|
+
className: "squisq-jf-textarea",
|
|
177
|
+
value: asString(value),
|
|
178
|
+
placeholder: schema.squisq?.placeholder,
|
|
179
|
+
disabled,
|
|
180
|
+
onChange: (e) => setAtPath(pointer, e.target.value)
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
function RichTextEditor({ value, schema, pointer, disabled }) {
|
|
185
|
+
const { setAtPath } = useJsonEditor();
|
|
186
|
+
return /* @__PURE__ */ jsx3(
|
|
187
|
+
EmbeddedRichTextField,
|
|
188
|
+
{
|
|
189
|
+
value: asString(value),
|
|
190
|
+
placeholder: schema.squisq?.placeholder,
|
|
191
|
+
readOnly: disabled,
|
|
192
|
+
onChange: (md) => setAtPath(pointer, md)
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
function NumberStepperEditor(props) {
|
|
197
|
+
const { value, schema, pointer, disabled } = props;
|
|
198
|
+
const { setAtPath } = useJsonEditor();
|
|
199
|
+
const isInt = schema.type === "integer";
|
|
200
|
+
const step = schema.squisq?.step ?? schema.multipleOf ?? (isInt ? 1 : 0.1);
|
|
201
|
+
const num = asNumber(value);
|
|
202
|
+
const update = (next) => {
|
|
203
|
+
const min = schema.minimum ?? schema.exclusiveMinimum;
|
|
204
|
+
const max = schema.maximum ?? schema.exclusiveMaximum;
|
|
205
|
+
let clamped = next;
|
|
206
|
+
if (typeof min === "number") clamped = Math.max(min, clamped);
|
|
207
|
+
if (typeof max === "number") clamped = Math.min(max, clamped);
|
|
208
|
+
setAtPath(pointer, isInt ? Math.round(clamped) : clamped);
|
|
209
|
+
};
|
|
210
|
+
return /* @__PURE__ */ jsxs("span", { className: "squisq-jf-stepper", children: [
|
|
211
|
+
/* @__PURE__ */ jsx3(
|
|
212
|
+
"button",
|
|
213
|
+
{
|
|
214
|
+
type: "button",
|
|
215
|
+
className: "squisq-jf-stepper__btn",
|
|
216
|
+
disabled,
|
|
217
|
+
onClick: () => update((typeof num === "number" ? num : 0) - step),
|
|
218
|
+
"aria-label": "Decrease",
|
|
219
|
+
children: "\u2212"
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
/* @__PURE__ */ jsx3(
|
|
223
|
+
"input",
|
|
224
|
+
{
|
|
225
|
+
...accessibilityProps(props),
|
|
226
|
+
className: "squisq-jf-stepper__input",
|
|
227
|
+
type: "number",
|
|
228
|
+
value: num === "" ? "" : num,
|
|
229
|
+
step,
|
|
230
|
+
disabled,
|
|
231
|
+
onChange: (e) => {
|
|
232
|
+
if (e.target.value === "") {
|
|
233
|
+
setAtPath(pointer, void 0);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const n = Number(e.target.value);
|
|
237
|
+
if (Number.isFinite(n)) update(n);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
/* @__PURE__ */ jsx3(
|
|
242
|
+
"button",
|
|
243
|
+
{
|
|
244
|
+
type: "button",
|
|
245
|
+
className: "squisq-jf-stepper__btn",
|
|
246
|
+
disabled,
|
|
247
|
+
onClick: () => update((typeof num === "number" ? num : 0) + step),
|
|
248
|
+
"aria-label": "Increase",
|
|
249
|
+
children: "+"
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
] });
|
|
253
|
+
}
|
|
254
|
+
function SliderEditor(props) {
|
|
255
|
+
const { value, schema, pointer, disabled } = props;
|
|
256
|
+
const { setAtPath } = useJsonEditor();
|
|
257
|
+
const min = schema.minimum ?? schema.exclusiveMinimum ?? 0;
|
|
258
|
+
const max = schema.maximum ?? schema.exclusiveMaximum ?? 100;
|
|
259
|
+
const step = schema.squisq?.step ?? schema.multipleOf ?? (schema.type === "integer" ? 1 : 1);
|
|
260
|
+
const num = asNumber(value);
|
|
261
|
+
const display = typeof num === "number" ? num : min;
|
|
262
|
+
return /* @__PURE__ */ jsxs("span", { className: "squisq-jf-slider-row", children: [
|
|
263
|
+
/* @__PURE__ */ jsx3(
|
|
264
|
+
"input",
|
|
265
|
+
{
|
|
266
|
+
...accessibilityProps(props),
|
|
267
|
+
type: "range",
|
|
268
|
+
className: "squisq-jf-slider",
|
|
269
|
+
min,
|
|
270
|
+
max,
|
|
271
|
+
step,
|
|
272
|
+
value: display,
|
|
273
|
+
disabled,
|
|
274
|
+
onChange: (e) => setAtPath(pointer, Number(e.target.value))
|
|
275
|
+
}
|
|
276
|
+
),
|
|
277
|
+
/* @__PURE__ */ jsx3("span", { className: "squisq-jf-slider-readout", children: display })
|
|
278
|
+
] });
|
|
279
|
+
}
|
|
280
|
+
function ToggleEditor(props) {
|
|
281
|
+
const { value, schema, pointer, disabled } = props;
|
|
282
|
+
const { setAtPath } = useJsonEditor();
|
|
283
|
+
const on = Boolean(value);
|
|
284
|
+
return /* @__PURE__ */ jsxs(
|
|
285
|
+
"button",
|
|
286
|
+
{
|
|
287
|
+
...accessibilityProps(props),
|
|
288
|
+
type: "button",
|
|
289
|
+
className: `squisq-jf-toggle${on ? " squisq-jf-toggle--on" : ""}`,
|
|
290
|
+
disabled,
|
|
291
|
+
onClick: () => setAtPath(pointer, !on),
|
|
292
|
+
"aria-pressed": on,
|
|
293
|
+
children: [
|
|
294
|
+
/* @__PURE__ */ jsx3("span", { className: "squisq-jf-toggle__track", children: /* @__PURE__ */ jsx3("span", { className: "squisq-jf-toggle__thumb" }) }),
|
|
295
|
+
/* @__PURE__ */ jsx3("span", { className: "squisq-jf-toggle__label", children: on ? schema.squisq?.label ? `${schema.squisq.label}: On` : "On" : schema.squisq?.label ? `${schema.squisq.label}: Off` : "Off" })
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
function CheckboxEditor(props) {
|
|
301
|
+
const { value, schema, pointer, disabled } = props;
|
|
302
|
+
const { setAtPath } = useJsonEditor();
|
|
303
|
+
const generatedId = useId();
|
|
304
|
+
const id = props.controlId ?? generatedId;
|
|
305
|
+
return /* @__PURE__ */ jsxs("label", { htmlFor: id, className: "squisq-jf-toggle", children: [
|
|
306
|
+
/* @__PURE__ */ jsx3(
|
|
307
|
+
"input",
|
|
308
|
+
{
|
|
309
|
+
"aria-labelledby": props.labelledBy,
|
|
310
|
+
"aria-describedby": props.describedBy,
|
|
311
|
+
"aria-invalid": props.invalid || void 0,
|
|
312
|
+
id,
|
|
313
|
+
type: "checkbox",
|
|
314
|
+
checked: Boolean(value),
|
|
315
|
+
disabled,
|
|
316
|
+
onChange: (e) => setAtPath(pointer, e.target.checked)
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
schema.squisq?.label ?? schema.title ?? ""
|
|
320
|
+
] });
|
|
321
|
+
}
|
|
322
|
+
function enumOptions(schema) {
|
|
323
|
+
const labels = schema.squisq?.enumLabels;
|
|
324
|
+
return (schema.enum ?? []).map((v) => ({
|
|
325
|
+
value: v,
|
|
326
|
+
label: labels && typeof v === "string" ? labels[v] ?? String(v) : String(v)
|
|
327
|
+
}));
|
|
328
|
+
}
|
|
329
|
+
function SegmentedEditor(props) {
|
|
330
|
+
const { value, schema, pointer, disabled } = props;
|
|
331
|
+
const { setAtPath } = useJsonEditor();
|
|
332
|
+
const options = enumOptions(schema);
|
|
333
|
+
return /* @__PURE__ */ jsx3("span", { ...accessibilityProps(props), className: "squisq-jf-segmented", role: "group", children: options.map((opt, i) => {
|
|
334
|
+
const active = value === opt.value;
|
|
335
|
+
return /* @__PURE__ */ jsx3(
|
|
336
|
+
"button",
|
|
337
|
+
{
|
|
338
|
+
type: "button",
|
|
339
|
+
className: `squisq-jf-segmented__btn${active ? " squisq-jf-segmented__btn--active" : ""}`,
|
|
340
|
+
disabled,
|
|
341
|
+
onClick: () => setAtPath(pointer, opt.value),
|
|
342
|
+
"aria-pressed": active,
|
|
343
|
+
children: opt.label
|
|
344
|
+
},
|
|
345
|
+
i
|
|
346
|
+
);
|
|
347
|
+
}) });
|
|
348
|
+
}
|
|
349
|
+
function RadioEditor(props) {
|
|
350
|
+
const { value, schema, pointer, disabled } = props;
|
|
351
|
+
const { setAtPath } = useJsonEditor();
|
|
352
|
+
const options = enumOptions(schema);
|
|
353
|
+
const name = useId();
|
|
354
|
+
return /* @__PURE__ */ jsx3("div", { ...accessibilityProps(props), className: "squisq-jf-radio", role: "radiogroup", children: options.map((opt, i) => {
|
|
355
|
+
const active = value === opt.value;
|
|
356
|
+
return /* @__PURE__ */ jsxs("label", { className: "squisq-jf-radio__option", children: [
|
|
357
|
+
/* @__PURE__ */ jsx3(
|
|
358
|
+
"input",
|
|
359
|
+
{
|
|
360
|
+
type: "radio",
|
|
361
|
+
name,
|
|
362
|
+
checked: active,
|
|
363
|
+
disabled,
|
|
364
|
+
onChange: () => setAtPath(pointer, opt.value)
|
|
365
|
+
}
|
|
366
|
+
),
|
|
367
|
+
opt.label
|
|
368
|
+
] }, i);
|
|
369
|
+
}) });
|
|
370
|
+
}
|
|
371
|
+
function ComboboxEditor(props) {
|
|
372
|
+
const { value, schema, pointer, disabled } = props;
|
|
373
|
+
const { setAtPath } = useJsonEditor();
|
|
374
|
+
const options = enumOptions(schema);
|
|
375
|
+
return /* @__PURE__ */ jsx3(
|
|
376
|
+
"select",
|
|
377
|
+
{
|
|
378
|
+
...accessibilityProps(props),
|
|
379
|
+
className: "squisq-jf-select",
|
|
380
|
+
value: asString(value),
|
|
381
|
+
disabled,
|
|
382
|
+
onChange: (e) => {
|
|
383
|
+
const raw = e.target.value;
|
|
384
|
+
const matched = options.find((opt) => String(opt.value) === raw);
|
|
385
|
+
setAtPath(pointer, matched ? matched.value : raw);
|
|
386
|
+
},
|
|
387
|
+
children: options.map((opt, i) => /* @__PURE__ */ jsx3("option", { value: String(opt.value), children: opt.label }, i))
|
|
388
|
+
}
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
function ColorEditor(props) {
|
|
392
|
+
const { value, pointer, disabled } = props;
|
|
393
|
+
const { setAtPath } = useJsonEditor();
|
|
394
|
+
const hex = typeof value === "string" && /^#[0-9a-f]{6}$/i.test(value) ? value : "#000000";
|
|
395
|
+
return /* @__PURE__ */ jsxs("span", { className: "squisq-jf-color", children: [
|
|
396
|
+
/* @__PURE__ */ jsx3(
|
|
397
|
+
"input",
|
|
398
|
+
{
|
|
399
|
+
...accessibilityProps(props),
|
|
400
|
+
type: "color",
|
|
401
|
+
className: "squisq-jf-color__input",
|
|
402
|
+
value: hex,
|
|
403
|
+
disabled,
|
|
404
|
+
onChange: (e) => setAtPath(pointer, e.target.value)
|
|
405
|
+
}
|
|
406
|
+
),
|
|
407
|
+
/* @__PURE__ */ jsx3(
|
|
408
|
+
"input",
|
|
409
|
+
{
|
|
410
|
+
type: "text",
|
|
411
|
+
className: "squisq-jf-input squisq-jf-color__hex",
|
|
412
|
+
value: asString(value),
|
|
413
|
+
disabled,
|
|
414
|
+
onChange: (e) => setAtPath(pointer, e.target.value)
|
|
415
|
+
}
|
|
416
|
+
)
|
|
417
|
+
] });
|
|
418
|
+
}
|
|
419
|
+
function DateEditor(props) {
|
|
420
|
+
const { value, schema, pointer, disabled } = props;
|
|
421
|
+
const { setAtPath } = useJsonEditor();
|
|
422
|
+
const fmt = schema.format;
|
|
423
|
+
const inputType = fmt === "time" ? "time" : fmt === "date" ? "date" : "datetime-local";
|
|
424
|
+
const display = inputType === "datetime-local" && typeof value === "string" && value.includes("T") ? value.replace(/Z$|:\d{2}\.\d+Z?$/, "").slice(0, 16) : asString(value);
|
|
425
|
+
return /* @__PURE__ */ jsx3(
|
|
426
|
+
"input",
|
|
427
|
+
{
|
|
428
|
+
...accessibilityProps(props),
|
|
429
|
+
type: inputType,
|
|
430
|
+
className: "squisq-jf-input",
|
|
431
|
+
value: display,
|
|
432
|
+
disabled,
|
|
433
|
+
onChange: (e) => setAtPath(pointer, e.target.value)
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
function GroupEditor(props) {
|
|
438
|
+
const { value, schema, pointer, disabled, suppressTitle } = props;
|
|
439
|
+
const title = !suppressTitle ? schema.squisq?.label ?? schema.title : void 0;
|
|
440
|
+
const help = schema.squisq?.help ?? schema.description;
|
|
441
|
+
const obj = (value && typeof value === "object" ? value : {}) ?? {};
|
|
442
|
+
const propEntries = Object.entries(schema.properties ?? {});
|
|
443
|
+
return /* @__PURE__ */ jsxs("section", { className: "squisq-jf-group", children: [
|
|
444
|
+
title ? /* @__PURE__ */ jsx3("h3", { className: "squisq-jf-group__title", children: title }) : null,
|
|
445
|
+
help ? /* @__PURE__ */ jsx3("p", { className: "squisq-jf-group__help", children: help }) : null,
|
|
446
|
+
propEntries.map(([key, propSchema]) => /* @__PURE__ */ jsx3(
|
|
447
|
+
RenderNode,
|
|
448
|
+
{
|
|
449
|
+
value: obj[key],
|
|
450
|
+
schema: propSchema,
|
|
451
|
+
pointer: appendPointer(pointer, key),
|
|
452
|
+
parentDisabled: disabled
|
|
453
|
+
},
|
|
454
|
+
key
|
|
455
|
+
))
|
|
456
|
+
] });
|
|
457
|
+
}
|
|
458
|
+
function ChipBinEditor({ value, schema, pointer, disabled }) {
|
|
459
|
+
const { setAtPath } = useJsonEditor();
|
|
460
|
+
const items = Array.isArray(value) ? value : [];
|
|
461
|
+
const itemSchema = (Array.isArray(schema.items) ? schema.items[0] : schema.items) ?? {
|
|
462
|
+
type: "string"
|
|
463
|
+
};
|
|
464
|
+
const labels = itemSchema.squisq?.enumLabels;
|
|
465
|
+
const enumOpts = itemSchema.enum;
|
|
466
|
+
const [draft, setDraft] = useState("");
|
|
467
|
+
const remove = (index) => {
|
|
468
|
+
const next = items.slice();
|
|
469
|
+
next.splice(index, 1);
|
|
470
|
+
setAtPath(pointer, next);
|
|
471
|
+
};
|
|
472
|
+
const add = (raw) => {
|
|
473
|
+
if (raw === "") return;
|
|
474
|
+
const coerced = coerceToSchema(raw, itemSchema);
|
|
475
|
+
setAtPath(pointer, [...items, coerced]);
|
|
476
|
+
setDraft("");
|
|
477
|
+
};
|
|
478
|
+
return /* @__PURE__ */ jsxs("div", { className: "squisq-jf-chip-bin", children: [
|
|
479
|
+
items.map((item, i) => {
|
|
480
|
+
const display = labels && typeof item === "string" ? labels[item] ?? String(item) : String(item);
|
|
481
|
+
return /* @__PURE__ */ jsxs("span", { className: "squisq-jf-chip", children: [
|
|
482
|
+
display,
|
|
483
|
+
/* @__PURE__ */ jsx3(
|
|
484
|
+
"button",
|
|
485
|
+
{
|
|
486
|
+
type: "button",
|
|
487
|
+
className: "squisq-jf-chip__remove",
|
|
488
|
+
disabled,
|
|
489
|
+
onClick: () => remove(i),
|
|
490
|
+
"aria-label": `Remove ${display}`,
|
|
491
|
+
children: "\xD7"
|
|
492
|
+
}
|
|
493
|
+
)
|
|
494
|
+
] }, i);
|
|
495
|
+
}),
|
|
496
|
+
!disabled && enumOpts && enumOpts.length > 0 ? /* @__PURE__ */ jsxs(
|
|
497
|
+
"select",
|
|
498
|
+
{
|
|
499
|
+
className: "squisq-jf-select",
|
|
500
|
+
value: "",
|
|
501
|
+
onChange: (e) => add(e.target.value),
|
|
502
|
+
style: { width: "auto" },
|
|
503
|
+
children: [
|
|
504
|
+
/* @__PURE__ */ jsx3("option", { value: "", disabled: true, children: schema.squisq?.addLabel ?? "+ Add" }),
|
|
505
|
+
enumOpts.filter((v) => !items.includes(v)).map((v, i) => /* @__PURE__ */ jsx3("option", { value: String(v), children: labels && typeof v === "string" ? labels[v] ?? String(v) : String(v) }, i))
|
|
506
|
+
]
|
|
507
|
+
}
|
|
508
|
+
) : !disabled ? /* @__PURE__ */ jsx3(
|
|
509
|
+
"input",
|
|
510
|
+
{
|
|
511
|
+
type: "text",
|
|
512
|
+
className: "squisq-jf-chip-bin__add-input",
|
|
513
|
+
placeholder: schema.squisq?.addLabel ?? "+ Add",
|
|
514
|
+
value: draft,
|
|
515
|
+
onChange: (e) => setDraft(e.target.value),
|
|
516
|
+
onKeyDown: (e) => {
|
|
517
|
+
if (e.key === "Enter" || e.key === ",") {
|
|
518
|
+
e.preventDefault();
|
|
519
|
+
add(draft.trim());
|
|
520
|
+
}
|
|
521
|
+
},
|
|
522
|
+
onBlur: () => add(draft.trim())
|
|
523
|
+
}
|
|
524
|
+
) : null
|
|
525
|
+
] });
|
|
526
|
+
}
|
|
527
|
+
function coerceToSchema(raw, schema) {
|
|
528
|
+
switch (schema.type) {
|
|
529
|
+
case "integer":
|
|
530
|
+
return parseInt(raw, 10);
|
|
531
|
+
case "number":
|
|
532
|
+
return Number(raw);
|
|
533
|
+
case "boolean":
|
|
534
|
+
return raw === "true" || raw === "1";
|
|
535
|
+
default:
|
|
536
|
+
return raw;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
function CardStackEditor({ value, schema, pointer, disabled }) {
|
|
540
|
+
const { setAtPath } = useJsonEditor();
|
|
541
|
+
const items = Array.isArray(value) ? value : [];
|
|
542
|
+
const itemSchema = (Array.isArray(schema.items) ? schema.items[0] : schema.items) ?? {
|
|
543
|
+
type: "object"
|
|
544
|
+
};
|
|
545
|
+
const itemLabel = itemSchema.squisq?.itemLabel;
|
|
546
|
+
const addLabel = schema.squisq?.addLabel ?? "+ Add";
|
|
547
|
+
const updateItems = (next) => setAtPath(pointer, next);
|
|
548
|
+
const addItem = () => updateItems([...items, defaultForSchema(itemSchema)]);
|
|
549
|
+
const removeItem = (i) => {
|
|
550
|
+
const next = items.slice();
|
|
551
|
+
next.splice(i, 1);
|
|
552
|
+
updateItems(next);
|
|
553
|
+
};
|
|
554
|
+
const moveItem = (i, delta) => {
|
|
555
|
+
const j = i + delta;
|
|
556
|
+
if (j < 0 || j >= items.length) return;
|
|
557
|
+
const next = items.slice();
|
|
558
|
+
[next[i], next[j]] = [next[j], next[i]];
|
|
559
|
+
updateItems(next);
|
|
560
|
+
};
|
|
561
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
562
|
+
/* @__PURE__ */ jsx3("div", { className: "squisq-jf-card-stack", children: items.map((item, i) => {
|
|
563
|
+
const title = resolveItemTitle(itemLabel, item, i);
|
|
564
|
+
return /* @__PURE__ */ jsxs("div", { className: "squisq-jf-card", children: [
|
|
565
|
+
/* @__PURE__ */ jsxs("div", { className: "squisq-jf-card__header", children: [
|
|
566
|
+
/* @__PURE__ */ jsx3("h4", { className: "squisq-jf-card__title", children: title }),
|
|
567
|
+
!disabled ? /* @__PURE__ */ jsxs("span", { className: "squisq-jf-card__actions", children: [
|
|
568
|
+
/* @__PURE__ */ jsx3(
|
|
569
|
+
"button",
|
|
570
|
+
{
|
|
571
|
+
type: "button",
|
|
572
|
+
className: "squisq-jf-icon-btn",
|
|
573
|
+
onClick: () => moveItem(i, -1),
|
|
574
|
+
disabled: i === 0,
|
|
575
|
+
"aria-label": "Move up",
|
|
576
|
+
title: "Move up",
|
|
577
|
+
children: "\u2191"
|
|
578
|
+
}
|
|
579
|
+
),
|
|
580
|
+
/* @__PURE__ */ jsx3(
|
|
581
|
+
"button",
|
|
582
|
+
{
|
|
583
|
+
type: "button",
|
|
584
|
+
className: "squisq-jf-icon-btn",
|
|
585
|
+
onClick: () => moveItem(i, 1),
|
|
586
|
+
disabled: i === items.length - 1,
|
|
587
|
+
"aria-label": "Move down",
|
|
588
|
+
title: "Move down",
|
|
589
|
+
children: "\u2193"
|
|
590
|
+
}
|
|
591
|
+
),
|
|
592
|
+
/* @__PURE__ */ jsx3(
|
|
593
|
+
"button",
|
|
594
|
+
{
|
|
595
|
+
type: "button",
|
|
596
|
+
className: "squisq-jf-icon-btn squisq-jf-icon-btn--danger",
|
|
597
|
+
onClick: () => removeItem(i),
|
|
598
|
+
"aria-label": schema.squisq?.removeLabel ?? "Remove",
|
|
599
|
+
title: schema.squisq?.removeLabel ?? "Remove",
|
|
600
|
+
children: "\xD7"
|
|
601
|
+
}
|
|
602
|
+
)
|
|
603
|
+
] }) : null
|
|
604
|
+
] }),
|
|
605
|
+
/* @__PURE__ */ jsx3(
|
|
606
|
+
RenderNode,
|
|
607
|
+
{
|
|
608
|
+
value: item,
|
|
609
|
+
schema: itemSchema,
|
|
610
|
+
pointer: `${pointer}/${i}`,
|
|
611
|
+
parentDisabled: disabled,
|
|
612
|
+
suppressTopGroupTitle: true
|
|
613
|
+
}
|
|
614
|
+
)
|
|
615
|
+
] }, i);
|
|
616
|
+
}) }),
|
|
617
|
+
!disabled ? /* @__PURE__ */ jsx3(
|
|
618
|
+
"button",
|
|
619
|
+
{
|
|
620
|
+
type: "button",
|
|
621
|
+
className: "squisq-jf-add-btn",
|
|
622
|
+
onClick: addItem,
|
|
623
|
+
style: { marginTop: 8 },
|
|
624
|
+
children: addLabel
|
|
625
|
+
}
|
|
626
|
+
) : null
|
|
627
|
+
] });
|
|
628
|
+
}
|
|
629
|
+
function resolveItemTitle(spec, item, index) {
|
|
630
|
+
if (!spec) return `Item ${index + 1}`;
|
|
631
|
+
if (typeof spec === "string") return spec;
|
|
632
|
+
if (item && typeof item === "object") {
|
|
633
|
+
const v = item[spec.fromField];
|
|
634
|
+
if (typeof v === "string" && v !== "") return v;
|
|
635
|
+
if (typeof v === "number") return String(v);
|
|
636
|
+
}
|
|
637
|
+
return `Item ${index + 1}`;
|
|
638
|
+
}
|
|
639
|
+
function defaultForSchema(schema) {
|
|
640
|
+
if (schema.default !== void 0) return schema.default;
|
|
641
|
+
const t = Array.isArray(schema.type) ? schema.type.find((x) => x !== "null") : schema.type;
|
|
642
|
+
switch (t) {
|
|
643
|
+
case "object": {
|
|
644
|
+
const out = {};
|
|
645
|
+
for (const [k, v] of Object.entries(schema.properties ?? {})) {
|
|
646
|
+
out[k] = defaultForSchema(v);
|
|
647
|
+
}
|
|
648
|
+
return out;
|
|
649
|
+
}
|
|
650
|
+
case "array":
|
|
651
|
+
return [];
|
|
652
|
+
case "string":
|
|
653
|
+
return "";
|
|
654
|
+
case "number":
|
|
655
|
+
case "integer":
|
|
656
|
+
return schema.minimum ?? 0;
|
|
657
|
+
case "boolean":
|
|
658
|
+
return false;
|
|
659
|
+
default:
|
|
660
|
+
return void 0;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
function TabsEditor(props) {
|
|
664
|
+
const { value, schema, pointer, disabled } = props;
|
|
665
|
+
const tabsId = useId().replace(/:/g, "");
|
|
666
|
+
const branches = schema.oneOf ?? schema.anyOf ?? [];
|
|
667
|
+
const initial = pickMatchingBranch(branches, value);
|
|
668
|
+
const [active, setActive] = useState(initial);
|
|
669
|
+
useEffect3(() => {
|
|
670
|
+
setActive(pickMatchingBranch(branches, value));
|
|
671
|
+
}, [value]);
|
|
672
|
+
const branch = branches[active];
|
|
673
|
+
if (!branch) return null;
|
|
674
|
+
const activateTab = (index) => {
|
|
675
|
+
const next = (index + branches.length) % branches.length;
|
|
676
|
+
setActive(next);
|
|
677
|
+
requestAnimationFrame(() => document.getElementById(`${tabsId}-tab-${next}`)?.focus());
|
|
678
|
+
};
|
|
679
|
+
return /* @__PURE__ */ jsxs("div", { ...accessibilityProps(props), children: [
|
|
680
|
+
/* @__PURE__ */ jsx3("div", { className: "squisq-jf-tabs__strip", role: "tablist", children: branches.map((b, i) => /* @__PURE__ */ jsx3(
|
|
681
|
+
"button",
|
|
682
|
+
{
|
|
683
|
+
type: "button",
|
|
684
|
+
className: `squisq-jf-tabs__tab${i === active ? " squisq-jf-tabs__tab--active" : ""}`,
|
|
685
|
+
disabled,
|
|
686
|
+
onClick: () => setActive(i),
|
|
687
|
+
onKeyDown: (event) => {
|
|
688
|
+
if (event.key === "ArrowRight" || event.key === "ArrowDown") {
|
|
689
|
+
event.preventDefault();
|
|
690
|
+
activateTab(i + 1);
|
|
691
|
+
} else if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
|
|
692
|
+
event.preventDefault();
|
|
693
|
+
activateTab(i - 1);
|
|
694
|
+
} else if (event.key === "Home") {
|
|
695
|
+
event.preventDefault();
|
|
696
|
+
activateTab(0);
|
|
697
|
+
} else if (event.key === "End") {
|
|
698
|
+
event.preventDefault();
|
|
699
|
+
activateTab(branches.length - 1);
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
role: "tab",
|
|
703
|
+
id: `${tabsId}-tab-${i}`,
|
|
704
|
+
"aria-selected": i === active,
|
|
705
|
+
"aria-controls": `${tabsId}-panel`,
|
|
706
|
+
tabIndex: i === active ? 0 : -1,
|
|
707
|
+
children: b.squisq?.label ?? b.title ?? `Option ${i + 1}`
|
|
708
|
+
},
|
|
709
|
+
i
|
|
710
|
+
)) }),
|
|
711
|
+
/* @__PURE__ */ jsx3("div", { id: `${tabsId}-panel`, role: "tabpanel", "aria-labelledby": `${tabsId}-tab-${active}`, children: /* @__PURE__ */ jsx3(RenderNode, { value, schema: branch, pointer, parentDisabled: disabled }) })
|
|
712
|
+
] });
|
|
713
|
+
}
|
|
714
|
+
function pickMatchingBranch(branches, value) {
|
|
715
|
+
for (let i = 0; i < branches.length; i++) {
|
|
716
|
+
if (matchesShape(branches[i], value)) return i;
|
|
717
|
+
}
|
|
718
|
+
return 0;
|
|
719
|
+
}
|
|
720
|
+
function matchesShape(schema, value) {
|
|
721
|
+
const t = schema.type;
|
|
722
|
+
const target = Array.isArray(t) ? t.find((x) => x !== "null") : t;
|
|
723
|
+
if (!target) return true;
|
|
724
|
+
switch (target) {
|
|
725
|
+
case "string":
|
|
726
|
+
return typeof value === "string";
|
|
727
|
+
case "number":
|
|
728
|
+
case "integer":
|
|
729
|
+
return typeof value === "number";
|
|
730
|
+
case "boolean":
|
|
731
|
+
return typeof value === "boolean";
|
|
732
|
+
case "null":
|
|
733
|
+
return value === null;
|
|
734
|
+
case "array":
|
|
735
|
+
return Array.isArray(value);
|
|
736
|
+
case "object":
|
|
737
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
738
|
+
default:
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
var EDITORS = {
|
|
743
|
+
text: TextEditor,
|
|
744
|
+
multiline: MultilineEditor,
|
|
745
|
+
richtext: RichTextEditor,
|
|
746
|
+
color: ColorEditor,
|
|
747
|
+
date: DateEditor,
|
|
748
|
+
time: DateEditor,
|
|
749
|
+
datetime: DateEditor,
|
|
750
|
+
slider: SliderEditor,
|
|
751
|
+
stepper: NumberStepperEditor,
|
|
752
|
+
segmented: SegmentedEditor,
|
|
753
|
+
radio: RadioEditor,
|
|
754
|
+
combobox: ComboboxEditor,
|
|
755
|
+
toggle: ToggleEditor,
|
|
756
|
+
checkbox: CheckboxEditor,
|
|
757
|
+
card: GroupEditor,
|
|
758
|
+
group: GroupEditor,
|
|
759
|
+
"card-stack": CardStackEditor,
|
|
760
|
+
"chip-bin": ChipBinEditor,
|
|
761
|
+
tabs: TabsEditor
|
|
762
|
+
};
|
|
763
|
+
function isCompositeControl(kind, schema) {
|
|
764
|
+
if (kind === "group" || kind === "card" || kind === "tabs" || kind === "card-stack") return true;
|
|
765
|
+
if (kind === "richtext") return true;
|
|
766
|
+
if (kind === "chip-bin") return arrayItemKind(schema) === "object";
|
|
767
|
+
return false;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// src/jsonEditor/RenderNode.tsx
|
|
771
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
772
|
+
function RenderNode(props) {
|
|
773
|
+
const generatedId = useId2().replace(/:/g, "");
|
|
774
|
+
const { rootSchema, rootData, errors } = useJsonEditor();
|
|
775
|
+
const resolved = resolveRef(props.schema, rootSchema) ?? props.schema;
|
|
776
|
+
if (resolveFlag(resolved.squisq?.hidden, rootData)) return null;
|
|
777
|
+
const disabled = (props.parentDisabled ?? false) || resolveFlag(resolved.squisq?.disabled, rootData);
|
|
778
|
+
const kind = chooseControl(resolved);
|
|
779
|
+
const Editor = EDITORS[kind];
|
|
780
|
+
const label = resolved.squisq?.label ?? resolved.title;
|
|
781
|
+
const help = resolved.squisq?.help ?? resolved.description;
|
|
782
|
+
const fieldErrors = errors.get(props.pointer) ?? [];
|
|
783
|
+
const controlId = `squisq-json-control-${generatedId}`;
|
|
784
|
+
const labelId = label ? `${controlId}-label` : void 0;
|
|
785
|
+
const helpId = help ? `${controlId}-help` : void 0;
|
|
786
|
+
const errorId = fieldErrors.length > 0 ? `${controlId}-error` : void 0;
|
|
787
|
+
const describedBy = [helpId, errorId].filter(Boolean).join(" ") || void 0;
|
|
788
|
+
const editorEl = /* @__PURE__ */ jsx4(
|
|
789
|
+
Editor,
|
|
790
|
+
{
|
|
791
|
+
value: props.value,
|
|
792
|
+
schema: resolved,
|
|
793
|
+
pointer: props.pointer,
|
|
794
|
+
disabled,
|
|
795
|
+
controlId,
|
|
796
|
+
labelledBy: labelId,
|
|
797
|
+
describedBy,
|
|
798
|
+
invalid: fieldErrors.length > 0,
|
|
799
|
+
suppressTitle: props.suppressTopGroupTitle
|
|
800
|
+
}
|
|
801
|
+
);
|
|
802
|
+
if (isCompositeControl(kind, resolved)) {
|
|
803
|
+
return editorEl;
|
|
804
|
+
}
|
|
805
|
+
return /* @__PURE__ */ jsxs2("div", { className: `squisq-jf-field${disabled ? " squisq-jf-field--disabled" : ""}`, children: [
|
|
806
|
+
label ? /* @__PURE__ */ jsx4("label", { id: labelId, htmlFor: controlId, className: "squisq-jf-field__label", children: label }) : null,
|
|
807
|
+
editorEl,
|
|
808
|
+
help ? /* @__PURE__ */ jsx4("p", { id: helpId, className: "squisq-jf-field__help", children: help }) : null,
|
|
809
|
+
fieldErrors.length > 0 ? /* @__PURE__ */ jsx4("p", { id: errorId, className: "squisq-jf-field__error", role: "alert", children: fieldErrors[0].message }) : null
|
|
810
|
+
] });
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
// src/jsonEditor/useJsonEditorTokens.ts
|
|
814
|
+
import { useMemo as useMemo2 } from "react";
|
|
815
|
+
import { buildJsonFormTokens, resolveJsonFormTheme } from "@bendyline/squisq/jsonForm";
|
|
816
|
+
import { useAutoSurface } from "@bendyline/squisq-react";
|
|
817
|
+
function useJsonEditorTokens(theme, surface) {
|
|
818
|
+
const auto = useAutoSurface(surface === "auto");
|
|
819
|
+
const effectiveSurface = surface === "auto" ? auto : surface ?? void 0;
|
|
820
|
+
return useMemo2(() => {
|
|
821
|
+
const style = buildJsonFormTokens(theme, effectiveSurface, {
|
|
822
|
+
prefix: "--squisq-jsonform"
|
|
823
|
+
});
|
|
824
|
+
return { style, theme: resolveJsonFormTheme(theme, effectiveSurface) };
|
|
825
|
+
}, [theme, effectiveSurface]);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
// src/jsonEditor/JsonEditor.tsx
|
|
829
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
830
|
+
function JsonEditor(props) {
|
|
831
|
+
const {
|
|
832
|
+
schema,
|
|
833
|
+
value,
|
|
834
|
+
onChange,
|
|
835
|
+
theme,
|
|
836
|
+
surface,
|
|
837
|
+
density = "comfortable",
|
|
838
|
+
validate,
|
|
839
|
+
onValidate,
|
|
840
|
+
className
|
|
841
|
+
} = props;
|
|
842
|
+
const { style } = useJsonEditorTokens(theme, surface);
|
|
843
|
+
const handleChange = onChange ?? (() => {
|
|
844
|
+
});
|
|
845
|
+
const cls = "squisq-jsonform" + (density === "compact" ? " squisq-jsonform--compact" : "") + (className ? ` ${className}` : "");
|
|
846
|
+
return /* @__PURE__ */ jsx5("div", { className: cls, style, children: /* @__PURE__ */ jsx5(
|
|
847
|
+
JsonEditorProvider,
|
|
848
|
+
{
|
|
849
|
+
rootSchema: schema,
|
|
850
|
+
rootData: value,
|
|
851
|
+
onRootChange: handleChange,
|
|
852
|
+
density,
|
|
853
|
+
validate,
|
|
854
|
+
onValidate,
|
|
855
|
+
children: /* @__PURE__ */ jsx5(RenderNode, { value, schema, pointer: "", parentDisabled: !onChange })
|
|
856
|
+
}
|
|
857
|
+
) });
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
export {
|
|
861
|
+
JsonEditor
|
|
862
|
+
};
|