@stll/folio-vue 0.28.0 → 0.29.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 (61) hide show
  1. package/README.md +5 -0
  2. package/dist/{SplitCellDialog-Dge_CE-B.cjs → SplitCellDialog-Bc2TjxMb.cjs} +1 -1
  3. package/dist/{SplitCellDialog-Vl4gq22E.js → SplitCellDialog-DULmbU_P.js} +6 -6
  4. package/dist/StylePicker-CD28Jh8D.cjs +4 -0
  5. package/dist/{StylePicker-CfC5Ef1i.js → StylePicker-D8VHvoMT.js} +664 -591
  6. package/dist/components/AnonymizationRectsOverlay.vue.d.ts +7 -4
  7. package/dist/components/AutocompleteSuggestionOverlay.vue.d.ts +5 -0
  8. package/dist/components/ContentControlWidgetsOverlay.vue.d.ts +5 -1
  9. package/dist/components/DocumentOutline.vue.d.ts +2 -0
  10. package/dist/components/DocxEditor/DocxEditorDialogs.vue.d.ts +3 -2
  11. package/dist/components/DocxEditor/pagedEditorRef.d.ts +11 -9
  12. package/dist/components/DocxEditor/types.d.ts +81 -18
  13. package/dist/components/DocxEditor.vue.d.ts +1 -1
  14. package/dist/components/FormattingBar.types.d.ts +2 -1
  15. package/dist/components/ReviewControls.vue.d.ts +2 -2
  16. package/dist/components/Toolbar.vue.d.ts +6 -5
  17. package/dist/components/UnifiedSidebar.vue.d.ts +3 -0
  18. package/dist/components/dialogs/FootnotePropertiesDialog.vue.d.ts +2 -2
  19. package/dist/components/dialogs/ImagePositionDialog.vue.d.ts +2 -2
  20. package/dist/components/dialogs/PageSetupDialog.vue.d.ts +4 -3
  21. package/dist/components/dialogs/SetNumberingValueDialog.vue.d.ts +2 -2
  22. package/dist/components/dialogs/TablePropertiesDialog.vue.d.ts +2 -2
  23. package/dist/components/dialogs/WatermarkDialog.vue.d.ts +4 -3
  24. package/dist/components/sidebar/CommentCard.vue.d.ts +2 -2
  25. package/dist/components/ui/ColorPicker.vue.d.ts +2 -1
  26. package/dist/components/ui/HorizontalRuler.vue.d.ts +4 -3
  27. package/dist/components/ui/TableBorderColorPicker.vue.d.ts +2 -1
  28. package/dist/components/ui/TableCellFillPicker.vue.d.ts +2 -1
  29. package/dist/components/ui/TableToolbar.vue.d.ts +2 -1
  30. package/dist/components/ui/VerticalRuler.vue.d.ts +3 -2
  31. package/dist/composables/commentMarks.d.ts +5 -14
  32. package/dist/composables/documentChrome.d.ts +14 -0
  33. package/dist/composables/useCommentLifecycle.d.ts +0 -2
  34. package/dist/composables/useCommentManagement.d.ts +5 -0
  35. package/dist/composables/useDocxEditor.d.ts +59 -15
  36. package/dist/composables/useDocxEditorRefApi.d.ts +20 -15
  37. package/dist/composables/useFontLifecycle.d.ts +2 -3
  38. package/dist/composables/useOutlineDrawerFocus.d.ts +1 -1
  39. package/dist/composables/usePageSetupControls.d.ts +2 -2
  40. package/dist/composables/usePagesPointer.d.ts +3 -2
  41. package/dist/composables/useParagraphStyleOptions.d.ts +2 -1
  42. package/dist/composables/useTableResize.d.ts +6 -1
  43. package/dist/composables.cjs +1 -1
  44. package/dist/composables.js +1 -1
  45. package/dist/dialogs.cjs +1 -1
  46. package/dist/dialogs.js +1 -1
  47. package/dist/folio-vue.css +1 -1
  48. package/dist/index.cjs +1 -1
  49. package/dist/index.d.ts +4 -4
  50. package/dist/index.js +2355 -2262
  51. package/dist/ui.cjs +1 -1
  52. package/dist/ui.js +28 -28
  53. package/dist/useZoom-BGTTHZwV.js +1119 -0
  54. package/dist/useZoom-u9lZMwJR.cjs +1 -0
  55. package/dist/utils/listItems.d.ts +7 -0
  56. package/dist/utils/rawDocument.d.ts +13 -0
  57. package/dist/utils/stylePreview.d.ts +2 -1
  58. package/package.json +9 -9
  59. package/dist/StylePicker-Bgu0Slqa.cjs +0 -4
  60. package/dist/useZoom-CKHgvyHZ.js +0 -1014
  61. package/dist/useZoom-Db3Q3xP7.cjs +0 -1
@@ -1,6 +1,7 @@
1
1
  import { SectionProperties } from '@stll/folio-core/types/document';
2
+ import { DeepReadonly } from '@stll/folio-core/types/documentModel';
2
3
  type __VLS_Props = {
3
- sectionProps?: SectionProperties | null;
4
+ sectionProps?: DeepReadonly<SectionProperties> | null;
4
5
  zoom?: number;
5
6
  editable?: boolean;
6
7
  unit?: "inch" | "cm";
@@ -13,8 +14,8 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {
13
14
  "onBottom-margin-change"?: (twips: number) => any;
14
15
  }>, {
15
16
  unit: "cm" | "inch";
16
- editable: boolean;
17
17
  zoom: number;
18
+ editable: boolean;
18
19
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
19
20
  declare const _default: typeof __VLS_export;
20
21
  export default _default;
@@ -1,4 +1,8 @@
1
- import { EditorView } from 'prosemirror-view';
1
+ /**
2
+ * The range the Vue adapter's add-comment flow comments on. The highlight and
3
+ * the thread's marks come from core's comment records; this picks the range,
4
+ * as React's `commentAnchors.ts` does.
5
+ */
2
6
  export type CommentMarkRange = {
3
7
  from: number;
4
8
  to: number;
@@ -17,16 +21,3 @@ export type ResolveCommentCreationRangeOptions = {
17
21
  savedRange: CommentMarkRange | null;
18
22
  };
19
23
  export declare function resolveCommentCreationRange({ docSize, capturedRange, currentRange, savedRange, }: ResolveCommentCreationRangeOptions): CommentMarkRange | null;
20
- export type ApplyCommentMarkOptions = {
21
- replacePending?: boolean;
22
- selectEnd?: boolean;
23
- };
24
- /**
25
- * Add a `comment` mark for `commentId` over `range`. With `replacePending` the
26
- * placeholder mark (PENDING_COMMENT_ID) is removed from the range first so a
27
- * pre-existing real comment the selection overlaps is left intact. Returns
28
- * false when the schema lacks the mark or the range is empty.
29
- */
30
- export declare function applyCommentMarkRange(view: EditorView, range: CommentMarkRange, commentId: number, options?: ApplyCommentMarkOptions): boolean;
31
- /** Strip the pending placeholder comment mark from `range` (cancel add-comment). */
32
- export declare function removePendingCommentMarkRange(view: EditorView, range: CommentMarkRange): void;
@@ -0,0 +1,14 @@
1
+ import { SectionProperties, Style } from '@stll/folio-core/types/document';
2
+ import { DeepReadonly, ReadonlyDocument } from '@stll/folio-core/types/documentModel';
3
+ import { Watermark } from '@stll/folio-core/watermark';
4
+ /**
5
+ * The document-wide values the toolbar, the rulers and the page setup controls
6
+ * show. Derived from the document model by reading it, never from a document
7
+ * built for the purpose, so deriving them costs nothing per keystroke.
8
+ */
9
+ export type DocumentChrome = {
10
+ sectionProperties: DeepReadonly<SectionProperties> | null;
11
+ watermark: DeepReadonly<Watermark> | undefined;
12
+ styles: DeepReadonly<Style[]> | undefined;
13
+ };
14
+ export declare const documentChrome: (document: ReadonlyDocument | null) => DocumentChrome;
@@ -17,8 +17,6 @@ export type UseCommentLifecycleOptions = {
17
17
  readOnly: Ref<boolean>;
18
18
  /** Build a comment with a freshly-allocated id (from useCommentManagement). */
19
19
  createComment: (text: string, parentId?: number) => Comment;
20
- /** Append a comment + emit the change (from useCommentManagement). */
21
- pushComment: (comment: Comment) => void;
22
20
  /** The session kind controls whether draft highlights belong in ProseMirror. */
23
21
  sessionKind: () => "canonical" | "prosemirror";
24
22
  /** Null selects the legacy comment-mark route; false means canonical refusal. */
@@ -12,6 +12,11 @@ export type UseCommentManagementOptions = {
12
12
  commentsProp: () => Comment[] | undefined;
13
13
  /** Fires on every comment-list mutation (controlled and uncontrolled). */
14
14
  onCommentsChange: (comments: Comment[]) => void;
15
+ /**
16
+ * Whether the comments are a canonical room's: the controlled prop then
17
+ * only reports them and is never read back into the session.
18
+ */
19
+ commentsFromRoom?: () => boolean;
15
20
  /** Reactive invalidation for the canonical document reader. */
16
21
  canonicalTick?: Ref<number>;
17
22
  /** Re-run layout after a mutation that changed marks in the document. */
@@ -1,7 +1,10 @@
1
1
  import { EditorState, Plugin } from 'prosemirror-state';
2
2
  import { EditorView } from 'prosemirror-view';
3
3
  import { MaybeRefOrGetter, Ref } from 'vue';
4
- import { FolioEditor } from '@stll/folio-core/controller/folioEditor';
4
+ import { CanonicalHistoryDrop, CanonicalHistoryEffect } from '@stll/folio-core/canonical/canonicalSession';
5
+ import { FolioAnonymizationTerm } from '@stll/folio-core/controller/anonymizationHighlights';
6
+ import { CanonicalRoomCollaboration } from '@stll/folio-core/controller/canonicalRoomEditor';
7
+ import { FolioEditor, FolioSaveOptions } from '@stll/folio-core/controller/folioEditor';
5
8
  import { HeaderFooterPartKind } from '@stll/folio-core/controller/headerFooterEditorManager';
6
9
  import { HiddenProseMirrorCollaboration, HiddenProseMirrorRemoteSelection } from '@stll/folio-core/controller/hiddenEditorManager';
7
10
  import { NoteStoryKey } from '@stll/folio-core/controller/noteEditorManager';
@@ -13,10 +16,12 @@ import { DisplayMode } from '@stll/folio-core/managers/EditorModeManager';
13
16
  import { LayoutSelectionGate } from '@stll/folio-core/paged-layout/LayoutSelectionGate';
14
17
  import { HistoryShortcutOwner } from '@stll/folio-core/prosemirror/extensions/core/HistoryExtension';
15
18
  import { CommandMap } from '@stll/folio-core/prosemirror/extensions/types';
16
- import { AnonymizationMatch } from '@stll/folio-core/prosemirror/plugins/anonymizationDecorations';
17
19
  import { TemplateSlashMenuKeyAction, TemplateSlashMenuState } from '@stll/folio-core/prosemirror/plugins/templateSlashMenu';
20
+ import { FolioAutocompleteState } from '@stll/folio-core/types/autocomplete';
21
+ import { EditorSession } from '@stll/folio-core/types/canonicalCapabilities';
18
22
  import { Comment } from '@stll/folio-core/types/content';
19
23
  import { Document } from '@stll/folio-core/types/document';
24
+ import { ReadonlyDocument } from '@stll/folio-core/types/documentModel';
20
25
  import { DocxInput } from '@stll/folio-core/utils/docxInput';
21
26
  export type UseDocxEditorOptions = {
22
27
  /**
@@ -35,8 +40,13 @@ export type UseDocxEditorOptions = {
35
40
  pagesContainer: Ref<HTMLElement | null>;
36
41
  /** Whether the editor is read-only. Reactive. */
37
42
  readOnly?: MaybeRefOrGetter<boolean>;
38
- /** Experimental plain-text canonical session; unsupported edits are refused. */
39
- experimentalSession?: MaybeRefOrGetter<"canonical" | undefined>;
43
+ /**
44
+ * The editing engine. Unset, the editor runs the canonical session, which
45
+ * refuses an edit it cannot make yet with a notice, or the legacy session
46
+ * when `collaboration` is a Yjs fragment. `"legacy"` selects the
47
+ * ProseMirror-owned engine.
48
+ */
49
+ experimentalSession?: MaybeRefOrGetter<EditorSession | undefined>;
40
50
  /** Gap between pages in pixels. */
41
51
  pageGap?: number;
42
52
  /** Whether to paint each page's effective body-content boundary. Reactive. */
@@ -66,15 +76,17 @@ export type UseDocxEditorOptions = {
66
76
  externalPlugins?: readonly Plugin[];
67
77
  /** Who answers the undo and redo keys. Read once, when the editor is created. */
68
78
  historyShortcuts?: HistoryShortcutOwner;
69
- /** Reactive Yjs collaboration owner and the ProseMirror binding plugins. */
70
- collaboration?: MaybeRefOrGetter<UseDocxEditorCollaboration | undefined>;
79
+ /** A canonical commit was published, with what it did to the undo history. */
80
+ onCanonicalHistory?: (effect: CanonicalHistoryEffect) => void;
81
+ /** A peer's edit dropped local history steps, counted from the bottom. */
82
+ onCanonicalHistoryDrop?: (drop: CanonicalHistoryDrop) => void;
71
83
  /**
72
- * Fires with the anonymization decoration plugin's current match list on
73
- * mount, term push, and every doc edit. The anonymization plugin is always
74
- * installed (inert until terms are pushed via `setAnonymizationTermsMeta`),
75
- * mirroring the React adapter.
84
+ * Reactive collaboration: the canonical room the canonical session joins,
85
+ * or the Yjs fragment a legacy session edits with its binding plugins.
76
86
  */
77
- onAnonymizationMatchesChange?: (matches: readonly AnonymizationMatch[]) => void;
87
+ collaboration?: MaybeRefOrGetter<UseDocxEditorCollaboration | CanonicalRoomCollaboration | undefined>;
88
+ /** The terms the editor highlights in the shown text; none when unset. */
89
+ getAnonymizationTerms?: () => readonly FolioAnonymizationTerm[] | undefined;
78
90
  /**
79
91
  * Install the template-directive + slash-menu plugins so `{{...}}` markers are
80
92
  * scanned and the `/` trigger is active. Reactive: toggling reconfigures the
@@ -86,6 +98,8 @@ export type UseDocxEditorOptions = {
86
98
  onSlashMenuChange?: (state: TemplateSlashMenuState) => void;
87
99
  /** Resolves a navigation/commit key while the slash menu is open. */
88
100
  onSlashMenuKeyAction?: (action: TemplateSlashMenuKeyAction) => boolean;
101
+ /** Called after each change of the inline suggestion, including view teardown. */
102
+ onAutocompleteChange?: (state: FolioAutocompleteState) => void;
89
103
  /** Callback on document change (debounced PM → Document model conversion). */
90
104
  onChange?: (doc: Document) => void;
91
105
  /** Callback on parse / layout / lifecycle error. */
@@ -154,6 +168,28 @@ export type UseDocxEditorReturn = {
154
168
  parseError: Ref<string | null>;
155
169
  /** Computed page layout, or null before first paint. */
156
170
  layout: Ref<Layout | null>;
171
+ /**
172
+ * The document model the editor holds, to derive toolbar and overlay state
173
+ * from: in a canonical session the session's own document, replaced on each
174
+ * edit (read it, never hand it out); otherwise the document the last change
175
+ * notification wrote back. Reading it never builds a document.
176
+ */
177
+ modelDocument: Readonly<Ref<ReadonlyDocument | null>>;
178
+ /**
179
+ * The session's own document in a canonical session, read without a copy
180
+ * (read it, never write it); otherwise null.
181
+ */
182
+ readDocumentModel: () => ReadonlyDocument | null;
183
+ /**
184
+ * The bytes the current document was loaded from: replaced when a document
185
+ * is loaded or set, never by an edit.
186
+ */
187
+ sourceBuffer: Readonly<Ref<ArrayBuffer | null>>;
188
+ /**
189
+ * Width in pixels of the first section's text column, for the hidden editor
190
+ * to lay out its content at; 0 before the first layout pass.
191
+ */
192
+ hiddenEditorWidth: Ref<number>;
157
193
  /** Flow blocks from the latest layout pass — the range-projection fallback. */
158
194
  blocks: Ref<FlowBlock[]>;
159
195
  /** Measures from the latest layout pass — the range-projection fallback. */
@@ -165,11 +201,19 @@ export type UseDocxEditorReturn = {
165
201
  /** Load an already-parsed `Document` directly. */
166
202
  loadDocument: (doc: Document) => void;
167
203
  /** Serialize the current document to a DOCX blob. */
168
- save: (options?: {
169
- selective?: boolean;
170
- }) => Promise<Blob | null>;
171
- /** Snapshot the current document model. */
204
+ save: (options?: FolioSaveOptions) => Promise<Blob | null>;
205
+ /**
206
+ * Build a copy of the current document, in time proportional to its size.
207
+ * For a host that owns the result; derived state reads `modelDocument`.
208
+ */
172
209
  getDocument: () => Document | null;
210
+ /**
211
+ * The current document for a reader, never copied: what `getDocument`
212
+ * copies. In a canonical session it is `readDocumentModel`'s, the session's
213
+ * own document; otherwise the document built from the editor state. Read
214
+ * it, never write it or hand it on.
215
+ */
216
+ readDocument: () => ReadonlyDocument | null;
173
217
  /** Publish a fresh Document object (e.g. after HF materialisation). */
174
218
  setDocument: (doc: Document) => void;
175
219
  /** Resolve a persistent header/footer EditorView by relationship id. */
@@ -1,28 +1,37 @@
1
1
  import { EditorView } from 'prosemirror-view';
2
2
  import { Ref } from 'vue';
3
- import { OpStory } from '@stll/folio-core/controller/canonicalOperations';
4
- import { FolioEditor } from '@stll/folio-core/controller/folioEditor';
3
+ import { OpStory } from '@stll/folio-core/canonical/canonicalOperations';
4
+ import { FolioEditor, FolioSaveOptions } from '@stll/folio-core/controller/folioEditor';
5
5
  import { Layout } from '@stll/folio-core/layout-engine';
6
6
  import { DisplayMode, EditorReadOnlyReason } from '@stll/folio-core/managers/EditorModeManager';
7
+ import { EditorSession } from '@stll/folio-core/types/canonicalCapabilities';
7
8
  import { Comment } from '@stll/folio-core/types/content';
8
9
  import { Document } from '@stll/folio-core/types/document';
10
+ import { ReadonlyDocument } from '@stll/folio-core/types/documentModel';
9
11
  import { DocxEditorRef } from '../components/DocxEditor/types';
10
12
  import { UseFindReplaceReturn } from './useFindReplace';
13
+ type OperationView = Pick<EditorView, "state" | "dispatch">;
11
14
  type StagedOperationCommentsOptions<Result extends {
12
15
  applied: readonly {
13
16
  commentId?: number;
14
17
  }[];
15
18
  }> = {
19
+ view: OperationView;
16
20
  createComment: (text: string) => Comment;
17
21
  publishComments: (comments: Comment[]) => void;
18
- apply: (createCommentId: (text: string) => number) => Result;
22
+ apply: (createCommentId: (text: string) => number, view: OperationView) => Result;
19
23
  };
20
- /** Publish only committed operations' comments, after the applier returns. */
24
+ /**
25
+ * Run a document operation whose comments join the editor's records in the
26
+ * operation's own transaction, so one undo takes both back. A state without
27
+ * records gets only the committed operations' comments, published after the
28
+ * applier returns.
29
+ */
21
30
  export declare const applyWithStagedOperationComments: <Result extends {
22
31
  applied: readonly {
23
32
  commentId?: number;
24
33
  }[];
25
- }>({ createComment, publishComments, apply, }: StagedOperationCommentsOptions<Result>) => Result;
34
+ }>({ view, createComment, publishComments, apply, }: StagedOperationCommentsOptions<Result>) => Result;
26
35
  export type UseDocxEditorRefApiOptions = {
27
36
  getReadOnlyReason?: () => EditorReadOnlyReason | null;
28
37
  /** Headless controller handle (imperative API + events; Seam 6). */
@@ -87,16 +96,16 @@ export type UseDocxEditorRefApiOptions = {
87
96
  setComments: (comments: Comment[]) => void;
88
97
  focus: () => void;
89
98
  getDocument: () => Document | null;
99
+ /** The session's own document in a canonical session, without a copy; otherwise null. */
100
+ readDocumentModel: () => ReadonlyDocument | null;
90
101
  getActiveView: () => EditorView | null;
91
- getExperimentalSession?: () => "canonical" | undefined;
102
+ getExperimentalSession?: () => EditorSession | undefined;
92
103
  getActiveCanonicalStory?: () => OpStory;
93
104
  closeNoteStory: () => void;
94
105
  getHeaderFooterView: (rId: string) => EditorView | null;
95
106
  setZoom: (zoom: number) => void;
96
107
  /** Serialize and commit a host-facing save through useDocxEditor. */
97
- saveDocument: (options?: {
98
- selective?: boolean;
99
- }) => Promise<Blob | null>;
108
+ saveDocument: (options?: FolioSaveOptions) => Promise<Blob | null>;
100
109
  /**
101
110
  * Open the find/replace panel. Backs `openFind` and `openReplace`: the Vue
102
111
  * panel has a single open state, so both land here.
@@ -111,13 +120,9 @@ export type UseDocxEditorRefApiOptions = {
111
120
  type SaveDocumentForHostOptions = {
112
121
  clearCommentsDirty: () => void;
113
122
  onSave: ((buffer: ArrayBuffer) => void) | undefined;
114
- saveDocument: (options?: {
115
- selective?: boolean;
116
- }) => Promise<Blob | null>;
123
+ saveDocument: (options?: FolioSaveOptions) => Promise<Blob | null>;
117
124
  };
118
- export declare const saveDocumentForHost: (host: SaveDocumentForHostOptions, options?: {
119
- selective?: boolean;
120
- }) => Promise<ArrayBuffer | null>;
125
+ export declare const saveDocumentForHost: (host: SaveDocumentForHostOptions, options?: FolioSaveOptions) => Promise<ArrayBuffer | null>;
121
126
  export declare function useDocxEditorRefApi(opts: UseDocxEditorRefApiOptions): {
122
127
  exposed: DocxEditorRef;
123
128
  };
@@ -3,9 +3,8 @@ import { FontDefinition } from '../components/DocxEditor/types';
3
3
  import { LoadedEmbeddedFonts } from '../utils/embeddedFonts';
4
4
  export type UseFontLifecycleOptions = {
5
5
  isReady: Ref<boolean>;
6
- getDocument: () => {
7
- originalBuffer?: ArrayBuffer | null;
8
- } | null;
6
+ /** The bytes the current document was loaded from, if any. */
7
+ sourceBuffer: () => ArrayBuffer | null;
9
8
  fonts: () => ReadonlyArray<FontDefinition> | undefined;
10
9
  remeasure: () => void;
11
10
  setEmbeddedFontFamilies: (families: ReadonlyMap<string, string> | null) => void;
@@ -1,5 +1,5 @@
1
1
  import { MaybeRefOrGetter, Ref } from 'vue';
2
- export type OutlineSurface = "column" | "rail" | "drawer";
2
+ export type OutlineSurface = "column" | "rail" | "expanded";
3
3
  type UseOutlineDrawerFocusOptions = {
4
4
  surface: MaybeRefOrGetter<OutlineSurface>;
5
5
  available: MaybeRefOrGetter<boolean>;
@@ -11,7 +11,7 @@ export type UsePageSetupControlsOptions = {
11
11
  * Notified after a direct section-properties write (margins, page size,
12
12
  * orientation) so the host's `onChange` fires. These writes bypass the PM
13
13
  * transaction pipeline, so this is their only change signal; ruler indent /
14
- * tab-stop edits dispatch PM commands and notify via the pipeline instead.
14
+ * tab-stop edits run through the view's command owner and notify via the pipeline instead.
15
15
  */
16
16
  onChange: (doc: Document) => void;
17
17
  /** Canonical sessions publish section properties through the Document journal. */
@@ -26,5 +26,5 @@ export declare function usePageSetupControls(opts: UsePageSetupControlsOptions):
26
26
  handleIndentLeftChange: (twips: number) => void;
27
27
  handleIndentRightChange: (twips: number) => void;
28
28
  handleFirstLineIndentChange: (twips: number) => void;
29
- handleTabStopRemove: (positionTwips: number) => void;
29
+ handleTabStopRemove: (position: number) => void;
30
30
  };
@@ -2,9 +2,10 @@ import { Node as PMNode } from 'prosemirror-model';
2
2
  import { Command } from 'prosemirror-state';
3
3
  import { EditorView } from 'prosemirror-view';
4
4
  import { Ref, ShallowRef } from 'vue';
5
- import { DocumentOp } from '@stll/folio-core/controller/canonicalOperations';
5
+ import { DocumentOp } from '@stll/folio-core/canonical/canonicalOperations';
6
6
  import { NoteStoryKey } from '@stll/folio-core/controller/noteEditorManager';
7
7
  import { Layout } from '@stll/folio-core/layout-engine';
8
+ import { EditorSession } from '@stll/folio-core/types/canonicalCapabilities';
8
9
  import { Document } from '@stll/folio-core/types/document';
9
10
  import { ImageSelectionInfo } from '../components/imageSelectionTypes';
10
11
  import { HyperlinkPopupData } from '../components/ui/hyperlinkPopupTypes';
@@ -47,7 +48,7 @@ export type UsePagesPointerOptions = {
47
48
  hyperlinkPopupData: Ref<HyperlinkPopupData | null>;
48
49
  readOnly: Ref<boolean>;
49
50
  showHeaderFooterEditing: Ref<boolean>;
50
- getExperimentalSession?: () => "canonical" | undefined;
51
+ getExperimentalSession?: () => EditorSession | undefined;
51
52
  applyCanonicalOperations?: (operations: readonly DocumentOp[]) => boolean;
52
53
  zoom: Ref<number>;
53
54
  layout: Ref<Layout | null>;
@@ -1,5 +1,6 @@
1
1
  import { ComputedRef } from 'vue';
2
2
  import { Style } from '@stll/folio-core/types/document';
3
+ import { DeepReadonly } from '@stll/folio-core/types/documentModel';
3
4
  import { TranslationKey } from '../components/Toolbar/presets';
4
5
  import { StylePreviewProps } from '../utils/stylePreview';
5
6
  export type ResolvedStyle = {
@@ -12,7 +13,7 @@ export type UseParagraphStyleOptionsReturn = {
12
13
  currentStyleLabel: ComputedRef<string>;
13
14
  };
14
15
  export declare function useParagraphStyleOptions(opts: {
15
- documentStyles: () => Style[] | undefined;
16
+ documentStyles: () => DeepReadonly<Style[]> | undefined;
16
17
  currentStyleId: () => string;
17
18
  t: (key: TranslationKey) => string;
18
19
  }): UseParagraphStyleOptionsReturn;
@@ -1,7 +1,12 @@
1
+ import { Command } from 'prosemirror-state';
1
2
  import { EditorView } from 'prosemirror-view';
2
3
  export type UseTableResizeReturn = {
3
4
  tryStartResize: (e: MouseEvent, view: EditorView) => boolean;
4
5
  install: () => () => void;
5
6
  isResizing: () => boolean;
6
7
  };
7
- export declare function useTableResize(): UseTableResizeReturn;
8
+ export type UseTableResizeOptions = {
9
+ /** Run a resize command in the view the resize started in. */
10
+ runCommand: (view: EditorView, command: Command) => void;
11
+ };
12
+ export declare function useTableResize({ runCommand, }: UseTableResizeOptions): UseTableResizeReturn;
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useZoom-Db3Q3xP7.cjs");let t=require("vue"),n=require("@stll/folio-core/utils/textEncoding"),r=require("prosemirror-history"),i=require("@stll/folio-core/utils/documentPointerDown"),a=require("@stll/folio-core/managers/ClipboardManager"),o=require("@stll/folio-core/utils/clipboard"),s=require("@stll/folio-core/managers/TableSelectionManager"),c=require("@stll/folio-core/prosemirror/utils/visualLineNavigation"),l=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges");function u(e={}){let{onCopy:r,onCut:i,onPaste:a,cleanWordFormatting:s=!0,editable:c=!0,onError:l}=e,u=(0,t.ref)(!1),d=(0,t.ref)(null),f=l?{onError:l}:{};async function p(e){if(u.value)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&r?.(e),t}finally{u.value=!1}}async function m(e){if(u.value||!c)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&i?.(e),t}finally{u.value=!1}}async function h(e=!1){if(u.value||!c)return null;u.value=!0;try{if(navigator.clipboard&&navigator.clipboard.read){let t=await navigator.clipboard.read(),r=``,i=``;for(let e of t)e.types.includes(`text/html`)&&(r=await(0,n.readBlobText)(await e.getType(`text/html`))),e.types.includes(`text/plain`)&&(i=await(0,n.readBlobText)(await e.getType(`text/plain`)));e&&(r=``);let c=(0,o.parseClipboardHtml)(r,i,s);return d.value=c,a?.(c,e),c}return null}catch(e){return l?.(e instanceof Error?e:Error(String(e))),null}finally{u.value=!1}}return{copy:p,cut:m,paste:h,isProcessing:u,lastPastedContent:d}}function d({isOpen:e,onClose:n,align:r=`left`}){let a=(0,t.ref)(null),o=(0,t.ref)(null),s=(0,t.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:1e4});function c(e,t){s.value={position:`fixed`,top:e+`px`,left:t+`px`,zIndex:1e4}}function l(e){let t=e.target;t instanceof Node&&a.value&&!a.value.contains(t)&&o.value&&!o.value.contains(t)&&n()}function u(e){e.key===`Escape`&&n()}function d(e){let t=e.target;t instanceof Node&&o.value&&o.value.contains(t)||n()}let f;function p(){f=(0,i.onDocumentPointerDown)(document,l),document.addEventListener(`keydown`,u),window.addEventListener(`scroll`,d,!0)}function m(){f?.(),f=void 0,document.removeEventListener(`keydown`,u),window.removeEventListener(`scroll`,d,!0)}(0,t.watch)(e,e=>{if(!e){m();return}let t=a.value;if(!t)return;let n=t.getBoundingClientRect();r===`right`?requestAnimationFrame(()=>{let e=o.value;if(e){let t=e.getBoundingClientRect();c(n.bottom+4,n.right-t.width)}else c(n.bottom+4,n.left)}):c(n.bottom+4,n.left),p()}),(0,t.onScopeDispose)(m);function h(e){e.preventDefault(),e.stopPropagation()}return{containerRef:a,dropdownRef:o,dropdownStyle:s,handleMouseDown:h}}function f(e,n){let i=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.undoDepth)(t.state)>0:!1}),a=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.redoDepth)(t.state)>0:!1});function o(){let t=e.value;return t?(0,r.undo)(t.state,t.dispatch):!1}function s(){let t=e.value;return t?(0,r.redo)(t.state,t.dispatch):!1}return{canUndo:i,canRedo:a,undo:o,redo:s}}var p={backgroundColor:`rgba(26, 115, 232, 0.3)`,borderRadius:0,zIndex:0,opacity:1,mixBlendMode:`multiply`};function m(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return[];let n=t.getRangeAt(0);if(e&&!e.contains(n.commonAncestorContainer))return[];let r=0,i=0;if(e){let t=e.getBoundingClientRect();r=t.left+e.scrollLeft,i=t.top+e.scrollTop}let a=[];for(let e of n.getClientRects())(e.width!==0||e.height!==0)&&a.push({left:e.left-r,top:e.top-i,width:e.width,height:e.height});return a}function h(e,t=2){if(e.length<=1)return e;let n=[...e].sort((e,n)=>Math.abs(e.top-n.top)<t?e.left-n.left:e.top-n.top),r=n[0];if(!r)return e;let i=[],a={...r};for(let e=1;e<n.length;e++){let r=n[e];if(!r)continue;let o=Math.abs(r.top-a.top)<t,s=r.left<=a.left+a.width+t;if(o&&s){let e=Math.max(a.left+a.width,r.left+r.width);a.width=e-a.left,a.height=Math.max(a.height,r.height)}else i.push(a),a={...r}}return i.push(a),i}function g(e){return h(m(e))}function _(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function v(e){let t=window.getSelection();return!t||t.rangeCount===0?!1:e.contains(t.getRangeAt(0).commonAncestorContainer)}var y=`docx-selection-styles`,b=null;function x(){b&&=(b.remove(),null),document.getElementById(y)?.remove()}function S(e=p){x();let t=`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useZoom-u9lZMwJR.cjs");let t=require("vue"),n=require("@stll/folio-core/utils/textEncoding"),r=require("prosemirror-history"),i=require("@stll/folio-core/utils/documentPointerDown"),a=require("@stll/folio-core/managers/ClipboardManager"),o=require("@stll/folio-core/utils/clipboard"),s=require("@stll/folio-core/managers/TableSelectionManager"),c=require("@stll/folio-core/prosemirror/utils/visualLineNavigation"),l=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges");function u(e={}){let{onCopy:r,onCut:i,onPaste:a,cleanWordFormatting:s=!0,editable:c=!0,onError:l}=e,u=(0,t.ref)(!1),d=(0,t.ref)(null),f=l?{onError:l}:{};async function p(e){if(u.value)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&r?.(e),t}finally{u.value=!1}}async function m(e){if(u.value||!c)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&i?.(e),t}finally{u.value=!1}}async function h(e=!1){if(u.value||!c)return null;u.value=!0;try{if(navigator.clipboard&&navigator.clipboard.read){let t=await navigator.clipboard.read(),r=``,i=``;for(let e of t)e.types.includes(`text/html`)&&(r=await(0,n.readBlobText)(await e.getType(`text/html`))),e.types.includes(`text/plain`)&&(i=await(0,n.readBlobText)(await e.getType(`text/plain`)));e&&(r=``);let c=(0,o.parseClipboardHtml)(r,i,s);return d.value=c,a?.(c,e),c}return null}catch(e){return l?.(e instanceof Error?e:Error(String(e))),null}finally{u.value=!1}}return{copy:p,cut:m,paste:h,isProcessing:u,lastPastedContent:d}}function d({isOpen:e,onClose:n,align:r=`left`}){let a=(0,t.ref)(null),o=(0,t.ref)(null),s=(0,t.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:1e4});function c(e,t){s.value={position:`fixed`,top:e+`px`,left:t+`px`,zIndex:1e4}}function l(e){let t=e.target;t instanceof Node&&a.value&&!a.value.contains(t)&&o.value&&!o.value.contains(t)&&n()}function u(e){e.key===`Escape`&&n()}function d(e){let t=e.target;t instanceof Node&&o.value&&o.value.contains(t)||n()}let f;function p(){f=(0,i.onDocumentPointerDown)(document,l),document.addEventListener(`keydown`,u),window.addEventListener(`scroll`,d,!0)}function m(){f?.(),f=void 0,document.removeEventListener(`keydown`,u),window.removeEventListener(`scroll`,d,!0)}(0,t.watch)(e,e=>{if(!e){m();return}let t=a.value;if(!t)return;let n=t.getBoundingClientRect();r===`right`?requestAnimationFrame(()=>{let e=o.value;if(e){let t=e.getBoundingClientRect();c(n.bottom+4,n.right-t.width)}else c(n.bottom+4,n.left)}):c(n.bottom+4,n.left),p()}),(0,t.onScopeDispose)(m);function h(e){e.preventDefault(),e.stopPropagation()}return{containerRef:a,dropdownRef:o,dropdownStyle:s,handleMouseDown:h}}function f(e,n){let i=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.undoDepth)(t.state)>0:!1}),a=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.redoDepth)(t.state)>0:!1});function o(){let t=e.value;return t?(0,r.undo)(t.state,t.dispatch):!1}function s(){let t=e.value;return t?(0,r.redo)(t.state,t.dispatch):!1}return{canUndo:i,canRedo:a,undo:o,redo:s}}var p={backgroundColor:`rgba(26, 115, 232, 0.3)`,borderRadius:0,zIndex:0,opacity:1,mixBlendMode:`multiply`};function m(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return[];let n=t.getRangeAt(0);if(e&&!e.contains(n.commonAncestorContainer))return[];let r=0,i=0;if(e){let t=e.getBoundingClientRect();r=t.left+e.scrollLeft,i=t.top+e.scrollTop}let a=[];for(let e of n.getClientRects())(e.width!==0||e.height!==0)&&a.push({left:e.left-r,top:e.top-i,width:e.width,height:e.height});return a}function h(e,t=2){if(e.length<=1)return e;let n=[...e].sort((e,n)=>Math.abs(e.top-n.top)<t?e.left-n.left:e.top-n.top),r=n[0];if(!r)return e;let i=[],a={...r};for(let e=1;e<n.length;e++){let r=n[e];if(!r)continue;let o=Math.abs(r.top-a.top)<t,s=r.left<=a.left+a.width+t;if(o&&s){let e=Math.max(a.left+a.width,r.left+r.width);a.width=e-a.left,a.height=Math.max(a.height,r.height)}else i.push(a),a={...r}}return i.push(a),i}function g(e){return h(m(e))}function _(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function v(e){let t=window.getSelection();return!t||t.rangeCount===0?!1:e.contains(t.getRangeAt(0).commonAncestorContainer)}var y=`docx-selection-styles`,b=null;function x(){b&&=(b.remove(),null),document.getElementById(y)?.remove()}function S(e=p){x();let t=`
2
2
  /* DOCX Editor Selection Highlighting */
3
3
 
4
4
  .docx-editor [contenteditable="true"]::selection,
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./useZoom-CKHgvyHZ.js";
1
+ import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./useZoom-BGTTHZwV.js";
2
2
  import { computed as d, onBeforeUnmount as f, onMounted as p, onScopeDispose as m, ref as h, watch as g } from "vue";
3
3
  import { readBlobText as _ } from "@stll/folio-core/utils/textEncoding";
4
4
  import { redo as v, redoDepth as y, undo as b, undoDepth as x } from "prosemirror-history";
package/dist/dialogs.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./SplitCellDialog-Dge_CE-B.cjs");exports.FindReplaceDialog=e.m,exports.FootnotePropertiesDialog=e.s,exports.HyperlinkDialog=e.p,exports.ImagePositionDialog=e.o,exports.ImagePropertiesDialog=e.f,exports.InsertImageDialog=e.a,exports.InsertSymbolDialog=e.d,exports.InsertTableDialog=e.r,exports.PageSetupDialog=e.u,exports.PasteSpecialDialog=e.n,exports.SplitCellDialog=e.t,exports.TablePropertiesDialog=e.l,exports.WatermarkDialog=e.c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./SplitCellDialog-Bc2TjxMb.cjs");exports.FindReplaceDialog=e.m,exports.FootnotePropertiesDialog=e.s,exports.HyperlinkDialog=e.p,exports.ImagePositionDialog=e.o,exports.ImagePropertiesDialog=e.f,exports.InsertImageDialog=e.a,exports.InsertSymbolDialog=e.d,exports.InsertTableDialog=e.r,exports.PageSetupDialog=e.u,exports.PasteSpecialDialog=e.n,exports.SplitCellDialog=e.t,exports.TablePropertiesDialog=e.l,exports.WatermarkDialog=e.c;
package/dist/dialogs.js CHANGED
@@ -1 +1 @@
1
- export { m as FindReplaceDialog, s as FootnotePropertiesDialog, p as HyperlinkDialog, o as ImagePositionDialog, f as ImagePropertiesDialog, a as InsertImageDialog, d as InsertSymbolDialog, r as InsertTableDialog, u as PageSetupDialog, n as PasteSpecialDialog, t as SplitCellDialog, l as TablePropertiesDialog, c as WatermarkDialog } from "./SplitCellDialog-Vl4gq22E.js";
1
+ export { m as FindReplaceDialog, s as FootnotePropertiesDialog, p as HyperlinkDialog, o as ImagePositionDialog, f as ImagePropertiesDialog, a as InsertImageDialog, d as InsertSymbolDialog, r as InsertTableDialog, u as PageSetupDialog, n as PasteSpecialDialog, t as SplitCellDialog, l as TablePropertiesDialog, c as WatermarkDialog } from "./SplitCellDialog-DULmbU_P.js";