@superdoc-dev/cli 0.17.0-next.45 → 0.17.0-next.47

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 +69 -32
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -2055,7 +2055,7 @@ More content with **bold** and *italic*.`
2055
2055
  },
2056
2056
  "blocks.list": {
2057
2057
  memberPath: "blocks.list",
2058
- description: "List top-level blocks in document order with IDs, types, text previews, and optional full text when includeText:true. Supports pagination via offset/limit, optional nodeType filtering, and single-story scoping via `in: <StoryLocator>`.",
2058
+ description: "List top-level blocks in document order with IDs, types, text previews, and optional full text when includeText:true. Text, previews, lengths, and formatting hints use the VISIBLE model: pending tracked deletions are excluded (matching how edit refs resolve), and inline atoms render as a single placeholder character. Supports pagination via offset/limit, optional nodeType filtering, and single-story scoping via `in: <StoryLocator>`.",
2059
2059
  expectedResult: "Returns a BlocksListResult with total block count, an ordered array of block entries (ordinal, nodeId, nodeType, textPreview, optional text, isEmpty), and the current document revision.",
2060
2060
  requiresDocumentContext: true,
2061
2061
  metadata: readOperation({
@@ -68210,7 +68210,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
68210
68210
  emptyOptions2 = {};
68211
68211
  });
68212
68212
 
68213
- // ../../packages/superdoc/dist/chunks/SuperConverter-DlrS7cQT.es.js
68213
+ // ../../packages/superdoc/dist/chunks/SuperConverter-ObBDHFlA.es.js
68214
68214
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68215
68215
  const fieldValue = extension$1.config[field];
68216
68216
  if (typeof fieldValue === "function")
@@ -76961,6 +76961,18 @@ function generateDocxRandomId(length3 = 8) {
76961
76961
  function generateRandomSigned32BitIntStrId() {
76962
76962
  return Math.floor(Math.random() * 2147483647).toString();
76963
76963
  }
76964
+ function addLinkMarkToContentNode(contentNode, linkMark, referenceNodeTypes) {
76965
+ if (contentNode.name === "w:ins" || contentNode.name === "w:del") {
76966
+ (contentNode.elements || []).forEach((child) => addLinkMarkToContentNode(child, linkMark, referenceNodeTypes));
76967
+ return;
76968
+ }
76969
+ if (contentNode.name !== "w:r" && !referenceNodeTypes.includes(contentNode.name))
76970
+ return;
76971
+ addLinkMark(contentNode, linkMark);
76972
+ }
76973
+ function addLinkMark(node3, linkMark) {
76974
+ node3.marks = [...(Array.isArray(node3.marks) ? node3.marks : []).filter((mark) => mark?.type !== "link"), linkMark];
76975
+ }
76964
76976
  function decode$68(params3) {
76965
76977
  const { hyperlinkGroup = [params3.node] } = params3.extraParams || {};
76966
76978
  const linkMark = hyperlinkGroup[0].marks.find((m) => m.type === "link");
@@ -76969,17 +76981,29 @@ function decode$68(params3) {
76969
76981
  node: linkMark
76970
76982
  });
76971
76983
  let { href: link2, anchor } = linkMark.attrs;
76972
- if (!linkAttrs["r:id"] && !anchor)
76973
- linkAttrs["r:id"] = _addNewLinkRelationship(params3, link2);
76974
76984
  let contentNodes = [];
76975
76985
  hyperlinkGroup.forEach((linkNode) => {
76986
+ let nodeWithoutLink = linkNode;
76976
76987
  if ("marks" in linkNode)
76977
- linkNode.marks = linkNode.marks.filter((m) => m.type !== "link");
76988
+ nodeWithoutLink = {
76989
+ ...linkNode,
76990
+ marks: linkNode.marks.filter((m) => m.type !== "link")
76991
+ };
76978
76992
  else
76979
- linkNode.attrs.marksAsAttrs = linkNode.attrs.marksAsAttrs.filter((m) => m.type !== "link");
76993
+ nodeWithoutLink = {
76994
+ ...linkNode,
76995
+ attrs: {
76996
+ ...linkNode.attrs,
76997
+ marksAsAttrs: linkNode.attrs.marksAsAttrs.filter((m) => m.type !== "link")
76998
+ }
76999
+ };
76980
77000
  const outputNode = exportSchemaToJson({
76981
77001
  ...params3,
76982
- node: linkNode
77002
+ node: nodeWithoutLink,
77003
+ extraParams: {
77004
+ ...params3.extraParams,
77005
+ linkProcessed: true
77006
+ }
76983
77007
  });
76984
77008
  if (outputNode)
76985
77009
  if (outputNode instanceof Array)
@@ -76987,6 +77011,10 @@ function decode$68(params3) {
76987
77011
  else
76988
77012
  contentNodes.push(outputNode);
76989
77013
  });
77014
+ if (!contentNodes.length)
77015
+ return null;
77016
+ if (!linkAttrs["r:id"] && !anchor)
77017
+ linkAttrs["r:id"] = _addNewLinkRelationship(params3, link2);
76990
77018
  return {
76991
77019
  name: "w:hyperlink",
76992
77020
  type: "element",
@@ -117085,9 +117113,10 @@ var isRegExp = (value) => {
117085
117113
  "sd:autoPageNumber",
117086
117114
  "sd:totalPageNumber"
117087
117115
  ];
117088
- const contentNodes = node3.elements.filter((el) => el.name === "w:r" || referenceNodeTypes.includes(el.name));
117116
+ const revisionNodeTypes = ["w:ins", "w:del"];
117117
+ const contentNodes = node3.elements.filter((el) => el.name === "w:r" || revisionNodeTypes.includes(el.name) || referenceNodeTypes.includes(el.name));
117089
117118
  contentNodes.forEach((contentNode) => {
117090
- contentNode.marks = [...(Array.isArray(contentNode.marks) ? contentNode.marks : []).filter((mark) => mark?.type !== "link"), linkMark];
117119
+ addLinkMarkToContentNode(contentNode, linkMark, referenceNodeTypes);
117091
117120
  });
117092
117121
  return nodeListHandler.handler({
117093
117122
  ...params3,
@@ -130041,6 +130070,12 @@ var isRegExp = (value) => {
130041
130070
  return null;
130042
130071
  const trackedMarks = ["trackDelete", "trackInsert"];
130043
130072
  const trackedMark = node3.marks?.find((m) => trackedMarks.includes(m.type));
130073
+ const isLinkNode = node3.marks?.some((m) => m.type === "link");
130074
+ const isGroupedHyperlinkExport = isLinkNode && !extraParams?.linkProcessed && Array.isArray(extraParams?.hyperlinkGroup) && extraParams.hyperlinkGroup.length > 1;
130075
+ if (params3.isFinalDoc && trackedMark?.type === "trackDelete" && !isGroupedHyperlinkExport)
130076
+ return translator$59.decode(params3);
130077
+ if (isLinkNode && trackedMark && !extraParams?.linkProcessed)
130078
+ return translator$78.decode(params3);
130044
130079
  if (trackedMark)
130045
130080
  switch (trackedMark.type) {
130046
130081
  case "trackDelete":
@@ -130048,7 +130083,7 @@ var isRegExp = (value) => {
130048
130083
  case "trackInsert":
130049
130084
  return translator$84.decode(params3);
130050
130085
  }
130051
- if (node3.marks?.some((m) => m.type === "link") && !extraParams?.linkProcessed)
130086
+ if (isLinkNode && !extraParams?.linkProcessed)
130052
130087
  return translator$78.decode(params3);
130053
130088
  const { text: text$2, marks = [] } = node3;
130054
130089
  return getTextNodeForExport(text$2, marks, params3);
@@ -136815,7 +136850,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
136815
136850
  state.kern = kernNode.attributes["w:val"];
136816
136851
  }
136817
136852
  }, SuperConverter;
136818
- var init_SuperConverter_DlrS7cQT_es = __esm(() => {
136853
+ var init_SuperConverter_ObBDHFlA_es = __esm(() => {
136819
136854
  init_rolldown_runtime_Bg48TavK_es();
136820
136855
  init_jszip_C49i9kUs_es();
136821
136856
  init_xml_js_CqGKpaft_es();
@@ -165831,7 +165866,7 @@ var init_SuperConverter_DlrS7cQT_es = __esm(() => {
165831
165866
  };
165832
165867
  });
165833
165868
 
165834
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-Bm-c7KZd.es.js
165869
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DZSiiGb6.es.js
165835
165870
  function parseSizeUnit(val = "0") {
165836
165871
  const length3 = val.toString() || "0";
165837
165872
  const value = Number.parseFloat(length3);
@@ -175037,7 +175072,7 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN2, P
175037
175072
  init() {
175038
175073
  if (!editor.converter || editor.options.mode !== "docx")
175039
175074
  return {};
175040
- if (editor.presentationEditor)
175075
+ if (editor.presentationEditor || editor.options?.isHeadless)
175041
175076
  return {
175042
175077
  styles: editor.converter?.linkedStyles || [],
175043
175078
  decorations: DecorationSet.empty
@@ -175051,7 +175086,7 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN2, P
175051
175086
  apply(tr, prev, oldEditorState, newEditorState) {
175052
175087
  if (!editor.converter || editor.options.mode !== "docx")
175053
175088
  return { ...prev };
175054
- if (editor.presentationEditor)
175089
+ if (editor.presentationEditor || editor.options?.isHeadless)
175055
175090
  return {
175056
175091
  ...prev,
175057
175092
  decorations: DecorationSet.empty
@@ -176652,9 +176687,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN2, P
176652
176687
  }
176653
176688
  };
176654
176689
  };
176655
- var init_create_headless_toolbar_Bm_c7KZd_es = __esm(() => {
176690
+ var init_create_headless_toolbar_DZSiiGb6_es = __esm(() => {
176656
176691
  init_rolldown_runtime_Bg48TavK_es();
176657
- init_SuperConverter_DlrS7cQT_es();
176692
+ init_SuperConverter_ObBDHFlA_es();
176658
176693
  init_jszip_C49i9kUs_es();
176659
176694
  init_uuid_B2wVPhPi_es();
176660
176695
  init_constants_D9qj59G2_es();
@@ -226747,7 +226782,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
226747
226782
  init_remark_gfm_BUJjZJLy_es();
226748
226783
  });
226749
226784
 
226750
- // ../../packages/superdoc/dist/chunks/src-CVmBLxZV.es.js
226785
+ // ../../packages/superdoc/dist/chunks/src-CHyLJ11V.es.js
226751
226786
  function deleteProps(obj, propOrProps) {
226752
226787
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
226753
226788
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -248515,7 +248550,7 @@ function createHeadingWrapper(editor, input2, options) {
248515
248550
  function extractTextPreview(node3) {
248516
248551
  if (!node3.isTextblock)
248517
248552
  return null;
248518
- const text5 = node3.textContent;
248553
+ const text5 = textContentInBlock(node3, { textModel: "visible" });
248519
248554
  if (text5.length <= TEXT_PREVIEW_MAX_LENGTH)
248520
248555
  return text5;
248521
248556
  return text5.slice(0, TEXT_PREVIEW_MAX_LENGTH);
@@ -248523,7 +248558,7 @@ function extractTextPreview(node3) {
248523
248558
  function extractBlockText$1(node3) {
248524
248559
  if (!node3.isTextblock)
248525
248560
  return null;
248526
- return node3.textContent;
248561
+ return textContentInBlock(node3, { textModel: "visible" });
248527
248562
  }
248528
248563
  function buildStyleContext(editor) {
248529
248564
  const styleProps = readTranslatedLinkedStyles(editor);
@@ -248592,6 +248627,8 @@ function extractBlockFormatting(node3, styleCtx) {
248592
248627
  const marks = child.marks ?? [];
248593
248628
  if (!child.isText || marks.length === 0)
248594
248629
  return;
248630
+ if (marks.some((mark2) => mark2.type.name === "trackDelete"))
248631
+ return;
248595
248632
  for (const mark2 of marks) {
248596
248633
  const markName = mark2.type.name;
248597
248634
  const attrs = mark2.attrs;
@@ -248701,7 +248738,7 @@ function blocksListWrapper(editor, input2) {
248701
248738
  return {
248702
248739
  total,
248703
248740
  blocks: paged.map((candidate, i3) => {
248704
- const textLength = computeTextContentLength(candidate.node);
248741
+ const textLength = computeTextContentLength(candidate.node, { textModel: "visible" });
248705
248742
  const fullText = input2?.includeText ? extractBlockText$1(candidate.node) : undefined;
248706
248743
  const numbering = extractBlockNumbering(candidate.node);
248707
248744
  const ref$1 = textLength > 0 ? encodeV4Ref({
@@ -327865,13 +327902,13 @@ menclose::after {
327865
327902
  return;
327866
327903
  console.log(...args$1);
327867
327904
  }, 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;
327868
- var init_src_CVmBLxZV_es = __esm(() => {
327905
+ var init_src_CHyLJ11V_es = __esm(() => {
327869
327906
  init_rolldown_runtime_Bg48TavK_es();
327870
- init_SuperConverter_DlrS7cQT_es();
327907
+ init_SuperConverter_ObBDHFlA_es();
327871
327908
  init_jszip_C49i9kUs_es();
327872
327909
  init_xml_js_CqGKpaft_es();
327873
327910
  init_uuid_B2wVPhPi_es();
327874
- init_create_headless_toolbar_Bm_c7KZd_es();
327911
+ init_create_headless_toolbar_DZSiiGb6_es();
327875
327912
  init_constants_D9qj59G2_es();
327876
327913
  init_unified_BDuVPlMu_es();
327877
327914
  init_remark_gfm_BUJjZJLy_es();
@@ -328300,7 +328337,7 @@ var init_src_CVmBLxZV_es = __esm(() => {
328300
328337
  },
328301
328338
  "blocks.list": {
328302
328339
  memberPath: "blocks.list",
328303
- description: "List top-level blocks in document order with IDs, types, text previews, and optional full text when includeText:true. Supports pagination via offset/limit, optional nodeType filtering, and single-story scoping via `in: <StoryLocator>`.",
328340
+ description: "List top-level blocks in document order with IDs, types, text previews, and optional full text when includeText:true. Text, previews, lengths, and formatting hints use the VISIBLE model: pending tracked deletions are excluded (matching how edit refs resolve), and inline atoms render as a single placeholder character. Supports pagination via offset/limit, optional nodeType filtering, and single-story scoping via `in: <StoryLocator>`.",
328304
328341
  expectedResult: "Returns a BlocksListResult with total block count, an ordered array of block entries (ordinal, nodeId, nodeType, textPreview, optional text, isEmpty), and the current document revision.",
328305
328342
  requiresDocumentContext: true,
328306
328343
  metadata: readOperation2({ throws: ["INVALID_INPUT", ...T_STORY2] }),
@@ -371178,11 +371215,11 @@ function print() { __p += __j.call(arguments, '') }
371178
371215
  ]);
371179
371216
  });
371180
371217
 
371181
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-D2qFX5i6.es.js
371218
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DwykmGCU.es.js
371182
371219
  var DEFAULT_TEXT_ALIGN_OPTIONS, DEFAULT_LINE_HEIGHT_OPTIONS, DEFAULT_ZOOM_OPTIONS, DEFAULT_DOCUMENT_MODE_OPTIONS, DEFAULT_FONT_SIZE_OPTIONS, headlessToolbarConstants, 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, FONT_SIZE_OPTIONS;
371183
- var init_create_super_doc_ui_D2qFX5i6_es = __esm(() => {
371184
- init_SuperConverter_DlrS7cQT_es();
371185
- init_create_headless_toolbar_Bm_c7KZd_es();
371220
+ var init_create_super_doc_ui_DwykmGCU_es = __esm(() => {
371221
+ init_SuperConverter_ObBDHFlA_es();
371222
+ init_create_headless_toolbar_DZSiiGb6_es();
371186
371223
  DEFAULT_TEXT_ALIGN_OPTIONS = [
371187
371224
  {
371188
371225
  label: "Left",
@@ -371473,15 +371510,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
371473
371510
 
371474
371511
  // ../../packages/superdoc/dist/super-editor.es.js
371475
371512
  var init_super_editor_es = __esm(() => {
371476
- init_src_CVmBLxZV_es();
371477
- init_SuperConverter_DlrS7cQT_es();
371513
+ init_src_CHyLJ11V_es();
371514
+ init_SuperConverter_ObBDHFlA_es();
371478
371515
  init_jszip_C49i9kUs_es();
371479
371516
  init_xml_js_CqGKpaft_es();
371480
- init_create_headless_toolbar_Bm_c7KZd_es();
371517
+ init_create_headless_toolbar_DZSiiGb6_es();
371481
371518
  init_constants_D9qj59G2_es();
371482
371519
  init_unified_BDuVPlMu_es();
371483
371520
  init_DocxZipper_BzS208BW_es();
371484
- init_create_super_doc_ui_D2qFX5i6_es();
371521
+ init_create_super_doc_ui_DwykmGCU_es();
371485
371522
  init_ui_CGB3qmy3_es();
371486
371523
  init_eventemitter3_UwU_CLPU_es();
371487
371524
  init_errors_C_DoKMoN_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.17.0-next.45",
3
+ "version": "0.17.0-next.47",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -26,8 +26,8 @@
26
26
  "lib0": "^0.2.114",
27
27
  "typescript": "^5.9.2",
28
28
  "y-protocols": "^1.0.6",
29
- "superdoc": "1.43.1",
30
29
  "@superdoc/document-api": "0.1.0-alpha.0",
30
+ "superdoc": "1.43.1",
31
31
  "@superdoc/super-editor": "0.0.1"
32
32
  },
33
33
  "module": "src/index.ts",
@@ -35,11 +35,11 @@
35
35
  "access": "public"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.45",
39
- "@superdoc-dev/cli-darwin-x64": "0.17.0-next.45",
40
- "@superdoc-dev/cli-linux-x64": "0.17.0-next.45",
41
- "@superdoc-dev/cli-linux-arm64": "0.17.0-next.45",
42
- "@superdoc-dev/cli-windows-x64": "0.17.0-next.45"
38
+ "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.47",
39
+ "@superdoc-dev/cli-darwin-x64": "0.17.0-next.47",
40
+ "@superdoc-dev/cli-linux-x64": "0.17.0-next.47",
41
+ "@superdoc-dev/cli-linux-arm64": "0.17.0-next.47",
42
+ "@superdoc-dev/cli-windows-x64": "0.17.0-next.47"
43
43
  },
44
44
  "scripts": {
45
45
  "predev": "node scripts/ensure-superdoc-build.js",