@harbour-enterprises/superdoc 1.0.0-beta.97 → 1.0.0-beta.98

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-BHcBfUWj.es.js → PdfViewer-1_KffD-j.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-YvkZg201.cjs → PdfViewer-D1Ot32kX.cjs} +1 -1
  3. package/dist/chunks/{index-DeQfFbTb.es.js → index-CP2_WwLA.es.js} +3 -3
  4. package/dist/chunks/{index-DZ_AI-HW.cjs → index-CUO7gEi8.cjs} +3 -3
  5. package/dist/chunks/{index-Pvlqsxge-vW641SZt.es.js → index-Dg_sTYZK-D20z8mus.es.js} +1 -1
  6. package/dist/chunks/{index-Pvlqsxge-IH3eauKE.cjs → index-Dg_sTYZK-DYDzxoXL.cjs} +1 -1
  7. package/dist/chunks/{super-editor.es-BinyZw4F.es.js → super-editor.es-3dJOUw65.es.js} +113 -151
  8. package/dist/chunks/{super-editor.es-BP3PKkwh.cjs → super-editor.es-DN_dgBH0.cjs} +113 -151
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-BEVM5t3i.js → converter-Oj-eTB79.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-vETk3IMG.js → docx-zipper-Dl188zQ3.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-B8k1bwD_.js → editor-DBXoaaWP.js} +114 -152
  13. package/dist/super-editor/chunks/{index-Pvlqsxge.js → index-Dg_sTYZK.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-j1GSUGWU.js → toolbar-PlGGj0Ew.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 +115 -153
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
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-BP3PKkwh.cjs");
4
- const superdoc = require("./chunks/index-DZ_AI-HW.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-DN_dgBH0.cjs");
4
+ const superdoc = require("./chunks/index-CUO7gEi8.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-BinyZw4F.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-DeQfFbTb.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-3dJOUw65.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-CP2_WwLA.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
4
  export {
5
5
  a as AnnotatorHelpers,
@@ -42422,7 +42422,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42422
42422
  static getStoredSuperdocVersion(docx) {
42423
42423
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42424
42424
  }
42425
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.97") {
42425
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.98") {
42426
42426
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42427
42427
  }
42428
42428
  /**
@@ -67497,7 +67497,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67497
67497
  const shouldSkipNodeView = (editor) => {
67498
67498
  return isHeadless(editor);
67499
67499
  };
67500
- const summaryVersion = "1.0.0-beta.97";
67500
+ const summaryVersion = "1.0.0-beta.98";
67501
67501
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67502
67502
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67503
67503
  function mapAttributes(attrs) {
@@ -68286,7 +68286,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68286
68286
  { default: remarkStringify2 },
68287
68287
  { default: remarkGfm2 }
68288
68288
  ] = await Promise.all([
68289
- Promise.resolve().then(() => indexPvlqsxge),
68289
+ Promise.resolve().then(() => indexDg_sTYZK),
68290
68290
  Promise.resolve().then(() => indexDRCvimau),
68291
68291
  Promise.resolve().then(() => indexC_x_N6Uh),
68292
68292
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68491,7 +68491,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68491
68491
  * Process collaboration migrations
68492
68492
  */
68493
68493
  processCollaborationMigrations() {
68494
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.97");
68494
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.98");
68495
68495
  if (!this.options.ydoc) return;
68496
68496
  const metaMap = this.options.ydoc.getMap("meta");
68497
68497
  let docVersion = metaMap.get("version");
@@ -70869,14 +70869,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70869
70869
  return { pageSizePx, orientation };
70870
70870
  }
70871
70871
  function extractFallbackMargins(elements, currentHeader, currentFooter) {
70872
- if (currentHeader !== void 0 && currentFooter !== void 0) {
70873
- return { headerPx: currentHeader, footerPx: currentFooter };
70874
- }
70875
70872
  const pgMar = elements.find((el) => el?.name === "w:pgMar");
70876
70873
  const a2 = pgMar?.attributes || {};
70877
70874
  return {
70878
70875
  headerPx: currentHeader ?? (a2["w:header"] != null ? twipsToPixels$1(a2["w:header"]) : void 0),
70879
- footerPx: currentFooter ?? (a2["w:footer"] != null ? twipsToPixels$1(a2["w:footer"]) : void 0)
70876
+ footerPx: currentFooter ?? (a2["w:footer"] != null ? twipsToPixels$1(a2["w:footer"]) : void 0),
70877
+ topPx: a2["w:top"] != null ? twipsToPixels$1(a2["w:top"]) : void 0,
70878
+ rightPx: a2["w:right"] != null ? twipsToPixels$1(a2["w:right"]) : void 0,
70879
+ bottomPx: a2["w:bottom"] != null ? twipsToPixels$1(a2["w:bottom"]) : void 0,
70880
+ leftPx: a2["w:left"] != null ? twipsToPixels$1(a2["w:left"]) : void 0
70880
70881
  };
70881
70882
  }
70882
70883
  function extractHeaderFooterRefs(elements, refName) {
@@ -70937,7 +70938,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70937
70938
  const type2 = extractSectionType(sectPrElements);
70938
70939
  const { pageSizePx, orientation } = extractPageSizeAndOrientation(sectPrElements);
70939
70940
  const titlePg = sectPrElements.some((el) => el?.name === "w:titlePg");
70940
- ({ headerPx, footerPx } = extractFallbackMargins(sectPrElements, headerPx, footerPx));
70941
+ const fallbackMargins = extractFallbackMargins(sectPrElements, headerPx, footerPx);
70942
+ headerPx = fallbackMargins.headerPx;
70943
+ footerPx = fallbackMargins.footerPx;
70944
+ const { topPx, rightPx, bottomPx, leftPx } = fallbackMargins;
70941
70945
  const headerRefs = extractHeaderFooterRefs(sectPrElements, "w:headerReference");
70942
70946
  const footerRefs = extractHeaderFooterRefs(sectPrElements, "w:footerReference");
70943
70947
  const numbering = extractPageNumbering(sectPrElements);
@@ -70946,6 +70950,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70946
70950
  return {
70947
70951
  headerPx,
70948
70952
  footerPx,
70953
+ topPx,
70954
+ rightPx,
70955
+ bottomPx,
70956
+ leftPx,
70949
70957
  type: type2,
70950
70958
  pageSizePx,
70951
70959
  orientation,
@@ -71057,7 +71065,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71057
71065
  startParagraphIndex: currentStart,
71058
71066
  endParagraphIndex: item.index,
71059
71067
  sectPr,
71060
- margins: sectionData.headerPx != null || sectionData.footerPx != null ? { header: sectionData.headerPx ?? 0, footer: sectionData.footerPx ?? 0 } : null,
71068
+ margins: sectionData.headerPx != null || sectionData.footerPx != null ? {
71069
+ header: sectionData.headerPx ?? 0,
71070
+ footer: sectionData.footerPx ?? 0,
71071
+ top: sectionData.topPx,
71072
+ right: sectionData.rightPx,
71073
+ bottom: sectionData.bottomPx,
71074
+ left: sectionData.leftPx
71075
+ } : null,
71061
71076
  pageSize: sectionData.pageSizePx ?? null,
71062
71077
  orientation: sectionData.orientation ?? null,
71063
71078
  columns: sectionData.columnsPx ?? null,
@@ -71099,7 +71114,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71099
71114
  startParagraphIndex: currentStart,
71100
71115
  endParagraphIndex: totalParagraphs - 1,
71101
71116
  sectPr: bodySectPr,
71102
- margins: bodySectionData.headerPx != null || bodySectionData.footerPx != null ? { header: bodySectionData.headerPx ?? 0, footer: bodySectionData.footerPx ?? 0 } : null,
71117
+ margins: bodySectionData.headerPx != null || bodySectionData.footerPx != null ? {
71118
+ header: bodySectionData.headerPx ?? 0,
71119
+ footer: bodySectionData.footerPx ?? 0,
71120
+ top: bodySectionData.topPx,
71121
+ right: bodySectionData.rightPx,
71122
+ bottom: bodySectionData.bottomPx,
71123
+ left: bodySectionData.leftPx
71124
+ } : null,
71103
71125
  pageSize: bodySectionData.pageSizePx ?? null,
71104
71126
  orientation: bodySectionData.orientation ?? null,
71105
71127
  columns: bodySectionData.columnsPx ?? null,
@@ -77378,41 +77400,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77378
77400
  }
77379
77401
  }
77380
77402
  }
77381
- try {
77382
- const blockSummaries = blocks2.map((b2) => {
77383
- if (b2.kind === "paragraph") {
77384
- const runs2 = b2.runs ?? [];
77385
- const attrs = b2.attrs ?? {};
77386
- return {
77387
- kind: "paragraph",
77388
- runKinds: runs2.map((r2) => r2.kind ?? "text"),
77389
- runCount: runs2.length,
77390
- runPreview: runs2.map((r2) => {
77391
- const kind = r2.kind ?? "text";
77392
- if (kind === "image") {
77393
- const img2 = r2;
77394
- return { kind, src: img2.src, width: img2.width, height: img2.height };
77395
- }
77396
- return { kind };
77397
- }),
77398
- hasNumbering: Boolean(attrs.numberingProperties),
77399
- markerText: attrs.wordLayout?.marker?.markerText
77400
- };
77401
- }
77402
- return { kind: b2.kind };
77403
- });
77404
- console.log(
77405
- "[tableNodeToBlock.parseTableCell] cell contents",
77406
- JSON.stringify({
77407
- cellIndex,
77408
- rowIndex,
77409
- cellIdPreview: `cell-${rowIndex}-${cellIndex}`,
77410
- childTypes: cellNode.content.map((c2) => c2?.type),
77411
- blocks: blockSummaries
77412
- })
77413
- );
77414
- } catch {
77415
- }
77416
77403
  if (blocks2.length === 0) {
77417
77404
  return null;
77418
77405
  }
@@ -81277,20 +81264,6 @@ ${l}
81277
81264
  }
81278
81265
  const cellBlocks = cell2?.blocks ?? (cell2?.paragraph ? [cell2.paragraph] : []);
81279
81266
  const blockMeasures = cellMeasure?.blocks ?? (cellMeasure?.paragraph ? [cellMeasure.paragraph] : []);
81280
- try {
81281
- console.log(
81282
- "[DomPainter.renderTableCell] cell render input",
81283
- JSON.stringify({
81284
- cellId: cell2?.id,
81285
- blockKinds: cellBlocks.map((b2) => b2.kind),
81286
- measureKinds: blockMeasures.map((m2) => m2.kind),
81287
- width: cellMeasure?.width,
81288
- height: cellMeasure?.height,
81289
- rowHeight
81290
- })
81291
- );
81292
- } catch {
81293
- }
81294
81267
  if (cellBlocks.length > 0 && blockMeasures.length > 0) {
81295
81268
  const content2 = doc2.createElement("div");
81296
81269
  content2.style.position = "relative";
@@ -81323,15 +81296,6 @@ ${l}
81323
81296
  const blockMeasure = blockMeasures[i2];
81324
81297
  const block = cellBlocks[i2];
81325
81298
  if (blockMeasure.kind === "image" && block?.kind === "image") {
81326
- console.log(
81327
- "[DomPainter.renderTableCell] rendering image block in cell",
81328
- JSON.stringify({
81329
- cellId: cell2?.id,
81330
- blockId: block.id,
81331
- width: blockMeasure.width,
81332
- height: blockMeasure.height
81333
- })
81334
- );
81335
81299
  const imageWrapper = doc2.createElement("div");
81336
81300
  imageWrapper.style.position = "relative";
81337
81301
  imageWrapper.style.width = `${blockMeasure.width}px`;
@@ -81354,16 +81318,6 @@ ${l}
81354
81318
  continue;
81355
81319
  }
81356
81320
  if (blockMeasure.kind === "drawing" && block?.kind === "drawing") {
81357
- console.log(
81358
- "[DomPainter.renderTableCell] rendering drawing block in cell",
81359
- JSON.stringify({
81360
- cellId: cell2?.id,
81361
- blockId: block.id,
81362
- drawingKind: block.drawingKind,
81363
- width: blockMeasure.width,
81364
- height: blockMeasure.height
81365
- })
81366
- );
81367
81321
  const drawingWrapper = doc2.createElement("div");
81368
81322
  drawingWrapper.style.position = "relative";
81369
81323
  drawingWrapper.style.width = `${blockMeasure.width}px`;
@@ -81406,20 +81360,6 @@ ${l}
81406
81360
  continue;
81407
81361
  }
81408
81362
  if (blockMeasure.kind === "paragraph" && block?.kind === "paragraph") {
81409
- try {
81410
- const runKinds = (block.runs ?? []).map((r2) => r2.kind ?? "text");
81411
- const imageRuns = (block.runs ?? []).filter((r2) => r2.kind === "image").map((r2) => ({ src: r2.src }));
81412
- console.log(
81413
- "[DomPainter.renderTableCell] rendering paragraph block in cell",
81414
- JSON.stringify({
81415
- cellId: cell2?.id,
81416
- blockId: block.id,
81417
- runKinds,
81418
- imageRuns
81419
- })
81420
- );
81421
- } catch {
81422
- }
81423
81363
  const paragraphMeasure = blockMeasure;
81424
81364
  const lines = paragraphMeasure.lines;
81425
81365
  const blockLineCount = lines?.length || 0;
@@ -83234,7 +83174,9 @@ ${l}
83234
83174
  const isTocEntry = block.attrs?.isTocEntry;
83235
83175
  const hasMarker = !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
83236
83176
  const hasSdtContainer = block.attrs?.sdt?.type === "documentSection" || block.attrs?.sdt?.type === "structuredContent" || block.attrs?.containerSdt?.type === "documentSection" || block.attrs?.containerSdt?.type === "structuredContent";
83237
- const styles = isTocEntry ? { ...fragmentStyles, whiteSpace: "nowrap" } : hasMarker || hasSdtContainer ? { ...fragmentStyles, overflow: "visible" } : fragmentStyles;
83177
+ const paraIndentForOverflow = block.attrs?.indent;
83178
+ const hasNegativeIndent = (paraIndentForOverflow?.left ?? 0) < 0 || (paraIndentForOverflow?.right ?? 0) < 0;
83179
+ const styles = isTocEntry ? { ...fragmentStyles, whiteSpace: "nowrap" } : hasMarker || hasSdtContainer || hasNegativeIndent ? { ...fragmentStyles, overflow: "visible" } : fragmentStyles;
83238
83180
  applyStyles$2(fragmentEl, styles);
83239
83181
  this.applyFragmentFrame(fragmentEl, fragment, context.section);
83240
83182
  if (isTocEntry) {
@@ -83263,6 +83205,8 @@ ${l}
83263
83205
  }
83264
83206
  if (fragmentEl.style.paddingLeft) fragmentEl.style.removeProperty("padding-left");
83265
83207
  if (fragmentEl.style.paddingRight) fragmentEl.style.removeProperty("padding-right");
83208
+ if (fragmentEl.style.marginLeft) fragmentEl.style.removeProperty("margin-left");
83209
+ if (fragmentEl.style.marginRight) fragmentEl.style.removeProperty("margin-right");
83266
83210
  if (fragmentEl.style.textIndent) fragmentEl.style.removeProperty("text-indent");
83267
83211
  const paraIndent = block.attrs?.indent;
83268
83212
  const paraIndentLeft = paraIndent?.left ?? 0;
@@ -83291,16 +83235,22 @@ ${l}
83291
83235
  if (!isListFirstLine) {
83292
83236
  if (hasExplicitSegmentPositioning) {
83293
83237
  if (isFirstLine && firstLineOffset !== 0) {
83294
- const adjustedPadding = paraIndentLeft + firstLineOffset;
83295
- lineEl.style.paddingLeft = `${adjustedPadding}px`;
83238
+ const effectiveLeftIndent = paraIndentLeft < 0 ? 0 : paraIndentLeft;
83239
+ const adjustedPadding = effectiveLeftIndent + firstLineOffset;
83240
+ if (adjustedPadding > 0) {
83241
+ lineEl.style.paddingLeft = `${adjustedPadding}px`;
83242
+ }
83296
83243
  }
83297
- } else if (paraIndentLeft) {
83244
+ } else if (paraIndentLeft && paraIndentLeft > 0) {
83298
83245
  lineEl.style.paddingLeft = `${paraIndentLeft}px`;
83246
+ } else if (!isFirstLine && paraIndent?.hanging && paraIndent.hanging > 0) {
83247
+ lineEl.style.paddingLeft = `${paraIndent.hanging}px`;
83299
83248
  }
83300
83249
  }
83301
- if (paraIndentRight) {
83250
+ if (paraIndentRight && paraIndentRight > 0) {
83302
83251
  lineEl.style.paddingRight = `${paraIndentRight}px`;
83303
83252
  }
83253
+ const hasNegativeLeftIndent = paraIndentLeft != null && paraIndentLeft < 0;
83304
83254
  if (!fragment.continuesFromPrev && index2 === 0 && firstLineOffset && !isListFirstLine) {
83305
83255
  if (!hasExplicitSegmentPositioning) {
83306
83256
  lineEl.style.textIndent = `${firstLineOffset}px`;
@@ -85585,15 +85535,18 @@ ${l}
85585
85535
  }
85586
85536
  const indent2 = attrs.indent;
85587
85537
  if (indent2) {
85588
- if (indent2.left) {
85538
+ if (indent2.left && indent2.left > 0) {
85589
85539
  element2.style.paddingLeft = `${indent2.left}px`;
85590
85540
  }
85591
- if (indent2.right) {
85541
+ if (indent2.right && indent2.right > 0) {
85592
85542
  element2.style.paddingRight = `${indent2.right}px`;
85593
85543
  }
85594
- const textIndent = (indent2.firstLine ?? 0) - (indent2.hanging ?? 0);
85595
- if (textIndent) {
85596
- element2.style.textIndent = `${textIndent}px`;
85544
+ const hasNegativeLeftIndent = indent2.left != null && indent2.left < 0;
85545
+ if (!hasNegativeLeftIndent) {
85546
+ const textIndent = (indent2.firstLine ?? 0) - (indent2.hanging ?? 0);
85547
+ if (textIndent) {
85548
+ element2.style.textIndent = `${textIndent}px`;
85549
+ }
85597
85550
  }
85598
85551
  }
85599
85552
  applyParagraphBorderStyles(element2, attrs.borders);
@@ -86955,20 +86908,6 @@ ${l}
86955
86908
  }
86956
86909
  return value;
86957
86910
  };
86958
- function calculateFirstLineIndent(block, measure) {
86959
- const wordLayout = block.attrs?.wordLayout;
86960
- if (!wordLayout?.firstLineIndentMode) {
86961
- return 0;
86962
- }
86963
- if (!wordLayout.marker || !measure.marker) {
86964
- return 0;
86965
- }
86966
- const markerWidthRaw = measure.marker.markerWidth ?? wordLayout.marker.markerBoxWidthPx ?? 0;
86967
- const markerWidth = Number.isFinite(markerWidthRaw) && markerWidthRaw >= 0 ? markerWidthRaw : 0;
86968
- const gutterWidthRaw = measure.marker.gutterWidth ?? 0;
86969
- const gutterWidth = Number.isFinite(gutterWidthRaw) && gutterWidthRaw >= 0 ? gutterWidthRaw : 0;
86970
- return markerWidth + gutterWidth;
86971
- }
86972
86911
  function layoutParagraphBlock(ctx2, anchors) {
86973
86912
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx2;
86974
86913
  const remeasureParagraph2 = ctx2.remeasureParagraph;
@@ -87090,10 +87029,25 @@ ${l}
87090
87029
  }
87091
87030
  let lines = normalizeLines(measure);
87092
87031
  const measurementWidth = lines[0]?.maxWidth;
87032
+ const paraIndent = block.attrs?.indent;
87033
+ const indentLeft = typeof paraIndent?.left === "number" && Number.isFinite(paraIndent.left) ? paraIndent.left : 0;
87034
+ const indentRight = typeof paraIndent?.right === "number" && Number.isFinite(paraIndent.right) ? paraIndent.right : 0;
87035
+ const negativeLeftIndent = indentLeft < 0 ? indentLeft : 0;
87036
+ const negativeRightIndent = indentRight < 0 ? indentRight : 0;
87037
+ const remeasureWidth = Math.max(1, columnWidth - indentLeft - indentRight);
87093
87038
  let didRemeasureForColumnWidth = false;
87094
- if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > columnWidth) {
87095
- const firstLineIndent = calculateFirstLineIndent(block, measure);
87096
- const newMeasure = remeasureParagraph2(block, columnWidth, firstLineIndent);
87039
+ if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > remeasureWidth) {
87040
+ let firstLineIndent = 0;
87041
+ const wordLayout = block.attrs?.wordLayout;
87042
+ if (wordLayout?.marker && measure.marker) {
87043
+ const markerJustification = wordLayout.marker.justification ?? "left";
87044
+ if (markerJustification === "left") {
87045
+ const markerWidth = measure.marker.markerWidth ?? 0;
87046
+ const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
87047
+ firstLineIndent = markerWidth + gutterWidth;
87048
+ }
87049
+ }
87050
+ const newMeasure = remeasureParagraph2(block, remeasureWidth, firstLineIndent);
87097
87051
  lines = normalizeLines(newMeasure);
87098
87052
  didRemeasureForColumnWidth = true;
87099
87053
  }
@@ -87172,9 +87126,19 @@ ${l}
87172
87126
  }
87173
87127
  tempY += lineHeight2;
87174
87128
  }
87175
- if (narrowestWidth < columnWidth) {
87176
- const firstLineIndent = calculateFirstLineIndent(block, measure);
87177
- const newMeasure = remeasureParagraph2(block, narrowestWidth, firstLineIndent);
87129
+ const narrowestRemeasureWidth = Math.max(1, narrowestWidth - indentLeft - indentRight);
87130
+ if (narrowestRemeasureWidth < remeasureWidth) {
87131
+ let firstLineIndent = 0;
87132
+ const wordLayout = block.attrs?.wordLayout;
87133
+ if (wordLayout?.marker && measure.marker) {
87134
+ const markerJustification = wordLayout.marker.justification ?? "left";
87135
+ if (markerJustification === "left") {
87136
+ const markerWidth = measure.marker.markerWidth ?? 0;
87137
+ const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
87138
+ firstLineIndent = markerWidth + gutterWidth;
87139
+ }
87140
+ }
87141
+ const newMeasure = remeasureParagraph2(block, narrowestRemeasureWidth, firstLineIndent);
87178
87142
  lines = normalizeLines(newMeasure);
87179
87143
  didRemeasureForFloats = true;
87180
87144
  }
@@ -87228,14 +87192,16 @@ ${l}
87228
87192
  }
87229
87193
  const slice2 = sliceLines(lines, fromLine, state2.contentBottom - state2.cursorY);
87230
87194
  const fragmentHeight = slice2.height;
87195
+ const adjustedX = columnX(state2.columnIndex) + offsetX + negativeLeftIndent;
87196
+ const adjustedWidth = effectiveColumnWidth - negativeLeftIndent - negativeRightIndent;
87231
87197
  const fragment = {
87232
87198
  kind: "para",
87233
87199
  blockId: block.id,
87234
87200
  fromLine,
87235
87201
  toLine: slice2.toLine,
87236
- x: columnX(state2.columnIndex) + offsetX,
87202
+ x: adjustedX,
87237
87203
  y: state2.cursorY,
87238
- width: effectiveColumnWidth,
87204
+ width: adjustedWidth,
87239
87205
  ...computeFragmentPmRange(block, lines, fromLine, slice2.toLine)
87240
87206
  };
87241
87207
  if (didRemeasureForColumnWidth) {
@@ -90943,9 +90909,15 @@ ${l}
90943
90909
  }
90944
90910
  const DEFAULT_PAGE_SIZE$1 = { w: 612, h: 792 };
90945
90911
  const DEFAULT_MARGINS$1 = { top: 72, right: 72, bottom: 72, left: 72 };
90912
+ const normalizeMargin = (value, fallback) => Number.isFinite(value) ? value : fallback;
90946
90913
  function resolveMeasurementConstraints(options) {
90947
90914
  const pageSize = options.pageSize ?? DEFAULT_PAGE_SIZE$1;
90948
- const margins = options.margins ?? DEFAULT_MARGINS$1;
90915
+ const margins = {
90916
+ top: normalizeMargin(options.margins?.top, DEFAULT_MARGINS$1.top),
90917
+ right: normalizeMargin(options.margins?.right, DEFAULT_MARGINS$1.right),
90918
+ bottom: normalizeMargin(options.margins?.bottom, DEFAULT_MARGINS$1.bottom),
90919
+ left: normalizeMargin(options.margins?.left, DEFAULT_MARGINS$1.left)
90920
+ };
90949
90921
  const contentWidth = pageSize.w - (margins.left + margins.right);
90950
90922
  const contentHeight = pageSize.h - (margins.top + margins.bottom);
90951
90923
  const columns = options.columns;
@@ -92483,8 +92455,8 @@ ${l}
92483
92455
  const lines = [];
92484
92456
  const indent2 = block.attrs?.indent;
92485
92457
  const spacing = block.attrs?.spacing;
92486
- const indentLeft = sanitizePositive(indent2?.left);
92487
- const indentRight = sanitizePositive(indent2?.right);
92458
+ const indentLeft = sanitizeIndent(indent2?.left);
92459
+ const indentRight = sanitizeIndent(indent2?.right);
92488
92460
  const firstLine = indent2?.firstLine ?? 0;
92489
92461
  const hanging = indent2?.hanging ?? 0;
92490
92462
  const isWordLayoutList = Boolean(wordLayout?.marker);
@@ -92493,10 +92465,10 @@ ${l}
92493
92465
  const clampedFirstLineOffset = Math.max(0, rawFirstLineOffset);
92494
92466
  const firstLineOffset = isWordLayoutList ? 0 : clampedFirstLineOffset;
92495
92467
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
92468
+ const bodyContentWidth = contentWidth;
92496
92469
  let initialAvailableWidth;
92497
92470
  const textStartPx = wordLayout?.textStartPx;
92498
- const treatAsHanging = isWordLayoutList && indentLeft === 0 && hanging === 0 && typeof textStartPx === "number";
92499
- if (typeof textStartPx === "number" && textStartPx > indentLeft && !treatAsHanging) {
92471
+ if (typeof textStartPx === "number" && textStartPx > indentLeft) {
92500
92472
  initialAvailableWidth = Math.max(1, maxWidth - textStartPx - indentRight);
92501
92473
  } else {
92502
92474
  initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
@@ -92543,21 +92515,6 @@ ${l}
92543
92515
  totalHeight: metrics.lineHeight
92544
92516
  };
92545
92517
  }
92546
- const isListLike = Boolean(block.attrs?.numId || wordLayout?.marker);
92547
- if (isListLike) {
92548
- console.log(
92549
- "[measureParagraph][list]",
92550
- JSON.stringify({
92551
- blockId: block.id,
92552
- maxWidth,
92553
- indentLeft,
92554
- indentRight,
92555
- textStartPx: textStartPx ?? null,
92556
- firstLineOffset: firstLineOffset ?? null,
92557
- initialAvailableWidth
92558
- })
92559
- );
92560
- }
92561
92518
  let currentLine = null;
92562
92519
  const getEffectiveWidth = (baseWidth) => {
92563
92520
  if (dropCapMeasure && lines.length < dropCapMeasure.lines && dropCapMeasure.mode === "drop") {
@@ -92703,7 +92660,7 @@ ${l}
92703
92660
  lines.push(emptyLine);
92704
92661
  }
92705
92662
  const hadPreviousLine = lines.length > 0;
92706
- const nextLineMaxWidth = hadPreviousLine ? getEffectiveWidth(contentWidth) : getEffectiveWidth(initialAvailableWidth);
92663
+ const nextLineMaxWidth = hadPreviousLine ? getEffectiveWidth(bodyContentWidth) : getEffectiveWidth(initialAvailableWidth);
92707
92664
  currentLine = {
92708
92665
  fromRun: runIndex,
92709
92666
  fromChar: 0,
@@ -92814,7 +92771,7 @@ ${l}
92814
92771
  toChar: 1,
92815
92772
  width: imageWidth,
92816
92773
  maxFontSize: imageHeight,
92817
- maxWidth: getEffectiveWidth(contentWidth),
92774
+ maxWidth: getEffectiveWidth(bodyContentWidth),
92818
92775
  spaceCount: 0,
92819
92776
  segments: [
92820
92777
  {
@@ -92903,7 +92860,7 @@ ${l}
92903
92860
  toChar: 1,
92904
92861
  width: annotationWidth,
92905
92862
  maxFontSize: annotationHeight,
92906
- maxWidth: getEffectiveWidth(contentWidth),
92863
+ maxWidth: getEffectiveWidth(bodyContentWidth),
92907
92864
  spaceCount: 0,
92908
92865
  segments: [
92909
92866
  {
@@ -92985,7 +92942,7 @@ ${l}
92985
92942
  width: spacesWidth,
92986
92943
  maxFontSize: run2.fontSize,
92987
92944
  maxFontInfo: getFontInfoFromRun(run2),
92988
- maxWidth: getEffectiveWidth(contentWidth),
92945
+ maxWidth: getEffectiveWidth(bodyContentWidth),
92989
92946
  segments: [{ runIndex, fromChar: spacesStartChar, toChar: spacesEndChar, width: spacesWidth }],
92990
92947
  spaceCount: spacesLength
92991
92948
  };
@@ -93048,7 +93005,7 @@ ${l}
93048
93005
  width: singleSpaceWidth,
93049
93006
  maxFontSize: run2.fontSize,
93050
93007
  maxFontInfo: getFontInfoFromRun(run2),
93051
- maxWidth: getEffectiveWidth(contentWidth),
93008
+ maxWidth: getEffectiveWidth(bodyContentWidth),
93052
93009
  segments: [{ runIndex, fromChar: spaceStartChar, toChar: spaceEndChar, width: singleSpaceWidth }],
93053
93010
  spaceCount: 1
93054
93011
  };
@@ -93241,7 +93198,7 @@ ${l}
93241
93198
  width: wordOnlyWidth,
93242
93199
  maxFontSize: run2.fontSize,
93243
93200
  maxFontInfo: getFontInfoFromRun(run2),
93244
- maxWidth: getEffectiveWidth(contentWidth),
93201
+ maxWidth: getEffectiveWidth(bodyContentWidth),
93245
93202
  segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }],
93246
93203
  spaceCount: 0
93247
93204
  };
@@ -93806,6 +93763,7 @@ ${l}
93806
93763
  return Math.max(baseLineHeight, raw);
93807
93764
  };
93808
93765
  const sanitizePositive = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(0, value) : 0;
93766
+ const sanitizeIndent = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
93809
93767
  const sanitizeDecimalSeparator = (value) => {
93810
93768
  if (value === ",") return ",";
93811
93769
  return DEFAULT_DECIMAL_SEPARATOR;
@@ -98354,6 +98312,10 @@ ${l}
98354
98312
  const pageSize = firstSection?.pageSize ?? defaults2.pageSize;
98355
98313
  const margins = {
98356
98314
  ...defaults2.margins,
98315
+ ...firstSection?.margins?.top != null ? { top: firstSection.margins.top } : {},
98316
+ ...firstSection?.margins?.right != null ? { right: firstSection.margins.right } : {},
98317
+ ...firstSection?.margins?.bottom != null ? { bottom: firstSection.margins.bottom } : {},
98318
+ ...firstSection?.margins?.left != null ? { left: firstSection.margins.left } : {},
98357
98319
  ...firstSection?.margins?.header != null ? { header: firstSection.margins.header } : {},
98358
98320
  ...firstSection?.margins?.footer != null ? { footer: firstSection.margins.footer } : {}
98359
98321
  };
@@ -152103,7 +152065,7 @@ ${style2}
152103
152065
  this.config.colors = shuffleArray(this.config.colors);
152104
152066
  this.userColorMap = /* @__PURE__ */ new Map();
152105
152067
  this.colorIndex = 0;
152106
- this.version = "1.0.0-beta.97";
152068
+ this.version = "1.0.0-beta.98";
152107
152069
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
152108
152070
  this.superdocId = config2.superdocId || v4();
152109
152071
  this.colors = this.config.colors;
@@ -154575,7 +154537,7 @@ ${style2}
154575
154537
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
154576
154538
  );
154577
154539
  }
154578
- const indexPvlqsxge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154540
+ const indexDg_sTYZK = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154579
154541
  __proto__: null,
154580
154542
  unified
154581
154543
  }, Symbol.toStringTag, { value: "Module" }));