@beyondwork/docx-react-component 1.0.131 → 1.0.132

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 +679 -157
  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 +5 -3
  5. package/dist/api/v3.cjs +371 -32
  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-BMtONpgf.d.cts → canonical-document-CfZIc-fC.d.cts} +1 -1
  10. package/dist/{canonical-document-BMtONpgf.d.ts → canonical-document-CfZIc-fC.d.ts} +1 -1
  11. package/dist/{chunk-YLL7MF5C.js → chunk-43JAPM2F.js} +24 -17
  12. package/dist/{chunk-4YCWECLZ.js → chunk-4HGFJ6Z2.js} +1 -1
  13. package/dist/{chunk-HYHCRMR7.js → chunk-6736GA6J.js} +1 -1
  14. package/dist/{chunk-Q7Y57KOK.js → chunk-6TLZ6CMP.js} +2 -2
  15. package/dist/{chunk-DGA7M77X.js → chunk-ALWXYGXP.js} +2 -2
  16. package/dist/{chunk-PHMWH23E.js → chunk-C5LXKR54.js} +1 -1
  17. package/dist/{chunk-6TBLDBCL.js → chunk-CDEZGLQ3.js} +1 -1
  18. package/dist/{chunk-VRKK2CSZ.js → chunk-JVTDBX67.js} +2 -2
  19. package/dist/{chunk-THVM6EP5.js → chunk-LPLJZJT2.js} +1196 -35
  20. package/dist/{chunk-T5YYFDZB.js → chunk-N5FTU4HZ.js} +1 -1
  21. package/dist/{chunk-3YCQM2RV.js → chunk-QUTVR72L.js} +8 -7
  22. package/dist/{chunk-M7YRJX6V.js → chunk-RBWJHRNP.js} +1 -1
  23. package/dist/{chunk-A66ZVUAT.js → chunk-RYMMKOFI.js} +204 -10
  24. package/dist/{chunk-QXKQPUOM.js → chunk-SZ6BJA4Q.js} +3 -3
  25. package/dist/{chunk-A3GSNB4G.js → chunk-U3UMKA7B.js} +147 -13
  26. package/dist/{chunk-KNHMXKC6.js → chunk-UFPBYJMA.js} +2 -2
  27. package/dist/{chunk-35RHOE6I.js → chunk-UP2KDOYE.js} +6 -1162
  28. package/dist/{chunk-CI2TD3T4.js → chunk-W2I47J2Q.js} +1 -1
  29. package/dist/{chunk-7G5GR3VV.js → chunk-XYTWOJII.js} +5 -5
  30. package/dist/{chunk-WZDKNF37.js → chunk-YUHNDEV5.js} +7 -7
  31. package/dist/{chunk-ZVC23LKV.js → chunk-ZDYGRO2Z.js} +1 -1
  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 +312 -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 +312 -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 +312 -20
  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 +3015 -2213
  57. package/dist/index.d.cts +5 -5
  58. package/dist/index.d.ts +5 -5
  59. package/dist/index.js +554 -99
  60. package/dist/io/docx-session.d.cts +4 -4
  61. package/dist/io/docx-session.d.ts +4 -4
  62. package/dist/io/docx-session.js +4 -4
  63. package/dist/legal.d.cts +1 -1
  64. package/dist/legal.d.ts +1 -1
  65. package/dist/legal.js +3 -3
  66. package/dist/{loader-B-aL5HGD.d.ts → loader-CfpeEPAa.d.ts} +3 -3
  67. package/dist/{loader-DiY_ZgKl.d.cts → loader-MAa8VpzW.d.cts} +3 -3
  68. package/dist/{public-types-gvubspUI.d.cts → public-types-Cjs8glST.d.ts} +137 -2
  69. package/dist/{public-types-DyqnxxO9.d.ts → public-types-KBS6JnOs.d.cts} +137 -2
  70. package/dist/public-types.cjs +679 -157
  71. package/dist/public-types.d.cts +2 -2
  72. package/dist/public-types.d.ts +2 -2
  73. package/dist/public-types.js +5 -3
  74. package/dist/runtime/collab.d.cts +3 -3
  75. package/dist/runtime/collab.d.ts +3 -3
  76. package/dist/runtime/document-runtime.cjs +371 -22
  77. package/dist/runtime/document-runtime.d.cts +2 -2
  78. package/dist/runtime/document-runtime.d.ts +2 -2
  79. package/dist/runtime/document-runtime.js +14 -14
  80. package/dist/{session-CDB0hohT.d.ts → session-CkoH8FoY.d.ts} +3 -3
  81. package/dist/{session-BUN6B-Vj.d.cts → session-wwe0Gib-.d.cts} +3 -3
  82. package/dist/session.d.cts +5 -5
  83. package/dist/session.d.ts +5 -5
  84. package/dist/session.js +5 -5
  85. package/dist/tailwind.cjs +492 -202
  86. package/dist/tailwind.d.cts +2 -2
  87. package/dist/tailwind.d.ts +2 -2
  88. package/dist/tailwind.js +7 -7
  89. package/dist/{types-C4bz3kDU.d.cts → types-B3SGRW0w.d.cts} +2 -2
  90. package/dist/{types-VWH6CRvG.d.ts → types-CH7NWqVL.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 +4 -4
  94. package/dist/ui-tailwind.cjs +492 -202
  95. package/dist/ui-tailwind.d.cts +3 -3
  96. package/dist/ui-tailwind.d.ts +3 -3
  97. package/dist/ui-tailwind.js +7 -7
  98. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  createSearchPlugin,
5
5
  performSearch,
6
6
  searchPluginKey
7
- } from "./chunk-6TBLDBCL.js";
7
+ } from "./chunk-CDEZGLQ3.js";
8
8
  import {
9
9
  CODE_METADATA_TABLE,
10
10
  KNOWN_DIAGNOSTIC_CODES,
@@ -26,7 +26,7 @@ import {
26
26
  splitListParagraph,
27
27
  toggleBulletedList,
28
28
  toggleNumberedList
29
- } from "./chunk-YLL7MF5C.js";
29
+ } from "./chunk-43JAPM2F.js";
30
30
  import {
31
31
  applyParagraphStyleToDocument
32
32
  } from "./chunk-6EXNNAO6.js";
@@ -37,7 +37,7 @@ import {
37
37
  setSectionPageNumberingAtSectionIndex,
38
38
  updateSectionLayoutAtSectionIndex
39
39
  } from "./chunk-M6XR534O.js";
40
- import "./chunk-ZVC23LKV.js";
40
+ import "./chunk-ZDYGRO2Z.js";
41
41
  import {
42
42
  createRuntimeCollabSync,
43
43
  createRuntimeCommandAppliedBridge
@@ -45,7 +45,7 @@ import {
45
45
  import {
46
46
  insertPageBreak,
47
47
  insertTable
48
- } from "./chunk-QXKQPUOM.js";
48
+ } from "./chunk-SZ6BJA4Q.js";
49
49
  import {
50
50
  getFormattingStateFromRenderSnapshot
51
51
  } from "./chunk-Y4XZCMCS.js";
@@ -53,13 +53,13 @@ import {
53
53
  insertImage,
54
54
  repositionFloatingImage,
55
55
  resizeImage
56
- } from "./chunk-KNHMXKC6.js";
57
- import "./chunk-T5YYFDZB.js";
56
+ } from "./chunk-UFPBYJMA.js";
57
+ import "./chunk-N5FTU4HZ.js";
58
58
  import {
59
59
  getTableStructureContext,
60
60
  tableStructureActionHandleForTarget
61
- } from "./chunk-Q7Y57KOK.js";
62
- import "./chunk-PHMWH23E.js";
61
+ } from "./chunk-6TLZ6CMP.js";
62
+ import "./chunk-C5LXKR54.js";
63
63
  import {
64
64
  MOUNTED_SURFACE_VIEWPORT_BLOCK_THRESHOLD,
65
65
  OverlayAnchorBridgeProvider,
@@ -85,16 +85,12 @@ import {
85
85
  resolveSelectionToolRegistry,
86
86
  shouldRenderAbsoluteFloatingImageInPageOverlay,
87
87
  shouldRenderSelectionToolKind,
88
- shouldUseMountedSurfaceViewportCulling
89
- } from "./chunk-3YCQM2RV.js";
88
+ shouldUseMountedSurfaceViewportCulling,
89
+ useLayoutFacetRenderSignal
90
+ } from "./chunk-QUTVR72L.js";
90
91
  import {
91
- PREDICTED_LANE_COUNTERS,
92
- createInertGeometryFacet,
93
- finishPerfProbe,
94
- incrementInvalidationCounter,
95
- recordPerfSample,
96
- startPerfProbe
97
- } from "./chunk-35RHOE6I.js";
92
+ createInertGeometryFacet
93
+ } from "./chunk-UP2KDOYE.js";
98
94
  import {
99
95
  composeSeriesColor,
100
96
  computeStructuralHash,
@@ -108,12 +104,12 @@ import {
108
104
  resolveColor,
109
105
  tryReadLaycacheEnvelope,
110
106
  writeEnvelopeToOpcPackage
111
- } from "./chunk-WZDKNF37.js";
107
+ } from "./chunk-YUHNDEV5.js";
112
108
  import {
113
109
  findTextMatches,
114
110
  parseCanonicalFragmentFromWordML,
115
111
  searchDocument
116
- } from "./chunk-7G5GR3VV.js";
112
+ } from "./chunk-XYTWOJII.js";
117
113
  import {
118
114
  clearLocalCursorState,
119
115
  getCursorColorForUser,
@@ -123,23 +119,29 @@ import {
123
119
  import {
124
120
  resolveChromePreset,
125
121
  resolveChromeVisibilityForPreset
126
- } from "./chunk-CI2TD3T4.js";
122
+ } from "./chunk-W2I47J2Q.js";
127
123
  import {
128
124
  CAPABILITY_BY_ID,
129
125
  ISSUE_METADATA_ID,
130
126
  LAYCACHE_SCHEMA_VERSION,
131
127
  LAYOUT_ENGINE_VERSION,
132
128
  MetadataResolverMissingError,
129
+ PREDICTED_LANE_COUNTERS,
133
130
  REVIEW_ACTION_METADATA_ID,
134
131
  buildPagePreviewMaps,
135
132
  createEditorViewStateSnapshot,
136
133
  createLayoutEngine,
134
+ createPagePatchPlan,
137
135
  createScopeTagRegistry,
138
136
  createViewState,
139
137
  deriveCapabilities,
138
+ finishPerfProbe,
139
+ incrementInvalidationCounter,
140
+ recordPerfSample,
140
141
  sanitizeMarkdown,
141
- sha256Hex
142
- } from "./chunk-THVM6EP5.js";
142
+ sha256Hex,
143
+ startPerfProbe
144
+ } from "./chunk-LPLJZJT2.js";
143
145
  import "./chunk-OVLZQ6FZ.js";
144
146
  import "./chunk-QIO6V46H.js";
145
147
  import {
@@ -147,7 +149,7 @@ import {
147
149
  getStoryBlocks,
148
150
  replaceStoryBlocks,
149
151
  stableChartId
150
- } from "./chunk-A3GSNB4G.js";
152
+ } from "./chunk-U3UMKA7B.js";
151
153
  import "./chunk-SYQWQ6FE.js";
152
154
  import {
153
155
  createDefaultCanonicalDocument,
@@ -158,14 +160,14 @@ import {
158
160
  SessionNotOpenError,
159
161
  SessionNotWiredError,
160
162
  isReopenBarrier
161
- } from "./chunk-DGA7M77X.js";
163
+ } from "./chunk-ALWXYGXP.js";
162
164
  import {
163
165
  createHmacSigner,
164
166
  createHmacVerifier,
165
167
  loadDocxSessionSync,
166
168
  signWorkflowPayloadXml,
167
169
  verifyWorkflowPayloadXml
168
- } from "./chunk-VRKK2CSZ.js";
170
+ } from "./chunk-JVTDBX67.js";
169
171
  import {
170
172
  EDITOR_SESSION_STATE_VERSION,
171
173
  assertEditorSessionState,
@@ -174,8 +176,8 @@ import {
174
176
  editorSessionStateFromPersistedSnapshot,
175
177
  persistedSnapshotFromEditorSessionState,
176
178
  validateEditorSessionState
177
- } from "./chunk-4YCWECLZ.js";
178
- import "./chunk-M7YRJX6V.js";
179
+ } from "./chunk-4HGFJ6Z2.js";
180
+ import "./chunk-RBWJHRNP.js";
179
181
  import {
180
182
  decodePersistedSourcePackageBytes,
181
183
  hasValidPersistedSourcePackageDigest
@@ -187,7 +189,7 @@ import {
187
189
  collectEditableTargetRefs,
188
190
  createHeaderFooterStoryKey,
189
191
  createNoteStoryKey
190
- } from "./chunk-A66ZVUAT.js";
192
+ } from "./chunk-RYMMKOFI.js";
191
193
  import {
192
194
  readOpcPackage
193
195
  } from "./chunk-WUDSNHWF.js";
@@ -6937,6 +6939,28 @@ function paragraphNeighborDigest(p) {
6937
6939
  function paragraphExternalKey(prev, next, mediaPreviewsId, showUnsupportedObjectPreviews, renderAbsoluteFloatingObjectsInPageOverlay) {
6938
6940
  return `p|${paragraphNeighborDigest(prev)}|${paragraphNeighborDigest(next)}|m${mediaPreviewsId}|${showUnsupportedObjectPreviews ? 1 : 0}|${renderAbsoluteFloatingObjectsInPageOverlay ? 1 : 0}`;
6939
6941
  }
6942
+ function topLevelBlockExternalKey(input) {
6943
+ const common = `m${input.mediaPreviewsId}|${input.showUnsupportedObjectPreviews ? 1 : 0}|${input.renderAbsoluteFloatingObjectsInPageOverlay ? 1 : 0}`;
6944
+ if (input.block.kind === "paragraph") {
6945
+ return paragraphExternalKey(
6946
+ input.previousParagraph,
6947
+ input.nextParagraph,
6948
+ input.mediaPreviewsId,
6949
+ input.showUnsupportedObjectPreviews,
6950
+ input.renderAbsoluteFloatingObjectsInPageOverlay
6951
+ );
6952
+ }
6953
+ if (input.block.kind === "table") {
6954
+ return `t|${common}`;
6955
+ }
6956
+ if (input.block.kind === "sdt_block") {
6957
+ return `sdt|${common}`;
6958
+ }
6959
+ if (input.block.kind === "opaque_block") {
6960
+ return `opaque|${input.showUnsupportedObjectPreviews ? 1 : 0}`;
6961
+ }
6962
+ return null;
6963
+ }
6940
6964
  function cacheLookup(blockRef, externalKey) {
6941
6965
  const bucket = pmNodeCache.get(blockRef);
6942
6966
  if (!bucket) return null;
@@ -7103,69 +7127,77 @@ function buildPMBlocks(blocks, mediaPreviews, showUnsupportedObjectPreviews, ren
7103
7127
  const nextBlock = blocks[index + 1];
7104
7128
  const previousParagraph = previousBlock?.kind === "paragraph" ? previousBlock : null;
7105
7129
  const nextParagraph = nextBlock?.kind === "paragraph" ? nextBlock : null;
7106
- if (block.kind === "paragraph") {
7107
- const ref = blockRefs?.[index] ?? null;
7108
- if (ref !== null) {
7109
- const extKey = paragraphExternalKey(
7110
- previousParagraph,
7111
- nextParagraph,
7112
- mediaId,
7113
- showUnsupportedObjectPreviews,
7114
- renderAbsoluteFloatingObjectsInPageOverlay
7115
- );
7116
- const cached = cacheLookup(ref, extKey);
7117
- if (cached) {
7118
- identityCacheHits += 1;
7119
- nodes.push(cached);
7120
- continue;
7121
- }
7122
- identityCacheMisses += 1;
7123
- const built = buildParagraph(
7124
- block,
7125
- previousParagraph,
7126
- nextParagraph,
7127
- mediaPreviews,
7128
- showUnsupportedObjectPreviews,
7129
- renderAbsoluteFloatingObjectsInPageOverlay
7130
- );
7131
- cacheStore(ref, extKey, built);
7132
- nodes.push(built);
7130
+ const ref = blockRefs?.[index] ?? null;
7131
+ const externalKey = ref === null ? null : topLevelBlockExternalKey({
7132
+ block,
7133
+ previousParagraph,
7134
+ nextParagraph,
7135
+ mediaPreviewsId: mediaId,
7136
+ showUnsupportedObjectPreviews,
7137
+ renderAbsoluteFloatingObjectsInPageOverlay
7138
+ });
7139
+ if (ref !== null && externalKey !== null) {
7140
+ const cached = cacheLookup(ref, externalKey);
7141
+ if (cached) {
7142
+ identityCacheHits += 1;
7143
+ nodes.push(cached);
7133
7144
  continue;
7134
7145
  }
7135
- nodes.push(
7136
- buildParagraph(
7137
- block,
7138
- previousParagraph,
7139
- nextParagraph,
7140
- mediaPreviews,
7141
- showUnsupportedObjectPreviews,
7142
- renderAbsoluteFloatingObjectsInPageOverlay
7143
- )
7144
- );
7145
- } else if (block.kind === "table") {
7146
- nodes.push(
7147
- buildTable(
7148
- block,
7149
- mediaPreviews,
7150
- showUnsupportedObjectPreviews,
7151
- renderAbsoluteFloatingObjectsInPageOverlay
7152
- )
7153
- );
7154
- } else if (block.kind === "sdt_block") {
7155
- nodes.push(
7156
- buildSdtBlock(
7157
- block,
7158
- mediaPreviews,
7159
- showUnsupportedObjectPreviews,
7160
- renderAbsoluteFloatingObjectsInPageOverlay
7161
- )
7146
+ identityCacheMisses += 1;
7147
+ const built = buildPMBlock(
7148
+ block,
7149
+ previousParagraph,
7150
+ nextParagraph,
7151
+ mediaPreviews,
7152
+ showUnsupportedObjectPreviews,
7153
+ renderAbsoluteFloatingObjectsInPageOverlay
7162
7154
  );
7163
- } else {
7164
- nodes.push(buildOpaqueBlock(block, showUnsupportedObjectPreviews));
7155
+ cacheStore(ref, externalKey, built);
7156
+ nodes.push(built);
7157
+ continue;
7165
7158
  }
7159
+ nodes.push(
7160
+ buildPMBlock(
7161
+ block,
7162
+ previousParagraph,
7163
+ nextParagraph,
7164
+ mediaPreviews,
7165
+ showUnsupportedObjectPreviews,
7166
+ renderAbsoluteFloatingObjectsInPageOverlay
7167
+ )
7168
+ );
7166
7169
  }
7167
7170
  return nodes;
7168
7171
  }
7172
+ function buildPMBlock(block, previousParagraph, nextParagraph, mediaPreviews, showUnsupportedObjectPreviews, renderAbsoluteFloatingObjectsInPageOverlay) {
7173
+ if (block.kind === "paragraph") {
7174
+ return buildParagraph(
7175
+ block,
7176
+ previousParagraph,
7177
+ nextParagraph,
7178
+ mediaPreviews,
7179
+ showUnsupportedObjectPreviews,
7180
+ renderAbsoluteFloatingObjectsInPageOverlay
7181
+ );
7182
+ }
7183
+ if (block.kind === "table") {
7184
+ return buildTable(
7185
+ block,
7186
+ mediaPreviews,
7187
+ showUnsupportedObjectPreviews,
7188
+ renderAbsoluteFloatingObjectsInPageOverlay
7189
+ );
7190
+ }
7191
+ if (block.kind === "sdt_block") {
7192
+ return buildSdtBlock(
7193
+ block,
7194
+ mediaPreviews,
7195
+ showUnsupportedObjectPreviews,
7196
+ renderAbsoluteFloatingObjectsInPageOverlay
7197
+ );
7198
+ }
7199
+ return buildOpaqueBlock(block, showUnsupportedObjectPreviews);
7200
+ }
7169
7201
  function buildParagraph(block, previousParagraph, nextParagraph, mediaPreviews, showUnsupportedObjectPreviews, renderAbsoluteFloatingObjectsInPageOverlay) {
7170
7202
  const content = [];
7171
7203
  const paragraphLayout = resolveParagraphLayout(block);
@@ -9674,6 +9706,7 @@ function createSurfaceDecorationKey(input) {
9674
9706
  showTrackedChanges: input.showTrackedChanges,
9675
9707
  suggestionsEnabled: input.suggestionsEnabled ?? false,
9676
9708
  canEdit: input.canEdit,
9709
+ pageBreakRevision: input.pageBreakRevision ?? 0,
9677
9710
  activeCommentId: input.activeCommentId ?? null,
9678
9711
  activeRevisionId: input.activeRevisionId ?? null,
9679
9712
  workflowScopeSignature: input.workflowScopeSignature ?? null,
@@ -9686,6 +9719,292 @@ function createSurfaceDecorationKey(input) {
9686
9719
  });
9687
9720
  }
9688
9721
 
9722
+ // src/ui-tailwind/editor-surface/pm-page-body-patch.ts
9723
+ function resolvePmPageBodyPatchPlan(input) {
9724
+ if (input.patchPlan.addedPages.length > 0 || input.patchPlan.removedPages.length > 0) {
9725
+ return {
9726
+ status: "fallback",
9727
+ reason: "page-membership-change",
9728
+ pageIds: [...input.patchPlan.addedPages, ...input.patchPlan.removedPages]
9729
+ };
9730
+ }
9731
+ if (input.currentDoc.childCount !== input.previousSurface.blocks.length || input.nextDoc.childCount !== input.nextSurface.blocks.length) {
9732
+ return {
9733
+ status: "fallback",
9734
+ reason: "doc-child-count-mismatch",
9735
+ pageIds: input.realization.patchPageIds
9736
+ };
9737
+ }
9738
+ const changedEntriesByPageId = new Map(
9739
+ input.patchPlan.changedPages.map((entry) => [entry.pageId, entry])
9740
+ );
9741
+ const rawSpans = [];
9742
+ const skippedPageIds = [];
9743
+ for (const pageId of input.realization.patchPageIds) {
9744
+ const entry = changedEntriesByPageId.get(pageId);
9745
+ if (!entry || !entry.regionChanges.includes("body") || entry.fragmentChanges.length === 0) {
9746
+ skippedPageIds.push(pageId);
9747
+ continue;
9748
+ }
9749
+ const previousPage = input.previousFrame.pages.find((page) => page.page.pageId === pageId);
9750
+ const nextPage = input.nextFrame.pages.find((page) => page.page.pageId === pageId);
9751
+ if (!previousPage || !nextPage) {
9752
+ return { status: "fallback", reason: "page-not-found", pageIds: [pageId] };
9753
+ }
9754
+ const previousRange = findBlockIndexRangeForPage(
9755
+ input.previousSurface.blocks,
9756
+ previousPage.page
9757
+ );
9758
+ const nextRange = findBlockIndexRangeForPage(input.nextSurface.blocks, nextPage.page);
9759
+ if (!previousRange || !nextRange) {
9760
+ return {
9761
+ status: "fallback",
9762
+ reason: "page-has-no-block-range",
9763
+ pageIds: [pageId]
9764
+ };
9765
+ }
9766
+ const nestedSpan = resolveNestedPatchSpan({
9767
+ pageId,
9768
+ changedFragmentIds: entry.fragmentChanges,
9769
+ previousSurface: input.previousSurface,
9770
+ nextSurface: input.nextSurface,
9771
+ currentDoc: input.currentDoc,
9772
+ nextDoc: input.nextDoc,
9773
+ previousRange,
9774
+ nextRange
9775
+ });
9776
+ if (nestedSpan.status === "fallback") {
9777
+ return {
9778
+ status: "fallback",
9779
+ reason: nestedSpan.reason,
9780
+ pageIds: [pageId]
9781
+ };
9782
+ }
9783
+ rawSpans.push(
9784
+ nestedSpan.status === "nested" ? nestedSpan.span : {
9785
+ pageIds: [pageId],
9786
+ fromBlockIndex: previousRange.first,
9787
+ toBlockIndex: previousRange.last + 1,
9788
+ nextFromBlockIndex: nextRange.first,
9789
+ nextToBlockIndex: nextRange.last + 1
9790
+ }
9791
+ );
9792
+ }
9793
+ if (rawSpans.length === 0) {
9794
+ return {
9795
+ status: "fallback",
9796
+ reason: "no-body-fragment-changes",
9797
+ pageIds: skippedPageIds
9798
+ };
9799
+ }
9800
+ const spans = mergePatchSpans(rawSpans).map((span) => ({
9801
+ ...span,
9802
+ fromPm: span.fromPm ?? topLevelPositionForBlockIndex(input.currentDoc, span.fromBlockIndex),
9803
+ toPm: span.toPm ?? topLevelPositionForBlockIndex(input.currentDoc, span.toBlockIndex),
9804
+ nextFromPm: span.nextFromPm ?? topLevelPositionForBlockIndex(input.nextDoc, span.nextFromBlockIndex),
9805
+ nextToPm: span.nextToPm ?? topLevelPositionForBlockIndex(input.nextDoc, span.nextToBlockIndex)
9806
+ }));
9807
+ const selection = input.currentSelection;
9808
+ if (selection) {
9809
+ const intersecting = spans.find(
9810
+ (span) => selectionIntersectsSpan(selection, span.fromPm, span.toPm)
9811
+ );
9812
+ if (intersecting) {
9813
+ return {
9814
+ status: "fallback",
9815
+ reason: "selection-intersects-replacement",
9816
+ pageIds: intersecting.pageIds
9817
+ };
9818
+ }
9819
+ }
9820
+ return {
9821
+ status: "patch",
9822
+ spans,
9823
+ skippedPageIds,
9824
+ replacedBlockCount: spans.reduce(
9825
+ (total, span) => total + (span.replacedBlockCount ?? span.toBlockIndex - span.fromBlockIndex),
9826
+ 0
9827
+ )
9828
+ };
9829
+ }
9830
+ function resolveNestedPatchSpan(input) {
9831
+ if (input.previousRange.first !== input.previousRange.last || input.nextRange.first !== input.nextRange.last || input.previousRange.first !== input.nextRange.first) {
9832
+ return { status: "top-level" };
9833
+ }
9834
+ const topIndex = input.previousRange.first;
9835
+ const previousTop = input.previousSurface.blocks[topIndex];
9836
+ const nextTop = input.nextSurface.blocks[topIndex];
9837
+ if (!previousTop || !nextTop || previousTop.kind !== nextTop.kind) {
9838
+ return { status: "top-level" };
9839
+ }
9840
+ if (previousTop.kind !== "table" && previousTop.kind !== "sdt_block") {
9841
+ return { status: "top-level" };
9842
+ }
9843
+ const changedIds = input.changedFragmentIds.filter(
9844
+ (id) => id !== "<added>" && id !== "<removed>"
9845
+ );
9846
+ if (changedIds.length !== input.changedFragmentIds.length) {
9847
+ return { status: "top-level" };
9848
+ }
9849
+ if (changedIds.includes(previousTop.blockId) || changedIds.includes(nextTop.blockId)) {
9850
+ return { status: "top-level" };
9851
+ }
9852
+ if (changedIds.length === 0) {
9853
+ return { status: "top-level" };
9854
+ }
9855
+ const previousLocated = changedIds.map(
9856
+ (id) => findNestedBlockSpanById(input.previousSurface.blocks, input.currentDoc, id)
9857
+ );
9858
+ const nextLocated = changedIds.map(
9859
+ (id) => findNestedBlockSpanById(input.nextSurface.blocks, input.nextDoc, id)
9860
+ );
9861
+ if (previousLocated.some((span) => !span) || nextLocated.some((span) => !span)) {
9862
+ return { status: "fallback", reason: "nested-span-unavailable" };
9863
+ }
9864
+ if (previousLocated.some((span) => span?.insideVerticalMergeContinuation) || nextLocated.some((span) => span?.insideVerticalMergeContinuation)) {
9865
+ return { status: "fallback", reason: "split-row-continuation" };
9866
+ }
9867
+ const previousSpans = previousLocated;
9868
+ const nextSpans = nextLocated;
9869
+ const previousKinds = new Set(previousSpans.map((span) => span.block.kind));
9870
+ const nextKinds = new Set(nextSpans.map((span) => span.block.kind));
9871
+ if (previousKinds.size !== nextKinds.size || [...previousKinds].some((kind) => !nextKinds.has(kind))) {
9872
+ return { status: "fallback", reason: "nested-span-unavailable" };
9873
+ }
9874
+ return {
9875
+ status: "nested",
9876
+ span: {
9877
+ pageIds: [input.pageId],
9878
+ fromBlockIndex: topIndex,
9879
+ toBlockIndex: topIndex + 1,
9880
+ nextFromBlockIndex: topIndex,
9881
+ nextToBlockIndex: topIndex + 1,
9882
+ fromPm: Math.min(...previousSpans.map((span) => span.fromPm)),
9883
+ toPm: Math.max(...previousSpans.map((span) => span.toPm)),
9884
+ nextFromPm: Math.min(...nextSpans.map((span) => span.fromPm)),
9885
+ nextToPm: Math.max(...nextSpans.map((span) => span.toPm)),
9886
+ replacedBlockCount: previousSpans.length
9887
+ }
9888
+ };
9889
+ }
9890
+ function findNestedBlockSpanById(blocks, doc, blockId) {
9891
+ return findBlockSpanByIdInContainer({
9892
+ blocks,
9893
+ containerNode: doc,
9894
+ contentStartPm: 1,
9895
+ blockId,
9896
+ allowCurrentLevelMatch: false,
9897
+ insideVerticalMergeContinuation: false
9898
+ });
9899
+ }
9900
+ function findBlockSpanByIdInContainer(input) {
9901
+ let cursor = input.contentStartPm;
9902
+ for (let blockIndex = 0; blockIndex < input.blocks.length; blockIndex += 1) {
9903
+ const block = input.blocks[blockIndex];
9904
+ const childNode = input.containerNode.child(blockIndex);
9905
+ const fromPm = cursor;
9906
+ const toPm = fromPm + childNode.nodeSize;
9907
+ if (input.allowCurrentLevelMatch && block.blockId === input.blockId) {
9908
+ return {
9909
+ fromPm,
9910
+ toPm,
9911
+ blockIndex,
9912
+ block,
9913
+ insideVerticalMergeContinuation: input.insideVerticalMergeContinuation
9914
+ };
9915
+ }
9916
+ if (block.kind === "sdt_block") {
9917
+ const found = findBlockSpanByIdInContainer({
9918
+ blocks: block.children,
9919
+ containerNode: childNode,
9920
+ contentStartPm: fromPm + 1,
9921
+ blockId: input.blockId,
9922
+ allowCurrentLevelMatch: true,
9923
+ insideVerticalMergeContinuation: input.insideVerticalMergeContinuation
9924
+ });
9925
+ if (found) return found;
9926
+ } else if (block.kind === "table") {
9927
+ const found = findBlockSpanByIdInTable({
9928
+ table: block,
9929
+ tableNode: childNode,
9930
+ tableStartPm: fromPm,
9931
+ blockId: input.blockId
9932
+ });
9933
+ if (found) return found;
9934
+ }
9935
+ cursor = toPm;
9936
+ }
9937
+ return null;
9938
+ }
9939
+ function findBlockSpanByIdInTable(input) {
9940
+ let rowCursor = input.tableStartPm + 1;
9941
+ for (let rowIndex = 0; rowIndex < input.table.rows.length; rowIndex += 1) {
9942
+ const row = input.table.rows[rowIndex];
9943
+ const rowNode = input.tableNode.child(rowIndex);
9944
+ let cellCursor = rowCursor + 1;
9945
+ for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {
9946
+ const cell = row.cells[cellIndex];
9947
+ const cellNode = rowNode.child(cellIndex);
9948
+ const found = findBlockSpanByIdInContainer({
9949
+ blocks: cell.content,
9950
+ containerNode: cellNode,
9951
+ contentStartPm: cellCursor + 1,
9952
+ blockId: input.blockId,
9953
+ allowCurrentLevelMatch: true,
9954
+ insideVerticalMergeContinuation: cell.verticalMerge === "continue"
9955
+ });
9956
+ if (found) return found;
9957
+ cellCursor += cellNode.nodeSize;
9958
+ }
9959
+ rowCursor += rowNode.nodeSize;
9960
+ }
9961
+ return null;
9962
+ }
9963
+ function mergePatchSpans(spans) {
9964
+ const sorted = [...spans].sort((a, b) => a.fromBlockIndex - b.fromBlockIndex);
9965
+ const merged = [];
9966
+ for (const span of sorted) {
9967
+ const previous = merged[merged.length - 1];
9968
+ if (previous && span.fromBlockIndex <= previous.toBlockIndex && span.nextFromBlockIndex <= previous.nextToBlockIndex) {
9969
+ previous.toBlockIndex = Math.max(previous.toBlockIndex, span.toBlockIndex);
9970
+ previous.nextToBlockIndex = Math.max(
9971
+ previous.nextToBlockIndex,
9972
+ span.nextToBlockIndex
9973
+ );
9974
+ previous.fromPm = minDefined(previous.fromPm, span.fromPm);
9975
+ previous.toPm = maxDefined(previous.toPm, span.toPm);
9976
+ previous.nextFromPm = minDefined(previous.nextFromPm, span.nextFromPm);
9977
+ previous.nextToPm = maxDefined(previous.nextToPm, span.nextToPm);
9978
+ previous.replacedBlockCount = (previous.replacedBlockCount ?? previous.toBlockIndex - previous.fromBlockIndex) + (span.replacedBlockCount ?? span.toBlockIndex - span.fromBlockIndex);
9979
+ previous.pageIds = [...previous.pageIds, ...span.pageIds];
9980
+ continue;
9981
+ }
9982
+ merged.push({ ...span });
9983
+ }
9984
+ return merged;
9985
+ }
9986
+ function minDefined(left, right) {
9987
+ if (left === void 0) return right;
9988
+ if (right === void 0) return left;
9989
+ return Math.min(left, right);
9990
+ }
9991
+ function maxDefined(left, right) {
9992
+ if (left === void 0) return right;
9993
+ if (right === void 0) return left;
9994
+ return Math.max(left, right);
9995
+ }
9996
+ function topLevelPositionForBlockIndex(doc, blockIndex) {
9997
+ const clamped = Math.max(0, Math.min(blockIndex, doc.childCount));
9998
+ let pos = 1;
9999
+ for (let index = 0; index < clamped; index += 1) {
10000
+ pos += doc.child(index).nodeSize;
10001
+ }
10002
+ return pos;
10003
+ }
10004
+ function selectionIntersectsSpan(selection, from, to) {
10005
+ return selection.to > from && selection.from < to;
10006
+ }
10007
+
9689
10008
  // src/ui-tailwind/editor-surface/tw-table-node-view.tsx
9690
10009
  var TABLE_LAYOUT_SYNC_EVENT = "pm-table-layout-sync";
9691
10010
  function readRowPadding(node, side) {
@@ -13135,6 +13454,57 @@ var chartNodeViews = {
13135
13454
  chart_atom: (node) => new ChartNodeViewInstance(node)
13136
13455
  };
13137
13456
 
13457
+ // src/ui-tailwind/page-stack/page-patch-realization.ts
13458
+ function resolvePagePatchRealization(input) {
13459
+ const { patchPlan, mountedPageIds, desiredMountedPageIds } = input;
13460
+ const mounted = new Set(mountedPageIds);
13461
+ const desiredPageIds = desiredMountedPageIds ?? null;
13462
+ const desired = desiredPageIds ? new Set(desiredPageIds) : null;
13463
+ const planMounts = desiredPageIds ? desiredPageIds.filter((pageId) => !mounted.has(pageId)) : patchPlan.mountChanges.mountPageIds;
13464
+ const planUnmounts = desired ? mountedPageIds.filter((pageId) => !desired.has(pageId)) : patchPlan.mountChanges.unmountPageIds;
13465
+ const mountPageIds = uniquePageIds(planMounts);
13466
+ const unmountPageIds = uniquePageIds(planUnmounts);
13467
+ const finalMounted = resolveFinalMountedPageIds({
13468
+ mountedPageIds,
13469
+ mountPageIds,
13470
+ unmountPageIds
13471
+ });
13472
+ const changedFragmentIdsByPageId = {};
13473
+ for (const entry of patchPlan.changedPages) {
13474
+ changedFragmentIdsByPageId[entry.pageId] = entry.fragmentChanges;
13475
+ }
13476
+ const patchPageIds = patchPlan.changedPages.map((entry) => entry.pageId).filter((pageId) => finalMounted.has(pageId));
13477
+ const preservePageIds = patchPlan.unchangedPages.filter(
13478
+ (pageId) => mounted.has(pageId) && finalMounted.has(pageId)
13479
+ );
13480
+ const skippedUnchangedPageIds = patchPlan.unchangedPages.filter(
13481
+ (pageId) => !finalMounted.has(pageId)
13482
+ );
13483
+ return {
13484
+ layoutRevision: patchPlan.layoutRevision,
13485
+ geometryRevision: patchPlan.geometryRevision,
13486
+ preservePageIds: uniquePageIds(preservePageIds),
13487
+ patchPageIds: uniquePageIds(patchPageIds),
13488
+ mountPageIds,
13489
+ unmountPageIds,
13490
+ skippedUnchangedPageIds: uniquePageIds(skippedUnchangedPageIds),
13491
+ changedFragmentIdsByPageId
13492
+ };
13493
+ }
13494
+ function resolveFinalMountedPageIds(input) {
13495
+ const finalMounted = new Set(input.mountedPageIds);
13496
+ for (const pageId of input.unmountPageIds) {
13497
+ finalMounted.delete(pageId);
13498
+ }
13499
+ for (const pageId of input.mountPageIds) {
13500
+ finalMounted.add(pageId);
13501
+ }
13502
+ return finalMounted;
13503
+ }
13504
+ function uniquePageIds(pageIds) {
13505
+ return [...new Set(pageIds)];
13506
+ }
13507
+
13138
13508
  // src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx
13139
13509
  import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
13140
13510
  var BOUNDED_TYPING_SCROLL_RESTORE_MAX_DELTA_PX = 256;
@@ -13144,6 +13514,53 @@ function shouldPreserveScrollAnchorForRebuild(options) {
13144
13514
  if (!options.previousStory) return false;
13145
13515
  return storyTargetsEqual(options.previousStory, options.nextStory);
13146
13516
  }
13517
+ function pageIdsFromRenderFrame(frame) {
13518
+ return frame.pages.map((page) => page.page.pageId);
13519
+ }
13520
+ function resolvePageBodyPatchForMountedState(input) {
13521
+ if (!input.previousSurface || !input.previousFrame || !input.nextFrame || input.previousPlugins !== input.plugins) {
13522
+ return { status: "fallback" };
13523
+ }
13524
+ const patchPlan = createPagePatchPlan(input.previousFrame, input.nextFrame, void 0, {
13525
+ mountedPageIds: pageIdsFromRenderFrame(input.previousFrame),
13526
+ requestedMountPageIds: pageIdsFromRenderFrame(input.nextFrame)
13527
+ });
13528
+ const realization = resolvePagePatchRealization({
13529
+ patchPlan,
13530
+ mountedPageIds: pageIdsFromRenderFrame(input.previousFrame),
13531
+ desiredMountedPageIds: pageIdsFromRenderFrame(input.nextFrame)
13532
+ });
13533
+ const bodyPatch = resolvePmPageBodyPatchPlan({
13534
+ patchPlan,
13535
+ realization,
13536
+ previousFrame: input.previousFrame,
13537
+ nextFrame: input.nextFrame,
13538
+ previousSurface: input.previousSurface,
13539
+ nextSurface: input.nextSurface,
13540
+ currentDoc: input.view.state.doc,
13541
+ nextDoc: input.nextState.doc,
13542
+ currentSelection: input.view.state.selection
13543
+ });
13544
+ if (bodyPatch.status !== "patch") {
13545
+ if (bodyPatch.reason === "no-body-fragment-changes") {
13546
+ return { status: "skip", reason: bodyPatch.reason };
13547
+ }
13548
+ return { status: "fallback", reason: bodyPatch.reason };
13549
+ }
13550
+ return { status: "patch", plan: bodyPatch };
13551
+ }
13552
+ function applyPageBodyPatchToState(view, nextDoc, plan) {
13553
+ let tr = view.state.tr;
13554
+ const spans = [...plan.spans].sort((a, b) => b.fromPm - a.fromPm);
13555
+ for (const span of spans) {
13556
+ tr = tr.replace(
13557
+ span.fromPm,
13558
+ span.toPm,
13559
+ nextDoc.slice(span.nextFromPm, span.nextToPm)
13560
+ );
13561
+ }
13562
+ return view.state.apply(tr);
13563
+ }
13147
13564
  function buildPageBreakDecorationsFromProps(geometryFacet, isMainStory, positionMap, posture, canonicalDocument, dimensions = {}, surfaceBlocks) {
13148
13565
  if (!geometryFacet || !isMainStory) return [];
13149
13566
  const frame = geometryFacet.getRenderFrame();
@@ -13263,6 +13680,9 @@ var TwProseMirrorSurface = forwardRef(function TwProseMirrorSurface2(props, ref)
13263
13680
  const localEquivalentOpsRef = useRef5([]);
13264
13681
  const pendingRebuildScrollAnchorRef = useRef5(null);
13265
13682
  const lastBuiltStoryRef = useRef5(null);
13683
+ const lastBuiltSurfaceRef = useRef5(null);
13684
+ const lastRenderFrameRef = useRef5(null);
13685
+ const lastPluginsRef = useRef5(null);
13266
13686
  const snapshotRef = useRef5(snapshot);
13267
13687
  snapshotRef.current = snapshot;
13268
13688
  const scopeTagRegistryFactoryProp = props.scopeTagRegistryFactory;
@@ -13358,6 +13778,7 @@ var TwProseMirrorSurface = forwardRef(function TwProseMirrorSurface2(props, ref)
13358
13778
  showTrackedChanges,
13359
13779
  suggestionsEnabled,
13360
13780
  canEdit,
13781
+ pageBreakRevision: props.pageBreakRevision,
13361
13782
  activeCommentId: snapshot.comments.activeCommentId,
13362
13783
  activeRevisionId: props.activeRevisionId,
13363
13784
  workflowScopeSignature: createWorkflowScopeSignature(props.workflowScopes),
@@ -13379,6 +13800,7 @@ var TwProseMirrorSurface = forwardRef(function TwProseMirrorSurface2(props, ref)
13379
13800
  props.activeWorkflowWorkItemId,
13380
13801
  props.activeWorkflowScopeIds,
13381
13802
  props.workflowScopes,
13803
+ props.pageBreakRevision,
13382
13804
  showTrackedChanges,
13383
13805
  suggestionsEnabled,
13384
13806
  snapshot.comments.activeCommentId
@@ -13527,6 +13949,7 @@ var TwProseMirrorSurface = forwardRef(function TwProseMirrorSurface2(props, ref)
13527
13949
  props.workflowMetadata,
13528
13950
  props.workflowCandidates,
13529
13951
  props.workflowScopes,
13952
+ props.pageBreakRevision,
13530
13953
  revisionDisplayByOffset,
13531
13954
  revisionModel,
13532
13955
  showTrackedChanges,
@@ -13654,6 +14077,9 @@ var TwProseMirrorSurface = forwardRef(function TwProseMirrorSurface2(props, ref)
13654
14077
  localEquivalentOpsRef.current = [];
13655
14078
  pendingRebuildScrollAnchorRef.current = null;
13656
14079
  lastBuiltStoryRef.current = snapshot.activeStory;
14080
+ lastBuiltSurfaceRef.current = surface;
14081
+ lastRenderFrameRef.current = snapshot.activeStory.kind === "main" ? props.geometryFacet?.getRenderFrame() ?? null : null;
14082
+ lastPluginsRef.current = plugins;
13657
14083
  if (pendingTypingProbeRef.current) {
13658
14084
  finishPerfProbe(pendingTypingProbeRef.current);
13659
14085
  pendingTypingProbeRef.current = null;
@@ -13692,23 +14118,49 @@ var TwProseMirrorSurface = forwardRef(function TwProseMirrorSurface2(props, ref)
13692
14118
  previousStory: lastBuiltStoryRef.current,
13693
14119
  nextStory: snapshot.activeStory
13694
14120
  });
13695
- replaceStatePreservingPosition(
13696
- {
13697
- view,
13698
- geometryFacet: props.geometryFacet,
13699
- suppressionRef: suppressSelectionEchoRef,
13700
- preserveScrollAnchor,
13701
- maxScrollDeltaPx: BOUNDED_TYPING_SCROLL_RESTORE_MAX_DELTA_PX,
13702
- afterUpdateState: () => {
13703
- applyDecorationProps(view, positionMap);
13704
- appliedDecorationProps = true;
13705
- }
13706
- },
13707
- state
13708
- );
14121
+ const pageBodyPatch = resolvePageBodyPatchForMountedState({
14122
+ view,
14123
+ nextState: state,
14124
+ previousSurface: lastBuiltSurfaceRef.current,
14125
+ nextSurface: surface,
14126
+ previousFrame: lastRenderFrameRef.current,
14127
+ nextFrame: snapshot.activeStory.kind === "main" ? props.geometryFacet?.getRenderFrame() ?? null : null,
14128
+ plugins,
14129
+ previousPlugins: lastPluginsRef.current
14130
+ });
14131
+ const replacementState = pageBodyPatch.status === "patch" ? applyPageBodyPatchToState(view, state.doc, pageBodyPatch.plan) : state;
14132
+ if (pageBodyPatch.status === "skip") {
14133
+ applyDecorationProps(view, positionMap);
14134
+ appliedDecorationProps = true;
14135
+ } else {
14136
+ replaceStatePreservingPosition(
14137
+ {
14138
+ view,
14139
+ geometryFacet: props.geometryFacet,
14140
+ suppressionRef: suppressSelectionEchoRef,
14141
+ preserveScrollAnchor,
14142
+ maxScrollDeltaPx: BOUNDED_TYPING_SCROLL_RESTORE_MAX_DELTA_PX,
14143
+ afterUpdateState: () => {
14144
+ applyDecorationProps(view, positionMap);
14145
+ appliedDecorationProps = true;
14146
+ }
14147
+ },
14148
+ replacementState
14149
+ );
14150
+ }
14151
+ if (pageBodyPatch.status === "patch") {
14152
+ incrementInvalidationCounter("pm.pagePatch.body");
14153
+ } else if (pageBodyPatch.status === "skip") {
14154
+ incrementInvalidationCounter(`pm.pagePatch.skip.${pageBodyPatch.reason}`);
14155
+ } else if (pageBodyPatch.reason) {
14156
+ incrementInvalidationCounter(`pm.pagePatch.fallback.${pageBodyPatch.reason}`);
14157
+ }
13709
14158
  }
13710
14159
  documentBuildKeyRef.current = documentBuildKey;
13711
14160
  lastBuiltStoryRef.current = snapshot.activeStory;
14161
+ lastBuiltSurfaceRef.current = surface;
14162
+ lastRenderFrameRef.current = snapshot.activeStory.kind === "main" ? props.geometryFacet?.getRenderFrame() ?? null : null;
14163
+ lastPluginsRef.current = plugins;
13712
14164
  if (!appliedDecorationProps) {
13713
14165
  applyDecorationProps(viewRef.current, positionMap);
13714
14166
  }
@@ -13728,7 +14180,8 @@ var TwProseMirrorSurface = forwardRef(function TwProseMirrorSurface2(props, ref)
13728
14180
  surface,
13729
14181
  snapshot.selection,
13730
14182
  plugins,
13731
- props.mediaPreviews
14183
+ props.mediaPreviews,
14184
+ props.geometryFacet
13732
14185
  ]);
13733
14186
  useEffect4(() => {
13734
14187
  const view = viewRef.current;
@@ -15448,6 +15901,7 @@ var WordReviewEditor = forwardRef3(
15448
15901
  lastSavedRevisionTokenRef,
15449
15902
  runtimeViewStateSeedRef
15450
15903
  } = useEditorRuntimeBoundary(props);
15904
+ const pageBreakRevision = useLayoutFacetRenderSignal(activeRuntime.layout);
15451
15905
  const shellUiStateRef = useRef7({
15452
15906
  hostPosture: {},
15453
15907
  chromePresetInput: { chromePreset: "advanced" }
@@ -17931,6 +18385,7 @@ var WordReviewEditor = forwardRef3(
17931
18385
  pageChromeHeaderBandPx: isPageWorkspace ? 32 : 0,
17932
18386
  pageChromeFooterBandPx: isPageWorkspace ? 32 : 0,
17933
18387
  pageChromeInterGapPx: PAGE_CHROME_DEFAULTS.interGapPx,
18388
+ pageBreakRevision,
17934
18389
  onOpenHeaderStoryForPage: (pageIndex) => openStoryForPage(activeRuntime, pageIndex, "header"),
17935
18390
  onOpenFooterStoryForPage: (pageIndex) => openStoryForPage(activeRuntime, pageIndex, "footer"),
17936
18391
  onCommentActivated: (commentId) => {