superdoc 1.15.0-next.21 → 1.15.0-next.23

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.
@@ -7952,12 +7952,16 @@ function translateTableCell(params) {
7952
7952
  function generateTableCellProperties(node) {
7953
7953
  const tableCellProperties = { ...node.attrs?.tableCellProperties || {} };
7954
7954
  const { attrs } = node;
7955
- const { colwidth = [], cellWidthType = "dxa", widthUnit } = attrs;
7956
- const colwidthSum = colwidth.reduce((acc, curr) => acc + curr, 0);
7957
- if (twipsToPixels(tableCellProperties.cellWidth?.value) !== colwidthSum) tableCellProperties["cellWidth"] = {
7958
- value: widthUnit === "px" ? pixelsToTwips(colwidthSum) : inchesToTwips(colwidthSum),
7959
- type: cellWidthType
7960
- };
7955
+ const { colwidth: rawColwidth, widthUnit = "px" } = attrs;
7956
+ const resolvedWidthType = attrs.cellWidthType ?? (attrs.widthType !== "auto" ? attrs.widthType : void 0) ?? tableCellProperties.cellWidth?.type ?? "dxa";
7957
+ const colwidth = Array.isArray(rawColwidth) ? rawColwidth.filter((v$1) => Number.isFinite(v$1)) : [];
7958
+ if (colwidth.length > 0 && resolvedWidthType !== "pct") {
7959
+ const colwidthSum = colwidth.reduce((acc, curr) => acc + curr, 0);
7960
+ if (twipsToPixels(tableCellProperties.cellWidth?.value) !== colwidthSum) tableCellProperties["cellWidth"] = {
7961
+ value: widthUnit === "px" ? pixelsToTwips(colwidthSum) : inchesToTwips(colwidthSum),
7962
+ type: resolvedWidthType
7963
+ };
7964
+ }
7961
7965
  const { colspan } = attrs;
7962
7966
  if (colspan > 1 && tableCellProperties.gridSpan !== colspan) tableCellProperties["gridSpan"] = colspan;
7963
7967
  else if (!colspan || tableCellProperties?.gridSpan === 1) delete tableCellProperties.gridSpan;
@@ -17808,10 +17812,12 @@ var listIndexMap = {
17808
17812
  japaneseCounting: handleJapaneseCounting
17809
17813
  };
17810
17814
  const generateOrderedListIndex = ({ listLevel, lvlText, listNumberingType, customFormat }) => {
17815
+ if (typeof lvlText !== "string") return null;
17811
17816
  const handler$1 = listIndexMap[listNumberingType];
17812
17817
  return handler$1 ? handler$1(listLevel, lvlText, customFormat) : null;
17813
17818
  };
17814
17819
  var createNumbering = (values, lvlText) => {
17820
+ if (typeof lvlText !== "string") return "";
17815
17821
  return values.reduce((acc, value, index) => {
17816
17822
  return Number(value) > 9 ? acc.replace(/^0/, "").replace(`%${index + 1}`, value) : acc.replace(`%${index + 1}`, value);
17817
17823
  }, lvlText);
@@ -17834,6 +17840,7 @@ var decimalZeroFormatter = (value, idx) => {
17834
17840
  return `0${value}`;
17835
17841
  };
17836
17842
  var generateFromCustom = (path, lvlText, customFormat) => {
17843
+ if (typeof customFormat !== "string") return generateNumbering(path, lvlText, numberToStringFormatter);
17837
17844
  if (customFormat.match(/(?:[0]+\d,\s){3}\.{3}/) == null) return generateNumbering(path, lvlText, numberToStringFormatter);
17838
17845
  const match = customFormat.match(/(\d+)/);
17839
17846
  if (!match) throw new Error("Invalid format string: no numeric pattern found");
@@ -27899,7 +27906,7 @@ var decode$33 = (params) => {
27899
27906
  const { grid: rawGrid } = params.node.attrs || {};
27900
27907
  const grid = Array.isArray(rawGrid) ? rawGrid : [];
27901
27908
  const { firstRow = {}, preferTableGrid = false, totalColumns: requestedColumns } = params.extraParams || {};
27902
- let colWidthsFromCellNodes = (firstRow.content?.filter((n) => n.type === "tableCell") ?? []).flatMap((cell) => {
27909
+ let colWidthsFromCellNodes = (firstRow.content?.filter((n) => n.type === "tableCell" || n.type === "tableHeader") ?? []).flatMap((cell) => {
27903
27910
  const spanCount = Math.max(1, cell?.attrs?.colspan ?? 1);
27904
27911
  const colwidth = cell.attrs?.colwidth;
27905
27912
  return Array.from({ length: spanCount }).map((_$1, span) => Array.isArray(colwidth) ? colwidth[span] : void 0);
@@ -33803,7 +33810,7 @@ var SuperConverter = class SuperConverter {
33803
33810
  static getStoredSuperdocVersion(docx) {
33804
33811
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33805
33812
  }
33806
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.15.0-next.21") {
33813
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.15.0-next.23") {
33807
33814
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33808
33815
  }
33809
33816
  static generateWordTimestamp() {
@@ -7964,12 +7964,16 @@ function translateTableCell(params) {
7964
7964
  function generateTableCellProperties(node) {
7965
7965
  const tableCellProperties = { ...node.attrs?.tableCellProperties || {} };
7966
7966
  const { attrs } = node;
7967
- const { colwidth = [], cellWidthType = "dxa", widthUnit } = attrs;
7968
- const colwidthSum = colwidth.reduce((acc, curr) => acc + curr, 0);
7969
- if (require_helpers.twipsToPixels(tableCellProperties.cellWidth?.value) !== colwidthSum) tableCellProperties["cellWidth"] = {
7970
- value: widthUnit === "px" ? require_helpers.pixelsToTwips(colwidthSum) : require_helpers.inchesToTwips(colwidthSum),
7971
- type: cellWidthType
7972
- };
7967
+ const { colwidth: rawColwidth, widthUnit = "px" } = attrs;
7968
+ const resolvedWidthType = attrs.cellWidthType ?? (attrs.widthType !== "auto" ? attrs.widthType : void 0) ?? tableCellProperties.cellWidth?.type ?? "dxa";
7969
+ const colwidth = Array.isArray(rawColwidth) ? rawColwidth.filter((v$1) => Number.isFinite(v$1)) : [];
7970
+ if (colwidth.length > 0 && resolvedWidthType !== "pct") {
7971
+ const colwidthSum = colwidth.reduce((acc, curr) => acc + curr, 0);
7972
+ if (require_helpers.twipsToPixels(tableCellProperties.cellWidth?.value) !== colwidthSum) tableCellProperties["cellWidth"] = {
7973
+ value: widthUnit === "px" ? require_helpers.pixelsToTwips(colwidthSum) : require_helpers.inchesToTwips(colwidthSum),
7974
+ type: resolvedWidthType
7975
+ };
7976
+ }
7973
7977
  const { colspan } = attrs;
7974
7978
  if (colspan > 1 && tableCellProperties.gridSpan !== colspan) tableCellProperties["gridSpan"] = colspan;
7975
7979
  else if (!colspan || tableCellProperties?.gridSpan === 1) delete tableCellProperties.gridSpan;
@@ -17820,10 +17824,12 @@ var listIndexMap = {
17820
17824
  japaneseCounting: handleJapaneseCounting
17821
17825
  };
17822
17826
  const generateOrderedListIndex = ({ listLevel, lvlText, listNumberingType, customFormat }) => {
17827
+ if (typeof lvlText !== "string") return null;
17823
17828
  const handler$1 = listIndexMap[listNumberingType];
17824
17829
  return handler$1 ? handler$1(listLevel, lvlText, customFormat) : null;
17825
17830
  };
17826
17831
  var createNumbering = (values, lvlText) => {
17832
+ if (typeof lvlText !== "string") return "";
17827
17833
  return values.reduce((acc, value, index) => {
17828
17834
  return Number(value) > 9 ? acc.replace(/^0/, "").replace(`%${index + 1}`, value) : acc.replace(`%${index + 1}`, value);
17829
17835
  }, lvlText);
@@ -17846,6 +17852,7 @@ var decimalZeroFormatter = (value, idx) => {
17846
17852
  return `0${value}`;
17847
17853
  };
17848
17854
  var generateFromCustom = (path, lvlText, customFormat) => {
17855
+ if (typeof customFormat !== "string") return generateNumbering(path, lvlText, numberToStringFormatter);
17849
17856
  if (customFormat.match(/(?:[0]+\d,\s){3}\.{3}/) == null) return generateNumbering(path, lvlText, numberToStringFormatter);
17850
17857
  const match = customFormat.match(/(\d+)/);
17851
17858
  if (!match) throw new Error("Invalid format string: no numeric pattern found");
@@ -27908,7 +27915,7 @@ var decode$33 = (params) => {
27908
27915
  const { grid: rawGrid } = params.node.attrs || {};
27909
27916
  const grid = Array.isArray(rawGrid) ? rawGrid : [];
27910
27917
  const { firstRow = {}, preferTableGrid = false, totalColumns: requestedColumns } = params.extraParams || {};
27911
- let colWidthsFromCellNodes = (firstRow.content?.filter((n) => n.type === "tableCell") ?? []).flatMap((cell) => {
27918
+ let colWidthsFromCellNodes = (firstRow.content?.filter((n) => n.type === "tableCell" || n.type === "tableHeader") ?? []).flatMap((cell) => {
27912
27919
  const spanCount = Math.max(1, cell?.attrs?.colspan ?? 1);
27913
27920
  const colwidth = cell.attrs?.colwidth;
27914
27921
  return Array.from({ length: spanCount }).map((_$1, span) => Array.isArray(colwidth) ? colwidth[span] : void 0);
@@ -33821,7 +33828,7 @@ var SuperConverter = class SuperConverter {
33821
33828
  static getStoredSuperdocVersion(docx) {
33822
33829
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33823
33830
  }
33824
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.15.0-next.21") {
33831
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.15.0-next.23") {
33825
33832
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33826
33833
  }
33827
33834
  static generateWordTimestamp() {
@@ -1,5 +1,5 @@
1
1
  import { a as __toCommonJS, n as __esmMin, r as __export, t as __commonJSMin } from "./rolldown-runtime-B2q5OVn9.es.js";
2
- import { $ as TextSelection$1, A as findMark, At as Mark$1, B as defaultBlockAt$1, C as docxNumberingHelpers, Ct as TrackDeleteMarkName, D as posToDOMRect, Dt as DOMParser$1, E as isInTable, Et as carbonCopy, F as isMarkActive, Ft as getExtensionConfigField, G as createDocument, H as getNodeType, I as getMarkRange, J as NodeSelection, K as AllSelection, L as isTextSelection, M as isActive, Mt as Slice, N as isNodeActive, Nt as minMax, O as findChildren$1, Ot as DOMSerializer, P as getSchemaTypeNameByName, Pt as callOrGet, Q as SelectionRange, R as findParentNode, S as getResolvedParagraphProperties, St as getUnderlineCssString, T as CommandService, Tt as TrackInsertMarkName, U as cleanSchemaItem, V as getMarkType, W as getSchemaTypeByName, X as PluginKey, Y as Plugin, Z as Selection, _ as ListHelpers, _t as encodeMarksFromRPr, a as _getReferencedTableStyles, at as Transform, b as isList, bt as resolveRunProperties, c as processContent, ct as dropPoint, d as createCellBorders, dt as replaceStep$1, et as AddMarkStep, f as InputRule, ft as generateDocxRandomId, g as unflattenListsInHtml, gt as encodeCSSFromRPr, h as inputRulesPlugin, ht as encodeCSSFromPPr, it as ReplaceStep, j as getMarksFromSelection, jt as Schema$1, k as getActiveFormatting, kt as Fragment$1, l as createDocFromMarkdown, lt as joinPoint, m as htmlHandler, mt as decodeRPrFromMarks, n as kebabCase$1, nt as RemoveMarkStep, o as helpers_exports, ot as canJoin, p as handleClipboardPaste, pt as generateRandomSigned32BitIntStrId, q as EditorState, r as insertNewRelationship, rt as ReplaceAroundStep$1, s as updateDOMAttributes, st as canSplit, t as SuperConverter, tt as Mapping, u as createDocFromHTML, ut as liftTarget, v as changeListLevel, vt as resolveDocxFontFamily, w as generateOrderedListIndex, wt as TrackFormatMarkName, x as calculateResolvedParagraphProperties, xt as resolveTableCellProperties, y as updateNumberingProperties, yt as resolveParagraphProperties, z as findParentNodeClosestToPos } from "./SuperConverter-COoLmvOX.es.js";
2
+ import { $ as TextSelection$1, A as findMark, At as Mark$1, B as defaultBlockAt$1, C as docxNumberingHelpers, Ct as TrackDeleteMarkName, D as posToDOMRect, Dt as DOMParser$1, E as isInTable, Et as carbonCopy, F as isMarkActive, Ft as getExtensionConfigField, G as createDocument, H as getNodeType, I as getMarkRange, J as NodeSelection, K as AllSelection, L as isTextSelection, M as isActive, Mt as Slice, N as isNodeActive, Nt as minMax, O as findChildren$1, Ot as DOMSerializer, P as getSchemaTypeNameByName, Pt as callOrGet, Q as SelectionRange, R as findParentNode, S as getResolvedParagraphProperties, St as getUnderlineCssString, T as CommandService, Tt as TrackInsertMarkName, U as cleanSchemaItem, V as getMarkType, W as getSchemaTypeByName, X as PluginKey, Y as Plugin, Z as Selection, _ as ListHelpers, _t as encodeMarksFromRPr, a as _getReferencedTableStyles, at as Transform, b as isList, bt as resolveRunProperties, c as processContent, ct as dropPoint, d as createCellBorders, dt as replaceStep$1, et as AddMarkStep, f as InputRule, ft as generateDocxRandomId, g as unflattenListsInHtml, gt as encodeCSSFromRPr, h as inputRulesPlugin, ht as encodeCSSFromPPr, it as ReplaceStep, j as getMarksFromSelection, jt as Schema$1, k as getActiveFormatting, kt as Fragment$1, l as createDocFromMarkdown, lt as joinPoint, m as htmlHandler, mt as decodeRPrFromMarks, n as kebabCase$1, nt as RemoveMarkStep, o as helpers_exports, ot as canJoin, p as handleClipboardPaste, pt as generateRandomSigned32BitIntStrId, q as EditorState, r as insertNewRelationship, rt as ReplaceAroundStep$1, s as updateDOMAttributes, st as canSplit, t as SuperConverter, tt as Mapping, u as createDocFromHTML, ut as liftTarget, v as changeListLevel, vt as resolveDocxFontFamily, w as generateOrderedListIndex, wt as TrackFormatMarkName, x as calculateResolvedParagraphProperties, xt as resolveTableCellProperties, y as updateNumberingProperties, yt as resolveParagraphProperties, z as findParentNodeClosestToPos } from "./SuperConverter-C-cxnWyc.es.js";
3
3
  import { a as init_dist$2, i as global, n as init_dist, o as Buffer$3, r as process$1, s as init_dist$1 } from "./jszip-ChlR43oI.es.js";
4
4
  import { t as v4_default } from "./uuid-2IzDu5nl.es.js";
5
5
  import { A as twipsToLines, T as resolveOpcTargetPath, c as getArrayBufferFromUrl, f as halfPointToPoints, g as linesToTwips, j as twipsToPixels, k as twipsToInches, m as inchesToTwips, p as inchesToPixels, r as convertSizeToCSS, w as ptToTwips, x as pixelsToTwips } from "./helpers-BGD_wEOi.es.js";
@@ -242,7 +242,7 @@ var v_click_outside_default = {
242
242
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
243
243
  function getSuperdocVersion() {
244
244
  try {
245
- return "1.15.0-next.21";
245
+ return "1.15.0-next.23";
246
246
  } catch {
247
247
  return "unknown";
248
248
  }
@@ -20670,7 +20670,7 @@ const canUseDOM = () => {
20670
20670
  return false;
20671
20671
  }
20672
20672
  };
20673
- var summaryVersion = "1.15.0-next.21";
20673
+ var summaryVersion = "1.15.0-next.23";
20674
20674
  var nodeKeys = [
20675
20675
  "group",
20676
20676
  "content",
@@ -27068,7 +27068,7 @@ var Editor = class Editor extends EventEmitter$1 {
27068
27068
  return migrations.length > 0;
27069
27069
  }
27070
27070
  processCollaborationMigrations() {
27071
- console.debug("[checkVersionMigrations] Current editor version", "1.15.0-next.21");
27071
+ console.debug("[checkVersionMigrations] Current editor version", "1.15.0-next.23");
27072
27072
  if (!this.options.ydoc) return;
27073
27073
  let docVersion = this.options.ydoc.getMap("meta").get("version");
27074
27074
  if (!docVersion) docVersion = "initial";
@@ -65476,47 +65476,50 @@ function createNumberingPlugin(editor) {
65476
65476
  if (nextRev != null) tr.setNodeAttribute(pos, "sdBlockRev", nextRev);
65477
65477
  };
65478
65478
  numberingManager.enableCache();
65479
- newState.doc.descendants((node, pos) => {
65480
- let resolvedProps = calculateResolvedParagraphProperties(editor, node, newState.doc.resolve(pos));
65481
- if (node.type.name !== "paragraph" || !resolvedProps.numberingProperties) return;
65482
- const { numId, ilvl: level = 0 } = resolvedProps.numberingProperties;
65483
- const definitionDetails = ListHelpers.getListDefinitionDetails({
65484
- numId,
65485
- level,
65486
- editor
65487
- });
65488
- if (!definitionDetails || Object.keys(definitionDetails).length === 0) {
65489
- tr.setNodeAttribute(pos, "listRendering", null);
65490
- bumpBlockRev(node, pos);
65491
- return;
65492
- }
65493
- let { lvlText, customFormat, listNumberingType, suffix: suffix$1, justification, abstractId } = definitionDetails;
65494
- let markerText = "";
65495
- listNumberingType = listNumberingType || "decimal";
65496
- const count = numberingManager.calculateCounter(numId, level, pos, abstractId);
65497
- numberingManager.setCounter(numId, level, pos, count, abstractId);
65498
- const path = numberingManager.calculatePath(numId, level, pos);
65499
- if (listNumberingType !== "bullet") markerText = generateOrderedListIndex({
65500
- listLevel: path,
65501
- lvlText,
65502
- listNumberingType,
65503
- customFormat
65479
+ try {
65480
+ newState.doc.descendants((node, pos) => {
65481
+ let resolvedProps = calculateResolvedParagraphProperties(editor, node, newState.doc.resolve(pos));
65482
+ if (node.type.name !== "paragraph" || !resolvedProps.numberingProperties) return;
65483
+ const { numId, ilvl: level = 0 } = resolvedProps.numberingProperties;
65484
+ const definitionDetails = ListHelpers.getListDefinitionDetails({
65485
+ numId,
65486
+ level,
65487
+ editor
65488
+ });
65489
+ if (!definitionDetails || Object.keys(definitionDetails).length === 0) {
65490
+ tr.setNodeAttribute(pos, "listRendering", null);
65491
+ bumpBlockRev(node, pos);
65492
+ return;
65493
+ }
65494
+ let { lvlText, customFormat, listNumberingType, suffix: suffix$1, justification, abstractId } = definitionDetails;
65495
+ let markerText = "";
65496
+ listNumberingType = listNumberingType || "decimal";
65497
+ const count = numberingManager.calculateCounter(numId, level, pos, abstractId);
65498
+ numberingManager.setCounter(numId, level, pos, count, abstractId);
65499
+ const path = numberingManager.calculatePath(numId, level, pos);
65500
+ if (listNumberingType !== "bullet") markerText = generateOrderedListIndex({
65501
+ listLevel: path,
65502
+ lvlText,
65503
+ listNumberingType,
65504
+ customFormat
65505
+ }) ?? "";
65506
+ else markerText = docxNumberingHelpers.normalizeLvlTextChar(lvlText) ?? "";
65507
+ const newListRendering = {
65508
+ markerText,
65509
+ suffix: suffix$1,
65510
+ justification,
65511
+ path,
65512
+ numberingType: listNumberingType
65513
+ };
65514
+ if (JSON.stringify(node.attrs.listRendering) !== JSON.stringify(newListRendering)) {
65515
+ tr.setNodeAttribute(pos, "listRendering", newListRendering);
65516
+ bumpBlockRev(node, pos);
65517
+ }
65518
+ return false;
65504
65519
  });
65505
- else markerText = docxNumberingHelpers.normalizeLvlTextChar(lvlText);
65506
- const newListRendering = {
65507
- markerText,
65508
- suffix: suffix$1,
65509
- justification,
65510
- path,
65511
- numberingType: listNumberingType
65512
- };
65513
- if (JSON.stringify(node.attrs.listRendering) !== JSON.stringify(newListRendering)) {
65514
- tr.setNodeAttribute(pos, "listRendering", newListRendering);
65515
- bumpBlockRev(node, pos);
65516
- }
65517
- return false;
65518
- });
65519
- numberingManager.disableCache();
65520
+ } finally {
65521
+ numberingManager.disableCache();
65522
+ }
65520
65523
  return tr.docChanged ? tr : null;
65521
65524
  }
65522
65525
  });
@@ -67451,7 +67454,7 @@ const TableHeader = Node$1.create({
67451
67454
  colspan: { default: 1 },
67452
67455
  rowspan: { default: 1 },
67453
67456
  colwidth: {
67454
- default: null,
67457
+ default: [100],
67455
67458
  parseDOM: (element) => {
67456
67459
  const colwidth = element.getAttribute("data-colwidth");
67457
67460
  return colwidth ? colwidth.split(",").map((width) => parseInt(width, 10)) : null;
@@ -67461,10 +67464,46 @@ const TableHeader = Node$1.create({
67461
67464
  return { "data-colwidth": attrs.colwidth.join(",") };
67462
67465
  }
67463
67466
  },
67467
+ background: { renderDOM({ background }) {
67468
+ if (!background) return {};
67469
+ const { color } = background || {};
67470
+ return { style: `background-color: ${color ? `#${color}` : "transparent"}` };
67471
+ } },
67472
+ verticalAlign: { renderDOM({ verticalAlign }) {
67473
+ if (!verticalAlign) return {};
67474
+ return { style: `vertical-align: ${verticalAlign}` };
67475
+ } },
67476
+ cellMargins: { renderDOM({ cellMargins, borders }) {
67477
+ if (!cellMargins) return {};
67478
+ return { style: [
67479
+ "top",
67480
+ "right",
67481
+ "bottom",
67482
+ "left"
67483
+ ].map((side) => {
67484
+ const margin = cellMargins?.[side] ?? 0;
67485
+ const border = borders?.[side];
67486
+ const borderSize = border && border.val !== "none" ? Math.ceil(border.size) : 0;
67487
+ if (margin) return `padding-${side}: ${Math.max(0, margin - borderSize)}px;`;
67488
+ return "";
67489
+ }).join(" ") };
67490
+ } },
67464
67491
  borders: {
67465
67492
  default: () => createCellBorders(),
67466
67493
  renderDOM: ({ borders }) => renderCellBorderStyle(borders)
67467
67494
  },
67495
+ widthType: {
67496
+ default: "auto",
67497
+ rendered: false
67498
+ },
67499
+ widthUnit: {
67500
+ default: "px",
67501
+ rendered: false
67502
+ },
67503
+ tableCellProperties: {
67504
+ default: null,
67505
+ rendered: false
67506
+ },
67468
67507
  __placeholder: {
67469
67508
  default: null,
67470
67509
  parseDOM: (element) => {
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-Dp2H1eGw.cjs");
2
- const require_SuperConverter = require("./SuperConverter-_Cck79uC.cjs");
2
+ const require_SuperConverter = require("./SuperConverter-Db4VUCfD.cjs");
3
3
  const require_jszip = require("./jszip-DCT9QYaK.cjs");
4
4
  const require_uuid = require("./uuid-CHj_rjgt.cjs");
5
5
  const require_helpers = require("./helpers-Cs_Zz44i.cjs");
@@ -243,7 +243,7 @@ var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
243
243
  const COMMUNITY_LICENSE_KEY = "community-and-eval-agplv3";
244
244
  function getSuperdocVersion() {
245
245
  try {
246
- return "1.15.0-next.21";
246
+ return "1.15.0-next.23";
247
247
  } catch {
248
248
  return "unknown";
249
249
  }
@@ -20689,7 +20689,7 @@ const canUseDOM = () => {
20689
20689
  return false;
20690
20690
  }
20691
20691
  };
20692
- var summaryVersion = "1.15.0-next.21";
20692
+ var summaryVersion = "1.15.0-next.23";
20693
20693
  var nodeKeys = [
20694
20694
  "group",
20695
20695
  "content",
@@ -27305,7 +27305,7 @@ var Editor = class Editor extends EventEmitter$1 {
27305
27305
  return migrations.length > 0;
27306
27306
  }
27307
27307
  processCollaborationMigrations() {
27308
- console.debug("[checkVersionMigrations] Current editor version", "1.15.0-next.21");
27308
+ console.debug("[checkVersionMigrations] Current editor version", "1.15.0-next.23");
27309
27309
  if (!this.options.ydoc) return;
27310
27310
  let docVersion = this.options.ydoc.getMap("meta").get("version");
27311
27311
  if (!docVersion) docVersion = "initial";
@@ -65744,47 +65744,50 @@ function createNumberingPlugin(editor) {
65744
65744
  if (nextRev != null) tr.setNodeAttribute(pos, "sdBlockRev", nextRev);
65745
65745
  };
65746
65746
  numberingManager.enableCache();
65747
- newState.doc.descendants((node, pos) => {
65748
- let resolvedProps = require_SuperConverter.calculateResolvedParagraphProperties(editor, node, newState.doc.resolve(pos));
65749
- if (node.type.name !== "paragraph" || !resolvedProps.numberingProperties) return;
65750
- const { numId, ilvl: level = 0 } = resolvedProps.numberingProperties;
65751
- const definitionDetails = require_SuperConverter.ListHelpers.getListDefinitionDetails({
65752
- numId,
65753
- level,
65754
- editor
65755
- });
65756
- if (!definitionDetails || Object.keys(definitionDetails).length === 0) {
65757
- tr.setNodeAttribute(pos, "listRendering", null);
65758
- bumpBlockRev(node, pos);
65759
- return;
65760
- }
65761
- let { lvlText, customFormat, listNumberingType, suffix: suffix$1, justification, abstractId } = definitionDetails;
65762
- let markerText = "";
65763
- listNumberingType = listNumberingType || "decimal";
65764
- const count = numberingManager.calculateCounter(numId, level, pos, abstractId);
65765
- numberingManager.setCounter(numId, level, pos, count, abstractId);
65766
- const path = numberingManager.calculatePath(numId, level, pos);
65767
- if (listNumberingType !== "bullet") markerText = require_SuperConverter.generateOrderedListIndex({
65768
- listLevel: path,
65769
- lvlText,
65770
- listNumberingType,
65771
- customFormat
65747
+ try {
65748
+ newState.doc.descendants((node, pos) => {
65749
+ let resolvedProps = require_SuperConverter.calculateResolvedParagraphProperties(editor, node, newState.doc.resolve(pos));
65750
+ if (node.type.name !== "paragraph" || !resolvedProps.numberingProperties) return;
65751
+ const { numId, ilvl: level = 0 } = resolvedProps.numberingProperties;
65752
+ const definitionDetails = require_SuperConverter.ListHelpers.getListDefinitionDetails({
65753
+ numId,
65754
+ level,
65755
+ editor
65756
+ });
65757
+ if (!definitionDetails || Object.keys(definitionDetails).length === 0) {
65758
+ tr.setNodeAttribute(pos, "listRendering", null);
65759
+ bumpBlockRev(node, pos);
65760
+ return;
65761
+ }
65762
+ let { lvlText, customFormat, listNumberingType, suffix: suffix$1, justification, abstractId } = definitionDetails;
65763
+ let markerText = "";
65764
+ listNumberingType = listNumberingType || "decimal";
65765
+ const count = numberingManager.calculateCounter(numId, level, pos, abstractId);
65766
+ numberingManager.setCounter(numId, level, pos, count, abstractId);
65767
+ const path = numberingManager.calculatePath(numId, level, pos);
65768
+ if (listNumberingType !== "bullet") markerText = require_SuperConverter.generateOrderedListIndex({
65769
+ listLevel: path,
65770
+ lvlText,
65771
+ listNumberingType,
65772
+ customFormat
65773
+ }) ?? "";
65774
+ else markerText = require_SuperConverter.docxNumberingHelpers.normalizeLvlTextChar(lvlText) ?? "";
65775
+ const newListRendering = {
65776
+ markerText,
65777
+ suffix: suffix$1,
65778
+ justification,
65779
+ path,
65780
+ numberingType: listNumberingType
65781
+ };
65782
+ if (JSON.stringify(node.attrs.listRendering) !== JSON.stringify(newListRendering)) {
65783
+ tr.setNodeAttribute(pos, "listRendering", newListRendering);
65784
+ bumpBlockRev(node, pos);
65785
+ }
65786
+ return false;
65772
65787
  });
65773
- else markerText = require_SuperConverter.docxNumberingHelpers.normalizeLvlTextChar(lvlText);
65774
- const newListRendering = {
65775
- markerText,
65776
- suffix: suffix$1,
65777
- justification,
65778
- path,
65779
- numberingType: listNumberingType
65780
- };
65781
- if (JSON.stringify(node.attrs.listRendering) !== JSON.stringify(newListRendering)) {
65782
- tr.setNodeAttribute(pos, "listRendering", newListRendering);
65783
- bumpBlockRev(node, pos);
65784
- }
65785
- return false;
65786
- });
65787
- numberingManager.disableCache();
65788
+ } finally {
65789
+ numberingManager.disableCache();
65790
+ }
65788
65791
  return tr.docChanged ? tr : null;
65789
65792
  }
65790
65793
  });
@@ -67719,7 +67722,7 @@ const TableHeader = Node$1.create({
67719
67722
  colspan: { default: 1 },
67720
67723
  rowspan: { default: 1 },
67721
67724
  colwidth: {
67722
- default: null,
67725
+ default: [100],
67723
67726
  parseDOM: (element) => {
67724
67727
  const colwidth = element.getAttribute("data-colwidth");
67725
67728
  return colwidth ? colwidth.split(",").map((width) => parseInt(width, 10)) : null;
@@ -67729,10 +67732,46 @@ const TableHeader = Node$1.create({
67729
67732
  return { "data-colwidth": attrs.colwidth.join(",") };
67730
67733
  }
67731
67734
  },
67735
+ background: { renderDOM({ background }) {
67736
+ if (!background) return {};
67737
+ const { color } = background || {};
67738
+ return { style: `background-color: ${color ? `#${color}` : "transparent"}` };
67739
+ } },
67740
+ verticalAlign: { renderDOM({ verticalAlign }) {
67741
+ if (!verticalAlign) return {};
67742
+ return { style: `vertical-align: ${verticalAlign}` };
67743
+ } },
67744
+ cellMargins: { renderDOM({ cellMargins, borders }) {
67745
+ if (!cellMargins) return {};
67746
+ return { style: [
67747
+ "top",
67748
+ "right",
67749
+ "bottom",
67750
+ "left"
67751
+ ].map((side) => {
67752
+ const margin = cellMargins?.[side] ?? 0;
67753
+ const border = borders?.[side];
67754
+ const borderSize = border && border.val !== "none" ? Math.ceil(border.size) : 0;
67755
+ if (margin) return `padding-${side}: ${Math.max(0, margin - borderSize)}px;`;
67756
+ return "";
67757
+ }).join(" ") };
67758
+ } },
67732
67759
  borders: {
67733
67760
  default: () => require_SuperConverter.createCellBorders(),
67734
67761
  renderDOM: ({ borders }) => renderCellBorderStyle(borders)
67735
67762
  },
67763
+ widthType: {
67764
+ default: "auto",
67765
+ rendered: false
67766
+ },
67767
+ widthUnit: {
67768
+ default: "px",
67769
+ rendered: false
67770
+ },
67771
+ tableCellProperties: {
67772
+ default: null,
67773
+ rendered: false
67774
+ },
67736
67775
  __placeholder: {
67737
67776
  default: null,
67738
67777
  parseDOM: (element) => {
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("../chunks/rolldown-runtime-Dp2H1eGw.cjs");
3
- const require_SuperConverter = require("../chunks/SuperConverter-_Cck79uC.cjs");
3
+ const require_SuperConverter = require("../chunks/SuperConverter-Db4VUCfD.cjs");
4
4
  require("../chunks/jszip-DCT9QYaK.cjs");
5
5
  require("../chunks/xml-js--DznO7Gk.cjs");
6
6
  require("../chunks/helpers-Cs_Zz44i.cjs");
@@ -1,4 +1,4 @@
1
- import { t as SuperConverter } from "../chunks/SuperConverter-COoLmvOX.es.js";
1
+ import { t as SuperConverter } from "../chunks/SuperConverter-C-cxnWyc.es.js";
2
2
  import "../chunks/jszip-ChlR43oI.es.js";
3
3
  import "../chunks/xml-js-DLE8mr0n.es.js";
4
4
  import "../chunks/helpers-BGD_wEOi.es.js";
@@ -1 +1 @@
1
- {"version":3,"file":"translate-table-cell.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../super-editor/src/core/super-converter/v3/handlers/w/tc/helpers/translate-table-cell.js"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,2CAHW,OAAO,qBAAqB,EAAE,YAAY,GACxC,OAAO,qBAAqB,EAAE,YAAY,CAetD;AAED;;;;GAIG;AACH,kDAHW,OAAO,qBAAqB,EAAE,UAAU,GACtC,OAAO,qBAAqB,EAAE,YAAY,CAsGtD"}
1
+ {"version":3,"file":"translate-table-cell.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../super-editor/src/core/super-converter/v3/handlers/w/tc/helpers/translate-table-cell.js"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,2CAHW,OAAO,qBAAqB,EAAE,YAAY,GACxC,OAAO,qBAAqB,EAAE,YAAY,CAetD;AAED;;;;GAIG;AACH,kDAHW,OAAO,qBAAqB,EAAE,UAAU,GACtC,OAAO,qBAAqB,EAAE,YAAY,CAmHtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"numberingPlugin.d.ts","sourceRoot":"","sources":["../../../../../../super-editor/src/extensions/paragraph/numberingPlugin.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,8CAHW,OAAO,mBAAmB,EAAE,MAAM,GAChC,OAAO,mBAAmB,EAAE,MAAM,CA4P9C"}
1
+ {"version":3,"file":"numberingPlugin.d.ts","sourceRoot":"","sources":["../../../../../../super-editor/src/extensions/paragraph/numberingPlugin.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,8CAHW,OAAO,mBAAmB,EAAE,MAAM,GAChC,OAAO,mBAAmB,EAAE,MAAM,CAgQ9C"}
@@ -11,8 +11,14 @@ import { Node } from '../../core/index.js';
11
11
  * @category Attributes
12
12
  * @property {number} [colspan=1] - Number of columns this header spans
13
13
  * @property {number} [rowspan=1] - Number of rows this header spans
14
- * @property {number[]} [colwidth] - Column widths array in pixels
14
+ * @property {number[]} [colwidth=[100]] - Column widths array in pixels
15
+ * @property {import('../table-cell/table-cell.js').CellBackground} [background] - Cell background color configuration
16
+ * @property {string} [verticalAlign] - Vertical content alignment (top, middle, bottom)
17
+ * @property {import('../table-cell/table-cell.js').CellMargins} [cellMargins] - Internal cell padding
15
18
  * @property {import('../table-cell/helpers/createCellBorders.js').CellBorders} [borders] - Cell border configuration
19
+ * @property {string} [widthType='auto'] @internal - Internal width type
20
+ * @property {string} [widthUnit='px'] @internal - Internal width unit
21
+ * @property {import('../table-cell/table-cell.js').TableCellProperties} [tableCellProperties] @internal - Raw OOXML cell properties
16
22
  */
17
23
  /**
18
24
  * @module TableHeader
@@ -1 +1 @@
1
- {"version":3,"file":"table-header.d.ts","sourceRoot":"","sources":["../../../../../../super-editor/src/extensions/table-header/table-header.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AAEH;;;;;;;;GAQG;AAEH;;;;GAIG;AACH,sGAuEG;;;;iCA3FU,MAAM;;;;oCAON,MAAM;qBAba,gBAAgB"}
1
+ {"version":3,"file":"table-header.d.ts","sourceRoot":"","sources":["../../../../../../super-editor/src/extensions/table-header/table-header.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AAEH;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AACH,sGA0HG;;;;iCApJU,MAAM;;;;oCAON,MAAM;qBAba,gBAAgB"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./chunks/rolldown-runtime-Dp2H1eGw.cjs");
3
- const require_src = require("./chunks/src--QIS17Yo.cjs");
4
- const require_SuperConverter = require("./chunks/SuperConverter-_Cck79uC.cjs");
3
+ const require_src = require("./chunks/src-pRQaMu4o.cjs");
4
+ const require_SuperConverter = require("./chunks/SuperConverter-Db4VUCfD.cjs");
5
5
  require("./chunks/jszip-DCT9QYaK.cjs");
6
6
  require("./chunks/xml-js--DznO7Gk.cjs");
7
7
  require("./chunks/helpers-Cs_Zz44i.cjs");
@@ -1,5 +1,5 @@
1
- import { $ as getAllowedImageDimensions, Bt as isMarkType, Ht as isNodeType, Q as trackChangesHelpers_exports, Rt as defineMark, Vt as assertNodeType, X as getRichTextExtensions, Y as AIWriter_default, Z as getStarterExtensions, a as BasicUpload_default, at as CommentsPluginKey, c as Toolbar_default, et as SectionHelpers, i as SuperEditor_default, it as AnnotatorHelpers, n as SlashMenu, nt as Editor, o as ContextMenu_default, ot as TrackChangesBasePluginKey, r as SuperInput_default, rt as fieldAnnotationHelpers_exports, s as SuperToolbar, t as Extensions, tt as PresentationEditor, zt as defineNode } from "./chunks/src-CixJzTzq.es.js";
2
- import { i as registeredHandlers, j as getMarksFromSelection, k as getActiveFormatting, o as helpers_exports, t as SuperConverter } from "./chunks/SuperConverter-COoLmvOX.es.js";
1
+ import { $ as getAllowedImageDimensions, Bt as isMarkType, Ht as isNodeType, Q as trackChangesHelpers_exports, Rt as defineMark, Vt as assertNodeType, X as getRichTextExtensions, Y as AIWriter_default, Z as getStarterExtensions, a as BasicUpload_default, at as CommentsPluginKey, c as Toolbar_default, et as SectionHelpers, i as SuperEditor_default, it as AnnotatorHelpers, n as SlashMenu, nt as Editor, o as ContextMenu_default, ot as TrackChangesBasePluginKey, r as SuperInput_default, rt as fieldAnnotationHelpers_exports, s as SuperToolbar, t as Extensions, tt as PresentationEditor, zt as defineNode } from "./chunks/src-B_UiMQx-.es.js";
2
+ import { i as registeredHandlers, j as getMarksFromSelection, k as getActiveFormatting, o as helpers_exports, t as SuperConverter } from "./chunks/SuperConverter-C-cxnWyc.es.js";
3
3
  import "./chunks/jszip-ChlR43oI.es.js";
4
4
  import "./chunks/xml-js-DLE8mr0n.es.js";
5
5
  import "./chunks/helpers-BGD_wEOi.es.js";
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./chunks/rolldown-runtime-Dp2H1eGw.cjs");
3
- const require_src = require("./chunks/src--QIS17Yo.cjs");
4
- const require_SuperConverter = require("./chunks/SuperConverter-_Cck79uC.cjs");
3
+ const require_src = require("./chunks/src-pRQaMu4o.cjs");
4
+ const require_SuperConverter = require("./chunks/SuperConverter-Db4VUCfD.cjs");
5
5
  const require_jszip = require("./chunks/jszip-DCT9QYaK.cjs");
6
6
  require("./chunks/xml-js--DznO7Gk.cjs");
7
7
  const require_uuid = require("./chunks/uuid-CHj_rjgt.cjs");
@@ -19904,7 +19904,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
19904
19904
  this.config.colors = shuffleArray(this.config.colors);
19905
19905
  this.userColorMap = /* @__PURE__ */ new Map();
19906
19906
  this.colorIndex = 0;
19907
- this.version = "1.15.0-next.21";
19907
+ this.version = "1.15.0-next.23";
19908
19908
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
19909
19909
  this.superdocId = config.superdocId || require_uuid.v4_default();
19910
19910
  this.colors = this.config.colors;
@@ -1,5 +1,5 @@
1
- import { A as isMounted, At as writeVarUint, B as cNotM, C as resolveWrappedSlot, Ct as createDecoder, D as warnOnce, Dt as createEncoder, E as throwError, Et as readVarUint8Array, F as changeColor, Ft as v_click_outside_default, G as ellipsis_vertical_solid_default, H as insideModal, I as c, It as getFileObject, J as comment_solid_default, K as xmark_solid_default, L as cB, Lt as comments_module_events, M as use_memo_default, Mt as create, N as on, Nt as min, O as useSsrAdapter, Ot as length, P as createId, Pt as pow, Q as trackChangesHelpers_exports, R as cE, S as configProviderInjectionKey, St as getUnixTime, T as call, Tt as readVarUint, U as insidePopover, V as createKey, W as caret_down_solid_default, X as getRichTextExtensions, Y as AIWriter_default, Z as getStarterExtensions, _ as useRtl, _t as encodeAwarenessUpdate, at as CommentsPluginKey, b as useThemeClass, bt as ObservableV2, ct as createUint8ArrayFromArrayBuffer, d as Dropdown_default, dt as isNode, et as SectionHelpers, f as ConfigProvider_default, ft as offChange, g as _common_default$2, gt as applyAwarenessUpdate, h as index_cssr_default$5, ht as Awareness, i as SuperEditor_default, it as AnnotatorHelpers, j as useMergedState, jt as writeVarUint8Array, k as createInjectionKey, kt as toUint8Array, l as messageApiInjectionKey, lt as fromBase64, m as use_theme_default, mt as varStorage, nt as Editor, ot as TrackChangesBasePluginKey, p as light_default$1, pt as onChange, q as check_solid_default, r as SuperInput_default, rt as fieldAnnotationHelpers_exports, s as SuperToolbar, st as getTrackChanges, t as Extensions, tt as PresentationEditor, u as messageProviderInjectionKey, ut as toBase64, v as cssrAnchorMetaName, vt as removeAwarenessStates, w as render, wt as readVarString, x as useConfig, xt as setIfUndefined, y as toString_default, yt as map, z as cM } from "./chunks/src-CixJzTzq.es.js";
2
- import { i as registeredHandlers, o as helpers_exports, t as SuperConverter } from "./chunks/SuperConverter-COoLmvOX.es.js";
1
+ import { A as isMounted, At as writeVarUint, B as cNotM, C as resolveWrappedSlot, Ct as createDecoder, D as warnOnce, Dt as createEncoder, E as throwError, Et as readVarUint8Array, F as changeColor, Ft as v_click_outside_default, G as ellipsis_vertical_solid_default, H as insideModal, I as c, It as getFileObject, J as comment_solid_default, K as xmark_solid_default, L as cB, Lt as comments_module_events, M as use_memo_default, Mt as create, N as on, Nt as min, O as useSsrAdapter, Ot as length, P as createId, Pt as pow, Q as trackChangesHelpers_exports, R as cE, S as configProviderInjectionKey, St as getUnixTime, T as call, Tt as readVarUint, U as insidePopover, V as createKey, W as caret_down_solid_default, X as getRichTextExtensions, Y as AIWriter_default, Z as getStarterExtensions, _ as useRtl, _t as encodeAwarenessUpdate, at as CommentsPluginKey, b as useThemeClass, bt as ObservableV2, ct as createUint8ArrayFromArrayBuffer, d as Dropdown_default, dt as isNode, et as SectionHelpers, f as ConfigProvider_default, ft as offChange, g as _common_default$2, gt as applyAwarenessUpdate, h as index_cssr_default$5, ht as Awareness, i as SuperEditor_default, it as AnnotatorHelpers, j as useMergedState, jt as writeVarUint8Array, k as createInjectionKey, kt as toUint8Array, l as messageApiInjectionKey, lt as fromBase64, m as use_theme_default, mt as varStorage, nt as Editor, ot as TrackChangesBasePluginKey, p as light_default$1, pt as onChange, q as check_solid_default, r as SuperInput_default, rt as fieldAnnotationHelpers_exports, s as SuperToolbar, st as getTrackChanges, t as Extensions, tt as PresentationEditor, u as messageProviderInjectionKey, ut as toBase64, v as cssrAnchorMetaName, vt as removeAwarenessStates, w as render, wt as readVarString, x as useConfig, xt as setIfUndefined, y as toString_default, yt as map, z as cM } from "./chunks/src-B_UiMQx-.es.js";
2
+ import { i as registeredHandlers, o as helpers_exports, t as SuperConverter } from "./chunks/SuperConverter-C-cxnWyc.es.js";
3
3
  import { a as init_dist$1, i as global, n as init_dist, r as process$1 } from "./chunks/jszip-ChlR43oI.es.js";
4
4
  import "./chunks/xml-js-DLE8mr0n.es.js";
5
5
  import { t as v4_default } from "./chunks/uuid-2IzDu5nl.es.js";
@@ -19863,7 +19863,7 @@ var SuperDoc = class extends import_eventemitter3.default {
19863
19863
  this.config.colors = shuffleArray(this.config.colors);
19864
19864
  this.userColorMap = /* @__PURE__ */ new Map();
19865
19865
  this.colorIndex = 0;
19866
- this.version = "1.15.0-next.21";
19866
+ this.version = "1.15.0-next.23";
19867
19867
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
19868
19868
  this.superdocId = config.superdocId || v4_default();
19869
19869
  this.colors = this.config.colors;