@superdoc-dev/cli 0.16.0-next.8 → 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 +66 -23
  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-ChnIPJVE.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) => {
@@ -321635,13 +321678,13 @@ menclose::after {
321635
321678
  return;
321636
321679
  console.log(...args$1);
321637
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;
321638
- var init_src_ChnIPJVE_es = __esm(() => {
321681
+ var init_src_BJS18wJQ_es = __esm(() => {
321639
321682
  init_rolldown_runtime_Bg48TavK_es();
321640
- init_SuperConverter_b2GjELX4_es();
321683
+ init_SuperConverter_D9c2ow57_es();
321641
321684
  init_jszip_C49i9kUs_es();
321642
321685
  init_xml_js_CqGKpaft_es();
321643
321686
  init_uuid_qzgm05fK_es();
321644
- init_create_headless_toolbar_BSnV7Mdp_es();
321687
+ init_create_headless_toolbar_evnTxkbH_es();
321645
321688
  init_constants_D_X7xF4s_es();
321646
321689
  init_dist_B8HfvhaK_es();
321647
321690
  init_unified_Dsuw2be5_es();
@@ -355953,11 +355996,11 @@ function print() { __p += __j.call(arguments, '') }
355953
355996
  ]);
355954
355997
  });
355955
355998
 
355956
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BNdktf8e.es.js
355999
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DX0SYUhT.es.js
355957
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;
355958
- var init_create_super_doc_ui_BNdktf8e_es = __esm(() => {
355959
- init_SuperConverter_b2GjELX4_es();
355960
- 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();
355961
356004
  MOD_ALIASES = new Set([
355962
356005
  "Mod",
355963
356006
  "Meta",
@@ -355999,16 +356042,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
355999
356042
 
356000
356043
  // ../../packages/superdoc/dist/super-editor.es.js
356001
356044
  var init_super_editor_es = __esm(() => {
356002
- init_src_ChnIPJVE_es();
356003
- init_SuperConverter_b2GjELX4_es();
356045
+ init_src_BJS18wJQ_es();
356046
+ init_SuperConverter_D9c2ow57_es();
356004
356047
  init_jszip_C49i9kUs_es();
356005
356048
  init_xml_js_CqGKpaft_es();
356006
- init_create_headless_toolbar_BSnV7Mdp_es();
356049
+ init_create_headless_toolbar_evnTxkbH_es();
356007
356050
  init_constants_D_X7xF4s_es();
356008
356051
  init_dist_B8HfvhaK_es();
356009
356052
  init_unified_Dsuw2be5_es();
356010
356053
  init_DocxZipper_nv_KfOqb_es();
356011
- init_create_super_doc_ui_BNdktf8e_es();
356054
+ init_create_super_doc_ui_DX0SYUhT_es();
356012
356055
  init_ui_C5PAS9hY_es();
356013
356056
  init_eventemitter3_BnGqBE_Q_es();
356014
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.8",
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-arm64": "0.16.0-next.8",
37
- "@superdoc-dev/cli-darwin-x64": "0.16.0-next.8",
38
- "@superdoc-dev/cli-linux-arm64": "0.16.0-next.8",
39
- "@superdoc-dev/cli-windows-x64": "0.16.0-next.8",
40
- "@superdoc-dev/cli-linux-x64": "0.16.0-next.8"
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",