superdoc 2.4.0-next.4 → 2.4.0-next.5

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 (22) 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/public/ui-react.cjs +1 -1
  12. package/dist/public/ui-react.es.js +1 -1
  13. package/dist/public/ui.cjs +1 -1
  14. package/dist/public/ui.es.js +1 -1
  15. package/dist/superdoc.cjs +65 -7
  16. package/dist/superdoc.es.js +65 -7
  17. package/dist-cdn/superdoc.min.js +35 -35
  18. package/package.json +2 -2
  19. /package/dist/chunks/{_plugin-vue_export-helper-BTwbGDKw.cjs → _plugin-vue_export-helper-CZ1Nl59K.cjs} +0 -0
  20. /package/dist/chunks/{_plugin-vue_export-helper-CInC0bKI.es.js → _plugin-vue_export-helper-DSMAhhwD.es.js} +0 -0
  21. /package/dist/chunks/{constants-CY3R3_kF.es.js → constants-BfH0br5u.es.js} +0 -0
  22. /package/dist/chunks/{constants-sbCZ2O_A.cjs → constants-D7TNtyJd.cjs} +0 -0
@@ -1,4 +1,4 @@
1
- import { t as __plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-CInC0bKI.es.js";
1
+ import { t as __plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-DSMAhhwD.es.js";
2
2
  import { computed, createCommentVNode, createElementBlock, createElementVNode, normalizeClass, onMounted, openBlock, ref, toDisplayString, withKeys, withModifiers } from "vue";
3
3
  var _hoisted_1 = ["onKeydown"];
4
4
  var _hoisted_2 = { class: "sd-find-replace__row" };
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-1Y-nnZJ3.cjs");
2
- const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper-BTwbGDKw.cjs");
2
+ const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper-CZ1Nl59K.cjs");
3
3
  let vue = require("vue");
4
4
  var _hoisted_1 = ["onKeydown"];
5
5
  var _hoisted_2 = { class: "sd-find-replace__row" };
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-1Y-nnZJ3.cjs");
2
- const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper-BTwbGDKw.cjs");
2
+ const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper-CZ1Nl59K.cjs");
3
3
  let vue = require("vue");
4
4
  var _hoisted_1 = ["onKeydown"];
5
5
  var _hoisted_2 = ["id"];
@@ -1,4 +1,4 @@
1
- import { t as __plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-CInC0bKI.es.js";
1
+ import { t as __plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-DSMAhhwD.es.js";
2
2
  import { computed, createCommentVNode, createElementBlock, createElementVNode, openBlock, ref, toDisplayString, vModelText, withDirectives, withKeys, withModifiers } from "vue";
3
3
  var _hoisted_1 = ["onKeydown"];
4
4
  var _hoisted_2 = ["id"];
@@ -1,5 +1,5 @@
1
- import { t as __plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-CInC0bKI.es.js";
2
- import { n as PDF_TO_CSS_UNITS, t as OUTPUT_SCALE } from "./constants-CY3R3_kF.es.js";
1
+ import { t as __plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-DSMAhhwD.es.js";
2
+ import { n as PDF_TO_CSS_UNITS, t as OUTPUT_SCALE } from "./constants-BfH0br5u.es.js";
3
3
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, markRaw, mergeProps, normalizeStyle, onBeforeUnmount, onMounted, openBlock, ref, renderList, shallowRef, watch } from "vue";
4
4
  const floor = (val, precision) => {
5
5
  const multiplier = 10 ** (precision || 0);
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-1Y-nnZJ3.cjs");
2
- const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper-BTwbGDKw.cjs");
3
- const require_constants = require("./constants-sbCZ2O_A.cjs");
2
+ const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper-CZ1Nl59K.cjs");
3
+ const require_constants = require("./constants-D7TNtyJd.cjs");
4
4
  let vue = require("vue");
5
5
  const floor = (val, precision) => {
6
6
  const multiplier = 10 ** (precision || 0);
@@ -1,3 +1,64 @@
1
+ const DOM_CLASS_NAMES = {
2
+ PAGE: "superdoc-page",
3
+ FRAGMENT: "superdoc-fragment",
4
+ LINE: "superdoc-line",
5
+ INLINE_SDT_WRAPPER: "superdoc-structured-content-inline",
6
+ INLINE_SDT_LABEL: "superdoc-structured-content-inline__label",
7
+ BLOCK_SDT: "superdoc-structured-content-block",
8
+ BLOCK_SDT_LABEL: "superdoc-structured-content__label",
9
+ TABLE_FRAGMENT: "superdoc-table-fragment",
10
+ DOCUMENT_SECTION: "superdoc-document-section",
11
+ SDT_GROUP_HOVER: "sdt-group-hover",
12
+ TOC_ENTRY: "superdoc-toc-entry",
13
+ TOC_GROUP_HOVER: "toc-group-hover",
14
+ IMAGE_FRAGMENT: "superdoc-image-fragment",
15
+ INLINE_IMAGE: "superdoc-inline-image",
16
+ LIST_MARKER: "superdoc-list-marker",
17
+ INLINE_IMAGE_CLIP_WRAPPER: "superdoc-inline-image-clip-wrapper",
18
+ ANNOTATION: "annotation",
19
+ ANNOTATION_CONTENT: "annotation-content",
20
+ ANNOTATION_CARET_ANCHOR: "annotation-caret-anchor"
21
+ };
22
+ DOM_CLASS_NAMES.INLINE_SDT_LABEL, DOM_CLASS_NAMES.BLOCK_SDT_LABEL;
23
+ const DATA_ATTRS = {
24
+ PM_START: "data-pm-start",
25
+ PM_END: "data-pm-end",
26
+ LAYOUT_EPOCH: "data-layout-epoch",
27
+ TABLE_BOUNDARIES: "data-table-boundaries",
28
+ SDT_ID: "data-sdt-id",
29
+ SDT_TYPE: "data-sdt-type",
30
+ FIELD_ID: "data-field-id",
31
+ FIELD_TYPE: "data-field-type",
32
+ DRAGGABLE: "data-draggable",
33
+ DISPLAY_LABEL: "data-display-label",
34
+ VARIANT: "data-variant",
35
+ TYPE: "data-type",
36
+ LAYOUT_BOUNDARY_SCHEMA: "data-layout-boundary-schema",
37
+ LAYOUT_FRAGMENT_ID: "data-layout-fragment-id",
38
+ LAYOUT_STORY: "data-layout-story",
39
+ LAYOUT_BLOCK_REF: "data-layout-block-ref"
40
+ };
41
+ const decodeLayoutStoryDataset = (raw) => {
42
+ if (!raw) return { kind: "unknown" };
43
+ if (raw === "body") return { kind: "body" };
44
+ const idx = raw.indexOf(":");
45
+ const kind = idx === -1 ? raw : raw.slice(0, idx);
46
+ const id = idx === -1 ? void 0 : raw.slice(idx + 1);
47
+ switch (kind) {
48
+ case "body":
49
+ case "header":
50
+ case "footer":
51
+ case "footnote":
52
+ case "endnote":
53
+ case "textbox": return id ? {
54
+ kind,
55
+ id
56
+ } : { kind };
57
+ default: return { kind: "unknown" };
58
+ }
59
+ };
60
+ `${DOM_CLASS_NAMES.BLOCK_SDT}${DATA_ATTRS.SDT_ID}`;
61
+ `${DATA_ATTRS.DRAGGABLE}`;
1
62
  function getParagraphInlineDirection(attrs) {
2
63
  const fromContext = attrs?.directionContext?.inlineDirection;
3
64
  if (fromContext != null) return fromContext;
@@ -1266,67 +1327,6 @@ function collectEntityHitsFromChain(start, stopAt) {
1266
1327
  }
1267
1328
  return hits;
1268
1329
  }
1269
- const DOM_CLASS_NAMES = {
1270
- PAGE: "superdoc-page",
1271
- FRAGMENT: "superdoc-fragment",
1272
- LINE: "superdoc-line",
1273
- INLINE_SDT_WRAPPER: "superdoc-structured-content-inline",
1274
- INLINE_SDT_LABEL: "superdoc-structured-content-inline__label",
1275
- BLOCK_SDT: "superdoc-structured-content-block",
1276
- BLOCK_SDT_LABEL: "superdoc-structured-content__label",
1277
- TABLE_FRAGMENT: "superdoc-table-fragment",
1278
- DOCUMENT_SECTION: "superdoc-document-section",
1279
- SDT_GROUP_HOVER: "sdt-group-hover",
1280
- TOC_ENTRY: "superdoc-toc-entry",
1281
- TOC_GROUP_HOVER: "toc-group-hover",
1282
- IMAGE_FRAGMENT: "superdoc-image-fragment",
1283
- INLINE_IMAGE: "superdoc-inline-image",
1284
- LIST_MARKER: "superdoc-list-marker",
1285
- INLINE_IMAGE_CLIP_WRAPPER: "superdoc-inline-image-clip-wrapper",
1286
- ANNOTATION: "annotation",
1287
- ANNOTATION_CONTENT: "annotation-content",
1288
- ANNOTATION_CARET_ANCHOR: "annotation-caret-anchor"
1289
- };
1290
- DOM_CLASS_NAMES.INLINE_SDT_LABEL, DOM_CLASS_NAMES.BLOCK_SDT_LABEL;
1291
- const DATA_ATTRS = {
1292
- PM_START: "data-pm-start",
1293
- PM_END: "data-pm-end",
1294
- LAYOUT_EPOCH: "data-layout-epoch",
1295
- TABLE_BOUNDARIES: "data-table-boundaries",
1296
- SDT_ID: "data-sdt-id",
1297
- SDT_TYPE: "data-sdt-type",
1298
- FIELD_ID: "data-field-id",
1299
- FIELD_TYPE: "data-field-type",
1300
- DRAGGABLE: "data-draggable",
1301
- DISPLAY_LABEL: "data-display-label",
1302
- VARIANT: "data-variant",
1303
- TYPE: "data-type",
1304
- LAYOUT_BOUNDARY_SCHEMA: "data-layout-boundary-schema",
1305
- LAYOUT_FRAGMENT_ID: "data-layout-fragment-id",
1306
- LAYOUT_STORY: "data-layout-story",
1307
- LAYOUT_BLOCK_REF: "data-layout-block-ref"
1308
- };
1309
- const decodeLayoutStoryDataset = (raw) => {
1310
- if (!raw) return { kind: "unknown" };
1311
- if (raw === "body") return { kind: "body" };
1312
- const idx = raw.indexOf(":");
1313
- const kind = idx === -1 ? raw : raw.slice(0, idx);
1314
- const id = idx === -1 ? void 0 : raw.slice(idx + 1);
1315
- switch (kind) {
1316
- case "body":
1317
- case "header":
1318
- case "footer":
1319
- case "footnote":
1320
- case "endnote":
1321
- case "textbox": return id ? {
1322
- kind,
1323
- id
1324
- } : { kind };
1325
- default: return { kind: "unknown" };
1326
- }
1327
- };
1328
- `${DOM_CLASS_NAMES.BLOCK_SDT}${DATA_ATTRS.SDT_ID}`;
1329
- `${DATA_ATTRS.DRAGGABLE}`;
1330
1330
  var schemaBooleanOrNull = () => ({ oneOf: [{ type: "boolean" }, { type: "null" }] });
1331
1331
  var schemaStringOrNull = () => ({ oneOf: [{
1332
1332
  type: "string",
@@ -7740,6 +7740,14 @@ function createSuperDocUI(options) {
7740
7740
  if (typeof helper?.apply !== "function") return { reason: SUPERDOC_UI_REASONS.hostCapabilityUnavailable };
7741
7741
  return { helper };
7742
7742
  };
7743
+ const activateContentControlChrome = (id) => {
7744
+ const host = getHost();
7745
+ if (typeof host?.getHandles !== "function") return;
7746
+ try {
7747
+ const contentControls$1 = (host.getHandles()?.editing)?.contentControls;
7748
+ if (typeof contentControls$1?.activate === "function") contentControls$1.activate({ id });
7749
+ } catch {}
7750
+ };
7743
7751
  const selection = {
7744
7752
  get: selectionSnap.get,
7745
7753
  getSnapshot: selectionSnap.getSnapshot,
@@ -8432,6 +8440,7 @@ function createSuperDocUI(options) {
8432
8440
  success: false,
8433
8441
  reason: "not-reachable"
8434
8442
  };
8443
+ activateContentControlChrome(id);
8435
8444
  return { success: true };
8436
8445
  }
8437
8446
  };
@@ -9636,4 +9645,4 @@ var DEFAULT_FONT_SIZE_OPTIONS = [
9636
9645
  function commandIsActive(descriptor, selection) {
9637
9646
  return descriptor.activeMark ? selection.activeMarks.includes(descriptor.activeMark) : false;
9638
9647
  }
9639
- export { createV2ReviewMutationReconciler as a, isV2EditableTextMutationEvent as i, shallowEqual as n, getV2TrackedChangeMutationImpact as o, BUILT_IN_COMMAND_IDS as r, composeAuthorColorResolver as s, createSuperDocUI as t };
9648
+ export { createV2ReviewMutationReconciler as a, DOM_CLASS_NAMES as c, isV2EditableTextMutationEvent as i, shallowEqual as n, getV2TrackedChangeMutationImpact as o, BUILT_IN_COMMAND_IDS as r, composeAuthorColorResolver as s, createSuperDocUI as t };
@@ -1,3 +1,64 @@
1
+ const DOM_CLASS_NAMES = {
2
+ PAGE: "superdoc-page",
3
+ FRAGMENT: "superdoc-fragment",
4
+ LINE: "superdoc-line",
5
+ INLINE_SDT_WRAPPER: "superdoc-structured-content-inline",
6
+ INLINE_SDT_LABEL: "superdoc-structured-content-inline__label",
7
+ BLOCK_SDT: "superdoc-structured-content-block",
8
+ BLOCK_SDT_LABEL: "superdoc-structured-content__label",
9
+ TABLE_FRAGMENT: "superdoc-table-fragment",
10
+ DOCUMENT_SECTION: "superdoc-document-section",
11
+ SDT_GROUP_HOVER: "sdt-group-hover",
12
+ TOC_ENTRY: "superdoc-toc-entry",
13
+ TOC_GROUP_HOVER: "toc-group-hover",
14
+ IMAGE_FRAGMENT: "superdoc-image-fragment",
15
+ INLINE_IMAGE: "superdoc-inline-image",
16
+ LIST_MARKER: "superdoc-list-marker",
17
+ INLINE_IMAGE_CLIP_WRAPPER: "superdoc-inline-image-clip-wrapper",
18
+ ANNOTATION: "annotation",
19
+ ANNOTATION_CONTENT: "annotation-content",
20
+ ANNOTATION_CARET_ANCHOR: "annotation-caret-anchor"
21
+ };
22
+ const STRUCTURED_CONTENT_CHROME_LABEL_CLASS_NAMES = [DOM_CLASS_NAMES.INLINE_SDT_LABEL, DOM_CLASS_NAMES.BLOCK_SDT_LABEL];
23
+ const DATA_ATTRS = {
24
+ PM_START: "data-pm-start",
25
+ PM_END: "data-pm-end",
26
+ LAYOUT_EPOCH: "data-layout-epoch",
27
+ TABLE_BOUNDARIES: "data-table-boundaries",
28
+ SDT_ID: "data-sdt-id",
29
+ SDT_TYPE: "data-sdt-type",
30
+ FIELD_ID: "data-field-id",
31
+ FIELD_TYPE: "data-field-type",
32
+ DRAGGABLE: "data-draggable",
33
+ DISPLAY_LABEL: "data-display-label",
34
+ VARIANT: "data-variant",
35
+ TYPE: "data-type",
36
+ LAYOUT_BOUNDARY_SCHEMA: "data-layout-boundary-schema",
37
+ LAYOUT_FRAGMENT_ID: "data-layout-fragment-id",
38
+ LAYOUT_STORY: "data-layout-story",
39
+ LAYOUT_BLOCK_REF: "data-layout-block-ref"
40
+ };
41
+ const decodeLayoutStoryDataset = (raw) => {
42
+ if (!raw) return { kind: "unknown" };
43
+ if (raw === "body") return { kind: "body" };
44
+ const idx = raw.indexOf(":");
45
+ const kind = idx === -1 ? raw : raw.slice(0, idx);
46
+ const id = idx === -1 ? void 0 : raw.slice(idx + 1);
47
+ switch (kind) {
48
+ case "body":
49
+ case "header":
50
+ case "footer":
51
+ case "footnote":
52
+ case "endnote":
53
+ case "textbox": return id ? {
54
+ kind,
55
+ id
56
+ } : { kind };
57
+ default: return { kind: "unknown" };
58
+ }
59
+ };
60
+ const SDT_BLOCK_WITH_ID_SELECTOR = `.${DOM_CLASS_NAMES.BLOCK_SDT}[${DATA_ATTRS.SDT_ID}]`;
61
+ const DRAGGABLE_SELECTOR = `[${DATA_ATTRS.DRAGGABLE}="true"]`;
1
62
  function getParagraphInlineDirection(attrs) {
2
63
  const fromContext = attrs?.directionContext?.inlineDirection;
3
64
  if (fromContext != null) return fromContext;
@@ -1485,67 +1546,6 @@ function collectEntityHitsFromChain(start, stopAt) {
1485
1546
  }
1486
1547
  return hits;
1487
1548
  }
1488
- const DOM_CLASS_NAMES = {
1489
- PAGE: "superdoc-page",
1490
- FRAGMENT: "superdoc-fragment",
1491
- LINE: "superdoc-line",
1492
- INLINE_SDT_WRAPPER: "superdoc-structured-content-inline",
1493
- INLINE_SDT_LABEL: "superdoc-structured-content-inline__label",
1494
- BLOCK_SDT: "superdoc-structured-content-block",
1495
- BLOCK_SDT_LABEL: "superdoc-structured-content__label",
1496
- TABLE_FRAGMENT: "superdoc-table-fragment",
1497
- DOCUMENT_SECTION: "superdoc-document-section",
1498
- SDT_GROUP_HOVER: "sdt-group-hover",
1499
- TOC_ENTRY: "superdoc-toc-entry",
1500
- TOC_GROUP_HOVER: "toc-group-hover",
1501
- IMAGE_FRAGMENT: "superdoc-image-fragment",
1502
- INLINE_IMAGE: "superdoc-inline-image",
1503
- LIST_MARKER: "superdoc-list-marker",
1504
- INLINE_IMAGE_CLIP_WRAPPER: "superdoc-inline-image-clip-wrapper",
1505
- ANNOTATION: "annotation",
1506
- ANNOTATION_CONTENT: "annotation-content",
1507
- ANNOTATION_CARET_ANCHOR: "annotation-caret-anchor"
1508
- };
1509
- const STRUCTURED_CONTENT_CHROME_LABEL_CLASS_NAMES = [DOM_CLASS_NAMES.INLINE_SDT_LABEL, DOM_CLASS_NAMES.BLOCK_SDT_LABEL];
1510
- const DATA_ATTRS = {
1511
- PM_START: "data-pm-start",
1512
- PM_END: "data-pm-end",
1513
- LAYOUT_EPOCH: "data-layout-epoch",
1514
- TABLE_BOUNDARIES: "data-table-boundaries",
1515
- SDT_ID: "data-sdt-id",
1516
- SDT_TYPE: "data-sdt-type",
1517
- FIELD_ID: "data-field-id",
1518
- FIELD_TYPE: "data-field-type",
1519
- DRAGGABLE: "data-draggable",
1520
- DISPLAY_LABEL: "data-display-label",
1521
- VARIANT: "data-variant",
1522
- TYPE: "data-type",
1523
- LAYOUT_BOUNDARY_SCHEMA: "data-layout-boundary-schema",
1524
- LAYOUT_FRAGMENT_ID: "data-layout-fragment-id",
1525
- LAYOUT_STORY: "data-layout-story",
1526
- LAYOUT_BLOCK_REF: "data-layout-block-ref"
1527
- };
1528
- const decodeLayoutStoryDataset = (raw) => {
1529
- if (!raw) return { kind: "unknown" };
1530
- if (raw === "body") return { kind: "body" };
1531
- const idx = raw.indexOf(":");
1532
- const kind = idx === -1 ? raw : raw.slice(0, idx);
1533
- const id = idx === -1 ? void 0 : raw.slice(idx + 1);
1534
- switch (kind) {
1535
- case "body":
1536
- case "header":
1537
- case "footer":
1538
- case "footnote":
1539
- case "endnote":
1540
- case "textbox": return id ? {
1541
- kind,
1542
- id
1543
- } : { kind };
1544
- default: return { kind: "unknown" };
1545
- }
1546
- };
1547
- const SDT_BLOCK_WITH_ID_SELECTOR = `.${DOM_CLASS_NAMES.BLOCK_SDT}[${DATA_ATTRS.SDT_ID}]`;
1548
- const DRAGGABLE_SELECTOR = `[${DATA_ATTRS.DRAGGABLE}="true"]`;
1549
1549
  var schemaBooleanOrNull = () => ({ oneOf: [{ type: "boolean" }, { type: "null" }] });
1550
1550
  var schemaStringOrNull = () => ({ oneOf: [{
1551
1551
  type: "string",
@@ -7962,6 +7962,14 @@ function createSuperDocUI(options) {
7962
7962
  if (typeof helper?.apply !== "function") return { reason: SUPERDOC_UI_REASONS.hostCapabilityUnavailable };
7963
7963
  return { helper };
7964
7964
  };
7965
+ const activateContentControlChrome = (id) => {
7966
+ const host = getHost();
7967
+ if (typeof host?.getHandles !== "function") return;
7968
+ try {
7969
+ const contentControls$1 = (host.getHandles()?.editing)?.contentControls;
7970
+ if (typeof contentControls$1?.activate === "function") contentControls$1.activate({ id });
7971
+ } catch {}
7972
+ };
7965
7973
  const selection = {
7966
7974
  get: selectionSnap.get,
7967
7975
  getSnapshot: selectionSnap.getSnapshot,
@@ -8654,6 +8662,7 @@ function createSuperDocUI(options) {
8654
8662
  success: false,
8655
8663
  reason: "not-reachable"
8656
8664
  };
8665
+ activateContentControlChrome(id);
8657
8666
  return { success: true };
8658
8667
  }
8659
8668
  };
@@ -9864,6 +9873,12 @@ Object.defineProperty(exports, "BUILT_IN_COMMAND_IDS", {
9864
9873
  return BUILT_IN_COMMAND_IDS;
9865
9874
  }
9866
9875
  });
9876
+ Object.defineProperty(exports, "DOM_CLASS_NAMES", {
9877
+ enumerable: true,
9878
+ get: function() {
9879
+ return DOM_CLASS_NAMES;
9880
+ }
9881
+ });
9867
9882
  Object.defineProperty(exports, "composeAuthorColorResolver", {
9868
9883
  enumerable: true,
9869
9884
  get: function() {
@@ -7,7 +7,7 @@ const COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
7
7
  var PRIVATE_ENGINE_INFO = (0, __superdoc_docx_engine_collaboration_upgrade_engine.getCollaborationUpgradeEngineInfo)();
8
8
  var ENGINE_INFO = Object.freeze({
9
9
  ...PRIVATE_ENGINE_INFO,
10
- superdocVersion: "2.4.0-next.4",
10
+ superdocVersion: "2.4.0-next.5",
11
11
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
12
12
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
13
13
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -6,7 +6,7 @@ const COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
6
6
  var PRIVATE_ENGINE_INFO = getCollaborationUpgradeEngineInfo$1();
7
7
  var ENGINE_INFO = Object.freeze({
8
8
  ...PRIVATE_ENGINE_INFO,
9
- superdocVersion: "2.4.0-next.4",
9
+ superdocVersion: "2.4.0-next.5",
10
10
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
11
11
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
12
12
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("../chunks/rolldown-runtime-1Y-nnZJ3.cjs");
3
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-BHMQEL2y.cjs");
3
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-sMXbYzhs.cjs");
4
4
  let react = require("react");
5
5
  var SuperDocUIContext = (0, react.createContext)(null);
6
6
  function disposeOwnedUi(ref) {
@@ -1,4 +1,4 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-Dli6Wq70.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-BquF8bnZ.es.js";
2
2
  import { createContext, createElement, useCallback, useContext, useEffect, useRef, useState } from "react";
3
3
  var SuperDocUIContext = createContext(null);
4
4
  function disposeOwnedUi(ref) {
@@ -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-BHMQEL2y.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-sMXbYzhs.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-Dli6Wq70.es.js";
1
+ import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-BquF8bnZ.es.js";
2
2
  export { BUILT_IN_COMMAND_IDS, createSuperDocUI, shallowEqual };
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;
@@ -39026,6 +39026,11 @@ var BuiltInToolbar = class extends require_eventemitter3.import_eventemitter3.de
39026
39026
  function createBuiltInToolbar(config) {
39027
39027
  return new BuiltInToolbar(config);
39028
39028
  }
39029
+ var STRUCTURED_CONTENT_FRAME_SELECTOR = [
39030
+ "[data-sdt-type=\"structuredContent\"][data-sdt-id]",
39031
+ "[data-sdt-type=\"structuredContent\"][data-sdt-container-id]",
39032
+ "[data-sdt-container-type=\"structuredContent\"][data-sdt-container-id]"
39033
+ ].join(", ");
39029
39034
  var DEFAULT_AWARENESS_PALETTE = Object.freeze([
39030
39035
  "#FF6B6B",
39031
39036
  "#4ECDC4",
@@ -39113,6 +39118,33 @@ function onCollaborationProviderSynced(provider, onSynced) {
39113
39118
  if (isCollaborationProviderSynced(provider)) finish();
39114
39119
  return cleanup;
39115
39120
  }
39121
+ function getClickedContentControlId(event, root) {
39122
+ const path = event.composedPath();
39123
+ if (!path.includes(root)) return null;
39124
+ const control = path.find((target$1) => target$1 instanceof HTMLElement && target$1.matches(STRUCTURED_CONTENT_FRAME_SELECTOR));
39125
+ if (!control) return null;
39126
+ 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));
39127
+ const containerId = control.getAttribute("data-sdt-container-id")?.trim() || null;
39128
+ const sdtId = control.getAttribute("data-sdt-id")?.trim() || null;
39129
+ return onBlockLabel ? containerId ?? sdtId : sdtId ?? containerId;
39130
+ }
39131
+ function getContentControlItems(result) {
39132
+ if (!result || typeof result !== "object") return [];
39133
+ const items = result.items;
39134
+ return Array.isArray(items) ? items : [];
39135
+ }
39136
+ function toSdtRef(item) {
39137
+ if (!item || typeof item.id !== "string" || item.kind !== "inline" && item.kind !== "block" || typeof item.controlType !== "string") return null;
39138
+ const tag = item.properties?.tag;
39139
+ const alias = item.properties?.alias;
39140
+ return {
39141
+ id: item.id,
39142
+ controlType: item.controlType,
39143
+ scope: item.kind,
39144
+ ...typeof tag === "string" && tag ? { tag } : {},
39145
+ ...typeof alias === "string" && alias ? { alias } : {}
39146
+ };
39147
+ }
39116
39148
  function isV2ActiveEditorFacade(editor) {
39117
39149
  return Boolean(editor && typeof editor === "object" && editor.editorVersion === 2);
39118
39150
  }
@@ -39166,6 +39198,10 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
39166
39198
  #v2LockUnsub = null;
39167
39199
  #pendingV2LockSeed = null;
39168
39200
  #mountWrapper = null;
39201
+ #contentControlClickRoot = null;
39202
+ #handleContentControlClick = (event) => {
39203
+ this.#emitContentControlClick(event);
39204
+ };
39169
39205
  #ui = null;
39170
39206
  #uiConfig = normalizeUiConfig({});
39171
39207
  get uiConfig() {
@@ -39249,8 +39285,28 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
39249
39285
  const container = typeof config.selector === "string" ? document.querySelector(config.selector) : config.selector;
39250
39286
  if (!(container instanceof HTMLElement)) throw new Error("SuperDoc: selector must be a valid CSS selector string or DOM element");
39251
39287
  this.#surfaceManager = new SurfaceManager({ getModuleConfig: () => this.#surfacesConfig });
39288
+ this.#contentControlClickRoot = container;
39289
+ container.addEventListener("click", this.#handleContentControlClick, true);
39252
39290
  this.#init(config, container);
39253
39291
  }
39292
+ async #emitContentControlClick(event) {
39293
+ const root = this.#contentControlClickRoot;
39294
+ if (!root) return;
39295
+ const id = getClickedContentControlId(event, root);
39296
+ const list = this.activeEditor?.doc?.contentControls?.list;
39297
+ if (!id || typeof list !== "function") return;
39298
+ try {
39299
+ const result = await list();
39300
+ if (this.#destroyed) return;
39301
+ const target$1 = toSdtRef(getContentControlItems(result).find((item) => item.id === id));
39302
+ if (target$1) this.emit("content-control:click", {
39303
+ target: target$1,
39304
+ source: "pointer"
39305
+ });
39306
+ } catch {
39307
+ return;
39308
+ }
39309
+ }
39254
39310
  async #init(config, container) {
39255
39311
  this.config = {
39256
39312
  ...this.config,
@@ -39297,7 +39353,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
39297
39353
  this.config.colors = shuffleArray(this.config.colors);
39298
39354
  this.userColorMap = /* @__PURE__ */ new Map();
39299
39355
  this.colorIndex = 0;
39300
- this.version = "2.4.0-next.4";
39356
+ this.version = "2.4.0-next.5";
39301
39357
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
39302
39358
  this.superdocId = config.superdocId || require_uuid.v4_default();
39303
39359
  this.colors = this.config.colors ?? [];
@@ -40825,6 +40881,8 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
40825
40881
  }
40826
40882
  destroy() {
40827
40883
  this.#destroyed = true;
40884
+ this.#contentControlClickRoot?.removeEventListener("click", this.#handleContentControlClick, true);
40885
+ this.#contentControlClickRoot = null;
40828
40886
  if (this.#abortUpgrade) {
40829
40887
  this.#abortUpgrade();
40830
40888
  this.#abortUpgrade = null;