@bendyline/squisq-editor-react 2.3.1 → 2.3.3

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, S as SceneTextChannel } from './shell-BxSCBm4H.js';
2
- export { B as BlockTagVisibility, a as CodeContextSection, D as DocumentLinkCandidate, b as DocumentLinkProvider, E as EditorActions, c as EditorColorScheme, d as EditorContextValue, e as EditorMode, f as EditorProvider, g as EditorProviderProps, h as EditorShell, i as EditorShellProps, j as EditorState, k as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, l as MentionProvider, P as PreviewPanel, m as PreviewPanelProps, R as RawEditor, n as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, W as WriteCanvasSettings, o as WysiwygEditor, p as WysiwygEditorProps, u as useEditorContext } from './shell-BxSCBm4H.js';
1
+ import { C as CodeContext, S as SceneTextChannel } from './shell-YIIUac26.js';
2
+ export { B as BlockTagVisibility, a as CodeContextSection, D as DocumentLinkCandidate, b as DocumentLinkProvider, E as EditorActions, c as EditorColorScheme, d as EditorContextValue, e as EditorMode, f as EditorProvider, g as EditorProviderProps, h as EditorShell, i as EditorShellProps, j as EditorState, k as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, l as MentionProvider, P as PreviewPanel, m as PreviewPanelProps, R as RawEditor, n as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, W as WriteCanvasSettings, o as WysiwygEditor, p as WysiwygEditorProps, u as useEditorContext } from './shell-YIIUac26.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';
@@ -8,6 +8,7 @@ import { MediaProvider, Theme, CustomTemplateDefinition, ThemeSeedColors, Viewpo
8
8
  import { IconFamily } from '@bendyline/squisq/icons';
9
9
  import { DisplayMode, CaptionStyle } from '@bendyline/squisq-react';
10
10
  import * as monaco_editor from 'monaco-editor';
11
+ export { MonacoWorkerConstructor, MonacoWorkerConstructors, configureMonacoWorkers } from './monaco-workers/index.js';
11
12
  import { ConnectorRouting, AsciiDiagram, Tree, AsciiTimeline, AsciiTimelineSide, AsciiTimelineMarker } from '@bendyline/squisq/doc';
12
13
  import * as _tiptap_core from '@tiptap/core';
13
14
  import { Extension } from '@tiptap/core';
@@ -1104,7 +1105,7 @@ interface InlinePreviewGutterProps {
1104
1105
  */
1105
1106
  mediaProvider?: MediaProvider | null;
1106
1107
  }
1107
- declare function InlinePreviewGutter({ width, basePath, viewport, className, connectorWidth, mediaProvider, }: InlinePreviewGutterProps): react_jsx_runtime.JSX.Element;
1108
+ declare function InlinePreviewGutter({ width, basePath, viewport, className, connectorWidth, mediaProvider, }: InlinePreviewGutterProps): react_jsx_runtime.JSX.Element | null;
1108
1109
 
1109
1110
  interface MediaBinProps {
1110
1111
  /** The active MediaProvider (null when no media context is available) */
@@ -1298,63 +1299,6 @@ interface UseMonacoLoaderResult {
1298
1299
  */
1299
1300
  declare function useMonacoLoader(): UseMonacoLoaderResult;
1300
1301
 
1301
- /**
1302
- * Monaco language-service worker wiring.
1303
- *
1304
- * Monaco offloads its heavy language services — css / html / json / typescript
1305
- * IntelliSense — plus a base editor service (word-based completions, link
1306
- * detection, diffing) to web workers. Those worker bundles must be produced by
1307
- * the HOST application's bundler: the mechanisms for it (Vite's `?worker`
1308
- * import suffix, `new Worker(new URL(...))`, webpack loaders) are all
1309
- * bundler-specific and cannot live inside this tsup-built library.
1310
- *
1311
- * So the division of labor is: the host supplies the five worker constructors
1312
- * (one line each with Vite's `?worker`), and this helper owns the
1313
- * `label → worker` mapping — the part that's fiddly and easy to get wrong.
1314
- *
1315
- * Call once, before the first editor mounts (typically in the app entry):
1316
- *
1317
- * ```ts
1318
- * import { configureMonacoWorkers } from '@bendyline/squisq-editor-react';
1319
- * import EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
1320
- * import JsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
1321
- * import CssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker';
1322
- * import HtmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker';
1323
- * import TsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
1324
- *
1325
- * configureMonacoWorkers({
1326
- * editor: EditorWorker, json: JsonWorker, css: CssWorker,
1327
- * html: HtmlWorker, ts: TsWorker,
1328
- * });
1329
- * ```
1330
- *
1331
- * This is purely additive: without it, highlighting, editing, and custom
1332
- * completion providers (e.g. the `{[template]}` typeahead) still work — they
1333
- * run on the main thread. Only the language-service IntelliSense is dormant
1334
- * until the workers are wired.
1335
- */
1336
- /** Zero-arg worker constructor, as produced by Vite's `?worker` import. */
1337
- type MonacoWorkerConstructor = new () => Worker;
1338
- interface MonacoWorkerConstructors {
1339
- /** Base editor worker (word completions, links, diff). Required. */
1340
- editor: MonacoWorkerConstructor;
1341
- /** JSON language service. */
1342
- json?: MonacoWorkerConstructor;
1343
- /** CSS/SCSS/LESS language service. */
1344
- css?: MonacoWorkerConstructor;
1345
- /** HTML/Handlebars/Razor language service. */
1346
- html?: MonacoWorkerConstructor;
1347
- /** TypeScript service — also handles JavaScript. */
1348
- ts?: MonacoWorkerConstructor;
1349
- }
1350
- /**
1351
- * Install `globalThis.MonacoEnvironment.getWorker` so Monaco routes each
1352
- * language to the matching worker, falling back to the base editor worker for
1353
- * any label without a dedicated service (which is every plain language — its
1354
- * grammar-based highlighting needs no worker).
1355
- */
1356
- declare function configureMonacoWorkers(workers: MonacoWorkerConstructors): void;
1357
-
1358
1302
  interface CustomTemplateContextValue {
1359
1303
  /** Templates inlined into the current doc's frontmatter. */
1360
1304
  docTemplates: CustomTemplateDefinition[];
@@ -2705,4 +2649,4 @@ declare function applyTimelineCommand(editor: Editor, blockId: string, command:
2705
2649
  /** Paste gate for bare, high-confidence Unicode timeline art. */
2706
2650
  declare function shouldPasteAsTimelineFence(text: string): boolean;
2707
2651
 
2708
- 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, 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, 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, type MonacoWorkerConstructor, type MonacoWorkerConstructors, OutlinePanel, type OutlinePanelProps, PICKER_CATEGORIES, type PickerCategory, type PickerEntry, PlainHtmlPreview, type PlainHtmlPreviewProps, PreviewFormatSwitch, PreviewModeMenu, PreviewModeSwitch, type PreviewSettings, PreviewSettingsProvider, PreviewToolbarControls, 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, TimelineEditorWidget, type TimelineEditorWidgetProps, type TimelineEventPatch, TimelineTrack, type TimelineTrackProps, type TimelineViewData, TimelineViewExtension, type TimelineViewExtensionOptions, type TimelineViewPluginState, 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 UseMonacoLoaderResult, VersionHistoryPanel, ViewMenuPanel, ViewSwitcher, type ViewSwitcherProps, addEdgeOp, addItemOp, addNodeOp, addTimelineEventOp, applyAsciiDiagramCommand, applyRepairCommand, applyTimelineCommand, applyTreeCommand, asciiDiagramToCanvas, buildPreviewDoc, classifyFile, codeSnippetFenceLanguageToken, codeSnippetLanguageLabel, codeSnippetMarkdown, configureMonacoWorkers, detectLanguageFromFileName, draftPatchFromImportedTheme, findAsciiDiagramBlockPos, findCodeSnippetBlockPos, findMermaidDiagramBlockPos, findRepairableBlockPos, findTimelineBlockPos, findTransitionEntry, findTreeBlockPos, formatSeconds, getBlockSlices, getTimelineForNode, indentItemOp, 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, 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, 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 };
2652
+ 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, 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, 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, OutlinePanel, type OutlinePanelProps, PICKER_CATEGORIES, type PickerCategory, type PickerEntry, PlainHtmlPreview, type PlainHtmlPreviewProps, PreviewFormatSwitch, PreviewModeMenu, PreviewModeSwitch, type PreviewSettings, PreviewSettingsProvider, PreviewToolbarControls, 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, TimelineEditorWidget, type TimelineEditorWidgetProps, type TimelineEventPatch, TimelineTrack, type TimelineTrackProps, type TimelineViewData, TimelineViewExtension, type TimelineViewExtensionOptions, type TimelineViewPluginState, 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 UseMonacoLoaderResult, VersionHistoryPanel, ViewMenuPanel, ViewSwitcher, type ViewSwitcherProps, addEdgeOp, addItemOp, addNodeOp, addTimelineEventOp, applyAsciiDiagramCommand, applyRepairCommand, applyTimelineCommand, applyTreeCommand, asciiDiagramToCanvas, buildPreviewDoc, classifyFile, codeSnippetFenceLanguageToken, codeSnippetLanguageLabel, codeSnippetMarkdown, detectLanguageFromFileName, draftPatchFromImportedTheme, findAsciiDiagramBlockPos, findCodeSnippetBlockPos, findMermaidDiagramBlockPos, findRepairableBlockPos, findTimelineBlockPos, findTransitionEntry, findTreeBlockPos, formatSeconds, getBlockSlices, getTimelineForNode, indentItemOp, 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, 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, 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
@@ -1,3 +1,6 @@
1
+ import {
2
+ configureMonacoWorkers
3
+ } from "./chunk-BWPFPHWY.js";
1
4
  import {
2
5
  ALL_PICKER_ENTRIES,
3
6
  ANIMATION_SPEED_PRESETS,
@@ -123,6 +126,7 @@ import {
123
126
  outdentItemOp,
124
127
  parseTimelineForNode,
125
128
  partitionFiles,
129
+ platformShortcut,
126
130
  processMediaFiles,
127
131
  processTextFile,
128
132
  processTextFiles,
@@ -178,7 +182,7 @@ import {
178
182
  usePreviewSettings,
179
183
  useTimelineData,
180
184
  useTreeViewData
181
- } from "./chunk-TRCKHRBS.js";
185
+ } from "./chunk-QN3Q64LV.js";
182
186
  import {
183
187
  JsonEditor
184
188
  } from "./chunk-54UGTQBO.js";
@@ -324,9 +328,9 @@ function defaultIconFor(entry) {
324
328
  // src/ViewSwitcher.tsx
325
329
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
326
330
  var VIEWS = [
327
- { id: "wysiwyg", label: "Write", shortcut: "\u23181" },
328
- { id: "raw", label: "Source", shortcut: "\u23182" },
329
- { id: "preview", label: "Use", shortcut: "\u23183" }
331
+ { id: "wysiwyg", label: "Write", shortcutKey: "1" },
332
+ { id: "raw", label: "Source", shortcutKey: "2" },
333
+ { id: "preview", label: "Use", shortcutKey: "3" }
330
334
  ];
331
335
  function ViewSwitcher({ className }) {
332
336
  const { activeView, setActiveView, editorMode } = useEditorContext();
@@ -345,7 +349,7 @@ function ViewSwitcher({ className }) {
345
349
  "aria-selected": activeView === view.id,
346
350
  className: `squisq-view-tab ${activeView === view.id ? "squisq-view-tab--active" : ""}`,
347
351
  onClick: () => setActiveView(view.id),
348
- title: `${view.label} (${view.shortcut})`,
352
+ title: `${view.label} (${platformShortcut(view.shortcutKey)})`,
349
353
  children: [
350
354
  /* @__PURE__ */ jsx2("span", { className: "squisq-view-tab-label squisq-view-tab-label--long", children: view.label }),
351
355
  view.shortLabel && view.shortLabel !== view.label && /* @__PURE__ */ jsx2("span", { className: "squisq-view-tab-label squisq-view-tab-label--short", children: view.shortLabel })
@@ -663,35 +667,6 @@ function ThemeCustomizerPanel({
663
667
  )
664
668
  ] });
665
669
  }
666
-
667
- // src/monacoWorkers.ts
668
- function configureMonacoWorkers(workers) {
669
- const host = globalThis;
670
- host.MonacoEnvironment = {
671
- getWorker(_workerId, label) {
672
- switch (label) {
673
- case "json":
674
- if (workers.json) return new workers.json();
675
- break;
676
- case "css":
677
- case "scss":
678
- case "less":
679
- if (workers.css) return new workers.css();
680
- break;
681
- case "html":
682
- case "handlebars":
683
- case "razor":
684
- if (workers.html) return new workers.html();
685
- break;
686
- case "typescript":
687
- case "javascript":
688
- if (workers.ts) return new workers.ts();
689
- break;
690
- }
691
- return new workers.editor();
692
- }
693
- };
694
- }
695
670
  export {
696
671
  ALL_PICKER_ENTRIES,
697
672
  AsciiDiagramExtension,
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Monaco language-service worker wiring.
3
+ *
4
+ * Monaco offloads its heavy language services — css / html / json / typescript
5
+ * IntelliSense — plus a base editor service (word-based completions, link
6
+ * detection, diffing) to web workers. Those worker bundles must be produced by
7
+ * the HOST application's bundler: the mechanisms for it (Vite's `?worker`
8
+ * import suffix, `new Worker(new URL(...))`, webpack loaders) are all
9
+ * bundler-specific and cannot live inside this tsup-built library.
10
+ *
11
+ * So the division of labor is: the host supplies the five worker constructors
12
+ * (one line each with Vite's `?worker`), and this helper owns the
13
+ * `label → worker` mapping — the part that's fiddly and easy to get wrong.
14
+ *
15
+ * Call once, before the first editor mounts (typically in the app entry):
16
+ *
17
+ * ```ts
18
+ * import { configureMonacoWorkers } from '@bendyline/squisq-editor-react/monaco-workers';
19
+ * import EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
20
+ * import JsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
21
+ * import CssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker';
22
+ * import HtmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker';
23
+ * import TsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
24
+ *
25
+ * configureMonacoWorkers({
26
+ * editor: EditorWorker, json: JsonWorker, css: CssWorker,
27
+ * html: HtmlWorker, ts: TsWorker,
28
+ * });
29
+ * ```
30
+ *
31
+ * This is purely additive: without it, highlighting, editing, and custom
32
+ * completion providers (e.g. the `{[template]}` typeahead) still work — they
33
+ * run on the main thread. Only the language-service IntelliSense is dormant
34
+ * until the workers are wired.
35
+ */
36
+ /** Zero-arg worker constructor, as produced by Vite's `?worker` import. */
37
+ type MonacoWorkerConstructor = new () => Worker;
38
+ interface MonacoWorkerConstructors {
39
+ /** Base editor worker (word completions, links, diff). Required. */
40
+ editor: MonacoWorkerConstructor;
41
+ /** JSON language service. */
42
+ json?: MonacoWorkerConstructor;
43
+ /** CSS/SCSS/LESS language service. */
44
+ css?: MonacoWorkerConstructor;
45
+ /** HTML/Handlebars/Razor language service. */
46
+ html?: MonacoWorkerConstructor;
47
+ /** TypeScript service — also handles JavaScript. */
48
+ ts?: MonacoWorkerConstructor;
49
+ }
50
+ /**
51
+ * Install `globalThis.MonacoEnvironment.getWorker` so Monaco routes each
52
+ * language to the matching worker, falling back to the base editor worker for
53
+ * any label without a dedicated service (which is every plain language — its
54
+ * grammar-based highlighting needs no worker).
55
+ */
56
+ declare function configureMonacoWorkers(workers: MonacoWorkerConstructors): void;
57
+
58
+ export { type MonacoWorkerConstructor, type MonacoWorkerConstructors, configureMonacoWorkers };
@@ -0,0 +1,6 @@
1
+ import {
2
+ configureMonacoWorkers
3
+ } from "../chunk-BWPFPHWY.js";
4
+ export {
5
+ configureMonacoWorkers
6
+ };
package/dist/monaco.js CHANGED
@@ -1,3 +1,68 @@
1
1
  // src/monaco.ts
2
2
  import "monaco-editor/esm/vs/editor/editor.main.js";
3
+ import * as monaco from "monaco-editor/esm/vs/editor/editor.api.js";
4
+
5
+ // src/monacoJsonc.ts
6
+ var JSONC_LANGUAGE = {
7
+ defaultToken: "",
8
+ // Reuse Monaco's JSON token scopes so built-in and host themes color JSONC
9
+ // exactly like JSON instead of requiring JSONC-specific theme rules.
10
+ tokenPostfix: ".json",
11
+ brackets: [
12
+ { open: "{", close: "}", token: "delimiter.bracket" },
13
+ { open: "[", close: "]", token: "delimiter.array" }
14
+ ],
15
+ tokenizer: {
16
+ root: [
17
+ { include: "@whitespace" },
18
+ [/[{}[\]]/, "@brackets"],
19
+ [/[,:]/, "delimiter"],
20
+ [/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/, "number"],
21
+ [/"(?:[^"\\]|\\.)*"(?=\s*:)/, "string.key"],
22
+ [/"(?:[^"\\]|\\.)*"/, "string.value"],
23
+ [/\b(?:true|false|null)\b/, "keyword"]
24
+ ],
25
+ whitespace: [
26
+ [/[ \t\r\n]+/, ""],
27
+ [/\/\*/, "comment", "@comment"],
28
+ [/\/\/.*$/, "comment"]
29
+ ],
30
+ comment: [
31
+ [/[^*/]+/, "comment"],
32
+ [/\*\//, "comment", "@pop"],
33
+ [/[*/]/, "comment"]
34
+ ]
35
+ }
36
+ };
37
+ var JSONC_CONFIGURATION = {
38
+ comments: { lineComment: "//", blockComment: ["/*", "*/"] },
39
+ brackets: [
40
+ ["{", "}"],
41
+ ["[", "]"]
42
+ ],
43
+ autoClosingPairs: [
44
+ { open: "{", close: "}" },
45
+ { open: "[", close: "]" },
46
+ { open: '"', close: '"', notIn: ["string"] }
47
+ ],
48
+ surroundingPairs: [
49
+ { open: "{", close: "}" },
50
+ { open: "[", close: "]" },
51
+ { open: '"', close: '"' }
52
+ ]
53
+ };
54
+ function registerJsoncLanguage(monaco2) {
55
+ if (monaco2.languages.getLanguages().some(({ id }) => id === "jsonc")) return;
56
+ monaco2.languages.register({
57
+ id: "jsonc",
58
+ aliases: ["JSONC", "JSON with Comments", "jsonc"],
59
+ extensions: [".jsonc"],
60
+ mimetypes: ["application/jsonc"]
61
+ });
62
+ monaco2.languages.setLanguageConfiguration("jsonc", JSONC_CONFIGURATION);
63
+ monaco2.languages.setMonarchTokensProvider("jsonc", JSONC_LANGUAGE);
64
+ }
65
+
66
+ // src/monaco.ts
3
67
  export * from "monaco-editor/esm/vs/editor/editor.api.js";
68
+ registerJsoncLanguage(monaco);
@@ -1,4 +1,4 @@
1
- export { B as BlockTagVisibility, D as DocumentLinkCandidate, b as DocumentLinkProvider, E as EditorActions, c as EditorColorScheme, d as EditorContextValue, e as EditorMode, f as EditorProvider, g as EditorProviderProps, h as EditorShell, i as EditorShellProps, j as EditorState, k as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, l as MentionProvider, P as PreviewPanel, m as PreviewPanelProps, R as RawEditor, n as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, o as WysiwygEditor, p as WysiwygEditorProps, u as useEditorContext } from '../shell-BxSCBm4H.js';
1
+ export { B as BlockTagVisibility, D as DocumentLinkCandidate, b as DocumentLinkProvider, E as EditorActions, c as EditorColorScheme, d as EditorContextValue, e as EditorMode, f as EditorProvider, g as EditorProviderProps, h as EditorShell, i as EditorShellProps, j as EditorState, k as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, l as MentionProvider, P as PreviewPanel, m as PreviewPanelProps, R as RawEditor, n as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, o as WysiwygEditor, p as WysiwygEditorProps, u as useEditorContext } from '../shell-YIIUac26.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
4
4
  import '@bendyline/squisq/schemas';
@@ -5,7 +5,7 @@ import {
5
5
  RawEditor,
6
6
  WysiwygEditor,
7
7
  useEditorContext
8
- } from "../chunk-TRCKHRBS.js";
8
+ } from "../chunk-QN3Q64LV.js";
9
9
  import "../chunk-NITZVAXL.js";
10
10
  import "../chunk-V44VP242.js";
11
11
  import "../chunk-MJJK7YQB.js";
@@ -631,6 +631,12 @@ interface EditorShellProps {
631
631
  basePath?: string;
632
632
  /** Called when markdown source changes */
633
633
  onChange?: (source: string) => void;
634
+ /**
635
+ * Delegate link activation to the embedding host. The callback receives the
636
+ * literal href as authored. Return `false` to allow the browser's default
637
+ * navigation; any other return (or void) marks the link as handled.
638
+ */
639
+ onLinkClick?: (href: string) => boolean | undefined;
634
640
  /**
635
641
  * Light/dark chrome color scheme for the editor shell — toolbar, tabs,
636
642
  * status bar, and side panes (default: `'light'`). This is the editor's
@@ -721,6 +727,18 @@ interface EditorShellProps {
721
727
  * sense (e.g. editing free-form prompt documents). Defaults to true.
722
728
  */
723
729
  showPlayTab?: boolean;
730
+ /**
731
+ * Whether Use mode may open its audience view in a separate browser window.
732
+ * Defaults to true. Disable this in embedded hosts that block popups.
733
+ */
734
+ allowPresentationWindow?: boolean;
735
+ /**
736
+ * Whether Use mode may enter browser full screen. Defaults to true. Disable
737
+ * this in embedded hosts whose webview does not support the Fullscreen API.
738
+ */
739
+ allowPresentationFullscreen?: boolean;
740
+ /** Whether to offer print preview and browser printing. Defaults to true. */
741
+ allowPrint?: boolean;
724
742
  /**
725
743
  * Optional "submit on Enter" callback. When provided, a plain Enter
726
744
  * keypress fires this callback instead of inserting a newline, and
@@ -977,7 +995,7 @@ interface EditorShellProps {
977
995
  * Complete markdown editor shell with toolbar, view switcher, and three
978
996
  * editing modes: Raw (Monaco), WYSIWYG (Tiptap), and Preview.
979
997
  */
980
- 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;
998
+ declare function EditorShell({ initialMarkdown, initialView, articleId, basePath, onChange, onLinkClick, colorScheme, className, height, minHeight, maxHeight, mediaProvider, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, showFilesToggle, 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, placeholder, readOnly, imageSrc, imageAlt, imageMode, imageEditorContainer, onImageExport, inlinePreview, inlinePreviewWidth, outline, outlineWidth, blockTags, blockTagVisibility, themeInheritance, viewPreferences, onViewPreferencesChange, themeOverride, }: EditorShellProps): react_jsx_runtime.JSX.Element;
981
999
 
982
1000
  /**
983
1001
  * RawEditor
@@ -7390,6 +7390,7 @@
7390
7390
  }
7391
7391
  .squisq-toolbar-view-tab-label {
7392
7392
  display: inline-block;
7393
+ transform: translateY(1px);
7393
7394
  }
7394
7395
  .squisq-toolbar-view-tab-label--short {
7395
7396
  display: none;
@@ -7435,6 +7436,7 @@
7435
7436
  justify-content: center;
7436
7437
  width: 32px;
7437
7438
  height: 28px;
7439
+ padding: 2px 0 0;
7438
7440
  flex-shrink: 0;
7439
7441
  border: none;
7440
7442
  border-radius: 4px;
@@ -9387,6 +9389,9 @@
9387
9389
  text-decoration-thickness: 1px;
9388
9390
  text-underline-offset: 2px;
9389
9391
  }
9392
+ .squisq-editor-shell[data-link-handler=true] a[href] {
9393
+ cursor: pointer;
9394
+ }
9390
9395
  .squisq-wysiwyg-editor p.is-editor-empty:first-child::before {
9391
9396
  content: attr(data-placeholder);
9392
9397
  float: left;
@@ -15202,15 +15207,14 @@
15202
15207
  box-sizing: border-box;
15203
15208
  display: flex;
15204
15209
  width: 100%;
15205
- height: 240px;
15206
- min-height: 128px;
15210
+ min-height: 96px;
15207
15211
  max-height: 70vh;
15208
15212
  flex-direction: column;
15209
15213
  overflow: hidden;
15210
15214
  resize: vertical;
15211
15215
  border: 1px solid var(--squisq-border, #d1d5db);
15212
15216
  border-radius: 8px;
15213
- background: var(--squisq-surface, #ffffff);
15217
+ background: var(--squisq-surface, var(--squisq-input-bg, #ffffff));
15214
15218
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
15215
15219
  }
15216
15220
  .squisq-code-snippet-header {
@@ -15220,7 +15224,7 @@
15220
15224
  align-items: center;
15221
15225
  padding: 0 10px;
15222
15226
  border-bottom: 1px solid var(--squisq-border, #d1d5db);
15223
- background: var(--squisq-surface-muted, #f8fafc);
15227
+ background: var(--squisq-surface-muted, var(--squisq-input-bg, #f8fafc));
15224
15228
  color: var(--squisq-text-muted, #64748b);
15225
15229
  font-family: var(--squisq-ux-font, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
15226
15230
  font-size: 12px;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/squisq-editor-react",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "React editor shell with raw/WYSIWYG/preview modes for Squisq documents",
5
5
  "license": "MIT",
6
6
  "author": "Bendyline",
@@ -32,7 +32,8 @@
32
32
  "dist",
33
33
  "!dist/**/*.map",
34
34
  "LICENSE",
35
- "NOTICE.md"
35
+ "NOTICE.md",
36
+ "THIRD_PARTY_LICENSES.txt"
36
37
  ],
37
38
  "exports": {
38
39
  ".": {
@@ -43,6 +44,10 @@
43
44
  "types": "./dist/monaco.d.ts",
44
45
  "import": "./dist/monaco.js"
45
46
  },
47
+ "./monaco-workers": {
48
+ "types": "./dist/monaco-workers/index.d.ts",
49
+ "import": "./dist/monaco-workers/index.js"
50
+ },
46
51
  "./shell": {
47
52
  "types": "./dist/shell/index.d.ts",
48
53
  "import": "./dist/shell/index.js"
@@ -63,22 +68,25 @@
63
68
  "types": "./dist/teleprompter/index.d.ts",
64
69
  "import": "./dist/teleprompter/index.js"
65
70
  },
66
- "./styles": "./dist/styles/index.css"
71
+ "./styles": {
72
+ "types": "./dist/styles/index.d.ts",
73
+ "default": "./dist/styles/index.css"
74
+ }
67
75
  },
68
76
  "scripts": {
69
- "build": "tsup && node ../../scripts/build-styles.mjs && node ../../scripts/remove-empty-chunks.mjs dist",
77
+ "build": "tsup && node ../../scripts/build-styles.mjs && node ../../scripts/generate-bundle-licenses.mjs . @fortawesome/fontawesome-free && node ../../scripts/remove-empty-chunks.mjs dist",
70
78
  "dev": "concurrently -n js,dts -c blue,gray -r \"tsup --watch --no-dts --no-clean\" \"tsup --watch --dts-only --no-clean\"",
71
79
  "typecheck": "tsc --noEmit"
72
80
  },
73
81
  "peerDependencies": {
74
- "monaco-editor": ">=0.50.0",
82
+ "monaco-editor": "~0.50.0",
75
83
  "react": "^18.0.0 || ^19.0.0",
76
84
  "react-dom": "^18.0.0 || ^19.0.0"
77
85
  },
78
86
  "dependencies": {
79
- "@bendyline/squisq": "2.3.0",
80
- "@bendyline/squisq-formats": "2.3.0",
81
- "@bendyline/squisq-react": "2.3.0",
87
+ "@bendyline/squisq": "2.3.2",
88
+ "@bendyline/squisq-formats": "2.3.2",
89
+ "@bendyline/squisq-react": "2.3.2",
82
90
  "@fortawesome/fontawesome-free": "7.2.0",
83
91
  "@tiptap/extension-image": "2.27.2",
84
92
  "@tiptap/extension-link": "2.27.2",