@superdoc-dev/cli 0.16.0-next.7 → 0.16.0-next.9

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 +87 -32
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -68110,7 +68110,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
68110
68110
  emptyOptions2 = {};
68111
68111
  });
68112
68112
 
68113
- // ../../packages/superdoc/dist/chunks/SuperConverter-b2GjELX4.es.js
68113
+ // ../../packages/superdoc/dist/chunks/SuperConverter-D9c2ow57.es.js
68114
68114
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68115
68115
  const fieldValue = extension$1.config[field];
68116
68116
  if (typeof fieldValue === "function")
@@ -80629,6 +80629,42 @@ function handleDocumentSectionNode$1(params3) {
80629
80629
  }
80630
80630
  };
80631
80631
  }
80632
+ function hasDirectBlockSignal(sdtContent) {
80633
+ return Boolean(sdtContent?.elements?.some((el) => el?.name === "w:p" || el?.name === "w:tbl" || BLOCK_FIELD_XML_NAMES.has(el?.name)));
80634
+ }
80635
+ function canEmitInlineStructuredContent(path2 = []) {
80636
+ return path2.some((entry) => INLINE_CONTEXT_XML_NAMES.has(entry?.name) || entry?.name === "w:sdtContent");
80637
+ }
80638
+ function hasTranslatedBlockContent(content$2 = [], schema) {
80639
+ return content$2.some((node3) => node3?.type && !isInlineNode(node3, schema));
80640
+ }
80641
+ function wrapInlineRunsAsParagraphs(content$2 = [], schema) {
80642
+ const normalized = [];
80643
+ let pendingInline = [];
80644
+ const flushInline = () => {
80645
+ if (!pendingInline.length)
80646
+ return;
80647
+ normalized.push({
80648
+ type: "paragraph",
80649
+ attrs: null,
80650
+ content: pendingInline,
80651
+ marks: []
80652
+ });
80653
+ pendingInline = [];
80654
+ };
80655
+ for (const node3 of content$2) {
80656
+ if (!node3)
80657
+ continue;
80658
+ if (isInlineNode(node3, schema)) {
80659
+ pendingInline.push(node3);
80660
+ continue;
80661
+ }
80662
+ flushInline();
80663
+ normalized.push(node3);
80664
+ }
80665
+ flushInline();
80666
+ return normalized;
80667
+ }
80632
80668
  function detectControlType(sdtPr) {
80633
80669
  if (!sdtPr?.elements)
80634
80670
  return "richText";
@@ -80703,18 +80739,18 @@ function handleStructuredContentNode(params3) {
80703
80739
  const temporary = extractTemporary(sdtPr);
80704
80740
  if (!sdtContent)
80705
80741
  return null;
80706
- const paragraph2 = sdtContent.elements?.find((el) => el.name === "w:p");
80707
- const table = sdtContent.elements?.find((el) => el.name === "w:tbl");
80708
- const blockField = sdtContent.elements?.find((el) => BLOCK_FIELD_XML_NAMES.has(el?.name));
80709
80742
  const { marks } = parseAnnotationMarks(sdtContent);
80710
80743
  const translatedContent = nodeListHandler.handler({
80711
80744
  ...params3,
80712
80745
  nodes: sdtContent.elements,
80713
80746
  path: [...params3.path || [], sdtContent]
80714
80747
  });
80748
+ const schema = params3.editor?.schema;
80749
+ const content$2 = Array.isArray(translatedContent) ? translatedContent : [];
80750
+ const isBlockNode$1 = hasTranslatedBlockContent(content$2, schema) || hasDirectBlockSignal(sdtContent) || !canEmitInlineStructuredContent(params3.path);
80715
80751
  return {
80716
- type: paragraph2 || table || blockField ? "structuredContentBlock" : "structuredContent",
80717
- content: translatedContent,
80752
+ type: isBlockNode$1 ? "structuredContentBlock" : "structuredContent",
80753
+ content: isBlockNode$1 ? wrapInlineRunsAsParagraphs(content$2, schema) : content$2,
80718
80754
  marks,
80719
80755
  attrs: {
80720
80756
  id: id2?.attributes?.["w:val"] || null,
@@ -114466,7 +114502,7 @@ var isRegExp = (value) => {
114466
114502
  normalized.push(node3);
114467
114503
  });
114468
114504
  return normalized;
114469
- }, BLOCK_FIELD_XML_NAMES, lower16 = 65535, factor16, DEL_BEFORE = 1, DEL_AFTER = 2, DEL_ACROSS = 4, DEL_SIDE = 8, MapResult = class {
114505
+ }, BLOCK_FIELD_XML_NAMES, INLINE_CONTEXT_XML_NAMES, lower16 = 65535, factor16, DEL_BEFORE = 1, DEL_AFTER = 2, DEL_ACROSS = 4, DEL_SIDE = 8, MapResult = class {
114470
114506
  constructor(pos, delInfo, recover) {
114471
114507
  this.pos = pos;
114472
114508
  this.delInfo = delInfo;
@@ -130660,7 +130696,7 @@ var isRegExp = (value) => {
130660
130696
  state.kern = kernNode.attributes["w:val"];
130661
130697
  }
130662
130698
  }, SuperConverter;
130663
- var init_SuperConverter_b2GjELX4_es = __esm(() => {
130699
+ var init_SuperConverter_D9c2ow57_es = __esm(() => {
130664
130700
  init_rolldown_runtime_Bg48TavK_es();
130665
130701
  init_jszip_C49i9kUs_es();
130666
130702
  init_xml_js_CqGKpaft_es();
@@ -147105,6 +147141,7 @@ var init_SuperConverter_b2GjELX4_es = __esm(() => {
147105
147141
  "endnoteReference",
147106
147142
  "fieldAnnotation",
147107
147143
  "structuredContent",
147144
+ "image",
147108
147145
  "mathInline",
147109
147146
  "passthroughInline",
147110
147147
  "page-number",
@@ -147422,6 +147459,12 @@ var init_SuperConverter_b2GjELX4_es = __esm(() => {
147422
147459
  "sd:bibliography",
147423
147460
  "sd:tableOfAuthorities"
147424
147461
  ]);
147462
+ INLINE_CONTEXT_XML_NAMES = new Set([
147463
+ "w:p",
147464
+ "w:r",
147465
+ "w:hyperlink",
147466
+ "w:smartTag"
147467
+ ]);
147425
147468
  factor16 = Math.pow(2, 16);
147426
147469
  StepMap.empty = new StepMap([]);
147427
147470
  stepsByID = Object.create(null);
@@ -169427,7 +169470,7 @@ var init_SuperConverter_b2GjELX4_es = __esm(() => {
169427
169470
  };
169428
169471
  });
169429
169472
 
169430
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BSnV7Mdp.es.js
169473
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-evnTxkbH.es.js
169431
169474
  function parseSizeUnit(val = "0") {
169432
169475
  const length3 = val.toString() || "0";
169433
169476
  const value = Number.parseFloat(length3);
@@ -179758,8 +179801,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
179758
179801
  }
179759
179802
  };
179760
179803
  };
179761
- var init_create_headless_toolbar_BSnV7Mdp_es = __esm(() => {
179762
- init_SuperConverter_b2GjELX4_es();
179804
+ var init_create_headless_toolbar_evnTxkbH_es = __esm(() => {
179805
+ init_SuperConverter_D9c2ow57_es();
179763
179806
  init_uuid_qzgm05fK_es();
179764
179807
  init_constants_D_X7xF4s_es();
179765
179808
  init_dist_B8HfvhaK_es();
@@ -228922,7 +228965,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
228922
228965
  init_remark_gfm_BhnWr3yf_es();
228923
228966
  });
228924
228967
 
228925
- // ../../packages/superdoc/dist/chunks/src-BuzqViEa.es.js
228968
+ // ../../packages/superdoc/dist/chunks/src-BJS18wJQ.es.js
228926
228969
  function deleteProps(obj, propOrProps) {
228927
228970
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
228928
228971
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -269354,6 +269397,7 @@ function resolveLayout(input2) {
269354
269397
  items: page.fragments.map((fragment2, fragmentIndex) => resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap, blockVersionCache)),
269355
269398
  margins: page.margins,
269356
269399
  footnoteReserved: page.footnoteReserved,
269400
+ displayNumber: page.displayNumber,
269357
269401
  numberText: page.numberText,
269358
269402
  vAlign: page.vAlign,
269359
269403
  baseMargins: page.baseMargins,
@@ -269379,6 +269423,7 @@ function resolveHeaderFooterLayout(layout, blocks2, measures, story) {
269379
269423
  const blockVersionCache = /* @__PURE__ */ new Map;
269380
269424
  return {
269381
269425
  number: page.number,
269426
+ displayNumber: page.displayNumber,
269382
269427
  numberText: page.numberText,
269383
269428
  items: page.fragments.map((fragment2, fragmentIndex) => resolveFragmentItem(fragment2, fragmentIndex, page.number - 1, blockMap, blockVersionCache, story))
269384
269429
  };
@@ -272556,7 +272601,7 @@ function layoutDocument(blocks2, measures, options = {}) {
272556
272601
  if (args$1.sectionPageNumber === 1 && args$1.titlePgEnabled)
272557
272602
  return "first";
272558
272603
  if (args$1.alternateHeaders)
272559
- return args$1.documentPageNumber % 2 === 0 ? "even" : "odd";
272604
+ return args$1.parityPageNumber % 2 === 0 ? "even" : "odd";
272560
272605
  return "default";
272561
272606
  };
272562
272607
  const getHeaderHeightForPage = (variantType, headerRef, sectionIndex) => {
@@ -273161,7 +273206,7 @@ function layoutDocument(blocks2, measures, options = {}) {
273161
273206
  const alternateHeaders = options.alternateHeaders ?? false;
273162
273207
  const variantType = getVariantTypeForPage({
273163
273208
  sectionPageNumber,
273164
- documentPageNumber: newPageNumber,
273209
+ parityPageNumber: activePageCounter,
273165
273210
  titlePgEnabled,
273166
273211
  alternateHeaders
273167
273212
  });
@@ -273202,6 +273247,7 @@ function layoutDocument(blocks2, measures, options = {}) {
273202
273247
  return;
273203
273248
  }
273204
273249
  if (state?.page) {
273250
+ state.page.displayNumber = activePageCounter;
273205
273251
  state.page.numberText = formatPageNumber(activePageCounter, activeNumberFormat);
273206
273252
  state.page.sectionIndex = activeSectionIndex;
273207
273253
  layoutLog(`[Layout] Page ${state.page.number}: Stamped sectionIndex:`, activeSectionIndex);
@@ -274544,6 +274590,7 @@ function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, opt
274544
274590
  return null;
274545
274591
  const kind = options?.kind ?? "header";
274546
274592
  const sectionPageNumber = options?.sectionPageNumber ?? pageNumber;
274593
+ const parityPageNumber = options?.parityPageNumber ?? pageNumber;
274547
274594
  const ids = (kind === "header" ? identifier.sectionHeaderIds.get(sectionIndex) : identifier.sectionFooterIds.get(sectionIndex)) ?? (kind === "header" ? identifier.headerIds : identifier.footerIds);
274548
274595
  const hasFirst = Boolean(ids.first);
274549
274596
  const hasEven = Boolean(ids.even);
@@ -274570,7 +274617,7 @@ function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, opt
274570
274617
  if (identifier.alternateHeaders) {
274571
274618
  if (!hasAny)
274572
274619
  return null;
274573
- return pageNumber % 2 === 0 ? "even" : "odd";
274620
+ return parityPageNumber % 2 === 0 ? "even" : "odd";
274574
274621
  }
274575
274622
  if (hasDefault)
274576
274623
  return "default";
@@ -313506,7 +313553,9 @@ menclose::after {
313506
313553
  }, getHeaderFooterType2 = (pageNumber, identifier, options) => {
313507
313554
  if (pageNumber <= 0)
313508
313555
  return null;
313509
- const ids = (options?.kind ?? "header") === "header" ? identifier.headerIds : identifier.footerIds;
313556
+ const kind = options?.kind ?? "header";
313557
+ const parityPageNumber = options?.parityPageNumber ?? pageNumber;
313558
+ const ids = kind === "header" ? identifier.headerIds : identifier.footerIds;
313510
313559
  const hasFirst = Boolean(ids.first);
313511
313560
  const hasEven = Boolean(ids.even);
313512
313561
  const hasOdd = Boolean(ids.odd);
@@ -313515,9 +313564,9 @@ menclose::after {
313515
313564
  if (pageNumber === 1 && titlePgEnabled)
313516
313565
  return "first";
313517
313566
  if (identifier.alternateHeaders) {
313518
- if (pageNumber % 2 === 0 && hasEven)
313567
+ if (parityPageNumber % 2 === 0 && hasEven)
313519
313568
  return "even";
313520
- if (pageNumber % 2 === 1 && (hasOdd || hasDefault))
313569
+ if (parityPageNumber % 2 !== 0 && (hasOdd || hasDefault))
313521
313570
  return hasOdd ? "odd" : "default";
313522
313571
  return null;
313523
313572
  }
@@ -320710,7 +320759,7 @@ menclose::after {
320710
320759
  if (isFirstPageOfSection && titlePgEnabled)
320711
320760
  return "first";
320712
320761
  if (hasAlternateHeaders)
320713
- return page.number % 2 === 0 ? "even" : "odd";
320762
+ return (page.displayNumber ?? page.number) % 2 === 0 ? "even" : "odd";
320714
320763
  return "default";
320715
320764
  }
320716
320765
  #stripFootnoteReserveFromBottomMargin(margins, page) {
@@ -321021,6 +321070,7 @@ menclose::after {
321021
321070
  },
321022
321071
  pages: activeLayoutResult.layout.pages.map((page) => ({
321023
321072
  number: page.number,
321073
+ displayNumber: page.displayNumber,
321024
321074
  numberText: page.numberText,
321025
321075
  fragments: page.fragments
321026
321076
  }))
@@ -321094,10 +321144,15 @@ menclose::after {
321094
321144
  const sectionIndex = page?.sectionIndex ?? 0;
321095
321145
  const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
321096
321146
  const sectionPageNumber = typeof firstPageInSection === "number" ? pageNumber - firstPageInSection + 1 : pageNumber;
321147
+ const parityPageNumber = page?.displayNumber ?? pageNumber;
321097
321148
  const headerFooterType = multiSectionId ? getHeaderFooterTypeForSection(pageNumber, sectionIndex, multiSectionId, {
321098
321149
  kind,
321099
- sectionPageNumber
321100
- }) : getHeaderFooterType2(pageNumber, legacyIdentifier, { kind });
321150
+ sectionPageNumber,
321151
+ parityPageNumber
321152
+ }) : getHeaderFooterType2(pageNumber, legacyIdentifier, {
321153
+ kind,
321154
+ parityPageNumber
321155
+ });
321101
321156
  let sectionRId;
321102
321157
  if (page?.sectionRefs && kind === "header") {
321103
321158
  sectionRId = page.sectionRefs.headerRefs?.[headerFooterType];
@@ -321623,13 +321678,13 @@ menclose::after {
321623
321678
  return;
321624
321679
  console.log(...args$1);
321625
321680
  }, 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, TRACKED_MARK_NAMES;
321626
- var init_src_BuzqViEa_es = __esm(() => {
321681
+ var init_src_BJS18wJQ_es = __esm(() => {
321627
321682
  init_rolldown_runtime_Bg48TavK_es();
321628
- init_SuperConverter_b2GjELX4_es();
321683
+ init_SuperConverter_D9c2ow57_es();
321629
321684
  init_jszip_C49i9kUs_es();
321630
321685
  init_xml_js_CqGKpaft_es();
321631
321686
  init_uuid_qzgm05fK_es();
321632
- init_create_headless_toolbar_BSnV7Mdp_es();
321687
+ init_create_headless_toolbar_evnTxkbH_es();
321633
321688
  init_constants_D_X7xF4s_es();
321634
321689
  init_dist_B8HfvhaK_es();
321635
321690
  init_unified_Dsuw2be5_es();
@@ -355941,11 +355996,11 @@ function print() { __p += __j.call(arguments, '') }
355941
355996
  ]);
355942
355997
  });
355943
355998
 
355944
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BNdktf8e.es.js
355999
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DX0SYUhT.es.js
355945
356000
  var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
355946
- var init_create_super_doc_ui_BNdktf8e_es = __esm(() => {
355947
- init_SuperConverter_b2GjELX4_es();
355948
- init_create_headless_toolbar_BSnV7Mdp_es();
356001
+ var init_create_super_doc_ui_DX0SYUhT_es = __esm(() => {
356002
+ init_SuperConverter_D9c2ow57_es();
356003
+ init_create_headless_toolbar_evnTxkbH_es();
355949
356004
  MOD_ALIASES = new Set([
355950
356005
  "Mod",
355951
356006
  "Meta",
@@ -355987,16 +356042,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
355987
356042
 
355988
356043
  // ../../packages/superdoc/dist/super-editor.es.js
355989
356044
  var init_super_editor_es = __esm(() => {
355990
- init_src_BuzqViEa_es();
355991
- init_SuperConverter_b2GjELX4_es();
356045
+ init_src_BJS18wJQ_es();
356046
+ init_SuperConverter_D9c2ow57_es();
355992
356047
  init_jszip_C49i9kUs_es();
355993
356048
  init_xml_js_CqGKpaft_es();
355994
- init_create_headless_toolbar_BSnV7Mdp_es();
356049
+ init_create_headless_toolbar_evnTxkbH_es();
355995
356050
  init_constants_D_X7xF4s_es();
355996
356051
  init_dist_B8HfvhaK_es();
355997
356052
  init_unified_Dsuw2be5_es();
355998
356053
  init_DocxZipper_nv_KfOqb_es();
355999
- init_create_super_doc_ui_BNdktf8e_es();
356054
+ init_create_super_doc_ui_DX0SYUhT_es();
356000
356055
  init_ui_C5PAS9hY_es();
356001
356056
  init_eventemitter3_BnGqBE_Q_es();
356002
356057
  init_errors_CNaD6vcg_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.16.0-next.7",
3
+ "version": "0.16.0-next.9",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -25,19 +25,19 @@
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
27
  "@superdoc/document-api": "0.0.1",
28
- "superdoc": "1.38.0",
29
- "@superdoc/super-editor": "0.0.1"
28
+ "@superdoc/super-editor": "0.0.1",
29
+ "superdoc": "1.38.0"
30
30
  },
31
31
  "module": "src/index.ts",
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@superdoc-dev/cli-darwin-x64": "0.16.0-next.7",
37
- "@superdoc-dev/cli-darwin-arm64": "0.16.0-next.7",
38
- "@superdoc-dev/cli-linux-x64": "0.16.0-next.7",
39
- "@superdoc-dev/cli-windows-x64": "0.16.0-next.7",
40
- "@superdoc-dev/cli-linux-arm64": "0.16.0-next.7"
36
+ "@superdoc-dev/cli-darwin-x64": "0.16.0-next.9",
37
+ "@superdoc-dev/cli-darwin-arm64": "0.16.0-next.9",
38
+ "@superdoc-dev/cli-linux-x64": "0.16.0-next.9",
39
+ "@superdoc-dev/cli-windows-x64": "0.16.0-next.9",
40
+ "@superdoc-dev/cli-linux-arm64": "0.16.0-next.9"
41
41
  },
42
42
  "scripts": {
43
43
  "predev": "node scripts/ensure-superdoc-build.js",