@beyondwork/docx-react-component 1.0.128 → 1.0.130

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 (108) hide show
  1. package/dist/api/public-types.cjs +809 -78
  2. package/dist/api/public-types.d.cts +2 -2
  3. package/dist/api/public-types.d.ts +2 -2
  4. package/dist/api/public-types.js +4 -4
  5. package/dist/api/v3.cjs +2059 -402
  6. package/dist/api/v3.d.cts +3 -3
  7. package/dist/api/v3.d.ts +3 -3
  8. package/dist/api/v3.js +13 -13
  9. package/dist/{canonical-document-CXCFCbAz.d.cts → canonical-document-BMtONpgf.d.cts} +6 -0
  10. package/dist/{canonical-document-CXCFCbAz.d.ts → canonical-document-BMtONpgf.d.ts} +6 -0
  11. package/dist/{chunk-MWSBGJQO.js → chunk-35RHOE6I.js} +105 -4
  12. package/dist/{chunk-2QL5DAKF.js → chunk-3YCQM2RV.js} +6 -6
  13. package/dist/{chunk-ESJ2MES5.js → chunk-4YCWECLZ.js} +1 -1
  14. package/dist/{chunk-4EENH4FG.js → chunk-6TBLDBCL.js} +1 -1
  15. package/dist/{chunk-XRACP43Q.js → chunk-7G5GR3VV.js} +469 -32
  16. package/dist/{chunk-CXSYRB37.js → chunk-A3GSNB4G.js} +183 -55
  17. package/dist/{chunk-5DGKFNQT.js → chunk-A66ZVUAT.js} +150 -1
  18. package/dist/{chunk-YIYM4ZAP.js → chunk-CI2TD3T4.js} +1 -1
  19. package/dist/{chunk-TQDQU2E3.js → chunk-DGA7M77X.js} +2 -2
  20. package/dist/{chunk-EB6M3GE6.js → chunk-FM4K4XFJ.js} +100 -97
  21. package/dist/{chunk-D5HYZQTG.js → chunk-HYHCRMR7.js} +1 -1
  22. package/dist/{chunk-6F5QW44A.js → chunk-KNHMXKC6.js} +2 -2
  23. package/dist/{chunk-4YJVRIUB.js → chunk-M7YRJX6V.js} +61 -29
  24. package/dist/{chunk-KFCQYZXR.js → chunk-OVLZQ6FZ.js} +61 -0
  25. package/dist/{chunk-BYSRJ4FE.js → chunk-PHMWH23E.js} +1 -1
  26. package/dist/{chunk-ZDOAUP3V.js → chunk-Q7Y57KOK.js} +2 -2
  27. package/dist/{chunk-LZVBNDGU.js → chunk-QXKQPUOM.js} +3 -3
  28. package/dist/{chunk-CX42VC67.js → chunk-SYQWQ6FE.js} +1 -1
  29. package/dist/{chunk-KV435YXO.js → chunk-T5YYFDZB.js} +1 -1
  30. package/dist/{chunk-YHZHPXDB.js → chunk-THVM6EP5.js} +419 -24
  31. package/dist/{chunk-V6XVZFFH.js → chunk-VRKK2CSZ.js} +111 -90
  32. package/dist/{chunk-OL2UEHRP.js → chunk-WUDSNHWF.js} +1 -1
  33. package/dist/{chunk-LCYYR57Q.js → chunk-WZDKNF37.js} +666 -107
  34. package/dist/{chunk-6EROGFUF.js → chunk-YLL7MF5C.js} +444 -131
  35. package/dist/{chunk-YD2JE54B.js → chunk-ZVC23LKV.js} +1 -1
  36. package/dist/compare.cjs +100 -97
  37. package/dist/compare.d.cts +1 -1
  38. package/dist/compare.d.ts +1 -1
  39. package/dist/compare.js +3 -3
  40. package/dist/core/commands/formatting-commands.d.cts +2 -2
  41. package/dist/core/commands/formatting-commands.d.ts +2 -2
  42. package/dist/core/commands/image-commands.cjs +182 -54
  43. package/dist/core/commands/image-commands.d.cts +2 -2
  44. package/dist/core/commands/image-commands.d.ts +2 -2
  45. package/dist/core/commands/image-commands.js +5 -5
  46. package/dist/core/commands/section-layout-commands.d.cts +2 -2
  47. package/dist/core/commands/section-layout-commands.d.ts +2 -2
  48. package/dist/core/commands/style-commands.d.cts +2 -2
  49. package/dist/core/commands/style-commands.d.ts +2 -2
  50. package/dist/core/commands/table-structure-commands.cjs +182 -54
  51. package/dist/core/commands/table-structure-commands.d.cts +2 -2
  52. package/dist/core/commands/table-structure-commands.d.ts +2 -2
  53. package/dist/core/commands/table-structure-commands.js +4 -4
  54. package/dist/core/commands/text-commands.cjs +182 -54
  55. package/dist/core/commands/text-commands.d.cts +2 -2
  56. package/dist/core/commands/text-commands.d.ts +2 -2
  57. package/dist/core/commands/text-commands.js +5 -5
  58. package/dist/core/selection/mapping.d.cts +2 -2
  59. package/dist/core/selection/mapping.d.ts +2 -2
  60. package/dist/core/state/editor-state.d.cts +2 -2
  61. package/dist/core/state/editor-state.d.ts +2 -2
  62. package/dist/index.cjs +2765 -557
  63. package/dist/index.d.cts +5 -5
  64. package/dist/index.d.ts +5 -5
  65. package/dist/index.js +52 -28
  66. package/dist/io/docx-session.cjs +267 -211
  67. package/dist/io/docx-session.d.cts +4 -4
  68. package/dist/io/docx-session.d.ts +4 -4
  69. package/dist/io/docx-session.js +6 -6
  70. package/dist/legal.cjs +9 -20
  71. package/dist/legal.d.cts +1 -1
  72. package/dist/legal.d.ts +1 -1
  73. package/dist/legal.js +3 -3
  74. package/dist/{loader-19ct2Be0.d.ts → loader-B-aL5HGD.d.ts} +3 -3
  75. package/dist/{loader-CoXQ2wGd.d.cts → loader-DiY_ZgKl.d.cts} +3 -3
  76. package/dist/{measurement-backend-canvas-Q3MJMEYX.js → measurement-backend-canvas-F7ZYDACK.js} +1 -1
  77. package/dist/{public-types-B-CskQen.d.cts → public-types-DyqnxxO9.d.ts} +252 -2
  78. package/dist/{public-types-7KZsNGE2.d.ts → public-types-gvubspUI.d.cts} +252 -2
  79. package/dist/public-types.cjs +809 -78
  80. package/dist/public-types.d.cts +2 -2
  81. package/dist/public-types.d.ts +2 -2
  82. package/dist/public-types.js +4 -4
  83. package/dist/runtime/collab.d.cts +3 -3
  84. package/dist/runtime/collab.d.ts +3 -3
  85. package/dist/runtime/document-runtime.cjs +1887 -313
  86. package/dist/runtime/document-runtime.d.cts +2 -2
  87. package/dist/runtime/document-runtime.d.ts +2 -2
  88. package/dist/runtime/document-runtime.js +17 -17
  89. package/dist/{session-B5015J4v.d.cts → session-BUN6B-Vj.d.cts} +3 -3
  90. package/dist/{session-C2i8-d6v.d.ts → session-CDB0hohT.d.ts} +3 -3
  91. package/dist/session.cjs +267 -211
  92. package/dist/session.d.cts +5 -5
  93. package/dist/session.d.ts +5 -5
  94. package/dist/session.js +7 -7
  95. package/dist/tailwind.cjs +809 -78
  96. package/dist/tailwind.d.cts +2 -2
  97. package/dist/tailwind.d.ts +2 -2
  98. package/dist/tailwind.js +8 -8
  99. package/dist/{types-DNhN0WeN.d.cts → types-C4bz3kDU.d.cts} +2 -2
  100. package/dist/{types-yvrQuGX9.d.ts → types-VWH6CRvG.d.ts} +2 -2
  101. package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +3 -3
  102. package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +3 -3
  103. package/dist/ui-tailwind/editor-surface/search-plugin.js +5 -5
  104. package/dist/ui-tailwind.cjs +809 -78
  105. package/dist/ui-tailwind.d.cts +3 -3
  106. package/dist/ui-tailwind.d.ts +3 -3
  107. package/dist/ui-tailwind.js +8 -8
  108. package/package.json +1 -1
@@ -4,7 +4,7 @@ import {
4
4
  MAIN_STORY_KEY,
5
5
  collectCanonicalFieldRegionIdentities,
6
6
  collectEditableTargetRefs
7
- } from "./chunk-5DGKFNQT.js";
7
+ } from "./chunk-A66ZVUAT.js";
8
8
  import {
9
9
  describeOpaqueFragment,
10
10
  describeStructuredWrapperBlock,
@@ -1366,12 +1366,13 @@ function getLevelStartAt(level, levelDefinitions) {
1366
1366
  return levelDefinitions.get(level)?.startAt ?? DEFAULT_NUMBERING_START_AT;
1367
1367
  }
1368
1368
  function getNumberingFormatPosture(format, value) {
1369
- if (!isSupportedNumberingFormat(format)) {
1369
+ const registryEntry = getNumberingFormatRegistryEntry(format);
1370
+ if (!registryEntry || registryEntry.renderSupport === "approximated") {
1370
1371
  return {
1371
1372
  status: "approximated",
1372
1373
  requestedFormat: format,
1373
1374
  renderedFormat: "decimal",
1374
- reason: "unsupported-numbering-format-decimal-fallback"
1375
+ reason: registryEntry?.fallbackReason ?? "unsupported-numbering-format-decimal-fallback"
1375
1376
  };
1376
1377
  }
1377
1378
  if (value !== void 0 && ((format === "upperRoman" || format === "lowerRoman") && (value <= 0 || value >= 4e3) || (format === "cardinalText" || format === "ordinalText") && (!Number.isInteger(value) || value < 1 || value > 999) || (format === "upperLetter" || format === "lowerLetter" || format === "chicago") && value < 1)) {
@@ -1402,56 +1403,148 @@ function renderLevelText(text, counters, levelDefinitions) {
1402
1403
  });
1403
1404
  return rendered.trim().length > 0 ? rendered : null;
1404
1405
  }
1405
- var SUPPORTED_NUMBERING_FORMATS = /* @__PURE__ */ new Set([
1406
- "decimal",
1407
- "decimalZero",
1408
- "upperLetter",
1409
- "lowerLetter",
1410
- "upperRoman",
1411
- "lowerRoman",
1412
- "hex",
1413
- "ordinal",
1414
- "cardinalText",
1415
- "ordinalText",
1416
- "chicago",
1417
- "bullet",
1418
- "none"
1419
- ]);
1420
1406
  function isSupportedNumberingFormat(format) {
1421
- return SUPPORTED_NUMBERING_FORMATS.has(format);
1407
+ return getNumberingFormatRegistryEntry(format)?.renderSupport === "supported";
1408
+ }
1409
+ function getNumberingFormatRegistryEntry(format) {
1410
+ return NUMBERING_FORMAT_REGISTRY.get(format);
1422
1411
  }
1423
1412
  function formatCounter(value, format) {
1424
- switch (format) {
1425
- case "decimal":
1426
- return String(value);
1427
- case "decimalZero":
1428
- return String(value).padStart(2, "0");
1429
- case "upperLetter":
1430
- return toAlphabetic2(value).toUpperCase();
1431
- case "lowerLetter":
1432
- return toAlphabetic2(value).toLowerCase();
1433
- case "upperRoman":
1434
- return toRoman2(value).toUpperCase();
1435
- case "lowerRoman":
1436
- return toRoman2(value).toLowerCase();
1437
- case "hex":
1438
- return value >= 0 ? value.toString(16).toUpperCase() : String(value);
1439
- case "ordinal":
1440
- return toOrdinal2(value);
1441
- case "cardinalText":
1442
- return toCardinalText2(value);
1443
- case "ordinalText":
1444
- return toOrdinalText2(value);
1445
- case "chicago":
1446
- return toChicago2(value);
1447
- case "bullet":
1448
- return "";
1449
- case "none":
1450
- return "";
1451
- default:
1452
- return String(value);
1413
+ return getNumberingFormatRegistryEntry(format)?.render(value) ?? String(value);
1414
+ }
1415
+ var exactNumberingFormatEntries = [
1416
+ {
1417
+ format: "decimal",
1418
+ renderSupport: "supported",
1419
+ renderedFormat: "decimal",
1420
+ supportsMutation: true,
1421
+ render: (value) => String(value)
1422
+ },
1423
+ {
1424
+ format: "decimalZero",
1425
+ renderSupport: "supported",
1426
+ renderedFormat: "decimalZero",
1427
+ supportsMutation: true,
1428
+ render: (value) => String(value).padStart(2, "0")
1429
+ },
1430
+ {
1431
+ format: "upperLetter",
1432
+ renderSupport: "supported",
1433
+ renderedFormat: "upperLetter",
1434
+ supportsMutation: true,
1435
+ render: (value) => toAlphabetic2(value).toUpperCase()
1436
+ },
1437
+ {
1438
+ format: "lowerLetter",
1439
+ renderSupport: "supported",
1440
+ renderedFormat: "lowerLetter",
1441
+ supportsMutation: true,
1442
+ render: (value) => toAlphabetic2(value).toLowerCase()
1443
+ },
1444
+ {
1445
+ format: "upperRoman",
1446
+ renderSupport: "supported",
1447
+ renderedFormat: "upperRoman",
1448
+ supportsMutation: true,
1449
+ render: (value) => toRoman2(value).toUpperCase()
1450
+ },
1451
+ {
1452
+ format: "lowerRoman",
1453
+ renderSupport: "supported",
1454
+ renderedFormat: "lowerRoman",
1455
+ supportsMutation: true,
1456
+ render: (value) => toRoman2(value).toLowerCase()
1457
+ },
1458
+ {
1459
+ format: "hex",
1460
+ renderSupport: "supported",
1461
+ renderedFormat: "hex",
1462
+ supportsMutation: true,
1463
+ render: (value) => value >= 0 ? value.toString(16).toUpperCase() : String(value)
1464
+ },
1465
+ {
1466
+ format: "ordinal",
1467
+ renderSupport: "supported",
1468
+ renderedFormat: "ordinal",
1469
+ supportsMutation: true,
1470
+ render: toOrdinal2
1471
+ },
1472
+ {
1473
+ format: "cardinalText",
1474
+ renderSupport: "supported",
1475
+ renderedFormat: "cardinalText",
1476
+ supportsMutation: true,
1477
+ render: toCardinalText2
1478
+ },
1479
+ {
1480
+ format: "ordinalText",
1481
+ renderSupport: "supported",
1482
+ renderedFormat: "ordinalText",
1483
+ supportsMutation: true,
1484
+ render: toOrdinalText2
1485
+ },
1486
+ {
1487
+ format: "chicago",
1488
+ renderSupport: "supported",
1489
+ renderedFormat: "chicago",
1490
+ supportsMutation: true,
1491
+ render: toChicago2
1492
+ },
1493
+ {
1494
+ format: "bullet",
1495
+ renderSupport: "supported",
1496
+ renderedFormat: "bullet",
1497
+ supportsMutation: true,
1498
+ render: () => ""
1499
+ },
1500
+ {
1501
+ format: "none",
1502
+ renderSupport: "supported",
1503
+ renderedFormat: "none",
1504
+ supportsMutation: true,
1505
+ render: () => ""
1453
1506
  }
1454
- }
1507
+ ];
1508
+ var approximatedDecimalFormats = [
1509
+ "decimalEnclosedCircle",
1510
+ "decimalEnclosedFullstop",
1511
+ "decimalEnclosedParen",
1512
+ "decimalFullWidth",
1513
+ "decimalHalfWidth",
1514
+ "aiueo",
1515
+ "iroha",
1516
+ "ganada",
1517
+ "chosung",
1518
+ "russianLower",
1519
+ "russianUpper",
1520
+ "hebrew1",
1521
+ "hebrew2",
1522
+ "arabicAlpha",
1523
+ "arabicAbjad",
1524
+ "thaiLetters",
1525
+ "thaiNumbers",
1526
+ "hindiLetters",
1527
+ "hindiNumbers",
1528
+ "ideographDigital",
1529
+ "ideographTraditional",
1530
+ "chineseCounting",
1531
+ "japaneseCounting",
1532
+ "japaneseLegal"
1533
+ ];
1534
+ var approximatedNumberingFormatEntries = approximatedDecimalFormats.map((format) => ({
1535
+ format,
1536
+ renderSupport: "approximated",
1537
+ renderedFormat: "decimal",
1538
+ supportsMutation: false,
1539
+ fallbackReason: "unsupported-numbering-format-decimal-fallback",
1540
+ render: (value) => String(value)
1541
+ }));
1542
+ var NUMBERING_FORMAT_REGISTRY = new Map(
1543
+ [...exactNumberingFormatEntries, ...approximatedNumberingFormatEntries].map((entry) => [
1544
+ entry.format,
1545
+ entry
1546
+ ])
1547
+ );
1455
1548
  function toOrdinal2(value) {
1456
1549
  if (value <= 0) return String(value);
1457
1550
  const lastTwo = value % 100;
@@ -2105,12 +2198,36 @@ var DEFAULT_HYPERLINK_COLOR_HEX = "0563C1";
2105
2198
  function resolveHyperlinkRunFormatting(input, catalog, resolver) {
2106
2199
  const augmentedInput = input.characterStyleId === void 0 ? { ...input, characterStyleId: HYPERLINK_CHARACTER_STYLE_ID } : input;
2107
2200
  const cascade = resolveEffectiveRunFormatting(augmentedInput, catalog);
2108
- const resolvedColor = resolveHyperlinkColorHex(cascade, resolver);
2201
+ const resolvedColor = resolveHyperlinkColorHex(
2202
+ stripInheritedColorHexForImplicitHyperlink(input, catalog, cascade),
2203
+ resolver
2204
+ );
2109
2205
  if (resolvedColor && resolvedColor !== cascade.colorHex) {
2110
2206
  return { ...cascade, colorHex: resolvedColor };
2111
2207
  }
2112
2208
  return cascade;
2113
2209
  }
2210
+ function hasDirectNonAutoColor(input) {
2211
+ return Boolean(input.direct?.colorHex && input.direct.colorHex !== "auto");
2212
+ }
2213
+ function characterStyleDeclaresColorHex(styleId, catalog) {
2214
+ if (!catalog) return false;
2215
+ const chain = resolveCharacterStyleChain(styleId, catalog);
2216
+ return chain.some((chainStyleId) => {
2217
+ const colorHex = catalog.characters[chainStyleId]?.runProperties?.colorHex;
2218
+ return Boolean(colorHex && colorHex !== "auto");
2219
+ });
2220
+ }
2221
+ function stripInheritedColorHexForImplicitHyperlink(originalInput, catalog, cascade) {
2222
+ if (originalInput.characterStyleId !== void 0 || hasDirectNonAutoColor(originalInput) || !cascade.colorHex || cascade.colorHex === "auto" || characterStyleDeclaresColorHex(HYPERLINK_CHARACTER_STYLE_ID, catalog)) {
2223
+ return cascade;
2224
+ }
2225
+ const inheritedCascade = resolveEffectiveRunFormatting(originalInput, catalog);
2226
+ if (inheritedCascade.colorHex !== cascade.colorHex) {
2227
+ return cascade;
2228
+ }
2229
+ return { ...cascade, colorHex: void 0 };
2230
+ }
2114
2231
  function resolveHyperlinkColorHex(cascade, resolver) {
2115
2232
  if (cascade.colorHex && cascade.colorHex !== "auto") {
2116
2233
  return cascade.colorHex;
@@ -2950,6 +3067,7 @@ function createEditorSurfaceSnapshot(document, _selection, activeStory = { kind:
2950
3067
  ...options.authorColorPalette ? { authorColorPalette: options.authorColorPalette } : {}
2951
3068
  });
2952
3069
  const editableTargetsByBlockPath = options.editableTargetsByBlockPath ?? indexEditableTargetsByBlockPath(document);
3070
+ const layoutIdentitiesByBlockPath = options.layoutIdentitiesByBlockPath;
2953
3071
  const activeStoryBlockPathBase = getActiveStoryBlockPathBase(document, activeStory);
2954
3072
  chartModelStore.beginBuildPass(document);
2955
3073
  const unsupportedNumberingFormatsSeen = options.emitFormattingTelemetry ? /* @__PURE__ */ new Set() : null;
@@ -2973,6 +3091,7 @@ function createEditorSurfaceSnapshot(document, _selection, activeStory = { kind:
2973
3091
  activeStory.kind !== "main",
2974
3092
  !isInViewport,
2975
3093
  editableTargetsByBlockPath,
3094
+ layoutIdentitiesByBlockPath,
2976
3095
  `${activeStoryBlockPathBase}/block[${index}]`
2977
3096
  );
2978
3097
  if (isInViewport) {
@@ -3039,7 +3158,7 @@ function isIndexInAnyRange(index, ranges) {
3039
3158
  }
3040
3159
  return false;
3041
3160
  }
3042
- function createSurfaceBlock(block, document, cursor, counters, formattingContext, promoteSecondaryStoryTextBoxes, cullBuild = false, editableTargetsByBlockPath = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH, blockPath) {
3161
+ function createSurfaceBlock(block, document, cursor, counters, formattingContext, promoteSecondaryStoryTextBoxes, cullBuild = false, editableTargetsByBlockPath = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH, layoutIdentitiesByBlockPath, blockPath) {
3043
3162
  if (block.type === "opaque_block") {
3044
3163
  const fragment = getOpaqueFragment(document.preservation, block.fragmentId);
3045
3164
  const descriptor = fragment ? describeOpaqueFragment(fragment) : null;
@@ -3076,6 +3195,7 @@ function createSurfaceBlock(block, document, cursor, counters, formattingContext
3076
3195
  promoteSecondaryStoryTextBoxes,
3077
3196
  cullBuild,
3078
3197
  editableTargetsByBlockPath,
3198
+ layoutIdentitiesByBlockPath,
3079
3199
  blockPath
3080
3200
  );
3081
3201
  }
@@ -3116,6 +3236,7 @@ function createSurfaceBlock(block, document, cursor, counters, formattingContext
3116
3236
  promoteSecondaryStoryTextBoxes,
3117
3237
  cullBuild,
3118
3238
  editableTargetsByBlockPath,
3239
+ layoutIdentitiesByBlockPath,
3119
3240
  blockPath
3120
3241
  );
3121
3242
  }
@@ -3198,10 +3319,11 @@ function createSurfaceBlock(block, document, cursor, counters, formattingContext
3198
3319
  cullBuild,
3199
3320
  editableTargetsByBlockPath,
3200
3321
  blockPath,
3201
- blockPath !== void 0 ? editableTargetsByBlockPath.get(blockPath) : void 0
3322
+ blockPath !== void 0 ? editableTargetsByBlockPath.get(blockPath) : void 0,
3323
+ blockPath !== void 0 ? layoutIdentitiesByBlockPath?.get(blockPath) : void 0
3202
3324
  );
3203
3325
  }
3204
- function createTableBlock(tableIndex, table, document, cursor, counters, formattingContext, promoteSecondaryStoryTextBoxes, cullBuild = false, editableTargetsByBlockPath = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH, tablePath) {
3326
+ function createTableBlock(tableIndex, table, document, cursor, counters, formattingContext, promoteSecondaryStoryTextBoxes, cullBuild = false, editableTargetsByBlockPath = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH, layoutIdentitiesByBlockPath, tablePath) {
3205
3327
  const lockedFragmentIds = [];
3206
3328
  let innerCursor = cursor;
3207
3329
  if (cullBuild) {
@@ -3218,6 +3340,7 @@ function createTableBlock(tableIndex, table, document, cursor, counters, formatt
3218
3340
  promoteSecondaryStoryTextBoxes,
3219
3341
  true,
3220
3342
  editableTargetsByBlockPath,
3343
+ layoutIdentitiesByBlockPath,
3221
3344
  tablePath !== void 0 ? `${tablePath}/row[${rowIndex}]/cell[${cellIndex}]/block[${childIndex}]` : void 0
3222
3345
  );
3223
3346
  lockedFragmentIds.push(...result.lockedFragmentIds);
@@ -3233,6 +3356,7 @@ function createTableBlock(tableIndex, table, document, cursor, counters, formatt
3233
3356
  to: innerCursor,
3234
3357
  styleId: table.styleId,
3235
3358
  ...table.sourceRef !== void 0 ? { sourceRef: table.sourceRef } : {},
3359
+ ...tablePath !== void 0 && layoutIdentitiesByBlockPath?.get(tablePath) !== void 0 ? { layoutIdentity: layoutIdentitiesByBlockPath.get(tablePath) } : {},
3236
3360
  gridColumns: table.gridColumns,
3237
3361
  rows: []
3238
3362
  },
@@ -3270,6 +3394,7 @@ function createTableBlock(tableIndex, table, document, cursor, counters, formatt
3270
3394
  promoteSecondaryStoryTextBoxes,
3271
3395
  cullBuild,
3272
3396
  editableTargetsByBlockPath,
3397
+ layoutIdentitiesByBlockPath,
3273
3398
  tablePath !== void 0 ? `${tablePath}/row[${rowIndex}]/cell[${cellIndex}]/block[${childIndex}]` : void 0
3274
3399
  );
3275
3400
  cellContent.push(result.block);
@@ -3358,6 +3483,7 @@ function createTableBlock(tableIndex, table, document, cursor, counters, formatt
3358
3483
  to: innerCursor,
3359
3484
  styleId: table.styleId,
3360
3485
  ...table.sourceRef !== void 0 ? { sourceRef: table.sourceRef } : {},
3486
+ ...tablePath !== void 0 && layoutIdentitiesByBlockPath?.get(tablePath) !== void 0 ? { layoutIdentity: layoutIdentitiesByBlockPath.get(tablePath) } : {},
3361
3487
  gridColumns: table.gridColumns,
3362
3488
  ...gridColumnsRelative ? { gridColumnsRelative } : {},
3363
3489
  ...resolvedTable.table?.alignment ? { alignment: resolvedTable.table.alignment } : {},
@@ -3545,7 +3671,7 @@ function resolveCellBorderStyles(borders, tableBorders, position) {
3545
3671
  if (left) result.borderLeft = left;
3546
3672
  return result;
3547
3673
  }
3548
- function createSdtBlock(sdtIndex, block, document, cursor, counters, formattingContext, promoteSecondaryStoryTextBoxes, cullBuild = false, editableTargetsByBlockPath = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH, sdtPath) {
3674
+ function createSdtBlock(sdtIndex, block, document, cursor, counters, formattingContext, promoteSecondaryStoryTextBoxes, cullBuild = false, editableTargetsByBlockPath = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH, layoutIdentitiesByBlockPath, sdtPath) {
3549
3675
  const children = [];
3550
3676
  const lockedFragmentIds = [];
3551
3677
  let innerCursor = cursor;
@@ -3562,6 +3688,7 @@ function createSdtBlock(sdtIndex, block, document, cursor, counters, formattingC
3562
3688
  promoteSecondaryStoryTextBoxes,
3563
3689
  cullBuild,
3564
3690
  editableTargetsByBlockPath,
3691
+ layoutIdentitiesByBlockPath,
3565
3692
  sdtPath !== void 0 ? `${sdtPath}/block[${childIndex}]` : void 0
3566
3693
  );
3567
3694
  children.push(result.block);
@@ -3604,7 +3731,7 @@ function getRecursableSdtBlockedReasonCode(block) {
3604
3731
  ].filter(Boolean).join(" ").toLowerCase();
3605
3732
  return searchText.includes("table of contents") || /\btoc\b/u.test(searchText) ? "workflow_preserve_only" : null;
3606
3733
  }
3607
- function createParagraphBlock(paragraphIndex, paragraph, document, start, formattingContext, promoteSecondaryStoryTextBoxes, cullBuild = false, editableTargetsByBlockPath = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH, blockPath, editableTarget) {
3734
+ function createParagraphBlock(paragraphIndex, paragraph, document, start, formattingContext, promoteSecondaryStoryTextBoxes, cullBuild = false, editableTargetsByBlockPath = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH, blockPath, editableTarget, layoutIdentity) {
3608
3735
  const themeResolver = formattingContext.theme;
3609
3736
  const effectiveNumbering = formattingContext.resolveEffectiveParagraphNumbering(paragraph);
3610
3737
  let resolvedNumbering = null;
@@ -3627,6 +3754,7 @@ function createParagraphBlock(paragraphIndex, paragraph, document, start, format
3627
3754
  from: start,
3628
3755
  to: start,
3629
3756
  ...editableTarget !== void 0 ? { editableTarget } : {},
3757
+ ...layoutIdentity !== void 0 ? { layoutIdentity } : {},
3630
3758
  ...paragraph.styleId ? { styleId: paragraph.styleId } : {},
3631
3759
  ...effectiveNumbering ? { numbering: effectiveNumbering } : {},
3632
3760
  ...resolvedNumbering ? {
@@ -247,6 +247,7 @@ function collectCanonicalLayoutInputs(doc) {
247
247
  const blockContexts = collectStoryBlockContexts(doc);
248
248
  return {
249
249
  stories: collectCanonicalStoryIdentities(doc),
250
+ layoutIdentities: collectLayoutInputIdentities(doc, blockContexts),
250
251
  fieldRegions: collectCanonicalFieldRegionIdentities(doc),
251
252
  numbering: collectCanonicalNumberingLayoutInputs(doc, blockContexts),
252
253
  tables: collectCanonicalTableLayoutInputs(blockContexts),
@@ -255,6 +256,116 @@ function collectCanonicalLayoutInputs(doc) {
255
256
  editableTargets: collectEditableTargetRefs(doc)
256
257
  };
257
258
  }
259
+ function collectLayoutInputIdentities(doc, contexts = collectStoryBlockContexts(doc)) {
260
+ const identities = [];
261
+ const editableTargets = collectEditableTargetRefs(doc);
262
+ const editableByStoryBlock = new Map(
263
+ editableTargets.map((target) => [`${target.storyKey}:${target.blockPath}`, target])
264
+ );
265
+ for (const context of contexts) {
266
+ walkBlocks(context.blocks, context.storyKey, context.basePath, {
267
+ paragraph(paragraph, blockPath) {
268
+ const styleNumbering = paragraph.numbering === void 0 && paragraph.styleId !== void 0 ? resolveParagraphStyleNumbering(doc, paragraph.styleId) : void 0;
269
+ const numbering = paragraph.numbering ?? styleNumbering;
270
+ const editableTargetRef = editableByStoryBlock.get(`${context.storyKey}:${blockPath}`);
271
+ identities.push(
272
+ createLayoutInputIdentity({
273
+ storyKey: context.storyKey,
274
+ blockPath,
275
+ block: paragraph,
276
+ ...editableTargetRef !== void 0 ? { editableTargetRef } : {},
277
+ ...numbering !== void 0 ? {
278
+ list: {
279
+ numberingInstanceId: numbering.numberingInstanceId,
280
+ level: numbering.level ?? 0,
281
+ ...paragraph.numbering?.sourceRef !== void 0 ? { markerSourceRef: paragraph.numbering.sourceRef } : {}
282
+ }
283
+ } : {}
284
+ })
285
+ );
286
+ },
287
+ table(table, blockPath) {
288
+ identities.push(
289
+ createLayoutInputIdentity({
290
+ storyKey: context.storyKey,
291
+ blockPath,
292
+ block: table,
293
+ table: { tableBlockPath: blockPath }
294
+ })
295
+ );
296
+ },
297
+ inline(inline, blockPath, inlinePath) {
298
+ const objectId = objectIdForInline(inline);
299
+ if (!objectId) return;
300
+ const sourceRef = sourceRefForInline(inline);
301
+ identities.push({
302
+ storyKey: context.storyKey,
303
+ blockPath,
304
+ blockId: `${context.storyKey}:${inlinePath}`,
305
+ ...sourceRef !== void 0 ? { sourceRef } : {},
306
+ object: {
307
+ objectId,
308
+ ...sourceRef !== void 0 ? { anchorSourceRef: sourceRef } : {}
309
+ }
310
+ });
311
+ }
312
+ });
313
+ }
314
+ return identities;
315
+ }
316
+ function createLayoutInputIdentity(input) {
317
+ const sourceRef = sourceRefForBlock(input.block);
318
+ const blockId = input.block.type === "paragraph" && input.block.wordExtensionIds?.paraId ? `para:${input.block.wordExtensionIds.paraId}` : sourceRef?.sourceId !== void 0 ? `source:${sourceRef.sourceId}` : `${input.storyKey}:${input.blockPath}`;
319
+ return {
320
+ storyKey: input.storyKey,
321
+ blockPath: input.blockPath,
322
+ blockId,
323
+ ...sourceRef !== void 0 ? { sourceRef } : {},
324
+ ...input.editableTargetRef !== void 0 ? { editableTargetRef: input.editableTargetRef } : {},
325
+ ...input.table !== void 0 ? { table: input.table } : {},
326
+ ...input.list !== void 0 ? { list: input.list } : {}
327
+ };
328
+ }
329
+ function sourceRefForBlock(block) {
330
+ return "sourceRef" in block ? block.sourceRef : void 0;
331
+ }
332
+ function sourceRefForInline(inline) {
333
+ return "sourceRef" in inline ? inline.sourceRef : void 0;
334
+ }
335
+ function objectIdForInline(inline) {
336
+ switch (inline.type) {
337
+ case "image":
338
+ return inline.mediaId;
339
+ case "drawing_frame":
340
+ return objectIdForDrawingContent(inline.content) ?? inline.sourceRef?.sourceId;
341
+ case "shape":
342
+ case "vml_shape":
343
+ case "wordart":
344
+ return inline.preserveOnlyObject?.sourceId ?? `raw:${sha256TextHex(inline.rawXml).slice(0, 16)}`;
345
+ case "chart_preview":
346
+ case "smartart_preview":
347
+ return inline.previewMediaId ?? `raw:${sha256TextHex(inline.rawXml).slice(0, 16)}`;
348
+ case "ole_embed":
349
+ return inline.relationshipId ?? inline.id ?? inline.sourceRef?.sourceId;
350
+ case "opaque_inline":
351
+ return inline.fragmentId;
352
+ default:
353
+ return void 0;
354
+ }
355
+ }
356
+ function objectIdForDrawingContent(content) {
357
+ switch (content.type) {
358
+ case "picture":
359
+ return content.mediaId ?? content.packagePartName ?? content.blipRef;
360
+ case "chart_preview":
361
+ case "smartart_preview":
362
+ return content.previewMediaId ?? `raw:${sha256TextHex(content.rawXml).slice(0, 16)}`;
363
+ case "shape":
364
+ return content.preserveOnlyObject?.sourceId ?? `raw:${sha256TextHex(content.rawXml).slice(0, 16)}`;
365
+ case "opaque":
366
+ return content.preserveOnlyObject?.sourceId ?? `raw:${sha256TextHex(content.rawXml).slice(0, 16)}`;
367
+ }
368
+ }
258
369
  function collectEditableTargetRefs(doc, cache) {
259
370
  const targets = [];
260
371
  for (const context of collectStoryBlockContexts(doc)) {
@@ -2403,6 +2514,16 @@ function collectCanonicalNumberingLayoutInputs(doc, contexts = collectStoryBlock
2403
2514
  const instance = doc.numbering.instances[numbering.numberingInstanceId];
2404
2515
  const abstractDefinition = instance?.abstractNumberingId === void 0 ? void 0 : doc.numbering.abstractDefinitions[instance.abstractNumberingId];
2405
2516
  inputs.push({
2517
+ identity: createLayoutInputIdentity({
2518
+ storyKey: context.storyKey,
2519
+ blockPath,
2520
+ block: paragraph,
2521
+ list: {
2522
+ numberingInstanceId: numbering.numberingInstanceId,
2523
+ level: numbering.level ?? 0,
2524
+ ...paragraph.numbering?.sourceRef !== void 0 ? { markerSourceRef: paragraph.numbering.sourceRef } : {}
2525
+ }
2526
+ }),
2406
2527
  numberingKey: `${context.storyKey}:${blockPath}:numbering`,
2407
2528
  storyKey: context.storyKey,
2408
2529
  blockPath,
@@ -2704,6 +2825,12 @@ function projectTableLayoutInput(table, storyKey, blockPath) {
2704
2825
  (row, rowIndex) => projectTableRowLayoutInput(row, tableKey, rowIndex)
2705
2826
  );
2706
2827
  return {
2828
+ identity: createLayoutInputIdentity({
2829
+ storyKey,
2830
+ blockPath,
2831
+ block: table,
2832
+ table: { tableBlockPath: blockPath }
2833
+ }),
2707
2834
  tableKey,
2708
2835
  storyKey,
2709
2836
  blockPath,
@@ -2791,6 +2918,16 @@ function projectDrawingFrameAnchor(node, storyKey, blockPath, inlinePath) {
2791
2918
  const objectKey = `${storyKey}:${inlinePath}`;
2792
2919
  const textBoxBody = projectTextBoxBodyLayoutInput(content, objectKey, sourceRef, `${inlinePath}/txbx`);
2793
2920
  return {
2921
+ identity: {
2922
+ storyKey,
2923
+ blockPath,
2924
+ blockId: objectKey,
2925
+ ...sourceRef !== void 0 ? { sourceRef } : {},
2926
+ object: {
2927
+ objectId: objectKey,
2928
+ ...sourceRef !== void 0 ? { anchorSourceRef: sourceRef } : {}
2929
+ }
2930
+ },
2794
2931
  objectKey,
2795
2932
  storyKey,
2796
2933
  blockPath,
@@ -2912,8 +3049,19 @@ function projectTextBoxRunLayoutInput(inline, paragraphKey, inlineIndex) {
2912
3049
  }
2913
3050
  function projectLegacyImageAnchor(doc, node, storyKey, blockPath, inlinePath) {
2914
3051
  const media = doc.media.items[node.mediaId];
3052
+ const objectKey = `${storyKey}:${inlinePath}`;
2915
3053
  return {
2916
- objectKey: `${storyKey}:${inlinePath}`,
3054
+ identity: {
3055
+ storyKey,
3056
+ blockPath,
3057
+ blockId: objectKey,
3058
+ ...node.sourceRef !== void 0 ? { sourceRef: node.sourceRef } : {},
3059
+ object: {
3060
+ objectId: objectKey,
3061
+ ...node.sourceRef !== void 0 ? { anchorSourceRef: node.sourceRef } : {}
3062
+ }
3063
+ },
3064
+ objectKey,
2917
3065
  storyKey,
2918
3066
  blockPath,
2919
3067
  inlinePath,
@@ -3099,6 +3247,7 @@ export {
3099
3247
  createHeaderFooterStoryKey,
3100
3248
  createNoteStoryKey,
3101
3249
  collectCanonicalLayoutInputs,
3250
+ collectLayoutInputIdentities,
3102
3251
  collectEditableTargetRefs,
3103
3252
  collectEditableTargetRefsForStoryBlockRanges,
3104
3253
  createEditableTargetBlockCache,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  collectEditableTargetRefs
3
- } from "./chunk-5DGKFNQT.js";
3
+ } from "./chunk-A66ZVUAT.js";
4
4
 
5
5
  // src/api/v3/_ux-response.ts
6
6
  function emitUxResponse(runtime, res) {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  loadDocxSessionAsync
3
- } from "./chunk-V6XVZFFH.js";
3
+ } from "./chunk-VRKK2CSZ.js";
4
4
  import {
5
5
  buildCompatibilityReport,
6
6
  createLoadScheduler
7
- } from "./chunk-ESJ2MES5.js";
7
+ } from "./chunk-4YCWECLZ.js";
8
8
  import {
9
9
  decodePersistedSourcePackageBytes,
10
10
  hasValidPersistedSourcePackageDigest,