@beyondwork/docx-react-component 1.0.128 → 1.0.129

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 (98) hide show
  1. package/dist/api/public-types.cjs +215 -61
  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 +2 -2
  5. package/dist/api/v3.cjs +896 -71
  6. package/dist/api/v3.d.cts +3 -3
  7. package/dist/api/v3.d.ts +3 -3
  8. package/dist/api/v3.js +8 -8
  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-KV435YXO.js → chunk-5DSHUYSY.js} +1 -1
  12. package/dist/{chunk-TQDQU2E3.js → chunk-63FYIGCT.js} +2 -2
  13. package/dist/{chunk-ZDOAUP3V.js → chunk-DDN2AIGE.js} +1 -1
  14. package/dist/{chunk-6F5QW44A.js → chunk-DJU2W4E4.js} +2 -2
  15. package/dist/{chunk-4EENH4FG.js → chunk-EZKJXIPH.js} +1 -1
  16. package/dist/{chunk-CXSYRB37.js → chunk-HUIHBBAQ.js} +166 -49
  17. package/dist/{chunk-ESJ2MES5.js → chunk-JJGVE5J7.js} +1 -1
  18. package/dist/{chunk-LZVBNDGU.js → chunk-LJH64PV3.js} +3 -3
  19. package/dist/{chunk-MWSBGJQO.js → chunk-OTQIW2TC.js} +2 -2
  20. package/dist/{chunk-2QL5DAKF.js → chunk-PGKUJZXV.js} +3 -3
  21. package/dist/{chunk-6EROGFUF.js → chunk-PRAZBHNF.js} +441 -128
  22. package/dist/{chunk-4YJVRIUB.js → chunk-Q3QYGKFE.js} +51 -8
  23. package/dist/{chunk-YHZHPXDB.js → chunk-RMRTQGW3.js} +50 -13
  24. package/dist/{chunk-XRACP43Q.js → chunk-SKPTKQHF.js} +351 -13
  25. package/dist/{chunk-D5HYZQTG.js → chunk-VNLDQJ47.js} +1 -1
  26. package/dist/{chunk-BYSRJ4FE.js → chunk-W34X3KBR.js} +1 -1
  27. package/dist/{chunk-V6XVZFFH.js → chunk-XMHSGPLN.js} +2 -2
  28. package/dist/{chunk-LCYYR57Q.js → chunk-XQCAMKIQ.js} +421 -6
  29. package/dist/{chunk-YD2JE54B.js → chunk-YZDZ4FGR.js} +1 -1
  30. package/dist/compare.d.cts +1 -1
  31. package/dist/compare.d.ts +1 -1
  32. package/dist/core/commands/formatting-commands.d.cts +2 -2
  33. package/dist/core/commands/formatting-commands.d.ts +2 -2
  34. package/dist/core/commands/image-commands.cjs +166 -49
  35. package/dist/core/commands/image-commands.d.cts +2 -2
  36. package/dist/core/commands/image-commands.d.ts +2 -2
  37. package/dist/core/commands/image-commands.js +4 -4
  38. package/dist/core/commands/section-layout-commands.d.cts +2 -2
  39. package/dist/core/commands/section-layout-commands.d.ts +2 -2
  40. package/dist/core/commands/style-commands.d.cts +2 -2
  41. package/dist/core/commands/style-commands.d.ts +2 -2
  42. package/dist/core/commands/table-structure-commands.cjs +166 -49
  43. package/dist/core/commands/table-structure-commands.d.cts +2 -2
  44. package/dist/core/commands/table-structure-commands.d.ts +2 -2
  45. package/dist/core/commands/table-structure-commands.js +3 -3
  46. package/dist/core/commands/text-commands.cjs +166 -49
  47. package/dist/core/commands/text-commands.d.cts +2 -2
  48. package/dist/core/commands/text-commands.d.ts +2 -2
  49. package/dist/core/commands/text-commands.js +4 -4
  50. package/dist/core/selection/mapping.d.cts +2 -2
  51. package/dist/core/selection/mapping.d.ts +2 -2
  52. package/dist/core/state/editor-state.d.cts +2 -2
  53. package/dist/core/state/editor-state.d.ts +2 -2
  54. package/dist/index.cjs +1486 -211
  55. package/dist/index.d.cts +5 -5
  56. package/dist/index.d.ts +5 -5
  57. package/dist/index.js +46 -22
  58. package/dist/io/docx-session.cjs +51 -8
  59. package/dist/io/docx-session.d.cts +4 -4
  60. package/dist/io/docx-session.d.ts +4 -4
  61. package/dist/io/docx-session.js +3 -3
  62. package/dist/legal.d.cts +1 -1
  63. package/dist/legal.d.ts +1 -1
  64. package/dist/legal.js +2 -2
  65. package/dist/{loader-19ct2Be0.d.ts → loader-4qsw4eIU.d.ts} +3 -3
  66. package/dist/{loader-CoXQ2wGd.d.cts → loader-B8TKhmQi.d.cts} +3 -3
  67. package/dist/{public-types-B-CskQen.d.cts → public-types-B5CRoR6f.d.cts} +128 -1
  68. package/dist/{public-types-7KZsNGE2.d.ts → public-types-p9b8rfy8.d.ts} +128 -1
  69. package/dist/public-types.cjs +215 -61
  70. package/dist/public-types.d.cts +2 -2
  71. package/dist/public-types.d.ts +2 -2
  72. package/dist/public-types.js +2 -2
  73. package/dist/runtime/collab.d.cts +3 -3
  74. package/dist/runtime/collab.d.ts +3 -3
  75. package/dist/runtime/document-runtime.cjs +980 -185
  76. package/dist/runtime/document-runtime.d.cts +2 -2
  77. package/dist/runtime/document-runtime.d.ts +2 -2
  78. package/dist/runtime/document-runtime.js +13 -13
  79. package/dist/{session-B5015J4v.d.cts → session-BnGIjaex.d.cts} +3 -3
  80. package/dist/{session-C2i8-d6v.d.ts → session-vEYKf-w3.d.ts} +3 -3
  81. package/dist/session.cjs +51 -8
  82. package/dist/session.d.cts +5 -5
  83. package/dist/session.d.ts +5 -5
  84. package/dist/session.js +4 -4
  85. package/dist/tailwind.cjs +215 -61
  86. package/dist/tailwind.d.cts +2 -2
  87. package/dist/tailwind.d.ts +2 -2
  88. package/dist/tailwind.js +5 -5
  89. package/dist/{types-DNhN0WeN.d.cts → types-BLuvZ6cQ.d.cts} +2 -2
  90. package/dist/{types-yvrQuGX9.d.ts → types-Dutlyj0T.d.ts} +2 -2
  91. package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +3 -3
  92. package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +3 -3
  93. package/dist/ui-tailwind/editor-surface/search-plugin.js +3 -3
  94. package/dist/ui-tailwind.cjs +215 -61
  95. package/dist/ui-tailwind.d.cts +3 -3
  96. package/dist/ui-tailwind.d.ts +3 -3
  97. package/dist/ui-tailwind.js +5 -5
  98. package/package.json +1 -1
@@ -1068,7 +1068,7 @@ function parseNumberingXml(xml, context) {
1068
1068
  abstractDefinitions[abstractNumberingId] = {
1069
1069
  abstractNumberingId,
1070
1070
  ...context?.partPath !== void 0 ? { sourceRef: createNumberingSourceRef(context.partPath, "abstractNum", rawId, childXmlPath) } : {},
1071
- levels: readLevels(child),
1071
+ levels: readLevels(child, context, childXmlPath, rawId),
1072
1072
  ...nsid ? { nsid } : {},
1073
1073
  ...multiLevelType ? { multiLevelType } : {},
1074
1074
  ...tplc ? { tplc } : {},
@@ -1089,7 +1089,7 @@ function parseNumberingXml(xml, context) {
1089
1089
  numberingInstanceId,
1090
1090
  ...context?.partPath !== void 0 ? { sourceRef: createNumberingSourceRef(context.partPath, "num", rawId, childXmlPath) } : {},
1091
1091
  abstractNumberingId: toCanonicalAbstractNumberingId(rawAbstractId),
1092
- overrides: readOverrides(child)
1092
+ overrides: readOverrides(child, context, childXmlPath, rawId)
1093
1093
  };
1094
1094
  break;
1095
1095
  }
@@ -1110,6 +1110,16 @@ function createNumberingSourceRef(partPath, element, rawId, xmlPath) {
1110
1110
  ...xmlPath !== void 0 ? { xmlPath } : {}
1111
1111
  };
1112
1112
  }
1113
+ function createNumberingChildSourceRef(partPath, element, sourceIdSuffix, xmlPath) {
1114
+ if (partPath === void 0) return void 0;
1115
+ return {
1116
+ sourceId: `part:${partPath}#${sourceIdSuffix}`,
1117
+ partPath,
1118
+ storyKind: "numbering",
1119
+ element,
1120
+ ...xmlPath !== void 0 ? { xmlPath } : {}
1121
+ };
1122
+ }
1113
1123
  function readNumPicBullet(node, numPicBulletId, context, xmlPath) {
1114
1124
  let widthEmu;
1115
1125
  let heightEmu;
@@ -1186,18 +1196,29 @@ function toCanonicalAbstractNumberingId(value) {
1186
1196
  function toCanonicalNumberingInstanceId(value) {
1187
1197
  return value.startsWith("num:") ? value : `num:${value}`;
1188
1198
  }
1189
- function readLevels(abstractNode) {
1199
+ function readLevels(abstractNode, context, abstractXmlPath, rawAbstractId) {
1190
1200
  const levels = [];
1201
+ let levelOrdinal = 0;
1191
1202
  for (const child of abstractNode.children) {
1192
1203
  if (child.type !== "element" || localName(child.name) !== "lvl") {
1193
1204
  continue;
1194
1205
  }
1206
+ levelOrdinal += 1;
1195
1207
  const rawLevel = readStringAttr(child, "w:ilvl");
1196
1208
  const level = rawLevel === void 0 ? void 0 : parseInteger(rawLevel);
1197
1209
  if (level === void 0) {
1198
1210
  continue;
1199
1211
  }
1200
- const definition = readLevelDefinition(child, level);
1212
+ const definition = readLevelDefinition(
1213
+ child,
1214
+ level,
1215
+ createNumberingChildSourceRef(
1216
+ context?.partPath,
1217
+ "lvl",
1218
+ `abstractNum:${rawAbstractId}:lvl:${level}`,
1219
+ `${abstractXmlPath}/lvl[${levelOrdinal}]`
1220
+ )
1221
+ );
1201
1222
  if (!definition) {
1202
1223
  continue;
1203
1224
  }
@@ -1205,12 +1226,14 @@ function readLevels(abstractNode) {
1205
1226
  }
1206
1227
  return levels.sort((left, right) => left.level - right.level);
1207
1228
  }
1208
- function readOverrides(numNode) {
1229
+ function readOverrides(numNode, context, numXmlPath, rawNumId) {
1209
1230
  const overrides = [];
1231
+ let overrideOrdinal = 0;
1210
1232
  for (const child of numNode.children) {
1211
1233
  if (child.type !== "element" || localName(child.name) !== "lvlOverride") {
1212
1234
  continue;
1213
1235
  }
1236
+ overrideOrdinal += 1;
1214
1237
  const rawLevel = readStringAttr(child, "w:ilvl");
1215
1238
  const level = rawLevel === void 0 ? void 0 : parseInteger(rawLevel);
1216
1239
  if (level === void 0) {
@@ -1220,8 +1243,26 @@ function readOverrides(numNode) {
1220
1243
  const rawStart = startOverrideNode ? readStringAttr(startOverrideNode, "w:val") : void 0;
1221
1244
  const startAt = rawStart === void 0 ? void 0 : parseInteger(rawStart);
1222
1245
  const levelDefinitionNode = findChildElementOptional(child, "lvl");
1223
- const levelDefinition = levelDefinitionNode ? readLevelOverrideDefinition(levelDefinitionNode, level) : void 0;
1246
+ const overrideXmlPath = `${numXmlPath}/lvlOverride[${overrideOrdinal}]`;
1247
+ const levelDefinition = levelDefinitionNode ? readLevelOverrideDefinition(
1248
+ levelDefinitionNode,
1249
+ level,
1250
+ createNumberingChildSourceRef(
1251
+ context?.partPath,
1252
+ "lvl",
1253
+ `num:${rawNumId}:lvlOverride:${level}:lvl`,
1254
+ `${overrideXmlPath}/lvl[1]`
1255
+ )
1256
+ ) : void 0;
1224
1257
  overrides.push({
1258
+ ...context?.partPath !== void 0 ? {
1259
+ sourceRef: createNumberingChildSourceRef(
1260
+ context.partPath,
1261
+ "lvlOverride",
1262
+ `num:${rawNumId}:lvlOverride:${level}`,
1263
+ overrideXmlPath
1264
+ )
1265
+ } : {},
1225
1266
  level,
1226
1267
  ...startAt !== void 0 ? { startAt } : {},
1227
1268
  ...levelDefinition ? { levelDefinition } : {}
@@ -1229,7 +1270,7 @@ function readOverrides(numNode) {
1229
1270
  }
1230
1271
  return overrides.sort((left, right) => left.level - right.level);
1231
1272
  }
1232
- function readLevelDefinition(levelNode, fallbackLevel) {
1273
+ function readLevelDefinition(levelNode, fallbackLevel, sourceRef) {
1233
1274
  const rawLevel = readStringAttr(levelNode, "w:ilvl");
1234
1275
  const level = rawLevel === void 0 ? fallbackLevel : parseInteger(rawLevel);
1235
1276
  if (level === void 0) {
@@ -1259,6 +1300,7 @@ function readLevelDefinition(levelNode, fallbackLevel) {
1259
1300
  const lvlPicBulletNode = findChildElementOptional(levelNode, "lvlPicBulletId");
1260
1301
  const picBulletId = lvlPicBulletNode ? readStringAttr(lvlPicBulletNode, "w:val") : void 0;
1261
1302
  return {
1303
+ ...sourceRef ? { sourceRef } : {},
1262
1304
  level,
1263
1305
  format,
1264
1306
  text,
@@ -1272,7 +1314,7 @@ function readLevelDefinition(levelNode, fallbackLevel) {
1272
1314
  ...picBulletId !== void 0 ? { picBulletId } : {}
1273
1315
  };
1274
1316
  }
1275
- function readLevelOverrideDefinition(levelNode, fallbackLevel) {
1317
+ function readLevelOverrideDefinition(levelNode, fallbackLevel, sourceRef) {
1276
1318
  const rawLevel = readStringAttr(levelNode, "w:ilvl");
1277
1319
  const level = rawLevel === void 0 ? fallbackLevel : parseInteger(rawLevel);
1278
1320
  if (level === void 0) {
@@ -1306,6 +1348,7 @@ function readLevelOverrideDefinition(levelNode, fallbackLevel) {
1306
1348
  return void 0;
1307
1349
  }
1308
1350
  return {
1351
+ ...sourceRef ? { sourceRef } : {},
1309
1352
  level,
1310
1353
  ...startAt !== void 0 ? { startAt } : {},
1311
1354
  ...format !== void 0 ? { format } : {},
@@ -18,7 +18,7 @@ import {
18
18
  resolveSectionVariants,
19
19
  sectionSupportsStoryTarget,
20
20
  storyTargetKey
21
- } from "./chunk-CXSYRB37.js";
21
+ } from "./chunk-HUIHBBAQ.js";
22
22
  import {
23
23
  createSelectionSnapshot
24
24
  } from "./chunk-OYGMRRR7.js";
@@ -3692,6 +3692,14 @@ function paginateSectionBlocksWithSplits(section, blocks, layout, footnotes, mea
3692
3692
  pushPage(block.from);
3693
3693
  continue;
3694
3694
  }
3695
+ if (isStandalonePageBreakParagraph(block)) {
3696
+ if (columnHeight > 0) {
3697
+ pushPage(nextBoundary);
3698
+ } else {
3699
+ pageStart = Math.max(pageStart, Math.min(nextBoundary, section.end));
3700
+ }
3701
+ break;
3702
+ }
3695
3703
  const effectiveNoteHeight = estimateFootnoteReservation(
3696
3704
  block,
3697
3705
  footnotes,
@@ -3866,6 +3874,21 @@ function hasPageBreak(block) {
3866
3874
  }
3867
3875
  return nestedBlocks(block).some(hasPageBreak);
3868
3876
  }
3877
+ function isStandalonePageBreakParagraph(block) {
3878
+ if (block.kind !== "paragraph") return false;
3879
+ let sawPageBreak = false;
3880
+ for (const segment of block.segments) {
3881
+ if (segment.kind === "opaque_inline" && segment.label === "Page break") {
3882
+ sawPageBreak = true;
3883
+ continue;
3884
+ }
3885
+ if (segment.kind === "text" && segment.text.trim().length === 0) {
3886
+ continue;
3887
+ }
3888
+ return false;
3889
+ }
3890
+ return sawPageBreak;
3891
+ }
3869
3892
  function nestedBlocks(block) {
3870
3893
  if (block.kind === "sdt_block") {
3871
3894
  return block.children;
@@ -5350,6 +5373,9 @@ function projectSurfaceBlocksToPageFragments(surface, pages, splits, columnByBlo
5350
5373
  for (let blockIndex = 0; blockIndex < surface.blocks.length; blockIndex += 1) {
5351
5374
  const block = surface.blocks[blockIndex];
5352
5375
  const blockPath = `main/block[${blockIndex}]`;
5376
+ if (isStandalonePageBreakParagraph2(block)) {
5377
+ continue;
5378
+ }
5353
5379
  if (block.kind === "table") {
5354
5380
  const tableSliceList = splits?.tablesByBlockId.get(block.blockId);
5355
5381
  if (tableSliceList && tableSliceList.length > 1) {
@@ -5435,6 +5461,23 @@ function projectSurfaceBlocksToPageFragments(surface, pages, splits, columnByBlo
5435
5461
  }
5436
5462
  return byPage;
5437
5463
  }
5464
+ function isStandalonePageBreakParagraph2(block) {
5465
+ if (block.kind !== "paragraph") {
5466
+ return false;
5467
+ }
5468
+ let sawPageBreak = false;
5469
+ for (const segment of block.segments) {
5470
+ if (segment.kind === "opaque_inline" && segment.label === "Page break") {
5471
+ sawPageBreak = true;
5472
+ continue;
5473
+ }
5474
+ if (segment.kind === "text" && segment.text.trim().length === 0) {
5475
+ continue;
5476
+ }
5477
+ return false;
5478
+ }
5479
+ return sawPageBreak;
5480
+ }
5438
5481
  function projectLineBoxesForPageFragments(pages, fragmentsByPageIndex, fragmentMeasurementsByPageIndex, surface) {
5439
5482
  const byPage = /* @__PURE__ */ new Map();
5440
5483
  const blocksById = surface ? new Map(surface.blocks.map((block) => [block.blockId, block])) : /* @__PURE__ */ new Map();
@@ -5947,13 +5990,11 @@ function buildBookmarkRanges(targets) {
5947
5990
  }
5948
5991
  var EMPTY_NUMBERING_INPUT_INDEX = {
5949
5992
  byNumberingKey: /* @__PURE__ */ new Map(),
5950
- byBlockPath: /* @__PURE__ */ new Map(),
5951
- byParagraphIndex: /* @__PURE__ */ new Map()
5993
+ byBlockPath: /* @__PURE__ */ new Map()
5952
5994
  };
5953
5995
  function buildNumberingInputIndex(numberingInputs) {
5954
5996
  const byNumberingKey = /* @__PURE__ */ new Map();
5955
5997
  const byBlockPath = /* @__PURE__ */ new Map();
5956
- const byParagraph = /* @__PURE__ */ new Map();
5957
5998
  for (const input of numberingInputs) {
5958
5999
  if (!byNumberingKey.has(input.numberingKey)) {
5959
6000
  byNumberingKey.set(input.numberingKey, input);
@@ -5961,11 +6002,8 @@ function buildNumberingInputIndex(numberingInputs) {
5961
6002
  if (!byBlockPath.has(input.blockPath)) {
5962
6003
  byBlockPath.set(input.blockPath, input);
5963
6004
  }
5964
- if (!byParagraph.has(input.paragraphIndex)) {
5965
- byParagraph.set(input.paragraphIndex, input);
5966
- }
5967
6005
  }
5968
- return { byNumberingKey, byBlockPath, byParagraphIndex: byParagraph };
6006
+ return { byNumberingKey, byBlockPath };
5969
6007
  }
5970
6008
  function collectBookmarkRangeLayoutFacts(fragmentId, blockPath, bookmarkRanges) {
5971
6009
  if (!blockPath || !bookmarkRanges || bookmarkRanges.length === 0) return [];
@@ -6085,8 +6123,7 @@ function collectNumberingLayoutFactsForBlock(block, blockPath, numberingIndex, n
6085
6123
  const canonical = lookupNumberingInput(
6086
6124
  numberingIndex,
6087
6125
  numberingKey,
6088
- context.path,
6089
- paragraphIndex
6126
+ context.path
6090
6127
  );
6091
6128
  const target = findNumberingTarget(numberingTargets, context.path);
6092
6129
  const numberingLayoutId = numberingKey ?? [
@@ -6126,7 +6163,7 @@ function findNumberingTarget(numberingTargets, blockPath) {
6126
6163
  if (blockPath === void 0) return void 0;
6127
6164
  return numberingTargets.find((target) => target.blockPath === blockPath);
6128
6165
  }
6129
- function lookupNumberingInput(numberingIndex, numberingKey, blockPath, paragraphIndex) {
6166
+ function lookupNumberingInput(numberingIndex, numberingKey, blockPath) {
6130
6167
  if (!numberingIndex) return void 0;
6131
6168
  if (numberingKey !== void 0) {
6132
6169
  const byKey = numberingIndex.byNumberingKey.get(numberingKey);
@@ -6136,7 +6173,7 @@ function lookupNumberingInput(numberingIndex, numberingKey, blockPath, paragraph
6136
6173
  const byPath = numberingIndex.byBlockPath.get(blockPath);
6137
6174
  if (byPath !== void 0) return byPath;
6138
6175
  }
6139
- return paragraphIndex !== void 0 ? numberingIndex.byParagraphIndex.get(paragraphIndex) : void 0;
6176
+ return void 0;
6140
6177
  }
6141
6178
  function collectNumberingUnavailableReasons(numbering, canonical) {
6142
6179
  const reasons = [];
@@ -6553,7 +6590,7 @@ async function createCanvasProvider(fontLoader) {
6553
6590
  }
6554
6591
 
6555
6592
  // src/runtime/layout/layout-engine-version.ts
6556
- var LAYOUT_ENGINE_VERSION = 88;
6593
+ var LAYOUT_ENGINE_VERSION = 89;
6557
6594
  var LAYCACHE_SCHEMA_VERSION = 12;
6558
6595
 
6559
6596
  // src/runtime/layout/layout-engine-instance.ts