@superdoc-dev/cli 0.7.0-next.22 → 0.7.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.
Files changed (2) hide show
  1. package/dist/index.js +286 -56
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -65501,7 +65501,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
65501
65501
  emptyOptions2 = {};
65502
65502
  });
65503
65503
 
65504
- // ../../packages/superdoc/dist/chunks/SuperConverter-DUDABEsC.es.js
65504
+ // ../../packages/superdoc/dist/chunks/SuperConverter-B4pTwmbr.es.js
65505
65505
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
65506
65506
  const fieldValue = extension$1.config[field];
65507
65507
  if (typeof fieldValue === "function")
@@ -95148,7 +95148,8 @@ function translatePassthroughNode(params3) {
95148
95148
  return carbonCopy(original);
95149
95149
  }
95150
95150
  function translateBodyNode(params3) {
95151
- let sectPr = params3.bodyNode?.elements?.find((n) => n.name === "w:sectPr");
95151
+ const liveSectPr = params3.converter?.bodySectPr;
95152
+ let sectPr = (liveSectPr && typeof liveSectPr === "object" ? carbonCopy(liveSectPr) : null) || params3.bodyNode?.elements?.find((n) => n.name === "w:sectPr");
95152
95153
  if (!sectPr)
95153
95154
  sectPr = {
95154
95155
  type: "element",
@@ -116806,13 +116807,13 @@ var isRegExp = (value) => {
116806
116807
  additions.push(rel);
116807
116808
  });
116808
116809
  return additions.length ? [...existingRelationships, ...additions] : existingRelationships;
116809
- }, RELS_XMLNS$1 = "http://schemas.openxmlformats.org/package/2006/relationships", FOOTNOTES_RELS_PATH = "word/_rels/footnotes.xml.rels", paragraphHasFootnoteRef = (node3) => {
116810
+ }, RELS_XMLNS$1 = "http://schemas.openxmlformats.org/package/2006/relationships", FOOTNOTES_RELS_PATH = "word/_rels/footnotes.xml.rels", ENDNOTES_RELS_PATH = "word/_rels/endnotes.xml.rels", FOOTNOTES_CONFIG$1, ENDNOTES_CONFIG$1, paragraphHasFootnoteRef = (node3) => {
116810
116811
  if (!node3)
116811
116812
  return false;
116812
- if (node3.name === "w:footnoteRef")
116813
+ if (node3.name === "w:footnoteRef" || node3.name === "w:endnoteRef")
116813
116814
  return true;
116814
116815
  return (Array.isArray(node3.elements) ? node3.elements : []).some((child) => paragraphHasFootnoteRef(child));
116815
- }, insertFootnoteRefIntoParagraph = (paragraph2) => {
116816
+ }, insertFootnoteRefIntoParagraph = (paragraph2, config$40) => {
116816
116817
  if (!paragraph2 || paragraph2.name !== "w:p")
116817
116818
  return;
116818
116819
  if (!Array.isArray(paragraph2.elements))
@@ -116821,7 +116822,7 @@ var isRegExp = (value) => {
116821
116822
  return;
116822
116823
  const footnoteRef = {
116823
116824
  type: "element",
116824
- name: "w:footnoteRef",
116825
+ name: config$40.refName,
116825
116826
  elements: []
116826
116827
  };
116827
116828
  const footnoteRefRun = {
@@ -116833,7 +116834,7 @@ var isRegExp = (value) => {
116833
116834
  elements: [{
116834
116835
  type: "element",
116835
116836
  name: "w:rStyle",
116836
- attributes: { "w:val": "FootnoteReference" }
116837
+ attributes: { "w:val": config$40.refStyle }
116837
116838
  }, {
116838
116839
  type: "element",
116839
116840
  name: "w:vertAlign",
@@ -116844,12 +116845,12 @@ var isRegExp = (value) => {
116844
116845
  const pPrIndex = paragraph2.elements.findIndex((el) => el?.name === "w:pPr");
116845
116846
  const insertAt = pPrIndex >= 0 ? pPrIndex + 1 : 0;
116846
116847
  paragraph2.elements.splice(insertAt, 0, footnoteRefRun);
116847
- }, ensureFootnoteRefMarker = (elements) => {
116848
+ }, ensureFootnoteRefMarker = (elements, config$40) => {
116848
116849
  if (!Array.isArray(elements))
116849
116850
  return;
116850
116851
  const firstParagraphIndex = elements.findIndex((el) => el?.name === "w:p");
116851
116852
  if (firstParagraphIndex >= 0) {
116852
- insertFootnoteRefIntoParagraph(elements[firstParagraphIndex]);
116853
+ insertFootnoteRefIntoParagraph(elements[firstParagraphIndex], config$40);
116853
116854
  return;
116854
116855
  }
116855
116856
  const paragraph2 = {
@@ -116857,7 +116858,7 @@ var isRegExp = (value) => {
116857
116858
  name: "w:p",
116858
116859
  elements: []
116859
116860
  };
116860
- insertFootnoteRefIntoParagraph(paragraph2);
116861
+ insertFootnoteRefIntoParagraph(paragraph2, config$40);
116861
116862
  elements.unshift(paragraph2);
116862
116863
  }, translateFootnoteContent = (content$2, exportContext) => {
116863
116864
  if (!Array.isArray(content$2) || content$2.length === 0)
@@ -116878,7 +116879,7 @@ var isRegExp = (value) => {
116878
116879
  translated.push(result);
116879
116880
  });
116880
116881
  return translated;
116881
- }, createFootnoteElement = (footnote, exportContext) => {
116882
+ }, createFootnoteElement = (footnote, exportContext, config$40 = FOOTNOTES_CONFIG$1) => {
116882
116883
  if (!footnote)
116883
116884
  return null;
116884
116885
  const { id: id2, content: content$2, type, originalXml } = footnote;
@@ -116889,10 +116890,10 @@ var isRegExp = (value) => {
116889
116890
  attributes["w:type"] = type;
116890
116891
  const translatedContent = translateFootnoteContent(content$2, exportContext);
116891
116892
  if (originalXml ? paragraphHasFootnoteRef(originalXml) : true)
116892
- ensureFootnoteRefMarker(translatedContent);
116893
+ ensureFootnoteRefMarker(translatedContent, config$40);
116893
116894
  const base$1 = originalXml ? carbonCopy(originalXml) : {
116894
116895
  type: "element",
116895
- name: "w:footnote",
116896
+ name: config$40.noteName,
116896
116897
  attributes: {},
116897
116898
  elements: []
116898
116899
  };
@@ -116939,10 +116940,10 @@ var isRegExp = (value) => {
116939
116940
  ...convertedXml,
116940
116941
  "word/settings.xml": updatedSettings
116941
116942
  };
116942
- }, buildFootnotesRelsXml = (converter, convertedXml, relationships) => {
116943
+ }, buildFootnotesRelsXml = (converter, convertedXml, relationships, relsPath = FOOTNOTES_RELS_PATH) => {
116943
116944
  if (!relationships.length)
116944
116945
  return null;
116945
- const existingRels = convertedXml[FOOTNOTES_RELS_PATH];
116946
+ const existingRels = convertedXml[relsPath];
116946
116947
  const existingRoot = existingRels?.elements?.find((el) => el.name === "Relationships");
116947
116948
  const merged = mergeRelationshipElements(Array.isArray(existingRoot?.elements) ? existingRoot.elements : [], relationships);
116948
116949
  const declaration = existingRels?.declaration ?? converter?.initialJSON?.declaration;
@@ -116954,10 +116955,18 @@ var isRegExp = (value) => {
116954
116955
  elements: merged
116955
116956
  }]
116956
116957
  };
116957
- }, prepareFootnotesXmlForExport = ({ footnotes, editor, converter, convertedXml }) => {
116958
- let updatedXml = applyFootnotePropertiesToSettings(converter, convertedXml);
116959
- updatedXml = applyViewSettingToSettings(converter, updatedXml);
116960
- if (!footnotes || !Array.isArray(footnotes) || footnotes.length === 0)
116958
+ }, createNotesXmlDefinition = (config$40) => {
116959
+ const base$1 = carbonCopy(FOOTNOTES_XML_DEF);
116960
+ if (base$1.elements?.[0])
116961
+ base$1.elements[0].name = config$40.rootName;
116962
+ return base$1;
116963
+ }, prepareNotesXmlForExport = ({ notes, editor, converter, convertedXml, config: config$40 }) => {
116964
+ let updatedXml = convertedXml;
116965
+ if (config$40.applySettingsSideEffects) {
116966
+ updatedXml = applyFootnotePropertiesToSettings(converter, updatedXml);
116967
+ updatedXml = applyViewSettingToSettings(converter, updatedXml);
116968
+ }
116969
+ if (!notes || !Array.isArray(notes) || notes.length === 0)
116961
116970
  return {
116962
116971
  updatedXml,
116963
116972
  relationships: [],
@@ -116972,45 +116981,58 @@ var isRegExp = (value) => {
116972
116981
  relationships: footnoteRelationships,
116973
116982
  media: footnoteMedia
116974
116983
  };
116975
- const footnoteElements = footnotes.map((fn) => createFootnoteElement(fn, exportContext)).filter(Boolean);
116984
+ const footnoteElements = notes.map((fn) => createFootnoteElement(fn, exportContext, config$40)).filter(Boolean);
116976
116985
  if (footnoteElements.length === 0)
116977
116986
  return {
116978
116987
  updatedXml,
116979
116988
  relationships: [],
116980
116989
  media: footnoteMedia
116981
116990
  };
116982
- let footnotesXml = updatedXml["word/footnotes.xml"];
116991
+ let footnotesXml = updatedXml[config$40.notesPath];
116983
116992
  if (!footnotesXml)
116984
- footnotesXml = carbonCopy(FOOTNOTES_XML_DEF);
116993
+ footnotesXml = createNotesXmlDefinition(config$40);
116985
116994
  else
116986
116995
  footnotesXml = carbonCopy(footnotesXml);
116987
116996
  if (footnotesXml.elements && footnotesXml.elements[0])
116988
116997
  footnotesXml.elements[0].elements = footnoteElements;
116989
116998
  updatedXml = {
116990
116999
  ...updatedXml,
116991
- "word/footnotes.xml": footnotesXml
117000
+ [config$40.notesPath]: footnotesXml
116992
117001
  };
116993
117002
  if (footnoteRelationships.length > 0) {
116994
- const footnotesRelsXml = buildFootnotesRelsXml(converter, updatedXml, footnoteRelationships);
117003
+ const footnotesRelsXml = buildFootnotesRelsXml(converter, updatedXml, footnoteRelationships, config$40.relsPath);
116995
117004
  if (footnotesRelsXml)
116996
117005
  updatedXml = {
116997
117006
  ...updatedXml,
116998
- [FOOTNOTES_RELS_PATH]: footnotesRelsXml
117007
+ [config$40.relsPath]: footnotesRelsXml
116999
117008
  };
117000
117009
  }
117010
+ const relationships = [{
117011
+ type: "element",
117012
+ name: "Relationship",
117013
+ attributes: {
117014
+ Type: config$40.relationshipType,
117015
+ Target: config$40.relationshipTarget
117016
+ }
117017
+ }];
117001
117018
  return {
117002
117019
  updatedXml,
117003
- relationships: [{
117004
- type: "element",
117005
- name: "Relationship",
117006
- attributes: {
117007
- Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",
117008
- Target: "footnotes.xml"
117009
- }
117010
- }],
117020
+ relationships,
117011
117021
  media: footnoteMedia
117012
117022
  };
117013
- }, APP_XML_PATH = "docProps/app.xml", EP_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties", BODY_STORY_KEY = "body", DEFAULT_CAPACITY = 10, StoryRuntimeCache = class {
117023
+ }, prepareFootnotesXmlForExport = ({ footnotes, editor, converter, convertedXml }) => prepareNotesXmlForExport({
117024
+ notes: footnotes,
117025
+ editor,
117026
+ converter,
117027
+ convertedXml,
117028
+ config: FOOTNOTES_CONFIG$1
117029
+ }), prepareEndnotesXmlForExport = ({ endnotes, editor, converter, convertedXml }) => prepareNotesXmlForExport({
117030
+ notes: endnotes,
117031
+ editor,
117032
+ converter,
117033
+ convertedXml,
117034
+ config: ENDNOTES_CONFIG$1
117035
+ }), APP_XML_PATH = "docProps/app.xml", EP_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties", BODY_STORY_KEY = "body", DEFAULT_CAPACITY = 10, StoryRuntimeCache = class {
117014
117036
  constructor(capacity = DEFAULT_CAPACITY) {
117015
117037
  this.map = /* @__PURE__ */ new Map;
117016
117038
  this.capacity = Math.max(1, capacity);
@@ -117228,7 +117250,7 @@ var isRegExp = (value) => {
117228
117250
  state.kern = kernNode.attributes["w:val"];
117229
117251
  }
117230
117252
  }, SuperConverter;
117231
- var init_SuperConverter_DUDABEsC_es = __esm(() => {
117253
+ var init_SuperConverter_B4pTwmbr_es = __esm(() => {
117232
117254
  init_rolldown_runtime_Bg48TavK_es();
117233
117255
  init_jszip_C49i9kUs_es();
117234
117256
  init_xml_js_CqGKpaft_es();
@@ -153199,6 +153221,28 @@ var init_SuperConverter_DUDABEsC_es = __esm(() => {
153199
153221
  });
153200
153222
  ALL_COMMENT_TARGETS = COMMENT_FILE_BASENAMES;
153201
153223
  REL_ID_NUMERIC_PATTERN = /rId|mi/g;
153224
+ FOOTNOTES_CONFIG$1 = {
153225
+ notesPath: "word/footnotes.xml",
153226
+ relsPath: FOOTNOTES_RELS_PATH,
153227
+ rootName: "w:footnotes",
153228
+ noteName: "w:footnote",
153229
+ refName: "w:footnoteRef",
153230
+ refStyle: "FootnoteReference",
153231
+ relationshipType: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",
153232
+ relationshipTarget: "footnotes.xml",
153233
+ applySettingsSideEffects: true
153234
+ };
153235
+ ENDNOTES_CONFIG$1 = {
153236
+ notesPath: "word/endnotes.xml",
153237
+ relsPath: ENDNOTES_RELS_PATH,
153238
+ rootName: "w:endnotes",
153239
+ noteName: "w:endnote",
153240
+ refName: "w:endnoteRef",
153241
+ refStyle: "EndnoteReference",
153242
+ relationshipType: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",
153243
+ relationshipTarget: "endnotes.xml",
153244
+ applySettingsSideEffects: false
153245
+ };
153202
153246
  DocumentApiAdapterError = class DocumentApiAdapterError2 extends Error {
153203
153247
  constructor(code$1, message, details) {
153204
153248
  super(message);
@@ -154147,10 +154191,21 @@ var init_SuperConverter_DUDABEsC_es = __esm(() => {
154147
154191
  ...this.convertedXml,
154148
154192
  ...footnotesUpdatedXml
154149
154193
  };
154194
+ const { updatedXml: endnotesUpdatedXml, relationships: endnotesRels, media: endnotesMedia } = prepareEndnotesXmlForExport({
154195
+ endnotes: this.endnotes,
154196
+ editor,
154197
+ converter: this,
154198
+ convertedXml: this.convertedXml
154199
+ });
154200
+ this.convertedXml = {
154201
+ ...this.convertedXml,
154202
+ ...endnotesUpdatedXml
154203
+ };
154150
154204
  await this.#exportProcessMediaFiles({
154151
154205
  ...documentMedia,
154152
154206
  ...params3.media,
154153
154207
  ...footnotesMedia,
154208
+ ...endnotesMedia,
154154
154209
  ...this.media
154155
154210
  }, editor);
154156
154211
  const { documentXml, relationships: commentsRels, removedTargets } = this.#prepareCommentsXmlFilesForExport({
@@ -154174,6 +154229,7 @@ var init_SuperConverter_DUDABEsC_es = __esm(() => {
154174
154229
  ...params3.relationships,
154175
154230
  ...commentsRels,
154176
154231
  ...footnotesRels,
154232
+ ...endnotesRels,
154177
154233
  ...headFootRels
154178
154234
  ]);
154179
154235
  if (removedTargets?.length)
@@ -154474,7 +154530,7 @@ var init_SuperConverter_DUDABEsC_es = __esm(() => {
154474
154530
  };
154475
154531
  });
154476
154532
 
154477
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-B7F814Ir.es.js
154533
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-C636gY8A.es.js
154478
154534
  function parseSizeUnit(val = "0") {
154479
154535
  const length3 = val.toString() || "0";
154480
154536
  const value = Number.parseFloat(length3);
@@ -157066,8 +157122,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
157066
157122
  }
157067
157123
  };
157068
157124
  };
157069
- var init_create_headless_toolbar_B7F814Ir_es = __esm(() => {
157070
- init_SuperConverter_DUDABEsC_es();
157125
+ var init_create_headless_toolbar_C636gY8A_es = __esm(() => {
157126
+ init_SuperConverter_B4pTwmbr_es();
157071
157127
  init_constants_CGhJRd87_es();
157072
157128
  init_dist_B8HfvhaK_es();
157073
157129
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -158514,7 +158570,7 @@ var init_decrypt_docx_Bs1PbPQR_es = __esm(() => {
158514
158570
  ]);
158515
158571
  });
158516
158572
 
158517
- // ../../packages/superdoc/dist/chunks/DocxZipper-CaIWmehq.es.js
158573
+ // ../../packages/superdoc/dist/chunks/DocxZipper-BBjEXAFw.es.js
158518
158574
  function sniffEncoding(u8) {
158519
158575
  if (u8.length >= 2) {
158520
158576
  const b0 = u8[0], b1 = u8[1];
@@ -158959,11 +159015,17 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
158959
159015
  typesString += commentsExtendedDef;
158960
159016
  }
158961
159017
  const hasFootnotes = types3.elements?.some((el) => el.name === "Override" && el.attributes.PartName === "/word/footnotes.xml");
159018
+ const hasEndnotes = types3.elements?.some((el) => el.name === "Override" && el.attributes.PartName === "/word/endnotes.xml");
158962
159019
  if (hasFile("word/footnotes.xml")) {
158963
159020
  const footnotesDef = `<Override PartName="/word/footnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml" />`;
158964
159021
  if (!hasFootnotes)
158965
159022
  typesString += footnotesDef;
158966
159023
  }
159024
+ if (hasFile("word/endnotes.xml")) {
159025
+ const endnotesDef = `<Override PartName="/word/endnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" />`;
159026
+ if (!hasEndnotes)
159027
+ typesString += endnotesDef;
159028
+ }
158967
159029
  for (const entry of MANAGED_DOCUMENT_PARTS)
158968
159030
  if (hasFile(entry.zipPath) && !hasPartOverride(`/${entry.zipPath}`))
158969
159031
  typesString += `<Override PartName="/${entry.zipPath}" ContentType="${entry.contentType}" />`;
@@ -159159,7 +159221,7 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
159159
159221
  return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
159160
159222
  }
159161
159223
  }, DocxZipper_default;
159162
- var init_DocxZipper_CaIWmehq_es = __esm(() => {
159224
+ var init_DocxZipper_BBjEXAFw_es = __esm(() => {
159163
159225
  init_rolldown_runtime_Bg48TavK_es();
159164
159226
  init_jszip_C49i9kUs_es();
159165
159227
  init_xml_js_CqGKpaft_es();
@@ -205505,7 +205567,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
205505
205567
  init_remark_gfm_BhnWr3yf_es();
205506
205568
  });
205507
205569
 
205508
- // ../../packages/superdoc/dist/chunks/src-oqYJU65d.es.js
205570
+ // ../../packages/superdoc/dist/chunks/src-BvQy1mGL.es.js
205509
205571
  function deleteProps(obj, propOrProps) {
205510
205572
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
205511
205573
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -248746,6 +248808,9 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
248746
248808
  const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
248747
248809
  const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
248748
248810
  const maxWidthForBlock = attrs?.isFullWidth === true && maxWidth > 0 ? Math.max(1, maxWidth - indentLeft - indentRight) : maxWidth;
248811
+ const rawWrap = attrs?.wrap;
248812
+ const isInlineShapeGroup = block.drawingKind === "shapeGroup" && rawWrap?.type === "Inline";
248813
+ const inlineParagraphAlignment = attrs?.inlineParagraphAlignment === "center" || attrs?.inlineParagraphAlignment === "right" ? attrs.inlineParagraphAlignment : undefined;
248749
248814
  if (width > maxWidthForBlock && maxWidthForBlock > 0) {
248750
248815
  const scale = maxWidthForBlock / width;
248751
248816
  width = maxWidthForBlock;
@@ -248762,11 +248827,19 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
248762
248827
  if (state.cursorY + requiredHeight > state.contentBottom && state.cursorY > state.topMargin)
248763
248828
  state = advanceColumn(state);
248764
248829
  const pmRange = extractBlockPmRange(block);
248830
+ let x = columnX(state.columnIndex) + marginLeft + indentLeft;
248831
+ if (isInlineShapeGroup && inlineParagraphAlignment) {
248832
+ const pIndentLeft = typeof attrs?.paragraphIndentLeft === "number" ? attrs.paragraphIndentLeft : 0;
248833
+ const pIndentRight = typeof attrs?.paragraphIndentRight === "number" ? attrs.paragraphIndentRight : 0;
248834
+ const alignBox = Math.max(0, maxWidthForBlock - pIndentLeft - pIndentRight);
248835
+ const extra = Math.max(0, alignBox - width);
248836
+ x += pIndentLeft + (inlineParagraphAlignment === "center" ? extra / 2 : extra);
248837
+ }
248765
248838
  const fragment2 = {
248766
248839
  kind: "drawing",
248767
248840
  blockId: block.id,
248768
248841
  drawingKind: block.drawingKind,
248769
- x: columnX(state.columnIndex) + marginLeft + indentLeft,
248842
+ x,
248770
248843
  y: state.cursorY + marginTop,
248771
248844
  width,
248772
248845
  height,
@@ -257918,6 +257991,26 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, trackedChangesCon
257918
257991
  blockWithAttrs.attrs.anchorParagraphId = anchorParagraphId;
257919
257992
  return blockWithAttrs;
257920
257993
  };
257994
+ const attachInlineShapeGroupAlignment = (block) => {
257995
+ if (block.kind !== "drawing")
257996
+ return block;
257997
+ const drawingBlock = block;
257998
+ const rawWrap = drawingBlock.attrs?.wrap;
257999
+ if (drawingBlock.drawingKind !== "shapeGroup" || rawWrap?.type !== "Inline")
258000
+ return block;
258001
+ const effectiveAlignment = resolvedParagraphProperties.justification === "distribute" ? "center" : paragraphAttrs.alignment;
258002
+ if (effectiveAlignment === "center" || effectiveAlignment === "right") {
258003
+ if (!drawingBlock.attrs)
258004
+ drawingBlock.attrs = {};
258005
+ drawingBlock.attrs.inlineParagraphAlignment = effectiveAlignment;
258006
+ const indent2 = paragraphAttrs.indent;
258007
+ if (typeof indent2?.left === "number")
258008
+ drawingBlock.attrs.paragraphIndentLeft = indent2.left;
258009
+ if (typeof indent2?.right === "number")
258010
+ drawingBlock.attrs.paragraphIndentRight = indent2.right;
258011
+ }
258012
+ return block;
258013
+ };
257921
258014
  const flushParagraph = () => {
257922
258015
  if (currentRuns.length === 0)
257923
258016
  return;
@@ -257999,10 +258092,12 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, trackedChangesCon
257999
258092
  });
258000
258093
  if (block) {
258001
258094
  attachAnchorParagraphId(block, anchorParagraphId);
258095
+ attachInlineShapeGroupAlignment(block);
258002
258096
  blocks2.push(block);
258003
258097
  } else if (newBlocks.length > 0)
258004
258098
  newBlocks.forEach((b$1) => {
258005
258099
  attachAnchorParagraphId(b$1, anchorParagraphId);
258100
+ attachInlineShapeGroupAlignment(b$1);
258006
258101
  blocks2.push(b$1);
258007
258102
  });
258008
258103
  } else
@@ -258015,8 +258110,10 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, trackedChangesCon
258015
258110
  flushParagraph();
258016
258111
  const converter = SHAPE_CONVERTERS_REGISTRY[node3.type];
258017
258112
  const drawingBlock = converter(node3, stableNextBlockId, positions);
258018
- if (drawingBlock)
258113
+ if (drawingBlock) {
258114
+ attachInlineShapeGroupAlignment(drawingBlock);
258019
258115
  blocks2.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
258116
+ }
258020
258117
  return;
258021
258118
  }
258022
258119
  };
@@ -279746,7 +279843,8 @@ var Node$13 = class Node$14 {
279746
279843
  hash$3 = hashString(hash$3, getRunStringProp(run2, "vertAlign"));
279747
279844
  hash$3 = hashNumber(hash$3, getRunNumberProp(run2, "baselineShift"));
279748
279845
  }
279749
- }
279846
+ } else if (cellBlock?.kind)
279847
+ hash$3 = hashString(hash$3, deriveBlockVersion(cellBlock));
279750
279848
  }
279751
279849
  }
279752
279850
  }
@@ -280612,6 +280710,83 @@ var Node$13 = class Node$14 {
280612
280710
  if (frame.vAnchor !== undefined)
280613
280711
  parts.push(`va:${frame.vAnchor}`);
280614
280712
  return parts.join(",");
280713
+ }, getTableCellBlocks = (cell2) => {
280714
+ return cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : []);
280715
+ }, readBlockClipPath = (block) => {
280716
+ if (typeof block.clipPath === "string")
280717
+ return block.clipPath;
280718
+ if (typeof block.attrs?.clipPath === "string")
280719
+ return block.attrs.clipPath;
280720
+ return "";
280721
+ }, hashDrawingGeometry = (geometry) => {
280722
+ return [
280723
+ geometry.width,
280724
+ geometry.height,
280725
+ geometry.rotation ?? 0,
280726
+ geometry.flipH ? 1 : 0,
280727
+ geometry.flipV ? 1 : 0
280728
+ ].join(":");
280729
+ }, hashImageLikeBlock = (block) => {
280730
+ return [
280731
+ block.src.slice(0, 50),
280732
+ block.width ?? "",
280733
+ block.height ?? "",
280734
+ block.alt ?? "",
280735
+ block.title ?? "",
280736
+ block.objectFit ?? "",
280737
+ readBlockClipPath(block),
280738
+ block.rotation ?? "",
280739
+ block.flipH ? 1 : 0,
280740
+ block.flipV ? 1 : 0
280741
+ ].join(":");
280742
+ }, hashListBlock = (block) => {
280743
+ return block.items.map((item) => `${item.id}:${item.marker.text}:${hashRuns(item.paragraph)}`).join("|");
280744
+ }, hashDrawingBlock = (block) => {
280745
+ if (block.drawingKind === "image")
280746
+ return `drawing:image:${hashImageLikeBlock(block)}`;
280747
+ if (block.drawingKind === "vectorShape")
280748
+ return [
280749
+ "drawing:vector",
280750
+ hashDrawingGeometry(block.geometry),
280751
+ block.shapeKind ?? "",
280752
+ JSON.stringify(block.fillColor ?? null),
280753
+ JSON.stringify(block.strokeColor ?? null),
280754
+ block.strokeWidth ?? "",
280755
+ JSON.stringify(block.customGeometry ?? null),
280756
+ JSON.stringify(block.lineEnds ?? null),
280757
+ JSON.stringify(block.effectExtent ?? null),
280758
+ JSON.stringify(block.textContent ?? null),
280759
+ block.textAlign ?? "",
280760
+ block.textVerticalAlign ?? "",
280761
+ JSON.stringify(block.textInsets ?? null)
280762
+ ].join(":");
280763
+ if (block.drawingKind === "shapeGroup")
280764
+ return [
280765
+ "drawing:shapeGroup",
280766
+ hashDrawingGeometry(block.geometry),
280767
+ JSON.stringify(block.groupTransform ?? null),
280768
+ JSON.stringify(block.shapes),
280769
+ block.size?.width ?? "",
280770
+ block.size?.height ?? ""
280771
+ ].join(":");
280772
+ return [
280773
+ "drawing:chart",
280774
+ hashDrawingGeometry(block.geometry),
280775
+ block.chartData?.chartType ?? "",
280776
+ block.chartData?.subType ?? "",
280777
+ JSON.stringify(block.chartData?.series ?? []),
280778
+ block.chartRelId ?? ""
280779
+ ].join(":");
280780
+ }, hashNonParagraphCellBlock = (block) => {
280781
+ if (block.kind === "table")
280782
+ return `table:${hashRuns(block)}`;
280783
+ if (block.kind === "image")
280784
+ return `image:${hashImageLikeBlock(block)}`;
280785
+ if (block.kind === "drawing")
280786
+ return hashDrawingBlock(block);
280787
+ if (block.kind === "list")
280788
+ return `list:${hashListBlock(block)}`;
280789
+ return `${block.kind}:${block.id}`;
280615
280790
  }, hashRuns = (block) => {
280616
280791
  if (block.kind === "table") {
280617
280792
  const tableBlock = block;
@@ -280638,8 +280813,12 @@ var Node$13 = class Node$14 {
280638
280813
  if (cellAttrParts.length > 0)
280639
280814
  cellHashes.push(`ca:${cellAttrParts.join(":")}`);
280640
280815
  }
280641
- const cellBlocks = cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : []);
280816
+ const cellBlocks = getTableCellBlocks(cell2);
280642
280817
  for (const cellBlock of cellBlocks) {
280818
+ if (cellBlock.kind !== "paragraph") {
280819
+ cellHashes.push(`nb:${hashNonParagraphCellBlock(cellBlock)}`);
280820
+ continue;
280821
+ }
280643
280822
  const paragraphBlock = cellBlock;
280644
280823
  if (!paragraphBlock.runs)
280645
280824
  continue;
@@ -286255,7 +286434,8 @@ var Node$13 = class Node$14 {
286255
286434
  try {
286256
286435
  const sdtBlock = clickDepth === 1 ? this.#findStructuredContentBlockAtPos(doc$12, hit.pos) : null;
286257
286436
  let nextSelection;
286258
- if (sdtBlock)
286437
+ const insideTableInSdt = !!sdtBlock && this.#isInsideTableWithinStructuredContentBlock(doc$12, hit.pos, sdtBlock.pos);
286438
+ if (sdtBlock && !insideTableInSdt)
286259
286439
  nextSelection = NodeSelection.create(doc$12, sdtBlock.pos);
286260
286440
  else {
286261
286441
  nextSelection = TextSelection.create(doc$12, hit.pos);
@@ -286485,6 +286665,29 @@ var Node$13 = class Node$14 {
286485
286665
  }
286486
286666
  return null;
286487
286667
  }
286668
+ #isInsideTableWithinStructuredContentBlock(doc$12, pos, sdtPos) {
286669
+ if (!Number.isFinite(pos) || !Number.isFinite(sdtPos))
286670
+ return false;
286671
+ try {
286672
+ const $pos = doc$12.resolve(pos);
286673
+ let tableDepth = -1;
286674
+ let blockDepth = -1;
286675
+ for (let depth = $pos.depth;depth > 0; depth--) {
286676
+ const nodeName = $pos.node(depth)?.type?.name;
286677
+ if (tableDepth === -1 && nodeName === "table")
286678
+ tableDepth = depth;
286679
+ if (nodeName === "structuredContentBlock") {
286680
+ if ($pos.before(depth) === sdtPos) {
286681
+ blockDepth = depth;
286682
+ break;
286683
+ }
286684
+ }
286685
+ }
286686
+ return tableDepth !== -1 && blockDepth !== -1 && tableDepth > blockDepth;
286687
+ } catch {
286688
+ return false;
286689
+ }
286690
+ }
286488
286691
  #findStructuredContentBlockById(doc$12, id2) {
286489
286692
  let found2 = null;
286490
286693
  doc$12.descendants((node3, pos) => {
@@ -289319,18 +289522,18 @@ var Node$13 = class Node$14 {
289319
289522
  return;
289320
289523
  console.log(...args$1);
289321
289524
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
289322
- var init_src_oqYJU65d_es = __esm(() => {
289525
+ var init_src_BvQy1mGL_es = __esm(() => {
289323
289526
  init_rolldown_runtime_Bg48TavK_es();
289324
- init_SuperConverter_DUDABEsC_es();
289527
+ init_SuperConverter_B4pTwmbr_es();
289325
289528
  init_jszip_C49i9kUs_es();
289326
289529
  init_uuid_qzgm05fK_es();
289327
- init_create_headless_toolbar_B7F814Ir_es();
289530
+ init_create_headless_toolbar_C636gY8A_es();
289328
289531
  init_constants_CGhJRd87_es();
289329
289532
  init_dist_B8HfvhaK_es();
289330
289533
  init_unified_Dsuw2be5_es();
289331
289534
  init_remark_gfm_BhnWr3yf_es();
289332
289535
  init_remark_stringify_6MMJfY0k_es();
289333
- init_DocxZipper_CaIWmehq_es();
289536
+ init_DocxZipper_BBjEXAFw_es();
289334
289537
  init__plugin_vue_export_helper_HmhZBO0u_es();
289335
289538
  init_eventemitter3_BdNugZrm_es();
289336
289539
  init_errors_CtyzHiH4_es();
@@ -314174,6 +314377,12 @@ function print() { __p += __j.call(arguments, '') }
314174
314377
  const footnotesXml = footnotesData?.elements?.[0] ? this.converter.schemaToXml(footnotesData.elements[0]) : null;
314175
314378
  const footnotesRelsData = this.converter.convertedXml["word/_rels/footnotes.xml.rels"];
314176
314379
  const footnotesRelsXml = footnotesRelsData?.elements?.[0] ? this.converter.schemaToXml(footnotesRelsData.elements[0]) : null;
314380
+ const endnotesData = this.converter.convertedXml["word/endnotes.xml"];
314381
+ const endnotesXml = endnotesData?.elements?.[0] ? this.converter.schemaToXml(endnotesData.elements[0]) : null;
314382
+ const endnotesRelsData = this.converter.convertedXml["word/_rels/endnotes.xml.rels"];
314383
+ const endnotesRelsXml = endnotesRelsData?.elements?.[0] ? this.converter.schemaToXml(endnotesRelsData.elements[0]) : null;
314384
+ const settingsRelsData = this.converter.convertedXml["word/_rels/settings.xml.rels"];
314385
+ const settingsRelsXml = settingsRelsData?.elements?.[0] ? this.converter.schemaToXml(settingsRelsData.elements[0]) : null;
314177
314386
  const media2 = this.converter.addedMedia;
314178
314387
  const updatedHeadersFooters = {};
314179
314388
  Object.entries(this.converter.convertedXml).forEach(([name, json$1]) => {
@@ -314200,12 +314409,22 @@ function print() { __p += __j.call(arguments, '') }
314200
314409
  ...appXml ? { "docProps/app.xml": String(appXml) } : {},
314201
314410
  ...coreXml ? { "docProps/core.xml": String(coreXml) } : {}
314202
314411
  };
314203
- if (hasCustomSettings)
314204
- updatedDocs["word/settings.xml"] = String(customSettings);
314412
+ if (hasCustomSettings) {
314413
+ let settingsXml = String(customSettings);
314414
+ if (settingsRelsXml)
314415
+ updatedDocs["word/_rels/settings.xml.rels"] = String(settingsRelsXml);
314416
+ else if (/<\w+:attachedTemplate\b/i.test(settingsXml))
314417
+ settingsXml = settingsXml.replace(/<\w+:attachedTemplate\b[^>]*\/?>/gi, "");
314418
+ updatedDocs["word/settings.xml"] = settingsXml;
314419
+ }
314205
314420
  if (footnotesXml)
314206
314421
  updatedDocs["word/footnotes.xml"] = String(footnotesXml);
314207
314422
  if (footnotesRelsXml)
314208
314423
  updatedDocs["word/_rels/footnotes.xml.rels"] = String(footnotesRelsXml);
314424
+ if (endnotesXml)
314425
+ updatedDocs["word/endnotes.xml"] = String(endnotesXml);
314426
+ if (endnotesRelsXml)
314427
+ updatedDocs["word/_rels/endnotes.xml.rels"] = String(endnotesRelsXml);
314209
314428
  const commentFiles = COMMENT_FILE_BASENAMES.map((name) => `word/${name}`);
314210
314429
  for (const path2 of commentFiles) {
314211
314430
  const data = this.converter.convertedXml[path2];
@@ -314220,6 +314439,17 @@ function print() { __p += __j.call(arguments, '') }
314220
314439
  if (partData?.elements?.[0])
314221
314440
  updatedDocs[path2] = String(this.converter.schemaToXml(partData.elements[0]));
314222
314441
  }
314442
+ for (const path2 of Object.keys(this.converter.convertedXml)) {
314443
+ if (!path2.startsWith("customXml/"))
314444
+ continue;
314445
+ if (!path2.endsWith(".xml") && !path2.endsWith(".rels"))
314446
+ continue;
314447
+ if (Object.prototype.hasOwnProperty.call(updatedDocs, path2))
314448
+ continue;
314449
+ const partData = this.converter.convertedXml[path2];
314450
+ if (partData?.elements?.[0])
314451
+ updatedDocs[path2] = String(this.converter.schemaToXml(partData.elements[0]));
314452
+ }
314223
314453
  const zipper = new DocxZipper_default;
314224
314454
  if (getUpdatedDocs) {
314225
314455
  updatedDocs["[Content_Types].xml"] = await zipper.updateContentTypes({ files: this.options.content }, media2, true, updatedDocs, this.options.fonts);
@@ -324069,15 +324299,15 @@ var init_zipper_DbkgrypV_es = __esm(() => {
324069
324299
 
324070
324300
  // ../../packages/superdoc/dist/super-editor.es.js
324071
324301
  var init_super_editor_es = __esm(() => {
324072
- init_src_oqYJU65d_es();
324073
- init_SuperConverter_DUDABEsC_es();
324302
+ init_src_BvQy1mGL_es();
324303
+ init_SuperConverter_B4pTwmbr_es();
324074
324304
  init_jszip_C49i9kUs_es();
324075
324305
  init_xml_js_CqGKpaft_es();
324076
- init_create_headless_toolbar_B7F814Ir_es();
324306
+ init_create_headless_toolbar_C636gY8A_es();
324077
324307
  init_constants_CGhJRd87_es();
324078
324308
  init_dist_B8HfvhaK_es();
324079
324309
  init_unified_Dsuw2be5_es();
324080
- init_DocxZipper_CaIWmehq_es();
324310
+ init_DocxZipper_BBjEXAFw_es();
324081
324311
  init_eventemitter3_BdNugZrm_es();
324082
324312
  init_errors_CtyzHiH4_es();
324083
324313
  init_zipper_DbkgrypV_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.7.0-next.22",
3
+ "version": "0.7.0-next.23",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -34,11 +34,11 @@
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.7.0-next.22",
38
- "@superdoc-dev/cli-darwin-x64": "0.7.0-next.22",
39
- "@superdoc-dev/cli-linux-x64": "0.7.0-next.22",
40
- "@superdoc-dev/cli-linux-arm64": "0.7.0-next.22",
41
- "@superdoc-dev/cli-windows-x64": "0.7.0-next.22"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.7.0-next.23",
38
+ "@superdoc-dev/cli-darwin-x64": "0.7.0-next.23",
39
+ "@superdoc-dev/cli-linux-x64": "0.7.0-next.23",
40
+ "@superdoc-dev/cli-windows-x64": "0.7.0-next.23",
41
+ "@superdoc-dev/cli-linux-arm64": "0.7.0-next.23"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",