superdoc 2.18.1-next.5 → 2.19.0-next.2

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 (42) hide show
  1. package/dist/chunks/{create-super-doc-ui-C3HDE1IE.es.js → create-super-doc-ui-BFJ9Y0YV.cjs} +1396 -1
  2. package/dist/chunks/{create-super-doc-ui-Gxk1m05U.cjs → create-super-doc-ui-Dfw1b6h_.es.js} +1318 -66
  3. package/dist/collaboration-upgrade-engine.cjs +1 -1
  4. package/dist/collaboration-upgrade-engine.es.js +1 -1
  5. package/dist/document-api/src/contract/command-catalog.d.ts +1 -1
  6. package/dist/document-api/src/contract/operation-definitions.d.ts +9 -0
  7. package/dist/document-api/src/index.d.ts +1 -0
  8. package/dist/document-api/src/types/track-changes.types.d.ts +35 -2
  9. package/dist/document-api/src/validation-primitives.d.ts +1 -1
  10. package/dist/document-api/src/watermarks/watermarks.d.ts +4 -1
  11. package/dist/document-api/src/watermarks/watermarks.types.d.ts +34 -0
  12. package/dist/layout-engine/painters/dom/src/index.d.ts +2 -0
  13. package/dist/public/ui-react.cjs +1 -1
  14. package/dist/public/ui-react.es.js +1 -1
  15. package/dist/public/ui-vue.cjs +1 -1
  16. package/dist/public/ui-vue.es.js +1 -1
  17. package/dist/public/ui.cjs +1 -1
  18. package/dist/public/ui.es.js +1 -1
  19. package/dist/style.css +596 -80
  20. package/dist/style.layered.css +597 -81
  21. package/dist/superdoc/src/components/surfaces/WatermarkSurface.vue.d.ts +16 -0
  22. package/dist/superdoc/src/components/surfaces/watermark-surface-runtime.d.ts +8 -0
  23. package/dist/superdoc/src/core/SuperDoc.d.ts +8 -7
  24. package/dist/superdoc/src/core/types/index.d.ts +36 -18
  25. package/dist/superdoc/src/internal/toolbar/built-in/OverflowMenu.vue.d.ts +93 -1
  26. package/dist/superdoc/src/internal/toolbar/built-in/Toolbar.vue.d.ts +3 -1
  27. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarDropdown.vue.d.ts +1 -0
  28. package/dist/superdoc/src/internal/toolbar/built-in/toolbarIcons.d.ts +1 -0
  29. package/dist/superdoc/src/internal/toolbar/built-in/toolbarTexts.d.ts +1 -0
  30. package/dist/superdoc/src/internal/toolbar/built-in-toolbar.d.ts +3 -0
  31. package/dist/superdoc/src/public/ui/types.d.ts +10 -1
  32. package/dist/superdoc/src/public/ui/watermark-controller.d.ts +32 -0
  33. package/dist/superdoc/src/public/ui/watermark-dialog-state.d.ts +66 -0
  34. package/dist/superdoc/src/public/ui/watermark-draft.d.ts +6 -0
  35. package/dist/superdoc/src/public/ui.d.cts +12 -0
  36. package/dist/superdoc/src/public/ui.d.ts +1 -1
  37. package/dist/superdoc.cjs +110 -174
  38. package/dist/superdoc.es.js +108 -172
  39. package/dist-cdn/style.layered.css +1 -1
  40. package/dist-cdn/superdoc.min.css +1 -1
  41. package/dist-cdn/superdoc.min.js +38 -37
  42. package/package.json +2 -2
@@ -0,0 +1,16 @@
1
+ import { WatermarkDialogModel } from '../../public/ui/watermark-dialog-state.js';
2
+ type __VLS_Props = {
3
+ model: WatermarkDialogModel;
4
+ surfaceId?: string;
5
+ mode?: string;
6
+ request?: object;
7
+ resolve?: (value?: unknown) => void;
8
+ close?: (reason?: string) => void;
9
+ };
10
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
+ close: (reason?: string) => void;
12
+ surfaceId: string;
13
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
14
+ fileInput: HTMLInputElement;
15
+ }, HTMLFormElement>;
16
+ export default _default;
@@ -0,0 +1,8 @@
1
+ /** The runtime owns its Vue component; consumers only need the surface request value. */
2
+ export function createWatermarkSurfaceRuntime(getContainer?: () => HTMLElement | null): {
3
+ component: unknown;
4
+ captureFocusReturn(): (isCurrent: () => boolean) => Promise<void>;
5
+ mount(): void;
6
+ announce(message: string): void;
7
+ destroy(): void;
8
+ };
@@ -149,15 +149,16 @@ export declare class SuperDoc extends EventEmitter<SuperDocEventMap> {
149
149
  * and throw a clear lifecycle error instead.
150
150
  */
151
151
  users: User[];
152
- /** Yjs document for collaboration; set in `#init` when collaboration is enabled, otherwise undefined. */
152
+ /**
153
+ * Not set in v2. SuperDoc owns the collaboration `Y.Doc` inside its
154
+ * collaboration worker and does not expose it on the main thread.
155
+ */
153
156
  ydoc: Y.Doc | undefined;
154
157
  /**
155
- * Provider for the SuperDoc-level collaboration room (separate from
156
- * per-document providers). Widened to `CollaborationProvider` to match
157
- * the runtime, which stores whatever provider the consumer passed via
158
- * `Config.modules.collaboration.provider`. Consumers needing Hocuspocus-
159
- * specific members must narrow before use.
160
- *
158
+ * Collaboration provider facade for the active v2 room. It is not a
159
+ * provider instance: SuperDoc owns the provider inside its collaboration
160
+ * worker, and this object only offers `sendStateless(message)`. It is
161
+ * `undefined` or `null` when no room is open.
161
162
  */
162
163
  provider: CollaborationProvider | undefined;
163
164
  /**
@@ -1023,14 +1023,16 @@ export interface Document {
1023
1023
  isNewFile?: boolean;
1024
1024
  /** Password for this encrypted DOCX. Overrides top-level `Config.password`. */
1025
1025
  password?: string;
1026
- /** The Yjs document for collaboration. */
1026
+ /**
1027
+ * Not set in v2 and cannot be supplied. SuperDoc owns the collaboration
1028
+ * `Y.Doc` inside its worker; configure the room with `collaboration`.
1029
+ */
1027
1030
  ydoc?: YDoc;
1028
1031
  /**
1029
- * The provider for collaboration. Widened from `HocuspocusProvider` to
1030
- * `CollaborationProvider` to match the runtime, which stores whatever
1031
- * provider the consumer passed via `Config.modules.collaboration.provider`
1032
- * (HocuspocusProvider, LiveblocksYjsProvider, TiptapCollabProvider, etc.).
1033
- * Consumers needing Hocuspocus-specific members must narrow before use.
1032
+ * Collaboration provider facade for this document's v2 room. It is not a
1033
+ * provider instance and cannot be supplied: SuperDoc owns the provider
1034
+ * inside its collaboration worker, and this object only offers
1035
+ * `sendStateless(message)`. Configure the room with `collaboration`.
1034
1036
  */
1035
1037
  provider?: CollaborationProvider;
1036
1038
  /**
@@ -1143,19 +1145,30 @@ export interface RuntimeDocument extends Document {
1143
1145
  */
1144
1146
  removeComments?: () => void;
1145
1147
  }
1146
- /** Collaboration module configuration. */
1148
+ /**
1149
+ * SuperDoc v1 collaboration module configuration.
1150
+ *
1151
+ * SuperDoc v2 rejects this configuration at runtime: it owns the `Y.Doc` and
1152
+ * provider inside its collaboration worker, so it neither attaches an external
1153
+ * `{ ydoc, provider }` pair nor opens the internal provider these fields
1154
+ * describe. Configure a room with `document.collaboration`
1155
+ * (`DocumentCollaborationConfig`) instead. To keep an existing provider setup,
1156
+ * see https://docs.superdoc.dev/editor/collaboration/use-your-own-provider
1157
+ *
1158
+ * @deprecated replaceWith=`DocumentCollaborationConfig` removeIn=v3.0
1159
+ */
1147
1160
  export interface CollaborationConfig {
1148
- /** External Yjs document (provider-agnostic mode). */
1161
+ /** SuperDoc v1 external Yjs document. Rejected by v2, which owns its `Y.Doc`. */
1149
1162
  ydoc?: YDoc;
1150
- /** External collaboration provider (provider-agnostic mode). */
1163
+ /** SuperDoc v1 external provider. Rejected by v2, which owns its provider. */
1151
1164
  provider?: CollaborationProvider;
1152
- /** Internal provider type (deprecated). */
1165
+ /** SuperDoc v1 internal provider type. Use `DocumentCollaborationConfig.providerType`. */
1153
1166
  providerType?: 'hocuspocus' | 'superdoc';
1154
- /** WebSocket URL for internal provider (deprecated). */
1167
+ /** SuperDoc v1 internal provider URL. Use `DocumentCollaborationConfig` `serverUrl`. */
1155
1168
  url?: string;
1156
- /** Authentication token for internal provider (deprecated). */
1169
+ /** SuperDoc v1 internal provider token. Use `DocumentCollaborationConfig` `token`. */
1157
1170
  token?: string;
1158
- /** Additional params for internal provider (deprecated). */
1171
+ /** SuperDoc v1 internal provider params. Use `DocumentCollaborationConfig` `params`. */
1159
1172
  params?: object;
1160
1173
  }
1161
1174
  /**
@@ -2548,7 +2561,12 @@ export interface Modules {
2548
2561
  /** Canvas render scale (quality). */
2549
2562
  outputScale?: number;
2550
2563
  } & Record<string, unknown>;
2551
- /** Collaboration module configuration. */
2564
+ /**
2565
+ * SuperDoc v1 collaboration module. SuperDoc v2 refuses it at runtime and
2566
+ * attaches nothing; configure `document.collaboration` instead.
2567
+ *
2568
+ * @deprecated replaceWith=`Document.collaboration` removeIn=v3.0
2569
+ */
2552
2570
  collaboration?: CollaborationConfig;
2553
2571
  /**
2554
2572
  * Toolbar module configuration. Pass `true` to configure the toolbar with
@@ -3559,13 +3577,13 @@ export interface SuperDocZoomConfig {
3559
3577
  /** The three regions rendered by the built-in toolbar. */
3560
3578
  export type ToolbarRegion = 'left' | 'center' | 'right';
3561
3579
  /** Built-in controls accepted by `ui.toolbar.items` and `excludeItems`. */
3562
- export type ToolbarItemId = 'undo' | 'redo' | 'track-changes-accept-selection' | 'track-changes-reject-selection' | 'search' | 'zoom' | 'font-family' | 'font-size' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'text-color' | 'highlight-color' | 'link' | 'image' | 'table-of-contents' | 'table' | 'table-actions' | 'text-align' | 'bullet-list' | 'numbered-list' | 'indent-decrease' | 'indent-increase' | 'line-height' | 'linked-style' | 'ruler' | 'measurement-unit' | 'formatting-marks' | 'copy-format' | 'clear-formatting' | 'ai' | 'document-mode';
3580
+ export type ToolbarItemId = 'undo' | 'redo' | 'track-changes-accept-selection' | 'track-changes-reject-selection' | 'search' | 'zoom' | 'font-family' | 'font-size' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'text-color' | 'highlight-color' | 'link' | 'image' | 'table-of-contents' | 'watermark' | 'table' | 'table-actions' | 'text-align' | 'bullet-list' | 'numbered-list' | 'indent-decrease' | 'indent-increase' | 'line-height' | 'linked-style' | 'ruler' | 'measurement-unit' | 'formatting-marks' | 'copy-format' | 'clear-formatting' | 'ai' | 'document-mode';
3563
3581
  /** Controls that `includeItems` can add to the default toolbar. */
3564
- export type ToolbarOptionalItemId = 'formatting-marks' | 'table-of-contents';
3582
+ export type ToolbarOptionalItemId = 'formatting-marks' | 'table-of-contents' | 'watermark';
3565
3583
  /** Slots whose built-in toolbar icon can be replaced. */
3566
- export type ToolbarIconId = 'undo' | 'redo' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'text-color' | 'link' | 'image' | 'table-of-contents' | 'align-left' | 'align-right' | 'align-center' | 'align-justify' | 'bullet-list' | 'numbered-list' | 'indent-decrease' | 'indent-increase' | 'track-changes-accept-selection' | 'track-changes-reject-selection' | 'document-mode' | 'document-mode-editing' | 'document-mode-suggesting' | 'document-mode-viewing' | 'overflow' | 'ruler' | 'linked-style' | 'highlight-color' | 'ai' | 'table' | 'table-actions' | 'split-cell' | 'merge-cells' | 'insert-row-before' | 'insert-row-after' | 'insert-column-before' | 'insert-column-after' | 'delete-row' | 'delete-column' | 'delete-table' | 'remove-borders' | 'fix-tables' | 'line-height' | 'search' | 'formatting-marks' | 'copy-format' | 'clear-formatting';
3584
+ export type ToolbarIconId = 'undo' | 'redo' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'text-color' | 'link' | 'image' | 'table-of-contents' | 'watermark' | 'align-left' | 'align-right' | 'align-center' | 'align-justify' | 'bullet-list' | 'numbered-list' | 'indent-decrease' | 'indent-increase' | 'track-changes-accept-selection' | 'track-changes-reject-selection' | 'document-mode' | 'document-mode-editing' | 'document-mode-suggesting' | 'document-mode-viewing' | 'overflow' | 'ruler' | 'linked-style' | 'highlight-color' | 'ai' | 'table' | 'table-actions' | 'split-cell' | 'merge-cells' | 'insert-row-before' | 'insert-row-after' | 'insert-column-before' | 'insert-column-after' | 'delete-row' | 'delete-column' | 'delete-table' | 'remove-borders' | 'fix-tables' | 'line-height' | 'search' | 'formatting-marks' | 'copy-format' | 'clear-formatting';
3567
3585
  /** Text slots whose built-in label or tooltip can be replaced. */
3568
- export type ToolbarStringId = 'bold' | 'font-family' | 'ai' | 'font-size' | 'italic' | 'underline' | 'highlight-color' | 'strikethrough' | 'text-color' | 'search' | 'link' | 'image' | 'table-of-contents' | 'table' | 'table-actions' | 'insert-row-before' | 'insert-row-after' | 'insert-column-before' | 'insert-column-after' | 'delete-row' | 'delete-column' | 'delete-table' | 'remove-borders' | 'merge-cells' | 'split-cell' | 'fix-tables' | 'text-align' | 'bullet-list' | 'numbered-list' | 'indent-decrease' | 'indent-increase' | 'zoom' | 'measurement-unit' | 'undo' | 'redo' | 'track-changes-accept-selection' | 'track-changes-reject-selection' | 'clear-formatting' | 'copy-format' | 'line-height' | 'linked-style-label' | 'ruler' | 'formatting-marks' | 'linked-style' | 'document-mode-editing' | 'document-mode-suggesting' | 'document-mode-viewing' | 'document-mode-editing-description' | 'document-mode-suggesting-description' | 'document-mode-viewing-description';
3586
+ export type ToolbarStringId = 'bold' | 'font-family' | 'ai' | 'font-size' | 'italic' | 'underline' | 'highlight-color' | 'strikethrough' | 'text-color' | 'search' | 'link' | 'image' | 'table-of-contents' | 'watermark' | 'table' | 'table-actions' | 'insert-row-before' | 'insert-row-after' | 'insert-column-before' | 'insert-column-after' | 'delete-row' | 'delete-column' | 'delete-table' | 'remove-borders' | 'merge-cells' | 'split-cell' | 'fix-tables' | 'text-align' | 'bullet-list' | 'numbered-list' | 'indent-decrease' | 'indent-increase' | 'zoom' | 'measurement-unit' | 'undo' | 'redo' | 'track-changes-accept-selection' | 'track-changes-reject-selection' | 'clear-formatting' | 'copy-format' | 'line-height' | 'linked-style-label' | 'ruler' | 'formatting-marks' | 'linked-style' | 'document-mode-editing' | 'document-mode-suggesting' | 'document-mode-viewing' | 'document-mode-editing-description' | 'document-mode-suggesting-description' | 'document-mode-viewing-description';
3569
3587
  /** One selectable option in a custom toolbar dropdown. */
3570
3588
  export interface ToolbarCustomOption {
3571
3589
  /** Stable option identity. Also used as the selected value when `value` is omitted. */
@@ -8,5 +8,97 @@ declare const _default: import('vue').DefineComponent<{}, {
8
8
  readonly toolbarItem?: Record<string, any> | undefined;
9
9
  readonly overflowItems?: unknown[] | undefined;
10
10
  };
11
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
11
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
12
+ dropdown: ({
13
+ $: import('vue').ComponentInternalInstance;
14
+ $data: {};
15
+ $props: Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>;
16
+ $attrs: import('vue').Attrs;
17
+ $refs: {
18
+ [x: string]: unknown;
19
+ } & {
20
+ triggerRef: HTMLDivElement;
21
+ menuRef: HTMLDivElement;
22
+ };
23
+ $slots: Readonly<{
24
+ [name: string]: import('vue').Slot<any> | undefined;
25
+ }>;
26
+ $root: import('vue').ComponentPublicInstance | null;
27
+ $parent: import('vue').ComponentPublicInstance | null;
28
+ $host: Element | null;
29
+ $emit: (event: string, ...args: any[]) => void;
30
+ $el: HTMLDivElement;
31
+ $options: import('vue').ComponentOptionsBase<Readonly<{}> & Readonly<{}>, {
32
+ focusTrigger: () => void;
33
+ $emit: (event: "select" | "update:show", ...args: any[]) => void;
34
+ placement: string;
35
+ options: unknown[];
36
+ disabled: boolean;
37
+ contentStyle: Record<string, any>;
38
+ show: boolean;
39
+ menuProps: Function;
40
+ nodeProps: Function;
41
+ closeOnEscape: boolean;
42
+ hasOpenChild: boolean;
43
+ $props: {
44
+ readonly placement?: string | undefined;
45
+ readonly options?: unknown[] | undefined;
46
+ readonly disabled?: boolean | undefined;
47
+ readonly contentStyle?: Record<string, any> | undefined;
48
+ readonly show?: boolean | undefined;
49
+ readonly menuProps?: Function | undefined;
50
+ readonly nodeProps?: Function | undefined;
51
+ readonly closeOnEscape?: boolean | undefined;
52
+ readonly hasOpenChild?: boolean | undefined;
53
+ };
54
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
55
+ beforeCreate?: (() => void) | (() => void)[];
56
+ created?: (() => void) | (() => void)[];
57
+ beforeMount?: (() => void) | (() => void)[];
58
+ mounted?: (() => void) | (() => void)[];
59
+ beforeUpdate?: (() => void) | (() => void)[];
60
+ updated?: (() => void) | (() => void)[];
61
+ activated?: (() => void) | (() => void)[];
62
+ deactivated?: (() => void) | (() => void)[];
63
+ beforeDestroy?: (() => void) | (() => void)[];
64
+ beforeUnmount?: (() => void) | (() => void)[];
65
+ destroyed?: (() => void) | (() => void)[];
66
+ unmounted?: (() => void) | (() => void)[];
67
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
68
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
69
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
70
+ };
71
+ $forceUpdate: () => void;
72
+ $nextTick: typeof import('vue').nextTick;
73
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
74
+ } & Readonly<{}> & Omit<Readonly<{}> & Readonly<{}>, "placement" | "options" | "$props" | "$emit" | "disabled" | "contentStyle" | "show" | "menuProps" | "nodeProps" | "closeOnEscape" | "hasOpenChild" | "focusTrigger"> & {
75
+ focusTrigger: () => void;
76
+ $emit: (event: "select" | "update:show", ...args: any[]) => void;
77
+ placement: string;
78
+ options: unknown[];
79
+ disabled: boolean;
80
+ contentStyle: Record<string, any>;
81
+ show: boolean;
82
+ menuProps: Function;
83
+ nodeProps: Function;
84
+ closeOnEscape: boolean;
85
+ hasOpenChild: boolean;
86
+ $props: {
87
+ readonly placement?: string | undefined;
88
+ readonly options?: unknown[] | undefined;
89
+ readonly disabled?: boolean | undefined;
90
+ readonly contentStyle?: Record<string, any> | undefined;
91
+ readonly show?: boolean | undefined;
92
+ readonly menuProps?: Function | undefined;
93
+ readonly nodeProps?: Function | undefined;
94
+ readonly closeOnEscape?: boolean | undefined;
95
+ readonly hasOpenChild?: boolean | undefined;
96
+ };
97
+ } & {} & import('vue').ComponentCustomProperties & {} & {
98
+ $slots: {
99
+ trigger?(_: {}): any;
100
+ menu?(_: {}): any;
101
+ };
102
+ }) | null;
103
+ }, HTMLDivElement>;
12
104
  export default _default;
@@ -1,4 +1,6 @@
1
1
  declare const _default: import('vue').DefineComponent<{}, {
2
2
  $emit: (event: "select" | "toggle" | "command", ...args: any[]) => void;
3
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
3
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
4
+ toolbarRoot: HTMLDivElement;
5
+ }, HTMLDivElement>;
4
6
  export default _default;
@@ -4,6 +4,7 @@ type __VLS_WithTemplateSlots<T, S> = T & (new () => {
4
4
  $slots: S;
5
5
  });
6
6
  declare const __VLS_component: import('vue').DefineComponent<{}, {
7
+ focusTrigger: () => void;
7
8
  $emit: (event: "select" | "update:show", ...args: any[]) => void;
8
9
  placement: string;
9
10
  options: unknown[];
@@ -8,6 +8,7 @@ export namespace toolbarIcons {
8
8
  export { linkIconSvg as link };
9
9
  export { imageIconSvg as image };
10
10
  export { tocIconSvg as tableOfContents };
11
+ export { watermarkIconSvg as watermark };
11
12
  export { alignLeftIconSvg as alignLeft };
12
13
  export { alignRightIconSvg as alignRight };
13
14
  export { alignCenterIconSvg as alignCenter };
@@ -12,6 +12,7 @@ export namespace toolbarTexts {
12
12
  let link: string;
13
13
  let image: string;
14
14
  let tableOfContents: string;
15
+ let watermark: string;
15
16
  let table: string;
16
17
  let tableActions: string;
17
18
  let addRowBefore: string;
@@ -33,6 +33,7 @@ export class BuiltInToolbar extends EventEmitter<string | symbol, any> {
33
33
  link: any;
34
34
  image: any;
35
35
  tableOfContents: any;
36
+ watermark: any;
36
37
  alignLeft: any;
37
38
  alignRight: any;
38
39
  alignCenter: any;
@@ -113,6 +114,7 @@ export class BuiltInToolbar extends EventEmitter<string | symbol, any> {
113
114
  link: string;
114
115
  image: string;
115
116
  tableOfContents: string;
117
+ watermark: string;
116
118
  table: string;
117
119
  tableActions: string;
118
120
  addRowBefore: string;
@@ -166,6 +168,7 @@ export class BuiltInToolbar extends EventEmitter<string | symbol, any> {
166
168
  customButtons: never[];
167
169
  showFormattingMarksButton: boolean;
168
170
  showTableOfContentsButton: boolean;
171
+ showWatermarkButton: boolean;
169
172
  };
170
173
  toolbarItems: any[];
171
174
  overflowItems: any[];
@@ -30,7 +30,7 @@ import { BuiltInCommandId } from './commands.js';
30
30
  * (`scripts/ensure-types.cjs` `rewriteDocApiPaths`), so no bare private
31
31
  * specifier leaks into the emitted `.d.ts`.
32
32
  */
33
- export type { Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, DocumentApi, EntityAddress, CommentsListQuery as DocumentApiCommentsListQuery, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, ContentControlTarget, RichContentInsertInput, OperationCapabilityResolveResult, SDHtmlMarkdownSupportCheckResult, PictureWatermarkInput, TextWatermark, WatermarkInfo, WatermarkTarget, } from '../../../../document-api/src/index.js';
33
+ export type { Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, DocumentApi, EntityAddress, CommentsListQuery as DocumentApiCommentsListQuery, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, ContentControlTarget, RichContentInsertInput, OperationCapabilityResolveResult, SDHtmlMarkdownSupportCheckResult, PictureWatermarkInput, RetainedPictureWatermarkInput, TextWatermark, WatermarkInfo, WatermarkTarget, WatermarksApplyInput, WatermarksApplyResult, WatermarksApplySuccess, WatermarksApplyTarget, } from '../../../../document-api/src/index.js';
34
34
  export type { StyleCatalogView, StyleCatalogItemType, StyleCatalogFilterType, StyleProvenance, StyleCatalogItemVisibility, StyleCatalogItemUsage, StyleCatalogItemPreview, StyleCatalogItem, StyleCatalogDefaults, StyleCatalogDiagnostic, StyleCatalogSourceStatus, StylesGetCatalogInput, StylesGetCatalogResult, } from '../../../../document-api/src/index.js';
35
35
  export type { ListPresetId } from '../../../../document-api/src/index.js';
36
36
  export type { BrowserDocumentApi, PartialBrowserDocumentApi } from '../browser-document-api.js';
@@ -1409,6 +1409,13 @@ export interface ContextMenuHandle {
1409
1409
  y: number;
1410
1410
  }): ViewportContext;
1411
1411
  }
1412
+ /** Runtime control for the built-in watermark dialog. */
1413
+ export interface WatermarkHandle {
1414
+ /** Open the dialog for the active document, or return an unavailable reason. */
1415
+ open(): WorkflowActionResult;
1416
+ /** Dismiss the dialog. Already submitted changes continue to completion. */
1417
+ close(): void;
1418
+ }
1412
1419
  /**
1413
1420
  * Structural shape of the active editor the controller reads. Every member is
1414
1421
  * optional so a non-browser / pre-ready stub still satisfies it. The
@@ -1562,6 +1569,8 @@ export interface SuperDocUI {
1562
1569
  readonly search: SearchController;
1563
1570
  /** Built-in context menu runtime control. */
1564
1571
  readonly contextMenu: ContextMenuHandle;
1572
+ /** Built-in watermark dialog runtime control. */
1573
+ readonly watermark: WatermarkHandle;
1565
1574
  /** Styles surface (read-only catalogue + active paragraph style). */
1566
1575
  readonly styles: StylesHandle;
1567
1576
  /** Format-painter surface (DOM listener coordination). */
@@ -0,0 +1,32 @@
1
+ import { RetainedPictureWatermarkInput, WatermarkInput } from '../../../../document-api/src/index.js';
2
+ import { SurfaceHandle, SurfaceRequest } from '../../core/types/index.js';
3
+ import { BrowserDocumentApi } from '../browser-document-api.js';
4
+ import { FontFamilyOption, WatermarkHandle } from './types.js';
5
+ import { WatermarkPreview } from './watermark-dialog-state.js';
6
+ interface WatermarkEditor {
7
+ doc: Pick<BrowserDocumentApi, 'watermarks' | 'sections'>;
8
+ host?: {
9
+ watermarkPreview?(input: {
10
+ watermark: WatermarkInput | RetainedPictureWatermarkInput;
11
+ sectionId?: string;
12
+ expectedRevision?: string;
13
+ }): Promise<WatermarkPreview>;
14
+ events?: {
15
+ subscribe(listener: (event: {
16
+ type: string;
17
+ }) => void): () => void;
18
+ };
19
+ };
20
+ }
21
+ interface WatermarkControllerOptions {
22
+ getEditor(): WatermarkEditor | null;
23
+ getMode(): string | null;
24
+ getFonts(): readonly FontFamilyOption[];
25
+ getContainer?(): HTMLElement | null;
26
+ openSurface: ((request: SurfaceRequest) => SurfaceHandle) | null;
27
+ announce?(message: string): void;
28
+ }
29
+ export declare function createWatermarkController(options: WatermarkControllerOptions): WatermarkHandle & {
30
+ destroy(): void;
31
+ };
32
+ export {};
@@ -0,0 +1,66 @@
1
+ import { WatermarkPlacement, WatermarkScalePercent } from '../../../../document-api/src/index.js';
2
+ import { FontFamilyOption } from './types.js';
3
+ export interface WatermarkDraft {
4
+ kind: 'none' | 'text' | 'picture';
5
+ geometryKind: 'text' | 'picture' | null;
6
+ text: string;
7
+ fontFamily: string;
8
+ fontSize: 'auto' | number;
9
+ bold: boolean;
10
+ italic: boolean;
11
+ color: string;
12
+ transparency: number;
13
+ orientation: 'horizontal' | 'diagonal';
14
+ scalePercent: WatermarkScalePercent;
15
+ washout: boolean;
16
+ lockAspectRatio: boolean;
17
+ pictureName: string;
18
+ src?: string;
19
+ sourceWatermarkId?: string;
20
+ placement?: WatermarkPlacement;
21
+ widthPt?: number;
22
+ heightPt?: number;
23
+ customPlacement: boolean;
24
+ customOrientation: boolean;
25
+ customSize: boolean;
26
+ }
27
+ export type WatermarkPageVariant = 'all' | 'default' | 'first' | 'even';
28
+ export interface WatermarkPreview {
29
+ url: string;
30
+ width: number;
31
+ height: number;
32
+ }
33
+ export interface WatermarkDialogSnapshot {
34
+ phase: 'loading' | 'editing' | 'previewing' | 'applying';
35
+ draft: WatermarkDraft;
36
+ sections: {
37
+ id: string;
38
+ label: string;
39
+ }[];
40
+ sectionId: string | null;
41
+ variant: WatermarkPageVariant;
42
+ items: {
43
+ id: string;
44
+ label: string;
45
+ locations: string;
46
+ }[];
47
+ selectedIds: string[];
48
+ fonts: FontFamilyOption[];
49
+ dirty: boolean;
50
+ canApply: boolean;
51
+ error: string | null;
52
+ stale: boolean;
53
+ readonlyReason: string | null;
54
+ impact: string;
55
+ impactDetails: string[];
56
+ preview: WatermarkPreview | null;
57
+ }
58
+ export interface WatermarkDialogModel {
59
+ getSnapshot(): WatermarkDialogSnapshot;
60
+ subscribe(listener: (snapshot: WatermarkDialogSnapshot) => void): () => void;
61
+ patchDraft(patch: Partial<WatermarkDraft>): void;
62
+ setScope(sectionId: string | null, variant: WatermarkPageVariant): void;
63
+ selectWatermarks(ids: string[]): void;
64
+ apply(): Promise<void>;
65
+ reload(): Promise<void>;
66
+ }
@@ -0,0 +1,6 @@
1
+ import { RetainedPictureWatermarkInput, WatermarkInfo, WatermarkInput } from '../../../../document-api/src/index.js';
2
+ import { WatermarkDraft } from './watermark-dialog-state.js';
3
+ export declare function createWatermarkDraft(item?: WatermarkInfo): WatermarkDraft;
4
+ export declare function patchWatermarkDraft(draft: WatermarkDraft, patch: Partial<WatermarkDraft>): WatermarkDraft;
5
+ export declare function getWatermarkDraftError(draft: WatermarkDraft): string | null;
6
+ export declare function toWatermarkInput(draft: WatermarkDraft): WatermarkInput | RetainedPictureWatermarkInput;
@@ -45,6 +45,7 @@ import type { OperationCapabilityResolveResult as __Cjs_OperationCapabilityResol
45
45
  import type { PartialBrowserDocumentApi as __Cjs_PartialBrowserDocumentApi } from './ui.js' with { "resolution-mode": "import" };
46
46
  import type { PictureWatermarkInput as __Cjs_PictureWatermarkInput } from './ui.js' with { "resolution-mode": "import" };
47
47
  import type { Receipt as __Cjs_Receipt } from './ui.js' with { "resolution-mode": "import" };
48
+ import type { RetainedPictureWatermarkInput as __Cjs_RetainedPictureWatermarkInput } from './ui.js' with { "resolution-mode": "import" };
48
49
  import type { RichContentInsertInput as __Cjs_RichContentInsertInput } from './ui.js' with { "resolution-mode": "import" };
49
50
  import type { ScrollIntoViewInput as __Cjs_ScrollIntoViewInput } from './ui.js' with { "resolution-mode": "import" };
50
51
  import type { ScrollIntoViewOutput as __Cjs_ScrollIntoViewOutput } from './ui.js' with { "resolution-mode": "import" };
@@ -106,7 +107,12 @@ import type { ViewportGetRectInput as __Cjs_ViewportGetRectInput } from './ui.js
106
107
  import type { ViewportHandle as __Cjs_ViewportHandle } from './ui.js' with { "resolution-mode": "import" };
107
108
  import type { ViewportRect as __Cjs_ViewportRect } from './ui.js' with { "resolution-mode": "import" };
108
109
  import type { ViewportRectResult as __Cjs_ViewportRectResult } from './ui.js' with { "resolution-mode": "import" };
110
+ import type { WatermarkHandle as __Cjs_WatermarkHandle } from './ui.js' with { "resolution-mode": "import" };
109
111
  import type { WatermarkInfo as __Cjs_WatermarkInfo } from './ui.js' with { "resolution-mode": "import" };
112
+ import type { WatermarksApplyInput as __Cjs_WatermarksApplyInput } from './ui.js' with { "resolution-mode": "import" };
113
+ import type { WatermarksApplyResult as __Cjs_WatermarksApplyResult } from './ui.js' with { "resolution-mode": "import" };
114
+ import type { WatermarksApplySuccess as __Cjs_WatermarksApplySuccess } from './ui.js' with { "resolution-mode": "import" };
115
+ import type { WatermarksApplyTarget as __Cjs_WatermarksApplyTarget } from './ui.js' with { "resolution-mode": "import" };
110
116
  import type { WatermarkTarget as __Cjs_WatermarkTarget } from './ui.js' with { "resolution-mode": "import" };
111
117
  import type { WorkflowActionResult as __Cjs_WorkflowActionResult } from './ui.js' with { "resolution-mode": "import" };
112
118
  import type { WorkflowReceipt as __Cjs_WorkflowReceipt } from './ui.js' with { "resolution-mode": "import" };
@@ -161,6 +167,7 @@ export type { __Cjs_OperationCapabilityResolveResult as OperationCapabilityResol
161
167
  export type { __Cjs_PartialBrowserDocumentApi as PartialBrowserDocumentApi };
162
168
  export type { __Cjs_PictureWatermarkInput as PictureWatermarkInput };
163
169
  export type { __Cjs_Receipt as Receipt };
170
+ export type { __Cjs_RetainedPictureWatermarkInput as RetainedPictureWatermarkInput };
164
171
  export type { __Cjs_RichContentInsertInput as RichContentInsertInput };
165
172
  export type { __Cjs_ScrollIntoViewInput as ScrollIntoViewInput };
166
173
  export type { __Cjs_ScrollIntoViewOutput as ScrollIntoViewOutput };
@@ -223,7 +230,12 @@ export type { __Cjs_ViewportGetRectInput as ViewportGetRectInput };
223
230
  export type { __Cjs_ViewportHandle as ViewportHandle };
224
231
  export type { __Cjs_ViewportRect as ViewportRect };
225
232
  export type { __Cjs_ViewportRectResult as ViewportRectResult };
233
+ export type { __Cjs_WatermarkHandle as WatermarkHandle };
226
234
  export type { __Cjs_WatermarkInfo as WatermarkInfo };
235
+ export type { __Cjs_WatermarksApplyInput as WatermarksApplyInput };
236
+ export type { __Cjs_WatermarksApplyResult as WatermarksApplyResult };
237
+ export type { __Cjs_WatermarksApplySuccess as WatermarksApplySuccess };
238
+ export type { __Cjs_WatermarksApplyTarget as WatermarksApplyTarget };
227
239
  export type { __Cjs_WatermarkTarget as WatermarkTarget };
228
240
  export type { __Cjs_WorkflowActionResult as WorkflowActionResult };
229
241
  export type { __Cjs_WorkflowReceipt as WorkflowReceipt };
@@ -26,4 +26,4 @@
26
26
  export { createSuperDocUI } from './ui/create-super-doc-ui.js';
27
27
  export { shallowEqual } from './ui/equality.js';
28
28
  export { BUILT_IN_COMMAND_IDS } from './ui/commands.js';
29
- export type { EqualityFn, SelectorFn, Subscribable, SuperDocUI, BorrowedSuperDocUI, SuperDocUIOptions, SuperDocUIState, SuperDocUIScope, SuperDocLike, SuperDocEditorLike, CommandHandle, CommandState, CommandExecutionResult, WorkflowReceipt, WorkflowActionResult, WorkflowScrollResult, SelectionRestoreResult, SuperDocUIReason, CommandId, CommandsHandle, ContextMenuItem, ContextMenuHandle, SearchController, SearchHandle, SearchQueryOptions, CustomCommandContext, CustomCommandHandle, CustomCommandHandleState, CustomCommandRegistration, CustomCommandRegistrationResult, MetadataHandle, SelectionHandle, ToolbarHandle, BuiltInCommandId, ToolbarCommandId, CommentsHandle, TrackChangesHandle, ContentControlsHandle, ContentControlFocusResult, ContentControlHighlightResult, FontsHandle, ZoomHandle, DocumentHandle, DocumentReplacementResult, ViewportHandle, StylesHandle, ActiveParagraphStyle, SliceStatus, SelectionSlice, SelectionCapture, CommentAnchorCapture, ToolbarSnapshotSlice, CommentsSlice, TrackChangesSlice, ContentControlsSlice, FontsSlice, ZoomSlice, DocumentSlice, StylesSlice, SearchSnapshot, SearchSlice, StyleCatalogView, StyleCatalogItemType, StyleCatalogFilterType, StyleProvenance, StyleCatalogItemVisibility, StyleCatalogItemUsage, StyleCatalogItemPreview, StyleCatalogItem, StyleCatalogDefaults, StyleCatalogDiagnostic, StyleCatalogSourceStatus, StylesGetCatalogInput, StylesGetCatalogResult, CommentInfo, CommentsListQuery, TrackChangeInfo, TrackChangePointHit, TrackChangesItem, FontFamilyOption, FontSizeOption, CommentAddress, TrackedChangeAddress, ContentControlViewportAddress, ViewportEntityAddress, ViewportEntityHit, ViewportContext, ViewportRect, ViewportGetRectInput, ViewportRectResult, BrowserDocumentApi, PartialBrowserDocumentApi, DocumentApi, Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, EntityAddress, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, ContentControlTarget, RichContentInsertInput, OperationCapabilityResolveResult, SDHtmlMarkdownSupportCheckResult, PictureWatermarkInput, TextWatermark, WatermarkInfo, WatermarkTarget, } from './ui/types.js';
29
+ export type { EqualityFn, SelectorFn, Subscribable, SuperDocUI, BorrowedSuperDocUI, SuperDocUIOptions, SuperDocUIState, SuperDocUIScope, SuperDocLike, SuperDocEditorLike, CommandHandle, CommandState, CommandExecutionResult, WorkflowReceipt, WorkflowActionResult, WorkflowScrollResult, SelectionRestoreResult, SuperDocUIReason, CommandId, CommandsHandle, ContextMenuItem, ContextMenuHandle, WatermarkHandle, SearchController, SearchHandle, SearchQueryOptions, CustomCommandContext, CustomCommandHandle, CustomCommandHandleState, CustomCommandRegistration, CustomCommandRegistrationResult, MetadataHandle, SelectionHandle, ToolbarHandle, BuiltInCommandId, ToolbarCommandId, CommentsHandle, TrackChangesHandle, ContentControlsHandle, ContentControlFocusResult, ContentControlHighlightResult, FontsHandle, ZoomHandle, DocumentHandle, DocumentReplacementResult, ViewportHandle, StylesHandle, ActiveParagraphStyle, SliceStatus, SelectionSlice, SelectionCapture, CommentAnchorCapture, ToolbarSnapshotSlice, CommentsSlice, TrackChangesSlice, ContentControlsSlice, FontsSlice, ZoomSlice, DocumentSlice, StylesSlice, SearchSnapshot, SearchSlice, StyleCatalogView, StyleCatalogItemType, StyleCatalogFilterType, StyleProvenance, StyleCatalogItemVisibility, StyleCatalogItemUsage, StyleCatalogItemPreview, StyleCatalogItem, StyleCatalogDefaults, StyleCatalogDiagnostic, StyleCatalogSourceStatus, StylesGetCatalogInput, StylesGetCatalogResult, CommentInfo, CommentsListQuery, TrackChangeInfo, TrackChangePointHit, TrackChangesItem, FontFamilyOption, FontSizeOption, CommentAddress, TrackedChangeAddress, ContentControlViewportAddress, ViewportEntityAddress, ViewportEntityHit, ViewportContext, ViewportRect, ViewportGetRectInput, ViewportRectResult, BrowserDocumentApi, PartialBrowserDocumentApi, DocumentApi, Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, EntityAddress, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, ContentControlTarget, RichContentInsertInput, OperationCapabilityResolveResult, SDHtmlMarkdownSupportCheckResult, PictureWatermarkInput, RetainedPictureWatermarkInput, TextWatermark, WatermarkInfo, WatermarkTarget, WatermarksApplyInput, WatermarksApplyResult, WatermarksApplySuccess, WatermarksApplyTarget, } from './ui/types.js';