@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
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import {
|
|
3
|
-
readBlockAttrsParams,
|
|
4
|
-
readBlockAttrsValue,
|
|
5
|
-
setBlockAttrsValue,
|
|
6
|
-
summarizeBlockProps,
|
|
7
|
-
} from '../blockProperties';
|
|
8
|
-
|
|
9
|
-
describe('readBlockAttrsParams', () => {
|
|
10
|
-
it('returns empty for null/empty inner', () => {
|
|
11
|
-
expect(readBlockAttrsParams(null)).toEqual({});
|
|
12
|
-
expect(readBlockAttrsParams('')).toEqual({});
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('parses key=value params (ignoring #id / .class)', () => {
|
|
16
|
-
expect(readBlockAttrsParams('#intro .lead duration=45 startTime=5')).toEqual({
|
|
17
|
-
duration: '45',
|
|
18
|
-
startTime: '5',
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
describe('readBlockAttrsValue', () => {
|
|
24
|
-
it('reads a single param or empty string', () => {
|
|
25
|
-
expect(readBlockAttrsValue('duration=45', 'duration')).toBe('45');
|
|
26
|
-
expect(readBlockAttrsValue('duration=45', 'startTime')).toBe('');
|
|
27
|
-
expect(readBlockAttrsValue(null, 'duration')).toBe('');
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
describe('setBlockAttrsValue', () => {
|
|
32
|
-
it('adds a param to a fresh block', () => {
|
|
33
|
-
expect(setBlockAttrsValue(null, 'duration', '45')).toBe('duration=45');
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('updates an existing param in place, preserving order and other keys', () => {
|
|
37
|
-
expect(setBlockAttrsValue('#intro duration=10 startTime=2', 'duration', '20')).toBe(
|
|
38
|
-
'#intro duration=20 startTime=2',
|
|
39
|
-
);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('removes a param when set to empty, dropping the block when nothing remains', () => {
|
|
43
|
-
expect(setBlockAttrsValue('duration=45', 'duration', '')).toBeNull();
|
|
44
|
-
expect(setBlockAttrsValue('#intro duration=45', 'duration', ' ')).toBe('#intro');
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('does not disturb a transition already present', () => {
|
|
48
|
-
expect(setBlockAttrsValue('transition=fade', 'duration', '3')).toBe(
|
|
49
|
-
'transition=fade duration=3',
|
|
50
|
-
);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('round-trips through read', () => {
|
|
54
|
-
const inner = setBlockAttrsValue(setBlockAttrsValue(null, 'duration', '12'), 'startTime', '4');
|
|
55
|
-
expect(readBlockAttrsValue(inner, 'duration')).toBe('12');
|
|
56
|
-
expect(readBlockAttrsValue(inner, 'startTime')).toBe('4');
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
describe('summarizeBlockProps', () => {
|
|
61
|
-
it('returns empty when nothing is set', () => {
|
|
62
|
-
expect(summarizeBlockProps(null, null)).toBe('');
|
|
63
|
-
expect(summarizeBlockProps('#intro', null)).toBe('');
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('names the transition using its friendly label', () => {
|
|
67
|
-
expect(summarizeBlockProps('transition=doors', null)).toBe('Doors');
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('formats start time and duration as m:ss', () => {
|
|
71
|
-
expect(summarizeBlockProps('startTime=90', null)).toBe('1:30 start');
|
|
72
|
-
expect(summarizeBlockProps('duration=200', null)).toBe('3:20 long');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('accepts already-formatted m:ss time values', () => {
|
|
76
|
-
expect(summarizeBlockProps('startTime=1:30', null)).toBe('1:30 start');
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('joins all set properties in order with a middot', () => {
|
|
80
|
-
expect(summarizeBlockProps('transition=vortex startTime=90 duration=200', null)).toBe(
|
|
81
|
-
'Vortex · 1:30 start · 3:20 long',
|
|
82
|
-
);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('reads a hand-typed transition from the {[…]} params', () => {
|
|
86
|
-
expect(summarizeBlockProps(null, 'title transition=zoom')).toBe('Zoom');
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('normalizes a transition alias spelling for the label', () => {
|
|
90
|
-
expect(summarizeBlockProps('transition=Doors', null)).toBe('Doors');
|
|
91
|
-
});
|
|
92
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
2
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
3
|
-
import { BlockPropertiesPopover } from '../BlockPropertiesPopover';
|
|
4
|
-
import { TRANSITION_FLYOUT_PORTAL_ID } from '../TransitionPicker';
|
|
5
|
-
|
|
6
|
-
describe('BlockPropertiesPopover theme propagation', () => {
|
|
7
|
-
it('copies dark mode and the document accent onto both portal roots', async () => {
|
|
8
|
-
render(
|
|
9
|
-
<BlockPropertiesPopover
|
|
10
|
-
anchorRect={new DOMRect(20, 20, 20, 20)}
|
|
11
|
-
blockAttrs={null}
|
|
12
|
-
templateParams={null}
|
|
13
|
-
colorScheme="dark"
|
|
14
|
-
accentColor="#c2410c"
|
|
15
|
-
onChange={vi.fn()}
|
|
16
|
-
onAnnotationChange={vi.fn()}
|
|
17
|
-
onClose={vi.fn()}
|
|
18
|
-
/>,
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
const panel = screen.getByRole('dialog', { name: 'Block properties' });
|
|
22
|
-
expect(panel.getAttribute('data-theme')).toBe('dark');
|
|
23
|
-
expect(panel.style.getPropertyValue('--squisq-block-props-accent')).toBe('#c2410c');
|
|
24
|
-
|
|
25
|
-
fireEvent.click(screen.getByRole('button', { name: /Transition:/ }));
|
|
26
|
-
|
|
27
|
-
await waitFor(() => {
|
|
28
|
-
const flyout = document.getElementById(TRANSITION_FLYOUT_PORTAL_ID);
|
|
29
|
-
expect(flyout?.getAttribute('data-theme')).toBe('dark');
|
|
30
|
-
expect(flyout?.style.getPropertyValue('--squisq-block-props-accent')).toBe('#c2410c');
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import {
|
|
3
|
-
getBlockSlices,
|
|
4
|
-
spliceBlock,
|
|
5
|
-
lineToOffset,
|
|
6
|
-
offsetToLine,
|
|
7
|
-
sliceIndexAtOffset,
|
|
8
|
-
} from '../blockRange';
|
|
9
|
-
|
|
10
|
-
describe('getBlockSlices', () => {
|
|
11
|
-
it('returns one slice per heading in document order', () => {
|
|
12
|
-
const md = '# One\n\nalpha\n\n# Two\n\nbeta\n';
|
|
13
|
-
const slices = getBlockSlices(md);
|
|
14
|
-
expect(slices.map((s) => s.text)).toEqual(['# One\n\nalpha\n\n', '# Two\n\nbeta\n']);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('starts a new slice at every heading depth (children are not folded in)', () => {
|
|
18
|
-
const md = '# Parent\n\nintro\n\n## Child\n\nbody\n';
|
|
19
|
-
const slices = getBlockSlices(md);
|
|
20
|
-
expect(slices).toHaveLength(2);
|
|
21
|
-
expect(slices[0].text).toBe('# Parent\n\nintro\n\n');
|
|
22
|
-
expect(slices[1].text).toBe('## Child\n\nbody\n');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('includes leading content before the first heading as a preamble slice', () => {
|
|
26
|
-
const md = 'preamble text\n\n# First\n\nbody\n';
|
|
27
|
-
const slices = getBlockSlices(md);
|
|
28
|
-
expect(slices).toHaveLength(2);
|
|
29
|
-
expect(slices[0].text).toBe('preamble text\n\n');
|
|
30
|
-
expect(slices[1].text).toBe('# First\n\nbody\n');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('skips a whitespace-only preamble', () => {
|
|
34
|
-
const md = '\n\n# Only\n\nbody\n';
|
|
35
|
-
const slices = getBlockSlices(md);
|
|
36
|
-
expect(slices).toHaveLength(1);
|
|
37
|
-
expect(slices[0].text).toBe('# Only\n\nbody\n');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('treats a heading-less document as a single slice', () => {
|
|
41
|
-
const md = 'just a paragraph\n\nand another\n';
|
|
42
|
-
const slices = getBlockSlices(md);
|
|
43
|
-
expect(slices).toHaveLength(1);
|
|
44
|
-
expect(slices[0].text).toBe(md);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('treats an empty document as a single (empty) slice', () => {
|
|
48
|
-
const slices = getBlockSlices('');
|
|
49
|
-
expect(slices).toHaveLength(1);
|
|
50
|
-
expect(slices[0].text).toBe('');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('never folds frontmatter into a slice', () => {
|
|
54
|
-
const md = '---\ntitle: Hi\n---\n# Heading\n\nbody\n';
|
|
55
|
-
const slices = getBlockSlices(md);
|
|
56
|
-
expect(slices).toHaveLength(1);
|
|
57
|
-
expect(slices[0].text).toBe('# Heading\n\nbody\n');
|
|
58
|
-
// The frontmatter stays in the untouched prefix.
|
|
59
|
-
expect(md.slice(0, slices[0].range.startOffset)).toBe('---\ntitle: Hi\n---\n');
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
describe('spliceBlock round-trips', () => {
|
|
64
|
-
const cases = [
|
|
65
|
-
'# One\n\nalpha\n\n# Two\n\nbeta\n',
|
|
66
|
-
'# Parent\n\nintro\n\n## Child\n\nbody\n',
|
|
67
|
-
'preamble text\n\n# First\n\nbody\n',
|
|
68
|
-
'---\ntitle: Hi\n---\n# Heading\n\nbody\n',
|
|
69
|
-
'no headings at all\n',
|
|
70
|
-
];
|
|
71
|
-
|
|
72
|
-
it('re-splicing a slice with its own text reproduces the source exactly', () => {
|
|
73
|
-
for (const md of cases) {
|
|
74
|
-
const slices = getBlockSlices(md);
|
|
75
|
-
for (const slice of slices) {
|
|
76
|
-
expect(spliceBlock(md, slice.range, slice.text)).toBe(md);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('splices an edited block back into the full document', () => {
|
|
82
|
-
const md = '# One\n\nalpha\n\n# Two\n\nbeta\n';
|
|
83
|
-
const slices = getBlockSlices(md);
|
|
84
|
-
const edited = spliceBlock(md, slices[0].range, '# One\n\nalpha edited\n\n');
|
|
85
|
-
expect(edited).toBe('# One\n\nalpha edited\n\n# Two\n\nbeta\n');
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
describe('line/offset helpers', () => {
|
|
90
|
-
const md = '# One\n\nalpha\n\n# Two\n';
|
|
91
|
-
|
|
92
|
-
it('maps lines to offsets and back', () => {
|
|
93
|
-
// Line 5 is the "# Two" heading.
|
|
94
|
-
const offset = lineToOffset(md, 5);
|
|
95
|
-
expect(md.slice(offset, offset + 5)).toBe('# Two');
|
|
96
|
-
expect(offsetToLine(md, offset)).toBe(5);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('finds the slice index containing an offset', () => {
|
|
100
|
-
const slices = getBlockSlices(md);
|
|
101
|
-
const secondHeadingOffset = lineToOffset(md, 5);
|
|
102
|
-
expect(sliceIndexAtOffset(slices, secondHeadingOffset)).toBe(1);
|
|
103
|
-
expect(sliceIndexAtOffset(slices, 0)).toBe(0);
|
|
104
|
-
});
|
|
105
|
-
});
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { Editor } from '@tiptap/core';
|
|
2
|
-
import StarterKit from '@tiptap/starter-kit';
|
|
3
|
-
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
-
import {
|
|
5
|
-
BlockTagActivityExtension,
|
|
6
|
-
BLOCK_TAG_HOVERED_CLASS,
|
|
7
|
-
BLOCK_TAG_SELECTED_CLASS,
|
|
8
|
-
} from '../blockTagActivity';
|
|
9
|
-
import { HeadingWithTemplate } from '../TemplateAnnotation';
|
|
10
|
-
import { markdownToTiptap } from '../tiptapBridge';
|
|
11
|
-
|
|
12
|
-
const MARKDOWN = `# First block {[title]}
|
|
13
|
-
|
|
14
|
-
First body.
|
|
15
|
-
|
|
16
|
-
- Outer item with **nested inline target**
|
|
17
|
-
|
|
18
|
-
# Second block {[quote]}
|
|
19
|
-
|
|
20
|
-
Second body.
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
const editors: Editor[] = [];
|
|
24
|
-
const editorHosts: HTMLElement[] = [];
|
|
25
|
-
|
|
26
|
-
function makeEditor(): Editor {
|
|
27
|
-
const element = document.createElement('div');
|
|
28
|
-
document.body.appendChild(element);
|
|
29
|
-
editorHosts.push(element);
|
|
30
|
-
|
|
31
|
-
const editor = new Editor({
|
|
32
|
-
element,
|
|
33
|
-
extensions: [
|
|
34
|
-
StarterKit.configure({ heading: false }),
|
|
35
|
-
HeadingWithTemplate.configure({ levels: [1, 2, 3, 4, 5, 6] }),
|
|
36
|
-
BlockTagActivityExtension,
|
|
37
|
-
],
|
|
38
|
-
content: markdownToTiptap(MARKDOWN),
|
|
39
|
-
});
|
|
40
|
-
editors.push(editor);
|
|
41
|
-
return editor;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function positionInsideTopLevelNode(editor: Editor, text: string): number {
|
|
45
|
-
let position: number | null = null;
|
|
46
|
-
editor.state.doc.forEach((node, offset) => {
|
|
47
|
-
if (position === null && node.textContent === text) position = offset + 1;
|
|
48
|
-
});
|
|
49
|
-
if (position === null) throw new Error(`Top-level node not found: ${text}`);
|
|
50
|
-
return position;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function headings(editor: Editor): HTMLElement[] {
|
|
54
|
-
return Array.from(editor.view.dom.children).filter((element): element is HTMLElement =>
|
|
55
|
-
/^H[1-6]$/.test(element.tagName),
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function elementWithExactText(editor: Editor, selector: string, text: string): HTMLElement {
|
|
60
|
-
const element = Array.from(editor.view.dom.querySelectorAll<HTMLElement>(selector)).find(
|
|
61
|
-
(candidate) => candidate.textContent === text,
|
|
62
|
-
);
|
|
63
|
-
if (!element) throw new Error(`Element not found: ${selector} containing ${text}`);
|
|
64
|
-
return element;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
afterEach(() => {
|
|
68
|
-
for (const editor of editors.splice(0)) editor.destroy();
|
|
69
|
-
for (const host of editorHosts.splice(0)) host.remove();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
function waitForDomReconciliation(): Promise<void> {
|
|
73
|
-
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
describe('block-tag activity', () => {
|
|
77
|
-
it('decorates the initial selection before the editor view settles', async () => {
|
|
78
|
-
const editor = makeEditor();
|
|
79
|
-
await waitForDomReconciliation();
|
|
80
|
-
|
|
81
|
-
const [firstHeading] = headings(editor);
|
|
82
|
-
expect(firstHeading.isConnected).toBe(true);
|
|
83
|
-
expect(firstHeading.classList.contains(BLOCK_TAG_SELECTED_CLASS)).toBe(true);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('keeps cursor and hover decorations through DOM reconciliation', async () => {
|
|
87
|
-
const editor = makeEditor();
|
|
88
|
-
editor.commands.setTextSelection(positionInsideTopLevelNode(editor, 'First body.'));
|
|
89
|
-
await waitForDomReconciliation();
|
|
90
|
-
|
|
91
|
-
const [firstHeading, secondHeading] = headings(editor);
|
|
92
|
-
expect(firstHeading.classList.contains(BLOCK_TAG_SELECTED_CLASS)).toBe(true);
|
|
93
|
-
expect(secondHeading.classList.contains(BLOCK_TAG_SELECTED_CLASS)).toBe(false);
|
|
94
|
-
|
|
95
|
-
const secondBody = elementWithExactText(editor, 'p', 'Second body.');
|
|
96
|
-
secondBody.dispatchEvent(new MouseEvent('mouseover', { bubbles: true }));
|
|
97
|
-
await waitForDomReconciliation();
|
|
98
|
-
|
|
99
|
-
expect(firstHeading.classList.contains(BLOCK_TAG_SELECTED_CLASS)).toBe(true);
|
|
100
|
-
expect(firstHeading.classList.contains(BLOCK_TAG_HOVERED_CLASS)).toBe(false);
|
|
101
|
-
expect(secondHeading.classList.contains(BLOCK_TAG_HOVERED_CLASS)).toBe(true);
|
|
102
|
-
expect(secondHeading.classList.contains(BLOCK_TAG_SELECTED_CLASS)).toBe(false);
|
|
103
|
-
|
|
104
|
-
editor.view.dom.dispatchEvent(new MouseEvent('mouseleave'));
|
|
105
|
-
await waitForDomReconciliation();
|
|
106
|
-
expect(secondHeading.classList.contains(BLOCK_TAG_HOVERED_CLASS)).toBe(false);
|
|
107
|
-
expect(firstHeading.classList.contains(BLOCK_TAG_SELECTED_CLASS)).toBe(true);
|
|
108
|
-
|
|
109
|
-
editor.commands.setTextSelection(positionInsideTopLevelNode(editor, 'Second body.'));
|
|
110
|
-
await waitForDomReconciliation();
|
|
111
|
-
expect(firstHeading.classList.contains(BLOCK_TAG_SELECTED_CLASS)).toBe(false);
|
|
112
|
-
expect(secondHeading.classList.contains(BLOCK_TAG_SELECTED_CLASS)).toBe(true);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('maps a nested list target to the heading that owns the list', async () => {
|
|
116
|
-
const editor = makeEditor();
|
|
117
|
-
editor.commands.setTextSelection(positionInsideTopLevelNode(editor, 'Second body.'));
|
|
118
|
-
await waitForDomReconciliation();
|
|
119
|
-
|
|
120
|
-
const [firstHeading, secondHeading] = headings(editor);
|
|
121
|
-
const nestedTarget = elementWithExactText(editor, 'strong', 'nested inline target');
|
|
122
|
-
nestedTarget.dispatchEvent(new MouseEvent('mouseover', { bubbles: true }));
|
|
123
|
-
await waitForDomReconciliation();
|
|
124
|
-
|
|
125
|
-
expect(firstHeading.classList.contains(BLOCK_TAG_HOVERED_CLASS)).toBe(true);
|
|
126
|
-
expect(firstHeading.classList.contains(BLOCK_TAG_SELECTED_CLASS)).toBe(false);
|
|
127
|
-
expect(secondHeading.classList.contains(BLOCK_TAG_SELECTED_CLASS)).toBe(true);
|
|
128
|
-
expect(secondHeading.classList.contains(BLOCK_TAG_HOVERED_CLASS)).toBe(false);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it('keeps the owning block hovered across blank space between its nodes', async () => {
|
|
132
|
-
const editor = makeEditor();
|
|
133
|
-
await waitForDomReconciliation();
|
|
134
|
-
|
|
135
|
-
const [firstHeading, secondHeading] = headings(editor);
|
|
136
|
-
const topLevelChildren = Array.from(editor.view.dom.children);
|
|
137
|
-
const firstHeadingIndex = topLevelChildren.indexOf(firstHeading);
|
|
138
|
-
const secondHeadingIndex = topLevelChildren.indexOf(secondHeading);
|
|
139
|
-
|
|
140
|
-
topLevelChildren.forEach((element, index) => {
|
|
141
|
-
const top =
|
|
142
|
-
index < secondHeadingIndex
|
|
143
|
-
? 10 + (index - firstHeadingIndex) * 25
|
|
144
|
-
: 120 + (index - secondHeadingIndex) * 25;
|
|
145
|
-
vi.spyOn(element, 'getBoundingClientRect').mockReturnValue({
|
|
146
|
-
top,
|
|
147
|
-
bottom: top + 18,
|
|
148
|
-
} as DOMRect);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
editor.view.dom.dispatchEvent(new MouseEvent('mousemove', { bubbles: true, clientY: 105 }));
|
|
152
|
-
await waitForDomReconciliation();
|
|
153
|
-
|
|
154
|
-
expect(firstHeading.classList.contains(BLOCK_TAG_HOVERED_CLASS)).toBe(true);
|
|
155
|
-
expect(secondHeading.classList.contains(BLOCK_TAG_HOVERED_CLASS)).toBe(false);
|
|
156
|
-
|
|
157
|
-
editor.view.dom.dispatchEvent(new MouseEvent('mousemove', { bubbles: true, clientY: 145 }));
|
|
158
|
-
await waitForDomReconciliation();
|
|
159
|
-
|
|
160
|
-
expect(firstHeading.classList.contains(BLOCK_TAG_HOVERED_CLASS)).toBe(false);
|
|
161
|
-
expect(secondHeading.classList.contains(BLOCK_TAG_HOVERED_CLASS)).toBe(true);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
it('clears block hover below the final content node', async () => {
|
|
165
|
-
const editor = makeEditor();
|
|
166
|
-
await waitForDomReconciliation();
|
|
167
|
-
|
|
168
|
-
const [, secondHeading] = headings(editor);
|
|
169
|
-
const topLevelChildren = Array.from(editor.view.dom.children);
|
|
170
|
-
topLevelChildren.forEach((element, index) => {
|
|
171
|
-
const top = index * 25;
|
|
172
|
-
vi.spyOn(element, 'getBoundingClientRect').mockReturnValue({
|
|
173
|
-
top,
|
|
174
|
-
bottom: top + 18,
|
|
175
|
-
} as DOMRect);
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
editor.view.dom.dispatchEvent(new MouseEvent('mousemove', { bubbles: true, clientY: 1000 }));
|
|
179
|
-
await waitForDomReconciliation();
|
|
180
|
-
|
|
181
|
-
expect(secondHeading.classList.contains(BLOCK_TAG_HOVERED_CLASS)).toBe(false);
|
|
182
|
-
});
|
|
183
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import type { Block, Doc } from '@bendyline/squisq/schemas';
|
|
3
|
-
import { buildDocumentPreviewMarkdown } from '../buildDocumentPreviewMarkdown';
|
|
4
|
-
|
|
5
|
-
function docWith(blocks: Block[]): Doc {
|
|
6
|
-
return {
|
|
7
|
-
articleId: 'summary-doc',
|
|
8
|
-
duration: 10,
|
|
9
|
-
blocks,
|
|
10
|
-
audio: { segments: [] },
|
|
11
|
-
frontmatter: { title: 'Quarterly Report' },
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
describe('buildDocumentPreviewMarkdown', () => {
|
|
16
|
-
it('serializes programmatic transform blocks as readable document content', () => {
|
|
17
|
-
const markdown = buildDocumentPreviewMarkdown(
|
|
18
|
-
docWith([
|
|
19
|
-
{
|
|
20
|
-
id: 'transform-stat',
|
|
21
|
-
template: 'statHighlight',
|
|
22
|
-
startTime: 0,
|
|
23
|
-
duration: 5,
|
|
24
|
-
audioSegment: 0,
|
|
25
|
-
stat: '42%',
|
|
26
|
-
description: 'Year-over-year growth',
|
|
27
|
-
} as Block,
|
|
28
|
-
{
|
|
29
|
-
id: 'transform-list',
|
|
30
|
-
template: 'list',
|
|
31
|
-
startTime: 5,
|
|
32
|
-
duration: 5,
|
|
33
|
-
audioSegment: 0,
|
|
34
|
-
title: 'Priorities',
|
|
35
|
-
items: ['Reliability', 'Speed'],
|
|
36
|
-
} as Block,
|
|
37
|
-
]),
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
expect(markdown).toContain('# Quarterly Report');
|
|
41
|
-
expect(markdown).toContain('## 42%');
|
|
42
|
-
expect(markdown).toContain('Year-over-year growth');
|
|
43
|
-
expect(markdown).toContain('## Priorities');
|
|
44
|
-
expect(markdown).toContain('Reliability');
|
|
45
|
-
expect(markdown).toContain('Speed');
|
|
46
|
-
expect(markdown).not.toContain('{[statHighlight');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('preserves authored blocks that a conservative transform kept', () => {
|
|
50
|
-
const markdown = buildDocumentPreviewMarkdown(
|
|
51
|
-
docWith([
|
|
52
|
-
{
|
|
53
|
-
id: 'authored',
|
|
54
|
-
startTime: 0,
|
|
55
|
-
duration: 5,
|
|
56
|
-
audioSegment: 0,
|
|
57
|
-
sourceHeading: {
|
|
58
|
-
type: 'heading',
|
|
59
|
-
depth: 2,
|
|
60
|
-
children: [{ type: 'text', value: 'Context' }],
|
|
61
|
-
},
|
|
62
|
-
contents: [
|
|
63
|
-
{
|
|
64
|
-
type: 'paragraph',
|
|
65
|
-
children: [{ type: 'text', value: 'Original supporting detail.' }],
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
]),
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
expect(markdown).toContain('## Context');
|
|
73
|
-
expect(markdown).toContain('Original supporting detail.');
|
|
74
|
-
});
|
|
75
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { markdownToDoc, materializeBlockLayers } from '@bendyline/squisq/doc';
|
|
3
|
-
import { parseMarkdown } from '@bendyline/squisq/markdown';
|
|
4
|
-
import type { DocBlock, TextLayer } from '@bendyline/squisq/schemas';
|
|
5
|
-
import { buildPreviewDoc } from '../buildPreviewDoc';
|
|
6
|
-
|
|
7
|
-
function firstPreviewSlide(markdown: string): Record<string, unknown> {
|
|
8
|
-
const source = markdownToDoc(parseMarkdown(markdown), {
|
|
9
|
-
articleId: 'stat-content-test',
|
|
10
|
-
generateCoverBlock: false,
|
|
11
|
-
});
|
|
12
|
-
return buildPreviewDoc(source).blocks[0] as unknown as Record<string, unknown>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
describe('buildPreviewDoc content mapping', () => {
|
|
16
|
-
it('maps the leading bold metric to the large stat layer', () => {
|
|
17
|
-
const slide = firstPreviewSlide(`### The Big Number {[statHighlight colorScheme=green]}
|
|
18
|
-
|
|
19
|
-
**42%** of teams prefer visual blocks over raw slides.`);
|
|
20
|
-
|
|
21
|
-
expect(slide).toMatchObject({
|
|
22
|
-
title: 'The Big Number',
|
|
23
|
-
stat: '42%',
|
|
24
|
-
description: 'of teams prefer visual blocks over raw slides.',
|
|
25
|
-
colorScheme: 'green',
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const { layers } = materializeBlockLayers(slide as unknown as DocBlock);
|
|
29
|
-
const stat = layers.find((layer) => layer.id === 'stat') as TextLayer;
|
|
30
|
-
const description = layers.find((layer) => layer.id === 'description') as TextLayer;
|
|
31
|
-
|
|
32
|
-
expect(stat.content.text).toBe('42%');
|
|
33
|
-
expect(description.content.text).toBe('of teams prefer visual blocks over raw slides.');
|
|
34
|
-
expect(stat.content.style.fontSize).toBeGreaterThan(description.content.style.fontSize);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('lets explicit annotation inputs override Markdown-derived defaults', () => {
|
|
38
|
-
const slide = firstPreviewSlide(
|
|
39
|
-
'### The Big Number {[statHighlight stat="99%" description="Pinned description"]}\n\n' +
|
|
40
|
-
'**42%** derived description.',
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
expect(slide).toMatchObject({
|
|
44
|
-
stat: '99%',
|
|
45
|
-
description: 'Pinned description',
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('keeps Mermaid source available to the slide materializer for every template', () => {
|
|
50
|
-
const slide = firstPreviewSlide(
|
|
51
|
-
'# Architecture\n\n```mermaid\nflowchart LR\n client --> server\n```',
|
|
52
|
-
);
|
|
53
|
-
expect(slide.contents).toEqual([expect.objectContaining({ type: 'code', lang: 'mermaid' })]);
|
|
54
|
-
|
|
55
|
-
const { layers } = materializeBlockLayers(slide as unknown as DocBlock, {
|
|
56
|
-
persistentLayers: false,
|
|
57
|
-
});
|
|
58
|
-
expect(layers.some((layer) => layer.type === 'mermaid')).toBe(true);
|
|
59
|
-
const narrativeText = layers
|
|
60
|
-
.filter((layer): layer is TextLayer => layer.type === 'text')
|
|
61
|
-
.map((layer) => layer.content.text)
|
|
62
|
-
.join('\n');
|
|
63
|
-
expect(narrativeText).not.toContain('flowchart LR');
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { parseMarkdown } from '@bendyline/squisq/markdown';
|
|
3
|
-
import { markdownToDoc } from '@bendyline/squisq/doc';
|
|
4
|
-
import type { Doc, Transition } from '@bendyline/squisq/schemas';
|
|
5
|
-
import { buildPreviewDoc } from '../buildPreviewDoc';
|
|
6
|
-
|
|
7
|
-
function previewSlides(md: string) {
|
|
8
|
-
const doc = markdownToDoc(parseMarkdown(md), { articleId: 't' });
|
|
9
|
-
return buildPreviewDoc(doc).blocks as unknown as Array<{ transition?: Transition }>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
describe('buildPreviewDoc transition mapping', () => {
|
|
13
|
-
it('carries an authored transition through to the player slide', () => {
|
|
14
|
-
// Legacy Pandoc transition syntax remains supported.
|
|
15
|
-
const md = ['# Intro', '', '# Second {transition=vortex}', '', 'body'].join('\n');
|
|
16
|
-
const slides = previewSlides(md);
|
|
17
|
-
expect(slides[1].transition).toEqual({ type: 'vortex' });
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('preserves direction and duration on the transition', () => {
|
|
21
|
-
const md = [
|
|
22
|
-
'# Intro',
|
|
23
|
-
'',
|
|
24
|
-
'# Second {transition=push transitionDirection=up transitionDuration=1.2}',
|
|
25
|
-
].join('\n');
|
|
26
|
-
const slides = previewSlides(md);
|
|
27
|
-
expect(slides[1].transition).toEqual({ type: 'push', direction: 'up', duration: 1.2 });
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('falls back to the default fade for a non-first block with no transition', () => {
|
|
31
|
-
const md = ['# Intro', '', '# Second'].join('\n');
|
|
32
|
-
const slides = previewSlides(md);
|
|
33
|
-
expect(slides[1].transition).toEqual({ type: 'fade', duration: 0.5 });
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('leaves the first block without a transition when none is authored', () => {
|
|
37
|
-
const slides = previewSlides(['# Intro', '', '# Second'].join('\n'));
|
|
38
|
-
expect(slides[0].transition).toBeUndefined();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('honors a transition authored on the first block', () => {
|
|
42
|
-
const slides = previewSlides(['# Intro {transition=zoom}', '', '# Second'].join('\n'));
|
|
43
|
-
expect(slides[0].transition).toEqual({ type: 'zoom' });
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// The `{[name key=value]}` template-annotation form is the one the editor's
|
|
47
|
-
// attribute autocomplete advertises for `transition=`. The coerced typed
|
|
48
|
-
// transition object also rides along as a raw string in the block's
|
|
49
|
-
// templateData; if that string is spread over the typed field it silently
|
|
50
|
-
// downgrades `{ type: 'vortex' }` to the string `'vortex'`, which the player
|
|
51
|
-
// can't animate. These guard that the typed object wins.
|
|
52
|
-
describe('transition written inside a {[…]} template annotation', () => {
|
|
53
|
-
it('keeps a bare transition as a typed object, not a raw string', () => {
|
|
54
|
-
const md = ['# Intro', '', '## Second {[quote transition=vortex]}', '', '> hi'].join('\n');
|
|
55
|
-
const slides = previewSlides(md);
|
|
56
|
-
expect(slides[1].transition).toEqual({ type: 'vortex' });
|
|
57
|
-
expect(typeof slides[1].transition).toBe('object');
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('preserves direction and duration from the annotation', () => {
|
|
61
|
-
const md = [
|
|
62
|
-
'# Intro',
|
|
63
|
-
'',
|
|
64
|
-
'## Second {[factCard transition=push transitionDirection=left transitionDuration=0.8]}',
|
|
65
|
-
'',
|
|
66
|
-
'body',
|
|
67
|
-
].join('\n');
|
|
68
|
-
const slides = previewSlides(md);
|
|
69
|
-
expect(slides[1].transition).toEqual({ type: 'push', direction: 'left', duration: 0.8 });
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('preserves document-wide fields and mapped audio', () => {
|
|
74
|
-
const source = markdownToDoc(parseMarkdown('# Intro'), { articleId: 'full' }) as Doc;
|
|
75
|
-
const enriched = {
|
|
76
|
-
...source,
|
|
77
|
-
frontmatter: { owner: 'team' },
|
|
78
|
-
customThemes: [{ id: 'custom-theme' }],
|
|
79
|
-
persistentLayers: { layers: [] },
|
|
80
|
-
documentMedia: [{ id: 'bed', kind: 'audio', src: 'bed.mp3', startTime: 0 }],
|
|
81
|
-
audio: {
|
|
82
|
-
segments: [{ src: 'narration.mp3', name: 'narration', duration: 4, startTime: 0 }],
|
|
83
|
-
},
|
|
84
|
-
} as unknown as Doc;
|
|
85
|
-
const preview = buildPreviewDoc(enriched);
|
|
86
|
-
expect(preview.frontmatter).toEqual({ owner: 'team' });
|
|
87
|
-
expect(preview.customThemes).toBe(enriched.customThemes);
|
|
88
|
-
expect(preview.persistentLayers).toBe(enriched.persistentLayers);
|
|
89
|
-
expect(preview.documentMedia).toBe(enriched.documentMedia);
|
|
90
|
-
expect(preview.audio).toBe(enriched.audio);
|
|
91
|
-
});
|
|
92
|
-
});
|