@beyondwork/docx-react-component 1.0.124 → 1.0.125

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 (101) hide show
  1. package/dist/api/public-types.cjs +147 -35
  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 +3 -3
  5. package/dist/api/v3.cjs +791 -101
  6. package/dist/api/v3.d.cts +3 -3
  7. package/dist/api/v3.d.ts +3 -3
  8. package/dist/api/v3.js +10 -10
  9. package/dist/{canonical-document-CG2TgAzj.d.cts → canonical-document-CXCFCbAz.d.cts} +2 -0
  10. package/dist/{canonical-document-CG2TgAzj.d.ts → canonical-document-CXCFCbAz.d.ts} +2 -0
  11. package/dist/{chunk-PFYUJU3Q.js → chunk-2QL5DAKF.js} +98 -43
  12. package/dist/{chunk-4IPEZYQX.js → chunk-4EENH4FG.js} +1 -1
  13. package/dist/{chunk-BOHHIVQ2.js → chunk-4G3OS2H6.js} +3 -3
  14. package/dist/{chunk-A74Y5NE4.js → chunk-4YJVRIUB.js} +52 -21
  15. package/dist/{chunk-FNWKE74J.js → chunk-5DGKFNQT.js} +5 -1
  16. package/dist/{chunk-RSYN6FTS.js → chunk-6F5QW44A.js} +2 -2
  17. package/dist/{chunk-KOHQFZMM.js → chunk-BYSRJ4FE.js} +1 -1
  18. package/dist/{chunk-H6IL5ABU.js → chunk-CXSYRB37.js} +64 -20
  19. package/dist/{chunk-32ZAOQ54.js → chunk-D5HYZQTG.js} +1 -1
  20. package/dist/{chunk-TY4DIJO3.js → chunk-ESJ2MES5.js} +1 -1
  21. package/dist/{chunk-ZMRO6P3A.js → chunk-JN444Z5S.js} +505 -44
  22. package/dist/{chunk-IR7QV2BX.js → chunk-KV435YXO.js} +2 -2
  23. package/dist/{chunk-N4VIXI2Z.js → chunk-MWSBGJQO.js} +137 -18
  24. package/dist/{chunk-Q76XPPTA.js → chunk-OHTK7F3F.js} +96 -13
  25. package/dist/{chunk-MPH4ZQS4.js → chunk-QT3LX4FA.js} +321 -51
  26. package/dist/{chunk-7PC6XUNO.js → chunk-TQDQU2E3.js} +2 -2
  27. package/dist/{chunk-4B74ETJI.js → chunk-V6XVZFFH.js} +2 -2
  28. package/dist/{chunk-NAMAWCXN.js → chunk-YD2JE54B.js} +1 -1
  29. package/dist/{chunk-ZRHLLPSJ.js → chunk-YHZHPXDB.js} +85 -18
  30. package/dist/{chunk-HXHQA4BU.js → chunk-YIYM4ZAP.js} +1 -1
  31. package/dist/{chunk-LGWNN3L2.js → chunk-ZDOAUP3V.js} +2 -2
  32. package/dist/compare.d.cts +1 -1
  33. package/dist/compare.d.ts +1 -1
  34. package/dist/core/commands/formatting-commands.d.cts +2 -2
  35. package/dist/core/commands/formatting-commands.d.ts +2 -2
  36. package/dist/core/commands/image-commands.cjs +65 -20
  37. package/dist/core/commands/image-commands.d.cts +2 -2
  38. package/dist/core/commands/image-commands.d.ts +2 -2
  39. package/dist/core/commands/image-commands.js +5 -5
  40. package/dist/core/commands/section-layout-commands.d.cts +2 -2
  41. package/dist/core/commands/section-layout-commands.d.ts +2 -2
  42. package/dist/core/commands/style-commands.d.cts +2 -2
  43. package/dist/core/commands/style-commands.d.ts +2 -2
  44. package/dist/core/commands/table-structure-commands.cjs +65 -20
  45. package/dist/core/commands/table-structure-commands.d.cts +2 -2
  46. package/dist/core/commands/table-structure-commands.d.ts +2 -2
  47. package/dist/core/commands/table-structure-commands.js +4 -4
  48. package/dist/core/commands/text-commands.cjs +66 -21
  49. package/dist/core/commands/text-commands.d.cts +2 -2
  50. package/dist/core/commands/text-commands.d.ts +2 -2
  51. package/dist/core/commands/text-commands.js +5 -5
  52. package/dist/core/selection/mapping.d.cts +2 -2
  53. package/dist/core/selection/mapping.d.ts +2 -2
  54. package/dist/core/state/editor-state.d.cts +2 -2
  55. package/dist/core/state/editor-state.d.ts +2 -2
  56. package/dist/index.cjs +1341 -193
  57. package/dist/index.d.cts +5 -5
  58. package/dist/index.d.ts +5 -5
  59. package/dist/index.js +39 -21
  60. package/dist/io/docx-session.cjs +51 -20
  61. package/dist/io/docx-session.d.cts +4 -4
  62. package/dist/io/docx-session.d.ts +4 -4
  63. package/dist/io/docx-session.js +4 -4
  64. package/dist/legal.cjs +36 -12
  65. package/dist/legal.d.cts +1 -1
  66. package/dist/legal.d.ts +1 -1
  67. package/dist/legal.js +3 -3
  68. package/dist/{loader-D9y4ZRjj.d.ts → loader-B1MxvbeV.d.ts} +3 -3
  69. package/dist/{loader-D9KCtj4m.d.cts → loader-CJXsswcd.d.cts} +3 -3
  70. package/dist/{public-types-CNnMHZM9.d.ts → public-types-BEGhv2YR.d.ts} +108 -6
  71. package/dist/{public-types-DajNGKV4.d.cts → public-types-DrhlQ5Zy.d.cts} +108 -6
  72. package/dist/public-types.cjs +147 -35
  73. package/dist/public-types.d.cts +2 -2
  74. package/dist/public-types.d.ts +2 -2
  75. package/dist/public-types.js +3 -3
  76. package/dist/runtime/collab.d.cts +3 -3
  77. package/dist/runtime/collab.d.ts +3 -3
  78. package/dist/runtime/document-runtime.cjs +685 -98
  79. package/dist/runtime/document-runtime.d.cts +2 -2
  80. package/dist/runtime/document-runtime.d.ts +2 -2
  81. package/dist/runtime/document-runtime.js +14 -14
  82. package/dist/{session-DyQGlryH.d.cts → session-Bp3zqnkS.d.cts} +3 -3
  83. package/dist/{session-DEmaOEjA.d.ts → session-xMOU_NtL.d.ts} +3 -3
  84. package/dist/session.cjs +51 -20
  85. package/dist/session.d.cts +5 -5
  86. package/dist/session.d.ts +5 -5
  87. package/dist/session.js +5 -5
  88. package/dist/tailwind.cjs +238 -73
  89. package/dist/tailwind.d.cts +2 -2
  90. package/dist/tailwind.d.ts +2 -2
  91. package/dist/tailwind.js +7 -7
  92. package/dist/{types-DjJNaE9c.d.ts → types-BFT8536T.d.ts} +2 -2
  93. package/dist/{types-CxE1aZiv.d.cts → types-DDPxEygX.d.cts} +2 -2
  94. package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +3 -3
  95. package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +3 -3
  96. package/dist/ui-tailwind/editor-surface/search-plugin.js +4 -4
  97. package/dist/ui-tailwind.cjs +238 -73
  98. package/dist/ui-tailwind.d.cts +3 -3
  99. package/dist/ui-tailwind.d.ts +3 -3
  100. package/dist/ui-tailwind.js +7 -7
  101. package/package.json +1 -1
@@ -8,7 +8,7 @@ import {
8
8
  getRevisionActionability,
9
9
  normalizeParsedTextDocument,
10
10
  normalizeParsedTextDocumentAsync
11
- } from "./chunk-TY4DIJO3.js";
11
+ } from "./chunk-ESJ2MES5.js";
12
12
  import {
13
13
  OLE_RELATIONSHIP_TYPES,
14
14
  buildFieldRegistry,
@@ -59,7 +59,7 @@ import {
59
59
  resolveHighlightColor,
60
60
  setActiveParseTelemetryBus,
61
61
  toCanonicalNumberingInstanceId
62
- } from "./chunk-A74Y5NE4.js";
62
+ } from "./chunk-4YJVRIUB.js";
63
63
  import {
64
64
  createPersistedSourcePackage,
65
65
  decodeBytesBase64,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  extractBookmarksFromBodyXml
3
- } from "./chunk-A74Y5NE4.js";
3
+ } from "./chunk-4YJVRIUB.js";
4
4
 
5
5
  // src/legal/document-root.ts
6
6
  function resolveWalkableRoot(document) {
@@ -18,13 +18,13 @@ import {
18
18
  resolveSectionVariants,
19
19
  sectionSupportsStoryTarget,
20
20
  storyTargetKey
21
- } from "./chunk-H6IL5ABU.js";
21
+ } from "./chunk-CXSYRB37.js";
22
22
  import {
23
23
  createSelectionSnapshot
24
24
  } from "./chunk-OYGMRRR7.js";
25
25
  import {
26
26
  collectCanonicalLayoutInputs
27
- } from "./chunk-FNWKE74J.js";
27
+ } from "./chunk-5DGKFNQT.js";
28
28
  import {
29
29
  MAIN_STORY_TARGET,
30
30
  createDetachedAnchor,
@@ -5329,8 +5329,9 @@ function projectSurfaceBlocksToPageFragments(surface, pages, splits, columnByBlo
5329
5329
  const perPageCounter = /* @__PURE__ */ new Map();
5330
5330
  const fieldRegionsByParagraphIndex = buildFieldRegionsByParagraphIndex(fieldRegions);
5331
5331
  const generatedTargets = buildGeneratedTargets(editableTargets);
5332
+ const numberingTargets = buildNumberingTargets(editableTargets);
5332
5333
  const bookmarkRanges = buildBookmarkRanges(editableTargets);
5333
- const numberingByParagraphIndex = buildNumberingByParagraphIndex(numberingInputs);
5334
+ const numberingIndex = buildNumberingInputIndex(numberingInputs);
5334
5335
  const pushFragment = (pageIndex, fragment) => {
5335
5336
  const existing = byPage.get(pageIndex);
5336
5337
  if (existing) {
@@ -5366,8 +5367,9 @@ function projectSurfaceBlocksToPageFragments(surface, pages, splits, columnByBlo
5366
5367
  },
5367
5368
  fieldRegionsByParagraphIndex,
5368
5369
  generatedTargets,
5370
+ numberingTargets,
5369
5371
  bookmarkRanges,
5370
- numberingByParagraphIndex,
5372
+ numberingIndex,
5371
5373
  blockPath
5372
5374
  );
5373
5375
  continue;
@@ -5388,8 +5390,9 @@ function projectSurfaceBlocksToPageFragments(surface, pages, splits, columnByBlo
5388
5390
  },
5389
5391
  fieldRegionsByParagraphIndex,
5390
5392
  generatedTargets,
5393
+ numberingTargets,
5391
5394
  bookmarkRanges,
5392
- numberingByParagraphIndex,
5395
+ numberingIndex,
5393
5396
  blockPath
5394
5397
  );
5395
5398
  continue;
@@ -5421,8 +5424,9 @@ function projectSurfaceBlocksToPageFragments(surface, pages, splits, columnByBlo
5421
5424
  paginationRole: "whole",
5422
5425
  fieldRegionsByParagraphIndex,
5423
5426
  generatedTargets,
5427
+ numberingTargets,
5424
5428
  bookmarkRanges,
5425
- numberingByParagraphIndex,
5429
+ numberingIndex,
5426
5430
  blockPath
5427
5431
  }),
5428
5432
  ...columnIndex !== void 0 ? { columnIndex } : {}
@@ -5569,7 +5573,7 @@ function buildRunAnchorsForLine(input) {
5569
5573
  }
5570
5574
  return anchors;
5571
5575
  }
5572
- function emitSlicedParagraph(block, slices, emit, fieldRegionsByParagraphIndex = /* @__PURE__ */ new Map(), generatedTargets = [], bookmarkRanges = [], numberingByParagraphIndex = /* @__PURE__ */ new Map(), blockPath) {
5576
+ function emitSlicedParagraph(block, slices, emit, fieldRegionsByParagraphIndex = /* @__PURE__ */ new Map(), generatedTargets = [], numberingTargets = [], bookmarkRanges = [], numberingIndex = EMPTY_NUMBERING_INPUT_INDEX, blockPath) {
5573
5577
  for (let i = 0; i < slices.length; i += 1) {
5574
5578
  const slice = slices[i];
5575
5579
  const heightTwips = slice.heightTwips ?? estimateSliceHeightFromLines(slice.lineRange);
@@ -5594,8 +5598,9 @@ function emitSlicedParagraph(block, slices, emit, fieldRegionsByParagraphIndex =
5594
5598
  paginationRole: slice.lineRange.from > 0 ? "continuation" : "slice",
5595
5599
  fieldRegionsByParagraphIndex,
5596
5600
  generatedTargets,
5601
+ numberingTargets,
5597
5602
  bookmarkRanges,
5598
- numberingByParagraphIndex,
5603
+ numberingIndex,
5599
5604
  blockPath
5600
5605
  })
5601
5606
  };
@@ -5616,7 +5621,7 @@ function estimateSliceHeightFromLines(lineRange) {
5616
5621
  const lines = Math.max(0, lineRange.to - lineRange.from);
5617
5622
  return lines * 240;
5618
5623
  }
5619
- function emitSlicedTable(block, slices, emit, fieldRegionsByParagraphIndex = /* @__PURE__ */ new Map(), generatedTargets = [], bookmarkRanges = [], numberingByParagraphIndex = /* @__PURE__ */ new Map(), blockPath) {
5624
+ function emitSlicedTable(block, slices, emit, fieldRegionsByParagraphIndex = /* @__PURE__ */ new Map(), generatedTargets = [], numberingTargets = [], bookmarkRanges = [], numberingIndex = EMPTY_NUMBERING_INPUT_INDEX, blockPath) {
5620
5625
  for (let i = 0; i < slices.length; i += 1) {
5621
5626
  const slice = slices[i];
5622
5627
  const heightTwips = slice.heightTwips ?? estimateSliceHeightFromRows(slice.rowRange);
@@ -5640,8 +5645,9 @@ function emitSlicedTable(block, slices, emit, fieldRegionsByParagraphIndex = /*
5640
5645
  paginationRole: slice.rowRange.from > 0 ? "continuation" : "slice",
5641
5646
  fieldRegionsByParagraphIndex,
5642
5647
  generatedTargets,
5648
+ numberingTargets,
5643
5649
  bookmarkRanges,
5644
- numberingByParagraphIndex,
5650
+ numberingIndex,
5645
5651
  blockPath
5646
5652
  }),
5647
5653
  ...slice.columnIndex !== void 0 ? { columnIndex: slice.columnIndex } : {}
@@ -5715,7 +5721,8 @@ function buildFragmentLayoutObject(input) {
5715
5721
  const numberingRows = collectNumberingLayoutFactsForBlock(
5716
5722
  input.block,
5717
5723
  input.blockPath,
5718
- input.numberingByParagraphIndex
5724
+ input.numberingIndex,
5725
+ input.numberingTargets
5719
5726
  );
5720
5727
  const numbering = input.block.kind === "paragraph" ? numberingRows[0] : void 0;
5721
5728
  const fieldRegions = collectFieldRegionLayoutFacts(
@@ -5886,6 +5893,11 @@ function buildGeneratedTargets(targets) {
5886
5893
  (target) => target.kind === "field-result-text" || target.kind === "hyperlink-text" || target.kind === "hyperlink-destination" || target.kind === "bookmark-anchor" || target.kind === "bookmark-content-range"
5887
5894
  );
5888
5895
  }
5896
+ function buildNumberingTargets(targets) {
5897
+ return targets.filter(
5898
+ (target) => target.listAddress !== void 0 || target.canonicalAddress?.addressKind === "list-item-text"
5899
+ );
5900
+ }
5889
5901
  function buildBookmarkRanges(targets) {
5890
5902
  const anchors = /* @__PURE__ */ new Map();
5891
5903
  const contentRanges = /* @__PURE__ */ new Map();
@@ -5933,14 +5945,27 @@ function buildBookmarkRanges(targets) {
5933
5945
  }
5934
5946
  return ranges;
5935
5947
  }
5936
- function buildNumberingByParagraphIndex(numberingInputs) {
5948
+ var EMPTY_NUMBERING_INPUT_INDEX = {
5949
+ byNumberingKey: /* @__PURE__ */ new Map(),
5950
+ byBlockPath: /* @__PURE__ */ new Map(),
5951
+ byParagraphIndex: /* @__PURE__ */ new Map()
5952
+ };
5953
+ function buildNumberingInputIndex(numberingInputs) {
5954
+ const byNumberingKey = /* @__PURE__ */ new Map();
5955
+ const byBlockPath = /* @__PURE__ */ new Map();
5937
5956
  const byParagraph = /* @__PURE__ */ new Map();
5938
5957
  for (const input of numberingInputs) {
5958
+ if (!byNumberingKey.has(input.numberingKey)) {
5959
+ byNumberingKey.set(input.numberingKey, input);
5960
+ }
5961
+ if (!byBlockPath.has(input.blockPath)) {
5962
+ byBlockPath.set(input.blockPath, input);
5963
+ }
5939
5964
  if (!byParagraph.has(input.paragraphIndex)) {
5940
5965
  byParagraph.set(input.paragraphIndex, input);
5941
5966
  }
5942
5967
  }
5943
- return byParagraph;
5968
+ return { byNumberingKey, byBlockPath, byParagraphIndex: byParagraph };
5944
5969
  }
5945
5970
  function collectBookmarkRangeLayoutFacts(fragmentId, blockPath, bookmarkRanges) {
5946
5971
  if (!blockPath || !bookmarkRanges || bookmarkRanges.length === 0) return [];
@@ -6021,6 +6046,7 @@ function collectNumberingLayoutFacts(block) {
6021
6046
  ...block.numbering?.numberingInstanceId !== void 0 ? { numberingInstanceId: block.numbering.numberingInstanceId } : {},
6022
6047
  ...block.numbering?.level !== void 0 ? { level: block.numbering.level } : {},
6023
6048
  ...block.resolvedNumbering?.format !== void 0 ? { format: block.resolvedNumbering.format } : {},
6049
+ ...block.resolvedNumbering?.formatPosture !== void 0 ? { formatPosture: { ...block.resolvedNumbering.formatPosture } } : {},
6024
6050
  ...block.numberingPrefix !== void 0 ? { markerText: block.numberingPrefix } : {},
6025
6051
  ...block.numberingSuffix !== void 0 ? { markerSuffix: block.numberingSuffix } : {},
6026
6052
  ...block.resolvedNumbering?.geometry.markerJustification !== void 0 ? { markerJustification: block.resolvedNumbering.geometry.markerJustification } : {},
@@ -6048,15 +6074,21 @@ function collectNumberingLayoutFacts(block) {
6048
6074
  } : {}
6049
6075
  };
6050
6076
  }
6051
- function collectNumberingLayoutFactsForBlock(block, blockPath, numberingByParagraphIndex) {
6077
+ function collectNumberingLayoutFactsForBlock(block, blockPath, numberingIndex, numberingTargets = []) {
6052
6078
  const rows = [];
6053
6079
  const seen = /* @__PURE__ */ new Set();
6054
6080
  visitParagraphBlocks(block, (paragraph, context) => {
6055
6081
  const numbering = collectNumberingLayoutFacts(paragraph);
6056
6082
  if (!numbering) return;
6057
6083
  const paragraphIndex = parseParagraphBlockIndex(paragraph.blockId);
6058
- const canonical = paragraphIndex !== void 0 ? numberingByParagraphIndex?.get(paragraphIndex) : void 0;
6059
6084
  const numberingKey = context.path !== void 0 ? `main:${context.path}:numbering` : void 0;
6085
+ const canonical = lookupNumberingInput(
6086
+ numberingIndex,
6087
+ numberingKey,
6088
+ context.path,
6089
+ paragraphIndex
6090
+ );
6091
+ const target = findNumberingTarget(numberingTargets, context.path);
6060
6092
  const numberingLayoutId = numberingKey ?? [
6061
6093
  "numbering",
6062
6094
  paragraph.blockId,
@@ -6065,6 +6097,7 @@ function collectNumberingLayoutFactsForBlock(block, blockPath, numberingByParagr
6065
6097
  ].join(":");
6066
6098
  if (seen.has(numberingLayoutId)) return;
6067
6099
  seen.add(numberingLayoutId);
6100
+ const unavailableReasons = collectNumberingUnavailableReasons(numbering, canonical);
6068
6101
  rows.push({
6069
6102
  numberingLayoutId,
6070
6103
  ...numberingKey !== void 0 ? { numberingKey } : {},
@@ -6072,6 +6105,10 @@ function collectNumberingLayoutFactsForBlock(block, blockPath, numberingByParagr
6072
6105
  ...canonical?.blockPath !== void 0 ? { sourceBlockPath: canonical.blockPath } : context.path !== void 0 ? { sourceBlockPath: context.path } : {},
6073
6106
  sourceBlockId: paragraph.blockId,
6074
6107
  ...paragraphIndex !== void 0 ? { paragraphIndex } : {},
6108
+ ...target?.targetKey !== void 0 ? { targetKey: target.targetKey } : {},
6109
+ ...target?.kind !== void 0 ? { targetKind: target.kind } : {},
6110
+ ...target?.canonicalAddress?.addressKey !== void 0 ? { canonicalAddressKey: target.canonicalAddress.addressKey } : {},
6111
+ ...target?.listAddress?.addressKey !== void 0 ? { listAddressKey: target.listAddress.addressKey } : {},
6075
6112
  ...canonical?.sourceRef !== void 0 ? { sourceRef: { ...canonical.sourceRef } } : {},
6076
6113
  ...canonical?.numberingSourceRef !== void 0 ? { numberingSourceRef: { ...canonical.numberingSourceRef } } : {},
6077
6114
  ...canonical?.numberingOrigin !== void 0 ? { numberingOrigin: canonical.numberingOrigin } : {},
@@ -6079,11 +6116,41 @@ function collectNumberingLayoutFactsForBlock(block, blockPath, numberingByParagr
6079
6116
  ...canonical?.numberingInstanceSourceRef !== void 0 ? { numberingInstanceSourceRef: { ...canonical.numberingInstanceSourceRef } } : {},
6080
6117
  ...canonical?.abstractNumberingId !== void 0 ? { abstractNumberingId: canonical.abstractNumberingId } : {},
6081
6118
  ...canonical?.abstractNumberingSourceRef !== void 0 ? { abstractNumberingSourceRef: { ...canonical.abstractNumberingSourceRef } } : {},
6082
- ...numbering
6119
+ ...numbering,
6120
+ ...unavailableReasons.length > 0 ? { unavailableReasons } : {}
6083
6121
  });
6084
6122
  }, blockPath);
6085
6123
  return rows;
6086
6124
  }
6125
+ function findNumberingTarget(numberingTargets, blockPath) {
6126
+ if (blockPath === void 0) return void 0;
6127
+ return numberingTargets.find((target) => target.blockPath === blockPath);
6128
+ }
6129
+ function lookupNumberingInput(numberingIndex, numberingKey, blockPath, paragraphIndex) {
6130
+ if (!numberingIndex) return void 0;
6131
+ if (numberingKey !== void 0) {
6132
+ const byKey = numberingIndex.byNumberingKey.get(numberingKey);
6133
+ if (byKey !== void 0) return byKey;
6134
+ }
6135
+ if (blockPath !== void 0) {
6136
+ const byPath = numberingIndex.byBlockPath.get(blockPath);
6137
+ if (byPath !== void 0) return byPath;
6138
+ }
6139
+ return paragraphIndex !== void 0 ? numberingIndex.byParagraphIndex.get(paragraphIndex) : void 0;
6140
+ }
6141
+ function collectNumberingUnavailableReasons(numbering, canonical) {
6142
+ const reasons = [];
6143
+ if (canonical === void 0) {
6144
+ reasons.push("canonical-numbering-input-missing");
6145
+ }
6146
+ if (numbering.markerLane === void 0) {
6147
+ reasons.push("numbering-marker-lane-unavailable");
6148
+ }
6149
+ if (numbering.textColumn === void 0) {
6150
+ reasons.push("numbering-text-column-unavailable");
6151
+ }
6152
+ return reasons;
6153
+ }
6087
6154
  function findPageIndexForOffset(pages, offset) {
6088
6155
  for (let i = 0; i < pages.length; i += 1) {
6089
6156
  const page = pages[i];
@@ -6486,8 +6553,8 @@ async function createCanvasProvider(fontLoader) {
6486
6553
  }
6487
6554
 
6488
6555
  // src/runtime/layout/layout-engine-version.ts
6489
- var LAYOUT_ENGINE_VERSION = 87;
6490
- var LAYCACHE_SCHEMA_VERSION = 11;
6556
+ var LAYOUT_ENGINE_VERSION = 88;
6557
+ var LAYCACHE_SCHEMA_VERSION = 12;
6491
6558
 
6492
6559
  // src/runtime/layout/layout-engine-instance.ts
6493
6560
  var FULL_VIEWPORT_WINDOW_KEY = "full";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  collectEditableTargetRefs
3
- } from "./chunk-FNWKE74J.js";
3
+ } from "./chunk-5DGKFNQT.js";
4
4
 
5
5
  // src/api/v3/_ux-response.ts
6
6
  function emitUxResponse(runtime, res) {
@@ -3,12 +3,12 @@ import {
3
3
  createNoopStructuralMutation,
4
4
  findTableCellParagraphSelection,
5
5
  findTopLevelParagraphSelectionNearBlock
6
- } from "./chunk-KOHQFZMM.js";
6
+ } from "./chunk-BYSRJ4FE.js";
7
7
  import {
8
8
  collectEditableTargetRefs,
9
9
  collectStoryBlockContexts,
10
10
  createHeaderFooterStoryKey
11
- } from "./chunk-FNWKE74J.js";
11
+ } from "./chunk-5DGKFNQT.js";
12
12
  import {
13
13
  createDetachedAnchor,
14
14
  createNodeAnchor,
@@ -1,4 +1,4 @@
1
- import { C as CanonicalDocument, B as BlockNode } from './canonical-document-CG2TgAzj.cjs';
1
+ import { C as CanonicalDocument, B as BlockNode } from './canonical-document-CXCFCbAz.cjs';
2
2
 
3
3
  type OpcCompressionMethod = "store" | "deflate";
4
4
  type OpcSurfaceKind = "content" | "relationships" | "content-types";
package/dist/compare.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as CanonicalDocument, B as BlockNode } from './canonical-document-CG2TgAzj.js';
1
+ import { C as CanonicalDocument, B as BlockNode } from './canonical-document-CXCFCbAz.js';
2
2
 
3
3
  type OpcCompressionMethod = "store" | "deflate";
4
4
  type OpcSurfaceKind = "content" | "relationships" | "content-types";
@@ -1,7 +1,7 @@
1
1
  import 'prosemirror-state';
2
2
  import 'prosemirror-model';
3
- export { g4 as Alignment, g5 as FormattingMutationResult, g6 as FormattingOperation, g7 as TextMarkClearTarget, g8 as TextMarkRangeOperation, g9 as applyFormattingOperationToDocument, ga as applyIndentation, gb as applyTextMarkOperationToDocumentRange, gc as getFormattingStateFromRenderSnapshot, gd as isMarkActive, ge as makeSetAlignment, gf as makeSetFontFamily, gg as makeSetFontSize, gh as makeSetHighlight, gi as makeSetTextColor, gj as makeToggleAllCaps, gk as makeToggleBold, gl as makeToggleItalic, gm as makeToggleSmallCaps, gn as makeToggleStrikethrough, go as makeToggleSubscript, gp as makeToggleSuperscript, gq as makeToggleUnderline } from '../../public-types-DajNGKV4.cjs';
4
- import '../../canonical-document-CG2TgAzj.cjs';
3
+ export { g4 as Alignment, g5 as FormattingMutationResult, g6 as FormattingOperation, g7 as TextMarkClearTarget, g8 as TextMarkRangeOperation, g9 as applyFormattingOperationToDocument, ga as applyIndentation, gb as applyTextMarkOperationToDocumentRange, gc as getFormattingStateFromRenderSnapshot, gd as isMarkActive, ge as makeSetAlignment, gf as makeSetFontFamily, gg as makeSetFontSize, gh as makeSetHighlight, gi as makeSetTextColor, gj as makeToggleAllCaps, gk as makeToggleBold, gl as makeToggleItalic, gm as makeToggleSmallCaps, gn as makeToggleStrikethrough, go as makeToggleSubscript, gp as makeToggleSuperscript, gq as makeToggleUnderline } from '../../public-types-DrhlQ5Zy.cjs';
4
+ import '../../canonical-document-CXCFCbAz.cjs';
5
5
  import 'react';
6
6
  import 'yjs';
7
7
  import 'y-protocols/awareness';
@@ -1,7 +1,7 @@
1
1
  import 'prosemirror-state';
2
2
  import 'prosemirror-model';
3
- export { g4 as Alignment, g5 as FormattingMutationResult, g6 as FormattingOperation, g7 as TextMarkClearTarget, g8 as TextMarkRangeOperation, g9 as applyFormattingOperationToDocument, ga as applyIndentation, gb as applyTextMarkOperationToDocumentRange, gc as getFormattingStateFromRenderSnapshot, gd as isMarkActive, ge as makeSetAlignment, gf as makeSetFontFamily, gg as makeSetFontSize, gh as makeSetHighlight, gi as makeSetTextColor, gj as makeToggleAllCaps, gk as makeToggleBold, gl as makeToggleItalic, gm as makeToggleSmallCaps, gn as makeToggleStrikethrough, go as makeToggleSubscript, gp as makeToggleSuperscript, gq as makeToggleUnderline } from '../../public-types-CNnMHZM9.js';
4
- import '../../canonical-document-CG2TgAzj.js';
3
+ export { g4 as Alignment, g5 as FormattingMutationResult, g6 as FormattingOperation, g7 as TextMarkClearTarget, g8 as TextMarkRangeOperation, g9 as applyFormattingOperationToDocument, ga as applyIndentation, gb as applyTextMarkOperationToDocumentRange, gc as getFormattingStateFromRenderSnapshot, gd as isMarkActive, ge as makeSetAlignment, gf as makeSetFontFamily, gg as makeSetFontSize, gh as makeSetHighlight, gi as makeSetTextColor, gj as makeToggleAllCaps, gk as makeToggleBold, gl as makeToggleItalic, gm as makeToggleSmallCaps, gn as makeToggleStrikethrough, go as makeToggleSubscript, gp as makeToggleSuperscript, gq as makeToggleUnderline } from '../../public-types-BEGhv2YR.js';
4
+ import '../../canonical-document-CXCFCbAz.js';
5
5
  import 'react';
6
6
  import 'yjs';
7
7
  import 'y-protocols/awareness';
@@ -1465,7 +1465,7 @@ function createParagraphEditableTarget(paragraph, kind, storyKey, blockPath, tar
1465
1465
  context: { storyKey, insideSdt: contentControl !== void 0 },
1466
1466
  ...tableTarget
1467
1467
  }) : void 0;
1468
- const listAddress = tableIdentity === void 0 && paragraph.numbering !== void 0 ? createCanonicalAddress({
1468
+ const listAddress = paragraph.numbering !== void 0 ? createCanonicalAddress({
1469
1469
  addressKind: "list-item-text",
1470
1470
  storyKey,
1471
1471
  staleCheckKind: "paragraph",
@@ -1499,6 +1499,7 @@ function createParagraphEditableTarget(paragraph, kind, storyKey, blockPath, tar
1499
1499
  ...contentControl !== void 0 ? { contentControl } : {},
1500
1500
  ...tableIdentity !== void 0 ? { table: tableIdentity } : {},
1501
1501
  ...editableOwner !== void 0 ? { editableOwner } : {},
1502
+ ...listAddress !== void 0 ? { listAddress } : {},
1502
1503
  ...tableIdentity !== void 0 ? {
1503
1504
  canonicalAddress: createTableTargetCanonicalAddress(
1504
1505
  tableIdentity,
@@ -3598,6 +3599,7 @@ function mergeLevelDefinition(base, override, startOverride, fallbackLevel) {
3598
3599
  );
3599
3600
  const runProperties = override?.runProperties ?? base?.runProperties;
3600
3601
  const restartAfterLevel = override?.restartAfterLevel ?? base?.restartAfterLevel;
3602
+ const picBulletId = override?.picBulletId ?? base?.picBulletId;
3601
3603
  return {
3602
3604
  level,
3603
3605
  format,
@@ -3608,7 +3610,8 @@ function mergeLevelDefinition(base, override, startOverride, fallbackLevel) {
3608
3610
  ...override?.suffix ?? base?.suffix ? { suffix: override?.suffix ?? base?.suffix } : {},
3609
3611
  ...paragraphGeometry ? { paragraphGeometry } : {},
3610
3612
  ...runProperties ? { runProperties } : {},
3611
- ...restartAfterLevel !== void 0 ? { restartAfterLevel } : {}
3613
+ ...restartAfterLevel !== void 0 ? { restartAfterLevel } : {},
3614
+ ...picBulletId !== void 0 ? { picBulletId } : {}
3612
3615
  };
3613
3616
  }
3614
3617
  function withDefaultStartAt(level) {
@@ -3736,7 +3739,7 @@ function resolveHangingWidth(indentation) {
3736
3739
  // src/runtime/formatting/numbering/prefix.ts
3737
3740
  function createNumberingPrefixResolver(catalog) {
3738
3741
  const sequenceStates = /* @__PURE__ */ new Map();
3739
- function resolveInternal(numbering, paragraph) {
3742
+ function resolveInternal(numbering, paragraph, options = {}) {
3740
3743
  const resolved = resolveNumberingDefinitionSet(
3741
3744
  catalog,
3742
3745
  paragraph?.numbering ?? numbering,
@@ -3749,29 +3752,44 @@ function createNumberingPrefixResolver(catalog) {
3749
3752
  if (!resolvedNumbering) {
3750
3753
  return null;
3751
3754
  }
3752
- const sequenceState = getSequenceState(sequenceStates, resolvedNumbering.numberingInstanceId);
3753
- advanceSequence(sequenceState, resolved.effectiveLevel.level, resolved.effectiveLevels);
3755
+ const advance = options.advance !== false;
3756
+ const sequenceState = getSequenceState(
3757
+ sequenceStates,
3758
+ resolvedNumbering.numberingInstanceId,
3759
+ { create: advance }
3760
+ );
3761
+ if (!sequenceState) {
3762
+ return null;
3763
+ }
3764
+ const workingState = advance ? sequenceState : cloneSequenceState(sequenceState);
3765
+ advanceSequence(workingState, resolved.effectiveLevel.level, resolved.effectiveLevels);
3766
+ const currentCounter = workingState.counters[resolved.effectiveLevel.level];
3754
3767
  const effectiveLevelDefs = resolved.effectiveLevel.isLegalNumbering ? new Map(
3755
3768
  Array.from(resolved.effectiveLevels.entries()).map(([level, definition]) => [
3756
3769
  level,
3757
3770
  { ...definition, format: "decimal" }
3758
3771
  ])
3759
3772
  ) : resolved.effectiveLevels;
3773
+ const picBulletId = resolved.effectiveLevel.picBulletId;
3760
3774
  const text = renderLevelText(
3761
3775
  resolved.effectiveLevel.text,
3762
- sequenceState.counters,
3776
+ workingState.counters,
3763
3777
  effectiveLevelDefs
3764
3778
  );
3765
- if (resolved.effectiveLevel.format !== "none" && text === null) {
3779
+ if (picBulletId == null && resolved.effectiveLevel.format !== "none" && text === null) {
3766
3780
  return null;
3767
3781
  }
3768
3782
  const visibleText = resolved.effectiveLevel.format === "none" ? null : text;
3769
- const picBulletId = resolved.effectiveLevel.picBulletId;
3783
+ const formatPosture = getNumberingFormatPosture(
3784
+ resolved.effectiveLevel.format,
3785
+ currentCounter
3786
+ );
3770
3787
  const picBulletMediaId = picBulletId != null ? catalog.numPicBullets?.[picBulletId]?.mediaId : void 0;
3771
3788
  return {
3772
3789
  text: visibleText,
3773
3790
  level: resolved.effectiveLevel.level,
3774
3791
  format: resolved.effectiveLevel.format,
3792
+ ...formatPosture !== void 0 ? { formatPosture } : {},
3775
3793
  startAt: resolved.effectiveLevel.startAt ?? DEFAULT_NUMBERING_START_AT,
3776
3794
  ...resolved.effectiveLevel.suffix ? { suffix: resolved.effectiveLevel.suffix } : {},
3777
3795
  ...resolved.effectiveLevel.paragraphStyleId ? { paragraphStyleId: resolved.effectiveLevel.paragraphStyleId } : {},
@@ -3782,23 +3800,26 @@ function createNumberingPrefixResolver(catalog) {
3782
3800
  };
3783
3801
  }
3784
3802
  return {
3785
- resolve(numbering) {
3786
- const result = resolveInternal(numbering);
3803
+ resolve(numbering, options) {
3804
+ const result = resolveInternal(numbering, void 0, options);
3787
3805
  return result?.text ?? null;
3788
3806
  },
3789
- resolveDetailed(numbering, paragraph) {
3790
- return resolveInternal(numbering, paragraph);
3807
+ resolveDetailed(numbering, paragraph, options) {
3808
+ return resolveInternal(numbering, paragraph, options);
3791
3809
  },
3792
- resolveParagraph(paragraph) {
3793
- return resolveInternal(paragraph.numbering, paragraph);
3810
+ resolveParagraph(paragraph, options) {
3811
+ return resolveInternal(paragraph.numbering, paragraph, options);
3794
3812
  }
3795
3813
  };
3796
3814
  }
3797
- function getSequenceState(states, numberingInstanceId) {
3815
+ function getSequenceState(states, numberingInstanceId, options = { create: true }) {
3798
3816
  const existing = states.get(numberingInstanceId);
3799
3817
  if (existing) {
3800
3818
  return existing;
3801
3819
  }
3820
+ if (options.create === false) {
3821
+ return { counters: [], lastLevel: null };
3822
+ }
3802
3823
  const created = {
3803
3824
  counters: [],
3804
3825
  lastLevel: null
@@ -3806,6 +3827,12 @@ function getSequenceState(states, numberingInstanceId) {
3806
3827
  states.set(numberingInstanceId, created);
3807
3828
  return created;
3808
3829
  }
3830
+ function cloneSequenceState(state) {
3831
+ return {
3832
+ counters: [...state.counters],
3833
+ lastLevel: state.lastLevel
3834
+ };
3835
+ }
3809
3836
  function advanceSequence(state, currentLevel, levelDefinitions) {
3810
3837
  for (let level = currentLevel + 1; level < state.counters.length; level += 1) {
3811
3838
  if (shouldResetDeeperLevel(level, currentLevel, levelDefinitions)) {
@@ -3837,6 +3864,25 @@ function shouldResetDeeperLevel(level, triggeringLevel, levelDefinitions) {
3837
3864
  function getLevelStartAt(level, levelDefinitions) {
3838
3865
  return levelDefinitions.get(level)?.startAt ?? DEFAULT_NUMBERING_START_AT;
3839
3866
  }
3867
+ function getNumberingFormatPosture(format, value) {
3868
+ if (!isSupportedNumberingFormat(format)) {
3869
+ return {
3870
+ status: "approximated",
3871
+ requestedFormat: format,
3872
+ renderedFormat: "decimal",
3873
+ reason: "unsupported-numbering-format-decimal-fallback"
3874
+ };
3875
+ }
3876
+ 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)) {
3877
+ return {
3878
+ status: "approximated",
3879
+ requestedFormat: format,
3880
+ renderedFormat: "decimal",
3881
+ reason: "numbering-format-range-decimal-fallback"
3882
+ };
3883
+ }
3884
+ return void 0;
3885
+ }
3840
3886
  function renderLevelText(text, counters, levelDefinitions) {
3841
3887
  if (!text) {
3842
3888
  return null;
@@ -4679,6 +4725,7 @@ function toNumberingLayoutInput(numbering) {
4679
4725
  associatedTabStops: toLayoutTabStops(numbering.geometry.tabStops, "numbering"),
4680
4726
  level: numbering.level,
4681
4727
  format: numbering.format,
4728
+ ...numbering.formatPosture !== void 0 ? { formatPosture: { ...numbering.formatPosture } } : {},
4682
4729
  startAt: numbering.startAt,
4683
4730
  ...numbering.isLegalNumbering ? { isLegalNumbering: true } : {},
4684
4731
  ...numbering.picBulletMediaId ? { pictureBulletMediaId: numbering.picBulletMediaId } : {}
@@ -4908,13 +4955,10 @@ var FormattingContextImpl = class {
4908
4955
  const effectiveNumbering = this.resolveEffectiveParagraphNumbering(para);
4909
4956
  if (!effectiveNumbering) return null;
4910
4957
  if (!emitGeometry) {
4911
- if (advance) this.numbering.resolve(effectiveNumbering);
4958
+ this.numbering.resolve(effectiveNumbering, { advance });
4912
4959
  return null;
4913
4960
  }
4914
- if (!advance) {
4915
- console.warn("[formatting-context] resolveParagraphNumbering({advance:false}) is not supported; counter always advances");
4916
- }
4917
- return this.numbering.resolveDetailed(effectiveNumbering, para);
4961
+ return this.numbering.resolveDetailed(effectiveNumbering, para, { advance });
4918
4962
  }
4919
4963
  resolveNumberingLayoutInput(para, options = {}) {
4920
4964
  return toNumberingLayoutInput(this.resolveParagraphNumbering(para, options));
@@ -7109,6 +7153,7 @@ function toSurfaceResolvedNumbering(numbering) {
7109
7153
  return {
7110
7154
  level: numbering.level,
7111
7155
  format: numbering.format,
7156
+ ...numbering.formatPosture !== void 0 ? { formatPosture: { ...numbering.formatPosture } } : {},
7112
7157
  ...numbering.text !== null ? { text: numbering.text } : {},
7113
7158
  startAt: numbering.startAt,
7114
7159
  ...numbering.paragraphStyleId ? { paragraphStyleId: numbering.paragraphStyleId } : {},
@@ -1,8 +1,8 @@
1
- import { C as CanonicalDocumentEnvelope, S as SelectionSnapshot, g as TransactionMapping } from '../../public-types-DajNGKV4.cjs';
1
+ import { C as CanonicalDocumentEnvelope, S as SelectionSnapshot, g as TransactionMapping } from '../../public-types-DrhlQ5Zy.cjs';
2
2
  import 'react';
3
3
  import 'yjs';
4
4
  import 'y-protocols/awareness';
5
- import '../../canonical-document-CG2TgAzj.cjs';
5
+ import '../../canonical-document-CXCFCbAz.cjs';
6
6
  import 'prosemirror-state';
7
7
  import 'prosemirror-model';
8
8
 
@@ -1,8 +1,8 @@
1
- import { C as CanonicalDocumentEnvelope, S as SelectionSnapshot, g as TransactionMapping } from '../../public-types-CNnMHZM9.js';
1
+ import { C as CanonicalDocumentEnvelope, S as SelectionSnapshot, g as TransactionMapping } from '../../public-types-BEGhv2YR.js';
2
2
  import 'react';
3
3
  import 'yjs';
4
4
  import 'y-protocols/awareness';
5
- import '../../canonical-document-CG2TgAzj.js';
5
+ import '../../canonical-document-CXCFCbAz.js';
6
6
  import 'prosemirror-state';
7
7
  import 'prosemirror-model';
8
8
 
@@ -2,13 +2,13 @@ import {
2
2
  insertImage,
3
3
  repositionFloatingImage,
4
4
  resizeImage
5
- } from "../../chunk-RSYN6FTS.js";
6
- import "../../chunk-IR7QV2BX.js";
7
- import "../../chunk-KOHQFZMM.js";
5
+ } from "../../chunk-6F5QW44A.js";
6
+ import "../../chunk-KV435YXO.js";
7
+ import "../../chunk-BYSRJ4FE.js";
8
8
  import "../../chunk-QIO6V46H.js";
9
- import "../../chunk-H6IL5ABU.js";
9
+ import "../../chunk-CXSYRB37.js";
10
10
  import "../../chunk-OYGMRRR7.js";
11
- import "../../chunk-FNWKE74J.js";
11
+ import "../../chunk-5DGKFNQT.js";
12
12
  import "../../chunk-UFVDIR2C.js";
13
13
  import "../../chunk-PGGPPZ65.js";
14
14
  import "../../chunk-DNXYUIIS.js";
@@ -1,5 +1,5 @@
1
- import { h as SelectionSnapshot, M as MarginPresetDefinition, i as PageFormatDefinition, R as RuntimeRenderSnapshot } from '../../public-types-DajNGKV4.cjs';
2
- import { C as CanonicalDocument, P as PageSize, a as PageMargins, b as ColumnProperties, c as PageNumbering } from '../../canonical-document-CG2TgAzj.cjs';
1
+ import { h as SelectionSnapshot, M as MarginPresetDefinition, i as PageFormatDefinition, R as RuntimeRenderSnapshot } from '../../public-types-DrhlQ5Zy.cjs';
2
+ import { C as CanonicalDocument, P as PageSize, a as PageMargins, b as ColumnProperties, c as PageNumbering } from '../../canonical-document-CXCFCbAz.cjs';
3
3
  import 'react';
4
4
  import 'yjs';
5
5
  import 'y-protocols/awareness';
@@ -1,5 +1,5 @@
1
- import { h as SelectionSnapshot, M as MarginPresetDefinition, i as PageFormatDefinition, R as RuntimeRenderSnapshot } from '../../public-types-CNnMHZM9.js';
2
- import { C as CanonicalDocument, P as PageSize, a as PageMargins, b as ColumnProperties, c as PageNumbering } from '../../canonical-document-CG2TgAzj.js';
1
+ import { h as SelectionSnapshot, M as MarginPresetDefinition, i as PageFormatDefinition, R as RuntimeRenderSnapshot } from '../../public-types-BEGhv2YR.js';
2
+ import { C as CanonicalDocument, P as PageSize, a as PageMargins, b as ColumnProperties, c as PageNumbering } from '../../canonical-document-CXCFCbAz.js';
3
3
  import 'react';
4
4
  import 'yjs';
5
5
  import 'y-protocols/awareness';
@@ -1,8 +1,8 @@
1
- import { P as PersistedEditorSnapshot, R as RuntimeRenderSnapshot } from '../../public-types-DajNGKV4.cjs';
1
+ import { P as PersistedEditorSnapshot, R as RuntimeRenderSnapshot } from '../../public-types-DrhlQ5Zy.cjs';
2
2
  import 'react';
3
3
  import 'yjs';
4
4
  import 'y-protocols/awareness';
5
- import '../../canonical-document-CG2TgAzj.cjs';
5
+ import '../../canonical-document-CXCFCbAz.cjs';
6
6
  import 'prosemirror-state';
7
7
  import 'prosemirror-model';
8
8
 
@@ -1,8 +1,8 @@
1
- import { P as PersistedEditorSnapshot, R as RuntimeRenderSnapshot } from '../../public-types-CNnMHZM9.js';
1
+ import { P as PersistedEditorSnapshot, R as RuntimeRenderSnapshot } from '../../public-types-BEGhv2YR.js';
2
2
  import 'react';
3
3
  import 'yjs';
4
4
  import 'y-protocols/awareness';
5
- import '../../canonical-document-CG2TgAzj.js';
5
+ import '../../canonical-document-CXCFCbAz.js';
6
6
  import 'prosemirror-state';
7
7
  import 'prosemirror-model';
8
8