superdoc 1.0.0-beta.7 → 1.0.0-beta.9

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-hAYAlKzI.es.js → PdfViewer-CuFLNmIu.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-T4fTm1XF.cjs → PdfViewer-IfeBMKsU.cjs} +1 -1
  3. package/dist/chunks/{index-DV613LhK-BY095UD2.es.js → index-BVhSHfFK-4HejWjUD.es.js} +1 -1
  4. package/dist/chunks/{index-DV613LhK-CqFLIBmd.cjs → index-BVhSHfFK-CTmHktSn.cjs} +1 -1
  5. package/dist/chunks/{index-CYQjWGo5.cjs → index-CICIPNZT.cjs} +3 -3
  6. package/dist/chunks/{index-DGYP5Xod.es.js → index-WwpxSzB1.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-CcaD69pQ.es.js → super-editor.es-BJP3oxNX.es.js} +250 -47
  8. package/dist/chunks/{super-editor.es-DmhQckCV.cjs → super-editor.es-CCq8j_qB.cjs} +250 -47
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-BM6gXTRC.js → converter-VnZK3P1W.js} +27 -2
  11. package/dist/super-editor/chunks/{docx-zipper-fwXPJGKu.js → docx-zipper-Bw5zXmBh.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-RPTrfArg.js → editor-CKkHVssy.js} +259 -60
  13. package/dist/super-editor/chunks/{index-DV613LhK.js → index-BVhSHfFK.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-DacKXz_n.js → toolbar-DPzMju-T.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 +252 -49
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-DacKXz_n.js";
3
- import "./chunks/editor-RPTrfArg.js";
2
+ import { T } from "./chunks/toolbar-DPzMju-T.js";
3
+ import "./chunks/editor-CKkHVssy.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-DmhQckCV.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-CCq8j_qB.cjs");
4
4
  require("./chunks/vue-ARQSyfaw.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-CcaD69pQ.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-BJP3oxNX.es.js";
2
2
  import "./chunks/vue-CztqUvm1.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-DmhQckCV.cjs");
4
- const superdoc = require("./chunks/index-CYQjWGo5.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-CCq8j_qB.cjs");
4
+ const superdoc = require("./chunks/index-CICIPNZT.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-CcaD69pQ.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-DGYP5Xod.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-BJP3oxNX.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-WwpxSzB1.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
4
  export {
5
5
  a as AnnotatorHelpers,
@@ -19530,18 +19530,43 @@
19530
19530
  }
19531
19531
  return marks;
19532
19532
  }
19533
- function encodeCSSFromPPr(paragraphProperties) {
19533
+ function encodeCSSFromPPr(paragraphProperties, hasPreviousParagraph, nextParagraphProps) {
19534
19534
  if (!paragraphProperties || typeof paragraphProperties !== "object") {
19535
19535
  return {};
19536
19536
  }
19537
19537
  let css = {};
19538
19538
  const { spacing, indent: indent2, borders, justification } = paragraphProperties;
19539
+ const nextStyleId = nextParagraphProps?.styleId;
19539
19540
  if (spacing) {
19541
+ const getEffectiveBefore = (nextSpacing, isListItem) => {
19542
+ if (!nextSpacing) return 0;
19543
+ if (nextSpacing.beforeAutospacing && isListItem) {
19544
+ return 0;
19545
+ }
19546
+ return nextSpacing.before || 0;
19547
+ };
19540
19548
  const isDropCap = Boolean(paragraphProperties.framePr?.dropCap);
19541
19549
  const spacingCopy = { ...spacing };
19550
+ if (hasPreviousParagraph) {
19551
+ delete spacingCopy.before;
19552
+ }
19542
19553
  if (isDropCap) {
19543
19554
  spacingCopy.line = linesToTwips(1);
19544
19555
  spacingCopy.lineRule = "auto";
19556
+ delete spacingCopy.after;
19557
+ } else {
19558
+ const nextBefore = getEffectiveBefore(
19559
+ nextParagraphProps?.spacing,
19560
+ Boolean(nextParagraphProps?.numberingProperties)
19561
+ );
19562
+ spacingCopy.after = Math.max(spacingCopy.after || 0, nextBefore);
19563
+ if (paragraphProperties.contextualSpacing && nextStyleId != null && nextStyleId === paragraphProperties.styleId) {
19564
+ spacingCopy.after -= paragraphProperties.spacing?.after || 0;
19565
+ }
19566
+ if (nextParagraphProps?.contextualSpacing && nextStyleId != null && nextStyleId === paragraphProperties.styleId) {
19567
+ spacingCopy.after -= nextBefore;
19568
+ }
19569
+ spacingCopy.after = Math.max(spacingCopy.after, 0);
19545
19570
  }
19546
19571
  const spacingStyle = getSpacingStyle(spacingCopy, Boolean(paragraphProperties.numberingProperties));
19547
19572
  css = { ...css, ...spacingStyle };
@@ -35581,7 +35606,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35581
35606
  static getStoredSuperdocVersion(docx) {
35582
35607
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35583
35608
  }
35584
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.7") {
35609
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.9") {
35585
35610
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35586
35611
  }
35587
35612
  /**
@@ -46562,7 +46587,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
46562
46587
  var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
46563
46588
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
46564
46589
  var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
46565
- var _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, _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, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _headerLayoutResults, _footerLayoutResults, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, updateDecorationProviders_fn, createDecorationProvider_fn, computeDecorationBox_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, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, computeHeaderFooterCaretRect_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _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, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, updateHTMLAttributes_fn, updateDOMStyles_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;
46590
+ var _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, _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, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _headerLayoutResults, _footerLayoutResults, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, updateDecorationProviders_fn, createDecorationProvider_fn, computeDecorationBox_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, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, computeHeaderFooterCaretRect_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _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, _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;
46566
46591
  var GOOD_LEAF_SIZE = 200;
46567
46592
  var RopeSequence = function RopeSequence2() {
46568
46593
  };
@@ -60069,7 +60094,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60069
60094
  const shouldSkipNodeView = (editor) => {
60070
60095
  return isHeadless(editor);
60071
60096
  };
60072
- const summaryVersion = "1.0.0-beta.7";
60097
+ const summaryVersion = "1.0.0-beta.9";
60073
60098
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
60074
60099
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
60075
60100
  function mapAttributes(attrs) {
@@ -60848,7 +60873,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60848
60873
  { default: remarkStringify2 },
60849
60874
  { default: remarkGfm2 }
60850
60875
  ] = await Promise.all([
60851
- Promise.resolve().then(() => indexDV613LhK),
60876
+ Promise.resolve().then(() => indexBVhSHfFK),
60852
60877
  Promise.resolve().then(() => indexDRCvimau),
60853
60878
  Promise.resolve().then(() => indexC_x_N6Uh),
60854
60879
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -61053,7 +61078,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61053
61078
  * Process collaboration migrations
61054
61079
  */
61055
61080
  processCollaborationMigrations() {
61056
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.7");
61081
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.9");
61057
61082
  if (!this.options.ydoc) return;
61058
61083
  const metaMap = this.options.ydoc.getMap("meta");
61059
61084
  let docVersion = metaMap.get("version");
@@ -64605,8 +64630,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64605
64630
  const beforeWidth = measureText2 ? measureText2(before) : 0;
64606
64631
  width -= beforeWidth;
64607
64632
  }
64608
- } else if (alignment2 === "bar") {
64609
- width = 0;
64610
64633
  }
64611
64634
  if (width < 1) {
64612
64635
  return fallbackWidth();
@@ -69649,14 +69672,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69649
69672
  return metrics.width;
69650
69673
  }
69651
69674
  function lineHeightForRuns(runs2, fromRun, toRun) {
69652
- let maxSize = 0;
69675
+ let maxSize2 = 0;
69653
69676
  for (let i2 = fromRun; i2 <= toRun; i2 += 1) {
69654
69677
  const run2 = runs2[i2];
69655
69678
  const textRun = run2 && isTextRun(run2) ? run2 : null;
69656
69679
  const size2 = textRun?.fontSize ?? 16;
69657
- if (size2 > maxSize) maxSize = size2;
69680
+ if (size2 > maxSize2) maxSize2 = size2;
69658
69681
  }
69659
- return maxSize * 1.2;
69682
+ return maxSize2 * 1.2;
69660
69683
  }
69661
69684
  function remeasureParagraph(block, maxWidth) {
69662
69685
  const runs2 = block.runs ?? [];
@@ -75259,6 +75282,45 @@ ${l}
75259
75282
  function degToRad(degrees) {
75260
75283
  return degrees * Math.PI / 180;
75261
75284
  }
75285
+ const defaultMaxSize = 5e3;
75286
+ let maxSize = defaultMaxSize;
75287
+ const cache$1$1 = /* @__PURE__ */ new Map();
75288
+ const makeKey = (text2, font, letterSpacing) => {
75289
+ return `${text2}|${font}|${letterSpacing || 0}`;
75290
+ };
75291
+ function getMeasuredTextWidth(text2, font, letterSpacing, ctx2) {
75292
+ if (text2.length > 32e3) {
75293
+ text2 = text2.substring(0, 32e3);
75294
+ }
75295
+ const key2 = makeKey(text2, font, letterSpacing);
75296
+ const hit = cache$1$1.get(key2);
75297
+ if (hit !== void 0) {
75298
+ cache$1$1.delete(key2);
75299
+ cache$1$1.set(key2, hit);
75300
+ return hit.width;
75301
+ }
75302
+ try {
75303
+ ctx2.font = font;
75304
+ const metrics = ctx2.measureText(text2);
75305
+ const advanceWidth = metrics.width;
75306
+ const paintedWidth = (metrics.actualBoundingBoxLeft || 0) + (metrics.actualBoundingBoxRight || 0);
75307
+ const baseWidth = Math.max(advanceWidth, paintedWidth);
75308
+ const extra = letterSpacing ? Math.max(0, text2.length - 1) * letterSpacing : 0;
75309
+ const width = baseWidth + extra;
75310
+ cache$1$1.set(key2, { width });
75311
+ evictIfNeeded();
75312
+ return width;
75313
+ } catch {
75314
+ return 0;
75315
+ }
75316
+ }
75317
+ function evictIfNeeded() {
75318
+ while (cache$1$1.size > maxSize) {
75319
+ const oldestKey = cache$1$1.keys().next().value;
75320
+ if (oldestKey === void 0) break;
75321
+ cache$1$1.delete(oldestKey);
75322
+ }
75323
+ }
75262
75324
  const { computeTabStops } = Engines;
75263
75325
  let canvasContext = null;
75264
75326
  const DEFAULT_TAB_INTERVAL_TWIPS = 720;
@@ -75303,8 +75365,7 @@ ${l}
75303
75365
  const metrics = ctx2.measureText(text2);
75304
75366
  const advanceWidth = metrics.width;
75305
75367
  const paintedWidth = (metrics.actualBoundingBoxLeft || 0) + (metrics.actualBoundingBoxRight || 0);
75306
- const baseWidth = Math.max(advanceWidth, paintedWidth);
75307
- return baseWidth;
75368
+ return Math.max(advanceWidth, paintedWidth);
75308
75369
  }
75309
75370
  const MIN_SINGLE_LINE_PX = 12 * 96 / 72;
75310
75371
  function calculateTypographyMetrics(fontSize2, spacing) {
@@ -75885,13 +75946,9 @@ ${l}
75885
75946
  };
75886
75947
  };
75887
75948
  const measureRunWidth = (text2, font, ctx2, run2) => {
75888
- const baseWidth = measureText(text2, font, ctx2);
75889
- const letterSpacing = run2.kind !== "tab" ? run2.letterSpacing : void 0;
75890
- if (!letterSpacing) {
75891
- return baseWidth;
75892
- }
75893
- const extra = Math.max(0, text2.length - 1) * letterSpacing;
75894
- return roundValue(baseWidth + extra);
75949
+ const letterSpacing = run2.kind !== "tab" ? run2.letterSpacing || 0 : 0;
75950
+ const width = getMeasuredTextWidth(text2, font, letterSpacing, ctx2);
75951
+ return roundValue(width);
75895
75952
  };
75896
75953
  const appendSegment = (segments, runIndex, fromChar, toChar, width, x2) => {
75897
75954
  if (!segments) return;
@@ -82640,7 +82697,7 @@ ${l}
82640
82697
  const tabHeight = paragraphContext.tabHeight;
82641
82698
  paragraphContext.accumulatedTabWidth = accumulatedTabWidth + tabWidth;
82642
82699
  return `width: ${tabWidth}px; height: ${tabHeight}; ${extraStyles}`;
82643
- } catch (error) {
82700
+ } catch {
82644
82701
  return null;
82645
82702
  }
82646
82703
  }
@@ -82832,6 +82889,7 @@ ${l}
82832
82889
  const fontSize2 = parseInt(parentTextStyleMark?.attrs.fontSize) * ptToPxRatio || defaultFontSize;
82833
82890
  return `${fontSize2 * defaultLineHeight}px`;
82834
82891
  }
82892
+ const nodeViewMap = /* @__PURE__ */ new WeakMap();
82835
82893
  class ParagraphNodeView {
82836
82894
  /**
82837
82895
  * @param {import('prosemirror-model').Node} node Current paragraph node.
@@ -82848,6 +82906,8 @@ ${l}
82848
82906
  this.decorations = decorations;
82849
82907
  this.extensionAttrs = extensionAttrs;
82850
82908
  this._animationFrameRequest = null;
82909
+ this.surroundingContext = {};
82910
+ nodeViewMap.set(this.node, this);
82851
82911
  calculateResolvedParagraphProperties(this.editor, this.node, this.editor.state.doc.resolve(this.getPos()));
82852
82912
  this.dom = document.createElement("p");
82853
82913
  this.contentDOM = document.createElement("span");
@@ -82867,18 +82927,26 @@ ${l}
82867
82927
  /**
82868
82928
  * @param {import('prosemirror-model').Node} node
82869
82929
  * @param {import('prosemirror-view').Decoration[]} decorations
82930
+ * @param {import('prosemirror-view').Decoration[]} innerDecorations
82931
+ * @param {boolean} [forceUpdate=false]
82932
+ * @returns {boolean}
82870
82933
  */
82871
- update(node2, decorations) {
82934
+ update(node2, decorations, innerDecorations, forceUpdate = false) {
82935
+ if (nodeViewMap.get(this.node) === this) {
82936
+ nodeViewMap.delete(this.node);
82937
+ }
82938
+ const oldProps = getResolvedParagraphProperties(this.node);
82872
82939
  const oldAttrs = this.node.attrs;
82873
- const newAttrs = node2.attrs;
82874
82940
  this.node = node2;
82875
82941
  this.decorations = decorations;
82876
- if (JSON.stringify(oldAttrs) === JSON.stringify(newAttrs)) {
82942
+ this.innerDecorations = innerDecorations;
82943
+ nodeViewMap.set(this.node, this);
82944
+ if (!forceUpdate && !__privateMethod$1(this, _ParagraphNodeView_instances, checkShouldUpdate_fn).call(this, oldProps, oldAttrs, this.surroundingContext)) {
82877
82945
  return true;
82878
82946
  }
82879
82947
  calculateResolvedParagraphProperties(this.editor, this.node, this.editor.state.doc.resolve(this.getPos()));
82880
82948
  __privateMethod$1(this, _ParagraphNodeView_instances, updateHTMLAttributes_fn).call(this);
82881
- __privateMethod$1(this, _ParagraphNodeView_instances, updateDOMStyles_fn).call(this);
82949
+ __privateMethod$1(this, _ParagraphNodeView_instances, updateDOMStyles_fn).call(this, oldProps);
82882
82950
  if (!__privateMethod$1(this, _ParagraphNodeView_instances, checkIsList_fn).call(this)) {
82883
82951
  __privateMethod$1(this, _ParagraphNodeView_instances, removeList_fn).call(this);
82884
82952
  return true;
@@ -82921,9 +82989,16 @@ ${l}
82921
82989
  }
82922
82990
  destroy() {
82923
82991
  __privateMethod$1(this, _ParagraphNodeView_instances, cancelScheduledAnimation_fn).call(this);
82992
+ if (nodeViewMap.get(this.node) === this) {
82993
+ nodeViewMap.delete(this.node);
82994
+ }
82924
82995
  }
82925
82996
  }
82926
82997
  _ParagraphNodeView_instances = /* @__PURE__ */ new WeakSet();
82998
+ checkShouldUpdate_fn = function(oldProps, oldAttrs, oldSurroundingContext) {
82999
+ __privateMethod$1(this, _ParagraphNodeView_instances, resolveNeighborParagraphProperties_fn).call(this);
83000
+ return JSON.stringify(oldAttrs) !== JSON.stringify(this.node.attrs) || JSON.stringify(oldProps) !== JSON.stringify(getResolvedParagraphProperties(this.node)) || JSON.stringify(oldSurroundingContext) !== JSON.stringify(this.surroundingContext);
83001
+ };
82927
83002
  updateHTMLAttributes_fn = function() {
82928
83003
  const htmlAttributes = Attribute.getAttributesToRender(this.node, this.extensionAttrs);
82929
83004
  htmlAttributes.style = htmlAttributes.style || "";
@@ -82951,13 +83026,62 @@ ${l}
82951
83026
  this.dom.setAttribute("styleid", paragraphProperties.styleId);
82952
83027
  }
82953
83028
  };
82954
- updateDOMStyles_fn = function() {
83029
+ updateDOMStyles_fn = function(oldParagraphProperties = null) {
82955
83030
  this.dom.style.cssText = "";
82956
83031
  const paragraphProperties = getResolvedParagraphProperties(this.node);
82957
- const style2 = encodeCSSFromPPr(paragraphProperties);
83032
+ __privateMethod$1(this, _ParagraphNodeView_instances, resolveNeighborParagraphProperties_fn).call(this);
83033
+ const style2 = encodeCSSFromPPr(
83034
+ paragraphProperties,
83035
+ this.surroundingContext.hasPreviousParagraph,
83036
+ this.surroundingContext.nextParagraphProps
83037
+ );
82958
83038
  Object.entries(style2).forEach(([k2, v2]) => {
82959
83039
  this.dom.style[k2] = v2;
82960
83040
  });
83041
+ if (JSON.stringify(paragraphProperties.spacing) !== JSON.stringify(oldParagraphProperties?.spacing) || paragraphProperties.styleId !== oldParagraphProperties?.styleId || paragraphProperties.contextualSpacing !== oldParagraphProperties?.contextualSpacing) {
83042
+ const previousNodeView = this.surroundingContext.previousParagraph ? nodeViewMap.get(this.surroundingContext.previousParagraph) : null;
83043
+ if (previousNodeView) {
83044
+ try {
83045
+ previousNodeView.getPos();
83046
+ } catch {
83047
+ return;
83048
+ }
83049
+ previousNodeView.update(
83050
+ previousNodeView.node,
83051
+ previousNodeView.decorations,
83052
+ previousNodeView.innerDecorations,
83053
+ true
83054
+ );
83055
+ }
83056
+ }
83057
+ };
83058
+ resolveNeighborParagraphProperties_fn = function() {
83059
+ const $pos = this.editor.state.doc.resolve(this.getPos());
83060
+ const parent = $pos.parent;
83061
+ const index2 = $pos.index();
83062
+ let hasPreviousParagraph = false;
83063
+ let previousParagraph = null;
83064
+ let nextParagraphProps = null;
83065
+ if (index2 > 0) {
83066
+ const previousNode = parent.child(index2 - 1);
83067
+ hasPreviousParagraph = previousNode.type.name === "paragraph" && !getResolvedParagraphProperties(previousNode)?.framePr?.dropCap;
83068
+ if (hasPreviousParagraph) {
83069
+ previousParagraph = previousNode;
83070
+ }
83071
+ }
83072
+ if (parent) {
83073
+ if (index2 < parent.childCount - 1) {
83074
+ const nextNode = parent.child(index2 + 1);
83075
+ if (nextNode.type.name === "paragraph") {
83076
+ nextParagraphProps = getResolvedParagraphProperties(nextNode);
83077
+ }
83078
+ }
83079
+ }
83080
+ this.surroundingContext = {
83081
+ hasPreviousParagraph,
83082
+ previousParagraph,
83083
+ nextParagraphProps
83084
+ };
82961
83085
  };
82962
83086
  updateListStyles_fn = function() {
82963
83087
  let { suffix: suffix2, justification } = this.node.attrs.listRendering;
@@ -83734,6 +83858,19 @@ ${l}
83734
83858
  return [CommentMarkName, Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
83735
83859
  }
83736
83860
  });
83861
+ let cache$2 = /* @__PURE__ */ new WeakMap();
83862
+ function getParagraphContext(paragraph2, startPos, helpers2, revision, compute) {
83863
+ const cached = cache$2.get(paragraph2);
83864
+ if (cached && cached.revision === revision) {
83865
+ return cached.context;
83866
+ }
83867
+ const context = compute(paragraph2, startPos, helpers2);
83868
+ cache$2.set(paragraph2, { revision, context });
83869
+ return context;
83870
+ }
83871
+ function clearAllParagraphContexts() {
83872
+ cache$2 = /* @__PURE__ */ new WeakMap();
83873
+ }
83737
83874
  const leaderStyles = {
83738
83875
  dot: "border-bottom: 1px dotted black;",
83739
83876
  heavy: "border-bottom: 2px solid black;",
@@ -83750,6 +83887,14 @@ ${l}
83750
83887
  if (!paragraphContext) return null;
83751
83888
  const paragraphId = paragraphIdFromPos(paragraphContext.startPos);
83752
83889
  const paragraphNode = paragraphContext.paragraph;
83890
+ const cachedContext = getParagraphContext(
83891
+ paragraphNode,
83892
+ paragraphContext.startPos,
83893
+ helpers2,
83894
+ revision,
83895
+ () => extractParagraphContext(paragraphNode, paragraphContext.startPos, helpers2, paragraphContext.paragraphDepth)
83896
+ );
83897
+ const effectiveContext = cachedContext || paragraphContext;
83753
83898
  const { entries } = flattenParagraph(paragraphNode, paragraphContext.startPos);
83754
83899
  const spans = [];
83755
83900
  let tabIndex = 0;
@@ -83777,13 +83922,13 @@ ${l}
83777
83922
  });
83778
83923
  }
83779
83924
  });
83780
- const tabStops = Array.isArray(paragraphContext.tabStops) ? [...paragraphContext.tabStops] : [];
83781
- const hangingPx = twipsToPixels(Number(paragraphContext.indent?.hanging) || 0);
83782
- if (hangingPx > 0 && paragraphContext.indentWidth != null) {
83783
- tabStops.unshift({ val: "start", pos: paragraphContext.indentWidth + hangingPx, leader: "none" });
83925
+ const tabStops = Array.isArray(effectiveContext.tabStops) ? [...effectiveContext.tabStops] : [];
83926
+ const hangingPx = twipsToPixels(Number(effectiveContext.indent?.hanging) || 0);
83927
+ if (hangingPx > 0 && effectiveContext.indentWidth != null) {
83928
+ tabStops.unshift({ val: "start", pos: effectiveContext.indentWidth + hangingPx, leader: "none" });
83784
83929
  }
83785
- const paragraphWidth = getBlockNodeWidth(view, paragraphContext.startPos) ?? defaultLineLength;
83786
- const indentWidth = paragraphContext.indentWidth ?? getIndentWidth(view, paragraphContext.startPos, paragraphContext.indent);
83930
+ const paragraphWidth = getBlockNodeWidth(view, effectiveContext.startPos) ?? defaultLineLength;
83931
+ const indentWidth = effectiveContext.indentWidth ?? getIndentWidth(view, effectiveContext.startPos, effectiveContext.indent);
83787
83932
  return {
83788
83933
  paragraphId,
83789
83934
  revision,
@@ -83791,9 +83936,9 @@ ${l}
83791
83936
  defaultTabDistance,
83792
83937
  defaultLineLength,
83793
83938
  indents: {
83794
- left: twipsToPixels(Number(paragraphContext.indent?.left) || 0),
83795
- right: twipsToPixels(Number(paragraphContext.indent?.right) || 0),
83796
- firstLine: twipsToPixels(Number(paragraphContext.indent?.firstLine) || 0),
83939
+ left: twipsToPixels(Number(effectiveContext.indent?.left) || 0),
83940
+ right: twipsToPixels(Number(effectiveContext.indent?.right) || 0),
83941
+ firstLine: twipsToPixels(Number(effectiveContext.indent?.firstLine) || 0),
83797
83942
  hanging: hangingPx
83798
83943
  },
83799
83944
  tabStops,
@@ -83958,31 +84103,58 @@ ${l}
83958
84103
  key: new PluginKey("tabPlugin"),
83959
84104
  state: {
83960
84105
  init() {
83961
- return { decorations: false, revision: 0 };
84106
+ const initialDecorations = buildInitialDecorations(view.state.doc, view, helpers2, 0);
84107
+ return { decorations: initialDecorations, revision: 0 };
83962
84108
  },
83963
84109
  apply(tr, { decorations, revision }, _oldState, newState) {
83964
- if (!decorations) {
83965
- const newDecorations2 = buildDecorations(newState.doc, view, helpers2, 0);
83966
- return { decorations: newDecorations2, revision: 0 };
83967
- }
84110
+ const currentDecorations = decorations && decorations.map ? decorations.map(tr.mapping, tr.doc) : DecorationSet.empty;
83968
84111
  if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate")) {
83969
- return { decorations, revision };
83970
- }
83971
- const nextRevision = revision + 1;
83972
- const newDecorations = buildDecorations(newState.doc, view, helpers2, nextRevision);
83973
- return { decorations: newDecorations, revision: nextRevision };
84112
+ return { decorations: currentDecorations, revision };
84113
+ }
84114
+ const affectedParagraphs = getAffectedParagraphStarts(tr, newState);
84115
+ if (affectedParagraphs.size === 0) {
84116
+ return { decorations: currentDecorations, revision };
84117
+ }
84118
+ let nextDecorations = currentDecorations;
84119
+ affectedParagraphs.forEach((pos) => {
84120
+ const paragraph2 = newState.doc.nodeAt(pos);
84121
+ if (!paragraph2 || paragraph2.type.name !== "paragraph") return;
84122
+ const from2 = pos;
84123
+ const to = pos + paragraph2.nodeSize;
84124
+ const existing = nextDecorations.find(from2, to);
84125
+ if (existing?.length) {
84126
+ nextDecorations = nextDecorations.remove(existing);
84127
+ }
84128
+ const paragraphDecorations = buildParagraphDecorations(
84129
+ newState.doc,
84130
+ pos + 1,
84131
+ paragraph2,
84132
+ view,
84133
+ helpers2,
84134
+ revision + 1
84135
+ );
84136
+ nextDecorations = nextDecorations.add(newState.doc, paragraphDecorations);
84137
+ });
84138
+ return { decorations: nextDecorations, revision: revision + 1 };
83974
84139
  }
83975
84140
  },
83976
84141
  props: {
83977
84142
  decorations(state2) {
83978
84143
  return this.getState(state2).decorations;
83979
84144
  }
84145
+ },
84146
+ view() {
84147
+ return {
84148
+ destroy() {
84149
+ clearAllParagraphContexts();
84150
+ }
84151
+ };
83980
84152
  }
83981
84153
  });
83982
84154
  return [tabPlugin];
83983
84155
  }
83984
84156
  });
83985
- function buildDecorations(doc2, view, helpers2, revision) {
84157
+ function buildInitialDecorations(doc2, view, helpers2, revision) {
83986
84158
  const decorations = [];
83987
84159
  doc2.descendants((node2, pos) => {
83988
84160
  if (node2.type.name !== "paragraph") return;
@@ -84003,6 +84175,37 @@ ${l}
84003
84175
  });
84004
84176
  return DecorationSet.create(doc2, decorations);
84005
84177
  }
84178
+ function buildParagraphDecorations(doc2, paragraphContentPos, paragraphNode, view, helpers2, revision) {
84179
+ const request = createLayoutRequest(doc2, paragraphContentPos, view, helpers2, revision);
84180
+ if (!request) return [];
84181
+ const result = calculateTabLayout(request, void 0, view);
84182
+ return applyLayoutResult(result, paragraphNode, paragraphContentPos - 1);
84183
+ }
84184
+ function getAffectedParagraphStarts(tr, newState) {
84185
+ const affected = /* @__PURE__ */ new Set();
84186
+ tr.steps.forEach((step, index2) => {
84187
+ if (step.from == null && step.to == null) return;
84188
+ let fromPos = step.from;
84189
+ let toPos = step.to;
84190
+ if (typeof fromPos !== "number" || typeof toPos !== "number") return;
84191
+ for (let i2 = index2; i2 < tr.steps.length; i2++) {
84192
+ const stepMap = tr.steps[i2].getMap();
84193
+ fromPos = stepMap.map(fromPos, -1);
84194
+ toPos = stepMap.map(toPos, 1);
84195
+ }
84196
+ if (fromPos < 0 || toPos < 0 || fromPos > newState.doc.content.size || toPos > newState.doc.content.size) {
84197
+ return;
84198
+ }
84199
+ newState.doc.nodesBetween(fromPos, toPos, (node2, pos) => {
84200
+ if (node2.type.name === "paragraph") {
84201
+ affected.add(pos);
84202
+ return false;
84203
+ }
84204
+ return true;
84205
+ });
84206
+ });
84207
+ return affected;
84208
+ }
84006
84209
  const LineBreak = Node$1.create({
84007
84210
  name: "lineBreak",
84008
84211
  group: "inline",
@@ -131530,7 +131733,7 @@ ${style2}
131530
131733
  this.config.colors = shuffleArray(this.config.colors);
131531
131734
  this.userColorMap = /* @__PURE__ */ new Map();
131532
131735
  this.colorIndex = 0;
131533
- this.version = "1.0.0-beta.7";
131736
+ this.version = "1.0.0-beta.9";
131534
131737
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
131535
131738
  this.superdocId = config2.superdocId || v4();
131536
131739
  this.colors = this.config.colors;
@@ -133973,7 +134176,7 @@ ${style2}
133973
134176
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
133974
134177
  );
133975
134178
  }
133976
- const indexDV613LhK = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
134179
+ const indexBVhSHfFK = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
133977
134180
  __proto__: null,
133978
134181
  unified
133979
134182
  }, Symbol.toStringTag, { value: "Module" }));