@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,126 +0,0 @@
|
|
|
1
|
-
/** @vitest-environment jsdom */
|
|
2
|
-
|
|
3
|
-
import { useRef } from 'react';
|
|
4
|
-
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
5
|
-
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
6
|
-
import type { Doc } from '@bendyline/squisq/schemas';
|
|
7
|
-
import type { DocPlayerProps, PlaybackState } from '@bendyline/squisq-react';
|
|
8
|
-
|
|
9
|
-
vi.mock('@bendyline/squisq-react', async (importOriginal) => {
|
|
10
|
-
const actual = await importOriginal<typeof import('@bendyline/squisq-react')>();
|
|
11
|
-
const { useEffect } = await import('react');
|
|
12
|
-
const state: PlaybackState = {
|
|
13
|
-
isPlaying: false,
|
|
14
|
-
currentTime: 0,
|
|
15
|
-
totalDuration: 10,
|
|
16
|
-
isCoverVisible: true,
|
|
17
|
-
currentBlockIndex: 0,
|
|
18
|
-
totalBlocks: 2,
|
|
19
|
-
docProgress: 0,
|
|
20
|
-
hasCaptions: false,
|
|
21
|
-
captionsEnabled: false,
|
|
22
|
-
captionMode: 'off',
|
|
23
|
-
currentSegmentIndex: 0,
|
|
24
|
-
currentSegmentName: null,
|
|
25
|
-
currentBlock: null,
|
|
26
|
-
};
|
|
27
|
-
function MockDocPlayer(props: DocPlayerProps & { doc: Doc }) {
|
|
28
|
-
const { onPlaybackStateChange, onControlsReady } = props;
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (props.audioController) return;
|
|
31
|
-
onPlaybackStateChange?.(state);
|
|
32
|
-
onControlsReady?.({
|
|
33
|
-
play: () => undefined,
|
|
34
|
-
pause: () => undefined,
|
|
35
|
-
toggle: () => undefined,
|
|
36
|
-
restart: () => undefined,
|
|
37
|
-
seekTo: () => undefined,
|
|
38
|
-
setCaptionsEnabled: () => undefined,
|
|
39
|
-
cycleCaptionMode: () => undefined,
|
|
40
|
-
});
|
|
41
|
-
}, [onControlsReady, onPlaybackStateChange, props.audioController]);
|
|
42
|
-
return (
|
|
43
|
-
<div
|
|
44
|
-
data-testid="mock-doc-player"
|
|
45
|
-
data-article={props.doc.articleId}
|
|
46
|
-
data-audience={props.audioController ? 'true' : 'false'}
|
|
47
|
-
data-controls={props.showControls ? 'true' : 'false'}
|
|
48
|
-
data-cover={String(props.coverVisible)}
|
|
49
|
-
/>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
...actual,
|
|
54
|
-
useMediaProvider: () => null,
|
|
55
|
-
DocPlayer: MockDocPlayer,
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
import { EditorProvider, useEditorContext } from '../EditorContext';
|
|
60
|
-
import { PreviewSettingsProvider } from '../PreviewControls';
|
|
61
|
-
import { PreviewPanel } from '../PreviewPanel';
|
|
62
|
-
import {
|
|
63
|
-
PresentationModeControl,
|
|
64
|
-
PresentationModeProvider,
|
|
65
|
-
} from '../presentation/PresentationMode';
|
|
66
|
-
|
|
67
|
-
function Harness() {
|
|
68
|
-
const { doc } = useEditorContext();
|
|
69
|
-
const rootRef = useRef<HTMLDivElement>(null);
|
|
70
|
-
return (
|
|
71
|
-
<div ref={rootRef}>
|
|
72
|
-
<PreviewSettingsProvider doc={doc}>
|
|
73
|
-
<PresentationModeProvider rootRef={rootRef}>
|
|
74
|
-
<PresentationModeControl />
|
|
75
|
-
<PreviewPanel />
|
|
76
|
-
</PresentationModeProvider>
|
|
77
|
-
</PreviewSettingsProvider>
|
|
78
|
-
</div>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
afterEach(() => {
|
|
83
|
-
cleanup();
|
|
84
|
-
vi.restoreAllMocks();
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
describe('PreviewPanel presentation audience', () => {
|
|
88
|
-
it('renders a clockless, controlled audience follower in the popup', async () => {
|
|
89
|
-
const popupDocument = document.implementation.createHTMLDocument('');
|
|
90
|
-
const popupEvents = new EventTarget();
|
|
91
|
-
let closed = false;
|
|
92
|
-
const popup = {
|
|
93
|
-
document: popupDocument,
|
|
94
|
-
get closed() {
|
|
95
|
-
return closed;
|
|
96
|
-
},
|
|
97
|
-
close: vi.fn(() => {
|
|
98
|
-
closed = true;
|
|
99
|
-
}),
|
|
100
|
-
focus: vi.fn(),
|
|
101
|
-
addEventListener: popupEvents.addEventListener.bind(popupEvents),
|
|
102
|
-
removeEventListener: popupEvents.removeEventListener.bind(popupEvents),
|
|
103
|
-
} as unknown as Window;
|
|
104
|
-
vi.spyOn(window, 'open').mockReturnValue(popup);
|
|
105
|
-
|
|
106
|
-
render(
|
|
107
|
-
<EditorProvider initialMarkdown="# Audience mirror\n\nBody" initialView="preview">
|
|
108
|
-
<Harness />
|
|
109
|
-
</EditorProvider>,
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
await waitFor(() => expect(screen.getByTestId('mock-doc-player')).toBeTruthy());
|
|
113
|
-
fireEvent.click(screen.getByRole('button', { name: 'Presentation options' }));
|
|
114
|
-
fireEvent.click(screen.getByRole('menuitemradio', { name: /New window/ }));
|
|
115
|
-
fireEvent.click(screen.getByRole('button', { name: 'Present: New window' }));
|
|
116
|
-
|
|
117
|
-
await waitFor(() => {
|
|
118
|
-
const audience = popupDocument.querySelector<HTMLElement>(
|
|
119
|
-
'[data-testid="mock-doc-player"][data-audience="true"]',
|
|
120
|
-
);
|
|
121
|
-
expect(audience).toBeTruthy();
|
|
122
|
-
expect(audience?.dataset.controls).toBe('false');
|
|
123
|
-
expect(audience?.dataset.cover).toBe('true');
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
});
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/** @vitest-environment jsdom */
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
4
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
5
|
-
import type { Doc } from '@bendyline/squisq/schemas';
|
|
6
|
-
|
|
7
|
-
vi.mock('@bendyline/squisq-react', async (importOriginal) => {
|
|
8
|
-
const actual = await importOriginal<typeof import('@bendyline/squisq-react')>();
|
|
9
|
-
const blockSummary = (doc: Doc) =>
|
|
10
|
-
JSON.stringify(doc.blocks.map((block) => ({ id: block.id, template: block.template })));
|
|
11
|
-
return {
|
|
12
|
-
...actual,
|
|
13
|
-
useMediaProvider: () => null,
|
|
14
|
-
DocPlayer: ({ doc }: { doc: Doc }) => (
|
|
15
|
-
<div data-testid="mock-doc-player">{blockSummary(doc)}</div>
|
|
16
|
-
),
|
|
17
|
-
LinearDocView: ({ doc }: { doc: Doc }) => (
|
|
18
|
-
<div data-testid="mock-linear-doc">{blockSummary(doc)}</div>
|
|
19
|
-
),
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
vi.mock('../PlainHtmlPreview', () => ({
|
|
24
|
-
PlainHtmlPreview: ({ markdown }: { markdown: string }) => (
|
|
25
|
-
<div data-testid="mock-plain-document">{markdown}</div>
|
|
26
|
-
),
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
import { EditorProvider, useEditorContext } from '../EditorContext';
|
|
30
|
-
import { PreviewSettingsProvider, usePreviewSettings } from '../PreviewControls';
|
|
31
|
-
import { PreviewPanel } from '../PreviewPanel';
|
|
32
|
-
|
|
33
|
-
const SOURCE = `---
|
|
34
|
-
title: Metrics Brief
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
# Metrics Brief {[title]}
|
|
38
|
-
|
|
39
|
-
This report collects the strongest signals from a year of product work.
|
|
40
|
-
|
|
41
|
-
## Growth
|
|
42
|
-
|
|
43
|
-
Revenue increased 42% year over year while customer retention reached 91%.
|
|
44
|
-
|
|
45
|
-
## Milestone
|
|
46
|
-
|
|
47
|
-
On January 15, 2026 the team shipped the largest release in company history.
|
|
48
|
-
|
|
49
|
-
## Customer voice
|
|
50
|
-
|
|
51
|
-
> "The new workflow saves our team hours every week."
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
function TransformButton() {
|
|
55
|
-
const { setSelectedTransformStyle } = usePreviewSettings();
|
|
56
|
-
return <button onClick={() => setSelectedTransformStyle('data-driven')}>Summarize now</button>;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function Harness({ children }: { children?: ReactNode }) {
|
|
60
|
-
const { doc } = useEditorContext();
|
|
61
|
-
return (
|
|
62
|
-
<PreviewSettingsProvider doc={doc}>
|
|
63
|
-
<TransformButton />
|
|
64
|
-
{children}
|
|
65
|
-
<PreviewPanel />
|
|
66
|
-
</PreviewSettingsProvider>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function renderMode(displayMode?: string) {
|
|
71
|
-
const source = displayMode
|
|
72
|
-
? SOURCE.replace('title: Metrics Brief', `title: Metrics Brief\ndisplay-mode: ${displayMode}`)
|
|
73
|
-
: SOURCE;
|
|
74
|
-
return render(
|
|
75
|
-
<EditorProvider initialMarkdown={source} initialView="preview">
|
|
76
|
-
<Harness />
|
|
77
|
-
</EditorProvider>,
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
describe('PreviewPanel transform projection', () => {
|
|
82
|
-
it('replaces the slideshow deck when a summarization style is selected', async () => {
|
|
83
|
-
renderMode('slideshow');
|
|
84
|
-
await waitFor(() => expect(screen.getByTestId('mock-doc-player')).toBeTruthy());
|
|
85
|
-
expect(screen.getByTestId('mock-doc-player').textContent).not.toContain('transform-');
|
|
86
|
-
|
|
87
|
-
fireEvent.click(screen.getByRole('button', { name: 'Summarize now' }));
|
|
88
|
-
|
|
89
|
-
await waitFor(() =>
|
|
90
|
-
expect(screen.getByTestId('mock-doc-player').textContent).toContain('transform-'),
|
|
91
|
-
);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('feeds the transformed content model to Page mode', async () => {
|
|
95
|
-
renderMode('page');
|
|
96
|
-
await waitFor(() => expect(screen.getByTestId('mock-linear-doc')).toBeTruthy());
|
|
97
|
-
|
|
98
|
-
fireEvent.click(screen.getByRole('button', { name: 'Summarize now' }));
|
|
99
|
-
|
|
100
|
-
await waitFor(() =>
|
|
101
|
-
expect(screen.getByTestId('mock-linear-doc').textContent).toContain('transform-'),
|
|
102
|
-
);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('feeds readable transformed Markdown to Document mode', async () => {
|
|
106
|
-
renderMode('document');
|
|
107
|
-
await waitFor(() => expect(screen.getByTestId('mock-plain-document')).toBeTruthy());
|
|
108
|
-
|
|
109
|
-
fireEvent.click(screen.getByRole('button', { name: 'Summarize now' }));
|
|
110
|
-
|
|
111
|
-
await waitFor(() => {
|
|
112
|
-
const markdown = screen.getByTestId('mock-plain-document').textContent ?? '';
|
|
113
|
-
expect(markdown).toContain('Metrics Brief');
|
|
114
|
-
expect(markdown).toContain('42%');
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @vitest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
5
|
-
import { fireEvent, render, screen } from '@testing-library/react';
|
|
6
|
-
import type { ImageEditDoc } from '@bendyline/squisq/schemas';
|
|
7
|
-
import { PropertiesPanel } from '../imageEditor/PropertiesPanel.js';
|
|
8
|
-
import type { ImageEditorAction } from '../imageEditor/state.js';
|
|
9
|
-
|
|
10
|
-
function buildDoc(): ImageEditDoc {
|
|
11
|
-
return {
|
|
12
|
-
version: 1,
|
|
13
|
-
canvas: { width: 100, height: 80, background: '#ffffff' },
|
|
14
|
-
layers: [
|
|
15
|
-
{
|
|
16
|
-
id: 'a',
|
|
17
|
-
type: 'shape',
|
|
18
|
-
name: 'Box',
|
|
19
|
-
position: { x: 5, y: 6, width: 30, height: 20 },
|
|
20
|
-
content: { shape: 'rect', fill: '#3399ff' },
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
describe('PropertiesPanel', () => {
|
|
27
|
-
it('shows an empty hint when no layer is selected', () => {
|
|
28
|
-
const dispatch = vi.fn();
|
|
29
|
-
render(<PropertiesPanel doc={buildDoc()} selectedLayerId={null} dispatch={dispatch} />);
|
|
30
|
-
expect(screen.getByText(/no layer selected/i)).toBeTruthy();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('editing the canvas width dispatches set-canvas', () => {
|
|
34
|
-
const dispatch = vi.fn<(a: ImageEditorAction) => void>();
|
|
35
|
-
render(<PropertiesPanel doc={buildDoc()} selectedLayerId={null} dispatch={dispatch} />);
|
|
36
|
-
const widthInput = screen.getByDisplayValue('100') as HTMLInputElement;
|
|
37
|
-
fireEvent.change(widthInput, { target: { value: '200' } });
|
|
38
|
-
expect(dispatch).toHaveBeenCalledWith({
|
|
39
|
-
type: 'set-canvas',
|
|
40
|
-
canvas: expect.objectContaining({ width: 200, height: 80 }),
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('renaming a layer dispatches update-layer with patch.name', () => {
|
|
45
|
-
const dispatch = vi.fn<(a: ImageEditorAction) => void>();
|
|
46
|
-
render(<PropertiesPanel doc={buildDoc()} selectedLayerId="a" dispatch={dispatch} />);
|
|
47
|
-
const nameInput = screen.getByDisplayValue('Box') as HTMLInputElement;
|
|
48
|
-
fireEvent.change(nameInput, { target: { value: 'Renamed' } });
|
|
49
|
-
expect(dispatch).toHaveBeenCalledWith({
|
|
50
|
-
type: 'update-layer',
|
|
51
|
-
layerId: 'a',
|
|
52
|
-
patch: expect.objectContaining({ name: 'Renamed' }),
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('changing position X dispatches update-layer with merged position', () => {
|
|
57
|
-
const dispatch = vi.fn<(a: ImageEditorAction) => void>();
|
|
58
|
-
render(<PropertiesPanel doc={buildDoc()} selectedLayerId="a" dispatch={dispatch} />);
|
|
59
|
-
const xInput = screen.getByDisplayValue('5') as HTMLInputElement;
|
|
60
|
-
fireEvent.change(xInput, { target: { value: '50' } });
|
|
61
|
-
const calls = dispatch.mock.calls.map((c) => c[0]);
|
|
62
|
-
const last = calls[calls.length - 1];
|
|
63
|
-
expect(last).toMatchObject({
|
|
64
|
-
type: 'update-layer',
|
|
65
|
-
layerId: 'a',
|
|
66
|
-
patch: { position: { x: 50, y: 6, width: 30, height: 20 } },
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { canHandleSquisqMediaDrop, ownsMonacoModel } from '../rawEditorIsolation';
|
|
3
|
-
import { SQUISQ_MEDIA_MIME } from '../mediaDragMime';
|
|
4
|
-
|
|
5
|
-
describe('RawEditor Monaco provider isolation', () => {
|
|
6
|
-
it('accepts only the model owned by the registering editor', () => {
|
|
7
|
-
const firstModel = {} as never;
|
|
8
|
-
const secondModel = {} as never;
|
|
9
|
-
const firstEditor = { getModel: () => firstModel } as never;
|
|
10
|
-
expect(ownsMonacoModel(firstEditor, firstModel)).toBe(true);
|
|
11
|
-
expect(ownsMonacoModel(firstEditor, secondModel)).toBe(false);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('rejects media-bin drops while read-only', () => {
|
|
15
|
-
const transfer = { types: [SQUISQ_MEDIA_MIME] } as unknown as DataTransfer;
|
|
16
|
-
expect(canHandleSquisqMediaDrop(true, transfer)).toBe(false);
|
|
17
|
-
expect(canHandleSquisqMediaDrop(false, transfer)).toBe(true);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import {
|
|
3
|
-
buildFilename,
|
|
4
|
-
resolveFormat,
|
|
5
|
-
supportsDisplayMedia,
|
|
6
|
-
supportsMediaRecorder,
|
|
7
|
-
supportsUserMedia,
|
|
8
|
-
} from '../recorder/formats.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Most of these probes touch global APIs that jsdom doesn't implement.
|
|
12
|
-
* Each test installs the minimum stub needed to exercise the probe and
|
|
13
|
-
* cleans up after itself so probes in other suites stay independent.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const originalMediaRecorder = (globalThis as { MediaRecorder?: unknown }).MediaRecorder;
|
|
17
|
-
const originalNavigator = globalThis.navigator;
|
|
18
|
-
|
|
19
|
-
afterEach(() => {
|
|
20
|
-
if (originalMediaRecorder === undefined) {
|
|
21
|
-
delete (globalThis as { MediaRecorder?: unknown }).MediaRecorder;
|
|
22
|
-
} else {
|
|
23
|
-
(globalThis as { MediaRecorder?: unknown }).MediaRecorder = originalMediaRecorder;
|
|
24
|
-
}
|
|
25
|
-
Object.defineProperty(globalThis, 'navigator', {
|
|
26
|
-
value: originalNavigator,
|
|
27
|
-
configurable: true,
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
function installMediaRecorderStub(supported: readonly string[]) {
|
|
32
|
-
const stub = {
|
|
33
|
-
isTypeSupported: (mime: string) => supported.includes(mime),
|
|
34
|
-
};
|
|
35
|
-
(globalThis as { MediaRecorder?: unknown }).MediaRecorder = stub;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
describe('supportsMediaRecorder', () => {
|
|
39
|
-
it('is false when MediaRecorder is undefined', () => {
|
|
40
|
-
delete (globalThis as { MediaRecorder?: unknown }).MediaRecorder;
|
|
41
|
-
expect(supportsMediaRecorder()).toBe(false);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('is true when a MediaRecorder global exists', () => {
|
|
45
|
-
installMediaRecorderStub(['audio/webm']);
|
|
46
|
-
expect(supportsMediaRecorder()).toBe(true);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
describe('supportsUserMedia / supportsDisplayMedia', () => {
|
|
51
|
-
it('is false when navigator.mediaDevices is unavailable', () => {
|
|
52
|
-
Object.defineProperty(globalThis, 'navigator', {
|
|
53
|
-
value: {},
|
|
54
|
-
configurable: true,
|
|
55
|
-
});
|
|
56
|
-
expect(supportsUserMedia()).toBe(false);
|
|
57
|
-
expect(supportsDisplayMedia()).toBe(false);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('is true only for the methods that exist', () => {
|
|
61
|
-
Object.defineProperty(globalThis, 'navigator', {
|
|
62
|
-
value: { mediaDevices: { getUserMedia: vi.fn() } },
|
|
63
|
-
configurable: true,
|
|
64
|
-
});
|
|
65
|
-
expect(supportsUserMedia()).toBe(true);
|
|
66
|
-
expect(supportsDisplayMedia()).toBe(false);
|
|
67
|
-
|
|
68
|
-
Object.defineProperty(globalThis, 'navigator', {
|
|
69
|
-
value: { mediaDevices: { getUserMedia: vi.fn(), getDisplayMedia: vi.fn() } },
|
|
70
|
-
configurable: true,
|
|
71
|
-
});
|
|
72
|
-
expect(supportsUserMedia()).toBe(true);
|
|
73
|
-
expect(supportsDisplayMedia()).toBe(true);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
describe('resolveFormat', () => {
|
|
78
|
-
it('picks the first supported audio candidate', () => {
|
|
79
|
-
installMediaRecorderStub(['audio/webm;codecs=opus', 'audio/webm']);
|
|
80
|
-
const fmt = resolveFormat('audio');
|
|
81
|
-
expect(fmt.mimeType).toBe('audio/webm;codecs=opus');
|
|
82
|
-
expect(fmt.extension).toBe('.webm');
|
|
83
|
-
expect(fmt.directory).toBe('audio');
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('picks the first supported video candidate', () => {
|
|
87
|
-
installMediaRecorderStub(['video/mp4;codecs=avc1.42E01E,mp4a.40.2']);
|
|
88
|
-
const fmt = resolveFormat('video');
|
|
89
|
-
expect(fmt.mimeType).toBe('video/mp4;codecs=avc1.42E01E,mp4a.40.2');
|
|
90
|
-
expect(fmt.extension).toBe('.mp4');
|
|
91
|
-
expect(fmt.directory).toBe('video');
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('honors a caller-supplied preferred MIME when supported', () => {
|
|
95
|
-
installMediaRecorderStub(['audio/webm', 'audio/ogg;codecs=opus']);
|
|
96
|
-
const fmt = resolveFormat('audio', 'audio/ogg;codecs=opus');
|
|
97
|
-
expect(fmt.mimeType).toBe('audio/ogg;codecs=opus');
|
|
98
|
-
expect(fmt.extension).toBe('.ogg');
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('falls through the candidate list when the preferred MIME is unsupported', () => {
|
|
102
|
-
installMediaRecorderStub(['audio/webm']);
|
|
103
|
-
const fmt = resolveFormat('audio', 'audio/aac');
|
|
104
|
-
expect(fmt.mimeType).toBe('audio/webm');
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('returns an empty MIME with a .webm extension fallback when nothing matches', () => {
|
|
108
|
-
installMediaRecorderStub([]);
|
|
109
|
-
const fmt = resolveFormat('video');
|
|
110
|
-
expect(fmt.mimeType).toBe('');
|
|
111
|
-
expect(fmt.extension).toBe('.webm');
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('returns the .webm fallback extension when MediaRecorder is absent entirely', () => {
|
|
115
|
-
delete (globalThis as { MediaRecorder?: unknown }).MediaRecorder;
|
|
116
|
-
const fmt = resolveFormat('audio');
|
|
117
|
-
expect(fmt.mimeType).toBe('');
|
|
118
|
-
expect(fmt.extension).toBe('.webm');
|
|
119
|
-
expect(fmt.directory).toBe('audio');
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
describe('buildFilename', () => {
|
|
124
|
-
it('uses the basename when supplied, prefixed with the chosen extension', () => {
|
|
125
|
-
expect(buildFilename('audio', '.webm', 'intro')).toBe('intro.webm');
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('sanitizes filesystem-hostile characters', () => {
|
|
129
|
-
expect(buildFilename('video', '.mp4', 'my recording: take/2?')).toBe(
|
|
130
|
-
'my-recording--take-2-.mp4',
|
|
131
|
-
);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it('falls back to a timestamped name when no basename is supplied', () => {
|
|
135
|
-
const name = buildFilename('audio', '.webm');
|
|
136
|
-
expect(name.startsWith('narration-')).toBe(true);
|
|
137
|
-
expect(name.endsWith('.webm')).toBe(true);
|
|
138
|
-
// Format is narration-YYYYMMDD-HHMMSS.webm — 15 chars after the prefix.
|
|
139
|
-
expect(name).toMatch(/^narration-\d{8}-\d{6}\.webm$/);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it('uses the recording-* prefix for video sources', () => {
|
|
143
|
-
const name = buildFilename('video', '.mp4');
|
|
144
|
-
expect(name).toMatch(/^recording-\d{8}-\d{6}\.mp4$/);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { Editor } from '@tiptap/core';
|
|
2
|
-
import Document from '@tiptap/extension-document';
|
|
3
|
-
import Paragraph from '@tiptap/extension-paragraph';
|
|
4
|
-
import Text from '@tiptap/extension-text';
|
|
5
|
-
import OrderedList from '@tiptap/extension-ordered-list';
|
|
6
|
-
import ListItem from '@tiptap/extension-list-item';
|
|
7
|
-
import { describe, expect, it } from 'vitest';
|
|
8
|
-
import { parseMarkdown } from '@bendyline/squisq/markdown';
|
|
9
|
-
import { markdownToDoc, flattenBlocks } from '@bendyline/squisq/doc';
|
|
10
|
-
import { tiptapToMarkdown } from '../tiptapBridge';
|
|
11
|
-
import { insertMediaBlock } from '../recorder/insertMediaBlock';
|
|
12
|
-
import { collectEmbeddedMedia } from '../embeddedMedia';
|
|
13
|
-
import { TiptapVideo } from '../tiptap/TiptapVideo';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Regression: a recorded clip used to vanish from the markdown source
|
|
17
|
-
* (and therefore the timeline) when the editor caret sat inside a list
|
|
18
|
-
* item. The recorder inserts a block-level `<video>` atom; a plain
|
|
19
|
-
* `insertContent` nests it inside the `<li>`, and `tiptapToMarkdown`'s
|
|
20
|
-
* list serializer emits only the item's inline text — silently dropping
|
|
21
|
-
* the nested media. `insertMediaBlock` lifts the insertion to the
|
|
22
|
-
* top level so the tag round-trips.
|
|
23
|
-
*/
|
|
24
|
-
function makeEditor() {
|
|
25
|
-
return new Editor({
|
|
26
|
-
extensions: [Document, Paragraph, Text, OrderedList, ListItem, TiptapVideo],
|
|
27
|
-
content: '<ol><li><p>First</p></li><li><p>Second</p></li></ol>',
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** Put the caret at the end of the last list item — where the recorder
|
|
32
|
-
* modal typically leaves it after the user selected a list-bearing block. */
|
|
33
|
-
function caretInLastListItem(editor: Editor) {
|
|
34
|
-
editor.commands.focus('end');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
describe('recorder media insertion (caret inside a list)', () => {
|
|
38
|
-
it('a plain insertContent buries the video as an indented continuation of the <li>', () => {
|
|
39
|
-
const editor = makeEditor();
|
|
40
|
-
caretInLastListItem(editor);
|
|
41
|
-
editor
|
|
42
|
-
.chain()
|
|
43
|
-
.focus()
|
|
44
|
-
.insertContent({ type: 'video', attrs: { src: 'video/clip.webm', controls: true } })
|
|
45
|
-
.run();
|
|
46
|
-
const md = tiptapToMarkdown(editor.getHTML());
|
|
47
|
-
editor.destroy();
|
|
48
|
-
// The hardened serializer no longer drops it, but it lands nested
|
|
49
|
-
// inside the list item (indented continuation) rather than as its
|
|
50
|
-
// own block — which is why the recorder uses `insertMediaBlock`.
|
|
51
|
-
expect(md).toMatch(/\n {2,}<video/);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('insertMediaBlock places the video as a top-level block after the list', () => {
|
|
55
|
-
const editor = makeEditor();
|
|
56
|
-
caretInLastListItem(editor);
|
|
57
|
-
insertMediaBlock(editor, {
|
|
58
|
-
type: 'video',
|
|
59
|
-
attrs: { src: 'video/clip.webm', controls: true, width: 480 },
|
|
60
|
-
});
|
|
61
|
-
const md = tiptapToMarkdown(editor.getHTML());
|
|
62
|
-
editor.destroy();
|
|
63
|
-
// The list is preserved and the clip sits at the document level
|
|
64
|
-
// (start of line, not indented under a bullet).
|
|
65
|
-
expect(md).toContain('1. First');
|
|
66
|
-
expect(md).toContain('2. Second');
|
|
67
|
-
expect(md).toMatch(/^<video src="video\/clip\.webm"/m);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe('hardened list serializer: nested media round-trips to a detectable clip', () => {
|
|
72
|
-
it('a <video> left inside a list item still parses back as embedded media', () => {
|
|
73
|
-
// Even when media ends up nested in a list item (drag/paste, not the
|
|
74
|
-
// recorder path), the serializer keeps it — and the markdown re-parses
|
|
75
|
-
// to a block whose embedded media the timeline can surface.
|
|
76
|
-
const md = tiptapToMarkdown(
|
|
77
|
-
'<h2>Section</h2><ol><li><p>Step</p><video src="video/clip.webm" controls=""></video></li></ol>',
|
|
78
|
-
);
|
|
79
|
-
expect(md).toContain('<video');
|
|
80
|
-
|
|
81
|
-
const doc = markdownToDoc(parseMarkdown(md));
|
|
82
|
-
const blocks = flattenBlocks(doc.blocks);
|
|
83
|
-
const total = blocks.reduce((s, b) => s + collectEmbeddedMedia(b).length, 0);
|
|
84
|
-
expect(total).toBe(1);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @vitest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
import { fireEvent, render, screen } from '@testing-library/react';
|
|
5
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
6
|
-
import type { MediaProvider } from '@bendyline/squisq/schemas';
|
|
7
|
-
import { RecorderModal } from '../recorder/RecorderModal';
|
|
8
|
-
import { RecorderPanel } from '../recorder/RecorderPanel';
|
|
9
|
-
|
|
10
|
-
const mediaProvider: MediaProvider = {
|
|
11
|
-
resolveUrl: vi.fn(async (path: string) => path),
|
|
12
|
-
listMedia: vi.fn(async () => []),
|
|
13
|
-
addMedia: vi.fn(async (name: string) => name),
|
|
14
|
-
removeMedia: vi.fn(async () => undefined),
|
|
15
|
-
dispose: vi.fn(),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
describe('recorder theme propagation', () => {
|
|
19
|
-
it('creates a dark theme scope for the recorder dialog', () => {
|
|
20
|
-
render(<RecorderModal mediaProvider={mediaProvider} colorScheme="dark" onClose={vi.fn()} />);
|
|
21
|
-
|
|
22
|
-
const dialog = screen.getByRole('dialog', { name: 'Record media' });
|
|
23
|
-
expect(dialog.getAttribute('data-theme')).toBe('dark');
|
|
24
|
-
expect(dialog.classList.contains('squisq-editor-shell')).toBe(true);
|
|
25
|
-
expect(dialog.style.colorScheme).toBe('dark');
|
|
26
|
-
expect(dialog.style.getPropertyValue('--squisq-recorder-surface')).toBe(
|
|
27
|
-
'var(--squisq-bg, #1f2937)',
|
|
28
|
-
);
|
|
29
|
-
expect(dialog.style.getPropertyValue('--squisq-recorder-text')).toBe(
|
|
30
|
-
'var(--squisq-text, #e5e7eb)',
|
|
31
|
-
);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('passes the requested scheme through the portaled panel wrapper', () => {
|
|
35
|
-
render(<RecorderPanel mediaProvider={mediaProvider} colorScheme="dark" />);
|
|
36
|
-
fireEvent.click(screen.getByRole('button', { name: 'Record media' }));
|
|
37
|
-
|
|
38
|
-
expect(screen.getByRole('dialog', { name: 'Record media' }).getAttribute('data-theme')).toBe(
|
|
39
|
-
'dark',
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { buildTimingJson, encodeTimingJson, timingPathFor } from '../recorder/timingJson.js';
|
|
3
|
-
|
|
4
|
-
describe('buildTimingJson', () => {
|
|
5
|
-
it('returns a payload matching what resolveAudioMapping() expects', () => {
|
|
6
|
-
const timing = buildTimingJson('Hello world.', 12.5);
|
|
7
|
-
expect(timing).toEqual({
|
|
8
|
-
sourceText: 'Hello world.',
|
|
9
|
-
duration: 12.5,
|
|
10
|
-
bookmarks: [],
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('coerces missing or negative durations to 0', () => {
|
|
15
|
-
expect(buildTimingJson('script', Number.NaN).duration).toBe(0);
|
|
16
|
-
expect(buildTimingJson('script', -5).duration).toBe(0);
|
|
17
|
-
expect(buildTimingJson('script', Number.POSITIVE_INFINITY).duration).toBe(0);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('treats empty sourceText as an empty string, not undefined', () => {
|
|
21
|
-
expect(buildTimingJson('', 1).sourceText).toBe('');
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe('encodeTimingJson', () => {
|
|
26
|
-
it('emits valid pretty-printed JSON', () => {
|
|
27
|
-
const bytes = encodeTimingJson(buildTimingJson('Hi.', 3));
|
|
28
|
-
const text = new TextDecoder().decode(bytes);
|
|
29
|
-
const parsed: unknown = JSON.parse(text);
|
|
30
|
-
expect(parsed).toEqual({ sourceText: 'Hi.', duration: 3, bookmarks: [] });
|
|
31
|
-
// Pretty-printed means newlines and indentation are present.
|
|
32
|
-
expect(text).toContain('\n');
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
describe('timingPathFor', () => {
|
|
37
|
-
it('appends .timing.json to the audio path verbatim', () => {
|
|
38
|
-
expect(timingPathFor('audio/narration.webm')).toBe('audio/narration.webm.timing.json');
|
|
39
|
-
expect(timingPathFor('intro.mp3')).toBe('intro.mp3.timing.json');
|
|
40
|
-
});
|
|
41
|
-
});
|