@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
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { ReactNode, CSSProperties, RefObject, KeyboardEvent } from 'react';
4
4
  import { Doc, MediaProvider, Theme, CustomTemplateDefinition, ThemeSeedColors, ViewportPreset, ViewportConfig, Block, MediaEntry, DiagramEdgeAnchor, SurfaceScheme, ImageEditDoc, ImageEditLayer } from '@bendyline/squisq/schemas';
5
- import { MarkdownDocument } from '@bendyline/squisq/markdown';
5
+ import { MarkdownDocument, ResourcePolicy } from '@bendyline/squisq/markdown';
6
6
  import { ContentContainer } from '@bendyline/squisq/storage';
7
7
  import { DocumentVersionManager, SaveVersionOptions, SaveVersionResult, PrunePolicy } from '@bendyline/squisq/versions';
8
8
  import * as _tiptap_core from '@tiptap/core';
@@ -17,6 +17,7 @@ import { DecorationSet } from '@tiptap/pm/view';
17
17
  import { Editor as Editor$1 } from '@tiptap/react';
18
18
  import { PluginKey } from '@tiptap/pm/state';
19
19
  import { Node } from '@tiptap/pm/model';
20
+ import { RenderResult } from 'mermaid';
20
21
  import { SquisqAnnotatedSchema, JsonFormValidator, JsonFormValidationError } from '@bendyline/squisq/jsonForm';
21
22
  import { NarrationTrace, NarrationAlignment, NarrationScript, NarrationTimingJsonV3, VadConfig } from '@bendyline/squisq/narration';
22
23
  import { ImageEditExportFormat, ImageEditVersionManager } from '@bendyline/squisq/imageEdit';
@@ -153,6 +154,8 @@ interface EditorState {
153
154
  colorScheme: EditorColorScheme;
154
155
  /** Operating mode — 'markdown' for the full shell, 'code' for Monaco-only. */
155
156
  editorMode: EditorMode;
157
+ /** Whether the host-triggered Find toolbar is active. */
158
+ findMode: boolean;
156
159
  /** Monaco language ID for the Raw editor. */
157
160
  language: string;
158
161
  /**
@@ -262,6 +265,8 @@ interface EditorActions {
262
265
  setMarkdownDoc: (doc: MarkdownDocument) => void;
263
266
  /** Switch the active view */
264
267
  setActiveView: (view: EditorView) => void;
268
+ /** Enter or leave the host-triggered Find toolbar mode. */
269
+ setFindMode: (active: boolean) => void;
265
270
  /** Register / unregister the Tiptap editor instance (called by WysiwygEditor) */
266
271
  setTiptapEditor: (editor: Editor | null) => void;
267
272
  /** Register / unregister the Monaco editor instance (called by RawEditor) */
@@ -360,6 +365,13 @@ interface EditorContextValue extends EditorState, EditorActions {
360
365
  * path link. When unset, the dialog falls back to URL-only.
361
366
  */
362
367
  documentLinkProvider: DocumentLinkProvider | null;
368
+ /**
369
+ * Extra link schemes the host intercepts itself (e.g. an app-internal
370
+ * navigation protocol). The link dialog validates against core's
371
+ * `sanitizeUrl` with these allowed, so authors aren't told a scheme the
372
+ * host DOES resolve is unsupported. Executable schemes stay refused.
373
+ */
374
+ linkSchemes: readonly string[] | undefined;
363
375
  }
364
376
  type ImageDisplayMode = 'inline' | 'thumbnail';
365
377
  /**
@@ -424,6 +436,12 @@ interface EditorProviderProps {
424
436
  * Omit to fall back to URL-only link insertion.
425
437
  */
426
438
  documentLinkProvider?: DocumentLinkProvider | null;
439
+ /**
440
+ * Extra link schemes this host resolves itself. Threaded into the link
441
+ * dialog's `sanitizeUrl` check so a host-custom protocol is accepted;
442
+ * executable schemes are refused regardless.
443
+ */
444
+ linkSchemes?: readonly string[];
427
445
  /**
428
446
  * Whether the in-editor media recorder is available in the toolbar.
429
447
  * Defaults to true. Set to false to suppress the recorder affordance
@@ -444,6 +462,13 @@ interface EditorProviderProps {
444
462
  fileName?: string;
445
463
  /** Explicit Monaco language ID — wins over the fileName-derived one. */
446
464
  language?: string;
465
+ /**
466
+ * Controlled Find-mode state. No trigger button is rendered by default;
467
+ * hosts can set this prop or call `setFindMode` from editor context.
468
+ */
469
+ findMode?: boolean;
470
+ /** Notified when Find mode requests a state change (for example, its X button). */
471
+ onFindModeChange?: (active: boolean) => void;
447
472
  /**
448
473
  * Initial visibility of the inline preview gutter. Defaults to false.
449
474
  * The toolbar's View menu can toggle it at runtime.
@@ -523,7 +548,7 @@ interface ViewPreferences {
523
548
  /** Document vs. block-at-a-time layout. */
524
549
  layoutMode?: LayoutMode;
525
550
  }
526
- declare function EditorProvider({ initialMarkdown, initialView, articleId, colorScheme: initialColorScheme, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, mediaProvider, imageDisplayMode, mentionProvider, documentLinkProvider, allowRecording, allowNarrate, fileName, language, inlinePreview, showStatusBar, outline, blockTags, blockTagVisibility: initialBlockTagVisibility, themeInheritance, layoutMode, viewPreferences, onViewPreferencesChange, children, }: EditorProviderProps): react_jsx_runtime.JSX.Element;
551
+ declare function EditorProvider({ initialMarkdown, initialView, articleId, colorScheme: initialColorScheme, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, mediaProvider, imageDisplayMode, mentionProvider, documentLinkProvider, linkSchemes, allowRecording, allowNarrate, fileName, language, findMode: controlledFindMode, onFindModeChange, inlinePreview, showStatusBar, outline, blockTags, blockTagVisibility: initialBlockTagVisibility, themeInheritance, layoutMode, viewPreferences, onViewPreferencesChange, children, }: EditorProviderProps): react_jsx_runtime.JSX.Element;
527
552
 
528
553
  /**
529
554
  * Host-supplied context sections rendered INSIDE the Monaco (raw/code)
@@ -601,6 +626,14 @@ interface CodeContext {
601
626
  onToggleSection?: (sectionId: string, expanded: boolean) => void;
602
627
  }
603
628
 
629
+ /** Host-controlled typography for the markdown Write canvas. */
630
+ interface WriteCanvasSettings {
631
+ /** Base text size in CSS pixels. Headings continue to scale relative to it. */
632
+ textSize?: number;
633
+ /** Unitless line-height multiplier for body text. */
634
+ lineSpacing?: number;
635
+ }
636
+
604
637
  interface EditorShellProps {
605
638
  /** Initial markdown content */
606
639
  initialMarkdown?: string;
@@ -694,6 +727,8 @@ interface EditorShellProps {
694
727
  toolbarSlotAfterActions?: ReactNode;
695
728
  /** Content rendered at the rightmost end of the toolbar, after all other elements. */
696
729
  toolbarSlotRight?: ReactNode;
730
+ /** Host-supplied content rendered at the right edge of the bottom status bar. */
731
+ statusBarSlotRight?: ReactNode;
697
732
  /**
698
733
  * Whether to show the "Play" (preview) tab in the toolbar. When false, the
699
734
  * tab and its preview panel are hidden, and ⌘3 becomes a no-op. Use this
@@ -744,8 +779,14 @@ interface EditorShellProps {
744
779
  */
745
780
  thinMargins?: boolean;
746
781
  /**
747
- * Render the bottom status bar (word / character / line / block counts
748
- * and parse-state indicator). Defaults to `true`. Set to `false` in
782
+ * Host-controlled typography for the markdown Write canvas. `textSize` is
783
+ * measured in CSS pixels and `lineSpacing` is a unitless line-height
784
+ * multiplier. This is presentation-only and does not modify the markdown.
785
+ */
786
+ writeCanvasSettings?: WriteCanvasSettings;
787
+ /**
788
+ * Render the bottom status bar (word / character / line / block counts,
789
+ * parse errors, and optional host status). Defaults to `true`. Set to `false` in
749
790
  * embedded surfaces — chat composers and other short-form inputs —
750
791
  * where the stats are noise.
751
792
  */
@@ -776,6 +817,14 @@ interface EditorShellProps {
776
817
  * switches the shell into code mode.
777
818
  */
778
819
  language?: string;
820
+ /**
821
+ * Controlled Find-mode state. Find has no built-in trigger button; hosts
822
+ * opt in by setting this prop (or by calling `setFindMode` from a toolbar
823
+ * slot rendered inside the editor context).
824
+ */
825
+ findMode?: boolean;
826
+ /** Called when Find mode requests a state change, including its X button. */
827
+ onFindModeChange?: (active: boolean) => void;
779
828
  /**
780
829
  * Optional async provider for `@`-mention suggestions. When supplied,
781
830
  * typing `@` inside the editor opens a popover of candidates; selecting
@@ -793,6 +842,14 @@ interface EditorShellProps {
793
842
  * remote API, …) implement this; the editor stays agnostic.
794
843
  */
795
844
  documentLinkProvider?: DocumentLinkProvider | null;
845
+ /**
846
+ * Extra link schemes this host resolves itself (e.g. an app-internal
847
+ * navigation protocol). The link dialog validates typed URLs against
848
+ * core's `sanitizeUrl` with these allowed, so an author isn't told a
849
+ * scheme the host DOES handle is unsupported. Executable schemes
850
+ * (`javascript:`, `vbscript:`, `data:`) are refused regardless.
851
+ */
852
+ linkSchemes?: readonly string[];
796
853
  /**
797
854
  * Whether the in-editor media recorder is surfaced in the toolbar.
798
855
  * Defaults to true — when a `mediaProvider` is wired, a record
@@ -935,7 +992,7 @@ interface EditorShellProps {
935
992
  * Complete markdown editor shell with toolbar, view switcher, and three
936
993
  * editing modes: Raw (Monaco), WYSIWYG (Tiptap), and Preview.
937
994
  */
938
- declare function EditorShell({ initialMarkdown, initialView, articleId, basePath, onChange, colorScheme, className, height, minHeight, maxHeight, mediaProvider, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, showFilesToggle, toolbarSlotLeft, toolbarSlotAfterActions, toolbarSlotRight, showPlayTab, submitOnEnter, codeContext, fullWidth, uxFont, thinMargins, showStatusBar, imageDisplayMode, fileName, language, mentionProvider, documentLinkProvider, allowRecording, allowNarrate, placeholder, readOnly, imageSrc, imageAlt, imageMode, imageEditorContainer, onImageExport, inlinePreview, inlinePreviewWidth, outline, outlineWidth, blockTags, blockTagVisibility, themeInheritance, viewPreferences, onViewPreferencesChange, themeOverride, }: EditorShellProps): react_jsx_runtime.JSX.Element;
995
+ declare function EditorShell({ initialMarkdown, initialView, articleId, basePath, onChange, colorScheme, className, height, minHeight, maxHeight, mediaProvider, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, showFilesToggle, toolbarSlotLeft, toolbarSlotAfterActions, toolbarSlotRight, statusBarSlotRight, showPlayTab, submitOnEnter, codeContext, fullWidth, uxFont, thinMargins, writeCanvasSettings, showStatusBar, imageDisplayMode, fileName, language, findMode, onFindModeChange, mentionProvider, documentLinkProvider, linkSchemes, allowRecording, allowNarrate, placeholder, readOnly, imageSrc, imageAlt, imageMode, imageEditorContainer, onImageExport, inlinePreview, inlinePreviewWidth, outline, outlineWidth, blockTags, blockTagVisibility, themeInheritance, viewPreferences, onViewPreferencesChange, themeOverride, }: EditorShellProps): react_jsx_runtime.JSX.Element;
939
996
 
940
997
  /**
941
998
  * Bridges a host-supplied {@link CodeContext} onto the live Monaco editor:
@@ -1265,17 +1322,6 @@ interface RawEditorProps {
1265
1322
  */
1266
1323
  declare function RawEditor({ monacoTheme, minimap, fontSize, wordWrap, className, submitOnEnter, readOnly, }: RawEditorProps): react_jsx_runtime.JSX.Element;
1267
1324
 
1268
- /**
1269
- * WysiwygEditor
1270
- *
1271
- * Tiptap-based rich text editor that provides a WYSIWYG editing experience
1272
- * for markdown content. Uses squisq's parseMarkdown/stringifyMarkdown for
1273
- * conversion rather than Tiptap's built-in HTML serialization, ensuring
1274
- * perfect fidelity with the markdown format.
1275
- *
1276
- * Includes extensions for GFM features: tables, task lists, strikethrough,
1277
- * and code blocks.
1278
- */
1279
1325
  interface WysiwygEditorProps {
1280
1326
  /**
1281
1327
  * Placeholder text when the editor is empty. If omitted, one of several
@@ -1292,12 +1338,14 @@ interface WysiwygEditorProps {
1292
1338
  submitOnEnter?: () => void;
1293
1339
  /** Disable Tiptap editing — renders content but blocks input. */
1294
1340
  readOnly?: boolean;
1341
+ /** Host-controlled base text size and line spacing for the Write canvas. */
1342
+ writeCanvasSettings?: WriteCanvasSettings;
1295
1343
  }
1296
1344
  /**
1297
1345
  * Rich WYSIWYG markdown editor built on Tiptap (ProseMirror).
1298
1346
  * Binds to the shared EditorContext for source synchronization.
1299
1347
  */
1300
- declare function WysiwygEditor({ placeholder, className, submitOnEnter, readOnly, }: WysiwygEditorProps): react_jsx_runtime.JSX.Element;
1348
+ declare function WysiwygEditor({ placeholder, className, submitOnEnter, readOnly, writeCanvasSettings, }: WysiwygEditorProps): react_jsx_runtime.JSX.Element;
1301
1349
 
1302
1350
  interface PreviewPanelProps {
1303
1351
  /** Base path for resolving media URLs in DocPlayer */
@@ -1702,6 +1750,13 @@ interface PreviewSettings {
1702
1750
  /** Config for the docked theme designer, or null when closed. Rendered by
1703
1751
  * `<ThemeDesignerDock>` in the editor's content row. */
1704
1752
  themeDesigner: ThemeDesignerConfig | null;
1753
+ /**
1754
+ * Set when a theme write was ABORTED because the document source could not
1755
+ * be read. The write is skipped rather than merged onto an empty list (which
1756
+ * would erase the doc's other custom themes/templates), so this must be
1757
+ * shown — otherwise the save looks like a silent no-op.
1758
+ */
1759
+ themeSaveError: string | null;
1705
1760
  }
1706
1761
  /** Everything `<ThemeDesignerDock>` needs to render the designer pane. */
1707
1762
  interface ThemeDesignerConfig {
@@ -2154,20 +2209,17 @@ interface MediaBinProps {
2154
2209
  }
2155
2210
  declare function MediaBin({ mediaProvider, isDark, refreshKey, usedMediaPaths, onMediaUploaded, onMediaRemoved, onCountChange, }: MediaBinProps): react_jsx_runtime.JSX.Element;
2156
2211
 
2157
- /**
2158
- * StatusBar
2159
- *
2160
- * Bottom status bar showing document statistics and parse status.
2161
- */
2162
2212
  interface StatusBarProps {
2163
2213
  /** Additional class name */
2164
2214
  className?: string;
2215
+ /** Host-supplied status content rendered at the right edge. */
2216
+ slotRight?: ReactNode;
2165
2217
  }
2166
2218
  /**
2167
2219
  * Status bar displaying document statistics: character count, word count,
2168
- * block count, and parse/error status.
2220
+ * block count, parse errors, and optional host status.
2169
2221
  */
2170
- declare function StatusBar({ className }: StatusBarProps): react_jsx_runtime.JSX.Element;
2222
+ declare function StatusBar({ className, slotRight }: StatusBarProps): react_jsx_runtime.JSX.Element;
2171
2223
 
2172
2224
  /**
2173
2225
  * TooltipLayer
@@ -2612,6 +2664,27 @@ interface DiagramCanvasProps {
2612
2664
  }
2613
2665
  declare function DiagramCanvas({ nodes: incomingNodes, edges: incomingEdges, onCommand, showMaximize, maximized, onToggleMaximize, activeToolId: controlledToolId, onActiveToolIdChange, onSelectionChange, textChannel, }: DiagramCanvasProps): react_jsx_runtime.JSX.Element;
2614
2666
 
2667
+ /**
2668
+ * Shared position-registry remapping for the fence-widget families (ascii
2669
+ * diagram, tree, timeline, mermaid, repairable).
2670
+ *
2671
+ * Each family keeps a registry of `{ id, pos }` entries: a synthetic session
2672
+ * id per claimed code fence, plus that fence's current document position.
2673
+ * The id is what keys the widget decoration, so preserving it across a
2674
+ * transaction is what keeps the mounted React root — and all of its
2675
+ * unpersisted state (pan/zoom, height, `sourceVisible`, collapse set) —
2676
+ * alive. This module owns the one rule for deciding which old id belongs to
2677
+ * which new position; it lived as five near-identical copies before.
2678
+ */
2679
+
2680
+ /** One registered fence: a stable session id at a live document position. */
2681
+ interface FenceBlockEntry {
2682
+ /** Synthetic session id, stable across edits to one fence. */
2683
+ id: string;
2684
+ /** Document position of the codeBlock node at the current state. */
2685
+ pos: number;
2686
+ }
2687
+
2615
2688
  /**
2616
2689
  * AsciiDiagramExtension — Tiptap/ProseMirror plugin that turns code blocks
2617
2690
  * containing ASCII box-and-line diagrams into interactive diagram canvases.
@@ -2638,12 +2711,7 @@ declare function DiagramCanvas({ nodes: incomingNodes, edges: incomingEdges, onC
2638
2711
  * doesn't kick the user back to a raw code block mid-edit.
2639
2712
  */
2640
2713
 
2641
- interface AsciiDiagramBlockEntry {
2642
- /** Synthetic session id (`ascii-N`), stable across edits for one block. */
2643
- id: string;
2644
- /** Document position of the codeBlock node at the current state. */
2645
- pos: number;
2646
- }
2714
+ type AsciiDiagramBlockEntry = FenceBlockEntry;
2647
2715
  interface AsciiDiagramPluginState {
2648
2716
  entries: AsciiDiagramBlockEntry[];
2649
2717
  decorations: DecorationSet;
@@ -2734,6 +2802,12 @@ interface ApplyAsciiDiagramCommandOptions {
2734
2802
  * is re-recognized even after it's flattened. No-op (returns false) only when
2735
2803
  * BOTH the text is already identical AND the language already matches, so
2736
2804
  * history stays clean on a true no-op.
2805
+ *
2806
+ * This is the single write boundary for the diagram, tree AND timeline
2807
+ * families, so it is also where the editor's read-only authority is enforced.
2808
+ * A mounted canvas/outline outlives the render that created its controls, so
2809
+ * a host flipping the editor read-only (saving, locked, permission change)
2810
+ * must not leave a stale drag/click able to rewrite the fence.
2737
2811
  */
2738
2812
  declare function replaceAsciiFenceText(editor: Editor$1, pos: number, nextText: string, ensureLanguage?: string): boolean;
2739
2813
  /**
@@ -2765,12 +2839,7 @@ declare function applyAsciiDiagramCommand(editor: Editor$1, blockId: string, cmd
2765
2839
  * mapping so the button always resolves the right fence.
2766
2840
  */
2767
2841
 
2768
- interface RepairableBlockEntry {
2769
- /** Synthetic session id (`repair-N`), stable across edits for one block. */
2770
- id: string;
2771
- /** Document position of the codeBlock node at the current state. */
2772
- pos: number;
2773
- }
2842
+ type RepairableBlockEntry = FenceBlockEntry;
2774
2843
  interface RepairablePluginState {
2775
2844
  entries: RepairableBlockEntry[];
2776
2845
  decorations: DecorationSet;
@@ -2855,6 +2924,508 @@ declare function removeNodeOp(diagram: AsciiDiagram, nodeId: string): AsciiDiagr
2855
2924
  */
2856
2925
  declare function shouldPasteAsAsciiFence(text: string): boolean;
2857
2926
 
2927
+ /**
2928
+ * Tiptap extension for `mermaid` code fences.
2929
+ *
2930
+ * The code block always remains the document source of truth. The extension
2931
+ * only hides/shows that block and mounts a rendered Mermaid canvas after it;
2932
+ * it never replaces the fence with an editor-only node or a reduced graph
2933
+ * model. That keeps every Mermaid diagram type and directive round-trippable.
2934
+ */
2935
+
2936
+ type MermaidDiagramBlockEntry = FenceBlockEntry;
2937
+ interface MermaidDiagramPluginState {
2938
+ entries: MermaidDiagramBlockEntry[];
2939
+ decorations: DecorationSet;
2940
+ sourceVisible: ReadonlySet<string>;
2941
+ seq: number;
2942
+ }
2943
+ interface MermaidDiagramExtensionOptions {
2944
+ /** When false, leave Mermaid fences as ordinary code blocks. */
2945
+ enabled?: boolean;
2946
+ }
2947
+ declare const MERMAID_DIAGRAM_KEY: PluginKey<MermaidDiagramPluginState>;
2948
+ /** Mermaid is an explicit mode: only a `mermaid` language tag claims it. */
2949
+ declare function isMermaidDiagramNode(node: Node): boolean;
2950
+ declare function findMermaidDiagramBlockPos(editor: Editor$1, blockId: string): number | null;
2951
+ declare function isMermaidSourceVisible(editor: Editor$1, blockId: string): boolean;
2952
+ /** Toggle the editable code block without changing any document bytes. */
2953
+ declare function toggleMermaidSource(editor: Editor$1, blockId: string): void;
2954
+ declare const MermaidDiagramExtension: Extension<MermaidDiagramExtensionOptions, any>;
2955
+
2956
+ interface MermaidDiagramWidgetProps {
2957
+ editor: Editor$1;
2958
+ blockId: string;
2959
+ host?: HTMLElement | null;
2960
+ }
2961
+ declare function MermaidDiagramWidget({ editor, blockId, host }: MermaidDiagramWidgetProps): react_jsx_runtime.JSX.Element | null;
2962
+
2963
+ /** Mermaid 11.16 flowchart shape catalog used by the structured editor. */
2964
+ interface MermaidFlowchartShape {
2965
+ id: string;
2966
+ label: string;
2967
+ category: 'Basic' | 'Process' | 'Data' | 'Documents' | 'Symbols';
2968
+ aliases?: readonly string[];
2969
+ }
2970
+ /**
2971
+ * Every non-asset shape in Mermaid 11.16's expanded flowchart catalog.
2972
+ * `icon` and `image` are deliberately excluded: they require additional
2973
+ * asset-specific fields and, for icons, a host-registered icon pack.
2974
+ */
2975
+ declare const MERMAID_FLOWCHART_SHAPES: readonly [{
2976
+ readonly id: "rect";
2977
+ readonly label: "Process";
2978
+ readonly category: "Basic";
2979
+ readonly aliases: readonly ["rectangle", "proc"];
2980
+ }, {
2981
+ readonly id: "rounded";
2982
+ readonly label: "Event";
2983
+ readonly category: "Basic";
2984
+ readonly aliases: readonly ["event"];
2985
+ }, {
2986
+ readonly id: "stadium";
2987
+ readonly label: "Terminal";
2988
+ readonly category: "Basic";
2989
+ readonly aliases: readonly ["pill"];
2990
+ }, {
2991
+ readonly id: "circle";
2992
+ readonly label: "Circle";
2993
+ readonly category: "Basic";
2994
+ readonly aliases: readonly ["circ"];
2995
+ }, {
2996
+ readonly id: "dbl-circ";
2997
+ readonly label: "Double circle";
2998
+ readonly category: "Basic";
2999
+ readonly aliases: readonly ["double-circle"];
3000
+ }, {
3001
+ readonly id: "diam";
3002
+ readonly label: "Decision";
3003
+ readonly category: "Basic";
3004
+ readonly aliases: readonly ["diamond", "question"];
3005
+ }, {
3006
+ readonly id: "hex";
3007
+ readonly label: "Preparation";
3008
+ readonly category: "Basic";
3009
+ readonly aliases: readonly ["hexagon", "prepare"];
3010
+ }, {
3011
+ readonly id: "tri";
3012
+ readonly label: "Extract";
3013
+ readonly category: "Basic";
3014
+ readonly aliases: readonly ["triangle"];
3015
+ }, {
3016
+ readonly id: "odd";
3017
+ readonly label: "Odd";
3018
+ readonly category: "Basic";
3019
+ }, {
3020
+ readonly id: "notch-rect";
3021
+ readonly label: "Card";
3022
+ readonly category: "Process";
3023
+ readonly aliases: readonly ["card"];
3024
+ }, {
3025
+ readonly id: "delay";
3026
+ readonly label: "Delay";
3027
+ readonly category: "Process";
3028
+ }, {
3029
+ readonly id: "div-rect";
3030
+ readonly label: "Divided process";
3031
+ readonly category: "Process";
3032
+ readonly aliases: readonly ["div-proc"];
3033
+ }, {
3034
+ readonly id: "fork";
3035
+ readonly label: "Fork / join";
3036
+ readonly category: "Process";
3037
+ readonly aliases: readonly ["join"];
3038
+ }, {
3039
+ readonly id: "lin-rect";
3040
+ readonly label: "Lined process";
3041
+ readonly category: "Process";
3042
+ readonly aliases: readonly ["lin-proc"];
3043
+ }, {
3044
+ readonly id: "st-rect";
3045
+ readonly label: "Multi-process";
3046
+ readonly category: "Process";
3047
+ readonly aliases: readonly ["processes"];
3048
+ }, {
3049
+ readonly id: "fr-rect";
3050
+ readonly label: "Subprocess";
3051
+ readonly category: "Process";
3052
+ readonly aliases: readonly ["subprocess"];
3053
+ }, {
3054
+ readonly id: "tag-rect";
3055
+ readonly label: "Tagged process";
3056
+ readonly category: "Process";
3057
+ readonly aliases: readonly ["tag-proc"];
3058
+ }, {
3059
+ readonly id: "lean-r";
3060
+ readonly label: "Input / output";
3061
+ readonly category: "Data";
3062
+ readonly aliases: readonly ["in-out"];
3063
+ }, {
3064
+ readonly id: "lean-l";
3065
+ readonly label: "Output / input";
3066
+ readonly category: "Data";
3067
+ readonly aliases: readonly ["out-in"];
3068
+ }, {
3069
+ readonly id: "datastore";
3070
+ readonly label: "Data store";
3071
+ readonly category: "Data";
3072
+ readonly aliases: readonly ["data-store"];
3073
+ }, {
3074
+ readonly id: "cyl";
3075
+ readonly label: "Database";
3076
+ readonly category: "Data";
3077
+ readonly aliases: readonly ["database", "db"];
3078
+ }, {
3079
+ readonly id: "h-cyl";
3080
+ readonly label: "Direct access storage";
3081
+ readonly category: "Data";
3082
+ readonly aliases: readonly ["das"];
3083
+ }, {
3084
+ readonly id: "lin-cyl";
3085
+ readonly label: "Disk storage";
3086
+ readonly category: "Data";
3087
+ readonly aliases: readonly ["disk"];
3088
+ }, {
3089
+ readonly id: "bow-rect";
3090
+ readonly label: "Stored data";
3091
+ readonly category: "Data";
3092
+ readonly aliases: readonly ["stored-data"];
3093
+ }, {
3094
+ readonly id: "win-pane";
3095
+ readonly label: "Internal storage";
3096
+ readonly category: "Data";
3097
+ readonly aliases: readonly ["window-pane"];
3098
+ }, {
3099
+ readonly id: "doc";
3100
+ readonly label: "Document";
3101
+ readonly category: "Documents";
3102
+ }, {
3103
+ readonly id: "docs";
3104
+ readonly label: "Multi-document";
3105
+ readonly category: "Documents";
3106
+ readonly aliases: readonly ["documents"];
3107
+ }, {
3108
+ readonly id: "lin-doc";
3109
+ readonly label: "Lined document";
3110
+ readonly category: "Documents";
3111
+ }, {
3112
+ readonly id: "tag-doc";
3113
+ readonly label: "Tagged document";
3114
+ readonly category: "Documents";
3115
+ }, {
3116
+ readonly id: "flag";
3117
+ readonly label: "Paper tape";
3118
+ readonly category: "Documents";
3119
+ readonly aliases: readonly ["paper-tape"];
3120
+ }, {
3121
+ readonly id: "bang";
3122
+ readonly label: "Bang";
3123
+ readonly category: "Symbols";
3124
+ }, {
3125
+ readonly id: "cloud";
3126
+ readonly label: "Cloud";
3127
+ readonly category: "Symbols";
3128
+ }, {
3129
+ readonly id: "hourglass";
3130
+ readonly label: "Collate";
3131
+ readonly category: "Symbols";
3132
+ readonly aliases: readonly ["collate"];
3133
+ }, {
3134
+ readonly id: "bolt";
3135
+ readonly label: "Communication link";
3136
+ readonly category: "Symbols";
3137
+ readonly aliases: readonly ["com-link"];
3138
+ }, {
3139
+ readonly id: "brace";
3140
+ readonly label: "Comment left";
3141
+ readonly category: "Symbols";
3142
+ readonly aliases: readonly ["comment"];
3143
+ }, {
3144
+ readonly id: "brace-r";
3145
+ readonly label: "Comment right";
3146
+ readonly category: "Symbols";
3147
+ }, {
3148
+ readonly id: "braces";
3149
+ readonly label: "Comment both";
3150
+ readonly category: "Symbols";
3151
+ }, {
3152
+ readonly id: "curv-trap";
3153
+ readonly label: "Display";
3154
+ readonly category: "Symbols";
3155
+ readonly aliases: readonly ["display"];
3156
+ }, {
3157
+ readonly id: "notch-pent";
3158
+ readonly label: "Loop limit";
3159
+ readonly category: "Symbols";
3160
+ readonly aliases: readonly ["loop-limit"];
3161
+ }, {
3162
+ readonly id: "flip-tri";
3163
+ readonly label: "Manual file";
3164
+ readonly category: "Symbols";
3165
+ readonly aliases: readonly ["manual-file"];
3166
+ }, {
3167
+ readonly id: "sl-rect";
3168
+ readonly label: "Manual input";
3169
+ readonly category: "Symbols";
3170
+ readonly aliases: readonly ["manual-input"];
3171
+ }, {
3172
+ readonly id: "trap-t";
3173
+ readonly label: "Manual operation";
3174
+ readonly category: "Symbols";
3175
+ readonly aliases: readonly ["manual"];
3176
+ }, {
3177
+ readonly id: "trap-b";
3178
+ readonly label: "Priority action";
3179
+ readonly category: "Symbols";
3180
+ readonly aliases: readonly ["priority"];
3181
+ }, {
3182
+ readonly id: "f-circ";
3183
+ readonly label: "Junction";
3184
+ readonly category: "Symbols";
3185
+ readonly aliases: readonly ["junction"];
3186
+ }, {
3187
+ readonly id: "sm-circ";
3188
+ readonly label: "Start";
3189
+ readonly category: "Symbols";
3190
+ readonly aliases: readonly ["start"];
3191
+ }, {
3192
+ readonly id: "fr-circ";
3193
+ readonly label: "Stop";
3194
+ readonly category: "Symbols";
3195
+ readonly aliases: readonly ["stop"];
3196
+ }, {
3197
+ readonly id: "cross-circ";
3198
+ readonly label: "Summary";
3199
+ readonly category: "Symbols";
3200
+ readonly aliases: readonly ["summary"];
3201
+ }, {
3202
+ readonly id: "text";
3203
+ readonly label: "Text block";
3204
+ readonly category: "Symbols";
3205
+ }];
3206
+ type MermaidFlowchartShapeId = (typeof MERMAID_FLOWCHART_SHAPES)[number]['id'];
3207
+ declare function isMermaidFlowchartShapeId(value: string): value is MermaidFlowchartShapeId;
3208
+ /** Normalize legacy parser names and documented aliases to the general-syntax id. */
3209
+ declare function normalizeMermaidFlowchartShape(value: string | null | undefined): MermaidFlowchartShapeId;
3210
+
3211
+ type MermaidFlowchartDirection = 'TB' | 'TD' | 'BT' | 'RL' | 'LR';
3212
+ type MermaidEditableDiagramKind = 'flowchart' | 'sequence' | 'state' | 'class' | 'er' | 'mindmap' | 'c4' | 'architecture' | 'gantt' | 'timeline' | 'journey' | 'kanban' | 'git' | 'pie' | 'quadrant' | 'sankey' | 'xy' | 'requirement';
3213
+ interface MermaidEditCapabilities {
3214
+ readonly addNode: boolean;
3215
+ readonly renameNode: boolean;
3216
+ readonly duplicateNode: boolean;
3217
+ readonly deleteNode: boolean;
3218
+ readonly connect: boolean;
3219
+ readonly disconnect: boolean;
3220
+ readonly edgeLabel: boolean;
3221
+ readonly shape: boolean;
3222
+ readonly direction: boolean;
3223
+ readonly properties: boolean;
3224
+ /** Explains why Connect is intentionally absent for ordered/data grammars. */
3225
+ readonly connectionHint?: string;
3226
+ }
3227
+ interface MermaidDiagramProperty {
3228
+ readonly id: string;
3229
+ readonly label: string;
3230
+ readonly value: string | boolean;
3231
+ readonly type?: 'text' | 'boolean' | 'select';
3232
+ readonly options?: readonly {
3233
+ readonly value: string;
3234
+ readonly label: string;
3235
+ }[];
3236
+ readonly placeholder?: string;
3237
+ }
3238
+ interface MermaidEditableNode {
3239
+ id: string;
3240
+ domId: string;
3241
+ label: string;
3242
+ shape: MermaidFlowchartShapeId;
3243
+ classes: readonly string[];
3244
+ /** Source adapter metadata. Never serialized into the Mermaid SVG. */
3245
+ origin?: Readonly<Record<string, string | number | boolean>>;
3246
+ }
3247
+ interface MermaidEditableEdge {
3248
+ id: string;
3249
+ source: string;
3250
+ target: string;
3251
+ label: string;
3252
+ type?: string;
3253
+ stroke?: string;
3254
+ userDefinedId?: boolean;
3255
+ /** Source adapter metadata. Never serialized into the Mermaid SVG. */
3256
+ origin?: Readonly<Record<string, string | number | boolean>>;
3257
+ }
3258
+ interface MermaidFlowchartModel {
3259
+ kind: 'flowchart';
3260
+ direction: MermaidFlowchartDirection;
3261
+ nodes: readonly MermaidEditableNode[];
3262
+ edges: readonly MermaidEditableEdge[];
3263
+ }
3264
+ interface MermaidSourceEditableModel {
3265
+ kind: Exclude<MermaidEditableDiagramKind, 'flowchart'>;
3266
+ nodes: readonly MermaidEditableNode[];
3267
+ edges: readonly MermaidEditableEdge[];
3268
+ capabilities: MermaidEditCapabilities;
3269
+ properties: readonly MermaidDiagramProperty[];
3270
+ nodeNoun: string;
3271
+ edgeNoun: string;
3272
+ direction?: MermaidFlowchartDirection;
3273
+ }
3274
+ /** Structured editing is additive to full Mermaid rendering, never required by it. */
3275
+ type MermaidEditableModel = MermaidFlowchartModel | MermaidSourceEditableModel;
3276
+ declare function mermaidEditCapabilities(model: MermaidEditableModel): MermaidEditCapabilities;
3277
+ declare function mermaidDiagramProperties(model: MermaidEditableModel): readonly MermaidDiagramProperty[];
3278
+
3279
+ type MermaidNodeCanvasAction = 'rename' | 'shape' | 'duplicate' | 'connect' | 'delete';
3280
+ interface MermaidDiagramCanvasProps {
3281
+ source: string;
3282
+ maximized?: boolean;
3283
+ onToggleMaximize?: () => void;
3284
+ selectedNodeId?: string | null;
3285
+ selectedEdgeId?: string | null;
3286
+ renamingNodeId?: string | null;
3287
+ renamingEdgeId?: string | null;
3288
+ connectSourceId?: string | null;
3289
+ connecting?: boolean;
3290
+ onModelChange?: (model: MermaidEditableModel | null) => void;
3291
+ onSelectNode?: (id: string | null) => void;
3292
+ onSelectEdge?: (id: string | null) => void;
3293
+ onNodeAction?: (action: MermaidNodeCanvasAction, id: string) => void;
3294
+ onEditEdgeLabel?: (id: string) => void;
3295
+ onCommitRename?: (id: string, label: string) => boolean;
3296
+ onCommitEdgeLabel?: (id: string, label: string) => boolean;
3297
+ onCancelRename?: () => void;
3298
+ onCancelEdgeLabel?: () => void;
3299
+ onDisconnectEdge?: (id: string) => void;
3300
+ }
3301
+ declare function MermaidDiagramCanvas({ source, maximized, onToggleMaximize, selectedNodeId, selectedEdgeId, renamingNodeId, renamingEdgeId, connectSourceId, connecting, onModelChange, onSelectNode, onSelectEdge, onNodeAction, onEditEdgeLabel, onCommitRename, onCommitEdgeLabel, onCancelRename, onCancelEdgeLabel, onDisconnectEdge, }: MermaidDiagramCanvasProps): react_jsx_runtime.JSX.Element;
3302
+
3303
+ /** Live source view for one registered Mermaid code fence. */
3304
+
3305
+ interface MermaidDiagramData {
3306
+ /** Mermaid source exactly as stored inside the code block. */
3307
+ source: string;
3308
+ }
3309
+ declare function useMermaidDiagramData(editor: Editor$1, blockId: string): MermaidDiagramData | null;
3310
+
3311
+ /** Browser-only, lazy Mermaid renderer shared by all complex-diagram widgets. */
3312
+
3313
+ interface MermaidRenderResult extends Pick<RenderResult, 'svg' | 'diagramType'> {
3314
+ /** Present for flowchart/graph sources that Mermaid exposes as editable nodes and edges. */
3315
+ model?: MermaidEditableModel;
3316
+ }
3317
+ /**
3318
+ * Render through Mermaid's public API so all diagram types supported by the
3319
+ * pinned Mermaid release share the same path. The caller owns insertion of
3320
+ * the returned SVG; interactive `bindFunctions` are intentionally not run in
3321
+ * the editor, preventing authored links/callbacks from hijacking editing.
3322
+ */
3323
+ declare function renderMermaidDiagram(id: string, source: string, container?: Element): Promise<MermaidRenderResult>;
3324
+ /** Inspect the subset Mermaid exposes as structured flowchart nodes/edges. */
3325
+ declare function inspectMermaidSource(source: string): Promise<MermaidEditableModel | null>;
3326
+ declare function mermaidErrorMessage(error: unknown): string;
3327
+
3328
+ interface MermaidShapePaletteProps {
3329
+ selected?: MermaidFlowchartShapeId;
3330
+ onPick: (shape: MermaidFlowchartShapeId) => void;
3331
+ onClose: () => void;
3332
+ }
3333
+ declare function MermaidShapePalette({ selected, onPick, onClose }: MermaidShapePaletteProps): react_jsx_runtime.JSX.Element;
3334
+
3335
+ /** Curated starter gallery for the diagram grammars supported by Mermaid 11.16. */
3336
+ type MermaidDiagramCategory = 'Structure' | 'Planning' | 'Data';
3337
+ type MermaidDiagramPreview = 'flowchart' | 'sequence' | 'state' | 'class' | 'er' | 'mindmap' | 'c4' | 'architecture' | 'gantt' | 'timeline' | 'journey' | 'kanban' | 'git' | 'pie' | 'quadrant' | 'sankey' | 'xy' | 'requirement';
3338
+ interface MermaidDiagramType {
3339
+ readonly id: string;
3340
+ readonly label: string;
3341
+ readonly description: string;
3342
+ readonly category: MermaidDiagramCategory;
3343
+ readonly preview: MermaidDiagramPreview;
3344
+ readonly starter: string;
3345
+ /** Mermaid marks this grammar as beta or otherwise experimental. */
3346
+ readonly badge?: 'Beta' | 'Experimental';
3347
+ }
3348
+ declare const MERMAID_DIAGRAM_TYPES: readonly MermaidDiagramType[];
3349
+ declare const DEFAULT_MERMAID_DIAGRAM_TYPE: MermaidDiagramType;
3350
+ declare function mermaidDiagramMarkdown(source: string): string;
3351
+
3352
+ /** Small authored SVG cues; these avoid spinning up Mermaid for every gallery tile. */
3353
+ declare function MermaidDiagramTypeThumbnail({ preview }: {
3354
+ preview: MermaidDiagramPreview;
3355
+ }): react_jsx_runtime.JSX.Element;
3356
+
3357
+ /**
3358
+ * Tiptap extension for ordinary explicit-language code fences.
3359
+ *
3360
+ * The ProseMirror code block remains authoritative. This plugin hides it and
3361
+ * mounts a Monaco editor whose edits rewrite only the node's text content, so
3362
+ * fence language and source round-trip through Markdown without a parallel model.
3363
+ */
3364
+
3365
+ interface CodeSnippetBlockEntry {
3366
+ /** Synthetic session id, stable while this code block remains in the doc. */
3367
+ id: string;
3368
+ /** Current ProseMirror position of the `codeBlock`. */
3369
+ pos: number;
3370
+ }
3371
+ interface CodeSnippetPluginState {
3372
+ entries: CodeSnippetBlockEntry[];
3373
+ decorations: DecorationSet;
3374
+ seq: number;
3375
+ }
3376
+ interface CodeSnippetExtensionOptions {
3377
+ /** When false, leave all ordinary language-tagged fences as code blocks. */
3378
+ enabled?: boolean;
3379
+ }
3380
+ declare const CODE_SNIPPET_KEY: PluginKey<CodeSnippetPluginState>;
3381
+ declare function isCodeSnippetNode(node: Node): boolean;
3382
+ declare function findCodeSnippetBlockPos(editor: Editor$1, blockId: string): number | null;
3383
+ declare const CodeSnippetExtension: Extension<CodeSnippetExtensionOptions, any>;
3384
+
3385
+ interface CodeSnippetWidgetProps {
3386
+ editor: Editor$1;
3387
+ blockId: string;
3388
+ host?: HTMLElement | null;
3389
+ }
3390
+ declare function CodeSnippetWidget({ editor, blockId, host }: CodeSnippetWidgetProps): react_jsx_runtime.JSX.Element | null;
3391
+
3392
+ /** Lossless edits for language-tagged code fences. */
3393
+
3394
+ declare function replaceCodeSnippetText(editor: Editor$1, blockId: string, nextText: string): boolean;
3395
+
3396
+ /** Live source/language view for one registered code snippet fence. */
3397
+
3398
+ interface CodeSnippetData {
3399
+ /** Fence language exactly as stored in the ProseMirror node. */
3400
+ fenceLanguage: string;
3401
+ label: string;
3402
+ monacoLanguage: string;
3403
+ /** Source exactly as stored inside the code block. */
3404
+ source: string;
3405
+ }
3406
+ declare function useCodeSnippetData(editor: Editor$1, blockId: string): CodeSnippetData | null;
3407
+
3408
+ /** Languages offered by the Insert Code Snippet menu and understood by Monaco. */
3409
+ interface CodeSnippetLanguage {
3410
+ /** Language written after the opening Markdown fence. */
3411
+ readonly fenceLanguage: string;
3412
+ /** Human-readable picker/header label. */
3413
+ readonly label: string;
3414
+ /** Monaco language id used for syntax highlighting and language services. */
3415
+ readonly monacoLanguage: string;
3416
+ /** Small, immediately editable body inserted for a new snippet. */
3417
+ readonly starter: string;
3418
+ }
3419
+ declare const CODE_SNIPPET_LANGUAGES: readonly CodeSnippetLanguage[];
3420
+ /** The first token is the syntax id; any remaining fence metadata stays untouched. */
3421
+ declare function codeSnippetFenceLanguageToken(language: string | null | undefined): string;
3422
+ /** True for explicit language-tagged fences not owned by a richer Squisq block editor. */
3423
+ declare function isCodeSnippetFenceLanguage(language: string | null | undefined): boolean;
3424
+ declare function monacoLanguageForFence(language: string | null | undefined): string;
3425
+ declare function codeSnippetLanguageLabel(language: string | null | undefined): string;
3426
+ /** Markdown insertion form. The caller decides whether to wrap selected text or use a starter. */
3427
+ declare function codeSnippetMarkdown(language: string, source: string): string;
3428
+
2858
3429
  /**
2859
3430
  * TreeViewExtension — Tiptap/ProseMirror plugin that turns code blocks
2860
3431
  * containing ASCII file-tree / outline art into interactive outline editors.
@@ -2869,12 +3440,7 @@ declare function shouldPasteAsAsciiFence(text: string): boolean;
2869
3440
  * extension claims any given fence.
2870
3441
  */
2871
3442
 
2872
- interface TreeBlockEntry {
2873
- /** Synthetic session id (`tree-N`), stable across edits for one block. */
2874
- id: string;
2875
- /** Document position of the codeBlock node at the current state. */
2876
- pos: number;
2877
- }
3443
+ type TreeBlockEntry = FenceBlockEntry;
2878
3444
  interface TreeViewPluginState {
2879
3445
  entries: TreeBlockEntry[];
2880
3446
  decorations: DecorationSet;
@@ -2998,12 +3564,7 @@ declare function shouldPasteAsTreeFence(text: string): boolean;
2998
3564
  * truth. Every semantic edit is rendered back through the core codec.
2999
3565
  */
3000
3566
 
3001
- interface TimelineBlockEntry {
3002
- /** Synthetic session id, stable across edits to one fence. */
3003
- id: string;
3004
- /** Current document position of the codeBlock node. */
3005
- pos: number;
3006
- }
3567
+ type TimelineBlockEntry = FenceBlockEntry;
3007
3568
  interface TimelineViewPluginState {
3008
3569
  entries: TimelineBlockEntry[];
3009
3570
  decorations: DecorationSet;
@@ -3500,10 +4061,17 @@ interface ScreenStreamOptions {
3500
4061
  /**
3501
4062
  * Handle returned by {@link requestScreenStream}. The `stream` is what
3502
4063
  * gets handed to `MediaRecorder`; the `dispose()` callback shuts down
3503
- * any auxiliary resources (e.g. the mic-mix `AudioContext`). Callers
3504
- * must also stop the stream's tracks via `stream.getTracks().forEach(t
3505
- * => t.stop())` when done — `dispose()` cleans up everything that isn't
3506
- * the stream itself.
4064
+ * any auxiliary resources (the mic-mix `AudioContext` plus the raw
4065
+ * source tracks feeding it). Callers must also stop the stream's tracks
4066
+ * via `stream.getTracks().forEach(t => t.stop())` when done —
4067
+ * `dispose()` cleans up everything that isn't the stream itself.
4068
+ *
4069
+ * IMPORTANT for callers: when the microphone is mixed in, the raw
4070
+ * system-audio / mic tracks are deliberately NOT members of `stream`
4071
+ * (only the single mixed output track is). So stopping `stream`'s tracks
4072
+ * alone leaves those captures live — `dispose()` is what releases them,
4073
+ * and it must always be called alongside the stream teardown or the
4074
+ * screen-share indicator stays lit.
3507
4075
  */
3508
4076
  interface ScreenStreamHandle {
3509
4077
  stream: MediaStream;
@@ -3727,22 +4295,47 @@ declare function buildNarrationSavePlan(args: NarrationSavePlanArgs): NarrationS
3727
4295
  interface ExecuteNarrationSaveDeps {
3728
4296
  mediaProvider: MediaProvider;
3729
4297
  container: ContentContainer | null;
3730
- markdownSource: string;
4298
+ /**
4299
+ * Read the LIVE markdown source at write time. Deliberately a getter, not
4300
+ * a snapshot: the media writes above are async, and a value captured before
4301
+ * them would compose the preamble from a stale source and clobber anything
4302
+ * that landed in between.
4303
+ */
4304
+ getMarkdownSource: () => string;
3731
4305
  setMarkdownSource: (next: string) => void;
3732
4306
  bumpMediaRevision: () => void;
3733
4307
  }
4308
+ /**
4309
+ * What a save attempt has already committed. Passed back in on a retry so a
4310
+ * second attempt REUSES the audio it already wrote instead of writing another
4311
+ * timestamped file (and orphaning the first).
4312
+ *
4313
+ * Mutated in place by {@link executeNarrationSave} as each step lands, which
4314
+ * is what makes the record survive the throw that aborted the attempt.
4315
+ */
4316
+ interface NarrationSaveProgress {
4317
+ audioPath?: string;
4318
+ cameraPath?: string | null;
4319
+ sidecarPath?: string;
4320
+ }
3734
4321
  interface NarrationSaveResult {
3735
4322
  audioPath: string;
3736
4323
  cameraPath: string | null;
3737
4324
  sidecarPath: string;
3738
4325
  }
3739
- /** Execute a save plan: media writes, sidecar, then the single markdown write. */
4326
+ /**
4327
+ * Execute a save plan: media writes, sidecar, then the single markdown write.
4328
+ *
4329
+ * Every step is idempotent against `progress`. A failed attempt leaves its
4330
+ * completed steps recorded there, so retrying with the SAME progress object
4331
+ * resumes rather than restarts — no duplicate audio, no second sidecar.
4332
+ */
3740
4333
  declare function executeNarrationSave(plan: NarrationSavePlan, take: {
3741
4334
  audioBlob: Blob;
3742
4335
  audioMime: string;
3743
4336
  cameraBlob: Blob | null;
3744
4337
  cameraMime: string | null;
3745
- }, deps: ExecuteNarrationSaveDeps): Promise<NarrationSaveResult>;
4338
+ }, deps: ExecuteNarrationSaveDeps, progress?: NarrationSaveProgress): Promise<NarrationSaveResult>;
3746
4339
 
3747
4340
  /**
3748
4341
  * Pure markdown edit: insert (or replace) the narration reference at the
@@ -3751,12 +4344,40 @@ declare function executeNarrationSave(plan: NarrationSavePlan, take: {
3751
4344
  * The narration take is referenced by a preamble media annotation —
3752
4345
  * `{[audio src=audio/narration-….webm anchor=document]}` — the canonical
3753
4346
  * authored form `markdownToDoc` lifts into `doc.documentMedia`. A prior
3754
- * teleprompter take's line (matched by the `audio/narration-` prefix +
3755
- * `anchor=document`) is replaced, so retakes swap the reference instead
3756
- * of stacking narrations. The optional camera companion rides on the
3757
- * next line as an inline `<video>` (deliberately NOT doc-anchored:
4347
+ * teleprompter take's line is replaced, so retakes swap the reference
4348
+ * instead of stacking narrations. The optional camera companion rides on
4349
+ * the next line as an inline `<video>` (deliberately NOT doc-anchored:
3758
4350
  * document-anchored video renders full-bleed behind every block and is
3759
4351
  * excluded from export audio — not a talking head).
4352
+ *
4353
+ * ## Matching a prior take by ROLE, not by path
4354
+ *
4355
+ * These patterns deliberately do not encode a `audio/narration-` /
4356
+ * `video/narration-cam-` path prefix. `narrationSave` treats the path
4357
+ * RETURNED by `MediaProvider.addMedia` as authoritative because providers
4358
+ * may rename or relocate the file, so a path-shaped matcher misses the
4359
+ * very annotation it wrote and the next retake stacks a second one — two
4360
+ * document-anchored audio tracks playing at once.
4361
+ *
4362
+ * Instead we match the annotation's ROLE, scoped to POSITION:
4363
+ *
4364
+ * - Narration: a `{[audio … anchor=document …]}` line. Document-anchored
4365
+ * audio is a single-occupancy slot (it becomes `doc.documentMedia` and
4366
+ * is what `applyNarrationTiming` / `resolveAudioMapping` treat as *the*
4367
+ * narration), so replacing whatever occupies it is exactly right —
4368
+ * two of them is never a valid document.
4369
+ * - Camera: a `<video …></video>` line sitting immediately after that
4370
+ * narration line (blank lines allowed between). Adjacency to the
4371
+ * preamble is the role marker here — an inline `<video>` carries no
4372
+ * anchor of its own, and this is the exact shape `cameraVideoLine`
4373
+ * emits as part of the same insert.
4374
+ *
4375
+ * Both matchers are confined to the PREAMBLE REGION — the blank-padded run
4376
+ * at the insertion point (top of file, or just after the frontmatter fence).
4377
+ * Role alone is not enough: matching document-wide would let a retake
4378
+ * silently replace a background-music annotation the user wrote further
4379
+ * down, or consume whichever `<video>` of theirs happened to follow it.
4380
+ * Content outside the region we wrote is never touched.
3760
4381
  */
3761
4382
  declare function narrationAnnotationLine(audioPath: string): string;
3762
4383
  declare function cameraVideoLine(cameraPath: string): string;
@@ -4162,6 +4783,8 @@ interface UseImageEditorOptions {
4162
4783
  * `assets/source.<ext>` so the doc is portable.
4163
4784
  */
4164
4785
  initialSrc?: string;
4786
+ /** Policy and byte/time limits for fetching `initialSrc`. */
4787
+ resourcePolicy?: ResourcePolicy;
4165
4788
  /** Override the state filename. Defaults to `state.json`. */
4166
4789
  stateFilename?: string;
4167
4790
  /** Enable version history. Default: `false`. */
@@ -4195,4 +4818,4 @@ interface UseImageEditorReturn {
4195
4818
  }
4196
4819
  declare function useImageEditor(options: UseImageEditorOptions): UseImageEditorReturn;
4197
4820
 
4198
- export { ALL_PICKER_ENTRIES, type AddTimelineEventOptions, type AddTimelineEventResult, type ApplyAsciiDiagramCommandOptions, type AsciiDiagramBlockEntry, AsciiDiagramExtension, type AsciiDiagramExtensionOptions, type AsciiDiagramPluginState, type AsciiDiagramView, AsciiDiagramWidget, BlockCardView, type BlockCardViewProps, type BlockNavigator, BlockPropertiesPopover, type BlockPropertiesPopoverProps, type BlockRange, type BlockSlice, type BlockTagVisibility, type CameraStreamOptions, type CanvasRect, type CanvasSink, type CaptureKind, type CodeContext, type CodeContextSection, CodeContextZones, type CustomTemplateContextValue, CustomTemplateProvider, type CustomTemplateProviderProps, type CustomThemeContextValue, CustomThemeProvider, type CustomThemeProviderProps, DEFAULT_TELEPROMPTER_PREFS, DiagramCanvas, type DiagramCommand, type DiagramData, type DiagramEdge, type DiagramNode, type DirectionModel, type DocCustomTemplates, type DocCustomThemes, type DocumentLinkCandidate, type DocumentLinkProvider, DocumentSettingsDialog, type DocumentSettingsDialogProps, type DragContentType, type DropTarget, DropZoneOverlay, type DropZoneOverlayProps, EMPTY_TRANSITION, EYE_LINE_FRACTION, type EditorActions, type EditorColorScheme, type EditorContextValue, type EditorMode, EditorProvider, type EditorProviderProps, EditorShell, type EditorShellProps, type EditorState, type EditorView, EmojiPicker, type EmojiPickerProps, type FileCategory, type FileKind, type FloatOpenOptions, type FloatTier, type FloatingWindowHandle, type FloatingWindowManager, type FolderEntry, FolderView, type FolderViewProps, type HeadingTransitionAttrs, HeadingWithTemplate, type ImageDisplayMode, ImageEditor, type ImageEditorAction, type ImageEditorProps, type ImageEditorState, type ImageEditorTool, ImageViewer, type ImageViewerProps, ImportThemeSection, type ImportThemeSectionProps, type ImportedThemeResult, InlinePreviewGutter, type InlinePreviewGutterProps, JsonEditor, type JsonEditorProps, type LayoutMode, MediaBin, type MediaBinProps, type MediaClipPatch, type MentionCandidate, type MentionProvider, type MicAnalysisHandle, type MicAnalysisStatus, type MonacoWorkerConstructor, type MonacoWorkerConstructors, type NarrationRecorderController, type NarrationRecorderState, type NarrationSavePlan, type NarrationSaveResult, type NarrationTake, OutlinePanel, type OutlinePanelProps, PCM_WORKLET_NAME, PCM_WORKLET_SOURCE, PICKER_CATEGORIES, type PickerCategory, type PickerEntry, PlainHtmlPreview, type PlainHtmlPreviewProps, PreviewFormatSwitch, PreviewModeMenu, PreviewModeSwitch, PreviewPanel, type PreviewPanelProps, type PreviewSettings, PreviewSettingsProvider, PreviewToolbarControls, type PrompterTransport, REPAIRABLE_KEY, RawEditor, type RawEditorProps, type RecordedBookmark, RecorderButton, type RecorderButtonProps, type RecorderColorScheme, RecorderModal, type RecorderModalProps, RecorderPanel, type RecorderPanelProps, type RecorderSaveResult, type RecorderSource, type RecorderState, type RepairableBlockEntry, RepairableDiagramExtension, type RepairableDiagramExtensionOptions, type RepairablePluginState, type ResolvedFormat, type ScreenStreamHandle, type ScreenStreamOptions, StatusBar, type StatusBarProps, TELEPROMPTER_CSS, TIMELINE_VIEW_KEY, TRANSITION_ENTRIES, TRANSITION_GROUPS, type TeleprompterController, TeleprompterControls, type TeleprompterControlsProps, type TeleprompterPrefs, type TeleprompterRecordingDeps, TeleprompterSurface, type TeleprompterSurfaceProps, TeleprompterView, type TeleprompterViewProps, TemplatePicker, ThemeCustomizerPanel, type ThemeCustomizerPanelProps, type ThemeInheritance, ThemePicker, type ThemePickerProps, type ThemeSaveExtras, type TimelineBlockEntry, type TimelineCommand, type TimelineCommandResult, TimelineEditorWidget, type TimelineEditorWidgetProps, type TimelineEventPatch, TimelineTrack, type TimelineTrackProps, type TimelineViewData, TimelineViewExtension, type TimelineViewExtensionOptions, type TimelineViewPluginState, type TimingJson, type TokenLineMap, Toolbar, type ToolbarProps, TooltipLayer, type TransitionCatalogEntry, type TransitionFields, type TransitionGroup, TransitionPicker, type TransitionPickerProps, type TreeBlockEntry, type TreeCommand, TreeOutlineWidget, type TreeViewData, TreeViewExtension, type TreeViewExtensionOptions, type TreeViewPluginState, type UseBlockNavigatorOptions, type UseFileDropOptions, type UseFileDropResult, type UseImageEditorOptions, type UseImageEditorReturn, type UseMediaRecorderOptions, type UseMediaRecorderResult, type UseMonacoLoaderResult, VersionHistoryPanel, ViewMenuPanel, type ViewPreferences, ViewSwitcher, type ViewSwitcherProps, WysiwygEditor, type WysiwygEditorProps, addEdgeOp, addItemOp, addNodeOp, addTimelineEventOp, applyAsciiDiagramCommand, applyRepairCommand, applyTimelineCommand, applyTreeCommand, asciiDiagramToCanvas, buildFilename, buildNarrationSavePlan, buildPreviewDoc, buildTimingJson, cameraVideoLine, classifyFile, configureMonacoWorkers, createFloatingWindowManager, detectFloatTiers, detectLanguageFromFileName, draftPatchFromImportedTheme, encodeTimingJson, ensureTeleprompterStyles, executeNarrationSave, findAsciiDiagramBlockPos, findRepairableBlockPos, findTimelineBlockPos, findTransitionEntry, findTreeBlockPos, formatSeconds, getBlockSlices, getCaptureKind, getTimelineForNode, imageEditorReducer, indentItemOp, initialImageEditorState, insertNarrationPreamble, isAsciiSourceVisible, isRepairableFence, isTimelineSourceSafeForSemanticEdit, lineToOffset, markdownToTiptap, measureTokenLines, moveItemDownOp, moveItemUpOp, moveNodeOp, narrationAnnotationLine, nextTimelineEventId, offsetToLine, outdentItemOp, parseTimelineForNode, partitionFiles, processMediaFiles, processTextFile, processTextFiles, prompterVarsFromTheme, readBlockAttrsParams, readBlockAttrsTransition, readBlockAttrsValue, readHeadingLineTransition, registerPcmWorklet, removeEdgeOp, removeItemOp, removeNodeOp, removeTimelineEventOp, renameItemOp, renameNodeOp, replaceAsciiFenceText, replaceAsciiFenceText as replaceTreeFenceText, requestCameraStream, requestMicStream, requestScreenStream, resizeNodeOp, resolveFileKind, resolveFormat, sanitizeAsciiLabel, sanitizeTimelineText, sanitizeTreeLabel, searchPickerEntries, setBlockAttrsValue, setBlockDurationInSource, setHeadingAttrsTransition, setHeadingLineTransition, setMediaClipInSource, shouldPasteAsAsciiFence, shouldPasteAsTimelineFence, shouldPasteAsTreeFence, sliceIndexAtOffset, spliceBlock, stepScroll, summarizeBlockProps, supportsDisplayMedia, supportsMediaRecorder, supportsUserMedia, targetOffsetFor, templateLabel, timingPathFor, tiptapToMarkdown, toggleAsciiSource, toggleDirOp, transitionLabel, translateDiagramOp, updateTimelineEventOp, useAsciiDiagramData, useBlockNavigator, useCustomTemplates, useCustomThemes, useDocCustomTemplates, useDocCustomThemes, useEditorContext, useFileDrop, useFloatingWindow, useImageEditor, useMediaRecorder, useMicAnalysis, useMonacoLoader, useNarrationRecorder, usePreviewSettings, useStreamPreview, useTeleprompter, useTimelineData, useTreeViewData, vadConfigForSensitivity };
4821
+ export { ALL_PICKER_ENTRIES, type AddTimelineEventOptions, type AddTimelineEventResult, type ApplyAsciiDiagramCommandOptions, type AsciiDiagramBlockEntry, AsciiDiagramExtension, type AsciiDiagramExtensionOptions, type AsciiDiagramPluginState, type AsciiDiagramView, AsciiDiagramWidget, BlockCardView, type BlockCardViewProps, type BlockNavigator, BlockPropertiesPopover, type BlockPropertiesPopoverProps, type BlockRange, type BlockSlice, type BlockTagVisibility, CODE_SNIPPET_KEY, CODE_SNIPPET_LANGUAGES, type CameraStreamOptions, type CanvasRect, type CanvasSink, type CaptureKind, type CodeContext, type CodeContextSection, CodeContextZones, type CodeSnippetBlockEntry, type CodeSnippetData, CodeSnippetExtension, type CodeSnippetExtensionOptions, type CodeSnippetLanguage, type CodeSnippetPluginState, CodeSnippetWidget, type CodeSnippetWidgetProps, type CustomTemplateContextValue, CustomTemplateProvider, type CustomTemplateProviderProps, type CustomThemeContextValue, CustomThemeProvider, type CustomThemeProviderProps, DEFAULT_MERMAID_DIAGRAM_TYPE, DEFAULT_TELEPROMPTER_PREFS, DiagramCanvas, type DiagramCommand, type DiagramData, type DiagramEdge, type DiagramNode, type DirectionModel, type DocCustomTemplates, type DocCustomThemes, type DocumentLinkCandidate, type DocumentLinkProvider, DocumentSettingsDialog, type DocumentSettingsDialogProps, type DragContentType, type DropTarget, DropZoneOverlay, type DropZoneOverlayProps, EMPTY_TRANSITION, EYE_LINE_FRACTION, type EditorActions, type EditorColorScheme, type EditorContextValue, type EditorMode, EditorProvider, type EditorProviderProps, EditorShell, type EditorShellProps, type EditorState, type EditorView, EmojiPicker, type EmojiPickerProps, type FileCategory, type FileKind, type FloatOpenOptions, type FloatTier, type FloatingWindowHandle, type FloatingWindowManager, type FolderEntry, FolderView, type FolderViewProps, type HeadingTransitionAttrs, HeadingWithTemplate, type ImageDisplayMode, ImageEditor, type ImageEditorAction, type ImageEditorProps, type ImageEditorState, type ImageEditorTool, ImageViewer, type ImageViewerProps, ImportThemeSection, type ImportThemeSectionProps, type ImportedThemeResult, InlinePreviewGutter, type InlinePreviewGutterProps, JsonEditor, type JsonEditorProps, type LayoutMode, MERMAID_DIAGRAM_KEY, MERMAID_DIAGRAM_TYPES, MERMAID_FLOWCHART_SHAPES, MediaBin, type MediaBinProps, type MediaClipPatch, type MentionCandidate, type MentionProvider, type MermaidDiagramBlockEntry, MermaidDiagramCanvas, type MermaidDiagramCanvasProps, type MermaidDiagramCategory, type MermaidDiagramData, MermaidDiagramExtension, type MermaidDiagramExtensionOptions, type MermaidDiagramPluginState, type MermaidDiagramPreview, type MermaidDiagramProperty, type MermaidDiagramType, MermaidDiagramTypeThumbnail, MermaidDiagramWidget, type MermaidDiagramWidgetProps, type MermaidEditCapabilities, type MermaidEditableDiagramKind, type MermaidEditableEdge, type MermaidEditableModel, type MermaidEditableNode, type MermaidFlowchartDirection, type MermaidFlowchartModel, type MermaidFlowchartShape, type MermaidFlowchartShapeId, type MermaidNodeCanvasAction, type MermaidRenderResult, MermaidShapePalette, type MermaidShapePaletteProps, type MermaidSourceEditableModel, type MicAnalysisHandle, type MicAnalysisStatus, type MonacoWorkerConstructor, type MonacoWorkerConstructors, type NarrationRecorderController, type NarrationRecorderState, type NarrationSavePlan, type NarrationSaveResult, type NarrationTake, OutlinePanel, type OutlinePanelProps, PCM_WORKLET_NAME, PCM_WORKLET_SOURCE, PICKER_CATEGORIES, type PickerCategory, type PickerEntry, PlainHtmlPreview, type PlainHtmlPreviewProps, PreviewFormatSwitch, PreviewModeMenu, PreviewModeSwitch, PreviewPanel, type PreviewPanelProps, type PreviewSettings, PreviewSettingsProvider, PreviewToolbarControls, type PrompterTransport, REPAIRABLE_KEY, RawEditor, type RawEditorProps, type RecordedBookmark, RecorderButton, type RecorderButtonProps, type RecorderColorScheme, RecorderModal, type RecorderModalProps, RecorderPanel, type RecorderPanelProps, type RecorderSaveResult, type RecorderSource, type RecorderState, type RepairableBlockEntry, RepairableDiagramExtension, type RepairableDiagramExtensionOptions, type RepairablePluginState, type ResolvedFormat, type ScreenStreamHandle, type ScreenStreamOptions, StatusBar, type StatusBarProps, TELEPROMPTER_CSS, TIMELINE_VIEW_KEY, TRANSITION_ENTRIES, TRANSITION_GROUPS, type TeleprompterController, TeleprompterControls, type TeleprompterControlsProps, type TeleprompterPrefs, type TeleprompterRecordingDeps, TeleprompterSurface, type TeleprompterSurfaceProps, TeleprompterView, type TeleprompterViewProps, TemplatePicker, ThemeCustomizerPanel, type ThemeCustomizerPanelProps, type ThemeInheritance, ThemePicker, type ThemePickerProps, type ThemeSaveExtras, type TimelineBlockEntry, type TimelineCommand, type TimelineCommandResult, TimelineEditorWidget, type TimelineEditorWidgetProps, type TimelineEventPatch, TimelineTrack, type TimelineTrackProps, type TimelineViewData, TimelineViewExtension, type TimelineViewExtensionOptions, type TimelineViewPluginState, type TimingJson, type TokenLineMap, Toolbar, type ToolbarProps, TooltipLayer, type TransitionCatalogEntry, type TransitionFields, type TransitionGroup, TransitionPicker, type TransitionPickerProps, type TreeBlockEntry, type TreeCommand, TreeOutlineWidget, type TreeViewData, TreeViewExtension, type TreeViewExtensionOptions, type TreeViewPluginState, type UseBlockNavigatorOptions, type UseFileDropOptions, type UseFileDropResult, type UseImageEditorOptions, type UseImageEditorReturn, type UseMediaRecorderOptions, type UseMediaRecorderResult, type UseMonacoLoaderResult, VersionHistoryPanel, ViewMenuPanel, type ViewPreferences, ViewSwitcher, type ViewSwitcherProps, type WriteCanvasSettings, WysiwygEditor, type WysiwygEditorProps, addEdgeOp, addItemOp, addNodeOp, addTimelineEventOp, applyAsciiDiagramCommand, applyRepairCommand, applyTimelineCommand, applyTreeCommand, asciiDiagramToCanvas, buildFilename, buildNarrationSavePlan, buildPreviewDoc, buildTimingJson, cameraVideoLine, classifyFile, codeSnippetFenceLanguageToken, codeSnippetLanguageLabel, codeSnippetMarkdown, configureMonacoWorkers, createFloatingWindowManager, detectFloatTiers, detectLanguageFromFileName, draftPatchFromImportedTheme, encodeTimingJson, ensureTeleprompterStyles, executeNarrationSave, findAsciiDiagramBlockPos, findCodeSnippetBlockPos, findMermaidDiagramBlockPos, findRepairableBlockPos, findTimelineBlockPos, findTransitionEntry, findTreeBlockPos, formatSeconds, getBlockSlices, getCaptureKind, getTimelineForNode, imageEditorReducer, indentItemOp, initialImageEditorState, insertNarrationPreamble, inspectMermaidSource, isAsciiSourceVisible, isCodeSnippetFenceLanguage, isCodeSnippetNode, isMermaidDiagramNode, isMermaidFlowchartShapeId, isMermaidSourceVisible, isRepairableFence, isTimelineSourceSafeForSemanticEdit, lineToOffset, markdownToTiptap, measureTokenLines, mermaidDiagramMarkdown, mermaidDiagramProperties, mermaidEditCapabilities, mermaidErrorMessage, monacoLanguageForFence, moveItemDownOp, moveItemUpOp, moveNodeOp, narrationAnnotationLine, nextTimelineEventId, normalizeMermaidFlowchartShape, offsetToLine, outdentItemOp, parseTimelineForNode, partitionFiles, processMediaFiles, processTextFile, processTextFiles, prompterVarsFromTheme, readBlockAttrsParams, readBlockAttrsTransition, readBlockAttrsValue, readHeadingLineTransition, registerPcmWorklet, removeEdgeOp, removeItemOp, removeNodeOp, removeTimelineEventOp, renameItemOp, renameNodeOp, renderMermaidDiagram, replaceAsciiFenceText, replaceCodeSnippetText, replaceAsciiFenceText as replaceTreeFenceText, requestCameraStream, requestMicStream, requestScreenStream, resizeNodeOp, resolveFileKind, resolveFormat, sanitizeAsciiLabel, sanitizeTimelineText, sanitizeTreeLabel, searchPickerEntries, setBlockAttrsValue, setBlockDurationInSource, setHeadingAttrsTransition, setHeadingLineTransition, setMediaClipInSource, shouldPasteAsAsciiFence, shouldPasteAsTimelineFence, shouldPasteAsTreeFence, sliceIndexAtOffset, spliceBlock, stepScroll, summarizeBlockProps, supportsDisplayMedia, supportsMediaRecorder, supportsUserMedia, targetOffsetFor, templateLabel, timingPathFor, tiptapToMarkdown, toggleAsciiSource, toggleDirOp, toggleMermaidSource, transitionLabel, translateDiagramOp, updateTimelineEventOp, useAsciiDiagramData, useBlockNavigator, useCodeSnippetData, useCustomTemplates, useCustomThemes, useDocCustomTemplates, useDocCustomThemes, useEditorContext, useFileDrop, useFloatingWindow, useImageEditor, useMediaRecorder, useMermaidDiagramData, useMicAnalysis, useMonacoLoader, useNarrationRecorder, usePreviewSettings, useStreamPreview, useTeleprompter, useTimelineData, useTreeViewData, vadConfigForSensitivity };