superdoc 2.4.0-next.4 → 2.4.0-next.6

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 (27) hide show
  1. package/dist/chunks/{FindReplaceSurface-BEW-1NhM.es.js → FindReplaceSurface-B_1Ksbr0.es.js} +1 -1
  2. package/dist/chunks/{FindReplaceSurface-Dx0llWqP.cjs → FindReplaceSurface-C-I4GcRE.cjs} +1 -1
  3. package/dist/chunks/{PasswordPromptSurface-BUUVC2ee.cjs → PasswordPromptSurface-Bu5xHm91.cjs} +1 -1
  4. package/dist/chunks/{PasswordPromptSurface-BA6HHqEa.es.js → PasswordPromptSurface-Bz9_sKhX.es.js} +1 -1
  5. package/dist/chunks/{PdfViewer-CNOtyS-I.es.js → PdfViewer-CdVGB6Fe.es.js} +2 -2
  6. package/dist/chunks/{PdfViewer-qpvzwYMz.cjs → PdfViewer-D4eD2dV1.cjs} +2 -2
  7. package/dist/chunks/{create-super-doc-ui-Dli6Wq70.es.js → create-super-doc-ui-BquF8bnZ.es.js} +71 -62
  8. package/dist/chunks/{create-super-doc-ui-BHMQEL2y.cjs → create-super-doc-ui-sMXbYzhs.cjs} +76 -61
  9. package/dist/collaboration-upgrade-engine.cjs +1 -1
  10. package/dist/collaboration-upgrade-engine.es.js +1 -1
  11. package/dist/document-api/src/types/track-changes.types.d.ts +1 -3
  12. package/dist/public/ui-react.cjs +1 -1
  13. package/dist/public/ui-react.es.js +1 -1
  14. package/dist/public/ui.cjs +1 -1
  15. package/dist/public/ui.es.js +1 -1
  16. package/dist/style.css +23 -23
  17. package/dist/style.layered.css +23 -23
  18. package/dist/superdoc.cjs +71 -11
  19. package/dist/superdoc.es.js +71 -11
  20. package/dist-cdn/style.layered.css +1 -1
  21. package/dist-cdn/superdoc.min.css +1 -1
  22. package/dist-cdn/superdoc.min.js +35 -35
  23. package/package.json +2 -2
  24. /package/dist/chunks/{_plugin-vue_export-helper-BTwbGDKw.cjs → _plugin-vue_export-helper-CZ1Nl59K.cjs} +0 -0
  25. /package/dist/chunks/{_plugin-vue_export-helper-CInC0bKI.es.js → _plugin-vue_export-helper-DSMAhhwD.es.js} +0 -0
  26. /package/dist/chunks/{constants-CY3R3_kF.es.js → constants-BfH0br5u.es.js} +0 -0
  27. /package/dist/chunks/{constants-sbCZ2O_A.cjs → constants-D7TNtyJd.cjs} +0 -0
@@ -1734,11 +1734,11 @@ img[data-v-c95b2073] {
1734
1734
  pointer-events: auto;
1735
1735
  }
1736
1736
 
1737
- .superdoc[data-v-c3bc8a46] {
1737
+ .superdoc[data-v-acf35f4b] {
1738
1738
  display: flex;
1739
1739
  position: relative;
1740
1740
  }
1741
- .sd-visually-hidden[data-v-c3bc8a46] {
1741
+ .sd-visually-hidden[data-v-acf35f4b] {
1742
1742
  position: absolute;
1743
1743
  width: 1px;
1744
1744
  height: 1px;
@@ -1749,30 +1749,30 @@ img[data-v-c95b2073] {
1749
1749
  white-space: nowrap;
1750
1750
  border: 0;
1751
1751
  }
1752
- .right-sidebar[data-v-c3bc8a46] {
1752
+ .right-sidebar[data-v-acf35f4b] {
1753
1753
  min-width: 320px;
1754
1754
  height: 100%;
1755
1755
  }
1756
- .floating-comments[data-v-c3bc8a46] {
1756
+ .floating-comments[data-v-acf35f4b] {
1757
1757
  min-width: 300px;
1758
1758
  width: 300px;
1759
1759
  height: 100%;
1760
1760
  overflow: visible;
1761
1761
  }
1762
- .superdoc__layers[data-v-c3bc8a46] {
1762
+ .superdoc__layers[data-v-acf35f4b] {
1763
1763
  height: 100%;
1764
1764
  position: relative;
1765
1765
  box-sizing: border-box;
1766
1766
  }
1767
- .superdoc__document[data-v-c3bc8a46] {
1767
+ .superdoc__document[data-v-acf35f4b] {
1768
1768
  width: 100%;
1769
1769
  position: relative;
1770
1770
  }
1771
- .superdoc__sub-document[data-v-c3bc8a46] {
1771
+ .superdoc__sub-document[data-v-acf35f4b] {
1772
1772
  width: 100%;
1773
1773
  position: relative;
1774
1774
  }
1775
- .superdoc__selection-layer[data-v-c3bc8a46] {
1775
+ .superdoc__selection-layer[data-v-acf35f4b] {
1776
1776
  position: absolute;
1777
1777
  min-width: 100%;
1778
1778
  min-height: 100%;
@@ -1783,13 +1783,13 @@ img[data-v-c95b2073] {
1783
1783
  /* SD-3497: PDF whiteboard overlay sits above the rendered PDF canvas but below
1784
1784
  the PDF comment anchors (z-index 6 in PdfCommentsLayer) so anchors stay
1785
1785
  clickable, and below the selection layer (z-index 10). */
1786
- .superdoc__whiteboard-layer[data-v-c3bc8a46] {
1786
+ .superdoc__whiteboard-layer[data-v-acf35f4b] {
1787
1787
  z-index: 4;
1788
1788
  }
1789
- .superdoc__temp-selection[data-v-c3bc8a46] {
1789
+ .superdoc__temp-selection[data-v-acf35f4b] {
1790
1790
  position: absolute;
1791
1791
  }
1792
- .superdoc__right-sidebar[data-v-c3bc8a46] {
1792
+ .superdoc__right-sidebar[data-v-acf35f4b] {
1793
1793
  width: 320px;
1794
1794
  min-width: 320px;
1795
1795
  padding: 0 10px;
@@ -1797,7 +1797,7 @@ img[data-v-c95b2073] {
1797
1797
  position: relative;
1798
1798
  z-index: 2;
1799
1799
  }
1800
- .superdoc__compact-comment-popover[data-v-c3bc8a46] {
1800
+ .superdoc__compact-comment-popover[data-v-acf35f4b] {
1801
1801
  position: absolute;
1802
1802
  top: 12px;
1803
1803
  right: 12px;
@@ -1806,14 +1806,14 @@ img[data-v-c95b2073] {
1806
1806
  }
1807
1807
 
1808
1808
  /* Tools styles */
1809
- .tools[data-v-c3bc8a46] {
1809
+ .tools[data-v-acf35f4b] {
1810
1810
  position: absolute;
1811
1811
  z-index: 3;
1812
1812
  display: flex;
1813
1813
  flex-direction: column;
1814
1814
  gap: var(--sd-ui-tools-gap, 6px);
1815
1815
  }
1816
- .tools-item[data-v-c3bc8a46] {
1816
+ .tools-item[data-v-acf35f4b] {
1817
1817
  display: flex;
1818
1818
  align-items: center;
1819
1819
  justify-content: center;
@@ -1824,10 +1824,10 @@ img[data-v-c95b2073] {
1824
1824
  cursor: pointer;
1825
1825
  position: relative;
1826
1826
  }
1827
- .tools-item i[data-v-c3bc8a46] {
1827
+ .tools-item i[data-v-acf35f4b] {
1828
1828
  cursor: pointer;
1829
1829
  }
1830
- .superdoc__tools-icon[data-v-c3bc8a46] {
1830
+ .superdoc__tools-icon[data-v-acf35f4b] {
1831
1831
  width: var(--sd-ui-tools-icon-size, 20px);
1832
1832
  height: var(--sd-ui-tools-icon-size, 20px);
1833
1833
  flex-shrink: 0;
@@ -1842,22 +1842,22 @@ img[data-v-c95b2073] {
1842
1842
 
1843
1843
  /* 834px is iPad screen size in portrait orientation */
1844
1844
  @media (max-width: 834px) {
1845
- .superdoc .superdoc__layers[data-v-c3bc8a46] {
1845
+ .superdoc .superdoc__layers[data-v-acf35f4b] {
1846
1846
  margin: 0;
1847
1847
  border: 0 !important;
1848
1848
  box-shadow: none;
1849
1849
  }
1850
- .superdoc__sub-document[data-v-c3bc8a46] {
1850
+ .superdoc__sub-document[data-v-acf35f4b] {
1851
1851
  max-width: 100%;
1852
1852
  }
1853
- .superdoc__right-sidebar[data-v-c3bc8a46] {
1853
+ .superdoc__right-sidebar[data-v-acf35f4b] {
1854
1854
  padding: 10px;
1855
1855
  position: relative;
1856
1856
  }
1857
1857
  }
1858
1858
 
1859
1859
  /* AI Writer styles */
1860
- .ai-writer-container[data-v-c3bc8a46] {
1860
+ .ai-writer-container[data-v-acf35f4b] {
1861
1861
  position: fixed;
1862
1862
  z-index: 1000;
1863
1863
  background: white;
@@ -1873,10 +1873,10 @@ img[data-v-c95b2073] {
1873
1873
  transform: translateY(-50%);
1874
1874
  z-index: 50;
1875
1875
  } */
1876
- .ai-tool > svg[data-v-c3bc8a46] {
1876
+ .ai-tool > svg[data-v-acf35f4b] {
1877
1877
  fill: transparent;
1878
1878
  }
1879
- .ai-tool[data-v-c3bc8a46]::before {
1879
+ .ai-tool[data-v-acf35f4b]::before {
1880
1880
  content: '';
1881
1881
  position: absolute;
1882
1882
  width: 20px;
@@ -1897,7 +1897,7 @@ img[data-v-c95b2073] {
1897
1897
  filter: brightness(1.2);
1898
1898
  transition: filter 0.2s ease;
1899
1899
  }
1900
- .ai-tool[data-v-c3bc8a46]:hover::before {
1900
+ .ai-tool[data-v-acf35f4b]:hover::before {
1901
1901
  filter: brightness(1.3);
1902
1902
  }
1903
1903
 
package/dist/superdoc.cjs CHANGED
@@ -4,9 +4,9 @@ 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__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-BTwbGDKw.cjs");
8
- const require_constants = require("./chunks/constants-sbCZ2O_A.cjs");
9
- const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-BHMQEL2y.cjs");
7
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-sMXbYzhs.cjs");
8
+ const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-CZ1Nl59K.cjs");
9
+ const require_constants = require("./chunks/constants-D7TNtyJd.cjs");
10
10
  let vue = require("vue");
11
11
  vue = require_rolldown_runtime.__toESM(vue);
12
12
  require("y-websocket");
@@ -14760,7 +14760,7 @@ function usePasswordPrompt({ getSurfaceManager, getPasswordPromptConfig, onUnhan
14760
14760
  })
14761
14761
  });
14762
14762
  } else {
14763
- const PasswordPromptSurface = (await Promise.resolve().then(() => require("./chunks/PasswordPromptSurface-BUUVC2ee.cjs"))).default;
14763
+ const PasswordPromptSurface = (await Promise.resolve().then(() => require("./chunks/PasswordPromptSurface-Bu5xHm91.cjs"))).default;
14764
14764
  const surfaceId = `password-prompt-${doc.id}`;
14765
14765
  handle = manager.open({
14766
14766
  id: surfaceId,
@@ -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-Dx0llWqP.cjs"))).default;
15412
+ FindReplaceSurface = (await Promise.resolve().then(() => require("./chunks/FindReplaceSurface-C-I4GcRE.cjs"))).default;
15413
15413
  } catch {
15414
15414
  opening = false;
15415
15415
  return;
@@ -18105,7 +18105,7 @@ var _sfc_main$20 = {
18105
18105
  __name: "SuperDoc",
18106
18106
  emits: ["selection-update"],
18107
18107
  setup(__props, { emit: __emit }) {
18108
- const PdfViewer = (0, vue.defineAsyncComponent)(() => Promise.resolve().then(() => require("./chunks/PdfViewer-qpvzwYMz.cjs")));
18108
+ const PdfViewer = (0, vue.defineAsyncComponent)(() => Promise.resolve().then(() => require("./chunks/PdfViewer-D4eD2dV1.cjs")));
18109
18109
  const getDocumentLoadPassword = (doc) => doc.password ?? proxy.$superdoc.config.password;
18110
18110
  const resolveDocumentV2Collaboration = (doc) => {
18111
18111
  const rawConfig = doc?.v2Collaboration;
@@ -19618,7 +19618,7 @@ var _sfc_main$20 = {
19618
19618
  zoom: (activeZoom.value ?? 100) / 100,
19619
19619
  emitCommentPositionsInViewing: isViewingMode() && shouldRenderCommentsInViewing.value,
19620
19620
  enableCommentsInViewing: isViewingCommentsVisible.value,
19621
- contentControlsChrome: !proxy.$superdoc.uiConfig.contentControls.enabled ? "none" : proxy.$superdoc.uiConfig.contentControls.options.chrome ?? (proxy.$superdoc.config.modules?.contentControls?.chrome === "none" ? void 0 : proxy.$superdoc.config.modules?.contentControls?.chrome),
19621
+ contentControlsChrome: proxy.$superdoc.uiConfig.contentControls.options.chrome,
19622
19622
  resolveTrackedChangeColor: require_create_super_doc_ui.composeAuthorColorResolver(proxy.$superdoc.config.modules?.trackChanges?.authorColors)
19623
19623
  } : void 0,
19624
19624
  permissionResolver: (payload = {}) => proxy.$superdoc.canPerformPermission({
@@ -20560,7 +20560,7 @@ var _sfc_main$20 = {
20560
20560
  };
20561
20561
  }
20562
20562
  };
20563
- var SuperDoc_default = /* @__PURE__ */ require__plugin_vue_export_helper.__plugin_vue_export_helper_default(_sfc_main$20, [["__scopeId", "data-v-c3bc8a46"]]);
20563
+ var SuperDoc_default = /* @__PURE__ */ require__plugin_vue_export_helper.__plugin_vue_export_helper_default(_sfc_main$20, [["__scopeId", "data-v-acf35f4b"]]);
20564
20564
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
20565
20565
  var PINIA_DEVTOOLS_PLUGIN_ID = "dev.esm.pinia";
20566
20566
  var piniaDevtoolsSuppressionState = {
@@ -32995,6 +32995,8 @@ function normalizeUiConfig(config = {}) {
32995
32995
  };
32996
32996
  const options = (key) => allDisabled ? {} : resolveOptions(ui, key);
32997
32997
  const rulerSuppressed = allDisabled || explicit("ruler") === false;
32998
+ const contentControlsEnabled = explicit("contentControls") ?? (!allDisabled && config.modules?.contentControls?.chrome !== "none");
32999
+ const legacyContentControlsChrome = config.modules?.contentControls?.chrome === "none" ? void 0 : config.modules?.contentControls?.chrome;
32998
33000
  const toolbarOptions = options("toolbar");
32999
33001
  const legacyToolbar = config.modules?.toolbar;
33000
33002
  const legacyToolbarOptions = isPlainObject$2(legacyToolbar) ? legacyToolbar : {};
@@ -33045,8 +33047,8 @@ function normalizeUiConfig(config = {}) {
33045
33047
  container: rulerSuppressed ? null : options("ruler").container ?? config.rulerContainer ?? null
33046
33048
  },
33047
33049
  contentControls: {
33048
- enabled: explicit("contentControls") ?? (!allDisabled && config.modules?.contentControls?.chrome !== "none"),
33049
- options: options("contentControls")
33050
+ enabled: contentControlsEnabled,
33051
+ options: contentControlsEnabled ? mergeDefined({ chrome: legacyContentControlsChrome }, options("contentControls")) : { chrome: "none" }
33050
33052
  }
33051
33053
  };
33052
33054
  }
@@ -39026,6 +39028,11 @@ var BuiltInToolbar = class extends require_eventemitter3.import_eventemitter3.de
39026
39028
  function createBuiltInToolbar(config) {
39027
39029
  return new BuiltInToolbar(config);
39028
39030
  }
39031
+ var STRUCTURED_CONTENT_FRAME_SELECTOR = [
39032
+ "[data-sdt-type=\"structuredContent\"][data-sdt-id]",
39033
+ "[data-sdt-type=\"structuredContent\"][data-sdt-container-id]",
39034
+ "[data-sdt-container-type=\"structuredContent\"][data-sdt-container-id]"
39035
+ ].join(", ");
39029
39036
  var DEFAULT_AWARENESS_PALETTE = Object.freeze([
39030
39037
  "#FF6B6B",
39031
39038
  "#4ECDC4",
@@ -39113,6 +39120,33 @@ function onCollaborationProviderSynced(provider, onSynced) {
39113
39120
  if (isCollaborationProviderSynced(provider)) finish();
39114
39121
  return cleanup;
39115
39122
  }
39123
+ function getClickedContentControlId(event, root) {
39124
+ const path = event.composedPath();
39125
+ if (!path.includes(root)) return null;
39126
+ const control = path.find((target$1) => target$1 instanceof HTMLElement && target$1.matches(STRUCTURED_CONTENT_FRAME_SELECTOR));
39127
+ if (!control) return null;
39128
+ const onBlockLabel = path.some((target$1) => target$1 instanceof HTMLElement && target$1.classList.contains(require_create_super_doc_ui.DOM_CLASS_NAMES.BLOCK_SDT_LABEL));
39129
+ const containerId = control.getAttribute("data-sdt-container-id")?.trim() || null;
39130
+ const sdtId = control.getAttribute("data-sdt-id")?.trim() || null;
39131
+ return onBlockLabel ? containerId ?? sdtId : sdtId ?? containerId;
39132
+ }
39133
+ function getContentControlItems(result) {
39134
+ if (!result || typeof result !== "object") return [];
39135
+ const items = result.items;
39136
+ return Array.isArray(items) ? items : [];
39137
+ }
39138
+ function toSdtRef(item) {
39139
+ if (!item || typeof item.id !== "string" || item.kind !== "inline" && item.kind !== "block" || typeof item.controlType !== "string") return null;
39140
+ const tag = item.properties?.tag;
39141
+ const alias = item.properties?.alias;
39142
+ return {
39143
+ id: item.id,
39144
+ controlType: item.controlType,
39145
+ scope: item.kind,
39146
+ ...typeof tag === "string" && tag ? { tag } : {},
39147
+ ...typeof alias === "string" && alias ? { alias } : {}
39148
+ };
39149
+ }
39116
39150
  function isV2ActiveEditorFacade(editor) {
39117
39151
  return Boolean(editor && typeof editor === "object" && editor.editorVersion === 2);
39118
39152
  }
@@ -39166,6 +39200,10 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
39166
39200
  #v2LockUnsub = null;
39167
39201
  #pendingV2LockSeed = null;
39168
39202
  #mountWrapper = null;
39203
+ #contentControlClickRoot = null;
39204
+ #handleContentControlClick = (event) => {
39205
+ this.#emitContentControlClick(event);
39206
+ };
39169
39207
  #ui = null;
39170
39208
  #uiConfig = normalizeUiConfig({});
39171
39209
  get uiConfig() {
@@ -39249,8 +39287,28 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
39249
39287
  const container = typeof config.selector === "string" ? document.querySelector(config.selector) : config.selector;
39250
39288
  if (!(container instanceof HTMLElement)) throw new Error("SuperDoc: selector must be a valid CSS selector string or DOM element");
39251
39289
  this.#surfaceManager = new SurfaceManager({ getModuleConfig: () => this.#surfacesConfig });
39290
+ this.#contentControlClickRoot = container;
39291
+ container.addEventListener("click", this.#handleContentControlClick, true);
39252
39292
  this.#init(config, container);
39253
39293
  }
39294
+ async #emitContentControlClick(event) {
39295
+ const root = this.#contentControlClickRoot;
39296
+ if (!root) return;
39297
+ const id = getClickedContentControlId(event, root);
39298
+ const list = this.activeEditor?.doc?.contentControls?.list;
39299
+ if (!id || typeof list !== "function") return;
39300
+ try {
39301
+ const result = await list();
39302
+ if (this.#destroyed) return;
39303
+ const target$1 = toSdtRef(getContentControlItems(result).find((item) => item.id === id));
39304
+ if (target$1) this.emit("content-control:click", {
39305
+ target: target$1,
39306
+ source: "pointer"
39307
+ });
39308
+ } catch {
39309
+ return;
39310
+ }
39311
+ }
39254
39312
  async #init(config, container) {
39255
39313
  this.config = {
39256
39314
  ...this.config,
@@ -39297,7 +39355,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
39297
39355
  this.config.colors = shuffleArray(this.config.colors);
39298
39356
  this.userColorMap = /* @__PURE__ */ new Map();
39299
39357
  this.colorIndex = 0;
39300
- this.version = "2.4.0-next.4";
39358
+ this.version = "2.4.0-next.6";
39301
39359
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
39302
39360
  this.superdocId = config.superdocId || require_uuid.v4_default();
39303
39361
  this.colors = this.config.colors ?? [];
@@ -40825,6 +40883,8 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
40825
40883
  }
40826
40884
  destroy() {
40827
40885
  this.#destroyed = true;
40886
+ this.#contentControlClickRoot?.removeEventListener("click", this.#handleContentControlClick, true);
40887
+ this.#contentControlClickRoot = null;
40828
40888
  if (this.#abortUpgrade) {
40829
40889
  this.#abortUpgrade();
40830
40890
  this.#abortUpgrade = null;
@@ -3,9 +3,9 @@ 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 { t as __plugin_vue_export_helper_default } from "./chunks/_plugin-vue_export-helper-CInC0bKI.es.js";
7
- import { n as PDF_TO_CSS_UNITS } from "./chunks/constants-CY3R3_kF.es.js";
8
- import { a as createV2ReviewMutationReconciler, i as isV2EditableTextMutationEvent, o as getV2TrackedChangeMutationImpact, s as composeAuthorColorResolver, t as createSuperDocUI } from "./chunks/create-super-doc-ui-Dli6Wq70.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";
7
+ import { t as __plugin_vue_export_helper_default } from "./chunks/_plugin-vue_export-helper-DSMAhhwD.es.js";
8
+ import { n as PDF_TO_CSS_UNITS } from "./chunks/constants-BfH0br5u.es.js";
9
9
  import * as Vue from "vue";
10
10
  import { Fragment, Teleport, Transition, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, effectScope, getCurrentInstance, getCurrentScope, h, hasInjectionContext, inject, isReactive, isRef, markRaw, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeUnmount, onDeactivated, onMounted, onScopeDispose, openBlock, reactive, ref, renderList, renderSlot, resolveDirective, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, toRefs, unref, useAttrs, vModelText, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
11
11
  import "y-websocket";
@@ -14734,7 +14734,7 @@ function usePasswordPrompt({ getSurfaceManager, getPasswordPromptConfig, onUnhan
14734
14734
  })
14735
14735
  });
14736
14736
  } else {
14737
- const PasswordPromptSurface = (await import("./chunks/PasswordPromptSurface-BA6HHqEa.es.js")).default;
14737
+ const PasswordPromptSurface = (await import("./chunks/PasswordPromptSurface-Bz9_sKhX.es.js")).default;
14738
14738
  const surfaceId = `password-prompt-${doc.id}`;
14739
14739
  handle = manager.open({
14740
14740
  id: surfaceId,
@@ -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-BEW-1NhM.es.js")).default;
15386
+ FindReplaceSurface = (await import("./chunks/FindReplaceSurface-B_1Ksbr0.es.js")).default;
15387
15387
  } catch {
15388
15388
  opening = false;
15389
15389
  return;
@@ -18062,7 +18062,7 @@ var SuperDoc_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
18062
18062
  __name: "SuperDoc",
18063
18063
  emits: ["selection-update"],
18064
18064
  setup(__props, { emit: __emit }) {
18065
- const PdfViewer = defineAsyncComponent(() => import("./chunks/PdfViewer-CNOtyS-I.es.js"));
18065
+ const PdfViewer = defineAsyncComponent(() => import("./chunks/PdfViewer-CdVGB6Fe.es.js"));
18066
18066
  const getDocumentLoadPassword = (doc) => doc.password ?? proxy.$superdoc.config.password;
18067
18067
  const resolveDocumentV2Collaboration = (doc) => {
18068
18068
  const rawConfig = doc?.v2Collaboration;
@@ -19575,7 +19575,7 @@ var SuperDoc_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
19575
19575
  zoom: (activeZoom.value ?? 100) / 100,
19576
19576
  emitCommentPositionsInViewing: isViewingMode() && shouldRenderCommentsInViewing.value,
19577
19577
  enableCommentsInViewing: isViewingCommentsVisible.value,
19578
- contentControlsChrome: !proxy.$superdoc.uiConfig.contentControls.enabled ? "none" : proxy.$superdoc.uiConfig.contentControls.options.chrome ?? (proxy.$superdoc.config.modules?.contentControls?.chrome === "none" ? void 0 : proxy.$superdoc.config.modules?.contentControls?.chrome),
19578
+ contentControlsChrome: proxy.$superdoc.uiConfig.contentControls.options.chrome,
19579
19579
  resolveTrackedChangeColor: composeAuthorColorResolver(proxy.$superdoc.config.modules?.trackChanges?.authorColors)
19580
19580
  } : void 0,
19581
19581
  permissionResolver: (payload = {}) => proxy.$superdoc.canPerformPermission({
@@ -20516,7 +20516,7 @@ var SuperDoc_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
20516
20516
  ], 38);
20517
20517
  };
20518
20518
  }
20519
- }, [["__scopeId", "data-v-c3bc8a46"]]);
20519
+ }, [["__scopeId", "data-v-acf35f4b"]]);
20520
20520
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
20521
20521
  var PINIA_DEVTOOLS_PLUGIN_ID = "dev.esm.pinia";
20522
20522
  var piniaDevtoolsSuppressionState = {
@@ -32950,6 +32950,8 @@ function normalizeUiConfig(config = {}) {
32950
32950
  };
32951
32951
  const options = (key) => allDisabled ? {} : resolveOptions(ui, key);
32952
32952
  const rulerSuppressed = allDisabled || explicit("ruler") === false;
32953
+ const contentControlsEnabled = explicit("contentControls") ?? (!allDisabled && config.modules?.contentControls?.chrome !== "none");
32954
+ const legacyContentControlsChrome = config.modules?.contentControls?.chrome === "none" ? void 0 : config.modules?.contentControls?.chrome;
32953
32955
  const toolbarOptions = options("toolbar");
32954
32956
  const legacyToolbar = config.modules?.toolbar;
32955
32957
  const legacyToolbarOptions = isPlainObject$2(legacyToolbar) ? legacyToolbar : {};
@@ -33000,8 +33002,8 @@ function normalizeUiConfig(config = {}) {
33000
33002
  container: rulerSuppressed ? null : options("ruler").container ?? config.rulerContainer ?? null
33001
33003
  },
33002
33004
  contentControls: {
33003
- enabled: explicit("contentControls") ?? (!allDisabled && config.modules?.contentControls?.chrome !== "none"),
33004
- options: options("contentControls")
33005
+ enabled: contentControlsEnabled,
33006
+ options: contentControlsEnabled ? mergeDefined({ chrome: legacyContentControlsChrome }, options("contentControls")) : { chrome: "none" }
33005
33007
  }
33006
33008
  };
33007
33009
  }
@@ -38959,6 +38961,11 @@ var BuiltInToolbar = class extends import_eventemitter3.default {
38959
38961
  function createBuiltInToolbar(config) {
38960
38962
  return new BuiltInToolbar(config);
38961
38963
  }
38964
+ var STRUCTURED_CONTENT_FRAME_SELECTOR = [
38965
+ "[data-sdt-type=\"structuredContent\"][data-sdt-id]",
38966
+ "[data-sdt-type=\"structuredContent\"][data-sdt-container-id]",
38967
+ "[data-sdt-container-type=\"structuredContent\"][data-sdt-container-id]"
38968
+ ].join(", ");
38962
38969
  var DEFAULT_AWARENESS_PALETTE = Object.freeze([
38963
38970
  "#FF6B6B",
38964
38971
  "#4ECDC4",
@@ -39046,6 +39053,33 @@ function onCollaborationProviderSynced(provider, onSynced) {
39046
39053
  if (isCollaborationProviderSynced(provider)) finish();
39047
39054
  return cleanup;
39048
39055
  }
39056
+ function getClickedContentControlId(event, root) {
39057
+ const path = event.composedPath();
39058
+ if (!path.includes(root)) return null;
39059
+ const control = path.find((target$1) => target$1 instanceof HTMLElement && target$1.matches(STRUCTURED_CONTENT_FRAME_SELECTOR));
39060
+ if (!control) return null;
39061
+ const onBlockLabel = path.some((target$1) => target$1 instanceof HTMLElement && target$1.classList.contains(DOM_CLASS_NAMES.BLOCK_SDT_LABEL));
39062
+ const containerId = control.getAttribute("data-sdt-container-id")?.trim() || null;
39063
+ const sdtId = control.getAttribute("data-sdt-id")?.trim() || null;
39064
+ return onBlockLabel ? containerId ?? sdtId : sdtId ?? containerId;
39065
+ }
39066
+ function getContentControlItems(result) {
39067
+ if (!result || typeof result !== "object") return [];
39068
+ const items = result.items;
39069
+ return Array.isArray(items) ? items : [];
39070
+ }
39071
+ function toSdtRef(item) {
39072
+ if (!item || typeof item.id !== "string" || item.kind !== "inline" && item.kind !== "block" || typeof item.controlType !== "string") return null;
39073
+ const tag = item.properties?.tag;
39074
+ const alias = item.properties?.alias;
39075
+ return {
39076
+ id: item.id,
39077
+ controlType: item.controlType,
39078
+ scope: item.kind,
39079
+ ...typeof tag === "string" && tag ? { tag } : {},
39080
+ ...typeof alias === "string" && alias ? { alias } : {}
39081
+ };
39082
+ }
39049
39083
  function isV2ActiveEditorFacade(editor) {
39050
39084
  return Boolean(editor && typeof editor === "object" && editor.editorVersion === 2);
39051
39085
  }
@@ -39099,6 +39133,10 @@ var SuperDoc = class extends import_eventemitter3.default {
39099
39133
  #v2LockUnsub = null;
39100
39134
  #pendingV2LockSeed = null;
39101
39135
  #mountWrapper = null;
39136
+ #contentControlClickRoot = null;
39137
+ #handleContentControlClick = (event) => {
39138
+ this.#emitContentControlClick(event);
39139
+ };
39102
39140
  #ui = null;
39103
39141
  #uiConfig = normalizeUiConfig({});
39104
39142
  get uiConfig() {
@@ -39182,8 +39220,28 @@ var SuperDoc = class extends import_eventemitter3.default {
39182
39220
  const container = typeof config.selector === "string" ? document.querySelector(config.selector) : config.selector;
39183
39221
  if (!(container instanceof HTMLElement)) throw new Error("SuperDoc: selector must be a valid CSS selector string or DOM element");
39184
39222
  this.#surfaceManager = new SurfaceManager({ getModuleConfig: () => this.#surfacesConfig });
39223
+ this.#contentControlClickRoot = container;
39224
+ container.addEventListener("click", this.#handleContentControlClick, true);
39185
39225
  this.#init(config, container);
39186
39226
  }
39227
+ async #emitContentControlClick(event) {
39228
+ const root = this.#contentControlClickRoot;
39229
+ if (!root) return;
39230
+ const id = getClickedContentControlId(event, root);
39231
+ const list = this.activeEditor?.doc?.contentControls?.list;
39232
+ if (!id || typeof list !== "function") return;
39233
+ try {
39234
+ const result = await list();
39235
+ if (this.#destroyed) return;
39236
+ const target$1 = toSdtRef(getContentControlItems(result).find((item) => item.id === id));
39237
+ if (target$1) this.emit("content-control:click", {
39238
+ target: target$1,
39239
+ source: "pointer"
39240
+ });
39241
+ } catch {
39242
+ return;
39243
+ }
39244
+ }
39187
39245
  async #init(config, container) {
39188
39246
  this.config = {
39189
39247
  ...this.config,
@@ -39230,7 +39288,7 @@ var SuperDoc = class extends import_eventemitter3.default {
39230
39288
  this.config.colors = shuffleArray(this.config.colors);
39231
39289
  this.userColorMap = /* @__PURE__ */ new Map();
39232
39290
  this.colorIndex = 0;
39233
- this.version = "2.4.0-next.4";
39291
+ this.version = "2.4.0-next.6";
39234
39292
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
39235
39293
  this.superdocId = config.superdocId || v4_default();
39236
39294
  this.colors = this.config.colors ?? [];
@@ -40758,6 +40816,8 @@ var SuperDoc = class extends import_eventemitter3.default {
40758
40816
  }
40759
40817
  destroy() {
40760
40818
  this.#destroyed = true;
40819
+ this.#contentControlClickRoot?.removeEventListener("click", this.#handleContentControlClick, true);
40820
+ this.#contentControlClickRoot = null;
40761
40821
  if (this.#abortUpgrade) {
40762
40822
  this.#abortUpgrade();
40763
40823
  this.#abortUpgrade = null;