@bendyline/squisq-editor-react 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CodeContext, E as EditorHostMode, S as SceneTextChannel } from './shell-BXG_NlvR.js';
2
- export { B as BlockTagVisibility, a as CodeContextSection, D as DocumentLinkCandidate, b as DocumentLinkProvider, c as EditorActions, d as EditorColorScheme, e as EditorContextValue, f as EditorMode, g as EditorProvider, h as EditorProviderProps, i as EditorShell, j as EditorShellProps, k as EditorState, l as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, m as MentionProvider, P as PreviewPanel, n as PreviewPanelProps, R as RawEditor, o as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, W as WriteCanvasSettings, p as WysiwygEditor, q as WysiwygEditorProps, u as useEditorContext } from './shell-BXG_NlvR.js';
1
+ import { C as CodeContext, E as EditorHostMode, S as SceneTextChannel } from './shell-595XbANu.js';
2
+ export { B as BlockTagVisibility, a as CodeContextSection, D as DocumentLinkCandidate, b as DocumentLinkProvider, c as EditorActions, d as EditorColorScheme, e as EditorContextValue, f as EditorMode, g as EditorProvider, h as EditorProviderProps, i as EditorShell, j as EditorShellProps, k as EditorState, l as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, m as MentionProvider, P as PreviewPanel, n as PreviewPanelProps, R as RawEditor, o as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, W as WriteCanvasSettings, p as WysiwygEditor, q as WysiwygEditorProps, u as useEditorContext } from './shell-595XbANu.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, CSSProperties } from 'react';
@@ -18,9 +18,10 @@ import { Extension } from '@tiptap/core';
18
18
  import * as _tiptap_extension_heading from '@tiptap/extension-heading';
19
19
  import { DecorationSet } from '@tiptap/pm/view';
20
20
  import { Editor } from '@tiptap/react';
21
- import { PluginKey } from '@tiptap/pm/state';
21
+ import { Transaction, PluginKey } from '@tiptap/pm/state';
22
22
  import { Node } from '@tiptap/pm/model';
23
23
  import { RenderResult } from 'mermaid';
24
+ import { FenceRendererMap } from '@bendyline/squisq/fence';
24
25
  export { JsonEditor, JsonEditorProps } from './json-editor/index.js';
25
26
  export { C as CameraStreamOptions, D as DEFAULT_RECORDER_DEVICE_SETTINGS, R as RecordedBookmark, a as RecordedMediaKind, b as RecorderAudioDeviceSettings, c as RecorderButton, d as RecorderButtonProps, e as RecorderCameraDeviceSettings, f as RecorderCameraSaveResult, g as RecorderColorScheme, h as RecorderConstraintMode, i as RecorderDeviceSettings, j as RecorderDeviceSettingsPanel, k as RecorderDeviceSettingsPanelProps, l as RecorderEncodingSettings, m as RecorderModal, n as RecorderModalProps, o as RecorderNarrationOptions, p as RecorderPanel, q as RecorderPanelProps, r as RecorderSaveResult, s as RecorderScreenAudioSettings, t as RecorderScreenDeviceSettings, S as ScreenStreamHandle, u as ScreenStreamOptions, T as TimingJson, v as buildRecorderAudioConstraints, w as buildRecorderCameraConstraints, x as buildRecorderScreenAudioConstraints, y as buildRecorderScreenConstraints, z as buildTimingJson, A as encodeTimingJson, B as recordedMediaKind, E as recorderBitsPerSecond, F as requestCameraStream, G as requestMicStream, H as requestScreenStream, I as timingPathFor, J as useStreamPreview } from './recorder-xL-5Vfbu.js';
26
27
  export { C as CanvasSink, a as CaptureKind, D as DEFAULT_TELEPROMPTER_PREFS, F as FloatOpenOptions, b as FloatTier, c as FloatingWindowHandle, d as FloatingWindowManager, M as MicAnalysisHandle, e as MicAnalysisStatus, N as NarrationRecorderController, f as NarrationRecorderState, g as NarrationStageHandle, h as NarrationTake, P as PrompterTransport, R as RecorderAudioBitrateMode, i as RecorderCameraLane, j as RecorderExtendedMediaOptions, k as RecorderSource, l as RecorderState, m as ResolvedFormat, T as TeleprompterController, n as TeleprompterPrefs, o as TeleprompterRecordingDeps, U as UseMediaRecorderOptions, p as UseMediaRecorderResult, q as UseNarrationStageOptions, r as buildFilename, s as createFloatingWindowManager, t as detectFloatTiers, u as getCaptureKind, v as resolveFormat, w as supportsDisplayMedia, x as supportsMediaRecorder, y as supportsUserMedia, z as useFloatingWindow, A as useMediaRecorder, B as useMicAnalysis, E as useNarrationRecorder, G as useNarrationStage, H as useTeleprompter, I as vadConfigForSensitivity } from './useNarrationStage-Bk3mdW75.js';
@@ -1749,6 +1750,23 @@ interface FenceBlockEntry {
1749
1750
  /** Document position of the codeBlock node at the current state. */
1750
1751
  pos: number;
1751
1752
  }
1753
+ /**
1754
+ * Remap a family's previous registry entries onto the new document, returning
1755
+ * `mappedPos -> id` for every fence whose identity carries over.
1756
+ *
1757
+ * Two passes:
1758
+ * 1. survivors whose start position was untouched — the common case;
1759
+ * 2. boundary-churn survivors, where an attrs-only `setNodeMarkup` makes
1760
+ * `mapResult` report the start as deleted even though the same block is
1761
+ * still there. Adopt the old id only when a codeBlock sits at the mapped
1762
+ * position, the slot is unclaimed, AND the old node actually survived
1763
+ * (see {@link survivedAsChurn}).
1764
+ *
1765
+ * Callers then walk the new doc: a position present in this map keeps its id
1766
+ * (and may use a lenient re-parse gate); a position absent from it is a NEW
1767
+ * fence that must pass full detection.
1768
+ */
1769
+ declare function mapFenceEntries(tr: Transaction, previous: readonly FenceBlockEntry[], doc: Node): Map<number, string>;
1752
1770
 
1753
1771
  /**
1754
1772
  * AsciiDiagramExtension — Tiptap/ProseMirror plugin that turns code blocks
@@ -2496,9 +2514,19 @@ interface CodeSnippetPluginState {
2496
2514
  interface CodeSnippetExtensionOptions {
2497
2515
  /** When false, leave all ordinary language-tagged fences as code blocks. */
2498
2516
  enabled?: boolean;
2517
+ /**
2518
+ * Fence languages this extension must NOT claim — typically the keys of
2519
+ * a host `FenceRendererMap` so `HostFenceExtension` can own them instead
2520
+ * of every unknown language becoming a Monaco inset. Tokens are
2521
+ * normalized like fence languages (first token, lowercased). Evaluated
2522
+ * at configure time: changing the *set* of registered languages
2523
+ * requires re-configuring the editor; renderer implementations can
2524
+ * change freely behind the host extension's getter.
2525
+ */
2526
+ reservedLanguages?: readonly string[];
2499
2527
  }
2500
2528
  declare const CODE_SNIPPET_KEY: PluginKey<CodeSnippetPluginState>;
2501
- declare function isCodeSnippetNode(node: Node): boolean;
2529
+ declare function isCodeSnippetNode(node: Node, reserved?: ReadonlySet<string>): boolean;
2502
2530
  declare function findCodeSnippetBlockPos(editor: Editor, blockId: string): number | null;
2503
2531
  declare const CodeSnippetExtension: Extension<CodeSnippetExtensionOptions, any>;
2504
2532
 
@@ -2680,6 +2708,94 @@ declare function applyTreeCommand(editor: Editor, blockId: string, cmd: TreeComm
2680
2708
  */
2681
2709
  declare function shouldPasteAsTreeFence(text: string): boolean;
2682
2710
 
2711
+ /**
2712
+ * HostFenceExtension — mounts HOST-registered fence renderers
2713
+ * (`@bendyline/squisq/fence`) inside the WYSIWYG editor.
2714
+ *
2715
+ * Structurally a sibling of TreeViewExtension/CodeSnippetExtension:
2716
+ * position registry with stable synthetic ids, `mapFenceEntries` for
2717
+ * boundary-churn survival, hide-the-fence node decoration + a widget
2718
+ * decoration hosting a React root with `containFenceWidgetEvents`.
2719
+ *
2720
+ * Ownership is simply "the host registry claims this fence language".
2721
+ * The registry is read through a GETTER (the `mentionProvider` pattern)
2722
+ * so renderer implementations can change without remounting the editor;
2723
+ * the *set* of claimed languages is also consulted per-transaction, but
2724
+ * remember to pass the same languages to
2725
+ * `CodeSnippetExtension.reservedLanguages` or Monaco claims them first.
2726
+ *
2727
+ * The fence body is the single source of truth. Renderers receive
2728
+ * `mode: 'edit'` plus a `replaceValue` callback that rewrites the fence
2729
+ * text in one undoable transaction; the info-string meta is NOT provided
2730
+ * (it does not survive the ProseMirror round-trip — payload lives in the
2731
+ * body, see the fence contract docs).
2732
+ */
2733
+
2734
+ type HostFenceBlockEntry = FenceBlockEntry;
2735
+ interface HostFencePluginState {
2736
+ entries: HostFenceBlockEntry[];
2737
+ decorations: DecorationSet;
2738
+ seq: number;
2739
+ }
2740
+ declare const HOST_FENCE_KEY: PluginKey<HostFencePluginState>;
2741
+ interface HostFenceExtensionOptions {
2742
+ /** When false, the extension is inert. */
2743
+ enabled?: boolean;
2744
+ /**
2745
+ * Getter for the host registry — read on every ownership check so
2746
+ * renderer implementations stay live without an editor remount.
2747
+ */
2748
+ renderers?: () => FenceRendererMap | null | undefined;
2749
+ /** Getter for the active theme, forwarded into the render context. */
2750
+ theme?: () => Theme | undefined;
2751
+ }
2752
+ declare function findHostFenceBlockPos(editor: Editor, blockId: string): number | null;
2753
+ /**
2754
+ * Replace a claimed fence's body in one undoable transaction. This is
2755
+ * what backs `FenceRenderContext.replaceValue` in edit mode; exported so
2756
+ * hosts building their own extensions get the same write boundary
2757
+ * (read-only enforcement included) as the built-in fence families.
2758
+ */
2759
+ declare function replaceHostFenceText(editor: Editor, blockId: string, next: string): boolean;
2760
+ declare const HostFenceExtension: Extension<HostFenceExtensionOptions, any>;
2761
+
2762
+ /**
2763
+ * Shared DOM containment for the interactive widgets that the fence-widget
2764
+ * families (ascii diagram, tree, timeline, mermaid) mount over a hidden code
2765
+ * fence via a ProseMirror widget decoration.
2766
+ *
2767
+ * Why this exists: a widget host is `contentEditable="false"` inside a
2768
+ * contentEditable ProseMirror surface, but the real form controls it contains
2769
+ * (`<input>`, `<textarea>`, `<select>`) still bubble their COMPLETE edit
2770
+ * stream up to the editor's DOM. ProseMirror's own handlers sit on
2771
+ * `view.dom`, so a `beforeinput`/`paste`/`compositionend` that originated in
2772
+ * a widget's rename field is ALSO interpreted as text insertion at the
2773
+ * document selection — the user types in the widget and the characters land
2774
+ * in the document. Stopping propagation at the host boundary is what keeps
2775
+ * the two edit surfaces separate.
2776
+ *
2777
+ * `keydown`/`keyup`/`pointerdown`/`mousedown` are contained for the same
2778
+ * reason: they drive ProseMirror's keymap and selection handling.
2779
+ *
2780
+ * This must stay ONE list used by every host — it drifted into three
2781
+ * divergent copies once already (only the timeline stopped the composition /
2782
+ * paste stream, so IME and paste edits leaked out of the diagram and tree
2783
+ * widgets).
2784
+ */
2785
+ /**
2786
+ * Every event a mounted fence widget must keep to itself. Ordered
2787
+ * pointer → key → text-input → composition → clipboard.
2788
+ */
2789
+ declare const FENCE_WIDGET_CONTAINED_EVENTS: readonly ["pointerdown", "mousedown", "keydown", "keyup", "beforeinput", "input", "change", "compositionstart", "compositionupdate", "compositionend", "paste", "cut"];
2790
+ /**
2791
+ * Stop every contained event at `container` so interaction inside a mounted
2792
+ * fence widget never reaches the ProseMirror editor that hosts it.
2793
+ *
2794
+ * Call once, on the host element created by a widget decoration, before
2795
+ * mounting React into it.
2796
+ */
2797
+ declare function containFenceWidgetEvents(container: HTMLElement): void;
2798
+
2683
2799
  /**
2684
2800
  * TimelineViewExtension — mounts a WYSIWYG timeline editor over qualifying
2685
2801
  * authored timeline code fences while keeping the fence text as source of
@@ -2843,4 +2959,4 @@ declare function applyTimelineCommand(editor: Editor, blockId: string, command:
2843
2959
  /** Paste gate for bare, high-confidence Unicode timeline art. */
2844
2960
  declare function shouldPasteAsTimelineFence(text: string): boolean;
2845
2961
 
2846
- 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 BuildPreviewDocOptions, CODE_SNIPPET_KEY, CODE_SNIPPET_LANGUAGES, CodeContext, 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, DiagramCanvas, type DiagramCommand, type DiagramData, type DiagramEdge, type DiagramNode, type DirectionModel, type DocCustomTemplates, type DocCustomThemes, DocumentSettingsDialog, type DocumentSettingsDialogProps, type DragContentType, type DropTarget, DropZoneOverlay, type DropZoneOverlayProps, EMPTY_TRANSITION, EditorHostMode, EmojiPicker, type EmojiPickerProps, type FileCategory, type FileKind, type FolderEntry, FolderView, type FolderViewProps, type HeadingTransitionAttrs, HeadingWithTemplate, ImportThemeSection, type ImportThemeSectionProps, type ImportedThemeResult, InlinePreviewGutter, type InlinePreviewGutterProps, MERMAID_DIAGRAM_KEY, MERMAID_DIAGRAM_TYPES, MERMAID_FLOWCHART_SHAPES, MediaBin, type MediaBinProps, type MediaClipPatch, 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 MermaidEditableText, type MermaidEditableTextTarget, type MermaidFlowchartDirection, type MermaidFlowchartModel, type MermaidFlowchartShape, type MermaidFlowchartShapeId, type MermaidNodeCanvasAction, type MermaidRenderResult, type MermaidSelection, MermaidShapePalette, type MermaidShapePaletteProps, type MermaidSourceEditableModel, MonacoLanguageLoadOptions, MonacoLanguageRequest, OutlinePanel, type OutlinePanelProps, PICKER_CATEGORIES, type PickerCategory, type PickerEntry, PlainHtmlPreview, type PlainHtmlPreviewProps, PreviewFormatSwitch, PreviewModeMenu, PreviewModeSwitch, type PreviewSettings, PreviewSettingsProvider, PreviewToolbarControls, type PreviewToolbarControlsProps, REPAIRABLE_KEY, type RepairableBlockEntry, RepairableDiagramExtension, type RepairableDiagramExtensionOptions, type RepairablePluginState, StatusBar, type StatusBarProps, TIMELINE_VIEW_KEY, TRANSITION_ENTRIES, TRANSITION_GROUPS, TemplatePicker, ThemeCustomizerPanel, type ThemeCustomizerPanelProps, ThemePicker, type ThemePickerProps, type ThemeSaveExtras, type TimelineBlockEntry, type TimelineCommand, type TimelineCommandResult, TimelineCompositionPanel, type TimelineCompositionPanelProps, TimelineEditorWidget, type TimelineEditorWidgetProps, type TimelineEventPatch, TimelineToolbar, type TimelineToolbarProps, TimelineTrack, type TimelineTrackProps, TimelineVideoPanel, type TimelineVideoPanelProps, type TimelineViewData, TimelineViewExtension, type TimelineViewExtensionOptions, type TimelineViewPluginState, Toolbar, type ToolbarProps, TooltipLayer, TransformMenu, 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 UseMonacoLoaderResult, VersionHistoryPanel, ViewMenuPanel, ViewSwitcher, type ViewSwitcherProps, type WrapPolicyIngest, addEdgeOp, addItemOp, addNodeOp, addTimelineEventOp, applyAsciiDiagramCommand, applyRepairCommand, applyTimelineCommand, applyTreeCommand, asciiDiagramToCanvas, buildPreviewDoc, classifyFile, codeSnippetFenceLanguageToken, codeSnippetLanguageLabel, codeSnippetMarkdown, detectLanguageFromFileName, documentTitleFromFileName, draftPatchFromImportedTheme, findAsciiDiagramBlockPos, findCodeSnippetBlockPos, findMermaidDiagramBlockPos, findRepairableBlockPos, findTimelineBlockPos, findTransitionEntry, findTreeBlockPos, formatSeconds, getBlockSlices, getTimelineForNode, indentItemOp, ingestForWrite, inspectMermaidSource, isAsciiSourceVisible, isCodeSnippetFenceLanguage, isCodeSnippetNode, isMermaidDiagramNode, isMermaidFlowchartShapeId, isMermaidSourceVisible, isRepairableFence, isTimelineSourceSafeForSemanticEdit, lineToOffset, markdownToTiptap, mermaidDiagramMarkdown, mermaidDiagramProperties, mermaidEditCapabilities, mermaidEditableTexts, mermaidErrorMessage, monacoLanguageForFence, moveItemDownOp, moveItemUpOp, moveNodeOp, nextTimelineEventId, normalizeMermaidFlowchartShape, offsetToLine, outdentItemOp, parseTimelineForNode, partitionFiles, persistFromWrite, preloadMonaco, preloadMonacoSuggestions, processMediaFiles, processTextFile, processTextFiles, readBlockAttrsParams, readBlockAttrsTransition, readBlockAttrsValue, readHeadingLineTransition, removeEdgeOp, removeItemOp, removeNodeOp, removeTimelineEventOp, renameItemOp, renameNodeOp, renderMermaidDiagram, replaceAsciiFenceText, replaceCodeSnippetText, replaceAsciiFenceText as replaceTreeFenceText, resizeNodeOp, resolveFileKind, sanitizeAsciiLabel, sanitizeTimelineText, sanitizeTreeLabel, searchPickerEntries, setBlockAttrsValue, setBlockDurationInSource, setBlockStartTimeInSource, setBlockTransitionInSource, setHeadingAttrsTransition, setHeadingLineTransition, setMediaClipInSource, shouldPasteAsAsciiFence, shouldPasteAsTimelineFence, shouldPasteAsTreeFence, sliceIndexAtOffset, spliceBlock, summarizeBlockProps, templateLabel, tiptapToMarkdown, toggleAsciiSource, toggleDirOp, toggleMermaidSource, transitionLabel, translateDiagramOp, updateTimelineEventOp, useAsciiDiagramData, useBlockNavigator, useCodeSnippetData, useCustomTemplates, useCustomThemes, useDocCustomTemplates, useDocCustomThemes, useFileDrop, useMermaidDiagramData, useMonacoLoader, usePreviewSettings, useTimelineData, useTreeViewData };
2962
+ 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 BuildPreviewDocOptions, CODE_SNIPPET_KEY, CODE_SNIPPET_LANGUAGES, CodeContext, 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, DiagramCanvas, type DiagramCommand, type DiagramData, type DiagramEdge, type DiagramNode, type DirectionModel, type DocCustomTemplates, type DocCustomThemes, DocumentSettingsDialog, type DocumentSettingsDialogProps, type DragContentType, type DropTarget, DropZoneOverlay, type DropZoneOverlayProps, EMPTY_TRANSITION, EditorHostMode, EmojiPicker, type EmojiPickerProps, FENCE_WIDGET_CONTAINED_EVENTS, type FenceBlockEntry, type FileCategory, type FileKind, type FolderEntry, FolderView, type FolderViewProps, HOST_FENCE_KEY, type HeadingTransitionAttrs, HeadingWithTemplate, type HostFenceBlockEntry, HostFenceExtension, type HostFenceExtensionOptions, type HostFencePluginState, ImportThemeSection, type ImportThemeSectionProps, type ImportedThemeResult, InlinePreviewGutter, type InlinePreviewGutterProps, MERMAID_DIAGRAM_KEY, MERMAID_DIAGRAM_TYPES, MERMAID_FLOWCHART_SHAPES, MediaBin, type MediaBinProps, type MediaClipPatch, 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 MermaidEditableText, type MermaidEditableTextTarget, type MermaidFlowchartDirection, type MermaidFlowchartModel, type MermaidFlowchartShape, type MermaidFlowchartShapeId, type MermaidNodeCanvasAction, type MermaidRenderResult, type MermaidSelection, MermaidShapePalette, type MermaidShapePaletteProps, type MermaidSourceEditableModel, MonacoLanguageLoadOptions, MonacoLanguageRequest, OutlinePanel, type OutlinePanelProps, PICKER_CATEGORIES, type PickerCategory, type PickerEntry, PlainHtmlPreview, type PlainHtmlPreviewProps, PreviewFormatSwitch, PreviewModeMenu, PreviewModeSwitch, type PreviewSettings, PreviewSettingsProvider, PreviewToolbarControls, type PreviewToolbarControlsProps, REPAIRABLE_KEY, type RepairableBlockEntry, RepairableDiagramExtension, type RepairableDiagramExtensionOptions, type RepairablePluginState, StatusBar, type StatusBarProps, TIMELINE_VIEW_KEY, TRANSITION_ENTRIES, TRANSITION_GROUPS, TemplatePicker, ThemeCustomizerPanel, type ThemeCustomizerPanelProps, ThemePicker, type ThemePickerProps, type ThemeSaveExtras, type TimelineBlockEntry, type TimelineCommand, type TimelineCommandResult, TimelineCompositionPanel, type TimelineCompositionPanelProps, TimelineEditorWidget, type TimelineEditorWidgetProps, type TimelineEventPatch, TimelineToolbar, type TimelineToolbarProps, TimelineTrack, type TimelineTrackProps, TimelineVideoPanel, type TimelineVideoPanelProps, type TimelineViewData, TimelineViewExtension, type TimelineViewExtensionOptions, type TimelineViewPluginState, Toolbar, type ToolbarProps, TooltipLayer, TransformMenu, 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 UseMonacoLoaderResult, VersionHistoryPanel, ViewMenuPanel, ViewSwitcher, type ViewSwitcherProps, type WrapPolicyIngest, addEdgeOp, addItemOp, addNodeOp, addTimelineEventOp, applyAsciiDiagramCommand, applyRepairCommand, applyTimelineCommand, applyTreeCommand, asciiDiagramToCanvas, buildPreviewDoc, classifyFile, codeSnippetFenceLanguageToken, codeSnippetLanguageLabel, codeSnippetMarkdown, containFenceWidgetEvents, detectLanguageFromFileName, documentTitleFromFileName, draftPatchFromImportedTheme, findAsciiDiagramBlockPos, findCodeSnippetBlockPos, findHostFenceBlockPos, findMermaidDiagramBlockPos, findRepairableBlockPos, findTimelineBlockPos, findTransitionEntry, findTreeBlockPos, formatSeconds, getBlockSlices, getTimelineForNode, indentItemOp, ingestForWrite, inspectMermaidSource, isAsciiSourceVisible, isCodeSnippetFenceLanguage, isCodeSnippetNode, isMermaidDiagramNode, isMermaidFlowchartShapeId, isMermaidSourceVisible, isRepairableFence, isTimelineSourceSafeForSemanticEdit, lineToOffset, mapFenceEntries, markdownToTiptap, mermaidDiagramMarkdown, mermaidDiagramProperties, mermaidEditCapabilities, mermaidEditableTexts, mermaidErrorMessage, monacoLanguageForFence, moveItemDownOp, moveItemUpOp, moveNodeOp, nextTimelineEventId, normalizeMermaidFlowchartShape, offsetToLine, outdentItemOp, parseTimelineForNode, partitionFiles, persistFromWrite, preloadMonaco, preloadMonacoSuggestions, processMediaFiles, processTextFile, processTextFiles, readBlockAttrsParams, readBlockAttrsTransition, readBlockAttrsValue, readHeadingLineTransition, removeEdgeOp, removeItemOp, removeNodeOp, removeTimelineEventOp, renameItemOp, renameNodeOp, renderMermaidDiagram, replaceAsciiFenceText, replaceCodeSnippetText, replaceHostFenceText, replaceAsciiFenceText as replaceTreeFenceText, resizeNodeOp, resolveFileKind, sanitizeAsciiLabel, sanitizeTimelineText, sanitizeTreeLabel, searchPickerEntries, setBlockAttrsValue, setBlockDurationInSource, setBlockStartTimeInSource, setBlockTransitionInSource, setHeadingAttrsTransition, setHeadingLineTransition, setMediaClipInSource, shouldPasteAsAsciiFence, shouldPasteAsTimelineFence, shouldPasteAsTreeFence, sliceIndexAtOffset, spliceBlock, summarizeBlockProps, templateLabel, tiptapToMarkdown, toggleAsciiSource, toggleDirOp, toggleMermaidSource, transitionLabel, translateDiagramOp, updateTimelineEventOp, useAsciiDiagramData, useBlockNavigator, useCodeSnippetData, useCustomTemplates, useCustomThemes, useDocCustomTemplates, useDocCustomThemes, useFileDrop, useMermaidDiagramData, useMonacoLoader, usePreviewSettings, useTimelineData, useTreeViewData };
package/dist/index.js CHANGED
@@ -26,8 +26,11 @@ import {
26
26
  EditorProvider,
27
27
  EditorShell,
28
28
  EmojiPicker,
29
+ FENCE_WIDGET_CONTAINED_EVENTS,
29
30
  FontPicker,
31
+ HOST_FENCE_KEY,
30
32
  HeadingWithTemplate,
33
+ HostFenceExtension,
31
34
  IMAGE_TREATMENT_PRESETS,
32
35
  ImportThemeSection,
33
36
  InlinePreviewGutter,
@@ -92,11 +95,13 @@ import {
92
95
  codeSnippetLanguageLabel,
93
96
  codeSnippetMarkdown,
94
97
  compileDraft,
98
+ containFenceWidgetEvents,
95
99
  detectLanguageFromFileName,
96
100
  documentTitleFromFileName,
97
101
  draftPatchFromImportedTheme,
98
102
  findAsciiDiagramBlockPos,
99
103
  findCodeSnippetBlockPos,
104
+ findHostFenceBlockPos,
100
105
  findMermaidDiagramBlockPos,
101
106
  findRepairableBlockPos,
102
107
  findTimelineBlockPos,
@@ -117,6 +122,7 @@ import {
117
122
  isRepairableFence,
118
123
  isTimelineSourceSafeForSemanticEdit,
119
124
  lineToOffset,
125
+ mapFenceEntries,
120
126
  mermaidDiagramMarkdown,
121
127
  mermaidDiagramProperties,
122
128
  mermaidEditCapabilities,
@@ -152,6 +158,7 @@ import {
152
158
  renderMermaidDiagram,
153
159
  replaceAsciiFenceText,
154
160
  replaceCodeSnippetText,
161
+ replaceHostFenceText,
155
162
  resizeNodeOp,
156
163
  resolveFileKind,
157
164
  sanitizeAsciiLabel,
@@ -194,7 +201,7 @@ import {
194
201
  usePreviewSettings,
195
202
  useTimelineData,
196
203
  useTreeViewData
197
- } from "./chunk-5FG3NAPH.js";
204
+ } from "./chunk-NJ2VKEQF.js";
198
205
  import "./chunk-V4NBQF5C.js";
199
206
  import {
200
207
  JsonEditor
@@ -718,8 +725,11 @@ export {
718
725
  EditorProvider,
719
726
  EditorShell,
720
727
  EmojiPicker,
728
+ FENCE_WIDGET_CONTAINED_EVENTS,
721
729
  FolderView,
730
+ HOST_FENCE_KEY,
722
731
  HeadingWithTemplate,
732
+ HostFenceExtension,
723
733
  ImageEditor,
724
734
  ImageViewer,
725
735
  ImportThemeSection,
@@ -803,6 +813,7 @@ export {
803
813
  codeSnippetLanguageLabel,
804
814
  codeSnippetMarkdown,
805
815
  configureMonacoWorkers,
816
+ containFenceWidgetEvents,
806
817
  createFloatingWindowManager,
807
818
  detectFloatTiers,
808
819
  detectLanguageFromFileName,
@@ -813,6 +824,7 @@ export {
813
824
  executeNarrationSave,
814
825
  findAsciiDiagramBlockPos,
815
826
  findCodeSnippetBlockPos,
827
+ findHostFenceBlockPos,
816
828
  findMermaidDiagramBlockPos,
817
829
  findRepairableBlockPos,
818
830
  findTimelineBlockPos,
@@ -837,6 +849,7 @@ export {
837
849
  isRepairableFence,
838
850
  isTimelineSourceSafeForSemanticEdit,
839
851
  lineToOffset,
852
+ mapFenceEntries,
840
853
  markdownToTiptap,
841
854
  measureTokenLines,
842
855
  mermaidDiagramMarkdown,
@@ -878,6 +891,7 @@ export {
878
891
  renderMermaidDiagram,
879
892
  replaceAsciiFenceText,
880
893
  replaceCodeSnippetText,
894
+ replaceHostFenceText,
881
895
  replaceAsciiFenceText as replaceTreeFenceText,
882
896
  requestCameraStream,
883
897
  requestMicStream,
@@ -1,7 +1,8 @@
1
- export { B as BlockTagVisibility, D as DocumentLinkCandidate, b as DocumentLinkProvider, c as EditorActions, d as EditorColorScheme, e as EditorContextValue, E as EditorHostMode, f as EditorMode, g as EditorProvider, h as EditorProviderProps, i as EditorShell, j as EditorShellProps, k as EditorState, l as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, m as MentionProvider, P as PreviewPanel, n as PreviewPanelProps, R as RawEditor, o as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, p as WysiwygEditor, q as WysiwygEditorProps, u as useEditorContext } from '../shell-BXG_NlvR.js';
1
+ export { B as BlockTagVisibility, D as DocumentLinkCandidate, b as DocumentLinkProvider, c as EditorActions, d as EditorColorScheme, e as EditorContextValue, E as EditorHostMode, f as EditorMode, g as EditorProvider, h as EditorProviderProps, i as EditorShell, j as EditorShellProps, k as EditorState, l as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, m as MentionProvider, P as PreviewPanel, n as PreviewPanelProps, R as RawEditor, o as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, p as WysiwygEditor, q as WysiwygEditorProps, u as useEditorContext } from '../shell-595XbANu.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
4
4
  import '@bendyline/squisq/schemas';
5
+ import '@bendyline/squisq/fence';
5
6
  import '@bendyline/squisq/markdown';
6
7
  import '@bendyline/squisq/storage';
7
8
  import '@bendyline/squisq/versions';
@@ -5,7 +5,7 @@ import {
5
5
  RawEditor,
6
6
  WysiwygEditor,
7
7
  useEditorContext
8
- } from "../chunk-5FG3NAPH.js";
8
+ } from "../chunk-NJ2VKEQF.js";
9
9
  import "../chunk-V4NBQF5C.js";
10
10
  import "../chunk-K2WJYVS4.js";
11
11
  import "../chunk-V44VP242.js";
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
3
  import { Doc, MediaProvider, ViewportPreset, Theme } from '@bendyline/squisq/schemas';
4
+ import { FenceRendererMap } from '@bendyline/squisq/fence';
4
5
  import { MarkdownDocument } from '@bendyline/squisq/markdown';
5
6
  import { ContentContainer } from '@bendyline/squisq/storage';
6
7
  import { DocumentVersionManager, SaveVersionOptions, SaveVersionResult, PrunePolicy } from '@bendyline/squisq/versions';
@@ -367,6 +368,13 @@ interface EditorContextValue extends EditorState, EditorActions {
367
368
  * host DOES resolve is unsupported. Executable schemes stay refused.
368
369
  */
369
370
  linkSchemes: readonly string[] | undefined;
371
+ /**
372
+ * Host fence-renderer registry (`@bendyline/squisq/fence`). Claimed
373
+ * fence languages render as interactive host widgets in the WYSIWYG
374
+ * editor (via `HostFenceExtension`) instead of Monaco code insets, and
375
+ * flow into the preview panel's read path. Null disables.
376
+ */
377
+ fenceRenderers: FenceRendererMap | null;
370
378
  /**
371
379
  * File name the host opened this document as (e.g. `Longview Plan.md`), if
372
380
  * any. Used as a display-title fallback — for example, the header of a
@@ -438,6 +446,11 @@ interface EditorProviderProps {
438
446
  * Omit to fall back to URL-only link insertion.
439
447
  */
440
448
  documentLinkProvider?: DocumentLinkProvider | null;
449
+ /**
450
+ * Host fence-renderer registry (`@bendyline/squisq/fence`). Omit to
451
+ * leave every explicit-language fence to the built-in families.
452
+ */
453
+ fenceRenderers?: FenceRendererMap | null;
441
454
  /**
442
455
  * Extra link schemes this host resolves itself. Threaded into the link
443
456
  * dialog's `sanitizeUrl` check so a host-custom protocol is accepted;
@@ -556,7 +569,7 @@ interface ViewPreferences {
556
569
  /** Document vs. block-at-a-time layout. */
557
570
  layoutMode?: LayoutMode;
558
571
  }
559
- declare function EditorProvider({ initialMarkdown, initialView, articleId, colorScheme: initialColorScheme, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, mediaProvider, imageDisplayMode, mentionProvider, documentLinkProvider, linkSchemes, allowRecording, allowNarrate, preserveSourceWrapping, fileName, language, findMode: controlledFindMode, onFindModeChange, inlinePreview, showStatusBar, outline, blockTags, blockTagVisibility: initialBlockTagVisibility, themeInheritance, layoutMode, viewPreferences, onViewPreferencesChange, children, }: EditorProviderProps): react_jsx_runtime.JSX.Element;
572
+ declare function EditorProvider({ initialMarkdown, initialView, articleId, colorScheme: initialColorScheme, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, mediaProvider, imageDisplayMode, mentionProvider, documentLinkProvider, fenceRenderers, linkSchemes, allowRecording, allowNarrate, preserveSourceWrapping, fileName, language, findMode: controlledFindMode, onFindModeChange, inlinePreview, showStatusBar, outline, blockTags, blockTagVisibility: initialBlockTagVisibility, themeInheritance, layoutMode, viewPreferences, onViewPreferencesChange, children, }: EditorProviderProps): react_jsx_runtime.JSX.Element;
560
573
 
561
574
  /**
562
575
  * Host-supplied context sections rendered INSIDE the Monaco (raw/code)
@@ -927,6 +940,15 @@ interface EditorShellProps {
927
940
  * remote API, …) implement this; the editor stays agnostic.
928
941
  */
929
942
  documentLinkProvider?: DocumentLinkProvider | null;
943
+ /**
944
+ * Host fence-renderer registry (`@bendyline/squisq/fence`). Claimed
945
+ * fence languages mount as interactive host widgets in the WYSIWYG
946
+ * view (via `HostFenceExtension`) instead of Monaco code insets. The
947
+ * *set* of claimed languages is read at editor configure time;
948
+ * renderer implementations stay live behind a getter. Omit to leave
949
+ * every fence to the built-in families.
950
+ */
951
+ fenceRenderers?: FenceRendererMap | null;
930
952
  /**
931
953
  * Extra link schemes this host resolves itself (e.g. an app-internal
932
954
  * navigation protocol). The link dialog validates typed URLs against
@@ -1086,7 +1108,7 @@ interface EditorShellProps {
1086
1108
  * Complete markdown editor shell with toolbar, view switcher, and three
1087
1109
  * editing modes: Raw (Monaco), WYSIWYG (Tiptap), and Preview.
1088
1110
  */
1089
- declare function EditorShell({ initialMarkdown, initialView, hostMode, defaultViewportPreset, articleId, basePath, onChange, onLinkClick, showCodeCopyButton, onCopyCode, colorScheme, className, height, minHeight, maxHeight, mediaProvider, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, showFilesToggle, showFormattingControls, showInsertControls, allowBinaryDownloads, toolbarSlotLeft, toolbarSlotAfterActions, toolbarSlotRight, statusBarSlotRight, showPlayTab, allowPresentationWindow, allowPresentationFullscreen, allowPrint, submitOnEnter, codeContext, fullWidth, uxFont, thinMargins, writeCanvasSettings, showStatusBar, imageDisplayMode, fileName, language, findMode, onFindModeChange, mentionProvider, documentLinkProvider, linkSchemes, allowRecording, allowNarrate, preserveSourceWrapping, placeholder, readOnly, imageSrc, imageAlt, imageMode, imageEditorContainer, onImageExport, inlinePreview, inlinePreviewWidth, outline, outlineWidth, blockTags, blockTagVisibility, themeInheritance, viewPreferences, onViewPreferencesChange, themeOverride, }: EditorShellProps): react_jsx_runtime.JSX.Element;
1111
+ declare function EditorShell({ initialMarkdown, initialView, hostMode, defaultViewportPreset, articleId, basePath, onChange, onLinkClick, showCodeCopyButton, onCopyCode, colorScheme, className, height, minHeight, maxHeight, mediaProvider, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, showFilesToggle, showFormattingControls, showInsertControls, allowBinaryDownloads, toolbarSlotLeft, toolbarSlotAfterActions, toolbarSlotRight, statusBarSlotRight, showPlayTab, allowPresentationWindow, allowPresentationFullscreen, allowPrint, submitOnEnter, codeContext, fullWidth, uxFont, thinMargins, writeCanvasSettings, showStatusBar, imageDisplayMode, fileName, language, findMode, onFindModeChange, mentionProvider, documentLinkProvider, fenceRenderers, linkSchemes, allowRecording, allowNarrate, preserveSourceWrapping, placeholder, readOnly, imageSrc, imageAlt, imageMode, imageEditorContainer, onImageExport, inlinePreview, inlinePreviewWidth, outline, outlineWidth, blockTags, blockTagVisibility, themeInheritance, viewPreferences, onViewPreferencesChange, themeOverride, }: EditorShellProps): react_jsx_runtime.JSX.Element;
1090
1112
 
1091
1113
  /**
1092
1114
  * RawEditor
@@ -16493,6 +16493,14 @@
16493
16493
  color: var(--squisq-text-muted, #6b7280);
16494
16494
  }
16495
16495
 
16496
+ /* src/styles/host-fence.css */
16497
+ .squisq-wysiwyg-editor pre.squisq-host-fence-hidden {
16498
+ display: none;
16499
+ }
16500
+ .squisq-host-fence-widget-host {
16501
+ margin: 0.6rem 0;
16502
+ }
16503
+
16496
16504
  /* src/styles/ascii-timeline.css */
16497
16505
  .squisq-wysiwyg-editor pre.squisq-ascii-timeline-fence-hidden {
16498
16506
  display: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/squisq-editor-react",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "React editor shell with raw/WYSIWYG/preview modes for Squisq documents",
5
5
  "license": "MIT",
6
6
  "author": "Bendyline",
@@ -84,10 +84,10 @@
84
84
  "react-dom": "^18.0.0 || ^19.0.0"
85
85
  },
86
86
  "dependencies": {
87
- "@bendyline/squisq": "2.6.0",
88
- "@bendyline/squisq-formats": "2.4.0",
89
- "@bendyline/squisq-react": "2.6.0",
90
- "@bendyline/squisq-video-react": "2.3.1",
87
+ "@bendyline/squisq": "2.7.0",
88
+ "@bendyline/squisq-formats": "2.4.1",
89
+ "@bendyline/squisq-react": "2.7.0",
90
+ "@bendyline/squisq-video-react": "2.3.2",
91
91
  "@fortawesome/fontawesome-free": "7.2.0",
92
92
  "@tiptap/core": "2.27.2",
93
93
  "@tiptap/extension-heading": "2.27.2",