@harbour-enterprises/superdoc 1.3.0-next.5 → 1.3.0-next.6

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.
@@ -1,6 +1,6 @@
1
1
  import { B as Buffer$2 } from "./jszip-B1fkPkPJ.es.js";
2
2
  import { t as twipsToInches, i as inchesToTwips, p as ptToTwips, l as linesToTwips, a as twipsToLines, b as pixelsToTwips, h as halfPointToPoints, c as twipsToPixels$2, d as convertSizeToCSS, e as inchesToPixels } from "./helpers-C8e9wR5l.es.js";
3
- import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as _getReferencedTableStyles, a4 as decodeRPrFromMarks, a5 as calculateResolvedParagraphProperties, a6 as encodeCSSFromPPr, a7 as encodeCSSFromRPr, a8 as generateOrderedListIndex, a9 as docxNumberingHelpers, aa as InputRule, ab as insertNewRelationship, ac as kebabCase$1, ad as getUnderlineCssString } from "./SuperConverter-DMbipzpl.es.js";
3
+ import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as _getReferencedTableStyles, a4 as decodeRPrFromMarks, a5 as calculateResolvedParagraphProperties, a6 as encodeCSSFromPPr, a7 as encodeCSSFromRPr, a8 as generateOrderedListIndex, a9 as docxNumberingHelpers, aa as InputRule, ab as insertNewRelationship, ac as kebabCase$1, ad as getUnderlineCssString } from "./SuperConverter-S9b1fFw5.es.js";
4
4
  import { p as process$1, r as ref, C as global$1, c as computed, E as createElementBlock, F as Fragment$1, S as renderList, O as withModifiers, G as openBlock, P as normalizeClass, M as createCommentVNode, H as toDisplayString, K as createBaseVNode, U as createApp, f as onMounted, X as onUnmounted, R as withDirectives, v as unref, Y as vModelText, y as nextTick, L as normalizeStyle, u as watch, Z as withKeys, _ as createTextVNode, I as createVNode, h, $ as readonly, s as getCurrentInstance, o as onBeforeUnmount, j as reactive, b as onBeforeMount, i as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, a as provide, g as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, D as shallowRef, w as watchEffect, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, m as markRaw, N as createBlock, J as withCtx, a9 as useCssVars, V as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-BnBKJwCW.es.js";
5
5
  import "./jszip.min-DCl8qkFO.es.js";
6
6
  import { E as EventEmitter$1 } from "./eventemitter3-CwrdEv8r.es.js";
@@ -15334,7 +15334,7 @@ const canUseDOM = () => {
15334
15334
  return false;
15335
15335
  }
15336
15336
  };
15337
- const summaryVersion = "1.3.0-next.5";
15337
+ const summaryVersion = "1.3.0-next.6";
15338
15338
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15339
15339
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15340
15340
  function mapAttributes(attrs) {
@@ -17967,7 +17967,7 @@ class Editor extends EventEmitter {
17967
17967
  * Process collaboration migrations
17968
17968
  */
17969
17969
  processCollaborationMigrations() {
17970
- console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.5");
17970
+ console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.6");
17971
17971
  if (!this.options.ydoc) return;
17972
17972
  const metaMap = this.options.ydoc.getMap("meta");
17973
17973
  let docVersion = metaMap.get("version");
@@ -30842,8 +30842,7 @@ function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, opt
30842
30842
  const titlePgEnabled = sectionTitlePg === true;
30843
30843
  const isFirstPageOfSection = sectionPageNumber === 1;
30844
30844
  if (isFirstPageOfSection && titlePgEnabled) {
30845
- if (hasFirst) return "first";
30846
- if (!hasDefault && !hasEven && !hasOdd) return null;
30845
+ if (hasFirst || hasDefault || hasEven || hasOdd) return "first";
30847
30846
  return null;
30848
30847
  }
30849
30848
  if (identifier.alternateHeaders) {
@@ -32899,6 +32898,45 @@ function layoutDocument(blocks, measures, options = {}) {
32899
32898
  return height;
32900
32899
  };
32901
32900
  const headerContentHeights = options.headerContentHeights;
32901
+ const footerContentHeights = options.footerContentHeights;
32902
+ const headerContentHeightsByRId = options.headerContentHeightsByRId;
32903
+ const footerContentHeightsByRId = options.footerContentHeightsByRId;
32904
+ const getVariantTypeForPage = (sectionPageNumber, titlePgEnabled, alternateHeaders) => {
32905
+ if (sectionPageNumber === 1 && titlePgEnabled) {
32906
+ return "first";
32907
+ }
32908
+ return "default";
32909
+ };
32910
+ const getHeaderHeightForPage = (variantType, headerRef) => {
32911
+ if (headerRef && headerContentHeightsByRId?.has(headerRef)) {
32912
+ return validateContentHeight(headerContentHeightsByRId.get(headerRef));
32913
+ }
32914
+ if (headerContentHeights) {
32915
+ return validateContentHeight(headerContentHeights[variantType]);
32916
+ }
32917
+ return 0;
32918
+ };
32919
+ const getFooterHeightForPage = (variantType, footerRef) => {
32920
+ if (footerRef && footerContentHeightsByRId?.has(footerRef)) {
32921
+ return validateContentHeight(footerContentHeightsByRId.get(footerRef));
32922
+ }
32923
+ if (footerContentHeights) {
32924
+ return validateContentHeight(footerContentHeights[variantType]);
32925
+ }
32926
+ return 0;
32927
+ };
32928
+ const calculateEffectiveTopMargin = (headerContentHeight, currentHeaderDistance, baseTopMargin) => {
32929
+ if (headerContentHeight > 0) {
32930
+ return Math.max(baseTopMargin, currentHeaderDistance + headerContentHeight);
32931
+ }
32932
+ return baseTopMargin;
32933
+ };
32934
+ const calculateEffectiveBottomMargin = (footerContentHeight, currentFooterDistance, baseBottomMargin) => {
32935
+ if (footerContentHeight > 0) {
32936
+ return Math.max(baseBottomMargin, currentFooterDistance + footerContentHeight);
32937
+ }
32938
+ return baseBottomMargin;
32939
+ };
32902
32940
  const maxHeaderContentHeight = headerContentHeights ? Math.max(
32903
32941
  0,
32904
32942
  validateContentHeight(headerContentHeights.default),
@@ -32906,9 +32944,6 @@ function layoutDocument(blocks, measures, options = {}) {
32906
32944
  validateContentHeight(headerContentHeights.even),
32907
32945
  validateContentHeight(headerContentHeights.odd)
32908
32946
  ) : 0;
32909
- const headerDistance = margins.header ?? margins.top;
32910
- const effectiveTopMargin = maxHeaderContentHeight > 0 ? Math.max(margins.top, headerDistance + maxHeaderContentHeight) : margins.top;
32911
- const footerContentHeights = options.footerContentHeights;
32912
32947
  const maxFooterContentHeight = footerContentHeights ? Math.max(
32913
32948
  0,
32914
32949
  validateContentHeight(footerContentHeights.default),
@@ -32916,8 +32951,12 @@ function layoutDocument(blocks, measures, options = {}) {
32916
32951
  validateContentHeight(footerContentHeights.even),
32917
32952
  validateContentHeight(footerContentHeights.odd)
32918
32953
  ) : 0;
32954
+ const headerDistance = margins.header ?? margins.top;
32919
32955
  const footerDistance = margins.footer ?? margins.bottom;
32920
- const effectiveBottomMargin = maxFooterContentHeight > 0 ? Math.max(margins.bottom, footerDistance + maxFooterContentHeight) : margins.bottom;
32956
+ const defaultHeaderHeight = getHeaderHeightForPage("default", void 0);
32957
+ const defaultFooterHeight = getFooterHeightForPage("default", void 0);
32958
+ const effectiveTopMargin = calculateEffectiveTopMargin(defaultHeaderHeight, headerDistance, margins.top);
32959
+ const effectiveBottomMargin = calculateEffectiveBottomMargin(defaultFooterHeight, footerDistance, margins.bottom);
32921
32960
  let activeTopMargin = effectiveTopMargin;
32922
32961
  let activeBottomMargin = effectiveBottomMargin;
32923
32962
  let activeLeftMargin = margins.left;
@@ -32926,6 +32965,10 @@ function layoutDocument(blocks, measures, options = {}) {
32926
32965
  let pendingBottomMargin = null;
32927
32966
  let pendingLeftMargin = null;
32928
32967
  let pendingRightMargin = null;
32968
+ let activeSectionBaseTopMargin = margins.top;
32969
+ let activeSectionBaseBottomMargin = margins.bottom;
32970
+ let pendingSectionBaseTopMargin = null;
32971
+ let pendingSectionBaseBottomMargin = null;
32929
32972
  let activeHeaderDistance = margins.header ?? margins.top;
32930
32973
  let pendingHeaderDistance = null;
32931
32974
  let activeFooterDistance = margins.footer ?? margins.bottom;
@@ -33131,6 +33174,7 @@ function layoutDocument(blocks, measures, options = {}) {
33131
33174
  }
33132
33175
  let activeSectionIndex = initialSectionMetadata?.sectionIndex ?? 0;
33133
33176
  let pendingSectionIndex = null;
33177
+ const sectionFirstPageNumbers = /* @__PURE__ */ new Map();
33134
33178
  const paginator = createPaginator({
33135
33179
  margins: paginatorMargins,
33136
33180
  getActiveTopMargin: () => activeTopMargin,
@@ -33144,6 +33188,7 @@ function layoutDocument(blocks, measures, options = {}) {
33144
33188
  createPage,
33145
33189
  onNewPage: (state) => {
33146
33190
  if (!state) {
33191
+ const isEnteringNewSection = pendingSectionIndex !== null;
33147
33192
  const applied = applyPendingToActive({
33148
33193
  activeTopMargin,
33149
33194
  activeBottomMargin,
@@ -33211,7 +33256,69 @@ function layoutDocument(blocks, measures, options = {}) {
33211
33256
  activeVAlign = pendingVAlign;
33212
33257
  pendingVAlign = null;
33213
33258
  }
33259
+ if (pendingSectionBaseTopMargin !== null) {
33260
+ activeSectionBaseTopMargin = pendingSectionBaseTopMargin;
33261
+ pendingSectionBaseTopMargin = null;
33262
+ }
33263
+ if (pendingSectionBaseBottomMargin !== null) {
33264
+ activeSectionBaseBottomMargin = pendingSectionBaseBottomMargin;
33265
+ pendingSectionBaseBottomMargin = null;
33266
+ }
33214
33267
  pageCount += 1;
33268
+ const newPageNumber = pageCount;
33269
+ if (isEnteringNewSection || !sectionFirstPageNumbers.has(activeSectionIndex)) {
33270
+ sectionFirstPageNumbers.set(activeSectionIndex, newPageNumber);
33271
+ }
33272
+ const firstPageInSection = sectionFirstPageNumbers.get(activeSectionIndex) ?? newPageNumber;
33273
+ const sectionPageNumber = newPageNumber - firstPageInSection + 1;
33274
+ const sectionMetadata = sectionMetadataList[activeSectionIndex];
33275
+ const titlePgEnabled = sectionMetadata?.titlePg ?? false;
33276
+ const variantType = getVariantTypeForPage(sectionPageNumber, titlePgEnabled);
33277
+ let headerRef = activeSectionRefs?.headerRefs?.[variantType];
33278
+ let footerRef = activeSectionRefs?.footerRefs?.[variantType];
33279
+ let effectiveVariantType = variantType;
33280
+ if (!headerRef && variantType !== "default" && activeSectionIndex > 0) {
33281
+ const prevSectionMetadata = sectionMetadataList[activeSectionIndex - 1];
33282
+ if (prevSectionMetadata?.headerRefs?.[variantType]) {
33283
+ headerRef = prevSectionMetadata.headerRefs[variantType];
33284
+ layoutLog(
33285
+ `[Layout] Page ${newPageNumber}: Inheriting header '${variantType}' from section ${activeSectionIndex - 1}: ${headerRef}`
33286
+ );
33287
+ }
33288
+ }
33289
+ if (!footerRef && variantType !== "default" && activeSectionIndex > 0) {
33290
+ const prevSectionMetadata = sectionMetadataList[activeSectionIndex - 1];
33291
+ if (prevSectionMetadata?.footerRefs?.[variantType]) {
33292
+ footerRef = prevSectionMetadata.footerRefs[variantType];
33293
+ layoutLog(
33294
+ `[Layout] Page ${newPageNumber}: Inheriting footer '${variantType}' from section ${activeSectionIndex - 1}: ${footerRef}`
33295
+ );
33296
+ }
33297
+ }
33298
+ if (!headerRef && variantType !== "default" && activeSectionRefs?.headerRefs?.default) {
33299
+ headerRef = activeSectionRefs.headerRefs.default;
33300
+ effectiveVariantType = "default";
33301
+ }
33302
+ if (!footerRef && variantType !== "default" && activeSectionRefs?.footerRefs?.default) {
33303
+ footerRef = activeSectionRefs.footerRefs.default;
33304
+ }
33305
+ const headerHeight = getHeaderHeightForPage(effectiveVariantType, headerRef);
33306
+ const footerHeight = getFooterHeightForPage(
33307
+ variantType !== "default" && !activeSectionRefs?.footerRefs?.[variantType] ? "default" : variantType,
33308
+ footerRef
33309
+ );
33310
+ activeTopMargin = calculateEffectiveTopMargin(headerHeight, activeHeaderDistance, activeSectionBaseTopMargin);
33311
+ activeBottomMargin = calculateEffectiveBottomMargin(
33312
+ footerHeight,
33313
+ activeFooterDistance,
33314
+ activeSectionBaseBottomMargin
33315
+ );
33316
+ layoutLog(
33317
+ `[Layout] Page ${newPageNumber}: Using variant '${variantType}' - headerHeight: ${headerHeight}, footerHeight: ${footerHeight}`
33318
+ );
33319
+ layoutLog(
33320
+ `[Layout] Page ${newPageNumber}: Adjusted margins - top: ${activeTopMargin}, bottom: ${activeBottomMargin} (base: ${activeSectionBaseTopMargin}, ${activeSectionBaseBottomMargin})`
33321
+ );
33215
33322
  return;
33216
33323
  }
33217
33324
  if (state?.page) {
@@ -33417,6 +33524,20 @@ function layoutDocument(blocks, measures, options = {}) {
33417
33524
  pendingColumns = updatedState.pendingColumns;
33418
33525
  activeOrientation = updatedState.activeOrientation;
33419
33526
  pendingOrientation = updatedState.pendingOrientation;
33527
+ const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
33528
+ const blockTopMargin = effectiveBlock.margins?.top;
33529
+ const blockBottomMargin = effectiveBlock.margins?.bottom;
33530
+ if (isFirstSection) {
33531
+ activeSectionBaseTopMargin = typeof blockTopMargin === "number" ? blockTopMargin : margins.top;
33532
+ activeSectionBaseBottomMargin = typeof blockBottomMargin === "number" ? blockBottomMargin : margins.bottom;
33533
+ } else if (blockTopMargin !== void 0 || blockBottomMargin !== void 0) {
33534
+ if (blockTopMargin !== void 0) {
33535
+ pendingSectionBaseTopMargin = typeof blockTopMargin === "number" ? blockTopMargin : margins.top;
33536
+ }
33537
+ if (blockBottomMargin !== void 0) {
33538
+ pendingSectionBaseBottomMargin = typeof blockBottomMargin === "number" ? blockBottomMargin : margins.bottom;
33539
+ }
33540
+ }
33420
33541
  if (effectiveBlock.vAlign) {
33421
33542
  const isFirstSection2 = effectiveBlock.attrs?.isFirstSection && states.length === 0;
33422
33543
  if (isFirstSection2) {
@@ -33435,7 +33556,6 @@ function layoutDocument(blocks, measures, options = {}) {
33435
33556
  }
33436
33557
  const sectionIndexRaw = effectiveBlock.attrs?.sectionIndex;
33437
33558
  const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
33438
- const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
33439
33559
  if (Number.isFinite(metadataIndex)) {
33440
33560
  if (isFirstSection) {
33441
33561
  activeSectionIndex = metadataIndex;
@@ -35623,6 +35743,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35623
35743
  `[Perf] 4.1 Measure all blocks: ${(measureEnd - measureStart).toFixed(2)}ms (${cacheMisses} measured, ${cacheHits} cached)`
35624
35744
  );
35625
35745
  let headerContentHeights;
35746
+ let headerContentHeightsByRId;
35626
35747
  const hasHeaderBlocks = headerFooter?.headerBlocks && Object.keys(headerFooter.headerBlocks).length > 0;
35627
35748
  const hasHeaderBlocksByRId = headerFooter?.headerBlocksByRId && headerFooter.headerBlocksByRId.size > 0;
35628
35749
  if (headerFooter?.constraints && (hasHeaderBlocks || hasHeaderBlocksByRId)) {
@@ -35662,7 +35783,8 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35662
35783
  }
35663
35784
  }
35664
35785
  if (hasHeaderBlocksByRId && headerFooter.headerBlocksByRId) {
35665
- for (const [_rId, blocks] of headerFooter.headerBlocksByRId) {
35786
+ headerContentHeightsByRId = /* @__PURE__ */ new Map();
35787
+ for (const [rId, blocks] of headerFooter.headerBlocksByRId) {
35666
35788
  if (!blocks || blocks.length === 0) continue;
35667
35789
  const measureConstraints = {
35668
35790
  maxWidth: headerFooter.constraints.width,
@@ -35674,8 +35796,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35674
35796
  height: headerFooter.constraints.height
35675
35797
  });
35676
35798
  if (layout2.height > 0) {
35677
- const currentDefault = headerContentHeights.default ?? 0;
35678
- headerContentHeights.default = Math.max(currentDefault, layout2.height);
35799
+ headerContentHeightsByRId.set(rId, layout2.height);
35679
35800
  }
35680
35801
  }
35681
35802
  }
@@ -35683,6 +35804,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35683
35804
  perfLog(`[Perf] 4.1.5 Pre-layout headers for height: ${(hfPreEnd - hfPreStart).toFixed(2)}ms`);
35684
35805
  }
35685
35806
  let footerContentHeights;
35807
+ let footerContentHeightsByRId;
35686
35808
  const hasFooterBlocks = headerFooter?.footerBlocks && Object.keys(headerFooter.footerBlocks).length > 0;
35687
35809
  const hasFooterBlocksByRId = headerFooter?.footerBlocksByRId && headerFooter.footerBlocksByRId.size > 0;
35688
35810
  if (headerFooter?.constraints && (hasFooterBlocks || hasFooterBlocksByRId)) {
@@ -35725,7 +35847,8 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35725
35847
  }
35726
35848
  }
35727
35849
  if (hasFooterBlocksByRId && headerFooter.footerBlocksByRId) {
35728
- for (const [_rId, blocks] of headerFooter.footerBlocksByRId) {
35850
+ footerContentHeightsByRId = /* @__PURE__ */ new Map();
35851
+ for (const [rId, blocks] of headerFooter.footerBlocksByRId) {
35729
35852
  if (!blocks || blocks.length === 0) continue;
35730
35853
  const measureConstraints = {
35731
35854
  maxWidth: headerFooter.constraints.width,
@@ -35737,8 +35860,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35737
35860
  height: headerFooter.constraints.height
35738
35861
  });
35739
35862
  if (layout2.height > 0) {
35740
- const currentDefault = footerContentHeights.default ?? 0;
35741
- footerContentHeights.default = Math.max(currentDefault, layout2.height);
35863
+ footerContentHeightsByRId.set(rId, layout2.height);
35742
35864
  }
35743
35865
  }
35744
35866
  }
@@ -35753,9 +35875,13 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35753
35875
  let layout = layoutDocument(nextBlocks, measures, {
35754
35876
  ...options,
35755
35877
  headerContentHeights,
35756
- // Pass header heights to prevent overlap
35878
+ // Pass header heights to prevent overlap (per-variant)
35757
35879
  footerContentHeights,
35758
- // Pass footer heights to prevent overlap
35880
+ // Pass footer heights to prevent overlap (per-variant)
35881
+ headerContentHeightsByRId,
35882
+ // Pass header heights by rId for per-page margin calculation
35883
+ footerContentHeightsByRId,
35884
+ // Pass footer heights by rId for per-page margin calculation
35759
35885
  remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
35760
35886
  });
35761
35887
  const layoutEnd = performance.now();
@@ -35803,9 +35929,13 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35803
35929
  layout = layoutDocument(currentBlocks, currentMeasures, {
35804
35930
  ...options,
35805
35931
  headerContentHeights,
35806
- // Pass header heights to prevent overlap
35932
+ // Pass header heights to prevent overlap (per-variant)
35807
35933
  footerContentHeights,
35808
- // Pass footer heights to prevent overlap
35934
+ // Pass footer heights to prevent overlap (per-variant)
35935
+ headerContentHeightsByRId,
35936
+ // Pass header heights by rId for per-page margin calculation
35937
+ footerContentHeightsByRId,
35938
+ // Pass footer heights by rId for per-page margin calculation
35809
35939
  remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
35810
35940
  });
35811
35941
  const relayoutEnd = performance.now();
@@ -53386,7 +53516,26 @@ class PresentationEditor extends EventEmitter {
53386
53516
  const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
53387
53517
  const sectionPageNumber = typeof firstPageInSection === "number" ? pageNumber - firstPageInSection + 1 : pageNumber;
53388
53518
  const headerFooterType = multiSectionId ? getHeaderFooterTypeForSection(pageNumber, sectionIndex, multiSectionId, { kind, sectionPageNumber }) : getHeaderFooterType(pageNumber, legacyIdentifier, { kind });
53389
- const sectionRId = page?.sectionRefs && kind === "header" ? page.sectionRefs.headerRefs?.[headerFooterType] ?? void 0 : page?.sectionRefs && kind === "footer" ? page.sectionRefs.footerRefs?.[headerFooterType] ?? void 0 : void 0;
53519
+ let sectionRId;
53520
+ if (page?.sectionRefs && kind === "header") {
53521
+ sectionRId = page.sectionRefs.headerRefs?.[headerFooterType];
53522
+ if (!sectionRId && headerFooterType && headerFooterType !== "default" && sectionIndex > 0 && multiSectionId) {
53523
+ const prevSectionIds = multiSectionId.sectionHeaderIds.get(sectionIndex - 1);
53524
+ sectionRId = prevSectionIds?.[headerFooterType] ?? void 0;
53525
+ }
53526
+ if (!sectionRId && headerFooterType !== "default") {
53527
+ sectionRId = page.sectionRefs.headerRefs?.default;
53528
+ }
53529
+ } else if (page?.sectionRefs && kind === "footer") {
53530
+ sectionRId = page.sectionRefs.footerRefs?.[headerFooterType];
53531
+ if (!sectionRId && headerFooterType && headerFooterType !== "default" && sectionIndex > 0 && multiSectionId) {
53532
+ const prevSectionIds = multiSectionId.sectionFooterIds.get(sectionIndex - 1);
53533
+ sectionRId = prevSectionIds?.[headerFooterType] ?? void 0;
53534
+ }
53535
+ if (!sectionRId && headerFooterType !== "default") {
53536
+ sectionRId = page.sectionRefs.footerRefs?.default;
53537
+ }
53538
+ }
53390
53539
  if (!headerFooterType) {
53391
53540
  return null;
53392
53541
  }
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("../chunks/jszip-C8_CqJxM.cjs");
4
4
  require("../chunks/helpers-nOdwpmwb.cjs");
5
- const superEditor_converter = require("../chunks/SuperConverter-tcg6NQjY.cjs");
5
+ const superEditor_converter = require("../chunks/SuperConverter-BdOf8skU.cjs");
6
6
  require("../chunks/uuid-R7L08bOx.cjs");
7
7
  exports.SuperConverter = superEditor_converter.SuperConverter;
@@ -1,6 +1,6 @@
1
1
  import "../chunks/jszip-B1fkPkPJ.es.js";
2
2
  import "../chunks/helpers-C8e9wR5l.es.js";
3
- import { S } from "../chunks/SuperConverter-DMbipzpl.es.js";
3
+ import { S } from "../chunks/SuperConverter-S9b1fFw5.es.js";
4
4
  import "../chunks/uuid-CjlX8hrF.es.js";
5
5
  export {
6
6
  S as SuperConverter
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-BHIGTNEQ.cjs");
3
+ const index = require("./chunks/index-C4RVDXKX.cjs");
4
4
  const superEditor_docxZipper = require("./super-editor/docx-zipper.cjs");
5
5
  const superEditor_fileZipper = require("./super-editor/file-zipper.cjs");
6
6
  const vue = require("./chunks/vue-De9wkgLl.cjs");
7
- const superEditor_converter = require("./chunks/SuperConverter-tcg6NQjY.cjs");
7
+ const superEditor_converter = require("./chunks/SuperConverter-BdOf8skU.cjs");
8
8
  function isNodeType(node, name) {
9
9
  return node.type.name === name;
10
10
  }
@@ -1,9 +1,9 @@
1
- import { ax as Node, ay as Mark } from "./chunks/index-BSxlafD_.es.js";
2
- import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-BSxlafD_.es.js";
1
+ import { ax as Node, ay as Mark } from "./chunks/index-CqbujvlE.es.js";
2
+ import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-CqbujvlE.es.js";
3
3
  import { default as default2 } from "./super-editor/docx-zipper.es.js";
4
4
  import { createZip } from "./super-editor/file-zipper.es.js";
5
5
  import { d as defineComponent, E as createElementBlock, G as openBlock, K as createBaseVNode } from "./chunks/vue-BnBKJwCW.es.js";
6
- import { S, r } from "./chunks/SuperConverter-DMbipzpl.es.js";
6
+ import { S, r } from "./chunks/SuperConverter-S9b1fFw5.es.js";
7
7
  function isNodeType(node, name) {
8
8
  return node.type.name === name;
9
9
  }
package/dist/superdoc.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-BHIGTNEQ.cjs");
4
- const superdoc = require("./chunks/index-79lZpkMi.cjs");
5
- const superEditor_converter = require("./chunks/SuperConverter-tcg6NQjY.cjs");
3
+ const index = require("./chunks/index-C4RVDXKX.cjs");
4
+ const superdoc = require("./chunks/index-CEDW4NYV.cjs");
5
+ const superEditor_converter = require("./chunks/SuperConverter-BdOf8skU.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
7
7
  require("./chunks/jszip-C8_CqJxM.cjs");
8
8
  require("./chunks/helpers-nOdwpmwb.cjs");
@@ -1,6 +1,6 @@
1
- import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-BSxlafD_.es.js";
2
- import { D, H, P, S, c } from "./chunks/index-B697vddF.es.js";
3
- import { S as S2, r } from "./chunks/SuperConverter-DMbipzpl.es.js";
1
+ import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-CqbujvlE.es.js";
2
+ import { D, H, P, S, c } from "./chunks/index-9qGjdWOS.es.js";
3
+ import { S as S2, r } from "./chunks/SuperConverter-S9b1fFw5.es.js";
4
4
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
5
5
  import "./chunks/jszip-B1fkPkPJ.es.js";
6
6
  import "./chunks/helpers-C8e9wR5l.es.js";