@harbour-enterprises/superdoc 2.0.0-next.20 → 2.0.0-next.21

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 (27) hide show
  1. package/dist/chunks/{PdfViewer-Y5Q3KpNr.cjs → PdfViewer-B4os0dhm.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-ag_ZFG_a.es.js → PdfViewer-CvJZenVo.es.js} +1 -1
  3. package/dist/chunks/{index-XnRj2biz-DiLIwrZX.cjs → index--w_Fk0WX-Bd420t19.cjs} +1 -1
  4. package/dist/chunks/{index-XnRj2biz-CWqMvtJZ.es.js → index--w_Fk0WX-D_kNY98j.es.js} +1 -1
  5. package/dist/chunks/{index-CWNzyoyI.cjs → index-BaspZNUO.cjs} +3 -3
  6. package/dist/chunks/{index-Dymes5hN.es.js → index-bocgaXi5.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-BBUBeVVw.es.js → super-editor.es-CHiYj0m5.es.js} +105 -48
  8. package/dist/chunks/{super-editor.es-DwEkOdPH.cjs → super-editor.es-KouCN1a9.cjs} +105 -48
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-CFpzAUl1.js → converter-De_h0rq-.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-B4U-khNy.js → docx-zipper-CKQFze2s.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-CUCVDSiG.js → editor-BJljVUQD.js} +106 -49
  13. package/dist/super-editor/chunks/{index-XnRj2biz.js → index--w_Fk0WX.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-DXUz-ZeU.js → toolbar-Br3J_GSc.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +107 -50
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -12,8 +12,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _a, _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _currentEpoch, _mapsByFromEpoch, _maxEpochsToKeep, _EpochPositionMapper_instances, pruneByCurrentEpoch_fn, _entries, _windowRoot, _getPainterHost, _onRebuild, _observer, _rebuildScheduled, _rebuildRafId, _docEpoch, _layoutEpoch, _layoutUpdating, _pending, _scheduled, _rafHandle, _scheduler, _SelectionSyncCoordinator_instances, isSafeToRender_fn, maybeSchedule_fn, cancelScheduledRender_fn, _windowRoot2, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, hideDimmingOverlay_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _pageGeometryHelper, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionSync, _remoteCursorUpdateScheduled, _epochMapper, _layoutEpoch2, _domPositionIndex, _domIndexObserverManager, _debugLastPointer, _debugLastHit, _pendingMarginClick, _rafHandle2, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _a11ySelectionAnnounceTimeout, _a11yLastAnnouncedSelectionKey, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _dragAnchorPageIndex, _isDragging, _dragExtensionMode, _dragLastPointer, _dragLastRawHit, _dragUsedPageNotMountedFallback, _cellAnchor, _cellDragMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, wrapHiddenEditorFocus_fn, syncDocumentModeClass_fn, collectCommentPositions_fn, updateSelectionDebugHud_fn, computePendingMarginClick_fn, aggregateLayoutBounds_fn, rebuildDomPositionIndex_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, _handlePointerMove, _handlePointerLeave, _handleVisibleHostFocusIn, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, computeExpectedSectionType_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, syncHiddenEditorA11yAttributes_fn, scheduleA11ySelectionAnnouncement_fn, announceSelectionNow_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, isSelectionAwareVirtualizationEnabled_fn, updateSelectionVirtualizationPins_fn, finalizeDragSelectionWithDom_fn, scrollPageIntoView_fn, waitForPageMount_fn, getEffectivePageGap_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderCellSelectionOverlay_fn, renderHoverRegion_fn, clearHoverRegion_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, applyZoom_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeSelectionRectsFromDom_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$2, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as objectIncludes, a4 as AddMarkStep, a5 as RemoveMarkStep, a6 as findMark, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-CFpzAUl1.js";
16
- import { D as DocxZipper } from "./docx-zipper-B4U-khNy.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$2, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as objectIncludes, a4 as AddMarkStep, a5 as RemoveMarkStep, a6 as findMark, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-De_h0rq-.js";
16
+ import { D as DocxZipper } from "./docx-zipper-CKQFze2s.js";
17
17
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
@@ -14921,7 +14921,7 @@ const isHeadless = (editor) => {
14921
14921
  const shouldSkipNodeView = (editor) => {
14922
14922
  return isHeadless(editor);
14923
14923
  };
14924
- const summaryVersion = "2.0.0-next.20";
14924
+ const summaryVersion = "2.0.0-next.21";
14925
14925
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
14926
14926
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
14927
14927
  function mapAttributes(attrs) {
@@ -15713,7 +15713,7 @@ const _Editor = class _Editor extends EventEmitter {
15713
15713
  { default: remarkStringify },
15714
15714
  { default: remarkGfm }
15715
15715
  ] = await Promise.all([
15716
- import("./index-XnRj2biz.js"),
15716
+ import("./index--w_Fk0WX.js"),
15717
15717
  import("./index-DRCvimau.js"),
15718
15718
  import("./index-C_x_N6Uh.js"),
15719
15719
  import("./index-D_sWOSiG.js"),
@@ -15918,7 +15918,7 @@ const _Editor = class _Editor extends EventEmitter {
15918
15918
  * Process collaboration migrations
15919
15919
  */
15920
15920
  processCollaborationMigrations() {
15921
- console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.20");
15921
+ console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.21");
15922
15922
  if (!this.options.ydoc) return;
15923
15923
  const metaMap = this.options.ydoc.getMap("meta");
15924
15924
  let docVersion = metaMap.get("version");
@@ -29565,13 +29565,13 @@ function scheduleSectionBreak(block, state, baseMargins, maxHeaderContentHeight
29565
29565
  if (maxHeaderContentHeight > 0) {
29566
29566
  return Math.max(baseTop, headerDistance + maxHeaderContentHeight);
29567
29567
  }
29568
- return Math.max(baseTop, headerDistance);
29568
+ return baseTop;
29569
29569
  };
29570
29570
  const calcRequiredBottomMargin = (footerDistance, baseBottom) => {
29571
29571
  if (maxFooterContentHeight > 0) {
29572
29572
  return Math.max(baseBottom, footerDistance + maxFooterContentHeight);
29573
29573
  }
29574
- return Math.max(baseBottom, footerDistance);
29574
+ return baseBottom;
29575
29575
  };
29576
29576
  if (block.attrs?.isFirstSection && !next.hasAnyPages) {
29577
29577
  if (block.pageSize) {
@@ -30072,6 +30072,11 @@ function layoutParagraphBlock(ctx2, anchors) {
30072
30072
  const prevTrailing = state.trailingSpacing ?? 0;
30073
30073
  const neededSpacingBefore = Math.max(spacingBefore - prevTrailing, 0);
30074
30074
  if (state.cursorY + neededSpacingBefore > state.contentBottom) {
30075
+ if (state.cursorY <= state.topMargin) {
30076
+ state.trailingSpacing = 0;
30077
+ appliedSpacingBefore = true;
30078
+ break;
30079
+ }
30075
30080
  state = advanceColumn(state);
30076
30081
  if (state.trailingSpacing == null) state.trailingSpacing = 0;
30077
30082
  continue;
@@ -31387,12 +31392,12 @@ function layoutDocument(blocks, measures, options = {}) {
31387
31392
  next.pendingFooterDistance = footerDistance2;
31388
31393
  }
31389
31394
  if (block.margins?.top !== void 0 || block.margins?.header !== void 0) {
31390
- const requiredTop = maxHeaderContentHeight > 0 ? headerDistance2 + maxHeaderContentHeight : headerDistance2;
31395
+ const requiredTop = maxHeaderContentHeight > 0 ? headerDistance2 + maxHeaderContentHeight : 0;
31391
31396
  next.activeTopMargin = Math.max(sectionTop, requiredTop);
31392
31397
  next.pendingTopMargin = next.activeTopMargin;
31393
31398
  }
31394
31399
  if (block.margins?.bottom !== void 0 || block.margins?.footer !== void 0) {
31395
- const requiredBottom = maxFooterContentHeight > 0 ? footerDistance2 + maxFooterContentHeight : footerDistance2;
31400
+ const requiredBottom = maxFooterContentHeight > 0 ? footerDistance2 + maxFooterContentHeight : 0;
31396
31401
  next.activeBottomMargin = Math.max(sectionBottom, requiredBottom);
31397
31402
  next.pendingBottomMargin = next.activeBottomMargin;
31398
31403
  }
@@ -32142,7 +32147,7 @@ function layoutHeaderFooter(blocks, measures, constraints) {
32142
32147
  throw new Error("layoutHeaderFooter: width must be positive");
32143
32148
  }
32144
32149
  if (!Number.isFinite(height) || height <= 0) {
32145
- throw new Error("layoutHeaderFooter: height must be positive");
32150
+ return { pages: [], height: 0 };
32146
32151
  }
32147
32152
  const maxBehindDocOverflow = Math.max(192, height * 4);
32148
32153
  const minBehindDocY = -maxBehindDocOverflow;
@@ -33988,7 +33993,9 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
33988
33993
  `[Perf] 4.1 Measure all blocks: ${(measureEnd - measureStart).toFixed(2)}ms (${cacheMisses} measured, ${cacheHits} cached)`
33989
33994
  );
33990
33995
  let headerContentHeights;
33991
- if (headerFooter?.constraints && headerFooter.headerBlocks) {
33996
+ const hasHeaderBlocks = headerFooter?.headerBlocks && Object.keys(headerFooter.headerBlocks).length > 0;
33997
+ const hasHeaderBlocksByRId = headerFooter?.headerBlocksByRId && headerFooter.headerBlocksByRId.size > 0;
33998
+ if (headerFooter?.constraints && (hasHeaderBlocks || hasHeaderBlocksByRId)) {
33992
33999
  const hfPreStart = performance.now();
33993
34000
  const measureFn = headerFooter.measure ?? measureBlock2;
33994
34001
  invalidateHeaderFooterCache(
@@ -34000,25 +34007,45 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
34000
34007
  options.sectionMetadata
34001
34008
  );
34002
34009
  const HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT = 1;
34003
- const preHeaderLayouts = await layoutHeaderFooterWithCache(
34004
- headerFooter.headerBlocks,
34005
- headerFooter.constraints,
34006
- measureFn,
34007
- headerMeasureCache,
34008
- HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT,
34009
- void 0
34010
- // No page resolver needed for height calculation
34011
- );
34012
34010
  const isValidHeaderType = (key2) => {
34013
34011
  return ["default", "first", "even", "odd"].includes(key2);
34014
34012
  };
34015
34013
  headerContentHeights = {};
34016
- for (const [type, value] of Object.entries(preHeaderLayouts)) {
34017
- if (!isValidHeaderType(type)) continue;
34018
- if (value?.layout && typeof value.layout.height === "number") {
34019
- const height = value.layout.height;
34020
- if (Number.isFinite(height) && height >= 0) {
34021
- headerContentHeights[type] = height;
34014
+ if (hasHeaderBlocks && headerFooter.headerBlocks) {
34015
+ const preHeaderLayouts = await layoutHeaderFooterWithCache(
34016
+ headerFooter.headerBlocks,
34017
+ headerFooter.constraints,
34018
+ measureFn,
34019
+ headerMeasureCache,
34020
+ HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT,
34021
+ void 0
34022
+ // No page resolver needed for height calculation
34023
+ );
34024
+ for (const [type, value] of Object.entries(preHeaderLayouts)) {
34025
+ if (!isValidHeaderType(type)) continue;
34026
+ if (value?.layout && typeof value.layout.height === "number") {
34027
+ const height = value.layout.height;
34028
+ if (Number.isFinite(height) && height >= 0) {
34029
+ headerContentHeights[type] = height;
34030
+ }
34031
+ }
34032
+ }
34033
+ }
34034
+ if (hasHeaderBlocksByRId && headerFooter.headerBlocksByRId) {
34035
+ for (const [_rId, blocks] of headerFooter.headerBlocksByRId) {
34036
+ if (!blocks || blocks.length === 0) continue;
34037
+ const measureConstraints = {
34038
+ maxWidth: headerFooter.constraints.width,
34039
+ maxHeight: headerFooter.constraints.height
34040
+ };
34041
+ const measures2 = await Promise.all(blocks.map((block) => measureFn(block, measureConstraints)));
34042
+ const layout2 = layoutHeaderFooter(blocks, measures2, {
34043
+ width: headerFooter.constraints.width,
34044
+ height: headerFooter.constraints.height
34045
+ });
34046
+ if (layout2.height > 0) {
34047
+ const currentDefault = headerContentHeights.default ?? 0;
34048
+ headerContentHeights.default = Math.max(currentDefault, layout2.height);
34022
34049
  }
34023
34050
  }
34024
34051
  }
@@ -34026,10 +34053,12 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
34026
34053
  perfLog(`[Perf] 4.1.5 Pre-layout headers for height: ${(hfPreEnd - hfPreStart).toFixed(2)}ms`);
34027
34054
  }
34028
34055
  let footerContentHeights;
34029
- if (headerFooter?.constraints && headerFooter.footerBlocks) {
34056
+ const hasFooterBlocks = headerFooter?.footerBlocks && Object.keys(headerFooter.footerBlocks).length > 0;
34057
+ const hasFooterBlocksByRId = headerFooter?.footerBlocksByRId && headerFooter.footerBlocksByRId.size > 0;
34058
+ if (headerFooter?.constraints && (hasFooterBlocks || hasFooterBlocksByRId)) {
34030
34059
  const footerPreStart = performance.now();
34031
34060
  const measureFn = headerFooter.measure ?? measureBlock2;
34032
- if (!headerFooter.headerBlocks) {
34061
+ if (!hasHeaderBlocks && !hasHeaderBlocksByRId) {
34033
34062
  invalidateHeaderFooterCache(
34034
34063
  headerMeasureCache,
34035
34064
  headerFooterCacheState,
@@ -34040,26 +34069,46 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
34040
34069
  );
34041
34070
  }
34042
34071
  const FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT = 1;
34072
+ const isValidFooterType = (key2) => {
34073
+ return ["default", "first", "even", "odd"].includes(key2);
34074
+ };
34075
+ footerContentHeights = {};
34043
34076
  try {
34044
- const preFooterLayouts = await layoutHeaderFooterWithCache(
34045
- headerFooter.footerBlocks,
34046
- headerFooter.constraints,
34047
- measureFn,
34048
- headerMeasureCache,
34049
- FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT,
34050
- void 0
34051
- // No page resolver needed for height calculation
34052
- );
34053
- const isValidFooterType = (key2) => {
34054
- return ["default", "first", "even", "odd"].includes(key2);
34055
- };
34056
- footerContentHeights = {};
34057
- for (const [type, value] of Object.entries(preFooterLayouts)) {
34058
- if (!isValidFooterType(type)) continue;
34059
- if (value?.layout && typeof value.layout.height === "number") {
34060
- const height = value.layout.height;
34061
- if (Number.isFinite(height) && height >= 0) {
34062
- footerContentHeights[type] = height;
34077
+ if (hasFooterBlocks && headerFooter.footerBlocks) {
34078
+ const preFooterLayouts = await layoutHeaderFooterWithCache(
34079
+ headerFooter.footerBlocks,
34080
+ headerFooter.constraints,
34081
+ measureFn,
34082
+ headerMeasureCache,
34083
+ FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT,
34084
+ void 0
34085
+ // No page resolver needed for height calculation
34086
+ );
34087
+ for (const [type, value] of Object.entries(preFooterLayouts)) {
34088
+ if (!isValidFooterType(type)) continue;
34089
+ if (value?.layout && typeof value.layout.height === "number") {
34090
+ const height = value.layout.height;
34091
+ if (Number.isFinite(height) && height >= 0) {
34092
+ footerContentHeights[type] = height;
34093
+ }
34094
+ }
34095
+ }
34096
+ }
34097
+ if (hasFooterBlocksByRId && headerFooter.footerBlocksByRId) {
34098
+ for (const [_rId, blocks] of headerFooter.footerBlocksByRId) {
34099
+ if (!blocks || blocks.length === 0) continue;
34100
+ const measureConstraints = {
34101
+ maxWidth: headerFooter.constraints.width,
34102
+ maxHeight: headerFooter.constraints.height
34103
+ };
34104
+ const measures2 = await Promise.all(blocks.map((block) => measureFn(block, measureConstraints)));
34105
+ const layout2 = layoutHeaderFooter(blocks, measures2, {
34106
+ width: headerFooter.constraints.width,
34107
+ height: headerFooter.constraints.height
34108
+ });
34109
+ if (layout2.height > 0) {
34110
+ const currentDefault = footerContentHeights.default ?? 0;
34111
+ footerContentHeights.default = Math.max(currentDefault, layout2.height);
34063
34112
  }
34064
34113
  }
34065
34114
  }
@@ -51554,7 +51603,14 @@ computeHeaderFooterConstraints_fn = function() {
51554
51603
  const footerMargin = margins.footer ?? 0;
51555
51604
  const headerContentSpace = Math.max(marginTop - headerMargin, 0);
51556
51605
  const footerContentSpace = Math.max(marginBottom - footerMargin, 0);
51557
- const height = Math.max(headerContentSpace, footerContentSpace, 1);
51606
+ const height = Math.max(
51607
+ headerContentSpace,
51608
+ footerContentSpace,
51609
+ headerMargin,
51610
+ footerMargin,
51611
+ marginTop,
51612
+ marginBottom
51613
+ );
51558
51614
  return {
51559
51615
  width: measurementWidth,
51560
51616
  height,
@@ -51722,7 +51778,8 @@ computeDecorationBox_fn = function(kind, pageMargins, pageHeight) {
51722
51778
  const headerMargin = margins.header ?? 0;
51723
51779
  const topMargin = margins.top ?? DEFAULT_MARGINS.top ?? 0;
51724
51780
  const height = Math.max(topMargin - headerMargin, 1);
51725
- return { x: left2, width, height, offset: headerMargin };
51781
+ const offset2 = headerMargin;
51782
+ return { x: left2, width, height, offset: offset2 };
51726
51783
  } else {
51727
51784
  const footerMargin = margins.footer ?? 0;
51728
51785
  const bottomMargin = margins.bottom ?? DEFAULT_MARGINS.bottom ?? 0;
@@ -1,4 +1,4 @@
1
- import { aK as getDefaultExportFromCjs } from "./converter-CFpzAUl1.js";
1
+ import { aK as getDefaultExportFromCjs } from "./converter-De_h0rq-.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -1,6 +1,6 @@
1
1
  import { ref, readonly, watch, computed, getCurrentInstance, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, withDirectives, h, Teleport, toRef, nextTick, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, markRaw, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, withKeys, unref, withModifiers, createBlock, toDisplayString, vModelText, createVNode, renderList, withCtx } from "vue";
2
- import { p as process$1 } from "./converter-CFpzAUl1.js";
3
- import { g as global$1, _ as _export_sfc, u as useHighContrastMode } from "./editor-CUCVDSiG.js";
2
+ import { p as process$1 } from "./converter-De_h0rq-.js";
3
+ import { g as global$1, _ as _export_sfc, u as useHighContrastMode } from "./editor-BJljVUQD.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { ac } from "./chunks/converter-CFpzAUl1.js";
1
+ import { ac } from "./chunks/converter-De_h0rq-.js";
2
2
  export {
3
3
  ac as SuperConverter
4
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-CFpzAUl1.js";
2
- import { D } from "./chunks/docx-zipper-B4U-khNy.js";
1
+ import "./chunks/converter-De_h0rq-.js";
2
+ import { D } from "./chunks/docx-zipper-CKQFze2s.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-CUCVDSiG.js";
2
- import "./chunks/converter-CFpzAUl1.js";
3
- import "./chunks/docx-zipper-B4U-khNy.js";
1
+ import { E } from "./chunks/editor-BJljVUQD.js";
2
+ import "./chunks/converter-De_h0rq-.js";
3
+ import "./chunks/docx-zipper-CKQFze2s.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-B4U-khNy.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-CKQFze2s.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _MARK_TOGGLE_NAMES, _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, enrichTrackedChanges_fn, runCommandWithArgumentOnly_fn, syncStickyMarksFromState_fn, restoreStickyMarksIfNeeded_fn, ensureStoredMarksForMarkToggle_fn;
12
- import { aK as getDefaultExportFromCjs, a0 as v4, T as TextSelection$1, v as getMarkRange, aN as vClickOutside, aO as getActiveFormatting, aD as isInTable, O as findParentNode, at as calculateResolvedParagraphProperties, a7 as twipsToLines, Q as isList, an as parseSizeUnit, W as isMacOS, a8 as pixelsToTwips, aP as getFileObject, P as PluginKey, a as Plugin } from "./chunks/converter-CFpzAUl1.js";
13
- import { ac, i, a9, aQ } from "./chunks/converter-CFpzAUl1.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as getEditorSurfaceElement, l as collectTrackedChangesForContext, S as SLASH_MENU_HANDLED_FLAG, m as SlashMenuPluginKey, s as shouldBypassContextMenu, n as generateRulerDefinition, o as clampHandlePosition, p as calculateMarginFromHandle, q as measureCache, t as isHeadless, E as Editor, v as getStarterExtensions, P as PresentationEditor, w as Placeholder, x as getRichTextExtensions, D as DecorationSet, z as Decoration, M as Mark, A as Extension, B as Attribute, N as Node } from "./chunks/editor-CUCVDSiG.js";
15
- import { G, J, H, T, C, I, F } from "./chunks/editor-CUCVDSiG.js";
12
+ import { aK as getDefaultExportFromCjs, a0 as v4, T as TextSelection$1, v as getMarkRange, aN as vClickOutside, aO as getActiveFormatting, aD as isInTable, O as findParentNode, at as calculateResolvedParagraphProperties, a7 as twipsToLines, Q as isList, an as parseSizeUnit, W as isMacOS, a8 as pixelsToTwips, aP as getFileObject, P as PluginKey, a as Plugin } from "./chunks/converter-De_h0rq-.js";
13
+ import { ac, i, a9, aQ } from "./chunks/converter-De_h0rq-.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as getEditorSurfaceElement, l as collectTrackedChangesForContext, S as SLASH_MENU_HANDLED_FLAG, m as SlashMenuPluginKey, s as shouldBypassContextMenu, n as generateRulerDefinition, o as clampHandlePosition, p as calculateMarginFromHandle, q as measureCache, t as isHeadless, E as Editor, v as getStarterExtensions, P as PresentationEditor, w as Placeholder, x as getRichTextExtensions, D as DecorationSet, z as Decoration, M as Mark, A as Extension, B as Attribute, N as Node } from "./chunks/editor-BJljVUQD.js";
15
+ import { G, J, H, T, C, I, F } from "./chunks/editor-BJljVUQD.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, defineComponent, reactive, onUnmounted, renderSlot, useCssVars, shallowRef, createBlock, Teleport, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-DXUz-ZeU.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-Br3J_GSc.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-B4U-khNy.js";
19
+ import { D } from "./chunks/docx-zipper-CKQFze2s.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-DXUz-ZeU.js";
3
- import "./chunks/editor-CUCVDSiG.js";
2
+ import { T } from "./chunks/toolbar-Br3J_GSc.js";
3
+ import "./chunks/editor-BJljVUQD.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-DwEkOdPH.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-KouCN1a9.cjs");
4
4
  require("./chunks/vue-gvuFr0vx.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, P, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-BBUBeVVw.es.js";
1
+ import { A, a, _, C, D, E, b, P, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-CHiYj0m5.es.js";
2
2
  import "./chunks/vue-CLFbn_1r.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-DwEkOdPH.cjs");
4
- const superdoc = require("./chunks/index-CWNzyoyI.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-KouCN1a9.cjs");
4
+ const superdoc = require("./chunks/index-BaspZNUO.cjs");
5
5
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
7
7
  exports.Editor = superEditor_es.Editor;
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-BBUBeVVw.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-Dymes5hN.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-CHiYj0m5.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-bocgaXi5.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
4
  export {
5
5
  a as AnnotatorHelpers,