superdoc 2.4.0-next.2 → 2.4.0-next.21

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 (62) hide show
  1. package/dist/chunks/{FindReplaceSurface-Dx0llWqP.cjs → FindReplaceSurface-0p7EtMZh.cjs} +4 -4
  2. package/dist/chunks/{FindReplaceSurface-BEW-1NhM.es.js → FindReplaceSurface-40AnrqWk.es.js} +5 -4
  3. package/dist/chunks/{PasswordPromptSurface-BUUVC2ee.cjs → PasswordPromptSurface-31lYPcCK.cjs} +4 -3
  4. package/dist/chunks/{PasswordPromptSurface-BA6HHqEa.es.js → PasswordPromptSurface-CwYeO3iQ.es.js} +4 -2
  5. package/dist/chunks/{PdfViewer-CNOtyS-I.es.js → PdfViewer-D8h7LRZy.es.js} +103 -19
  6. package/dist/chunks/{PdfViewer-qpvzwYMz.cjs → PdfViewer-Dug6yDRC.cjs} +105 -20
  7. package/dist/chunks/_plugin-vue_export-helper-BOaGB7Aw.es.js +8 -0
  8. package/dist/chunks/_plugin-vue_export-helper-SDR04tiH.cjs +13 -0
  9. package/dist/chunks/{blank-docx-DP8RUPW-.cjs → blank-docx-BuFAbRjs.cjs} +2 -0
  10. package/dist/chunks/{blank-docx-XRX6Ker2.es.js → blank-docx-DzQccOlW.es.js} +2 -0
  11. package/dist/chunks/constants-B6VBlmKp.es.js +4 -0
  12. package/dist/chunks/constants-DpXuDx_g.cjs +9 -0
  13. package/dist/chunks/{create-super-doc-ui-D4kk9AjM.es.js → create-super-doc-ui-CFsY0uxw.es.js} +2177 -581
  14. package/dist/chunks/{create-super-doc-ui-DXdWuTzm.cjs → create-super-doc-ui-jSJQis_0.cjs} +1987 -619
  15. package/dist/chunks/{eventemitter3-DqY4aSMf.cjs → eventemitter3-C_TAnXOl.cjs} +125 -16
  16. package/dist/chunks/{eventemitter3-Bt2s0X0a.es.js → eventemitter3-DEIiXiH2.es.js} +124 -16
  17. package/dist/chunks/jszip-BzJ3CyxR.es.js +4717 -0
  18. package/dist/chunks/jszip-D8mAFF-r.cjs +4758 -0
  19. package/dist/chunks/{rolldown-runtime-D7PMmH3s.es.js → rolldown-runtime-0pSA04fp.es.js} +12 -3
  20. package/dist/chunks/{rolldown-runtime-1Y-nnZJ3.cjs → rolldown-runtime-74VwNCz7.cjs} +11 -2
  21. package/dist/chunks/{uuid-CFp0WGVU.cjs → uuid-BhG0ngwk.cjs} +10 -6
  22. package/dist/chunks/{uuid-B2Sqk-3p.es.js → uuid-H0Xcmmhy.es.js} +8 -3
  23. package/dist/collaboration-upgrade-engine.cjs +34 -9
  24. package/dist/collaboration-upgrade-engine.es.js +30 -5
  25. package/dist/document-api/src/comments/comments.types.d.ts +7 -0
  26. package/dist/document-api/src/types/track-changes.types.d.ts +1 -3
  27. package/dist/layout-engine/contracts/src/incremental-dependency.d.ts +22 -2
  28. package/dist/layout-engine/contracts/src/index.d.ts +1 -1
  29. package/dist/layout-engine/layout-bridge/src/incrementalLayout.d.ts +2 -1
  30. package/dist/layout-engine/layout-bridge/src/index.d.ts +1 -0
  31. package/dist/public/ui-react.cjs +66 -2
  32. package/dist/public/ui-react.es.js +66 -1
  33. package/dist/public/ui.cjs +1 -1
  34. package/dist/public/ui.es.js +1 -1
  35. package/dist/style.css +104 -69
  36. package/dist/style.layered.css +104 -69
  37. package/dist/superdoc/src/core/SuperDoc.d.ts +4 -0
  38. package/dist/superdoc/src/core/types/index.d.ts +505 -42
  39. package/dist/superdoc/src/helpers/comment-small-screen.d.ts +10 -0
  40. package/dist/superdoc/src/helpers/v2-review-mutation-impact.d.ts +1 -0
  41. package/dist/superdoc/src/helpers/v2-review-mutation-reconciler.d.ts +1 -1
  42. package/dist/superdoc/src/helpers/v2-typing-review-hydration.d.ts +16 -0
  43. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButton.vue.d.ts +4 -4
  44. package/dist/superdoc/src/internal/toolbar/built-in-toolbar.d.ts +11 -0
  45. package/dist/superdoc/src/internal/toolbar/compatibility-catalog.d.ts +1 -1
  46. package/dist/superdoc/src/public/index.d.cts +22 -0
  47. package/dist/superdoc/src/public/index.d.ts +11 -0
  48. package/dist/superdoc/src/public/ui/types.d.ts +25 -1
  49. package/dist/superdoc/src/stores/comments-store.d.ts +100 -22
  50. package/dist/superdoc/src/stores/superdoc-store.d.ts +300 -66
  51. package/dist/superdoc.cjs +6678 -1391
  52. package/dist/superdoc.es.js +6556 -1268
  53. package/dist-cdn/style.layered.css +1 -1
  54. package/dist-cdn/superdoc.min.css +1 -1
  55. package/dist-cdn/superdoc.min.js +37 -37
  56. package/package.json +14 -14
  57. package/dist/chunks/_plugin-vue_export-helper-BTwbGDKw.cjs +0 -11
  58. package/dist/chunks/_plugin-vue_export-helper-CInC0bKI.es.js +0 -6
  59. package/dist/chunks/constants-CY3R3_kF.es.js +0 -3
  60. package/dist/chunks/constants-sbCZ2O_A.cjs +0 -14
  61. package/dist/chunks/jszip-C8srOKAO.es.js +0 -4650
  62. package/dist/chunks/jszip-Cs9JBLlJ.cjs +0 -4691
@@ -1,15 +1,44 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-D4kk9AjM.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-CFsY0uxw.es.js";
2
2
  import { createContext, createElement, useCallback, useContext, useEffect, useRef, useState } from "react";
3
+ //#region src/public/ui/react.ts
4
+ /**
5
+ * v2-native React bindings for the `superdoc/ui` controller.
6
+ *
7
+ * Provider + hooks over the SuperDoc-owned controller (`superdoc.ui`). For a
8
+ * real `SuperDoc` this layer never creates or destroys a controller; it binds
9
+ * to the one the instance already owns. It falls back to building (and then
10
+ * owning) one only for a structural host that carries no `ui`, since
11
+ * `SuperDocHost` leaves that property optional. Authored with
12
+ * `React.createElement` (no JSX) so the
13
+ * library build needs no JSX transform, and `react` stays an external/optional
14
+ * peer. No v1 editor or private v2 runtime imports.
15
+ */
3
16
  var SuperDocUIContext = createContext(null);
17
+ /**
18
+ * Destroy a controller this provider built itself. Controllers read off
19
+ * `superdoc.ui` are never passed here: the instance owns those.
20
+ */
4
21
  function disposeOwnedUi(ref) {
5
22
  const ui = ref.current;
6
23
  if (!ui) return;
7
24
  ui.destroy();
8
25
  ref.current = null;
9
26
  }
27
+ /**
28
+ * Root provider. Call {@link useSetSuperDoc} from your editor-mount
29
+ * component's ready callback to bind a running SuperDoc instance; the hooks
30
+ * below then read that instance's own controller (`superdoc.ui`).
31
+ *
32
+ * The provider is a consumer, not an owner. SuperDoc creates the controller
33
+ * and destroys it in `superdoc.destroy()`, so unmounting or rebinding the
34
+ * provider leaves it running for the built-in toolbar and any other consumer
35
+ * of the same instance. Every React hook therefore observes the same command
36
+ * state the rest of the application sees.
37
+ */
10
38
  function SuperDocUIProvider(props) {
11
39
  const [ui, setUi] = useState(null);
12
40
  const [host, setHost] = useState(null);
41
+ /** Only ever holds a controller this provider created for a host lacking one. */
13
42
  const ownedUiRef = useRef(null);
14
43
  const setSuperDoc = useCallback((superdoc) => {
15
44
  const hostUi = superdoc.ui;
@@ -35,15 +64,33 @@ function useContextValue() {
35
64
  if (!value) throw new Error("[superdoc/ui/react] hooks must be used within <SuperDocUIProvider>.");
36
65
  return value;
37
66
  }
67
+ /**
68
+ * Read the controller, or `null` until a SuperDoc instance is bound.
69
+ *
70
+ * Borrowed: the bound instance owns teardown, so the returned type omits
71
+ * `destroy()`. A provider-built fallback controller is disposed by the provider.
72
+ */
38
73
  function useSuperDocUI() {
39
74
  return useContextValue().ui;
40
75
  }
76
+ /** Read the raw bound SuperDoc host, or `null` until one is bound. */
41
77
  function useSuperDocHost() {
42
78
  return useContextValue().host;
43
79
  }
80
+ /** Get the stable callback used to bind a running SuperDoc instance. */
44
81
  function useSetSuperDoc() {
45
82
  return useContextValue().setSuperDoc;
46
83
  }
84
+ /**
85
+ * Normalize a `pick` result into a {@link SliceSource}. Domain handles and the
86
+ * command/font hooks already expose the snapshot-shaped contract
87
+ * (`getSnapshot` + `observe`) and pass through unchanged. A raw `ui.select(...)`
88
+ * {@link Subscribable} (`get` + `subscribe`) is adapted: it `subscribe`s FIRST,
89
+ * then emits the current value, so a synchronous recompute triggered by the
90
+ * first listener is not missed (the substrate's `subscribe` does not emit on
91
+ * attach). Exported for unit tests; not re-exported by the `superdoc/ui/react`
92
+ * facade, so it stays off the public surface.
93
+ */
47
94
  function toSliceSource(source) {
48
95
  const candidate = source;
49
96
  if (typeof candidate.getSnapshot === "function" && typeof candidate.observe === "function") return source;
@@ -57,6 +104,13 @@ function toSliceSource(source) {
57
104
  }
58
105
  };
59
106
  }
107
+ /**
108
+ * Subscribe to a derived slice of controller state. `pick` selects a value
109
+ * source from the controller: a domain handle / snapshot source
110
+ * ({@link SliceSource}) or a raw `ui.select(...)` {@link Subscribable}, both
111
+ * normalized via {@link toSliceSource}. `initial` is returned until the
112
+ * controller is bound.
113
+ */
60
114
  function useSuperDocSlice(pick, initial) {
61
115
  const ui = useSuperDocUI();
62
116
  const [value, setValue] = useState(() => ui ? toSliceSource(pick(ui)).getSnapshot() : initial);
@@ -81,9 +135,11 @@ var EMPTY_SELECTION = {
81
135
  activeChangeIds: [],
82
136
  quotedText: ""
83
137
  };
138
+ /** Subscribe to the selection slice. */
84
139
  function useSuperDocSelection() {
85
140
  return useSuperDocSlice((ui) => ui.selection, EMPTY_SELECTION);
86
141
  }
142
+ /** Subscribe to the comments slice. */
87
143
  function useSuperDocComments() {
88
144
  return useSuperDocSlice((ui) => ui.comments, {
89
145
  status: "pending",
@@ -94,6 +150,7 @@ function useSuperDocComments() {
94
150
  activeId: null
95
151
  });
96
152
  }
153
+ /** Subscribe to the content-controls slice. */
97
154
  function useSuperDocContentControls() {
98
155
  return useSuperDocSlice((ui) => ui.contentControls, {
99
156
  status: "pending",
@@ -103,6 +160,7 @@ function useSuperDocContentControls() {
103
160
  activeIds: []
104
161
  });
105
162
  }
163
+ /** Subscribe to the track-changes slice. */
106
164
  function useSuperDocTrackChanges() {
107
165
  return useSuperDocSlice((ui) => ui.trackChanges, {
108
166
  status: "pending",
@@ -112,6 +170,7 @@ function useSuperDocTrackChanges() {
112
170
  authors: []
113
171
  });
114
172
  }
173
+ /** Subscribe to the toolbar snapshot slice. */
115
174
  function useSuperDocToolbar() {
116
175
  return useSuperDocSlice((ui) => ui.toolbar, {
117
176
  context: null,
@@ -119,6 +178,7 @@ function useSuperDocToolbar() {
119
178
  copyFormatActive: false
120
179
  });
121
180
  }
181
+ /** Subscribe to a single command's enable/active state. */
122
182
  function useSuperDocCommand(id) {
123
183
  return useSuperDocSlice((ui) => ({
124
184
  getSnapshot: () => ui.commands.get(id).getState(),
@@ -129,6 +189,7 @@ function useSuperDocCommand(id) {
129
189
  supported: false
130
190
  });
131
191
  }
192
+ /** Subscribe to the document slice. */
132
193
  function useSuperDocDocument() {
133
194
  return useSuperDocSlice((ui) => ui.document, {
134
195
  ready: false,
@@ -136,18 +197,21 @@ function useSuperDocDocument() {
136
197
  dirty: false
137
198
  });
138
199
  }
200
+ /** Subscribe to available font-family options. */
139
201
  function useSuperDocFontOptions() {
140
202
  return useSuperDocSlice((ui) => ({
141
203
  getSnapshot: () => ui.fonts.getFamilyOptions(),
142
204
  observe: (cb) => ui.fonts.observe((slice) => cb(slice.options))
143
205
  }), []);
144
206
  }
207
+ /** Subscribe to available font-size options. */
145
208
  function useSuperDocFontSizeOptions() {
146
209
  return useSuperDocSlice((ui) => ({
147
210
  getSnapshot: () => ui.fonts.getSizeOptions(),
148
211
  observe: (cb) => ui.fonts.observe((slice) => cb(slice.sizeOptions))
149
212
  }), []);
150
213
  }
214
+ /** Subscribe to the zoom slice. */
151
215
  function useSuperDocZoom() {
152
216
  return useSuperDocSlice((ui) => ui.zoom, {
153
217
  mode: null,
@@ -156,4 +220,5 @@ function useSuperDocZoom() {
156
220
  max: 100
157
221
  });
158
222
  }
223
+ //#endregion
159
224
  export { SuperDocUIProvider, useSetSuperDoc, useSuperDocCommand, useSuperDocComments, useSuperDocContentControls, useSuperDocDocument, useSuperDocFontOptions, useSuperDocFontSizeOptions, useSuperDocHost, useSuperDocSelection, useSuperDocSlice, useSuperDocToolbar, useSuperDocTrackChanges, useSuperDocUI, useSuperDocZoom };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-DXdWuTzm.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-jSJQis_0.cjs");
3
3
  exports.BUILT_IN_COMMAND_IDS = require_create_super_doc_ui.BUILT_IN_COMMAND_IDS;
4
4
  exports.createSuperDocUI = require_create_super_doc_ui.createSuperDocUI;
5
5
  exports.shallowEqual = require_create_super_doc_ui.shallowEqual;
@@ -1,2 +1,2 @@
1
- import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-D4kk9AjM.es.js";
1
+ import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-CFsY0uxw.es.js";
2
2
  export { BUILT_IN_COMMAND_IDS, createSuperDocUI, shallowEqual };