@bendyline/squisq-editor-react 2.0.1 → 2.2.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.
Files changed (357) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +40 -0
  3. package/README.md +10 -2
  4. package/dist/index.d.ts +683 -60
  5. package/dist/index.js +9648 -3750
  6. package/dist/monaco.js +0 -1
  7. package/dist/styles/index.css +1160 -241
  8. package/package.json +10 -6
  9. package/dist/index.js.map +0 -1
  10. package/dist/monaco.js.map +0 -1
  11. package/src/BlockCardView.tsx +0 -121
  12. package/src/BlockPreviewPanel.tsx +0 -69
  13. package/src/BlockPropertiesPopover.tsx +0 -222
  14. package/src/DocumentSettingsDialog.tsx +0 -272
  15. package/src/DropZoneOverlay.tsx +0 -137
  16. package/src/EditorContext.tsx +0 -1247
  17. package/src/EditorShell.tsx +0 -1334
  18. package/src/EmojiPicker.tsx +0 -332
  19. package/src/FolderView.tsx +0 -131
  20. package/src/Icon.tsx +0 -26
  21. package/src/ImageEditor.tsx +0 -395
  22. package/src/ImageNodeView.tsx +0 -284
  23. package/src/ImageViewer.tsx +0 -221
  24. package/src/InlineIcon.ts +0 -84
  25. package/src/InlinePreviewGutter.tsx +0 -590
  26. package/src/LinkDialog.tsx +0 -276
  27. package/src/MediaBin.tsx +0 -500
  28. package/src/MentionExtension.tsx +0 -261
  29. package/src/OutlinePanel.tsx +0 -547
  30. package/src/PlainHtmlPreview.tsx +0 -277
  31. package/src/PreviewControls.tsx +0 -1250
  32. package/src/PreviewPanel.tsx +0 -422
  33. package/src/RawEditor.tsx +0 -731
  34. package/src/RecorderEntry.tsx +0 -159
  35. package/src/StatusBar.tsx +0 -51
  36. package/src/TemplateAnnotation.ts +0 -167
  37. package/src/TemplateContentPreview.tsx +0 -56
  38. package/src/TemplatePicker.tsx +0 -1314
  39. package/src/ThemeCustomizerPanel.tsx +0 -304
  40. package/src/ThemePicker.tsx +0 -433
  41. package/src/TimelineBlockPreview.tsx +0 -37
  42. package/src/TimelineTrack.tsx +0 -671
  43. package/src/Toolbar.tsx +0 -2587
  44. package/src/Tooltip.tsx +0 -142
  45. package/src/TransitionPicker.tsx +0 -390
  46. package/src/VersionHistoryPanel.tsx +0 -359
  47. package/src/ViewMenuPanel.tsx +0 -189
  48. package/src/ViewSwitcher.tsx +0 -56
  49. package/src/WysiwygEditor.tsx +0 -792
  50. package/src/__tests__/blockProperties.test.ts +0 -92
  51. package/src/__tests__/blockPropertiesPopoverTheme.test.tsx +0 -33
  52. package/src/__tests__/blockRange.test.ts +0 -105
  53. package/src/__tests__/blockTagActivity.test.ts +0 -183
  54. package/src/__tests__/buildDocumentPreviewMarkdown.test.ts +0 -75
  55. package/src/__tests__/buildPreviewDocContent.test.ts +0 -48
  56. package/src/__tests__/buildPreviewDocTransition.test.ts +0 -92
  57. package/src/__tests__/canvasSurfaceTextEditing.test.tsx +0 -60
  58. package/src/__tests__/codeContextSectionView.test.tsx +0 -97
  59. package/src/__tests__/codeContextZoneManager.test.ts +0 -127
  60. package/src/__tests__/createShapeLayer.test.ts +0 -46
  61. package/src/__tests__/customLayoutManagerTheme.test.tsx +0 -34
  62. package/src/__tests__/detectMarkdown.test.ts +0 -73
  63. package/src/__tests__/diffContextSections.test.ts +0 -39
  64. package/src/__tests__/documentSettingsDialog.test.tsx +0 -197
  65. package/src/__tests__/drawingShapeRoundTrip.test.ts +0 -49
  66. package/src/__tests__/editorScrollHandoff.test.tsx +0 -102
  67. package/src/__tests__/editorScrollSync.test.ts +0 -65
  68. package/src/__tests__/editorShellCodeContext.test.tsx +0 -86
  69. package/src/__tests__/editorShellProps.test.tsx +0 -485
  70. package/src/__tests__/embeddedMedia.test.ts +0 -48
  71. package/src/__tests__/emojiPicker.test.tsx +0 -93
  72. package/src/__tests__/fileKind.test.ts +0 -112
  73. package/src/__tests__/headingTransition.test.ts +0 -176
  74. package/src/__tests__/imageEditAffordance.test.tsx +0 -272
  75. package/src/__tests__/imageEditModalContract.test.tsx +0 -119
  76. package/src/__tests__/imageEditorShell.test.tsx +0 -94
  77. package/src/__tests__/imageEditorState.test.ts +0 -171
  78. package/src/__tests__/inlinePreviewGutter.test.tsx +0 -62
  79. package/src/__tests__/inlinePreviewGutterAllBlocks.test.tsx +0 -103
  80. package/src/__tests__/jsonEditor.test.tsx +0 -223
  81. package/src/__tests__/layersPanel.test.tsx +0 -167
  82. package/src/__tests__/layoutChildRoundTrip.test.ts +0 -71
  83. package/src/__tests__/linkDialogDocPicker.test.tsx +0 -137
  84. package/src/__tests__/majorApiTypes.test.ts +0 -26
  85. package/src/__tests__/mediaAttachmentFlow.test.ts +0 -110
  86. package/src/__tests__/mediaBinDrop.test.tsx +0 -90
  87. package/src/__tests__/mediaReferences.test.ts +0 -82
  88. package/src/__tests__/narrationSave.test.ts +0 -148
  89. package/src/__tests__/outlinePanel.test.tsx +0 -169
  90. package/src/__tests__/outlineSource.test.ts +0 -217
  91. package/src/__tests__/plainHtmlPreview.test.tsx +0 -125
  92. package/src/__tests__/presentationMode.test.tsx +0 -290
  93. package/src/__tests__/previewControls.test.tsx +0 -540
  94. package/src/__tests__/previewPanelAudioFailure.test.tsx +0 -46
  95. package/src/__tests__/previewPanelPresentation.test.tsx +0 -126
  96. package/src/__tests__/previewPanelTransforms.test.tsx +0 -117
  97. package/src/__tests__/propertiesPanel.test.tsx +0 -69
  98. package/src/__tests__/rawEditorModelIsolation.test.ts +0 -19
  99. package/src/__tests__/recorderFormats.test.ts +0 -146
  100. package/src/__tests__/recorderMediaInsert.test.ts +0 -86
  101. package/src/__tests__/recorderTheme.test.tsx +0 -42
  102. package/src/__tests__/recorderTimingJson.test.ts +0 -41
  103. package/src/__tests__/resolveBlockVisual.test.ts +0 -43
  104. package/src/__tests__/selectionConversions.test.ts +0 -80
  105. package/src/__tests__/statusBar.test.tsx +0 -27
  106. package/src/__tests__/teleprompter.test.tsx +0 -190
  107. package/src/__tests__/templateAnnotationRoundTrip.test.ts +0 -99
  108. package/src/__tests__/templateContentPreview.test.ts +0 -101
  109. package/src/__tests__/templatePickerMetadata.test.ts +0 -32
  110. package/src/__tests__/templatePickerPortal.test.tsx +0 -62
  111. package/src/__tests__/timelineSource.test.ts +0 -134
  112. package/src/__tests__/tiptapBridge.test.ts +0 -566
  113. package/src/__tests__/tiptapBridgeConformance.test.ts +0 -47
  114. package/src/__tests__/tiptapCodeBlockRoundTrip.test.ts +0 -109
  115. package/src/__tests__/tiptapImageRoundTrip.test.ts +0 -73
  116. package/src/__tests__/toolbarSelectionConversion.test.tsx +0 -164
  117. package/src/__tests__/tooltip.test.tsx +0 -72
  118. package/src/__tests__/transformStyleId.test.ts +0 -13
  119. package/src/__tests__/transitionCatalog.test.ts +0 -64
  120. package/src/__tests__/useBlockNavigator.test.tsx +0 -67
  121. package/src/__tests__/useImageEditor.test.tsx +0 -226
  122. package/src/__tests__/useJsonEditorTokens.test.ts +0 -59
  123. package/src/__tests__/useMediaRecorder.test.ts +0 -302
  124. package/src/__tests__/useTimelineClock.test.ts +0 -21
  125. package/src/__tests__/versionHistory.test.tsx +0 -197
  126. package/src/__tests__/viewMenuPanel.test.tsx +0 -130
  127. package/src/__tests__/wysiwygImageUpload.test.ts +0 -69
  128. package/src/__tests__/wysiwygTemplateBadgeFocus.test.tsx +0 -56
  129. package/src/asciiDiagram/AsciiDiagramExtension.ts +0 -343
  130. package/src/asciiDiagram/AsciiDiagramWidget.tsx +0 -254
  131. package/src/asciiDiagram/RepairableDiagramExtension.ts +0 -200
  132. package/src/asciiDiagram/__tests__/AsciiDiagramExtension.test.ts +0 -145
  133. package/src/asciiDiagram/__tests__/RepairableDiagramExtension.test.ts +0 -159
  134. package/src/asciiDiagram/__tests__/asciiDiagramCommands.test.ts +0 -284
  135. package/src/asciiDiagram/__tests__/asciiDiagramOps.test.ts +0 -114
  136. package/src/asciiDiagram/__tests__/asciiPaste.test.ts +0 -43
  137. package/src/asciiDiagram/asciiDiagramCommands.ts +0 -174
  138. package/src/asciiDiagram/asciiDiagramData.ts +0 -149
  139. package/src/asciiDiagram/asciiDiagramOps.ts +0 -238
  140. package/src/asciiDiagram/asciiPaste.ts +0 -19
  141. package/src/blockProperties.ts +0 -88
  142. package/src/blockRange.ts +0 -132
  143. package/src/blockSlice.ts +0 -75
  144. package/src/blockTagActivity.ts +0 -233
  145. package/src/buildDocumentPreviewMarkdown.ts +0 -168
  146. package/src/buildPreviewDoc.ts +0 -405
  147. package/src/codeContext/CodeContextSectionView.tsx +0 -124
  148. package/src/codeContext/CodeContextZoneManager.ts +0 -149
  149. package/src/codeContext/CodeContextZones.tsx +0 -121
  150. package/src/codeContext/diffContextSections.ts +0 -38
  151. package/src/codeContext/types.ts +0 -75
  152. package/src/customTemplates/AddBin.tsx +0 -126
  153. package/src/customTemplates/CustomLayoutManager.tsx +0 -234
  154. package/src/customTemplates/CustomTemplateContext.tsx +0 -188
  155. package/src/customTemplates/LayerToolbar.tsx +0 -580
  156. package/src/customTemplates/ShapeGlyph.tsx +0 -47
  157. package/src/customTemplates/TemplateDesigner.tsx +0 -433
  158. package/src/customTemplates/__tests__/library.test.ts +0 -96
  159. package/src/customTemplates/__tests__/normalizePositions.test.ts +0 -109
  160. package/src/customTemplates/__tests__/shapeDefs.test.ts +0 -49
  161. package/src/customTemplates/__tests__/useMemoryLayerAdapter.test.ts +0 -108
  162. package/src/customTemplates/designer.css +0 -732
  163. package/src/customTemplates/index.ts +0 -31
  164. package/src/customTemplates/library.ts +0 -110
  165. package/src/customTemplates/normalizePositions.ts +0 -75
  166. package/src/customTemplates/shapeDefs.ts +0 -131
  167. package/src/customTemplates/thumbnail.tsx +0 -63
  168. package/src/customTemplates/tokenDefs.ts +0 -60
  169. package/src/customTemplates/useDocCustomTemplates.ts +0 -52
  170. package/src/customTemplates/useMemoryLayerAdapter.ts +0 -129
  171. package/src/customThemes/CustomThemeContext.tsx +0 -185
  172. package/src/customThemes/CustomThemeDialog.tsx +0 -316
  173. package/src/customThemes/ImportThemeSection.tsx +0 -178
  174. package/src/customThemes/__tests__/CustomThemeContext.test.tsx +0 -64
  175. package/src/customThemes/__tests__/CustomThemeDialog.test.tsx +0 -47
  176. package/src/customThemes/__tests__/customThemeLibrary.test.ts +0 -60
  177. package/src/customThemes/__tests__/importThemeSection.test.tsx +0 -192
  178. package/src/customThemes/customThemeLibrary.ts +0 -100
  179. package/src/customThemes/index.ts +0 -37
  180. package/src/customThemes/themeControls.tsx +0 -229
  181. package/src/customThemes/themeDraft.ts +0 -288
  182. package/src/customThemes/useDocCustomThemes.ts +0 -49
  183. package/src/detectMarkdown.ts +0 -62
  184. package/src/diagram/DiagramCanvas.tsx +0 -259
  185. package/src/diagram/DiagramMaximizedOverlay.tsx +0 -46
  186. package/src/diagram/diagramCommands.ts +0 -604
  187. package/src/diagram/diagramConstants.ts +0 -17
  188. package/src/diagram/types.ts +0 -35
  189. package/src/editorScrollSync.ts +0 -73
  190. package/src/embeddedMedia.ts +0 -78
  191. package/src/emojiData.ts +0 -1317
  192. package/src/fileKind.ts +0 -158
  193. package/src/frontmatter.ts +0 -29
  194. package/src/frontmatterSettings.ts +0 -23
  195. package/src/headingTransition.ts +0 -291
  196. package/src/hooks/useFileDrop.ts +0 -266
  197. package/src/imageEditor/CanvasSurface.tsx +0 -703
  198. package/src/imageEditor/ImageVersionHistoryDropdown.tsx +0 -396
  199. package/src/imageEditor/LayersPanel.tsx +0 -218
  200. package/src/imageEditor/PropertiesPanel.tsx +0 -474
  201. package/src/imageEditor/Toolbar.tsx +0 -459
  202. package/src/imageEditor/createShapeLayer.ts +0 -280
  203. package/src/imageEditor/icons.tsx +0 -68
  204. package/src/imageEditor/image-editor.css +0 -574
  205. package/src/imageEditor/layers/EditorImageLayer.tsx +0 -45
  206. package/src/imageEditor/layers/EditorShapeLayer.tsx +0 -62
  207. package/src/imageEditor/layers/EditorTextLayer.tsx +0 -45
  208. package/src/imageEditor/layers/SelectionHandles.tsx +0 -86
  209. package/src/imageEditor/state.ts +0 -173
  210. package/src/imageEditor/useImageEditor.ts +0 -385
  211. package/src/imageEditor/useImageEditorTokens.ts +0 -70
  212. package/src/index.ts +0 -470
  213. package/src/jsonEditor/EmbeddedRichTextField.tsx +0 -81
  214. package/src/jsonEditor/JsonEditor.tsx +0 -81
  215. package/src/jsonEditor/JsonEditorContext.tsx +0 -81
  216. package/src/jsonEditor/RenderNode.tsx +0 -87
  217. package/src/jsonEditor/editors.tsx +0 -745
  218. package/src/jsonEditor/index.ts +0 -2
  219. package/src/jsonEditor/json-editor.css +0 -463
  220. package/src/jsonEditor/useJsonEditorTokens.ts +0 -33
  221. package/src/mediaDragMime.ts +0 -32
  222. package/src/mediaEntries.ts +0 -12
  223. package/src/mediaReferences.ts +0 -299
  224. package/src/monaco.ts +0 -35
  225. package/src/monacoWorkers.ts +0 -89
  226. package/src/outlineSource.ts +0 -171
  227. package/src/presentation/PresentationMode.tsx +0 -596
  228. package/src/rawEditorIsolation.ts +0 -18
  229. package/src/recorder/RecorderButton.tsx +0 -80
  230. package/src/recorder/RecorderModal.tsx +0 -706
  231. package/src/recorder/RecorderPanel.tsx +0 -77
  232. package/src/recorder/formats.ts +0 -159
  233. package/src/recorder/hooks/useMediaRecorder.ts +0 -436
  234. package/src/recorder/hooks/useStreamPreview.ts +0 -47
  235. package/src/recorder/insertMediaBlock.ts +0 -30
  236. package/src/recorder/sources/cameraStream.ts +0 -32
  237. package/src/recorder/sources/micStream.ts +0 -25
  238. package/src/recorder/sources/screenStream.ts +0 -162
  239. package/src/recorder/timingJson.ts +0 -66
  240. package/src/resolveBlockVisual.ts +0 -39
  241. package/src/scene/Scene.tsx +0 -616
  242. package/src/scene/SceneBlockExtension.ts +0 -205
  243. package/src/scene/SceneBlockToolbar.tsx +0 -201
  244. package/src/scene/SceneBlockWidget.tsx +0 -441
  245. package/src/scene/ScenePropsBar.tsx +0 -85
  246. package/src/scene/SceneSelection.tsx +0 -111
  247. package/src/scene/SceneSideToolbar.tsx +0 -89
  248. package/src/scene/SceneViewport.tsx +0 -106
  249. package/src/scene/ShapePalette.tsx +0 -196
  250. package/src/scene/__tests__/DiagramAdapter.test.ts +0 -142
  251. package/src/scene/__tests__/SceneBlockExtension.test.ts +0 -33
  252. package/src/scene/__tests__/bezierEdit.test.ts +0 -85
  253. package/src/scene/__tests__/blockLayers.test.ts +0 -57
  254. package/src/scene/__tests__/sceneIsolation.test.tsx +0 -119
  255. package/src/scene/__tests__/shapeLayers.test.ts +0 -106
  256. package/src/scene/__tests__/useSceneHitTest.test.ts +0 -90
  257. package/src/scene/__tests__/useScenePanZoom.test.ts +0 -103
  258. package/src/scene/adapters/DiagramAdapter.ts +0 -79
  259. package/src/scene/adapters/DrawingAdapter.ts +0 -420
  260. package/src/scene/adapters/LayoutAdapter.ts +0 -313
  261. package/src/scene/adapters/blockLayers.ts +0 -159
  262. package/src/scene/commands/SceneCommand.ts +0 -84
  263. package/src/scene/commands/drawingCommands.ts +0 -318
  264. package/src/scene/commands/layoutCommands.ts +0 -301
  265. package/src/scene/hooks/useSceneHitTest.ts +0 -105
  266. package/src/scene/hooks/useScenePanZoom.ts +0 -147
  267. package/src/scene/hooks/useSceneSelection.ts +0 -62
  268. package/src/scene/index.ts +0 -90
  269. package/src/scene/layers/DiagramEdges.tsx +0 -142
  270. package/src/scene/layers/edgeGeometry.ts +0 -104
  271. package/src/scene/layers/nodeCard.tsx +0 -164
  272. package/src/scene/layers/renderLayer.tsx +0 -70
  273. package/src/scene/layers/shapeLayers.ts +0 -201
  274. package/src/scene/paths/bezierEdit.ts +0 -208
  275. package/src/scene/scene.css +0 -792
  276. package/src/scene/text/SceneTextOverlay.tsx +0 -161
  277. package/src/scene/text/sceneTextChannel.ts +0 -46
  278. package/src/scene/text/sceneTextConfig.ts +0 -31
  279. package/src/scene/text/sceneTiptap.ts +0 -36
  280. package/src/scene/text/useSceneTextEditing.ts +0 -39
  281. package/src/scene/tools/ConnectTool.ts +0 -209
  282. package/src/scene/tools/DrawingConnectTool.ts +0 -231
  283. package/src/scene/tools/PathTool.ts +0 -158
  284. package/src/scene/tools/PlaceTool.ts +0 -47
  285. package/src/scene/tools/SceneTool.ts +0 -85
  286. package/src/scene/tools/SelectTool.ts +0 -300
  287. package/src/scene/tools/ShapeTool.ts +0 -143
  288. package/src/scene/tools/TextTool.ts +0 -72
  289. package/src/scene/tools/TokenTool.ts +0 -95
  290. package/src/scene/tools/createDrawShapeTool.ts +0 -82
  291. package/src/selectionConversions.ts +0 -155
  292. package/src/styles/ascii-diagram.css +0 -79
  293. package/src/styles/ascii-timeline.css +0 -596
  294. package/src/styles/code-context.css +0 -155
  295. package/src/styles/diagram.css +0 -183
  296. package/src/styles/editor.css +0 -6811
  297. package/src/styles/folder-view.css +0 -210
  298. package/src/styles/image-edit-affordance.css +0 -201
  299. package/src/styles/index.css +0 -18
  300. package/src/styles/tree-view.css +0 -189
  301. package/src/teleprompter/TeleprompterControls.tsx +0 -218
  302. package/src/teleprompter/TeleprompterSelfView.tsx +0 -22
  303. package/src/teleprompter/TeleprompterSurface.tsx +0 -267
  304. package/src/teleprompter/TeleprompterView.tsx +0 -338
  305. package/src/teleprompter/canvasRenderer.ts +0 -161
  306. package/src/teleprompter/floatingWindow.ts +0 -352
  307. package/src/teleprompter/index.ts +0 -61
  308. package/src/teleprompter/pcmWorklet.ts +0 -62
  309. package/src/teleprompter/recording/insertPreamble.ts +0 -80
  310. package/src/teleprompter/recording/narrationSave.ts +0 -134
  311. package/src/teleprompter/recording/useNarrationRecorder.ts +0 -367
  312. package/src/teleprompter/scrollModel.ts +0 -85
  313. package/src/teleprompter/teleprompterTheme.ts +0 -303
  314. package/src/teleprompter/types.ts +0 -38
  315. package/src/teleprompter/useFloatingWindow.ts +0 -74
  316. package/src/teleprompter/useMicAnalysis.ts +0 -211
  317. package/src/teleprompter/useTeleprompter.ts +0 -421
  318. package/src/templateContentPreviewResolver.ts +0 -360
  319. package/src/timeline/TimelineEditorWidget.tsx +0 -861
  320. package/src/timeline/TimelineViewExtension.ts +0 -252
  321. package/src/timeline/__tests__/TimelineEditorWidget.test.tsx +0 -414
  322. package/src/timeline/__tests__/TimelineViewExtension.test.ts +0 -163
  323. package/src/timeline/__tests__/timelineCommands.test.ts +0 -359
  324. package/src/timeline/__tests__/timelineOps.test.ts +0 -277
  325. package/src/timeline/__tests__/timelinePaste.test.ts +0 -34
  326. package/src/timeline/timelineCommands.ts +0 -421
  327. package/src/timeline/timelineData.ts +0 -54
  328. package/src/timeline/timelineOps.ts +0 -381
  329. package/src/timeline/timelinePaste.ts +0 -8
  330. package/src/timelineSource.ts +0 -244
  331. package/src/tiptap/TiptapAudio.tsx +0 -86
  332. package/src/tiptap/TiptapVideo.tsx +0 -119
  333. package/src/tiptap/useResolvedMediaSrc.ts +0 -47
  334. package/src/tiptapBridge.ts +0 -986
  335. package/src/tooltipPlacement.ts +0 -13
  336. package/src/transformStyleId.ts +0 -17
  337. package/src/transitionCatalog.ts +0 -159
  338. package/src/treeview/TreeOutlineWidget.tsx +0 -390
  339. package/src/treeview/TreeViewExtension.ts +0 -250
  340. package/src/treeview/__tests__/TreeOutlineWidget.test.tsx +0 -156
  341. package/src/treeview/__tests__/TreeViewExtension.test.ts +0 -122
  342. package/src/treeview/__tests__/treeOps.test.ts +0 -177
  343. package/src/treeview/__tests__/treePaste.test.ts +0 -40
  344. package/src/treeview/__tests__/treeViewCommands.test.ts +0 -179
  345. package/src/treeview/treeOps.ts +0 -231
  346. package/src/treeview/treePaste.ts +0 -13
  347. package/src/treeview/treeViewCommands.ts +0 -99
  348. package/src/treeview/treeViewData.ts +0 -41
  349. package/src/types/monaco-shims.d.ts +0 -10
  350. package/src/useBlockNavigator.ts +0 -153
  351. package/src/useHeadingLayout.ts +0 -294
  352. package/src/useMonacoLoader.ts +0 -82
  353. package/src/useTimelineClock.ts +0 -76
  354. package/src/utils/collectInlineFontAwesomeCss.ts +0 -69
  355. package/src/utils/dropUtils.ts +0 -136
  356. package/src/utils/normalizeMalformedAssetUrl.ts +0 -22
  357. 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,48 +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
- });
@@ -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
- });