@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
@@ -4,7 +4,7 @@ import {
4
4
  MAIN_STORY_KEY,
5
5
  collectCanonicalFieldRegionIdentities,
6
6
  collectEditableTargetRefs
7
- } from "./chunk-FNWKE74J.js";
7
+ } from "./chunk-5DGKFNQT.js";
8
8
  import {
9
9
  describeOpaqueFragment,
10
10
  describeStructuredWrapperBlock,
@@ -1100,6 +1100,7 @@ function mergeLevelDefinition(base, override, startOverride, fallbackLevel) {
1100
1100
  );
1101
1101
  const runProperties = override?.runProperties ?? base?.runProperties;
1102
1102
  const restartAfterLevel = override?.restartAfterLevel ?? base?.restartAfterLevel;
1103
+ const picBulletId = override?.picBulletId ?? base?.picBulletId;
1103
1104
  return {
1104
1105
  level,
1105
1106
  format,
@@ -1110,7 +1111,8 @@ function mergeLevelDefinition(base, override, startOverride, fallbackLevel) {
1110
1111
  ...override?.suffix ?? base?.suffix ? { suffix: override?.suffix ?? base?.suffix } : {},
1111
1112
  ...paragraphGeometry ? { paragraphGeometry } : {},
1112
1113
  ...runProperties ? { runProperties } : {},
1113
- ...restartAfterLevel !== void 0 ? { restartAfterLevel } : {}
1114
+ ...restartAfterLevel !== void 0 ? { restartAfterLevel } : {},
1115
+ ...picBulletId !== void 0 ? { picBulletId } : {}
1114
1116
  };
1115
1117
  }
1116
1118
  function withDefaultStartAt(level) {
@@ -1238,7 +1240,7 @@ function resolveHangingWidth(indentation) {
1238
1240
  // src/runtime/formatting/numbering/prefix.ts
1239
1241
  function createNumberingPrefixResolver(catalog) {
1240
1242
  const sequenceStates = /* @__PURE__ */ new Map();
1241
- function resolveInternal(numbering, paragraph) {
1243
+ function resolveInternal(numbering, paragraph, options = {}) {
1242
1244
  const resolved = resolveNumberingDefinitionSet(
1243
1245
  catalog,
1244
1246
  paragraph?.numbering ?? numbering,
@@ -1251,29 +1253,44 @@ function createNumberingPrefixResolver(catalog) {
1251
1253
  if (!resolvedNumbering) {
1252
1254
  return null;
1253
1255
  }
1254
- const sequenceState = getSequenceState(sequenceStates, resolvedNumbering.numberingInstanceId);
1255
- advanceSequence(sequenceState, resolved.effectiveLevel.level, resolved.effectiveLevels);
1256
+ const advance = options.advance !== false;
1257
+ const sequenceState = getSequenceState(
1258
+ sequenceStates,
1259
+ resolvedNumbering.numberingInstanceId,
1260
+ { create: advance }
1261
+ );
1262
+ if (!sequenceState) {
1263
+ return null;
1264
+ }
1265
+ const workingState = advance ? sequenceState : cloneSequenceState(sequenceState);
1266
+ advanceSequence(workingState, resolved.effectiveLevel.level, resolved.effectiveLevels);
1267
+ const currentCounter = workingState.counters[resolved.effectiveLevel.level];
1256
1268
  const effectiveLevelDefs = resolved.effectiveLevel.isLegalNumbering ? new Map(
1257
1269
  Array.from(resolved.effectiveLevels.entries()).map(([level, definition]) => [
1258
1270
  level,
1259
1271
  { ...definition, format: "decimal" }
1260
1272
  ])
1261
1273
  ) : resolved.effectiveLevels;
1274
+ const picBulletId = resolved.effectiveLevel.picBulletId;
1262
1275
  const text = renderLevelText(
1263
1276
  resolved.effectiveLevel.text,
1264
- sequenceState.counters,
1277
+ workingState.counters,
1265
1278
  effectiveLevelDefs
1266
1279
  );
1267
- if (resolved.effectiveLevel.format !== "none" && text === null) {
1280
+ if (picBulletId == null && resolved.effectiveLevel.format !== "none" && text === null) {
1268
1281
  return null;
1269
1282
  }
1270
1283
  const visibleText = resolved.effectiveLevel.format === "none" ? null : text;
1271
- const picBulletId = resolved.effectiveLevel.picBulletId;
1284
+ const formatPosture = getNumberingFormatPosture(
1285
+ resolved.effectiveLevel.format,
1286
+ currentCounter
1287
+ );
1272
1288
  const picBulletMediaId = picBulletId != null ? catalog.numPicBullets?.[picBulletId]?.mediaId : void 0;
1273
1289
  return {
1274
1290
  text: visibleText,
1275
1291
  level: resolved.effectiveLevel.level,
1276
1292
  format: resolved.effectiveLevel.format,
1293
+ ...formatPosture !== void 0 ? { formatPosture } : {},
1277
1294
  startAt: resolved.effectiveLevel.startAt ?? DEFAULT_NUMBERING_START_AT,
1278
1295
  ...resolved.effectiveLevel.suffix ? { suffix: resolved.effectiveLevel.suffix } : {},
1279
1296
  ...resolved.effectiveLevel.paragraphStyleId ? { paragraphStyleId: resolved.effectiveLevel.paragraphStyleId } : {},
@@ -1284,23 +1301,26 @@ function createNumberingPrefixResolver(catalog) {
1284
1301
  };
1285
1302
  }
1286
1303
  return {
1287
- resolve(numbering) {
1288
- const result = resolveInternal(numbering);
1304
+ resolve(numbering, options) {
1305
+ const result = resolveInternal(numbering, void 0, options);
1289
1306
  return result?.text ?? null;
1290
1307
  },
1291
- resolveDetailed(numbering, paragraph) {
1292
- return resolveInternal(numbering, paragraph);
1308
+ resolveDetailed(numbering, paragraph, options) {
1309
+ return resolveInternal(numbering, paragraph, options);
1293
1310
  },
1294
- resolveParagraph(paragraph) {
1295
- return resolveInternal(paragraph.numbering, paragraph);
1311
+ resolveParagraph(paragraph, options) {
1312
+ return resolveInternal(paragraph.numbering, paragraph, options);
1296
1313
  }
1297
1314
  };
1298
1315
  }
1299
- function getSequenceState(states, numberingInstanceId) {
1316
+ function getSequenceState(states, numberingInstanceId, options = { create: true }) {
1300
1317
  const existing = states.get(numberingInstanceId);
1301
1318
  if (existing) {
1302
1319
  return existing;
1303
1320
  }
1321
+ if (options.create === false) {
1322
+ return { counters: [], lastLevel: null };
1323
+ }
1304
1324
  const created = {
1305
1325
  counters: [],
1306
1326
  lastLevel: null
@@ -1308,6 +1328,12 @@ function getSequenceState(states, numberingInstanceId) {
1308
1328
  states.set(numberingInstanceId, created);
1309
1329
  return created;
1310
1330
  }
1331
+ function cloneSequenceState(state) {
1332
+ return {
1333
+ counters: [...state.counters],
1334
+ lastLevel: state.lastLevel
1335
+ };
1336
+ }
1311
1337
  function advanceSequence(state, currentLevel, levelDefinitions) {
1312
1338
  for (let level = currentLevel + 1; level < state.counters.length; level += 1) {
1313
1339
  if (shouldResetDeeperLevel(level, currentLevel, levelDefinitions)) {
@@ -1339,6 +1365,25 @@ function shouldResetDeeperLevel(level, triggeringLevel, levelDefinitions) {
1339
1365
  function getLevelStartAt(level, levelDefinitions) {
1340
1366
  return levelDefinitions.get(level)?.startAt ?? DEFAULT_NUMBERING_START_AT;
1341
1367
  }
1368
+ function getNumberingFormatPosture(format, value) {
1369
+ if (!isSupportedNumberingFormat(format)) {
1370
+ return {
1371
+ status: "approximated",
1372
+ requestedFormat: format,
1373
+ renderedFormat: "decimal",
1374
+ reason: "unsupported-numbering-format-decimal-fallback"
1375
+ };
1376
+ }
1377
+ 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)) {
1378
+ return {
1379
+ status: "approximated",
1380
+ requestedFormat: format,
1381
+ renderedFormat: "decimal",
1382
+ reason: "numbering-format-range-decimal-fallback"
1383
+ };
1384
+ }
1385
+ return void 0;
1386
+ }
1342
1387
  function renderLevelText(text, counters, levelDefinitions) {
1343
1388
  if (!text) {
1344
1389
  return null;
@@ -2181,6 +2226,7 @@ function toNumberingLayoutInput(numbering) {
2181
2226
  associatedTabStops: toLayoutTabStops(numbering.geometry.tabStops, "numbering"),
2182
2227
  level: numbering.level,
2183
2228
  format: numbering.format,
2229
+ ...numbering.formatPosture !== void 0 ? { formatPosture: { ...numbering.formatPosture } } : {},
2184
2230
  startAt: numbering.startAt,
2185
2231
  ...numbering.isLegalNumbering ? { isLegalNumbering: true } : {},
2186
2232
  ...numbering.picBulletMediaId ? { pictureBulletMediaId: numbering.picBulletMediaId } : {}
@@ -2410,13 +2456,10 @@ var FormattingContextImpl = class {
2410
2456
  const effectiveNumbering = this.resolveEffectiveParagraphNumbering(para);
2411
2457
  if (!effectiveNumbering) return null;
2412
2458
  if (!emitGeometry) {
2413
- if (advance) this.numbering.resolve(effectiveNumbering);
2459
+ this.numbering.resolve(effectiveNumbering, { advance });
2414
2460
  return null;
2415
2461
  }
2416
- if (!advance) {
2417
- console.warn("[formatting-context] resolveParagraphNumbering({advance:false}) is not supported; counter always advances");
2418
- }
2419
- return this.numbering.resolveDetailed(effectiveNumbering, para);
2462
+ return this.numbering.resolveDetailed(effectiveNumbering, para, { advance });
2420
2463
  }
2421
2464
  resolveNumberingLayoutInput(para, options = {}) {
2422
2465
  return toNumberingLayoutInput(this.resolveParagraphNumbering(para, options));
@@ -4692,6 +4735,7 @@ function toSurfaceResolvedNumbering(numbering) {
4692
4735
  return {
4693
4736
  level: numbering.level,
4694
4737
  format: numbering.format,
4738
+ ...numbering.formatPosture !== void 0 ? { formatPosture: { ...numbering.formatPosture } } : {},
4695
4739
  ...numbering.text !== null ? { text: numbering.text } : {},
4696
4740
  startAt: numbering.startAt,
4697
4741
  ...numbering.paragraphStyleId ? { paragraphStyleId: numbering.paragraphStyleId } : {},
@@ -8,7 +8,7 @@ import {
8
8
  getRevisionRangeState,
9
9
  selectionTouchesRange,
10
10
  shouldHideInCleanMode
11
- } from "./chunk-PFYUJU3Q.js";
11
+ } from "./chunk-2QL5DAKF.js";
12
12
 
13
13
  // src/ui-tailwind/editor-surface/tw-editor-surface.tsx
14
14
  import { useMemo } from "react";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  classifyFieldInstruction
3
- } from "./chunk-A74Y5NE4.js";
3
+ } from "./chunk-4YJVRIUB.js";
4
4
  import {
5
5
  describeOpaqueFragment,
6
6
  describeStructuredWrapperBlock,