@beyondwork/docx-react-component 1.0.134 → 1.0.136

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 (89) hide show
  1. package/dist/api/public-types.cjs +20 -2
  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 +203 -41
  6. package/dist/api/v3.d.cts +3 -3
  7. package/dist/api/v3.d.ts +3 -3
  8. package/dist/api/v3.js +4 -4
  9. package/dist/{canonical-document-CfZIc-fC.d.cts → canonical-document-COmM7v11.d.cts} +1 -1
  10. package/dist/{canonical-document-CfZIc-fC.d.ts → canonical-document-COmM7v11.d.ts} +1 -1
  11. package/dist/{chunk-REFHJ2FN.js → chunk-2BNXARVO.js} +3 -3
  12. package/dist/{chunk-INLRCC4N.js → chunk-4CIHTMCH.js} +2 -2
  13. package/dist/{chunk-MQ5GAJ54.js → chunk-BJXSMPHD.js} +1 -1
  14. package/dist/{chunk-XBQFDBXE.js → chunk-EZFF6GKF.js} +9 -2
  15. package/dist/{chunk-3YR47WTD.js → chunk-FGJTOFZY.js} +21 -9
  16. package/dist/{chunk-74R5B2EZ.js → chunk-H4HI6RUE.js} +1 -1
  17. package/dist/{chunk-IJD6D7HU.js → chunk-HUWZ7AHE.js} +125 -2
  18. package/dist/{chunk-7Y6JCIK3.js → chunk-HWMPNLEF.js} +1 -1
  19. package/dist/{chunk-EBSI6VQX.js → chunk-JZZKTL7K.js} +800 -93
  20. package/dist/{chunk-VA24T4EB.js → chunk-NEMOQ4QR.js} +1 -1
  21. package/dist/{chunk-ESEEWELA.js → chunk-NX7W6T7L.js} +171 -39
  22. package/dist/{chunk-O4EDZR44.js → chunk-P7XDEVS6.js} +12 -1
  23. package/dist/{chunk-QTRJLKR2.js → chunk-TSNK4ECL.js} +1 -1
  24. package/dist/{chunk-WDDFU2N2.js → chunk-UR2LW63N.js} +1 -1
  25. package/dist/compare.d.cts +1 -1
  26. package/dist/compare.d.ts +1 -1
  27. package/dist/core/commands/formatting-commands.d.cts +2 -2
  28. package/dist/core/commands/formatting-commands.d.ts +2 -2
  29. package/dist/core/commands/image-commands.cjs +9 -2
  30. package/dist/core/commands/image-commands.d.cts +2 -2
  31. package/dist/core/commands/image-commands.d.ts +2 -2
  32. package/dist/core/commands/image-commands.js +4 -4
  33. package/dist/core/commands/section-layout-commands.d.cts +2 -2
  34. package/dist/core/commands/section-layout-commands.d.ts +2 -2
  35. package/dist/core/commands/style-commands.d.cts +2 -2
  36. package/dist/core/commands/style-commands.d.ts +2 -2
  37. package/dist/core/commands/table-structure-commands.cjs +9 -2
  38. package/dist/core/commands/table-structure-commands.d.cts +2 -2
  39. package/dist/core/commands/table-structure-commands.d.ts +2 -2
  40. package/dist/core/commands/table-structure-commands.js +3 -3
  41. package/dist/core/commands/text-commands.cjs +9 -2
  42. package/dist/core/commands/text-commands.d.cts +2 -2
  43. package/dist/core/commands/text-commands.d.ts +2 -2
  44. package/dist/core/commands/text-commands.js +4 -4
  45. package/dist/core/selection/mapping.d.cts +2 -2
  46. package/dist/core/selection/mapping.d.ts +2 -2
  47. package/dist/core/state/editor-state.d.cts +2 -2
  48. package/dist/core/state/editor-state.d.ts +2 -2
  49. package/dist/index.cjs +1287 -198
  50. package/dist/index.d.cts +5 -5
  51. package/dist/index.d.ts +5 -5
  52. package/dist/index.js +135 -34
  53. package/dist/io/docx-session.d.cts +4 -4
  54. package/dist/io/docx-session.d.ts +4 -4
  55. package/dist/legal.d.cts +1 -1
  56. package/dist/legal.d.ts +1 -1
  57. package/dist/{loader-CK3lZy4h.d.cts → loader-Cr35kVUi.d.cts} +3 -3
  58. package/dist/{loader-CQXplstv.d.ts → loader-uGY6nDZP.d.ts} +3 -3
  59. package/dist/{public-types-DXNZVKrS.d.ts → public-types-8kVIB5HW.d.ts} +22 -8
  60. package/dist/{public-types-BR1SYK2F.d.cts → public-types-CSSH2Whc.d.cts} +22 -8
  61. package/dist/public-types.cjs +20 -2
  62. package/dist/public-types.d.cts +2 -2
  63. package/dist/public-types.d.ts +2 -2
  64. package/dist/public-types.js +2 -2
  65. package/dist/runtime/collab.d.cts +3 -3
  66. package/dist/runtime/collab.d.ts +3 -3
  67. package/dist/runtime/document-runtime.cjs +929 -83
  68. package/dist/runtime/document-runtime.d.cts +2 -2
  69. package/dist/runtime/document-runtime.d.ts +2 -2
  70. package/dist/runtime/document-runtime.js +10 -10
  71. package/dist/{session-CSbwkgII.d.cts → session-Beg8ihOi.d.cts} +3 -3
  72. package/dist/{session-C9UjrhJF.d.ts → session-Dgp-2uYw.d.ts} +3 -3
  73. package/dist/session.d.cts +5 -5
  74. package/dist/session.d.ts +5 -5
  75. package/dist/tailwind.cjs +27 -8
  76. package/dist/tailwind.d.cts +2 -2
  77. package/dist/tailwind.d.ts +2 -2
  78. package/dist/tailwind.js +5 -5
  79. package/dist/{types-RzkCXDNV.d.ts → types-Cin_abw3.d.ts} +2 -2
  80. package/dist/{types-CZtAueri.d.cts → types-qsS39ZkQ.d.cts} +2 -2
  81. package/dist/ui-tailwind/editor-surface/search-plugin.cjs +11 -0
  82. package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +3 -3
  83. package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +3 -3
  84. package/dist/ui-tailwind/editor-surface/search-plugin.js +3 -3
  85. package/dist/ui-tailwind.cjs +27 -8
  86. package/dist/ui-tailwind.d.cts +3 -3
  87. package/dist/ui-tailwind.d.ts +3 -3
  88. package/dist/ui-tailwind.js +5 -5
  89. package/package.json +1 -1
package/dist/api/v3.cjs CHANGED
@@ -39073,10 +39073,16 @@ var FormattingContextImpl = class {
39073
39073
  // surface-projection calls `resolveParagraphCascade` on the same
39074
39074
  // paragraph via `resolveParagraph` + numbering resolve + marker-rPr;
39075
39075
  // each of those re-walked the style catalog before.
39076
- paragraphCascadeCache = /* @__PURE__ */ new WeakMap();
39076
+ //
39077
+ // Defaults to a per-context instance, but the runtime can supply a
39078
+ // persistent `WeakMap` via `FormattingContextOptions.paragraphCascadeCache`
39079
+ // so unchanged paragraphs don't re-cascade on every keystroke. See the
39080
+ // contract on the option for invalidation semantics.
39081
+ paragraphCascadeCache;
39077
39082
  constructor(doc, opts) {
39078
39083
  this.doc = doc;
39079
39084
  this.opts = opts;
39085
+ this.paragraphCascadeCache = opts.paragraphCascadeCache ?? /* @__PURE__ */ new WeakMap();
39080
39086
  const canonicalTheme = doc.subParts?.canonicalTheme;
39081
39087
  this.theme = opts.themeResolver ?? (canonicalTheme ? new ThemeColorResolver(canonicalTheme) : void 0);
39082
39088
  this.numbering = opts.numberingPrefixResolver ?? createNumberingPrefixResolver(doc.numbering);
@@ -45098,6 +45104,20 @@ function normalizeHeaderFooterTarget(document2, target, preferredSectionIndex) {
45098
45104
  }
45099
45105
 
45100
45106
  // src/runtime/story-targeting.ts
45107
+ function storyTargetKey(target) {
45108
+ switch (target.kind) {
45109
+ case "main":
45110
+ return "main";
45111
+ case "header":
45112
+ return `header:${target.relationshipId}:${target.variant}:${target.sectionIndex ?? "*"}`;
45113
+ case "footer":
45114
+ return `footer:${target.relationshipId}:${target.variant}:${target.sectionIndex ?? "*"}`;
45115
+ case "footnote":
45116
+ return `footnote:${target.noteId}`;
45117
+ case "endnote":
45118
+ return `endnote:${target.noteId}`;
45119
+ }
45120
+ }
45101
45121
  function getStoryBlocks(document2, target) {
45102
45122
  if (target.kind === "main") {
45103
45123
  return document2.content.children;
@@ -45190,7 +45210,8 @@ function createEditorSurfaceSnapshot(document2, _selection, activeStory = { kind
45190
45210
  const formattingContext = createFormattingContext(document2, {
45191
45211
  ...options.revisionMarkupMode ? { revisionMarkupMode: options.revisionMarkupMode } : {},
45192
45212
  ...options.getEffectiveMarkupMode ? { getEffectiveMarkupMode: options.getEffectiveMarkupMode } : {},
45193
- ...options.authorColorPalette ? { authorColorPalette: options.authorColorPalette } : {}
45213
+ ...options.authorColorPalette ? { authorColorPalette: options.authorColorPalette } : {},
45214
+ ...options.paragraphCascadeCache ? { paragraphCascadeCache: options.paragraphCascadeCache } : {}
45194
45215
  });
45195
45216
  const editableTargetsByBlockPath = options.editableTargetsByBlockPath ?? indexEditableTargetsByBlockPath(document2);
45196
45217
  const layoutIdentitiesByBlockPath = options.layoutIdentitiesByBlockPath;
@@ -47337,9 +47358,23 @@ function findSurfaceBlockById(blocks, blockId) {
47337
47358
  }
47338
47359
  function createScopeFromAnchor(runtime, input) {
47339
47360
  const doc = runtime.getCanonicalDocument();
47340
- const storyTarget = input.anchor.storyTarget ?? { kind: "main" };
47361
+ const normalizedInputAnchor = normalizeCreateScopeAnchor(input.anchor);
47362
+ const storyTarget = normalizedInputAnchor.storyTarget ?? { kind: "main" };
47341
47363
  const storyLength = storyTarget.kind === "main" ? computeMainStoryLength(doc) : Number.MAX_SAFE_INTEGER;
47342
- const { from, to } = input.anchor;
47364
+ const { from, to } = normalizedInputAnchor;
47365
+ if (!Number.isFinite(from) || !Number.isFinite(to)) {
47366
+ const diagnosticFrom = Number.isFinite(from) ? from : 0;
47367
+ const diagnosticTo = Number.isFinite(to) ? to : diagnosticFrom;
47368
+ return {
47369
+ status: "range-invalid",
47370
+ reason: "non-finite-range",
47371
+ from: diagnosticFrom,
47372
+ to: diagnosticTo,
47373
+ storyLength,
47374
+ message: `createScopeFromAnchor requires finite numeric from/to offsets. Pass selection.activeRange or an object shaped as {from, to}; do not pass a malformed range.`,
47375
+ nextStep: "pass-selection-activeRange-or-finite-from-to"
47376
+ };
47377
+ }
47343
47378
  if (from < 0) {
47344
47379
  return {
47345
47380
  status: "range-invalid",
@@ -47437,6 +47472,29 @@ function createScopeFromAnchor(runtime, input) {
47437
47472
  }
47438
47473
  return { status: "created", scopeId: result.scopeId, anchor: result.anchor };
47439
47474
  }
47475
+ function normalizeCreateScopeAnchor(anchor) {
47476
+ const candidate = anchor;
47477
+ const activeRange = candidate.activeRange;
47478
+ if (activeRange?.kind === "range") {
47479
+ return {
47480
+ from: activeRange.from,
47481
+ to: activeRange.to,
47482
+ storyTarget: candidate.storyTarget
47483
+ };
47484
+ }
47485
+ if (candidate.kind === "range") {
47486
+ return {
47487
+ from: candidate.from ?? Number.NaN,
47488
+ to: candidate.to ?? Number.NaN,
47489
+ storyTarget: candidate.storyTarget
47490
+ };
47491
+ }
47492
+ return {
47493
+ from: candidate.from ?? Number.NaN,
47494
+ to: candidate.to ?? Number.NaN,
47495
+ storyTarget: candidate.storyTarget
47496
+ };
47497
+ }
47440
47498
 
47441
47499
  // src/runtime/workflow/scope-tag-registry.ts
47442
47500
  var DEFAULT_UNKNOWN_BEHAVIOR = {
@@ -56555,6 +56613,8 @@ function buildSearchPattern(query, options = {}) {
56555
56613
  function findSearchMatches(text, query, options = {}) {
56556
56614
  const pattern = buildSearchPattern(query, options);
56557
56615
  if (!pattern) return [];
56616
+ const limit = normalizeSearchLimit(options.limit);
56617
+ if (limit === 0) return [];
56558
56618
  const results = [];
56559
56619
  let match;
56560
56620
  pattern.lastIndex = 0;
@@ -56565,12 +56625,21 @@ function findSearchMatches(text, query, options = {}) {
56565
56625
  text: match[0],
56566
56626
  index: results.length
56567
56627
  });
56628
+ if (results.length >= limit) {
56629
+ break;
56630
+ }
56568
56631
  if (match[0].length === 0) {
56569
56632
  pattern.lastIndex += 1;
56570
56633
  }
56571
56634
  }
56572
56635
  return results;
56573
56636
  }
56637
+ function normalizeSearchLimit(limit) {
56638
+ if (limit === void 0 || !Number.isFinite(limit)) {
56639
+ return Number.POSITIVE_INFINITY;
56640
+ }
56641
+ return Math.max(0, Math.floor(limit));
56642
+ }
56574
56643
  function createSearchExcerpt(text, from, to, radius = 24) {
56575
56644
  const safeFrom = Math.max(0, Math.min(from, text.length));
56576
56645
  const safeTo = Math.max(safeFrom, Math.min(to, text.length));
@@ -57073,7 +57142,8 @@ var SUPPORTED_COMMANDS = [
57073
57142
  "indent",
57074
57143
  "outdent",
57075
57144
  "restart-numbering",
57076
- "continue-numbering"
57145
+ "continue-numbering",
57146
+ "set-value"
57077
57147
  ];
57078
57148
  var UNSUPPORTED_COMMANDS = [
57079
57149
  "create",
@@ -57082,7 +57152,6 @@ var UNSUPPORTED_COMMANDS = [
57082
57152
  "join",
57083
57153
  "separate",
57084
57154
  "split",
57085
- "set-value",
57086
57155
  "apply-template",
57087
57156
  "capture-template",
57088
57157
  "apply-preset",
@@ -57131,10 +57200,10 @@ function createListsFamily(runtime) {
57131
57200
  return resolved.kind === "resolved" ? toReadback(runtime.getCanonicalDocument(), resolved.target, resolved.paragraph) : null;
57132
57201
  },
57133
57202
  previewCommand(input) {
57134
- return previewListCommand(runtime.getCanonicalDocument(), input);
57203
+ return previewListCommand(runtime.getCanonicalDocument(), input, activeStoryKey(runtime));
57135
57204
  },
57136
57205
  applyCommand(input) {
57137
- const preview = previewListCommand(runtime.getCanonicalDocument(), input);
57206
+ const preview = previewListCommand(runtime.getCanonicalDocument(), input, activeStoryKey(runtime));
57138
57207
  if (!preview.supported || !preview.target) {
57139
57208
  return {
57140
57209
  applied: false,
@@ -57194,7 +57263,7 @@ function createListsFamily(runtime) {
57194
57263
  }
57195
57264
  };
57196
57265
  }
57197
- function previewListCommand(document2, input) {
57266
+ function previewListCommand(document2, input, activeStoryKey2) {
57198
57267
  const resolved = resolveCurrentListTarget(document2, input);
57199
57268
  if (resolved.kind !== "resolved") {
57200
57269
  return {
@@ -57206,6 +57275,20 @@ function previewListCommand(document2, input) {
57206
57275
  }
57207
57276
  const target = toReadback(document2, resolved.target, resolved.paragraph);
57208
57277
  const targetRef = { targetKey: target.targetKey, addressKey: target.addressKey };
57278
+ if (activeStoryKey2 !== void 0 && target.storyKey !== activeStoryKey2) {
57279
+ return {
57280
+ command: input.command,
57281
+ supported: false,
57282
+ target,
57283
+ affectedTargets: [target],
57284
+ blockers: [{
57285
+ code: "list-target-wrong-story",
57286
+ ownerLayer: "L07",
57287
+ message: "List target does not belong to the runtime active story.",
57288
+ ...targetRef
57289
+ }]
57290
+ };
57291
+ }
57209
57292
  if (!SUPPORTED_COMMANDS.includes(input.command)) {
57210
57293
  return {
57211
57294
  command: input.command,
@@ -57218,6 +57301,17 @@ function previewListCommand(document2, input) {
57218
57301
  const canContinuePrevious = canContinuePreviousSequence(document2, resolved.paragraphIndex);
57219
57302
  const canJoin = canJoinPreviousSequence(document2, resolved.paragraphIndex);
57220
57303
  const blockers = [];
57304
+ if (input.command === "set-value") {
57305
+ const value = input.startAt;
57306
+ if (!Number.isInteger(value) || value === void 0 || value < 1) {
57307
+ blockers.push({
57308
+ code: "list-command-preflight-blocked",
57309
+ ownerLayer: "L07",
57310
+ message: "runtime.lists.set-value requires a positive integer startAt value.",
57311
+ ...targetRef
57312
+ });
57313
+ }
57314
+ }
57221
57315
  if (input.command === "continue-numbering" && !canContinuePrevious) {
57222
57316
  blockers.push({
57223
57317
  code: "list-continue-target-missing",
@@ -57248,6 +57342,7 @@ function editorCommandForListCommand(command, editableTarget, timestamp, startAt
57248
57342
  case "outdent":
57249
57343
  return { type: "list.outdent", editableTargets: [editableTarget], origin };
57250
57344
  case "restart-numbering":
57345
+ case "set-value":
57251
57346
  return {
57252
57347
  type: "list.restart-numbering",
57253
57348
  editableTarget,
@@ -57331,33 +57426,35 @@ function resolveCurrentListTarget(document2, input) {
57331
57426
  return { kind: "resolved", ...resolved };
57332
57427
  }
57333
57428
  function currentListTargets(document2) {
57334
- const paragraphs = collectParagraphEntries(document2.content.children, "main");
57429
+ const paragraphs = collectParagraphEntries(document2);
57335
57430
  const targets = collectEditableTargetRefs(document2).filter(isListTextTarget);
57336
- const byBlockPath = /* @__PURE__ */ new Map();
57337
- for (const target of targets) byBlockPath.set(target.blockPath, target);
57431
+ const byStoryBlockPath = /* @__PURE__ */ new Map();
57432
+ for (const target of targets) byStoryBlockPath.set(storyBlockPathKey(target.storyKey, target.blockPath), target);
57338
57433
  const out = [];
57339
57434
  for (let paragraphIndex = 0; paragraphIndex < paragraphs.length; paragraphIndex += 1) {
57340
57435
  const entry = paragraphs[paragraphIndex];
57341
57436
  if (!entry?.paragraph.numbering) continue;
57342
- const target = byBlockPath.get(entry.blockPath);
57437
+ const target = byStoryBlockPath.get(storyBlockPathKey(entry.storyKey, entry.blockPath));
57343
57438
  if (!target) continue;
57344
- out.push({ target, paragraph: entry.paragraph, paragraphIndex });
57439
+ out.push({ target, paragraph: entry.paragraph, paragraphIndex, storyKey: entry.storyKey });
57345
57440
  }
57346
57441
  return out;
57347
57442
  }
57348
- function collectParagraphEntries(blocks, basePath) {
57443
+ function collectParagraphEntries(document2) {
57349
57444
  const out = [];
57350
- collectParagraphEntriesInto(blocks, basePath, out);
57445
+ for (const context of collectStoryBlockContexts(document2)) {
57446
+ collectParagraphEntriesInto(context.blocks, context.storyKey, context.basePath, out);
57447
+ }
57351
57448
  return out;
57352
57449
  }
57353
- function collectParagraphEntriesInto(blocks, basePath, out) {
57450
+ function collectParagraphEntriesInto(blocks, storyKey, basePath, out) {
57354
57451
  for (let blockIndex = 0; blockIndex < blocks.length; blockIndex += 1) {
57355
57452
  const block = blocks[blockIndex];
57356
57453
  if (!block) continue;
57357
57454
  const blockPath = `${basePath}/block[${blockIndex}]`;
57358
57455
  switch (block.type) {
57359
57456
  case "paragraph":
57360
- out.push({ paragraph: block, blockPath });
57457
+ out.push({ paragraph: block, storyKey, blockPath });
57361
57458
  break;
57362
57459
  case "table":
57363
57460
  for (let rowIndex = 0; rowIndex < block.rows.length; rowIndex += 1) {
@@ -57368,6 +57465,7 @@ function collectParagraphEntriesInto(blocks, basePath, out) {
57368
57465
  if (!cell) continue;
57369
57466
  collectParagraphEntriesInto(
57370
57467
  cell.children,
57468
+ storyKey,
57371
57469
  `${blockPath}/row[${rowIndex}]/cell[${cellIndex}]`,
57372
57470
  out
57373
57471
  );
@@ -57375,7 +57473,7 @@ function collectParagraphEntriesInto(blocks, basePath, out) {
57375
57473
  }
57376
57474
  break;
57377
57475
  case "sdt":
57378
- collectParagraphEntriesInto(block.children, blockPath, out);
57476
+ collectParagraphEntriesInto(block.children, storyKey, blockPath, out);
57379
57477
  break;
57380
57478
  case "custom_xml":
57381
57479
  break;
@@ -57419,13 +57517,16 @@ function toReadback(document2, target, paragraph) {
57419
57517
  };
57420
57518
  }
57421
57519
  function canContinuePreviousSequence(document2, paragraphIndex) {
57422
- const paragraphs = collectParagraphEntries(document2.content.children, "main");
57423
- const current = paragraphs[paragraphIndex]?.paragraph;
57520
+ const paragraphs = collectParagraphEntries(document2);
57521
+ const currentEntry = paragraphs[paragraphIndex];
57522
+ const current = currentEntry?.paragraph;
57424
57523
  if (!current?.numbering) return false;
57425
57524
  const currentKind = getListKind(document2.numbering, current.numbering.numberingInstanceId);
57426
57525
  if (!currentKind) return false;
57427
57526
  for (let index = paragraphIndex - 1; index >= 0; index -= 1) {
57428
- const previous = paragraphs[index]?.paragraph;
57527
+ const previousEntry = paragraphs[index];
57528
+ if (previousEntry?.storyKey !== currentEntry.storyKey) break;
57529
+ const previous = previousEntry.paragraph;
57429
57530
  if (!previous?.numbering) continue;
57430
57531
  const previousKind = getListKind(document2.numbering, previous.numbering.numberingInstanceId);
57431
57532
  return previousKind === currentKind && previous.numbering.numberingInstanceId !== current.numbering.numberingInstanceId;
@@ -57433,14 +57534,25 @@ function canContinuePreviousSequence(document2, paragraphIndex) {
57433
57534
  return false;
57434
57535
  }
57435
57536
  function canJoinPreviousSequence(document2, paragraphIndex) {
57436
- const paragraphs = collectParagraphEntries(document2.content.children, "main");
57437
- const current = paragraphs[paragraphIndex]?.paragraph;
57438
- const previous = paragraphs[paragraphIndex - 1]?.paragraph;
57537
+ const paragraphs = collectParagraphEntries(document2);
57538
+ const currentEntry = paragraphs[paragraphIndex];
57539
+ const previousEntry = paragraphs[paragraphIndex - 1];
57540
+ if (previousEntry?.storyKey !== currentEntry?.storyKey) return false;
57541
+ const current = currentEntry?.paragraph;
57542
+ const previous = previousEntry?.paragraph;
57439
57543
  if (!current?.numbering || !previous?.numbering) return false;
57440
57544
  const currentKind = getListKind(document2.numbering, current.numbering.numberingInstanceId);
57441
57545
  const previousKind = getListKind(document2.numbering, previous.numbering.numberingInstanceId);
57442
57546
  return Boolean(currentKind) && currentKind === previousKind && current.numbering.numberingInstanceId !== previous.numbering.numberingInstanceId;
57443
57547
  }
57548
+ function storyBlockPathKey(storyKey, blockPath) {
57549
+ return `${storyKey}
57550
+ ${blockPath}`;
57551
+ }
57552
+ function activeStoryKey(runtime) {
57553
+ const activeStory = runtime.getRenderSnapshot()?.activeStory;
57554
+ return activeStory ? storyTargetKey(activeStory) : void 0;
57555
+ }
57444
57556
  function unsupportedCommandBlocker(command, target) {
57445
57557
  return {
57446
57558
  code: "list-command-unsupported",
@@ -57694,8 +57806,8 @@ function resolveEditableTextTarget(input) {
57694
57806
  `Editable target ref is malformed: ${shapeIssues[0]?.path ?? "$"}.`
57695
57807
  );
57696
57808
  }
57697
- const activeStoryKey = input.activeStoryKey ?? "main";
57698
- if (input.target.storyKey !== activeStoryKey) {
57809
+ const activeStoryKey2 = input.activeStoryKey ?? "main";
57810
+ if (input.target.storyKey !== activeStoryKey2) {
57699
57811
  return reject(
57700
57812
  "editable_target_wrong_story",
57701
57813
  "Editable target ref does not belong to the active story."
@@ -58124,8 +58236,8 @@ function resolveEditableTableStructureTarget(input) {
58124
58236
  `Editable target ref is malformed: ${shapeIssues[0]?.path ?? "$"}.`
58125
58237
  );
58126
58238
  }
58127
- const activeStoryKey = input.activeStoryKey ?? input.target.storyKey;
58128
- if (input.target.storyKey !== activeStoryKey) {
58239
+ const activeStoryKey2 = input.activeStoryKey ?? input.target.storyKey;
58240
+ if (input.target.storyKey !== activeStoryKey2) {
58129
58241
  return reject2(
58130
58242
  "editable_target_wrong_story",
58131
58243
  "Editable target ref does not belong to the active story."
@@ -62361,33 +62473,51 @@ function createPlaceholderScopes(runtime, input) {
62361
62473
  blockerDetails: Object.freeze([detail])
62362
62474
  };
62363
62475
  }
62364
- const compiler = createScopeCompilerService(runtime);
62365
62476
  const byOriginalIndex = /* @__PURE__ */ new Map();
62366
- for (const item of orderedHits) {
62477
+ const createdScopeIds = [];
62478
+ const scopeRequests = orderedHits.map((item) => {
62367
62479
  const text = item.text || query;
62368
62480
  const label = input.labelPrefix === void 0 ? text : `${input.labelPrefix} ${item.originalIndex + 1}`;
62369
- const result = createScopeFromAnchor(runtime, {
62370
- anchor: { from: item.hit.from, to: item.hit.to },
62481
+ return {
62482
+ anchor: {
62483
+ kind: "range",
62484
+ from: item.hit.from,
62485
+ to: item.hit.to,
62486
+ assoc: input.assoc ?? { start: 1, end: -1 }
62487
+ },
62371
62488
  mode: input.mode ?? "edit",
62372
62489
  label,
62373
62490
  ...input.visibility ? { visibility: input.visibility } : {},
62374
62491
  ...input.guardPolicy ? { guardPolicy: input.guardPolicy } : {},
62375
62492
  ...input.assoc ? { assoc: input.assoc } : {},
62376
- ...input.stableRefHint ? { stableRefHint: input.stableRefHint } : {}
62377
- });
62378
- if (result.status === "created") {
62379
- const compiled = compiler.compileScopeById(result.scopeId)?.scope;
62493
+ ...input.stableRefHint ? {
62494
+ scopeMetadataFields: [
62495
+ {
62496
+ key: "stableRefHint",
62497
+ valueType: "string",
62498
+ value: input.stableRefHint
62499
+ }
62500
+ ]
62501
+ } : {}
62502
+ };
62503
+ });
62504
+ const scopeResults = runtime.addScopes(scopeRequests);
62505
+ orderedHits.forEach((item, requestIndex) => {
62506
+ const text = item.text || query;
62507
+ const result = scopeResults[requestIndex];
62508
+ if (result && result.scopeId && result.plantStatus?.planted !== false) {
62509
+ createdScopeIds.push(result.scopeId);
62380
62510
  byOriginalIndex.set(item.originalIndex, {
62381
62511
  status: "created",
62382
62512
  text,
62383
62513
  excerpt: excerpt(text),
62384
- scopeId: result.scopeId,
62385
- ...compiled?.handle ? { handle: compiled.handle } : {}
62514
+ scopeId: result.scopeId
62386
62515
  });
62387
- continue;
62516
+ return;
62388
62517
  }
62518
+ const reason = result?.plantStatus?.reason ?? "unknown";
62389
62519
  const detail = blockerWithOwner(
62390
- `actions:placeholder-scopes:create-refused:${result.reason}`,
62520
+ `actions:placeholder-scopes:create-refused:${reason}`,
62391
62521
  "blocked",
62392
62522
  "The placeholder match could not be converted into a workflow scope.",
62393
62523
  "Refresh the document and retry; if it still refuses, route the target to the workflow/scope writer owner.",
@@ -62400,6 +62530,38 @@ function createPlaceholderScopes(runtime, input) {
62400
62530
  blockers: Object.freeze([detail.code]),
62401
62531
  blockerDetails: Object.freeze([detail])
62402
62532
  });
62533
+ });
62534
+ if (createdScopeIds.length > 0) {
62535
+ const createdScopeIdSet = new Set(createdScopeIds);
62536
+ const handlesByScopeId = new Map(
62537
+ createScopeCompilerService(runtime).compileAllScopes().filter((scope) => createdScopeIdSet.has(scope.handle.scopeId)).map((scope) => [scope.handle.scopeId, scope.handle])
62538
+ );
62539
+ for (const [originalIndex, item] of byOriginalIndex) {
62540
+ if (item.status !== "created" || !item.scopeId) continue;
62541
+ const handle = handlesByScopeId.get(item.scopeId);
62542
+ if (!handle) {
62543
+ const detail = blockerWithOwner(
62544
+ `actions:placeholder-scopes:create-unresolved:${item.scopeId}`,
62545
+ "blocked",
62546
+ "The placeholder scope marker was planted but did not enumerate as a current semantic scope handle.",
62547
+ "Treat this target as unresolved, refresh scope enumeration, and route persistent misses to the semantic-scope compiler owner.",
62548
+ "L08"
62549
+ );
62550
+ byOriginalIndex.set(originalIndex, {
62551
+ status: "blocked",
62552
+ text: item.text,
62553
+ excerpt: item.excerpt,
62554
+ scopeId: item.scopeId,
62555
+ blockers: Object.freeze([detail.code]),
62556
+ blockerDetails: Object.freeze([detail])
62557
+ });
62558
+ continue;
62559
+ }
62560
+ byOriginalIndex.set(originalIndex, {
62561
+ ...item,
62562
+ handle
62563
+ });
62564
+ }
62403
62565
  }
62404
62566
  const scopes = orderedHits.map((item) => byOriginalIndex.get(item.originalIndex)).filter((value) => value !== void 0);
62405
62567
  const created = scopes.filter((scope) => scope.status === "created").length;
package/dist/api/v3.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { v as MockPayload, A as ApiStatus, U as UxIntent, w as RuntimeApiHandle, x as UiControllerFactory, y as ApiV3Ui } from '../public-types-BR1SYK2F.cjs';
2
- export { z as AgentMetadata, B as AiPe2EvidenceOptions, D as AiPe2GraphOracleReference, F as AiPe2OracleEvidence, G as AiPe2OracleEvidenceProvider, H as AiPe2OracleEvidenceProviderInput, J as AiPe2OracleVerdict, K as ApiV3, N as ApiV3FnMetadata, O as ApiV3UiChrome, Q as ApiV3UiDebug, V as ApiV3UiLists, W as ApiV3UiOverlays, X as ApiV3UiSession, Y as ApiV3UiSurface, Z as ApiV3UiViewport, _ as BroadcastsVia, $ as ChromeDebugMode, a0 as ChromeDocumentMode, a1 as ChromeHostPosture, a2 as ChromeMarkupDisplay, a3 as ChromePosture, a4 as ChromeReviewMode, a5 as ChromeSurface, a6 as ChromeSurfaceKind, a7 as CreateApiV3Opts, a8 as DebugAttachment, a9 as DebugSession, aa as GeometryRect, ab as LiveEvidence, ac as MockShape, ad as OverlayAnchorQuery, ae as PersistsTo, af as ScrollTarget, ag as ScrollTargetBehavior, ah as SelectionRangeInput, ai as SourceLayer, aj as StateClass, ak as SubscriptionShape, al as UiBinding, am as UiController, an as UiControllerKind, ao as UiListCommand, ap as UiListCommandAvailability, aq as UiListCommandPreview, ar as UiListReadbackFilter, as as UiListReadbackSnapshot, at as UiListReadbackTarget, au as UiListener, av as UiUnsubscribe, aw as ViewportState, ax as createApiV3, ay as validateApiV3Metadata } from '../public-types-BR1SYK2F.cjs';
1
+ import { v as MockPayload, A as ApiStatus, U as UxIntent, w as RuntimeApiHandle, x as UiControllerFactory, y as ApiV3Ui } from '../public-types-CSSH2Whc.cjs';
2
+ export { z as AgentMetadata, B as AiPe2EvidenceOptions, D as AiPe2GraphOracleReference, F as AiPe2OracleEvidence, G as AiPe2OracleEvidenceProvider, H as AiPe2OracleEvidenceProviderInput, J as AiPe2OracleVerdict, K as ApiV3, N as ApiV3FnMetadata, O as ApiV3UiChrome, Q as ApiV3UiDebug, V as ApiV3UiLists, W as ApiV3UiOverlays, X as ApiV3UiSession, Y as ApiV3UiSurface, Z as ApiV3UiViewport, _ as BroadcastsVia, $ as ChromeDebugMode, a0 as ChromeDocumentMode, a1 as ChromeHostPosture, a2 as ChromeMarkupDisplay, a3 as ChromePosture, a4 as ChromeReviewMode, a5 as ChromeSurface, a6 as ChromeSurfaceKind, a7 as CreateApiV3Opts, a8 as DebugAttachment, a9 as DebugSession, aa as GeometryRect, ab as LiveEvidence, ac as MockShape, ad as OverlayAnchorQuery, ae as PersistsTo, af as ScrollTarget, ag as ScrollTargetBehavior, ah as SelectionRangeInput, ai as SourceLayer, aj as StateClass, ak as SubscriptionShape, al as UiBinding, am as UiController, an as UiControllerKind, ao as UiListCommand, ap as UiListCommandAvailability, aq as UiListCommandPreview, ar as UiListReadbackFilter, as as UiListReadbackSnapshot, at as UiListReadbackTarget, au as UiListener, av as UiUnsubscribe, aw as ViewportState, ax as createApiV3, ay as validateApiV3Metadata } from '../public-types-CSSH2Whc.cjs';
3
3
  import 'react';
4
4
  import 'yjs';
5
5
  import 'y-protocols/awareness';
6
- import '../canonical-document-CfZIc-fC.cjs';
6
+ import '../canonical-document-COmM7v11.cjs';
7
7
  import 'prosemirror-state';
8
8
  import 'prosemirror-model';
9
9
 
package/dist/api/v3.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { v as MockPayload, A as ApiStatus, U as UxIntent, w as RuntimeApiHandle, x as UiControllerFactory, y as ApiV3Ui } from '../public-types-DXNZVKrS.js';
2
- export { z as AgentMetadata, B as AiPe2EvidenceOptions, D as AiPe2GraphOracleReference, F as AiPe2OracleEvidence, G as AiPe2OracleEvidenceProvider, H as AiPe2OracleEvidenceProviderInput, J as AiPe2OracleVerdict, K as ApiV3, N as ApiV3FnMetadata, O as ApiV3UiChrome, Q as ApiV3UiDebug, V as ApiV3UiLists, W as ApiV3UiOverlays, X as ApiV3UiSession, Y as ApiV3UiSurface, Z as ApiV3UiViewport, _ as BroadcastsVia, $ as ChromeDebugMode, a0 as ChromeDocumentMode, a1 as ChromeHostPosture, a2 as ChromeMarkupDisplay, a3 as ChromePosture, a4 as ChromeReviewMode, a5 as ChromeSurface, a6 as ChromeSurfaceKind, a7 as CreateApiV3Opts, a8 as DebugAttachment, a9 as DebugSession, aa as GeometryRect, ab as LiveEvidence, ac as MockShape, ad as OverlayAnchorQuery, ae as PersistsTo, af as ScrollTarget, ag as ScrollTargetBehavior, ah as SelectionRangeInput, ai as SourceLayer, aj as StateClass, ak as SubscriptionShape, al as UiBinding, am as UiController, an as UiControllerKind, ao as UiListCommand, ap as UiListCommandAvailability, aq as UiListCommandPreview, ar as UiListReadbackFilter, as as UiListReadbackSnapshot, at as UiListReadbackTarget, au as UiListener, av as UiUnsubscribe, aw as ViewportState, ax as createApiV3, ay as validateApiV3Metadata } from '../public-types-DXNZVKrS.js';
1
+ import { v as MockPayload, A as ApiStatus, U as UxIntent, w as RuntimeApiHandle, x as UiControllerFactory, y as ApiV3Ui } from '../public-types-8kVIB5HW.js';
2
+ export { z as AgentMetadata, B as AiPe2EvidenceOptions, D as AiPe2GraphOracleReference, F as AiPe2OracleEvidence, G as AiPe2OracleEvidenceProvider, H as AiPe2OracleEvidenceProviderInput, J as AiPe2OracleVerdict, K as ApiV3, N as ApiV3FnMetadata, O as ApiV3UiChrome, Q as ApiV3UiDebug, V as ApiV3UiLists, W as ApiV3UiOverlays, X as ApiV3UiSession, Y as ApiV3UiSurface, Z as ApiV3UiViewport, _ as BroadcastsVia, $ as ChromeDebugMode, a0 as ChromeDocumentMode, a1 as ChromeHostPosture, a2 as ChromeMarkupDisplay, a3 as ChromePosture, a4 as ChromeReviewMode, a5 as ChromeSurface, a6 as ChromeSurfaceKind, a7 as CreateApiV3Opts, a8 as DebugAttachment, a9 as DebugSession, aa as GeometryRect, ab as LiveEvidence, ac as MockShape, ad as OverlayAnchorQuery, ae as PersistsTo, af as ScrollTarget, ag as ScrollTargetBehavior, ah as SelectionRangeInput, ai as SourceLayer, aj as StateClass, ak as SubscriptionShape, al as UiBinding, am as UiController, an as UiControllerKind, ao as UiListCommand, ap as UiListCommandAvailability, aq as UiListCommandPreview, ar as UiListReadbackFilter, as as UiListReadbackSnapshot, at as UiListReadbackTarget, au as UiListener, av as UiUnsubscribe, aw as ViewportState, ax as createApiV3, ay as validateApiV3Metadata } from '../public-types-8kVIB5HW.js';
3
3
  import 'react';
4
4
  import 'yjs';
5
5
  import 'y-protocols/awareness';
6
- import '../canonical-document-CfZIc-fC.js';
6
+ import '../canonical-document-COmM7v11.js';
7
7
  import 'prosemirror-state';
8
8
  import 'prosemirror-model';
9
9
 
package/dist/api/v3.js CHANGED
@@ -5,17 +5,17 @@ import {
5
5
  mockId,
6
6
  mockPayload,
7
7
  validateApiV3Metadata
8
- } from "../chunk-ESEEWELA.js";
9
- import "../chunk-IJD6D7HU.js";
8
+ } from "../chunk-NX7W6T7L.js";
9
+ import "../chunk-HUWZ7AHE.js";
10
10
  import "../chunk-C2LWJ4CZ.js";
11
11
  import {
12
12
  createUiApi,
13
13
  emitUxResponse
14
14
  } from "../chunk-NJFKPDNG.js";
15
- import "../chunk-O4EDZR44.js";
15
+ import "../chunk-P7XDEVS6.js";
16
16
  import "../chunk-OVLZQ6FZ.js";
17
17
  import "../chunk-QIO6V46H.js";
18
- import "../chunk-XBQFDBXE.js";
18
+ import "../chunk-EZFF6GKF.js";
19
19
  import "../chunk-OYGMRRR7.js";
20
20
  import "../chunk-V2JF42SI.js";
21
21
  import "../chunk-EFEW7BTT.js";
@@ -2494,4 +2494,4 @@ interface DiagnosticErrorEntry {
2494
2494
  */
2495
2495
  declare function createCanonicalDocumentId(documentId: string): string;
2496
2496
 
2497
- export { type TabStop as $, type TableCellBorders as A, type BlockNode as B, type CanonicalDocument as C, type DocumentRootNode as D, type CellShading as E, type FieldFamily as F, type TextMark as G, type Mutable as H, type ISO8601DateTime as I, type ParagraphNode as J, type TableIndent as K, type TableCellMargins as L, type ModelValidationIssue as M, type TableNode as N, type OpaqueFragmentRecord as O, type PageSize as P, type FieldRegistryEntry as Q, type RevisionStoryTargetRecord as R, type SectionProperties as S, type TocRegion as T, type FootnoteProperties as U, type EndnoteProperties as V, type CanonicalTheme as W, type InlineNode as X, type NumberingLevelParagraphGeometry as Y, type ParagraphSpacing as Z, type ParagraphIndentation as _, type PageMargins as a, type CanonicalRunFormatting as a0, type NumPicBullet as a1, type CanonicalParagraphFormatting as a2, type FillSpec as a3, type TextProperties as a4, type StrokeSpec as a5, type ChartModel as a6, type ResolvedTheme as a7, type ColorRef as a8, type SupportedFieldFamily as a9, type SeriesAxis as aA, type SeriesBase as aB, type ShapeProperties as aC, type Title as aD, type UnsupportedChartModel as aE, type UnsupportedReason as aF, type ValueAxis as aG, type HeaderDocument as aa, type FooterDocument as ab, type ParagraphBorders as ac, type AreaChartModel as ad, type Axis as ae, type AxisBase as af, type BarChartModel as ag, type BubbleChartModel as ah, type BubbleSeries as ai, type CategoryAxis as aj, type CategoryLikeAxis as ak, type ChartCommon as al, type ColorMod as am, type ComboChartModel as an, type DataLabelsSpec as ao, type DataPointOverride as ap, type DateAxis as aq, type Legend as ar, type LineChartModel as as, type LineSeries as at, type MarkerSpec as au, type PieChartModel as av, type PieSeries as aw, type ScatterChartModel as ax, type ScatterSeries as ay, type Series as az, type ColumnProperties as b, type PageNumbering as c, type PreservationStore as d, type DocumentNode as e, type PersistedEditorSnapshotVersion as f, CDS_SCHEMA_VERSION as g, type CompatibilityReportVersion as h, type Base64 as i, type CommentThread as j, type CommentEntry as k, type CommentResolution as l, type RevisionMetadataRecord as m, type RevisionRecord as n, createCanonicalDocumentId as o, type CanonicalSourceRef as p, type SdtDataBindingState as q, type FieldRefreshStatus as r, type CanonicalAnchor as s, type PreserveOnlyObjectSizing as t, type TableCellNode as u, type TableLook as v, type TableStyleFormatting as w, type TableWidth as x, type TableBorders as y, type TableStyleConditionalRegion as z };
2497
+ export { type TabStop as $, type TableCellBorders as A, type BlockNode as B, type CanonicalDocument as C, type DocumentRootNode as D, type CellShading as E, type FieldFamily as F, type TextMark as G, type Mutable as H, type ISO8601DateTime as I, type ParagraphNode as J, type TableIndent as K, type TableCellMargins as L, type ModelValidationIssue as M, type TableNode as N, type OpaqueFragmentRecord as O, type PageSize as P, type FieldRegistryEntry as Q, type RevisionStoryTargetRecord as R, type SectionProperties as S, type TocRegion as T, type FootnoteProperties as U, type EndnoteProperties as V, type CanonicalTheme as W, type InlineNode as X, type NumberingLevelParagraphGeometry as Y, type ParagraphSpacing as Z, type ParagraphIndentation as _, type PageMargins as a, type CanonicalRunFormatting as a0, type NumPicBullet as a1, type CanonicalParagraphFormatting as a2, type FillSpec as a3, type TextProperties as a4, type StrokeSpec as a5, type ChartModel as a6, type ResolvedTheme as a7, type ColorRef as a8, type SupportedFieldFamily as a9, type Series as aA, type SeriesAxis as aB, type SeriesBase as aC, type ShapeProperties as aD, type Title as aE, type UnsupportedChartModel as aF, type UnsupportedReason as aG, type ValueAxis as aH, type HeaderDocument as aa, type FooterDocument as ab, type ParagraphBorders as ac, type NumberingCatalog as ad, type AreaChartModel as ae, type Axis as af, type AxisBase as ag, type BarChartModel as ah, type BubbleChartModel as ai, type BubbleSeries as aj, type CategoryAxis as ak, type CategoryLikeAxis as al, type ChartCommon as am, type ColorMod as an, type ComboChartModel as ao, type DataLabelsSpec as ap, type DataPointOverride as aq, type DateAxis as ar, type Legend as as, type LineChartModel as at, type LineSeries as au, type MarkerSpec as av, type PieChartModel as aw, type PieSeries as ax, type ScatterChartModel as ay, type ScatterSeries as az, type ColumnProperties as b, type PageNumbering as c, type PreservationStore as d, type DocumentNode as e, type PersistedEditorSnapshotVersion as f, CDS_SCHEMA_VERSION as g, type CompatibilityReportVersion as h, type Base64 as i, type CommentThread as j, type CommentEntry as k, type CommentResolution as l, type RevisionMetadataRecord as m, type RevisionRecord as n, createCanonicalDocumentId as o, type CanonicalSourceRef as p, type SdtDataBindingState as q, type FieldRefreshStatus as r, type CanonicalAnchor as s, type PreserveOnlyObjectSizing as t, type TableCellNode as u, type TableLook as v, type TableStyleFormatting as w, type TableWidth as x, type TableBorders as y, type TableStyleConditionalRegion as z };
@@ -2494,4 +2494,4 @@ interface DiagnosticErrorEntry {
2494
2494
  */
2495
2495
  declare function createCanonicalDocumentId(documentId: string): string;
2496
2496
 
2497
- export { type TabStop as $, type TableCellBorders as A, type BlockNode as B, type CanonicalDocument as C, type DocumentRootNode as D, type CellShading as E, type FieldFamily as F, type TextMark as G, type Mutable as H, type ISO8601DateTime as I, type ParagraphNode as J, type TableIndent as K, type TableCellMargins as L, type ModelValidationIssue as M, type TableNode as N, type OpaqueFragmentRecord as O, type PageSize as P, type FieldRegistryEntry as Q, type RevisionStoryTargetRecord as R, type SectionProperties as S, type TocRegion as T, type FootnoteProperties as U, type EndnoteProperties as V, type CanonicalTheme as W, type InlineNode as X, type NumberingLevelParagraphGeometry as Y, type ParagraphSpacing as Z, type ParagraphIndentation as _, type PageMargins as a, type CanonicalRunFormatting as a0, type NumPicBullet as a1, type CanonicalParagraphFormatting as a2, type FillSpec as a3, type TextProperties as a4, type StrokeSpec as a5, type ChartModel as a6, type ResolvedTheme as a7, type ColorRef as a8, type SupportedFieldFamily as a9, type SeriesAxis as aA, type SeriesBase as aB, type ShapeProperties as aC, type Title as aD, type UnsupportedChartModel as aE, type UnsupportedReason as aF, type ValueAxis as aG, type HeaderDocument as aa, type FooterDocument as ab, type ParagraphBorders as ac, type AreaChartModel as ad, type Axis as ae, type AxisBase as af, type BarChartModel as ag, type BubbleChartModel as ah, type BubbleSeries as ai, type CategoryAxis as aj, type CategoryLikeAxis as ak, type ChartCommon as al, type ColorMod as am, type ComboChartModel as an, type DataLabelsSpec as ao, type DataPointOverride as ap, type DateAxis as aq, type Legend as ar, type LineChartModel as as, type LineSeries as at, type MarkerSpec as au, type PieChartModel as av, type PieSeries as aw, type ScatterChartModel as ax, type ScatterSeries as ay, type Series as az, type ColumnProperties as b, type PageNumbering as c, type PreservationStore as d, type DocumentNode as e, type PersistedEditorSnapshotVersion as f, CDS_SCHEMA_VERSION as g, type CompatibilityReportVersion as h, type Base64 as i, type CommentThread as j, type CommentEntry as k, type CommentResolution as l, type RevisionMetadataRecord as m, type RevisionRecord as n, createCanonicalDocumentId as o, type CanonicalSourceRef as p, type SdtDataBindingState as q, type FieldRefreshStatus as r, type CanonicalAnchor as s, type PreserveOnlyObjectSizing as t, type TableCellNode as u, type TableLook as v, type TableStyleFormatting as w, type TableWidth as x, type TableBorders as y, type TableStyleConditionalRegion as z };
2497
+ export { type TabStop as $, type TableCellBorders as A, type BlockNode as B, type CanonicalDocument as C, type DocumentRootNode as D, type CellShading as E, type FieldFamily as F, type TextMark as G, type Mutable as H, type ISO8601DateTime as I, type ParagraphNode as J, type TableIndent as K, type TableCellMargins as L, type ModelValidationIssue as M, type TableNode as N, type OpaqueFragmentRecord as O, type PageSize as P, type FieldRegistryEntry as Q, type RevisionStoryTargetRecord as R, type SectionProperties as S, type TocRegion as T, type FootnoteProperties as U, type EndnoteProperties as V, type CanonicalTheme as W, type InlineNode as X, type NumberingLevelParagraphGeometry as Y, type ParagraphSpacing as Z, type ParagraphIndentation as _, type PageMargins as a, type CanonicalRunFormatting as a0, type NumPicBullet as a1, type CanonicalParagraphFormatting as a2, type FillSpec as a3, type TextProperties as a4, type StrokeSpec as a5, type ChartModel as a6, type ResolvedTheme as a7, type ColorRef as a8, type SupportedFieldFamily as a9, type Series as aA, type SeriesAxis as aB, type SeriesBase as aC, type ShapeProperties as aD, type Title as aE, type UnsupportedChartModel as aF, type UnsupportedReason as aG, type ValueAxis as aH, type HeaderDocument as aa, type FooterDocument as ab, type ParagraphBorders as ac, type NumberingCatalog as ad, type AreaChartModel as ae, type Axis as af, type AxisBase as ag, type BarChartModel as ah, type BubbleChartModel as ai, type BubbleSeries as aj, type CategoryAxis as ak, type CategoryLikeAxis as al, type ChartCommon as am, type ColorMod as an, type ComboChartModel as ao, type DataLabelsSpec as ap, type DataPointOverride as aq, type DateAxis as ar, type Legend as as, type LineChartModel as at, type LineSeries as au, type MarkerSpec as av, type PieChartModel as aw, type PieSeries as ax, type ScatterChartModel as ay, type ScatterSeries as az, type ColumnProperties as b, type PageNumbering as c, type PreservationStore as d, type DocumentNode as e, type PersistedEditorSnapshotVersion as f, CDS_SCHEMA_VERSION as g, type CompatibilityReportVersion as h, type Base64 as i, type CommentThread as j, type CommentEntry as k, type CommentResolution as l, type RevisionMetadataRecord as m, type RevisionRecord as n, createCanonicalDocumentId as o, type CanonicalSourceRef as p, type SdtDataBindingState as q, type FieldRefreshStatus as r, type CanonicalAnchor as s, type PreserveOnlyObjectSizing as t, type TableCellNode as u, type TableLook as v, type TableStyleFormatting as w, type TableWidth as x, type TableBorders as y, type TableStyleConditionalRegion as z };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-Y4XZCMCS.js";
4
4
  import {
5
5
  applyTextTransaction
6
- } from "./chunk-MQ5GAJ54.js";
6
+ } from "./chunk-BJXSMPHD.js";
7
7
  import {
8
8
  createInsertedTableBlock,
9
9
  createNoopStructuralMutation,
@@ -11,11 +11,11 @@ import {
11
11
  replaceParagraphScope,
12
12
  resolveInsertedTableStyleId,
13
13
  resolveParagraphScope
14
- } from "./chunk-QTRJLKR2.js";
14
+ } from "./chunk-TSNK4ECL.js";
15
15
  import {
16
16
  NO_EDITABLE_TARGETS_INDEX,
17
17
  createEditorSurfaceSnapshot
18
- } from "./chunk-XBQFDBXE.js";
18
+ } from "./chunk-EZFF6GKF.js";
19
19
  import {
20
20
  createSelectionSnapshot
21
21
  } from "./chunk-OYGMRRR7.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  TextTransactionError
3
- } from "./chunk-MQ5GAJ54.js";
3
+ } from "./chunk-BJXSMPHD.js";
4
4
  import {
5
5
  replaceParagraphScope,
6
6
  resolveParagraphScope
7
- } from "./chunk-QTRJLKR2.js";
7
+ } from "./chunk-TSNK4ECL.js";
8
8
  import {
9
9
  cloneParagraphProperties,
10
10
  cloneStoryUnit,
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  NO_EDITABLE_TARGETS_INDEX,
12
12
  createEditorSurfaceSnapshot
13
- } from "./chunk-XBQFDBXE.js";
13
+ } from "./chunk-EZFF6GKF.js";
14
14
  import {
15
15
  createSelectionSnapshot
16
16
  } from "./chunk-OYGMRRR7.js";
@@ -2626,10 +2626,16 @@ var FormattingContextImpl = class {
2626
2626
  // surface-projection calls `resolveParagraphCascade` on the same
2627
2627
  // paragraph via `resolveParagraph` + numbering resolve + marker-rPr;
2628
2628
  // each of those re-walked the style catalog before.
2629
- paragraphCascadeCache = /* @__PURE__ */ new WeakMap();
2629
+ //
2630
+ // Defaults to a per-context instance, but the runtime can supply a
2631
+ // persistent `WeakMap` via `FormattingContextOptions.paragraphCascadeCache`
2632
+ // so unchanged paragraphs don't re-cascade on every keystroke. See the
2633
+ // contract on the option for invalidation semantics.
2634
+ paragraphCascadeCache;
2630
2635
  constructor(doc, opts) {
2631
2636
  this.doc = doc;
2632
2637
  this.opts = opts;
2638
+ this.paragraphCascadeCache = opts.paragraphCascadeCache ?? /* @__PURE__ */ new WeakMap();
2633
2639
  const canonicalTheme = doc.subParts?.canonicalTheme;
2634
2640
  this.theme = opts.themeResolver ?? (canonicalTheme ? new ThemeColorResolver(canonicalTheme) : void 0);
2635
2641
  this.numbering = opts.numberingPrefixResolver ?? createNumberingPrefixResolver(doc.numbering);
@@ -3195,7 +3201,8 @@ function createEditorSurfaceSnapshot(document, _selection, activeStory = { kind:
3195
3201
  const formattingContext = createFormattingContext(document, {
3196
3202
  ...options.revisionMarkupMode ? { revisionMarkupMode: options.revisionMarkupMode } : {},
3197
3203
  ...options.getEffectiveMarkupMode ? { getEffectiveMarkupMode: options.getEffectiveMarkupMode } : {},
3198
- ...options.authorColorPalette ? { authorColorPalette: options.authorColorPalette } : {}
3204
+ ...options.authorColorPalette ? { authorColorPalette: options.authorColorPalette } : {},
3205
+ ...options.paragraphCascadeCache ? { paragraphCascadeCache: options.paragraphCascadeCache } : {}
3199
3206
  });
3200
3207
  const editableTargetsByBlockPath = options.editableTargetsByBlockPath ?? indexEditableTargetsByBlockPath(document);
3201
3208
  const layoutIdentitiesByBlockPath = options.layoutIdentitiesByBlockPath;