@beyondwork/docx-react-component 1.0.124 → 1.0.126

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 +796 -102
  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-ZMRO6P3A.js → chunk-6IGWPAR4.js} +505 -44
  18. package/dist/{chunk-KOHQFZMM.js → chunk-BYSRJ4FE.js} +1 -1
  19. package/dist/{chunk-H6IL5ABU.js → chunk-CXSYRB37.js} +64 -20
  20. package/dist/{chunk-32ZAOQ54.js → chunk-D5HYZQTG.js} +1 -1
  21. package/dist/{chunk-TY4DIJO3.js → chunk-ESJ2MES5.js} +1 -1
  22. package/dist/{chunk-Q76XPPTA.js → chunk-FPRWV54X.js} +101 -14
  23. package/dist/{chunk-MPH4ZQS4.js → chunk-GL7XRYBY.js} +624 -87
  24. package/dist/{chunk-IR7QV2BX.js → chunk-KV435YXO.js} +2 -2
  25. package/dist/{chunk-N4VIXI2Z.js → chunk-MWSBGJQO.js} +137 -18
  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 +1677 -240
  57. package/dist/index.d.cts +5 -5
  58. package/dist/index.d.ts +5 -5
  59. package/dist/index.js +62 -25
  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-CS9-9KFa.d.ts} +3 -3
  69. package/dist/{loader-D9KCtj4m.d.cts → loader-OoWJ1_17.d.cts} +3 -3
  70. package/dist/{public-types-CNnMHZM9.d.ts → public-types-BP3vqJR5.d.cts} +157 -11
  71. package/dist/{public-types-DajNGKV4.d.cts → public-types-DdcHqcow.d.ts} +157 -11
  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 +945 -134
  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-Cq-fzx3B.d.cts} +3 -3
  83. package/dist/{session-DEmaOEjA.d.ts → session-DyFQt8Ph.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-CxE1aZiv.d.cts → types-Bg7D-GD3.d.cts} +2 -2
  93. package/dist/{types-DjJNaE9c.d.ts → types-bJAgMq1M.d.ts} +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
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  NO_EDITABLE_TARGETS_INDEX,
12
12
  createEditorSurfaceSnapshot
13
- } from "./chunk-H6IL5ABU.js";
13
+ } from "./chunk-CXSYRB37.js";
14
14
  import {
15
15
  createSelectionSnapshot
16
16
  } from "./chunk-OYGMRRR7.js";
@@ -803,7 +803,7 @@ function parseCanonicalTextLeafPath(path) {
803
803
  if (normalized[offset] !== "/") return null;
804
804
  offset += 1;
805
805
  }
806
- return tokens.some((token) => token.kind === "txbx") ? tokens : null;
806
+ return tokens.length > 0 ? tokens : null;
807
807
  }
808
808
  function parseCanonicalHyperlinkPath(path) {
809
809
  const blockStart = path.indexOf("/block[");
@@ -3,17 +3,17 @@ import {
3
3
  PAGE_STACK_GAP_PX,
4
4
  defaultChromeReservations,
5
5
  resolveDefaultZoom
6
- } from "./chunk-ZRHLLPSJ.js";
6
+ } from "./chunk-YHZHPXDB.js";
7
7
  import {
8
8
  storyTargetKey
9
- } from "./chunk-H6IL5ABU.js";
9
+ } from "./chunk-CXSYRB37.js";
10
10
  import {
11
11
  MAIN_STORY_KEY,
12
12
  collectCanonicalLayoutInputs,
13
13
  collectStoryBlockContexts,
14
14
  createHeaderFooterStoryKey,
15
15
  createNoteStoryKey
16
- } from "./chunk-FNWKE74J.js";
16
+ } from "./chunk-5DGKFNQT.js";
17
17
  import {
18
18
  MAIN_STORY_TARGET
19
19
  } from "./chunk-M2HUK3KF.js";
@@ -1198,6 +1198,27 @@ function hitTestRegion(index, region, point) {
1198
1198
  (target2) => target2.regionId === region.regionId
1199
1199
  );
1200
1200
  const containing = targets.filter((target2) => containsPoint(target2.rect, point));
1201
+ const generatedTarget = containing.find(
1202
+ (target2) => target2.generatedContentKind === "numbering-marker"
1203
+ );
1204
+ if (generatedTarget) {
1205
+ const anchorHit2 = firstLineAnchor(index, generatedTarget)?.runtimeOffset !== void 0 ? {
1206
+ runtimeOffset: firstLineAnchor(index, generatedTarget).runtimeOffset,
1207
+ assoc: "before"
1208
+ } : resolveLineAnchorHit(index, generatedTarget, point);
1209
+ return {
1210
+ pageIndex: generatedTarget.pageIndex,
1211
+ regionKind: generatedTarget.regionKind,
1212
+ blockId: generatedTarget.blockId,
1213
+ fragmentId: generatedTarget.fragmentId,
1214
+ lineIndex: generatedTarget.lineIndex,
1215
+ runtimeOffset: anchorHit2?.runtimeOffset ?? 0,
1216
+ assoc: "before",
1217
+ generatedContentKind: generatedTarget.generatedContentKind,
1218
+ generatedContentBoundary: generatedTarget.generatedContentBoundary?.policy,
1219
+ semanticEntryId: generatedTarget.targetId.startsWith("hit:") ? generatedTarget.targetId.slice("hit:".length) : generatedTarget.targetId
1220
+ };
1221
+ }
1201
1222
  const target = nearestTarget(containing, point) ?? nearestTarget(targets, point);
1202
1223
  if (!target) return null;
1203
1224
  const anchorHit = resolveLineAnchorHit(index, target, point);
@@ -1574,6 +1595,7 @@ function projectGeometryIndexFromFrame(frame, options) {
1574
1595
  identities,
1575
1596
  storyKey: storyKey2,
1576
1597
  entries: semanticEntries,
1598
+ hitTargets,
1577
1599
  projectedBlocksByStory,
1578
1600
  projectedCommandTargetsByKey,
1579
1601
  precision,
@@ -1844,6 +1866,7 @@ function appendBlockSemanticEntries(input) {
1844
1866
  identities,
1845
1867
  storyKey: storyKey2,
1846
1868
  entries,
1869
+ hitTargets,
1847
1870
  projectedBlocksByStory,
1848
1871
  projectedCommandTargetsByKey,
1849
1872
  precision,
@@ -1873,6 +1896,7 @@ function appendBlockSemanticEntries(input) {
1873
1896
  block,
1874
1897
  sourceIdentity: sliceIdentity,
1875
1898
  entries,
1899
+ hitTargets,
1876
1900
  projectedCommandTargetsByKey,
1877
1901
  precision,
1878
1902
  frameCompleteness,
@@ -2054,6 +2078,7 @@ function appendFragmentLayoutObjectSemanticEntries(input) {
2054
2078
  block,
2055
2079
  sourceIdentity,
2056
2080
  entries,
2081
+ hitTargets,
2057
2082
  projectedCommandTargetsByKey,
2058
2083
  precision,
2059
2084
  frameCompleteness,
@@ -2138,18 +2163,57 @@ function appendFragmentLayoutObjectSemanticEntries(input) {
2138
2163
  }
2139
2164
  return;
2140
2165
  }
2141
- if (layoutObject.kind === "numbered-paragraph") {
2142
- const markerProjection = resolveNumberingMarkerProjection(block);
2166
+ const numberingRows = layoutObject.numberingRows && layoutObject.numberingRows.length > 0 ? layoutObject.numberingRows : layoutObject.kind === "numbered-paragraph" && layoutObject.numbering ? [layoutObject.numbering] : [];
2167
+ for (let index = 0; index < numberingRows.length; index += 1) {
2168
+ const numbering = numberingRows[index];
2169
+ const markerProjection = resolveNumberingMarkerProjection(block, numbering);
2170
+ const entryId = layoutObject.kind === "numbered-paragraph" && index === 0 ? `semantic:numbering-marker:${base.sliceId}` : `semantic:numbering-marker:${base.sliceId}:${stableGeometryId(
2171
+ numbering.numberingLayoutId ?? numbering.numberingKey ?? String(index)
2172
+ )}`;
2173
+ const source = numberingSourceIdentity(numbering, sourceIdentity);
2143
2174
  entries.push({
2144
2175
  ...base,
2145
- entryId: `semantic:numbering-marker:${base.sliceId}`,
2176
+ entryId,
2146
2177
  kind: "numbering-marker",
2147
2178
  layoutObjectId: layoutObject.objectId,
2179
+ numberingLayoutId: numbering.numberingLayoutId,
2180
+ numberingKey: numbering.numberingKey,
2181
+ numberingTargetKey: numbering.targetKey,
2182
+ numberingTargetKind: numbering.targetKind,
2183
+ numberingCanonicalAddressKey: numbering.canonicalAddressKey,
2184
+ numberingListAddressKey: numbering.listAddressKey,
2185
+ numberingMarkerText: numbering.markerText,
2186
+ numberingMarkerSuffix: numbering.markerSuffix,
2187
+ numberingFormat: numbering.format,
2188
+ numberingFormatPosture: numbering.formatPosture,
2189
+ numberingUnavailableReasons: numbering.unavailableReasons,
2190
+ markerGlyphRect: markerProjection.rect,
2191
+ markerLaneRect: markerProjection.markerLaneRect,
2192
+ textColumnRect: markerProjection.textColumnRect,
2193
+ markerBoundary: markerProjection.markerBoundary,
2148
2194
  rect: markerProjection.rect,
2149
2195
  status: markerProjection.status,
2150
2196
  precision: markerProjection.precision,
2151
2197
  frameCompleteness,
2152
- ...sourceIdentity ? { sourceIdentity } : {}
2198
+ ...source ? { sourceIdentity: source } : {}
2199
+ });
2200
+ hitTargets.push({
2201
+ targetId: `hit:${entryId}`,
2202
+ pageId: base.pageId,
2203
+ pageIndex: base.pageIndex,
2204
+ regionId: base.regionId,
2205
+ regionKind: base.regionKind,
2206
+ blockId: base.blockId,
2207
+ fragmentId: base.fragmentId,
2208
+ lineIndex: firstLineIndex(block),
2209
+ rect: markerProjection.rect,
2210
+ precision: markerProjection.precision,
2211
+ generatedContentKind: "numbering-marker",
2212
+ generatedContentBoundary: {
2213
+ policy: "snap-to-authored-text",
2214
+ authoredTextStartsAtPx: markerProjection.markerBoundary.authoredTextStartsAtPx,
2215
+ selectionPolicy: "exclude-generated-marker"
2216
+ }
2153
2217
  });
2154
2218
  recordPrecision(precision, markerProjection.precision);
2155
2219
  }
@@ -2240,8 +2304,8 @@ function bookmarkRangeSourceIdentity(fact, fallback) {
2240
2304
  joinKind: "block-scoped"
2241
2305
  };
2242
2306
  }
2243
- function resolveNumberingMarkerProjection(block) {
2244
- const metadata = resolveNumberingMarkerProjectionMetadata(block);
2307
+ function resolveNumberingMarkerProjection(block, numbering) {
2308
+ const metadata = resolveNumberingMarkerProjectionMetadata(block, numbering);
2245
2309
  const blockFrame = block.frame;
2246
2310
  if (metadata.markerLane && metadata.measuredWidthTwips !== void 0) {
2247
2311
  const markerLane = metadata.markerLane;
@@ -2252,14 +2316,25 @@ function resolveNumberingMarkerProjection(block) {
2252
2316
  const rawRightPx = rawLeftPx + markerLane.widthTwips * pxPerTwip;
2253
2317
  const leftPx = clamp(rawLeftPx, blockLeftPx, blockRightPx);
2254
2318
  const rightPx = clamp(rawRightPx, leftPx, blockRightPx);
2319
+ const markerLaneRect = {
2320
+ leftPx,
2321
+ topPx: blockFrame.topPx,
2322
+ widthPx: rightPx - leftPx,
2323
+ heightPx: blockFrame.heightPx,
2324
+ space: "frame",
2325
+ precision: metadata.precision
2326
+ };
2327
+ const textColumnRect = metadata.textColumn ? projectTextColumnRect(blockFrame, metadata.measuredWidthTwips, metadata.textColumn) : void 0;
2255
2328
  return {
2256
- rect: {
2257
- leftPx,
2258
- topPx: blockFrame.topPx,
2259
- widthPx: rightPx - leftPx,
2260
- heightPx: blockFrame.heightPx,
2261
- space: "frame",
2262
- precision: metadata.precision
2329
+ rect: markerLaneRect,
2330
+ markerLaneRect,
2331
+ ...textColumnRect ? { textColumnRect } : {},
2332
+ markerBoundary: {
2333
+ generatedContent: "numbering-marker",
2334
+ caretPolicy: "snap-to-authored-text",
2335
+ selectionPolicy: "exclude-marker-unless-list-item-action",
2336
+ coordinateSpace: "frame-px",
2337
+ ...textColumnRect ? { authoredTextStartsAtPx: textColumnRect.leftPx } : {}
2263
2338
  },
2264
2339
  precision: metadata.precision,
2265
2340
  status: metadata.status
@@ -2278,20 +2353,28 @@ function resolveNumberingMarkerProjection(block) {
2278
2353
  space: "frame",
2279
2354
  precision: metadata.precision
2280
2355
  },
2356
+ markerBoundary: {
2357
+ generatedContent: "numbering-marker",
2358
+ caretPolicy: "snap-to-authored-text",
2359
+ selectionPolicy: "exclude-marker-unless-list-item-action",
2360
+ coordinateSpace: "frame-px"
2361
+ },
2281
2362
  precision: metadata.precision,
2282
2363
  status: metadata.status
2283
2364
  };
2284
2365
  }
2285
- function resolveNumberingMarkerProjectionMetadata(block) {
2366
+ function resolveNumberingMarkerProjectionMetadata(block, numbering) {
2286
2367
  const blockFrame = block.frame;
2287
2368
  const layoutObject = block.fragment.layoutObject;
2288
- const markerLane = layoutObject?.kind === "numbered-paragraph" ? layoutObject.numbering?.markerLane : void 0;
2369
+ const markerLane = numbering?.markerLane ?? (layoutObject?.kind === "numbered-paragraph" ? layoutObject.numbering?.markerLane : void 0);
2370
+ const textColumn = numbering?.textColumn ?? (layoutObject?.kind === "numbered-paragraph" ? layoutObject.numbering?.textColumn : void 0);
2289
2371
  const measuredWidthTwips = layoutObject?.measuredExtentTwips.widthTwips;
2290
2372
  if (markerLane && markerLane.widthTwips > 0 && measuredWidthTwips !== void 0 && measuredWidthTwips > 0 && Number.isFinite(blockFrame.widthPx)) {
2291
2373
  return {
2292
2374
  precision: "within-tolerance",
2293
2375
  status: "realized",
2294
2376
  markerLane,
2377
+ ...textColumn ? { textColumn } : {},
2295
2378
  measuredWidthTwips
2296
2379
  };
2297
2380
  }
@@ -2300,6 +2383,42 @@ function resolveNumberingMarkerProjectionMetadata(block) {
2300
2383
  status: "requires-rehydration"
2301
2384
  };
2302
2385
  }
2386
+ function projectTextColumnRect(blockFrame, measuredWidthTwips, textColumn) {
2387
+ if (measuredWidthTwips <= 0 || !Number.isFinite(blockFrame.widthPx)) {
2388
+ return void 0;
2389
+ }
2390
+ const pxPerTwip = blockFrame.widthPx / measuredWidthTwips;
2391
+ const leftPx = blockFrame.leftPx + textColumn.startTwips * pxPerTwip;
2392
+ const rightInsetPx = (textColumn.rightTwips ?? 0) * pxPerTwip;
2393
+ const rightPx = blockFrame.leftPx + blockFrame.widthPx - rightInsetPx;
2394
+ if (rightPx < leftPx) return void 0;
2395
+ return {
2396
+ leftPx,
2397
+ topPx: blockFrame.topPx,
2398
+ widthPx: rightPx - leftPx,
2399
+ heightPx: blockFrame.heightPx,
2400
+ space: "frame",
2401
+ precision: "within-tolerance"
2402
+ };
2403
+ }
2404
+ function numberingSourceIdentity(numbering, fallback) {
2405
+ const storyKey2 = numbering.storyKey ?? fallback?.storyKey;
2406
+ if (!storyKey2) return fallback;
2407
+ return {
2408
+ storyKey: storyKey2,
2409
+ ...numbering.sourceBlockPath ?? fallback?.blockPath ? { blockPath: numbering.sourceBlockPath ?? fallback?.blockPath } : {},
2410
+ ...numbering.numberingKey ?? fallback?.scopeKey ? { scopeKey: numbering.numberingKey ?? fallback?.scopeKey } : {},
2411
+ ...numbering.numberingInstanceId ?? fallback?.scopeId ? { scopeId: numbering.numberingInstanceId ?? fallback?.scopeId } : {},
2412
+ ...numbering.numberingSourceRef ?? numbering.sourceRef ?? fallback?.sourceRef ? { sourceRef: numbering.numberingSourceRef ?? numbering.sourceRef ?? fallback?.sourceRef } : {},
2413
+ joinKind: "block-scoped"
2414
+ };
2415
+ }
2416
+ function stableGeometryId(value) {
2417
+ return value.replace(/[^A-Za-z0-9_.:-]+/gu, "_");
2418
+ }
2419
+ function firstLineIndex(block) {
2420
+ return block.lines[0]?.line.lineIndex ?? 0;
2421
+ }
2303
2422
  function countBlockSemanticEntries(block) {
2304
2423
  const counts = createPrecisionCounts();
2305
2424
  const layoutObject = block.fragment.layoutObject;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  loadDocxSessionAsync
3
- } from "./chunk-4B74ETJI.js";
3
+ } from "./chunk-V6XVZFFH.js";
4
4
  import {
5
5
  buildCompatibilityReport,
6
6
  createLoadScheduler
7
- } from "./chunk-TY4DIJO3.js";
7
+ } from "./chunk-ESJ2MES5.js";
8
8
  import {
9
9
  decodePersistedSourcePackageBytes,
10
10
  hasValidPersistedSourcePackageDigest,
@@ -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-BP3vqJR5.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-DdcHqcow.js';
4
+ import '../../canonical-document-CXCFCbAz.js';
5
5
  import 'react';
6
6
  import 'yjs';
7
7
  import 'y-protocols/awareness';