@superdoc-dev/cli 0.2.0-next.61 → 0.2.0-next.63

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 (2) hide show
  1. package/dist/index.js +422 -154
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -30514,7 +30514,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
30514
30514
  emptyOptions2 = {};
30515
30515
  });
30516
30516
 
30517
- // ../../packages/superdoc/dist/chunks/SuperConverter-Ba_l6vso.es.js
30517
+ // ../../packages/superdoc/dist/chunks/SuperConverter-C1hZYQNS.es.js
30518
30518
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
30519
30519
  const fieldValue = extension$1.config[field];
30520
30520
  if (typeof fieldValue === "function")
@@ -34892,21 +34892,56 @@ function resolveDocxFontFamily(attributes, docx, toCssFontFamily) {
34892
34892
  return toCssFontFamily(resolved, docx ?? undefined);
34893
34893
  return resolved;
34894
34894
  }
34895
+ function resolveEffectiveBandSizes(styleId, translatedLinkedStyles) {
34896
+ const seen = /* @__PURE__ */ new Set;
34897
+ let currentId = styleId;
34898
+ let rowBandSize;
34899
+ let colBandSize;
34900
+ while (currentId && !seen.has(currentId)) {
34901
+ seen.add(currentId);
34902
+ const def = translatedLinkedStyles.styles?.[currentId];
34903
+ const tblProps = def?.tableProperties;
34904
+ if (rowBandSize == null && tblProps?.tableStyleRowBandSize != null)
34905
+ rowBandSize = tblProps.tableStyleRowBandSize;
34906
+ if (colBandSize == null && tblProps?.tableStyleColBandSize != null)
34907
+ colBandSize = tblProps.tableStyleColBandSize;
34908
+ if (rowBandSize != null && colBandSize != null)
34909
+ break;
34910
+ currentId = def?.basedOn;
34911
+ }
34912
+ return {
34913
+ rowBandSize: rowBandSize ?? 1,
34914
+ colBandSize: colBandSize ?? 1
34915
+ };
34916
+ }
34917
+ function resolveConditionalProps(propertyType, styleType, styleId, translatedLinkedStyles) {
34918
+ const chain = [];
34919
+ const seen = /* @__PURE__ */ new Set;
34920
+ let currentId = styleId;
34921
+ while (currentId && !seen.has(currentId)) {
34922
+ seen.add(currentId);
34923
+ const def = translatedLinkedStyles.styles?.[currentId];
34924
+ const props = def?.tableStyleProperties?.[styleType]?.[propertyType];
34925
+ if (props)
34926
+ chain.push(props);
34927
+ currentId = def?.basedOn;
34928
+ }
34929
+ if (chain.length === 0)
34930
+ return;
34931
+ chain.reverse();
34932
+ return combineProperties(chain);
34933
+ }
34895
34934
  function resolveCellStyles(propertyType, tableInfo, translatedLinkedStyles) {
34896
34935
  if (tableInfo == null || !tableInfo.tableProperties?.tableStyleId)
34897
34936
  return [];
34898
34937
  const cellStyleProps = [];
34899
- if (tableInfo != null && tableInfo.tableProperties.tableStyleId) {
34900
- const tableStyleDef = translatedLinkedStyles.styles[tableInfo.tableProperties.tableStyleId];
34901
- const tableStylePropsDef = tableStyleDef?.tableProperties;
34902
- const rowBandSize = tableStylePropsDef?.tableStyleRowBandSize ?? 1;
34903
- const colBandSize = tableStylePropsDef?.tableStyleColBandSize ?? 1;
34904
- determineCellStyleTypes(tableInfo.tableProperties?.tblLook, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize).forEach((styleType) => {
34905
- const typeProps = tableStyleDef?.tableStyleProperties?.[styleType]?.[propertyType];
34906
- if (typeProps)
34907
- cellStyleProps.push(typeProps);
34908
- });
34909
- }
34938
+ const tableStyleId = tableInfo.tableProperties.tableStyleId;
34939
+ const { rowBandSize, colBandSize } = resolveEffectiveBandSizes(tableStyleId, translatedLinkedStyles);
34940
+ determineCellStyleTypes(tableInfo.tableProperties?.tblLook ?? DEFAULT_TBL_LOOK, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize, tableInfo.rowCnfStyle, tableInfo.cellCnfStyle).forEach((styleType) => {
34941
+ const typeProps = resolveConditionalProps(propertyType, styleType, tableStyleId, translatedLinkedStyles);
34942
+ if (typeProps)
34943
+ cellStyleProps.push(typeProps);
34944
+ });
34910
34945
  return cellStyleProps;
34911
34946
  }
34912
34947
  function resolveTableCellProperties(inlineProps, tableInfo, translatedLinkedStyles) {
@@ -34920,8 +34955,8 @@ function resolveTableCellProperties(inlineProps, tableInfo, translatedLinkedStyl
34920
34955
  chain.push(inlineProps);
34921
34956
  return combineProperties(chain, { fullOverrideProps: ["shading"] });
34922
34957
  }
34923
- function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1) {
34924
- const styleTypes = ["wholeTable"];
34958
+ function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1, rowCnfStyle, cellCnfStyle) {
34959
+ const applicable = new Set(["wholeTable"]);
34925
34960
  const normalizedRowBandSize = rowBandSize > 0 ? rowBandSize : 1;
34926
34961
  const normalizedColBandSize = colBandSize > 0 ? colBandSize : 1;
34927
34962
  const bandRowIndex = Math.max(0, rowIndex - (tblLook?.firstRow ? 1 : 0));
@@ -34929,32 +34964,33 @@ function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells
34929
34964
  const rowGroup = Math.floor(bandRowIndex / normalizedRowBandSize);
34930
34965
  const colGroup = Math.floor(bandColIndex / normalizedColBandSize);
34931
34966
  if (!tblLook?.noHBand)
34932
- if (rowGroup % 2 === 0)
34933
- styleTypes.push("band1Horz");
34934
- else
34935
- styleTypes.push("band2Horz");
34967
+ applicable.add(rowGroup % 2 === 0 ? "band1Horz" : "band2Horz");
34936
34968
  if (!tblLook?.noVBand)
34937
- if (colGroup % 2 === 0)
34938
- styleTypes.push("band1Vert");
34939
- else
34940
- styleTypes.push("band2Vert");
34969
+ applicable.add(colGroup % 2 === 0 ? "band1Vert" : "band2Vert");
34941
34970
  if (tblLook?.firstRow && rowIndex === 0)
34942
- styleTypes.push("firstRow");
34971
+ applicable.add("firstRow");
34943
34972
  if (tblLook?.firstColumn && cellIndex === 0)
34944
- styleTypes.push("firstCol");
34973
+ applicable.add("firstCol");
34945
34974
  if (tblLook?.lastRow && numRows != null && numRows > 0 && rowIndex === numRows - 1)
34946
- styleTypes.push("lastRow");
34975
+ applicable.add("lastRow");
34947
34976
  if (tblLook?.lastColumn && numCells != null && numCells > 0 && cellIndex === numCells - 1)
34948
- styleTypes.push("lastCol");
34977
+ applicable.add("lastCol");
34949
34978
  if (rowIndex === 0 && cellIndex === 0)
34950
- styleTypes.push("nwCell");
34979
+ applicable.add("nwCell");
34951
34980
  if (rowIndex === 0 && numCells != null && numCells > 0 && cellIndex === numCells - 1)
34952
- styleTypes.push("neCell");
34981
+ applicable.add("neCell");
34953
34982
  if (numRows != null && numRows > 0 && rowIndex === numRows - 1 && cellIndex === 0)
34954
- styleTypes.push("swCell");
34983
+ applicable.add("swCell");
34955
34984
  if (numRows != null && numRows > 0 && numCells != null && numCells > 0 && rowIndex === numRows - 1 && cellIndex === numCells - 1)
34956
- styleTypes.push("seCell");
34957
- return styleTypes;
34985
+ applicable.add("seCell");
34986
+ if (rowCnfStyle || cellCnfStyle)
34987
+ for (const [flag, styleType] of CNF_STYLE_MAP) {
34988
+ const rowFlag = rowCnfStyle?.[flag];
34989
+ const cellFlag = cellCnfStyle?.[flag];
34990
+ if (rowFlag === true || cellFlag === true)
34991
+ applicable.add(styleType);
34992
+ }
34993
+ return TABLE_STYLE_PRECEDENCE.filter((t) => applicable.has(t));
34958
34994
  }
34959
34995
  function encodeMarksFromRPr(runProperties, docx) {
34960
34996
  if (!runProperties || typeof runProperties !== "object")
@@ -49782,7 +49818,7 @@ var isRegExp = (value) => {
49782
49818
  return true;
49783
49819
  }, areAttrsEqual = (attrsA = {}, attrsB = {}) => {
49784
49820
  return objectIncludes(attrsA, attrsB);
49785
- }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TABLE_STYLE_ID_TABLE_GRID = "TableGrid", TABLE_FALLBACK_BORDER, TABLE_FALLBACK_BORDERS, TABLE_FALLBACK_CELL_PADDING, getToCssFontFamily = () => {
49821
+ }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TABLE_STYLE_ID_TABLE_GRID = "TableGrid", TABLE_FALLBACK_BORDER, TABLE_FALLBACK_BORDERS, TABLE_FALLBACK_CELL_PADDING, DEFAULT_TBL_LOOK, CNF_STYLE_MAP, TABLE_STYLE_PRECEDENCE, getToCssFontFamily = () => {
49786
49822
  return SuperConverter.toCssFontFamily;
49787
49823
  }, SUBSCRIPT_SUPERSCRIPT_SCALE = 0.65, getSpacingStyle = (spacing, isListItem) => {
49788
49824
  let { before, after, line, lineRule, beforeAutospacing, afterAutospacing } = spacing;
@@ -60887,7 +60923,7 @@ var isRegExp = (value) => {
60887
60923
  state.kern = kernNode.attributes["w:val"];
60888
60924
  }
60889
60925
  }, SuperConverter;
60890
- var init_SuperConverter_Ba_l6vso_es = __esm(() => {
60926
+ var init_SuperConverter_C1hZYQNS_es = __esm(() => {
60891
60927
  init_rolldown_runtime_B2q5OVn9_es();
60892
60928
  init_jszip_ChlR43oI_es();
60893
60929
  init_xml_js_DLE8mr0n_es();
@@ -69073,6 +69109,43 @@ var init_SuperConverter_Ba_l6vso_es = __esm(() => {
69073
69109
  left: 108,
69074
69110
  right: 108
69075
69111
  };
69112
+ DEFAULT_TBL_LOOK = {
69113
+ firstRow: true,
69114
+ lastRow: false,
69115
+ firstColumn: true,
69116
+ lastColumn: false,
69117
+ noHBand: false,
69118
+ noVBand: true
69119
+ };
69120
+ CNF_STYLE_MAP = [
69121
+ ["oddHBand", "band1Horz"],
69122
+ ["evenHBand", "band2Horz"],
69123
+ ["oddVBand", "band1Vert"],
69124
+ ["evenVBand", "band2Vert"],
69125
+ ["firstRow", "firstRow"],
69126
+ ["firstColumn", "firstCol"],
69127
+ ["lastRow", "lastRow"],
69128
+ ["lastColumn", "lastCol"],
69129
+ ["firstRowFirstColumn", "nwCell"],
69130
+ ["firstRowLastColumn", "neCell"],
69131
+ ["lastRowFirstColumn", "swCell"],
69132
+ ["lastRowLastColumn", "seCell"]
69133
+ ];
69134
+ TABLE_STYLE_PRECEDENCE = [
69135
+ "wholeTable",
69136
+ "band1Horz",
69137
+ "band2Horz",
69138
+ "band1Vert",
69139
+ "band2Vert",
69140
+ "firstCol",
69141
+ "lastCol",
69142
+ "firstRow",
69143
+ "lastRow",
69144
+ "nwCell",
69145
+ "neCell",
69146
+ "swCell",
69147
+ "seCell"
69148
+ ];
69076
69149
  SUPPORTED_ALTERNATE_CONTENT_REQUIRES = new Set([
69077
69150
  "wps",
69078
69151
  "wpg",
@@ -105714,9 +105787,9 @@ var init_remark_gfm_CQ3Jg4PR_es = __esm(() => {
105714
105787
  init_remark_gfm_z_sDF4ss_es();
105715
105788
  });
105716
105789
 
105717
- // ../../packages/superdoc/dist/chunks/src-B2ASTVlZ.es.js
105718
- var exports_src_B2ASTVlZ_es = {};
105719
- __export(exports_src_B2ASTVlZ_es, {
105790
+ // ../../packages/superdoc/dist/chunks/src-B1yNdREj.es.js
105791
+ var exports_src_B1yNdREj_es = {};
105792
+ __export(exports_src_B1yNdREj_es, {
105720
105793
  zt: () => defineMark,
105721
105794
  z: () => cM,
105722
105795
  yt: () => removeAwarenessStates,
@@ -144796,9 +144869,22 @@ function normalizeNewTableAttrs(editor) {
144796
144869
  };
144797
144870
  return {
144798
144871
  tableStyleId: resolved.styleId,
144799
- tableProperties: { tableStyleId: resolved.styleId }
144872
+ tableProperties: {
144873
+ tableStyleId: resolved.styleId,
144874
+ tblLook: { ...DEFAULT_TBL_LOOK }
144875
+ }
144800
144876
  };
144801
144877
  }
144878
+ function computeColumnWidths(editor, columnCount) {
144879
+ const { pageSize = {}, pageMargins = {} } = editor?.converter?.pageStyles ?? {};
144880
+ const { width: pageWidth } = pageSize;
144881
+ const { left: left$1 = 0, right: right$1 = 0 } = pageMargins;
144882
+ if (!pageWidth)
144883
+ return null;
144884
+ const availableWidth = (pageWidth - left$1 - right$1) * 96;
144885
+ const columnWidth = Math.floor(availableWidth / columnCount);
144886
+ return Array(columnCount).fill(columnWidth);
144887
+ }
144802
144888
  function cellAround($pos) {
144803
144889
  for (let d = $pos.depth - 1;d > 0; d--)
144804
144890
  if ($pos.node(d).type.spec.tableRole == "row")
@@ -160090,6 +160176,75 @@ var Node$13 = class Node$14 {
160090
160176
  newTr.removeMark(Math.max(step.from, pos), Math.min(step.to, pos + node3.nodeSize), formatChangeMark);
160091
160177
  }
160092
160178
  });
160179
+ }, findPreviousLiveCharPos = (doc$2, cursorPos, trackDeleteMarkType) => {
160180
+ const $cursor = doc$2.resolve(cursorPos);
160181
+ let paraDepth = $cursor.depth;
160182
+ while (paraDepth > 0 && $cursor.node(paraDepth).type.name !== "paragraph")
160183
+ paraDepth--;
160184
+ if (paraDepth <= 0)
160185
+ return null;
160186
+ const paraStart = $cursor.before(paraDepth) + 1;
160187
+ let lastLiveCharPos = null;
160188
+ doc$2.nodesBetween(paraStart, cursorPos, (node3, pos) => {
160189
+ if (!node3.isText)
160190
+ return;
160191
+ if (node3.marks.some((m$1) => m$1.type === trackDeleteMarkType))
160192
+ return;
160193
+ const nodeEnd = pos + node3.nodeSize;
160194
+ const relevantEnd = Math.min(nodeEnd, cursorPos);
160195
+ if (relevantEnd > pos)
160196
+ lastLiveCharPos = relevantEnd - 1;
160197
+ });
160198
+ return lastLiveCharPos;
160199
+ }, replaceAroundStep = ({ state, tr, step, newTr, map: map$22, doc: doc$2, user, date, originalStep, originalStepIndex }) => {
160200
+ if (!(tr.getMeta("inputType") === "deleteContentBackward"))
160201
+ return;
160202
+ const trackDeleteMarkType = state.schema.marks[TrackDeleteMarkName];
160203
+ const deleteFrom = findPreviousLiveCharPos(doc$2, state.selection.from, trackDeleteMarkType);
160204
+ if (deleteFrom === null)
160205
+ return;
160206
+ const charStep = new ReplaceStep(deleteFrom, deleteFrom + 1, Slice.empty);
160207
+ replaceStep2({
160208
+ state,
160209
+ tr,
160210
+ step: charStep,
160211
+ newTr,
160212
+ map: map$22,
160213
+ doc: doc$2,
160214
+ user,
160215
+ date,
160216
+ originalStep: charStep,
160217
+ originalStepIndex
160218
+ });
160219
+ const trackMeta = newTr.getMeta(TrackChangesBasePluginKey) || {};
160220
+ trackMeta.selectionPos = deleteFrom;
160221
+ newTr.setMeta(TrackChangesBasePluginKey, trackMeta);
160222
+ if (trackMeta.deletionMark) {
160223
+ const ourId = trackMeta.deletionMark.attrs.id;
160224
+ const ourEmail = trackMeta.deletionMark.attrs.authorEmail;
160225
+ const ourDate = trackMeta.deletionMark.attrs.date;
160226
+ const searchTo = Math.min(newTr.doc.content.size, deleteFrom + 20);
160227
+ let contiguous = true;
160228
+ newTr.doc.nodesBetween(deleteFrom, searchTo, (node3, pos) => {
160229
+ if (!contiguous)
160230
+ return false;
160231
+ if (!node3.isText)
160232
+ return;
160233
+ const delMark = node3.marks.find((m$1) => m$1.type.name === TrackDeleteMarkName);
160234
+ if (!delMark) {
160235
+ contiguous = false;
160236
+ return;
160237
+ }
160238
+ if (delMark.attrs.id !== ourId && delMark.attrs.authorEmail === ourEmail && delMark.attrs.date === ourDate) {
160239
+ const merged = state.schema.marks[TrackDeleteMarkName].create({
160240
+ ...delMark.attrs,
160241
+ id: ourId
160242
+ });
160243
+ newTr.removeMark(pos, pos + node3.nodeSize, delMark);
160244
+ newTr.addMark(pos, pos + node3.nodeSize, merged);
160245
+ }
160246
+ });
160247
+ }
160093
160248
  }, trackedTransaction = ({ tr, state, user }) => {
160094
160249
  const onlyInputTypeMeta = [
160095
160250
  "inputType",
@@ -160152,6 +160307,19 @@ var Node$13 = class Node$14 {
160152
160307
  user,
160153
160308
  date
160154
160309
  });
160310
+ else if (step instanceof ReplaceAroundStep2)
160311
+ replaceAroundStep({
160312
+ state,
160313
+ tr,
160314
+ step,
160315
+ newTr,
160316
+ map: map$22,
160317
+ doc: doc$2,
160318
+ user,
160319
+ date,
160320
+ originalStep,
160321
+ originalStepIndex
160322
+ });
160155
160323
  else
160156
160324
  newTr.step(step);
160157
160325
  });
@@ -160162,15 +160330,15 @@ var Node$13 = class Node$14 {
160162
160330
  if (tr.getMeta("addToHistory") !== undefined)
160163
160331
  newTr.setMeta("addToHistory", tr.getMeta("addToHistory"));
160164
160332
  const trackMeta = newTr.getMeta(TrackChangesBasePluginKey);
160165
- if (tr.selectionSet)
160166
- if (trackMeta?.selectionPos !== undefined && trackMeta?.selectionPos !== null) {
160167
- const boundedPos = Math.max(0, Math.min(trackMeta.selectionPos, newTr.doc.content.size));
160168
- const $pos = newTr.doc.resolve(boundedPos);
160169
- if ($pos.parent.inlineContent)
160170
- newTr.setSelection(TextSelection2.create(newTr.doc, boundedPos));
160171
- else
160172
- newTr.setSelection(TextSelection2.near($pos, -1));
160173
- } else if (tr.selection instanceof TextSelection2 && (tr.selection.from < state.selection.from || tr.getMeta("inputType") === "deleteContentBackward")) {
160333
+ if (trackMeta?.selectionPos !== undefined && trackMeta?.selectionPos !== null) {
160334
+ const boundedPos = Math.max(0, Math.min(trackMeta.selectionPos, newTr.doc.content.size));
160335
+ const $pos = newTr.doc.resolve(boundedPos);
160336
+ if ($pos.parent.inlineContent)
160337
+ newTr.setSelection(TextSelection2.create(newTr.doc, boundedPos));
160338
+ else
160339
+ newTr.setSelection(TextSelection2.near($pos, -1));
160340
+ } else if (tr.selectionSet)
160341
+ if (tr.selection instanceof TextSelection2 && (tr.selection.from < state.selection.from || tr.getMeta("inputType") === "deleteContentBackward")) {
160174
160342
  const caretPos = map$22.map(tr.selection.from, -1);
160175
160343
  newTr.setSelection(new TextSelection2(newTr.doc.resolve(caretPos)));
160176
160344
  } else if (trackMeta?.insertedTo !== undefined) {
@@ -167091,21 +167259,6 @@ var Node$13 = class Node$14 {
167091
167259
  if (history$1 != null)
167092
167260
  link2.history = history$1;
167093
167261
  return link2;
167094
- }, TRACK_INSERT_MARK = "trackInsert", TRACK_DELETE_MARK = "trackDelete", TRACK_FORMAT_MARK = "trackFormat", TRACK_CHANGE_KIND_MAP, TRACK_CHANGE_PRIORITY, MAX_RUN_MARK_JSON_LENGTH = 1e4, MAX_RUN_MARK_ARRAY_LENGTH = 100, MAX_RUN_MARK_DEPTH = 5, RANDOM_ID_LENGTH = 9, generateRandomBase36Id = (length$1) => {
167095
- let randomId = "";
167096
- while (randomId.length < length$1)
167097
- randomId += Math.random().toString(36).slice(2);
167098
- return randomId.slice(0, length$1);
167099
- }, validateDepth = (obj, currentDepth = 0) => {
167100
- if (currentDepth > MAX_RUN_MARK_DEPTH)
167101
- return false;
167102
- if (obj && typeof obj === "object") {
167103
- const values = Array.isArray(obj) ? obj : Object.values(obj);
167104
- for (const value of values)
167105
- if (!validateDepth(value, currentDepth + 1))
167106
- return false;
167107
- }
167108
- return true;
167109
167262
  }, parseThemePercentage = (value) => {
167110
167263
  if (typeof value !== "string")
167111
167264
  return;
@@ -167116,13 +167269,13 @@ var Node$13 = class Node$14 {
167116
167269
  if (Number.isNaN(parsed))
167117
167270
  return;
167118
167271
  return Math.max(0, Math.min(parsed / 255, 1));
167119
- }, expandHex = (hex$1) => {
167272
+ }, expandHex$1 = (hex$1) => {
167120
167273
  const normalized = hex$1.replace("#", "");
167121
167274
  if (normalized.length === 3)
167122
167275
  return normalized.split("").map((char) => char + char).join("");
167123
167276
  return normalized;
167124
- }, hexToRgb2 = (hex$1) => {
167125
- const cleaned = expandHex(hex$1);
167277
+ }, hexToRgb$1 = (hex$1) => {
167278
+ const cleaned = expandHex$1(hex$1);
167126
167279
  if (cleaned.length !== 6)
167127
167280
  return null;
167128
167281
  const r$1 = Number.parseInt(cleaned.slice(0, 2), 16);
@@ -167145,7 +167298,7 @@ var Node$13 = class Node$14 {
167145
167298
  };
167146
167299
  return `#${toHex$1(value.r)}${toHex$1(value.g)}${toHex$1(value.b)}`;
167147
167300
  }, applyThemeTint = (baseHex, ratio) => {
167148
- const rgb = hexToRgb2(baseHex);
167301
+ const rgb = hexToRgb$1(baseHex);
167149
167302
  if (!rgb)
167150
167303
  return baseHex;
167151
167304
  return rgbToHex2({
@@ -167154,7 +167307,7 @@ var Node$13 = class Node$14 {
167154
167307
  b: Math.round(rgb.b + (255 - rgb.b) * ratio)
167155
167308
  });
167156
167309
  }, applyThemeShade = (baseHex, ratio) => {
167157
- const rgb = hexToRgb2(baseHex);
167310
+ const rgb = hexToRgb$1(baseHex);
167158
167311
  if (!rgb)
167159
167312
  return baseHex;
167160
167313
  return rgbToHex2({
@@ -167162,6 +167315,59 @@ var Node$13 = class Node$14 {
167162
167315
  g: Math.round(rgb.g * ratio),
167163
167316
  b: Math.round(rgb.b * ratio)
167164
167317
  });
167318
+ }, resolveThemeColorValue = (themeKey, tint, shade, themeColors) => {
167319
+ const key$1 = themeKey.trim();
167320
+ if (!key$1)
167321
+ return;
167322
+ const base$2 = themeColors[key$1];
167323
+ if (!base$2)
167324
+ return;
167325
+ let computed$12 = base$2;
167326
+ const tintRatio = parseThemePercentage(tint);
167327
+ const shadeRatio = parseThemePercentage(shade);
167328
+ if (tintRatio != null)
167329
+ computed$12 = applyThemeTint(computed$12, tintRatio);
167330
+ if (shadeRatio != null)
167331
+ computed$12 = applyThemeShade(computed$12, shadeRatio);
167332
+ return computed$12;
167333
+ }, TRACK_INSERT_MARK = "trackInsert", TRACK_DELETE_MARK = "trackDelete", TRACK_FORMAT_MARK = "trackFormat", TRACK_CHANGE_KIND_MAP, TRACK_CHANGE_PRIORITY, MAX_RUN_MARK_JSON_LENGTH = 1e4, MAX_RUN_MARK_ARRAY_LENGTH = 100, MAX_RUN_MARK_DEPTH = 5, RANDOM_ID_LENGTH = 9, generateRandomBase36Id = (length$1) => {
167334
+ let randomId = "";
167335
+ while (randomId.length < length$1)
167336
+ randomId += Math.random().toString(36).slice(2);
167337
+ return randomId.slice(0, length$1);
167338
+ }, validateDepth = (obj, currentDepth = 0) => {
167339
+ if (currentDepth > MAX_RUN_MARK_DEPTH)
167340
+ return false;
167341
+ if (obj && typeof obj === "object") {
167342
+ const values = Array.isArray(obj) ? obj : Object.values(obj);
167343
+ for (const value of values)
167344
+ if (!validateDepth(value, currentDepth + 1))
167345
+ return false;
167346
+ }
167347
+ return true;
167348
+ }, expandHex = (hex$1) => {
167349
+ const normalized = hex$1.replace("#", "");
167350
+ if (normalized.length === 3)
167351
+ return normalized.split("").map((char) => char + char).join("");
167352
+ return normalized;
167353
+ }, hexToRgb2 = (hex$1) => {
167354
+ const cleaned = expandHex(hex$1);
167355
+ if (cleaned.length !== 6)
167356
+ return null;
167357
+ const r$1 = Number.parseInt(cleaned.slice(0, 2), 16);
167358
+ const g$1 = Number.parseInt(cleaned.slice(2, 4), 16);
167359
+ const b$1 = Number.parseInt(cleaned.slice(4, 6), 16);
167360
+ if ([
167361
+ r$1,
167362
+ g$1,
167363
+ b$1
167364
+ ].some((channel) => Number.isNaN(channel)))
167365
+ return null;
167366
+ return {
167367
+ r: r$1,
167368
+ g: g$1,
167369
+ b: b$1
167370
+ };
167165
167371
  }, getLuminance = (hexColor) => {
167166
167372
  const rgb = hexToRgb2(hexColor);
167167
167373
  if (!rgb)
@@ -167182,20 +167388,7 @@ var Node$13 = class Node$14 {
167182
167388
  const rawKey = attrs.themeColor;
167183
167389
  if (typeof rawKey !== "string")
167184
167390
  return;
167185
- const key$1 = rawKey.trim();
167186
- if (!key$1)
167187
- return;
167188
- const base$2 = themeColors[key$1];
167189
- if (!base$2)
167190
- return;
167191
- const tint = parseThemePercentage(attrs.themeTint);
167192
- const shade = parseThemePercentage(attrs.themeShade);
167193
- let computed$12 = base$2;
167194
- if (tint != null)
167195
- computed$12 = applyThemeTint(computed$12, tint);
167196
- if (shade != null)
167197
- computed$12 = applyThemeShade(computed$12, shade);
167198
- return computed$12;
167391
+ return resolveThemeColorValue(rawKey, attrs.themeTint, attrs.themeShade, themeColors);
167199
167392
  }, resolveColorFromAttributes = (attrs, themeColors) => {
167200
167393
  if (!attrs)
167201
167394
  return;
@@ -168020,14 +168213,19 @@ var Node$13 = class Node$14 {
168020
168213
  if (!isTableCellNode(cellNode) || !Array.isArray(cellNode.content))
168021
168214
  return null;
168022
168215
  const blocks2 = [];
168023
- const inlineTcProps = cellNode.attrs?.tableCellProperties;
168024
- const resolvedTcProps = resolveTableCellProperties(inlineTcProps, tableProperties ? {
168216
+ const rowCnfStyle = args$1.rowCnfStyle ?? null;
168217
+ const cellCnfStyle = cellNode.attrs?.tableCellProperties?.cnfStyle ?? null;
168218
+ const tableInfo = tableProperties ? {
168025
168219
  tableProperties,
168026
168220
  rowIndex,
168027
168221
  cellIndex,
168028
168222
  numCells,
168029
- numRows
168030
- } : undefined, context.converterContext?.translatedLinkedStyles);
168223
+ numRows,
168224
+ rowCnfStyle,
168225
+ cellCnfStyle
168226
+ } : undefined;
168227
+ const inlineTcProps = cellNode.attrs?.tableCellProperties;
168228
+ const resolvedTcProps = resolveTableCellProperties(inlineTcProps, tableInfo, context.converterContext?.translatedLinkedStyles);
168031
168229
  const cellBackground = cellNode.attrs?.background;
168032
168230
  let cellBackgroundColor;
168033
168231
  if (cellBackground && typeof cellBackground.color === "string") {
@@ -168038,20 +168236,20 @@ var Node$13 = class Node$14 {
168038
168236
  cellBackgroundColor = normalized;
168039
168237
  }
168040
168238
  }
168041
- if (!cellBackgroundColor && resolvedTcProps?.shading?.fill) {
168042
- const fill = resolvedTcProps.shading.fill;
168043
- if (fill !== "auto")
168044
- cellBackgroundColor = fill.startsWith("#") ? fill : `#${fill}`;
168239
+ if (!cellBackgroundColor && resolvedTcProps?.shading) {
168240
+ const { fill, themeFill, themeFillTint, themeFillShade } = resolvedTcProps.shading;
168241
+ const normalizedFill = normalizeShadingColor(fill);
168242
+ if (normalizedFill)
168243
+ cellBackgroundColor = normalizedFill;
168244
+ else if (themeFill && context.themeColors) {
168245
+ const normalizedTheme = normalizeShadingColor(resolveThemeColorValue(themeFill, themeFillTint, themeFillShade, context.themeColors));
168246
+ if (normalizedTheme)
168247
+ cellBackgroundColor = normalizedTheme;
168248
+ }
168045
168249
  }
168046
- const cellConverterContext = tableProperties || cellBackgroundColor ? {
168250
+ const cellConverterContext = tableInfo || cellBackgroundColor ? {
168047
168251
  ...context.converterContext,
168048
- ...tableProperties && { tableInfo: {
168049
- tableProperties,
168050
- rowIndex,
168051
- cellIndex,
168052
- numCells,
168053
- numRows
168054
- } },
168252
+ ...tableInfo && { tableInfo },
168055
168253
  ...cellBackgroundColor && { backgroundColor: cellBackgroundColor }
168056
168254
  } : context.converterContext;
168057
168255
  const paragraphToFlowBlocks$1 = context.converters.paragraphToFlowBlocks;
@@ -168246,6 +168444,7 @@ var Node$13 = class Node$14 {
168246
168444
  if (!isTableRowNode(rowNode) || !Array.isArray(rowNode.content))
168247
168445
  return null;
168248
168446
  const cells = [];
168447
+ const rowCnfStyle = rowNode.attrs?.tableRowProperties?.cnfStyle;
168249
168448
  rowNode.content.forEach((cellNode, cellIndex) => {
168250
168449
  const parsedCell = parseTableCell({
168251
168450
  cellNode,
@@ -168255,7 +168454,8 @@ var Node$13 = class Node$14 {
168255
168454
  defaultCellPadding,
168256
168455
  tableProperties,
168257
168456
  numCells: rowNode?.content?.length || 1,
168258
- numRows
168457
+ numRows,
168458
+ rowCnfStyle
168259
168459
  });
168260
168460
  if (parsedCell)
168261
168461
  cells.push(parsedCell);
@@ -177634,7 +177834,7 @@ var Node$13 = class Node$14 {
177634
177834
  from: from$12,
177635
177835
  to
177636
177836
  };
177637
- }, trackInsertClass = "track-insert", TrackInsert, trackDeleteClass = "track-delete", TrackDelete, replaceAroundStep = () => {}, markWrapping = () => {}, parseFormatList = (str) => {
177837
+ }, trackInsertClass = "track-insert", TrackInsert, trackDeleteClass = "track-delete", TrackDelete, markWrapping = () => {}, parseFormatList = (str) => {
177638
177838
  if (!str)
177639
177839
  return [];
177640
177840
  let formatList;
@@ -179933,9 +180133,9 @@ var Node$13 = class Node$14 {
179933
180133
  trackedChanges: context.trackedChanges ?? []
179934
180134
  });
179935
180135
  }, _hoisted_1$6, _hoisted_2$2, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, _hoisted_2$1, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_HEIGHT_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, POPOVER_VERTICAL_OFFSET_PX = 15, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
179936
- var init_src_B2ASTVlZ_es = __esm(() => {
180136
+ var init_src_B1yNdREj_es = __esm(() => {
179937
180137
  init_rolldown_runtime_B2q5OVn9_es();
179938
- init_SuperConverter_Ba_l6vso_es();
180138
+ init_SuperConverter_C1hZYQNS_es();
179939
180139
  init_jszip_ChlR43oI_es();
179940
180140
  init_uuid_2IzDu5nl_es();
179941
180141
  init_constants_CqvgVEDh_es();
@@ -203450,17 +203650,7 @@ function print() { __p += __j.call(arguments, '') }
203450
203650
  }).run();
203451
203651
  },
203452
203652
  insertTable: ({ rows = 3, cols = 3, withHeaderRow = false, columnWidths = null } = {}) => ({ tr, dispatch, editor }) => {
203453
- let widths = columnWidths;
203454
- if (!widths) {
203455
- const { pageSize = {}, pageMargins = {} } = editor.converter?.pageStyles ?? {};
203456
- const { width: pageWidth } = pageSize;
203457
- const { left: left$1 = 0, right: right$1 = 0 } = pageMargins;
203458
- if (pageWidth) {
203459
- const availableWidth = (pageWidth - left$1 - right$1) * 96;
203460
- const columnWidth = Math.floor(availableWidth / cols);
203461
- widths = Array(cols).fill(columnWidth);
203462
- }
203463
- }
203653
+ const widths = columnWidths ?? computeColumnWidths(editor, cols);
203464
203654
  const resolved = normalizeNewTableAttrs(editor);
203465
203655
  const tableAttrs = {
203466
203656
  ...resolved.tableStyleId ? { tableStyleId: resolved.tableStyleId } : {},
@@ -203490,11 +203680,16 @@ function print() { __p += __j.call(arguments, '') }
203490
203680
  return false;
203491
203681
  try {
203492
203682
  const genParaId = () => Array.from({ length: 8 }, () => Math.floor(Math.random() * 16).toString(16)).join("").toUpperCase();
203683
+ const widths = computeColumnWidths(editor, columns);
203493
203684
  const rowNodes = [];
203494
203685
  for (let r$1 = 0;r$1 < rows; r$1++) {
203495
203686
  const cellNodes = [];
203496
203687
  for (let c$3 = 0;c$3 < columns; c$3++) {
203497
- const cell2 = tableCellType.createAndFill({ paraId: genParaId() });
203688
+ const cellAttrs = {
203689
+ paraId: genParaId(),
203690
+ ...widths ? { colwidth: [widths[c$3]] } : {}
203691
+ };
203692
+ const cell2 = tableCellType.createAndFill(cellAttrs);
203498
203693
  if (!cell2)
203499
203694
  return false;
203500
203695
  cellNodes.push(cell2);
@@ -211240,8 +211435,8 @@ function print() { __p += __j.call(arguments, '') }
211240
211435
  return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
211241
211436
  };
211242
211437
  stubFalse_default = stubFalse;
211243
- freeExports$2 = typeof exports_src_B2ASTVlZ_es == "object" && exports_src_B2ASTVlZ_es && !exports_src_B2ASTVlZ_es.nodeType && exports_src_B2ASTVlZ_es;
211244
- freeModule$2 = freeExports$2 && typeof module_src_B2ASTVlZ_es == "object" && module_src_B2ASTVlZ_es && !module_src_B2ASTVlZ_es.nodeType && module_src_B2ASTVlZ_es;
211438
+ freeExports$2 = typeof exports_src_B1yNdREj_es == "object" && exports_src_B1yNdREj_es && !exports_src_B1yNdREj_es.nodeType && exports_src_B1yNdREj_es;
211439
+ freeModule$2 = freeExports$2 && typeof module_src_B1yNdREj_es == "object" && module_src_B1yNdREj_es && !module_src_B1yNdREj_es.nodeType && module_src_B1yNdREj_es;
211245
211440
  Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
211246
211441
  isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
211247
211442
  typedArrayTags = {};
@@ -211249,8 +211444,8 @@ function print() { __p += __j.call(arguments, '') }
211249
211444
  typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
211250
211445
  _baseIsTypedArray_default = baseIsTypedArray;
211251
211446
  _baseUnary_default = baseUnary;
211252
- freeExports$1 = typeof exports_src_B2ASTVlZ_es == "object" && exports_src_B2ASTVlZ_es && !exports_src_B2ASTVlZ_es.nodeType && exports_src_B2ASTVlZ_es;
211253
- freeModule$1 = freeExports$1 && typeof module_src_B2ASTVlZ_es == "object" && module_src_B2ASTVlZ_es && !module_src_B2ASTVlZ_es.nodeType && module_src_B2ASTVlZ_es;
211447
+ freeExports$1 = typeof exports_src_B1yNdREj_es == "object" && exports_src_B1yNdREj_es && !exports_src_B1yNdREj_es.nodeType && exports_src_B1yNdREj_es;
211448
+ freeModule$1 = freeExports$1 && typeof module_src_B1yNdREj_es == "object" && module_src_B1yNdREj_es && !module_src_B1yNdREj_es.nodeType && module_src_B1yNdREj_es;
211254
211449
  freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
211255
211450
  _nodeUtil_default = function() {
211256
211451
  try {
@@ -211355,8 +211550,8 @@ function print() { __p += __j.call(arguments, '') }
211355
211550
  Stack.prototype.has = _stackHas_default;
211356
211551
  Stack.prototype.set = _stackSet_default;
211357
211552
  _Stack_default = Stack;
211358
- freeExports = typeof exports_src_B2ASTVlZ_es == "object" && exports_src_B2ASTVlZ_es && !exports_src_B2ASTVlZ_es.nodeType && exports_src_B2ASTVlZ_es;
211359
- freeModule = freeExports && typeof module_src_B2ASTVlZ_es == "object" && module_src_B2ASTVlZ_es && !module_src_B2ASTVlZ_es.nodeType && module_src_B2ASTVlZ_es;
211553
+ freeExports = typeof exports_src_B1yNdREj_es == "object" && exports_src_B1yNdREj_es && !exports_src_B1yNdREj_es.nodeType && exports_src_B1yNdREj_es;
211554
+ freeModule = freeExports && typeof module_src_B1yNdREj_es == "object" && module_src_B1yNdREj_es && !module_src_B1yNdREj_es.nodeType && module_src_B1yNdREj_es;
211360
211555
  Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
211361
211556
  allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
211362
211557
  _cloneBuffer_default = cloneBuffer;
@@ -219436,8 +219631,8 @@ var init_zipper_Cnk_HjM2_es = __esm(() => {
219436
219631
 
219437
219632
  // ../../packages/superdoc/dist/super-editor.es.js
219438
219633
  var init_super_editor_es = __esm(() => {
219439
- init_src_B2ASTVlZ_es();
219440
- init_SuperConverter_Ba_l6vso_es();
219634
+ init_src_B1yNdREj_es();
219635
+ init_SuperConverter_C1hZYQNS_es();
219441
219636
  init_jszip_ChlR43oI_es();
219442
219637
  init_xml_js_DLE8mr0n_es();
219443
219638
  init_constants_CqvgVEDh_es();
@@ -261172,28 +261367,62 @@ function resolveDocxFontFamily2(attributes, docx, toCssFontFamily2) {
261172
261367
  }
261173
261368
  return resolved;
261174
261369
  }
261370
+ function resolveEffectiveBandSizes2(styleId, translatedLinkedStyles) {
261371
+ const seen = new Set;
261372
+ let currentId = styleId;
261373
+ let rowBandSize;
261374
+ let colBandSize;
261375
+ while (currentId && !seen.has(currentId)) {
261376
+ seen.add(currentId);
261377
+ const def2 = translatedLinkedStyles.styles?.[currentId];
261378
+ const tblProps = def2?.tableProperties;
261379
+ if (rowBandSize == null && tblProps?.tableStyleRowBandSize != null) {
261380
+ rowBandSize = tblProps.tableStyleRowBandSize;
261381
+ }
261382
+ if (colBandSize == null && tblProps?.tableStyleColBandSize != null) {
261383
+ colBandSize = tblProps.tableStyleColBandSize;
261384
+ }
261385
+ if (rowBandSize != null && colBandSize != null)
261386
+ break;
261387
+ currentId = def2?.basedOn;
261388
+ }
261389
+ return { rowBandSize: rowBandSize ?? 1, colBandSize: colBandSize ?? 1 };
261390
+ }
261391
+ function resolveConditionalProps2(propertyType, styleType, styleId, translatedLinkedStyles) {
261392
+ const chain = [];
261393
+ const seen = new Set;
261394
+ let currentId = styleId;
261395
+ while (currentId && !seen.has(currentId)) {
261396
+ seen.add(currentId);
261397
+ const def2 = translatedLinkedStyles.styles?.[currentId];
261398
+ const props = def2?.tableStyleProperties?.[styleType]?.[propertyType];
261399
+ if (props)
261400
+ chain.push(props);
261401
+ currentId = def2?.basedOn;
261402
+ }
261403
+ if (chain.length === 0)
261404
+ return;
261405
+ chain.reverse();
261406
+ return combineProperties2(chain);
261407
+ }
261175
261408
  function resolveCellStyles2(propertyType, tableInfo, translatedLinkedStyles) {
261176
261409
  if (tableInfo == null || !tableInfo.tableProperties?.tableStyleId) {
261177
261410
  return [];
261178
261411
  }
261179
261412
  const cellStyleProps = [];
261180
- if (tableInfo != null && tableInfo.tableProperties.tableStyleId) {
261181
- const tableStyleDef = translatedLinkedStyles.styles[tableInfo.tableProperties.tableStyleId];
261182
- const tableStylePropsDef = tableStyleDef?.tableProperties;
261183
- const rowBandSize = tableStylePropsDef?.tableStyleRowBandSize ?? 1;
261184
- const colBandSize = tableStylePropsDef?.tableStyleColBandSize ?? 1;
261185
- const cellStyleTypes = determineCellStyleTypes2(tableInfo.tableProperties?.tblLook, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize);
261186
- cellStyleTypes.forEach((styleType) => {
261187
- const typeProps = tableStyleDef?.tableStyleProperties?.[styleType]?.[propertyType];
261188
- if (typeProps) {
261189
- cellStyleProps.push(typeProps);
261190
- }
261191
- });
261192
- }
261413
+ const tableStyleId = tableInfo.tableProperties.tableStyleId;
261414
+ const { rowBandSize, colBandSize } = resolveEffectiveBandSizes2(tableStyleId, translatedLinkedStyles);
261415
+ const cellStyleTypes = determineCellStyleTypes2(tableInfo.tableProperties?.tblLook ?? DEFAULT_TBL_LOOK2, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize, tableInfo.rowCnfStyle, tableInfo.cellCnfStyle);
261416
+ cellStyleTypes.forEach((styleType) => {
261417
+ const typeProps = resolveConditionalProps2(propertyType, styleType, tableStyleId, translatedLinkedStyles);
261418
+ if (typeProps) {
261419
+ cellStyleProps.push(typeProps);
261420
+ }
261421
+ });
261193
261422
  return cellStyleProps;
261194
261423
  }
261195
- function determineCellStyleTypes2(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1) {
261196
- const styleTypes = ["wholeTable"];
261424
+ function determineCellStyleTypes2(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1, rowCnfStyle, cellCnfStyle) {
261425
+ const applicable = new Set(["wholeTable"]);
261197
261426
  const normalizedRowBandSize = rowBandSize > 0 ? rowBandSize : 1;
261198
261427
  const normalizedColBandSize = colBandSize > 0 ? colBandSize : 1;
261199
261428
  const bandRowIndex = Math.max(0, rowIndex - (tblLook?.firstRow ? 1 : 0));
@@ -261201,47 +261430,86 @@ function determineCellStyleTypes2(tblLook, rowIndex, cellIndex, numRows, numCell
261201
261430
  const rowGroup = Math.floor(bandRowIndex / normalizedRowBandSize);
261202
261431
  const colGroup = Math.floor(bandColIndex / normalizedColBandSize);
261203
261432
  if (!tblLook?.noHBand) {
261204
- if (rowGroup % 2 === 0) {
261205
- styleTypes.push("band1Horz");
261206
- } else {
261207
- styleTypes.push("band2Horz");
261208
- }
261433
+ applicable.add(rowGroup % 2 === 0 ? "band1Horz" : "band2Horz");
261209
261434
  }
261210
261435
  if (!tblLook?.noVBand) {
261211
- if (colGroup % 2 === 0) {
261212
- styleTypes.push("band1Vert");
261213
- } else {
261214
- styleTypes.push("band2Vert");
261215
- }
261436
+ applicable.add(colGroup % 2 === 0 ? "band1Vert" : "band2Vert");
261216
261437
  }
261217
261438
  if (tblLook?.firstRow && rowIndex === 0) {
261218
- styleTypes.push("firstRow");
261439
+ applicable.add("firstRow");
261219
261440
  }
261220
261441
  if (tblLook?.firstColumn && cellIndex === 0) {
261221
- styleTypes.push("firstCol");
261442
+ applicable.add("firstCol");
261222
261443
  }
261223
261444
  if (tblLook?.lastRow && numRows != null && numRows > 0 && rowIndex === numRows - 1) {
261224
- styleTypes.push("lastRow");
261445
+ applicable.add("lastRow");
261225
261446
  }
261226
261447
  if (tblLook?.lastColumn && numCells != null && numCells > 0 && cellIndex === numCells - 1) {
261227
- styleTypes.push("lastCol");
261448
+ applicable.add("lastCol");
261228
261449
  }
261229
261450
  if (rowIndex === 0 && cellIndex === 0) {
261230
- styleTypes.push("nwCell");
261451
+ applicable.add("nwCell");
261231
261452
  }
261232
261453
  if (rowIndex === 0 && numCells != null && numCells > 0 && cellIndex === numCells - 1) {
261233
- styleTypes.push("neCell");
261454
+ applicable.add("neCell");
261234
261455
  }
261235
261456
  if (numRows != null && numRows > 0 && rowIndex === numRows - 1 && cellIndex === 0) {
261236
- styleTypes.push("swCell");
261457
+ applicable.add("swCell");
261237
261458
  }
261238
261459
  if (numRows != null && numRows > 0 && numCells != null && numCells > 0 && rowIndex === numRows - 1 && cellIndex === numCells - 1) {
261239
- styleTypes.push("seCell");
261460
+ applicable.add("seCell");
261240
261461
  }
261241
- return styleTypes;
261462
+ if (rowCnfStyle || cellCnfStyle) {
261463
+ for (const [flag, styleType] of CNF_STYLE_MAP2) {
261464
+ const rowFlag = rowCnfStyle?.[flag];
261465
+ const cellFlag = cellCnfStyle?.[flag];
261466
+ if (rowFlag === true || cellFlag === true) {
261467
+ applicable.add(styleType);
261468
+ }
261469
+ }
261470
+ }
261471
+ return TABLE_STYLE_PRECEDENCE2.filter((t) => applicable.has(t));
261242
261472
  }
261473
+ var DEFAULT_TBL_LOOK2, CNF_STYLE_MAP2, TABLE_STYLE_PRECEDENCE2;
261243
261474
  var init_ooxml = __esm(() => {
261244
261475
  init_table_style_selection();
261476
+ DEFAULT_TBL_LOOK2 = {
261477
+ firstRow: true,
261478
+ lastRow: false,
261479
+ firstColumn: true,
261480
+ lastColumn: false,
261481
+ noHBand: false,
261482
+ noVBand: true
261483
+ };
261484
+ CNF_STYLE_MAP2 = [
261485
+ ["oddHBand", "band1Horz"],
261486
+ ["evenHBand", "band2Horz"],
261487
+ ["oddVBand", "band1Vert"],
261488
+ ["evenVBand", "band2Vert"],
261489
+ ["firstRow", "firstRow"],
261490
+ ["firstColumn", "firstCol"],
261491
+ ["lastRow", "lastRow"],
261492
+ ["lastColumn", "lastCol"],
261493
+ ["firstRowFirstColumn", "nwCell"],
261494
+ ["firstRowLastColumn", "neCell"],
261495
+ ["lastRowFirstColumn", "swCell"],
261496
+ ["lastRowLastColumn", "seCell"]
261497
+ ];
261498
+ TABLE_STYLE_PRECEDENCE2 = [
261499
+ "wholeTable",
261500
+ "band1Horz",
261501
+ "band2Horz",
261502
+ "band1Vert",
261503
+ "band2Vert",
261504
+ "firstCol",
261505
+ "lastCol",
261506
+ "firstRow",
261507
+ "lastRow",
261508
+ "nwCell",
261509
+ "neCell",
261510
+ "swCell",
261511
+ "seCell"
261512
+ ];
261245
261513
  });
261246
261514
 
261247
261515
  // ../../packages/super-editor/src/core/super-converter/v3/handlers/wp/helpers/textbox-content-helpers.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.61",
3
+ "version": "0.2.0-next.63",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -19,21 +19,21 @@
19
19
  "@types/bun": "^1.3.8",
20
20
  "@types/node": "22.19.2",
21
21
  "typescript": "^5.9.2",
22
- "@superdoc/super-editor": "0.0.1",
22
+ "@superdoc/pm-adapter": "0.0.0",
23
23
  "@superdoc/document-api": "0.0.1",
24
- "superdoc": "1.16.0",
25
- "@superdoc/pm-adapter": "0.0.0"
24
+ "@superdoc/super-editor": "0.0.1",
25
+ "superdoc": "1.16.0"
26
26
  },
27
27
  "module": "src/index.ts",
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
31
  "optionalDependencies": {
32
- "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.61",
33
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.61",
34
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.61",
35
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.61",
36
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.61"
32
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.63",
33
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.63",
34
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.63",
35
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.63",
36
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.63"
37
37
  },
38
38
  "scripts": {
39
39
  "dev": "bun run src/index.ts",