@harbour-enterprises/superdoc 1.0.0-beta.82 → 1.0.0-beta.84

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-kLZVOUbz.cjs → PdfViewer-CAaNRs-k.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-gQqtBsXT.es.js → PdfViewer-CN5I0v21.es.js} +1 -1
  3. package/dist/chunks/{index-GF5Urhpn-BNFw-VyP.cjs → index-ByDo0rez-DTbakkgE.cjs} +1 -1
  4. package/dist/chunks/{index-GF5Urhpn-LFkKkWot.es.js → index-ByDo0rez-Dddj1OPE.es.js} +1 -1
  5. package/dist/chunks/{index-cUgy4sJN.cjs → index-CXX12ADx.cjs} +3 -3
  6. package/dist/chunks/{index-CNPZHNDf.es.js → index-D6mF0NAB.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-DfLaDbHA.es.js → super-editor.es-B-ix_3cI.es.js} +469 -74
  8. package/dist/chunks/{super-editor.es-44RL9-Ca.cjs → super-editor.es-C89GPNG4.cjs} +469 -74
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-Bfu1F5pk.js → converter-CWmKgkFT.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-Cl08Z_S_.js → docx-zipper-CFgPPujz.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-CwTMBaym.js → editor-Dmk80b6P.js} +470 -75
  13. package/dist/super-editor/chunks/{index-GF5Urhpn.js → index-ByDo0rez.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-DZTp7DIF.js → toolbar-Bi5YCv48.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 +471 -76
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -42392,7 +42392,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42392
42392
  static getStoredSuperdocVersion(docx) {
42393
42393
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42394
42394
  }
42395
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.82") {
42395
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.84") {
42396
42396
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42397
42397
  }
42398
42398
  /**
@@ -67438,7 +67438,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67438
67438
  const shouldSkipNodeView = (editor) => {
67439
67439
  return isHeadless(editor);
67440
67440
  };
67441
- const summaryVersion = "1.0.0-beta.82";
67441
+ const summaryVersion = "1.0.0-beta.84";
67442
67442
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67443
67443
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67444
67444
  function mapAttributes(attrs) {
@@ -68227,7 +68227,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68227
68227
  { default: remarkStringify2 },
68228
68228
  { default: remarkGfm2 }
68229
68229
  ] = await Promise.all([
68230
- Promise.resolve().then(() => indexGF5Urhpn),
68230
+ Promise.resolve().then(() => indexByDo0rez),
68231
68231
  Promise.resolve().then(() => indexDRCvimau),
68232
68232
  Promise.resolve().then(() => indexC_x_N6Uh),
68233
68233
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68432,7 +68432,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68432
68432
  * Process collaboration migrations
68433
68433
  */
68434
68434
  processCollaborationMigrations() {
68435
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.82");
68435
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.84");
68436
68436
  if (!this.options.ydoc) return;
68437
68437
  const metaMap = this.options.ydoc.getMap("meta");
68438
68438
  let docVersion = metaMap.get("version");
@@ -71476,32 +71476,76 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71476
71476
  return hasChanges ? hydratedRuns : runs2;
71477
71477
  };
71478
71478
  return blocks2.map((block) => {
71479
- if (block.kind === "image") {
71480
- if (!block.src || block.src.startsWith("data:")) {
71481
- return block;
71482
- }
71483
- const attrs = block.attrs ?? {};
71484
- const relId = typeof attrs.rId === "string" ? attrs.rId : void 0;
71485
- const attrSrc = typeof attrs.src === "string" ? attrs.src : void 0;
71486
- const extension = typeof attrs.extension === "string" ? attrs.extension.toLowerCase() : void 0;
71487
- const resolvedSrc = resolveImageSrc(block.src, relId, attrSrc, extension);
71488
- if (resolvedSrc) {
71489
- return { ...block, src: resolvedSrc };
71490
- }
71491
- return block;
71492
- }
71493
- if (block.kind === "paragraph") {
71494
- const paragraphBlock = block;
71495
- if (!paragraphBlock.runs || paragraphBlock.runs.length === 0) {
71496
- return block;
71497
- }
71498
- const hydratedRuns = hydrateRuns(paragraphBlock.runs);
71499
- if (hydratedRuns !== paragraphBlock.runs) {
71500
- return { ...paragraphBlock, runs: hydratedRuns };
71479
+ const hydrateBlock = (blk) => {
71480
+ if (blk.kind === "image") {
71481
+ if (!blk.src || blk.src.startsWith("data:")) {
71482
+ return blk;
71483
+ }
71484
+ const attrs = blk.attrs ?? {};
71485
+ const relId = typeof attrs.rId === "string" ? attrs.rId : void 0;
71486
+ const attrSrc = typeof attrs.src === "string" ? attrs.src : void 0;
71487
+ const extension = typeof attrs.extension === "string" ? attrs.extension.toLowerCase() : void 0;
71488
+ const resolvedSrc = resolveImageSrc(blk.src, relId, attrSrc, extension);
71489
+ if (resolvedSrc) {
71490
+ return { ...blk, src: resolvedSrc };
71491
+ }
71492
+ return blk;
71493
+ }
71494
+ if (blk.kind === "paragraph") {
71495
+ const paragraphBlock = blk;
71496
+ if (!paragraphBlock.runs || paragraphBlock.runs.length === 0) {
71497
+ return blk;
71498
+ }
71499
+ const hydratedRuns = hydrateRuns(paragraphBlock.runs);
71500
+ if (hydratedRuns !== paragraphBlock.runs) {
71501
+ return { ...paragraphBlock, runs: hydratedRuns };
71502
+ }
71503
+ return blk;
71504
+ }
71505
+ if (blk.kind === "table") {
71506
+ let rowsChanged = false;
71507
+ const newRows = blk.rows.map((row2) => {
71508
+ let cellsChanged = false;
71509
+ const newCells = row2.cells.map((cell2) => {
71510
+ let cellChanged = false;
71511
+ const hydratedBlocks = (cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : [])).map((cb) => hydrateBlock(cb));
71512
+ if (cell2.blocks && hydratedBlocks !== cell2.blocks) {
71513
+ cellChanged = true;
71514
+ }
71515
+ let hydratedParagraph = cell2.paragraph;
71516
+ if (!cell2.blocks && cell2.paragraph && cell2.paragraph.kind === "paragraph") {
71517
+ const hydratedPara = hydrateBlock(cell2.paragraph);
71518
+ if (hydratedPara !== cell2.paragraph) {
71519
+ hydratedParagraph = hydratedPara;
71520
+ cellChanged = true;
71521
+ }
71522
+ }
71523
+ if (cellChanged) {
71524
+ return {
71525
+ ...cell2,
71526
+ blocks: hydratedBlocks.length > 0 ? hydratedBlocks : cell2.blocks,
71527
+ paragraph: hydratedParagraph
71528
+ };
71529
+ }
71530
+ return cell2;
71531
+ });
71532
+ if (newCells.some((c2, idx) => c2 !== row2.cells[idx])) {
71533
+ cellsChanged = true;
71534
+ }
71535
+ if (cellsChanged) {
71536
+ rowsChanged = true;
71537
+ return { ...row2, cells: newCells };
71538
+ }
71539
+ return row2;
71540
+ });
71541
+ if (rowsChanged) {
71542
+ return { ...blk, rows: newRows };
71543
+ }
71544
+ return blk;
71501
71545
  }
71502
- return block;
71503
- }
71504
- return block;
71546
+ return blk;
71547
+ };
71548
+ return hydrateBlock(block);
71505
71549
  });
71506
71550
  }
71507
71551
  function isGradientFill(value) {
@@ -73216,7 +73260,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
73216
73260
  return void 0;
73217
73261
  }
73218
73262
  const DEFAULT_LIST_HANGING_PX$1 = 18;
73219
- const LIST_MARKER_GAP$2 = 8;
73263
+ const LIST_MARKER_GAP$3 = 8;
73220
73264
  const DEFAULT_BULLET_GLYPH = "•";
73221
73265
  const DEFAULT_DECIMAL_PATTERN = "%1.";
73222
73266
  const ASCII_UPPERCASE_A = 65;
@@ -73627,7 +73671,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
73627
73671
  let markerBoxWidthPx;
73628
73672
  let markerX;
73629
73673
  if (hasFirstLineIndent) {
73630
- markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP$2 : DEFAULT_LIST_HANGING_PX$1;
73674
+ markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP$3 : DEFAULT_LIST_HANGING_PX$1;
73631
73675
  markerX = indentLeftPx + (firstLinePx ?? 0);
73632
73676
  layout.textStartPx = markerX + markerBoxWidthPx;
73633
73677
  layout.hangingPx = 0;
@@ -73727,12 +73771,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
73727
73771
  let markerBox = Math.max(hangingPxRaw || 0, 0);
73728
73772
  if (markerBox <= 0) {
73729
73773
  if (glyphWidthPx != null && glyphWidthPx > 0) {
73730
- markerBox = glyphWidthPx + LIST_MARKER_GAP$2;
73774
+ markerBox = glyphWidthPx + LIST_MARKER_GAP$3;
73731
73775
  } else {
73732
73776
  markerBox = DEFAULT_LIST_HANGING_PX$1;
73733
73777
  }
73734
- } else if (glyphWidthPx != null && glyphWidthPx + LIST_MARKER_GAP$2 > markerBox) {
73735
- markerBox = glyphWidthPx + LIST_MARKER_GAP$2;
73778
+ } else if (glyphWidthPx != null && glyphWidthPx + LIST_MARKER_GAP$3 > markerBox) {
73779
+ markerBox = glyphWidthPx + LIST_MARKER_GAP$3;
73736
73780
  }
73737
73781
  return markerBox;
73738
73782
  };
@@ -74354,13 +74398,21 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74354
74398
  const resolveNumberingFromContext = (numId, ilvl, numbering) => {
74355
74399
  const definitions = numbering?.definitions;
74356
74400
  const abstracts = numbering?.abstracts;
74357
- if (!definitions || !abstracts) return void 0;
74401
+ if (!definitions || !abstracts) {
74402
+ return void 0;
74403
+ }
74358
74404
  const numDef = asOoxmlElement(definitions[String(numId)]);
74359
- if (!numDef) return void 0;
74405
+ if (!numDef) {
74406
+ return void 0;
74407
+ }
74360
74408
  const abstractId = getAttribute(findChild(numDef, "w:abstractNumId"), "w:val");
74361
- if (abstractId == null) return void 0;
74409
+ if (abstractId == null) {
74410
+ return void 0;
74411
+ }
74362
74412
  const abstract = asOoxmlElement(abstracts[String(abstractId)]);
74363
- if (!abstract) return void 0;
74413
+ if (!abstract) {
74414
+ return void 0;
74415
+ }
74364
74416
  let levelDef = abstract.elements?.find(
74365
74417
  (el) => el?.name === "w:lvl" && parseNumberAttr(el.attributes?.["w:ilvl"]) === ilvl
74366
74418
  );
@@ -74372,7 +74424,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74372
74424
  levelDef = overrideLvl;
74373
74425
  }
74374
74426
  const startOverride = parseNumberAttr(getAttribute(findChild(override, "w:startOverride"), "w:val"));
74375
- if (!levelDef) return void 0;
74427
+ if (!levelDef) {
74428
+ return void 0;
74429
+ }
74376
74430
  const numFmtEl = findNumFmtElement(levelDef);
74377
74431
  const lvlText = getAttribute(findChild(levelDef, "w:lvlText"), "w:val");
74378
74432
  const start2 = startOverride ?? parseNumberAttr(getAttribute(findChild(levelDef, "w:start"), "w:val"));
@@ -75018,14 +75072,29 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75018
75072
  paragraphAttrs.frame = frame;
75019
75073
  }
75020
75074
  }
75075
+ const listRendering = normalizeListRenderingAttrs(attrs.listRendering);
75021
75076
  const numberingSource = attrs.numberingProperties ?? paragraphProps.numberingProperties ?? hydrated?.numberingProperties;
75022
- const rawNumberingProps = toAdapterNumberingProps(numberingSource);
75077
+ let rawNumberingProps = toAdapterNumberingProps(numberingSource);
75078
+ if (!rawNumberingProps && listRendering) {
75079
+ const path2 = listRendering.path;
75080
+ const counterFromPath = path2 && path2.length ? path2[path2.length - 1] : void 0;
75081
+ const ilvl = path2 && path2.length > 1 ? path2.length - 1 : 0;
75082
+ rawNumberingProps = {
75083
+ numId: -1,
75084
+ ilvl,
75085
+ path: path2,
75086
+ counterValue: Number.isFinite(counterFromPath) ? Number(counterFromPath) : void 0,
75087
+ markerText: listRendering.markerText,
75088
+ format: listRendering.numberingType,
75089
+ lvlJc: listRendering.justification,
75090
+ suffix: listRendering.suffix
75091
+ };
75092
+ }
75023
75093
  const hasValidNumbering = rawNumberingProps && isValidNumberingId(rawNumberingProps.numId);
75024
75094
  if (hasValidNumbering) {
75025
75095
  const numberingProps = rawNumberingProps;
75026
75096
  const numId = numberingProps.numId;
75027
75097
  const ilvl = Number.isFinite(numberingProps.ilvl) ? Math.max(0, Math.floor(Number(numberingProps.ilvl))) : 0;
75028
- const listRendering = normalizeListRenderingAttrs(attrs.listRendering);
75029
75098
  const numericNumId = typeof numId === "number" ? numId : void 0;
75030
75099
  const resolvedLevel = resolveNumberingFromContext(numId, ilvl, converterContext?.numbering);
75031
75100
  if (resolvedLevel) {
@@ -75100,13 +75169,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75100
75169
  }
75101
75170
  }
75102
75171
  paragraphAttrs.wordLayout = wordLayout;
75103
- if (enrichedNumberingProps.resolvedLevelIndent) {
75104
- const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
75105
- const baseIndent = resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent;
75106
- paragraphAttrs.indent = {
75107
- ...baseIndent,
75108
- ...normalizedIndent ?? {}
75109
- };
75172
+ }
75173
+ if (enrichedNumberingProps.resolvedLevelIndent) {
75174
+ const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
75175
+ const baseIndent = resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent;
75176
+ paragraphAttrs.indent = {
75177
+ ...baseIndent,
75178
+ ...normalizedIndent ?? {}
75179
+ };
75180
+ if (normalizedIndent?.firstLine !== void 0) {
75181
+ delete paragraphAttrs.indent.hanging;
75182
+ } else if (normalizedIndent?.hanging !== void 0) {
75183
+ delete paragraphAttrs.indent.firstLine;
75110
75184
  }
75111
75185
  }
75112
75186
  paragraphAttrs.numberingProperties = enrichedNumberingProps;
@@ -77076,29 +77150,129 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77076
77150
  ...context.converterContext,
77077
77151
  tableStyleParagraphProps
77078
77152
  } : context.converterContext;
77153
+ const paragraphToFlowBlocks2 = context.converters?.paragraphToFlowBlocks ?? context.paragraphToFlowBlocks;
77154
+ const listCounterContext = context.listCounterContext;
77079
77155
  for (const childNode of cellNode.content) {
77080
77156
  if (childNode.type === "paragraph") {
77081
- const paragraphBlocks = context.paragraphToFlowBlocks(
77157
+ if (!paragraphToFlowBlocks2) continue;
77158
+ const paragraphBlocks = paragraphToFlowBlocks2(
77082
77159
  childNode,
77083
77160
  context.nextBlockId,
77084
77161
  context.positions,
77085
77162
  context.defaultFont,
77086
77163
  context.defaultSize,
77087
77164
  context.styleContext,
77088
- void 0,
77089
- // listCounterContext
77165
+ listCounterContext,
77090
77166
  context.trackedChanges,
77091
77167
  context.bookmarks,
77092
77168
  context.hyperlinkConfig,
77093
77169
  context.themeColors,
77094
77170
  cellConverterContext
77095
- // converterContext at position 12
77096
77171
  );
77097
- const paragraph2 = paragraphBlocks.find((b2) => b2.kind === "paragraph");
77098
- if (paragraph2) {
77099
- blocks2.push(paragraph2);
77172
+ paragraphBlocks.forEach((block) => {
77173
+ if (block.kind === "paragraph" || block.kind === "image" || block.kind === "drawing") {
77174
+ blocks2.push(block);
77175
+ }
77176
+ });
77177
+ continue;
77178
+ }
77179
+ if (childNode.type === "image" && context.converters?.imageNodeToBlock) {
77180
+ const mergedMarks = [...childNode.marks ?? []];
77181
+ const trackedMeta = context.trackedChanges ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
77182
+ if (shouldHideTrackedNode(trackedMeta, context.trackedChanges)) {
77183
+ continue;
77184
+ }
77185
+ const imageBlock = context.converters.imageNodeToBlock(
77186
+ childNode,
77187
+ context.nextBlockId,
77188
+ context.positions,
77189
+ trackedMeta,
77190
+ context.trackedChanges
77191
+ );
77192
+ if (imageBlock && imageBlock.kind === "image") {
77193
+ annotateBlockWithTrackedChange(imageBlock, trackedMeta, context.trackedChanges);
77194
+ blocks2.push(imageBlock);
77195
+ }
77196
+ continue;
77197
+ }
77198
+ if (childNode.type === "vectorShape" && context.converters?.vectorShapeNodeToDrawingBlock) {
77199
+ const drawingBlock = context.converters.vectorShapeNodeToDrawingBlock(
77200
+ childNode,
77201
+ context.nextBlockId,
77202
+ context.positions
77203
+ );
77204
+ if (drawingBlock) {
77205
+ blocks2.push(drawingBlock);
77206
+ }
77207
+ continue;
77208
+ }
77209
+ if (childNode.type === "shapeGroup" && context.converters?.shapeGroupNodeToDrawingBlock) {
77210
+ const drawingBlock = context.converters.shapeGroupNodeToDrawingBlock(
77211
+ childNode,
77212
+ context.nextBlockId,
77213
+ context.positions
77214
+ );
77215
+ if (drawingBlock) {
77216
+ blocks2.push(drawingBlock);
77100
77217
  }
77218
+ continue;
77101
77219
  }
77220
+ if (childNode.type === "shapeContainer" && context.converters?.shapeContainerNodeToDrawingBlock) {
77221
+ const drawingBlock = context.converters.shapeContainerNodeToDrawingBlock(
77222
+ childNode,
77223
+ context.nextBlockId,
77224
+ context.positions
77225
+ );
77226
+ if (drawingBlock) {
77227
+ blocks2.push(drawingBlock);
77228
+ }
77229
+ continue;
77230
+ }
77231
+ if (childNode.type === "shapeTextbox" && context.converters?.shapeTextboxNodeToDrawingBlock) {
77232
+ const drawingBlock = context.converters.shapeTextboxNodeToDrawingBlock(
77233
+ childNode,
77234
+ context.nextBlockId,
77235
+ context.positions
77236
+ );
77237
+ if (drawingBlock) {
77238
+ blocks2.push(drawingBlock);
77239
+ }
77240
+ }
77241
+ }
77242
+ try {
77243
+ const blockSummaries = blocks2.map((b2) => {
77244
+ if (b2.kind === "paragraph") {
77245
+ const runs2 = b2.runs ?? [];
77246
+ const attrs = b2.attrs ?? {};
77247
+ return {
77248
+ kind: "paragraph",
77249
+ runKinds: runs2.map((r2) => r2.kind ?? "text"),
77250
+ runCount: runs2.length,
77251
+ runPreview: runs2.map((r2) => {
77252
+ const kind = r2.kind ?? "text";
77253
+ if (kind === "image") {
77254
+ const img2 = r2;
77255
+ return { kind, src: img2.src, width: img2.width, height: img2.height };
77256
+ }
77257
+ return { kind };
77258
+ }),
77259
+ hasNumbering: Boolean(attrs.numberingProperties),
77260
+ markerText: attrs.wordLayout?.marker?.markerText
77261
+ };
77262
+ }
77263
+ return { kind: b2.kind };
77264
+ });
77265
+ console.log(
77266
+ "[tableNodeToBlock.parseTableCell] cell contents",
77267
+ JSON.stringify({
77268
+ cellIndex,
77269
+ rowIndex,
77270
+ cellIdPreview: `cell-${rowIndex}-${cellIndex}`,
77271
+ childTypes: cellNode.content.map((c2) => c2?.type),
77272
+ blocks: blockSummaries
77273
+ })
77274
+ );
77275
+ } catch {
77102
77276
  }
77103
77277
  if (blocks2.length === 0) {
77104
77278
  return null;
@@ -77238,9 +77412,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77238
77412
  }
77239
77413
  return { anchor, wrap: wrap2 };
77240
77414
  }
77241
- function tableNodeToBlock$1(node2, nextBlockId, positions, defaultFont, defaultSize, _styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, paragraphToFlowBlocks2, converterContext) {
77415
+ function tableNodeToBlock$1(node2, nextBlockId, positions, defaultFont, defaultSize, _styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, paragraphToFlowBlocks2, converterContext, options) {
77242
77416
  if (!Array.isArray(node2.content) || node2.content.length === 0) return null;
77243
- if (!paragraphToFlowBlocks2) return null;
77417
+ const paragraphConverter = paragraphToFlowBlocks2 ?? options?.converters?.paragraphToFlowBlocks;
77418
+ if (!paragraphConverter) return null;
77244
77419
  const parserDeps = {
77245
77420
  nextBlockId,
77246
77421
  positions,
@@ -77251,8 +77426,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77251
77426
  bookmarks,
77252
77427
  hyperlinkConfig,
77253
77428
  themeColors,
77254
- paragraphToFlowBlocks: paragraphToFlowBlocks2,
77255
- converterContext
77429
+ listCounterContext: options?.listCounterContext,
77430
+ paragraphToFlowBlocks: paragraphConverter,
77431
+ converterContext,
77432
+ converters: options?.converters
77256
77433
  };
77257
77434
  const hydratedTableStyle = hydrateTableStyleAttrs(node2, converterContext);
77258
77435
  const defaultCellPadding = hydratedTableStyle?.cellPadding;
@@ -77372,6 +77549,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77372
77549
  defaultFont,
77373
77550
  defaultSize,
77374
77551
  styleContext,
77552
+ listCounterContext,
77375
77553
  trackedChangesConfig,
77376
77554
  bookmarks,
77377
77555
  hyperlinkConfig,
@@ -77391,7 +77569,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77391
77569
  void 0,
77392
77570
  // themeColors
77393
77571
  converters?.paragraphToFlowBlocks,
77394
- converterContext
77572
+ converterContext,
77573
+ { listCounterContext, converters }
77395
77574
  );
77396
77575
  if (tableBlock) {
77397
77576
  blocks2.push(tableBlock);
@@ -77545,7 +77724,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77545
77724
  bookmarks2,
77546
77725
  hyperlinkConfig2,
77547
77726
  themeColorsParam ?? themeColors,
77548
- converterCtx ?? converterContext
77727
+ paragraphConverter
77549
77728
  );
77550
77729
  const handlerContext = {
77551
77730
  blocks: blocks2,
@@ -77568,7 +77747,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77568
77747
  converters: {
77569
77748
  paragraphToFlowBlocks: paragraphConverter,
77570
77749
  tableNodeToBlock: tableConverter,
77571
- imageNodeToBlock
77750
+ imageNodeToBlock,
77751
+ vectorShapeNodeToDrawingBlock,
77752
+ shapeGroupNodeToDrawingBlock,
77753
+ shapeContainerNodeToDrawingBlock,
77754
+ shapeTextboxNodeToDrawingBlock
77572
77755
  }
77573
77756
  };
77574
77757
  doc2.content.forEach((node2) => {
@@ -77653,7 +77836,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77653
77836
  hyperlinkConfig2,
77654
77837
  themeColors2,
77655
77838
  paragraphToFlowBlocks,
77656
- converterCtx ?? converterContext
77839
+ converterCtx ?? converterContext,
77840
+ {
77841
+ listCounterContext,
77842
+ converters: {
77843
+ paragraphToFlowBlocks: paragraphToFlowBlocks$1,
77844
+ imageNodeToBlock,
77845
+ vectorShapeNodeToDrawingBlock,
77846
+ shapeGroupNodeToDrawingBlock,
77847
+ shapeContainerNodeToDrawingBlock,
77848
+ shapeTextboxNodeToDrawingBlock
77849
+ }
77850
+ }
77657
77851
  )
77658
77852
  },
77659
77853
  converterContext
@@ -77672,7 +77866,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77672
77866
  hyperlinkConfig,
77673
77867
  themeColors,
77674
77868
  paragraphToFlowBlocks,
77675
- converterContext
77869
+ converterContext,
77870
+ {
77871
+ converters: {
77872
+ paragraphToFlowBlocks: paragraphToFlowBlocks$1,
77873
+ imageNodeToBlock,
77874
+ vectorShapeNodeToDrawingBlock,
77875
+ shapeGroupNodeToDrawingBlock,
77876
+ shapeContainerNodeToDrawingBlock,
77877
+ shapeTextboxNodeToDrawingBlock
77878
+ }
77879
+ }
77676
77880
  );
77677
77881
  }
77678
77882
  let measurementCanvas = null;
@@ -80855,6 +81059,43 @@ ${l}
80855
81059
  right: borderValueToSpec(isLastCol ? tableBorders?.right : null)
80856
81060
  };
80857
81061
  };
81062
+ const LIST_MARKER_GAP$2 = 8;
81063
+ function renderListMarker(params2) {
81064
+ const { doc: doc2, lineEl, markerLayout, markerMeasure, indentLeftPx } = params2;
81065
+ const markerJustification = markerLayout?.justification ?? "left";
81066
+ const markerBoxWidth = (typeof markerLayout?.markerBoxWidthPx === "number" ? markerLayout.markerBoxWidthPx : void 0) ?? markerMeasure?.markerWidth ?? 0;
81067
+ const gutter = (typeof markerLayout?.gutterWidthPx === "number" ? markerLayout.gutterWidthPx : void 0) ?? markerMeasure?.gutterWidth ?? LIST_MARKER_GAP$2;
81068
+ const markerStartPos = markerJustification === "left" ? indentLeftPx : (typeof markerLayout?.markerX === "number" ? markerLayout.markerX : void 0) ?? indentLeftPx;
81069
+ const markerLeftPos = markerStartPos - markerBoxWidth;
81070
+ const lineContainer = doc2.createElement("div");
81071
+ lineContainer.style.position = "relative";
81072
+ lineContainer.style.width = "100%";
81073
+ const markerEl = doc2.createElement("span");
81074
+ markerEl.classList.add("superdoc-paragraph-marker");
81075
+ markerEl.textContent = markerLayout?.markerText ?? "";
81076
+ markerEl.style.display = "inline-block";
81077
+ markerEl.style.fontFamily = markerLayout?.run?.fontFamily ?? "";
81078
+ if (markerLayout?.run?.fontSize != null) {
81079
+ markerEl.style.fontSize = `${markerLayout.run.fontSize}px`;
81080
+ }
81081
+ markerEl.style.fontWeight = markerLayout?.run?.bold ? "bold" : "";
81082
+ markerEl.style.fontStyle = markerLayout?.run?.italic ? "italic" : "";
81083
+ if (markerLayout?.run?.color) {
81084
+ markerEl.style.color = markerLayout.run.color;
81085
+ }
81086
+ if (markerLayout?.run?.letterSpacing != null) {
81087
+ markerEl.style.letterSpacing = `${markerLayout.run.letterSpacing}px`;
81088
+ }
81089
+ markerEl.style.position = "absolute";
81090
+ markerEl.style.left = `${markerLeftPos}px`;
81091
+ markerEl.style.width = `${markerBoxWidth}px`;
81092
+ markerEl.style.textAlign = markerJustification;
81093
+ markerEl.style.paddingRight = `${gutter}px`;
81094
+ lineEl.style.paddingLeft = `${markerStartPos}px`;
81095
+ lineContainer.appendChild(markerEl);
81096
+ lineContainer.appendChild(lineEl);
81097
+ return lineContainer;
81098
+ }
80858
81099
  const renderTableCell = (deps) => {
80859
81100
  const {
80860
81101
  doc: doc2,
@@ -80896,6 +81137,20 @@ ${l}
80896
81137
  }
80897
81138
  const cellBlocks = cell2?.blocks ?? (cell2?.paragraph ? [cell2.paragraph] : []);
80898
81139
  const blockMeasures = cellMeasure?.blocks ?? (cellMeasure?.paragraph ? [cellMeasure.paragraph] : []);
81140
+ try {
81141
+ console.log(
81142
+ "[DomPainter.renderTableCell] cell render input",
81143
+ JSON.stringify({
81144
+ cellId: cell2?.id,
81145
+ blockKinds: cellBlocks.map((b2) => b2.kind),
81146
+ measureKinds: blockMeasures.map((m2) => m2.kind),
81147
+ width: cellMeasure?.width,
81148
+ height: cellMeasure?.height,
81149
+ rowHeight
81150
+ })
81151
+ );
81152
+ } catch {
81153
+ }
80899
81154
  if (cellBlocks.length > 0 && blockMeasures.length > 0) {
80900
81155
  const content2 = doc2.createElement("div");
80901
81156
  content2.style.position = "relative";
@@ -80927,9 +81182,106 @@ ${l}
80927
81182
  for (let i2 = 0; i2 < Math.min(blockMeasures.length, cellBlocks.length); i2++) {
80928
81183
  const blockMeasure = blockMeasures[i2];
80929
81184
  const block = cellBlocks[i2];
81185
+ if (blockMeasure.kind === "image" && block?.kind === "image") {
81186
+ console.log(
81187
+ "[DomPainter.renderTableCell] rendering image block in cell",
81188
+ JSON.stringify({
81189
+ cellId: cell2?.id,
81190
+ blockId: block.id,
81191
+ width: blockMeasure.width,
81192
+ height: blockMeasure.height
81193
+ })
81194
+ );
81195
+ const imageWrapper = doc2.createElement("div");
81196
+ imageWrapper.style.position = "relative";
81197
+ imageWrapper.style.width = `${blockMeasure.width}px`;
81198
+ imageWrapper.style.height = `${blockMeasure.height}px`;
81199
+ imageWrapper.style.maxWidth = "100%";
81200
+ imageWrapper.style.boxSizing = "border-box";
81201
+ applySdtDataset(imageWrapper, block.attrs?.sdt);
81202
+ const imgEl = doc2.createElement("img");
81203
+ imgEl.classList.add("superdoc-table-image");
81204
+ if (block.src) {
81205
+ imgEl.src = block.src;
81206
+ }
81207
+ imgEl.alt = block.alt ?? "";
81208
+ imgEl.style.width = "100%";
81209
+ imgEl.style.height = "100%";
81210
+ imgEl.style.objectFit = block.objectFit ?? "contain";
81211
+ imgEl.style.display = "block";
81212
+ imageWrapper.appendChild(imgEl);
81213
+ content2.appendChild(imageWrapper);
81214
+ continue;
81215
+ }
81216
+ if (blockMeasure.kind === "drawing" && block?.kind === "drawing") {
81217
+ console.log(
81218
+ "[DomPainter.renderTableCell] rendering drawing block in cell",
81219
+ JSON.stringify({
81220
+ cellId: cell2?.id,
81221
+ blockId: block.id,
81222
+ drawingKind: block.drawingKind,
81223
+ width: blockMeasure.width,
81224
+ height: blockMeasure.height
81225
+ })
81226
+ );
81227
+ const drawingWrapper = doc2.createElement("div");
81228
+ drawingWrapper.style.position = "relative";
81229
+ drawingWrapper.style.width = `${blockMeasure.width}px`;
81230
+ drawingWrapper.style.height = `${blockMeasure.height}px`;
81231
+ drawingWrapper.style.maxWidth = "100%";
81232
+ drawingWrapper.style.boxSizing = "border-box";
81233
+ applySdtDataset(drawingWrapper, block.attrs);
81234
+ const drawingInner = doc2.createElement("div");
81235
+ drawingInner.classList.add("superdoc-table-drawing");
81236
+ drawingInner.style.width = "100%";
81237
+ drawingInner.style.height = "100%";
81238
+ drawingInner.style.display = "flex";
81239
+ drawingInner.style.alignItems = "center";
81240
+ drawingInner.style.justifyContent = "center";
81241
+ drawingInner.style.overflow = "hidden";
81242
+ if (block.drawingKind === "image" && "src" in block && block.src) {
81243
+ const img2 = doc2.createElement("img");
81244
+ img2.classList.add("superdoc-drawing-image");
81245
+ img2.src = block.src;
81246
+ img2.alt = block.alt ?? "";
81247
+ img2.style.width = "100%";
81248
+ img2.style.height = "100%";
81249
+ img2.style.objectFit = block.objectFit ?? "contain";
81250
+ drawingInner.appendChild(img2);
81251
+ } else {
81252
+ const placeholder = doc2.createElement("div");
81253
+ placeholder.style.width = "100%";
81254
+ placeholder.style.height = "100%";
81255
+ placeholder.style.background = "repeating-linear-gradient(45deg, rgba(15,23,42,0.1), rgba(15,23,42,0.1) 6px, rgba(15,23,42,0.2) 6px, rgba(15,23,42,0.2) 12px)";
81256
+ placeholder.style.border = "1px dashed rgba(15, 23, 42, 0.3)";
81257
+ drawingInner.appendChild(placeholder);
81258
+ }
81259
+ drawingWrapper.appendChild(drawingInner);
81260
+ content2.appendChild(drawingWrapper);
81261
+ continue;
81262
+ }
80930
81263
  if (blockMeasure.kind === "paragraph" && block?.kind === "paragraph") {
80931
- const lines = blockMeasure.lines;
81264
+ try {
81265
+ const runKinds = (block.runs ?? []).map((r2) => r2.kind ?? "text");
81266
+ const imageRuns = (block.runs ?? []).filter((r2) => r2.kind === "image").map((r2) => ({ src: r2.src }));
81267
+ console.log(
81268
+ "[DomPainter.renderTableCell] rendering paragraph block in cell",
81269
+ JSON.stringify({
81270
+ cellId: cell2?.id,
81271
+ blockId: block.id,
81272
+ runKinds,
81273
+ imageRuns
81274
+ })
81275
+ );
81276
+ } catch {
81277
+ }
81278
+ const paragraphMeasure = blockMeasure;
81279
+ const lines = paragraphMeasure.lines;
80932
81280
  const blockLineCount = lines?.length || 0;
81281
+ const wordLayout = block.attrs?.wordLayout ?? null;
81282
+ const markerLayout = wordLayout?.marker;
81283
+ const markerMeasure = paragraphMeasure.marker;
81284
+ const indentLeftPx = markerMeasure?.indentLeft ?? wordLayout?.indentLeftPx ?? (block.attrs?.indent && typeof block.attrs.indent.left === "number" ? block.attrs.indent.left : 0);
80933
81285
  const blockStartGlobal = cumulativeLineCount;
80934
81286
  const blockEndGlobal = cumulativeLineCount + blockLineCount;
80935
81287
  if (blockEndGlobal <= globalFromLine) {
@@ -80951,7 +81303,38 @@ ${l}
80951
81303
  for (let lineIdx = localStartLine; lineIdx < localEndLine && lineIdx < lines.length; lineIdx++) {
80952
81304
  const line = lines[lineIdx];
80953
81305
  const lineEl = renderLine(block, line, { ...context, section: "body" });
80954
- paraWrapper.appendChild(lineEl);
81306
+ lineEl.style.paddingLeft = "";
81307
+ lineEl.style.paddingRight = "";
81308
+ lineEl.style.textIndent = "";
81309
+ const shouldRenderMarker = markerLayout && markerMeasure && lineIdx === 0 && localStartLine === 0 && markerMeasure.markerWidth > 0;
81310
+ if (shouldRenderMarker) {
81311
+ const lineContainer = renderListMarker({
81312
+ doc: doc2,
81313
+ lineEl,
81314
+ markerLayout,
81315
+ markerMeasure,
81316
+ indentLeftPx
81317
+ });
81318
+ paraWrapper.appendChild(lineContainer);
81319
+ } else {
81320
+ if (markerLayout && indentLeftPx) {
81321
+ lineEl.style.paddingLeft = `${indentLeftPx}px`;
81322
+ } else {
81323
+ const indent2 = block.attrs?.indent;
81324
+ if (indent2) {
81325
+ if (typeof indent2.left === "number" && indent2.left > 0) {
81326
+ lineEl.style.paddingLeft = `${indent2.left}px`;
81327
+ }
81328
+ if (typeof indent2.right === "number" && indent2.right > 0) {
81329
+ lineEl.style.paddingRight = `${indent2.right}px`;
81330
+ }
81331
+ if (lineIdx === 0 && typeof indent2.firstLine === "number" && indent2.firstLine !== 0) {
81332
+ lineEl.style.textIndent = `${indent2.firstLine}px`;
81333
+ }
81334
+ }
81335
+ }
81336
+ paraWrapper.appendChild(lineEl);
81337
+ }
80955
81338
  renderedHeight += line.lineHeight;
80956
81339
  }
80957
81340
  const renderedEntireBlock = localStartLine === 0 && localEndLine >= blockLineCount;
@@ -82761,10 +83144,10 @@ ${l}
82761
83144
  let markerStartPos;
82762
83145
  if (isFirstLineIndentMode && wordLayout.marker.markerX !== void 0 && Number.isFinite(wordLayout.marker.markerX)) {
82763
83146
  markerStartPos = wordLayout.marker.markerX;
82764
- } else if (isFirstLineIndentMode) {
82765
- markerStartPos = paraIndentLeft + (paraIndent?.firstLine ?? 0);
82766
83147
  } else {
82767
- markerStartPos = paraIndentLeft - (paraIndent?.hanging ?? 0);
83148
+ const hanging = paraIndent?.hanging ?? 0;
83149
+ const firstLine = paraIndent?.firstLine ?? 0;
83150
+ markerStartPos = paraIndentLeft - hanging + firstLine;
82768
83151
  }
82769
83152
  const validMarkerStartPos = Number.isFinite(markerStartPos) ? markerStartPos : 0;
82770
83153
  lineEl.style.paddingLeft = `${validMarkerStartPos}px`;
@@ -82832,15 +83215,27 @@ ${l}
82832
83215
  tabWidth = LIST_MARKER_GAP$1;
82833
83216
  }
82834
83217
  } else {
82835
- const implicitTabStop = paraIndentLeft;
82836
- tabWidth = implicitTabStop - currentPos;
82837
- if (tabWidth < 1) {
83218
+ const firstLine = paraIndent?.firstLine ?? 0;
83219
+ const textStart = paraIndentLeft + firstLine;
83220
+ tabWidth = textStart - currentPos;
83221
+ if (tabWidth <= 0) {
82838
83222
  tabWidth = DEFAULT_TAB_INTERVAL_PX$1 - currentPos % DEFAULT_TAB_INTERVAL_PX$1;
82839
- if (tabWidth === 0) tabWidth = DEFAULT_TAB_INTERVAL_PX$1;
83223
+ } else if (tabWidth < LIST_MARKER_GAP$1) {
83224
+ tabWidth = LIST_MARKER_GAP$1;
82840
83225
  }
82841
83226
  }
82842
83227
  } else {
82843
- tabWidth = fragment.markerGutter != null && isFinite(fragment.markerGutter) ? fragment.markerGutter : typeof wordLayout.marker.gutterWidthPx === "number" && isFinite(wordLayout.marker.gutterWidthPx) && wordLayout.marker.gutterWidthPx > 0 ? wordLayout.marker.gutterWidthPx : LIST_MARKER_GAP$1;
83228
+ const gutterWidth = fragment.markerGutter ?? wordLayout.marker.gutterWidthPx;
83229
+ if (gutterWidth !== void 0 && Number.isFinite(gutterWidth) && gutterWidth > 0) {
83230
+ tabWidth = gutterWidth;
83231
+ } else {
83232
+ const firstLine = paraIndent?.firstLine ?? 0;
83233
+ const textStart = paraIndentLeft + firstLine;
83234
+ tabWidth = textStart - validMarkerStartPos;
83235
+ }
83236
+ if (tabWidth < LIST_MARKER_GAP$1) {
83237
+ tabWidth = LIST_MARKER_GAP$1;
83238
+ }
82844
83239
  }
82845
83240
  tabEl.style.display = "inline-block";
82846
83241
  tabEl.style.width = `${tabWidth}px`;
@@ -150906,7 +151301,7 @@ ${style2}
150906
151301
  this.config.colors = shuffleArray(this.config.colors);
150907
151302
  this.userColorMap = /* @__PURE__ */ new Map();
150908
151303
  this.colorIndex = 0;
150909
- this.version = "1.0.0-beta.82";
151304
+ this.version = "1.0.0-beta.84";
150910
151305
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
150911
151306
  this.superdocId = config2.superdocId || v4();
150912
151307
  this.colors = this.config.colors;
@@ -153378,7 +153773,7 @@ ${style2}
153378
153773
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
153379
153774
  );
153380
153775
  }
153381
- const indexGF5Urhpn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
153776
+ const indexByDo0rez = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
153382
153777
  __proto__: null,
153383
153778
  unified
153384
153779
  }, Symbol.toStringTag, { value: "Module" }));