superdoc 2.4.0-next.7 → 2.4.0-next.9

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.
@@ -843,6 +843,97 @@ export type LinkPopoverResolution = {
843
843
  * default popover.
844
844
  */
845
845
  export type LinkPopoverResolver = (ctx: LinkPopoverContext) => LinkPopoverResolution | null | undefined;
846
+ /**
847
+ * Canonical presentation settings for the built-in comments UI.
848
+ *
849
+ * Presentation only, and deliberately not the whole of `modules.comments`.
850
+ * That block also carries `readOnly` and `allowResolve`, which resolve through
851
+ * `interaction.comments`, and `permissionResolver`, which is read off
852
+ * `modules.comments` or the top-level `Config`. All three are stripped from
853
+ * this bag: policy outlives the built-in UI, so an application drawing its own
854
+ * comment surface still has to honor it. See the fields themselves, which are
855
+ * rejected by name with the spelling that applies to each.
856
+ *
857
+ * Open on purpose, for the same reason `modules.comments` is: the runtime
858
+ * merges this bag over that block and spreads the result through the comments
859
+ * store, which accepts pass-through keys. Closing it would reject working
860
+ * configurations, which is a worse failure than the missing autocomplete it
861
+ * would buy. The named fields are the ones the shell reads.
862
+ */
863
+ export type CommentsConfig = {
864
+ /** How comments present themselves as the surface narrows. */
865
+ displayMode?: 'auto' | 'sidebar' | 'inline';
866
+ /** CSS selector for an explicit width measurement target in `auto` mode. */
867
+ compactMeasurementSelector?: string;
868
+ /** Fixed compact-mode breakpoint override, in pixels. */
869
+ compactBreakpointPx?: number;
870
+ /** Comment highlight colors (internal/external and active overrides). */
871
+ highlightColors?: {
872
+ /** Base highlight color for internal comments. */
873
+ internal?: string;
874
+ /** Base highlight color for external comments. */
875
+ external?: string;
876
+ /** Active highlight color override for internal comments. */
877
+ activeInternal?: string;
878
+ /** Active highlight color override for external comments. */
879
+ activeExternal?: string;
880
+ };
881
+ /** Comment highlight opacity, active and inactive. */
882
+ highlightOpacity?: {
883
+ /** Opacity for the active comment highlight. */
884
+ active?: number;
885
+ /** Opacity for inactive comment highlights. */
886
+ inactive?: number;
887
+ };
888
+ /** Highlight color used while hovering a comment. */
889
+ highlightHoverColor?: string;
890
+ /** Tracked-change highlight colors. */
891
+ trackChangeHighlightColors?: TrackChangeHighlightColors;
892
+ /** Active tracked-change highlight colors (defaults to the above). */
893
+ trackChangeActiveHighlightColors?: TrackChangeHighlightColors;
894
+ /**
895
+ * Policy, not presentation. `normalizeUiConfig` strips all three from this
896
+ * bag before anything reads it, so accepting them here would advertise a
897
+ * setting that is silently discarded.
898
+ *
899
+ * `readOnly` and `allowResolve` belong on `interaction.comments`, where they
900
+ * resolve and keep applying to an application drawing its own comment
901
+ * surface.
902
+ *
903
+ * `permissionResolver` is collaboration wiring rather than policy, and has
904
+ * no `ui` spelling at all. `pickResolver` takes the first of
905
+ * `modules.comments.permissionResolver` and the top-level
906
+ * `Config.permissionResolver`, in that order, so either works and the
907
+ * comments-scoped one wins.
908
+ */
909
+ readOnly?: never;
910
+ allowResolve?: never;
911
+ permissionResolver?: never;
912
+ } & Record<string, unknown>;
913
+ /** Border and background colors for one tracked-change highlight state. */
914
+ export interface TrackChangeHighlightColors {
915
+ /** Border color for inserted text. */
916
+ insertBorder?: string;
917
+ /** Background color for inserted text. */
918
+ insertBackground?: string;
919
+ /** Border color for deleted text. */
920
+ deleteBorder?: string;
921
+ /** Background color for deleted text. */
922
+ deleteBackground?: string;
923
+ /** Border color for a format change. */
924
+ formatBorder?: string;
925
+ }
926
+ /**
927
+ * Canonical configuration for the chrome drawn around content controls.
928
+ *
929
+ * `chrome` is the whole option bag this surface has. `'default'` and `'none'`
930
+ * are the only values the painter and the v2 host accept; anything else is
931
+ * coerced back to `'default'`.
932
+ */
933
+ export interface ContentControlsConfig {
934
+ /** Whether SuperDoc draws its own chrome around each content control. */
935
+ chrome?: 'default' | 'none';
936
+ }
846
937
  /**
847
938
  * Canonical configuration for the built-in link popover.
848
939
  *
@@ -1664,6 +1755,17 @@ export interface FindReplaceConfig {
1664
1755
  width?: number | string;
1665
1756
  maxWidth?: number | string;
1666
1757
  maxHeight?: number | string;
1758
+ /**
1759
+ * Focus the find input when the surface opens. Defaults to `true`; set
1760
+ * `false` to leave focus wherever the user had it.
1761
+ *
1762
+ * Honored but undeclared until #1094: `useFindReplace` spreads this whole
1763
+ * bag into the surface request, and `SurfaceManager` applies it last, over
1764
+ * the `modules.surfaces.floating` defaults.
1765
+ */
1766
+ autoFocus?: boolean;
1767
+ /** Close the surface on a pointer press outside it. Defaults to `false`. */
1768
+ closeOnOutsidePointerDown?: boolean;
1667
1769
  };
1668
1770
  }
1669
1771
  /**
@@ -2668,7 +2770,7 @@ export interface UIConfig {
2668
2770
  showTableOfContentsButton?: boolean;
2669
2771
  };
2670
2772
  /** Built-in comments UI. Enabled by default. */
2671
- comments?: boolean | Record<string, unknown>;
2773
+ comments?: boolean | CommentsConfig;
2672
2774
  /** Built-in right-click and slash context menu. Enabled by default. */
2673
2775
  contextMenu?: boolean | ContextMenuConfig;
2674
2776
  /**
@@ -2676,7 +2778,7 @@ export interface UIConfig {
2676
2778
  * SuperDoc intercept Cmd+F / Ctrl+F; `editor.ui.search` stays available to
2677
2779
  * custom UI either way.
2678
2780
  */
2679
- search?: boolean | Record<string, unknown>;
2781
+ search?: boolean | FindReplaceConfig;
2680
2782
  /**
2681
2783
  * Built-in popover shown when a link is clicked. It renders by default;
2682
2784
  * pass `false` (or `ui: false`) to suppress it. Supplying a
@@ -2689,7 +2791,7 @@ export interface UIConfig {
2689
2791
  container?: string | HTMLElement;
2690
2792
  };
2691
2793
  /** Built-in chrome drawn around content controls. Enabled by default. */
2692
- contentControls?: boolean | Record<string, unknown>;
2794
+ contentControls?: boolean | ContentControlsConfig;
2693
2795
  }
2694
2796
  /**
2695
2797
  * What the user is permitted to do, as distinct from what SuperDoc draws.
@@ -9,10 +9,12 @@ import type { BorrowedSuperDocUI as __Cjs_BorrowedSuperDocUI } from './index.js'
9
9
  import type { CanPerformPermissionParams as __Cjs_CanPerformPermissionParams } from './index.js' with { "resolution-mode": "import" };
10
10
  import type { CollaborationConfig as __Cjs_CollaborationConfig } from './index.js' with { "resolution-mode": "import" };
11
11
  import type { CommentAddress as __Cjs_CommentAddress } from './index.js' with { "resolution-mode": "import" };
12
+ import type { CommentsConfig as __Cjs_CommentsConfig } from './index.js' with { "resolution-mode": "import" };
12
13
  import type { CommentsType as __Cjs_CommentsType } from './index.js' with { "resolution-mode": "import" };
13
14
  import type { Config as __Cjs_Config } from './index.js' with { "resolution-mode": "import" };
14
15
  import type { ContentControlActiveChangePayload as __Cjs_ContentControlActiveChangePayload } from './index.js' with { "resolution-mode": "import" };
15
16
  import type { ContentControlClickPayload as __Cjs_ContentControlClickPayload } from './index.js' with { "resolution-mode": "import" };
17
+ import type { ContentControlsConfig as __Cjs_ContentControlsConfig } from './index.js' with { "resolution-mode": "import" };
16
18
  import type { ContextMenuConfig as __Cjs_ContextMenuConfig } from './index.js' with { "resolution-mode": "import" };
17
19
  import type { ContextMenuContext as __Cjs_ContextMenuContext } from './index.js' with { "resolution-mode": "import" };
18
20
  import type { ContextMenuItem as __Cjs_ContextMenuItem } from './index.js' with { "resolution-mode": "import" };
@@ -165,6 +167,7 @@ import type { TextAddress as __Cjs_TextAddress } from './index.js' with { "resol
165
167
  import type { TextSegment as __Cjs_TextSegment } from './index.js' with { "resolution-mode": "import" };
166
168
  import type { TextTarget as __Cjs_TextTarget } from './index.js' with { "resolution-mode": "import" };
167
169
  import type { TrackChangeAuthor as __Cjs_TrackChangeAuthor } from './index.js' with { "resolution-mode": "import" };
170
+ import type { TrackChangeHighlightColors as __Cjs_TrackChangeHighlightColors } from './index.js' with { "resolution-mode": "import" };
168
171
  import type { TrackChangesAuthorColorsConfig as __Cjs_TrackChangesAuthorColorsConfig } from './index.js' with { "resolution-mode": "import" };
169
172
  import type { TrackChangesModuleConfig as __Cjs_TrackChangesModuleConfig } from './index.js' with { "resolution-mode": "import" };
170
173
  import type { TrackChangesSemanticColorsConfig as __Cjs_TrackChangesSemanticColorsConfig } from './index.js' with { "resolution-mode": "import" };
@@ -189,11 +192,13 @@ export declare const buildTheme: typeof import('./index.js', { with: { "resoluti
189
192
  export type { __Cjs_CanPerformPermissionParams as CanPerformPermissionParams };
190
193
  export type { __Cjs_CollaborationConfig as CollaborationConfig };
191
194
  export type { __Cjs_CommentAddress as CommentAddress };
195
+ export type { __Cjs_CommentsConfig as CommentsConfig };
192
196
  export type { __Cjs_CommentsType as CommentsType };
193
197
  export declare const compareVersions: typeof import('./index.js', { with: { "resolution-mode": "import" } }).compareVersions;
194
198
  export type { __Cjs_Config as Config };
195
199
  export type { __Cjs_ContentControlActiveChangePayload as ContentControlActiveChangePayload };
196
200
  export type { __Cjs_ContentControlClickPayload as ContentControlClickPayload };
201
+ export type { __Cjs_ContentControlsConfig as ContentControlsConfig };
197
202
  export type { __Cjs_ContextMenuConfig as ContextMenuConfig };
198
203
  export type { __Cjs_ContextMenuContext as ContextMenuContext };
199
204
  export type { __Cjs_ContextMenuItem as ContextMenuItem };
@@ -353,6 +358,7 @@ export type { __Cjs_TextAddress as TextAddress };
353
358
  export type { __Cjs_TextSegment as TextSegment };
354
359
  export type { __Cjs_TextTarget as TextTarget };
355
360
  export type { __Cjs_TrackChangeAuthor as TrackChangeAuthor };
361
+ export type { __Cjs_TrackChangeHighlightColors as TrackChangeHighlightColors };
356
362
  export type { __Cjs_TrackChangesAuthorColorsConfig as TrackChangesAuthorColorsConfig };
357
363
  export type { __Cjs_TrackChangesModuleConfig as TrackChangesModuleConfig };
358
364
  export type { __Cjs_TrackChangesSemanticColorsConfig as TrackChangesSemanticColorsConfig };
@@ -72,6 +72,9 @@ export type { SuperDocLayoutEngineOptions as LayoutEngineOptions } from '../core
72
72
  export type { FlowBlock, FlowMode, Layout, Fragment as LayoutFragment, Page as LayoutPage } from '../../../layout-engine/contracts/src/index.js';
73
73
  export type { LayoutMetrics } from '../../../layout-engine/layout-bridge/src/index.js';
74
74
  export type { LayoutMode } from '../../../layout-engine/painters/dom/src/index.js';
75
+ export type { CommentsConfig } from '../core/types/index.js';
76
+ export type { TrackChangeHighlightColors } from '../core/types/index.js';
77
+ export type { ContentControlsConfig } from '../core/types/index.js';
75
78
  export type { LinkPopoverConfig } from '../core/types/index.js';
76
79
  export type { LinkPopoverContext } from '../core/types/index.js';
77
80
  export type { LinkPopoverResolution } from '../core/types/index.js';
@@ -837,7 +837,19 @@ export interface CommentsHandle extends SnapshotSubscribable<CommentsSlice> {
837
837
  list(query?: CommentsListQuery): readonly CommentInfo[];
838
838
  /** Resolve a single comment by id from the best-known loaded state. */
839
839
  getById(commentId: string): CommentInfo | null;
840
- /** Create a comment from a frozen selection capture. */
840
+ /**
841
+ * Create a comment from a frozen selection capture.
842
+ *
843
+ * A capture carrying neither `target` nor `selectionTarget` fails closed with
844
+ * the same `NO_SELECTION` receipt {@link createFromSelection} mints for an
845
+ * empty selection, because both describe the same user-visible mistake:
846
+ * commenting with nothing selected. A capture that *has* a target which no
847
+ * longer resolves is a different failure, and keeps the Document API's own
848
+ * receipt so the reason stays specific.
849
+ *
850
+ * `capturedAt` is provenance for the consumer, not an expiry. A capture stays
851
+ * usable while its target resolves; elapsed time alone never invalidates it.
852
+ */
841
853
  createFromCapture(capture: CommentAnchorCapture, input: {
842
854
  text: string;
843
855
  }): WorkflowReceipt;
@@ -853,6 +865,18 @@ export interface CommentsHandle extends SnapshotSubscribable<CommentsSlice> {
853
865
  reply(commentId: string, input: {
854
866
  text: string;
855
867
  }): WorkflowReceipt;
868
+ /**
869
+ * Replace a comment's body text through the Document API
870
+ * (`comments.patch({ commentId, text })`).
871
+ *
872
+ * Gated by the comments `readOnly` policy like every other comment write.
873
+ * `allowResolve` is deliberately NOT consulted: that policy forbids only the
874
+ * resolve/reopen transition, and an application that may not resolve threads
875
+ * can still let an author correct their own wording.
876
+ */
877
+ edit(commentId: string, input: {
878
+ text: string;
879
+ }): WorkflowReceipt;
856
880
  /** Mark a comment resolved. */
857
881
  resolve(commentId: string): WorkflowReceipt;
858
882
  /** Reopen a resolved comment. */
package/dist/superdoc.cjs CHANGED
@@ -4,7 +4,7 @@ const require_blank_docx = require("./chunks/blank-docx-DP8RUPW-.cjs");
4
4
  const require_eventemitter3 = require("./chunks/eventemitter3-DqY4aSMf.cjs");
5
5
  const require_uuid = require("./chunks/uuid-CFp0WGVU.cjs");
6
6
  const require_jszip = require("./chunks/jszip-Cs9JBLlJ.cjs");
7
- const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-sMXbYzhs.cjs");
7
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-ByvmsAAG.cjs");
8
8
  const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-CZ1Nl59K.cjs");
9
9
  const require_constants = require("./chunks/constants-D7TNtyJd.cjs");
10
10
  let vue = require("vue");
@@ -15409,7 +15409,7 @@ function useFindReplace({ getSurfaceManager, getActiveEditor, activeEditorRef, g
15409
15409
  } else {
15410
15410
  let FindReplaceSurface;
15411
15411
  try {
15412
- FindReplaceSurface = (await Promise.resolve().then(() => require("./chunks/FindReplaceSurface-C-I4GcRE.cjs"))).default;
15412
+ FindReplaceSurface = (await Promise.resolve().then(() => require("./chunks/FindReplaceSurface-9VkPw_-X.cjs"))).default;
15413
15413
  } catch {
15414
15414
  opening = false;
15415
15415
  return;
@@ -39357,7 +39357,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
39357
39357
  this.config.colors = shuffleArray(this.config.colors);
39358
39358
  this.userColorMap = /* @__PURE__ */ new Map();
39359
39359
  this.colorIndex = 0;
39360
- this.version = "2.4.0-next.7";
39360
+ this.version = "2.4.0-next.9";
39361
39361
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
39362
39362
  this.superdocId = config.superdocId || require_uuid.v4_default();
39363
39363
  this.colors = this.config.colors ?? [];
@@ -3,7 +3,7 @@ import { t as blank_default } from "./chunks/blank-docx-XRX6Ker2.es.js";
3
3
  import { t as import_eventemitter3 } from "./chunks/eventemitter3-Bt2s0X0a.es.js";
4
4
  import { t as v4_default } from "./chunks/uuid-B2Sqk-3p.es.js";
5
5
  import { a as init_dist$1, i as global, n as init_dist$2, o as Buffer, r as process$1, s as init_dist, t as require_jszip_min } from "./chunks/jszip-C8srOKAO.es.js";
6
- import { a as createV2ReviewMutationReconciler, c as DOM_CLASS_NAMES, i as isV2EditableTextMutationEvent, o as getV2TrackedChangeMutationImpact, s as composeAuthorColorResolver, t as createSuperDocUI } from "./chunks/create-super-doc-ui-BquF8bnZ.es.js";
6
+ import { a as createV2ReviewMutationReconciler, c as DOM_CLASS_NAMES, i as isV2EditableTextMutationEvent, o as getV2TrackedChangeMutationImpact, s as composeAuthorColorResolver, t as createSuperDocUI } from "./chunks/create-super-doc-ui-DBXOhHdW.es.js";
7
7
  import { t as __plugin_vue_export_helper_default } from "./chunks/_plugin-vue_export-helper-DSMAhhwD.es.js";
8
8
  import { n as PDF_TO_CSS_UNITS } from "./chunks/constants-BfH0br5u.es.js";
9
9
  import * as Vue from "vue";
@@ -15383,7 +15383,7 @@ function useFindReplace({ getSurfaceManager, getActiveEditor, activeEditorRef, g
15383
15383
  } else {
15384
15384
  let FindReplaceSurface;
15385
15385
  try {
15386
- FindReplaceSurface = (await import("./chunks/FindReplaceSurface-B_1Ksbr0.es.js")).default;
15386
+ FindReplaceSurface = (await import("./chunks/FindReplaceSurface-BuvaIrQ5.es.js")).default;
15387
15387
  } catch {
15388
15388
  opening = false;
15389
15389
  return;
@@ -39290,7 +39290,7 @@ var SuperDoc = class extends import_eventemitter3.default {
39290
39290
  this.config.colors = shuffleArray(this.config.colors);
39291
39291
  this.userColorMap = /* @__PURE__ */ new Map();
39292
39292
  this.colorIndex = 0;
39293
- this.version = "2.4.0-next.7";
39293
+ this.version = "2.4.0-next.9";
39294
39294
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
39295
39295
  this.superdocId = config.superdocId || v4_default();
39296
39296
  this.colors = this.config.colors ?? [];