@superdoc-dev/cli 0.7.0-next.15 → 0.7.0-next.17

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 +53 -29
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -7984,6 +7984,7 @@ function buildContentControlSchemas() {
7984
7984
  kind: { enum: ["block", "inline"] },
7985
7985
  controlType: { type: "string" },
7986
7986
  target: contentControlTargetSchema,
7987
+ at: selectionTargetSchema,
7987
7988
  tag: { type: "string" },
7988
7989
  alias: { type: "string" },
7989
7990
  lockMode: { enum: ["unlocked", "sdtLocked", "contentLocked", "sdtContentLocked"] },
@@ -17670,9 +17671,15 @@ function executeCreateContentControl(adapter, input, options) {
17670
17671
  if (input.lockMode !== undefined && !VALID_LOCK_MODES.has(input.lockMode)) {
17671
17672
  throw new DocumentApiValidationError("INVALID_INPUT", `create.contentControl lockMode must be one of: ${[...VALID_LOCK_MODES].join(", ")}.`, { field: "lockMode", value: input.lockMode });
17672
17673
  }
17674
+ if (input.at !== undefined && input.target !== undefined) {
17675
+ throw new DocumentApiValidationError("INVALID_INPUT", `create.contentControl: "at" and "target" are mutually exclusive — provide one or neither.`, { field: "at" });
17676
+ }
17673
17677
  if (input.target !== undefined) {
17674
17678
  validateCCTarget(input.target, "create.contentControl");
17675
17679
  }
17680
+ if (input.at !== undefined && !isSelectionTarget(input.at)) {
17681
+ throw new DocumentApiValidationError("INVALID_INPUT", `create.contentControl: "at" must be a valid SelectionTarget with kind "selection", start, and end.`, { field: "at", value: input.at });
17682
+ }
17676
17683
  if (input.content !== undefined && typeof input.content !== "string") {
17677
17684
  throw new DocumentApiValidationError("INVALID_INPUT", `create.contentControl content must be a string, got ${typeof input.content}.`, { field: "content", value: input.content });
17678
17685
  }
@@ -17682,6 +17689,7 @@ var VALID_NODE_KINDS, VALID_LOCK_MODES, VALID_CC_TYPES, VALID_CC_APPEARANCES, VA
17682
17689
  var init_content_controls = __esm(() => {
17683
17690
  init_errors2();
17684
17691
  init_validation_primitives();
17692
+ init_selection_target_validator();
17685
17693
  init_content_controls_types();
17686
17694
  init_base();
17687
17695
  VALID_NODE_KINDS = new Set(NODE_KINDS);
@@ -65493,7 +65501,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
65493
65501
  emptyOptions2 = {};
65494
65502
  });
65495
65503
 
65496
- // ../../packages/superdoc/dist/chunks/SuperConverter-w6yaFRT5.es.js
65504
+ // ../../packages/superdoc/dist/chunks/SuperConverter-BgwP1GeS.es.js
65497
65505
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
65498
65506
  const fieldValue = extension$1.config[field];
65499
65507
  if (typeof fieldValue === "function")
@@ -67608,6 +67616,7 @@ function buildContentControlSchemas2() {
67608
67616
  kind: { enum: ["block", "inline"] },
67609
67617
  controlType: { type: "string" },
67610
67618
  target: contentControlTargetSchema2,
67619
+ at: selectionTargetSchema2,
67611
67620
  tag: { type: "string" },
67612
67621
  alias: { type: "string" },
67613
67622
  lockMode: { enum: [
@@ -71740,8 +71749,15 @@ function executeCreateContentControl2(adapter, input, options) {
71740
71749
  field: "lockMode",
71741
71750
  value: input.lockMode
71742
71751
  });
71752
+ if (input.at !== undefined && input.target !== undefined)
71753
+ throw new DocumentApiValidationError2("INVALID_INPUT", `create.contentControl: "at" and "target" are mutually exclusive — provide one or neither.`, { field: "at" });
71743
71754
  if (input.target !== undefined)
71744
71755
  validateCCTarget2(input.target, "create.contentControl");
71756
+ if (input.at !== undefined && !isSelectionTarget2(input.at))
71757
+ throw new DocumentApiValidationError2("INVALID_INPUT", `create.contentControl: "at" must be a valid SelectionTarget with kind "selection", start, and end.`, {
71758
+ field: "at",
71759
+ value: input.at
71760
+ });
71745
71761
  if (input.content !== undefined && typeof input.content !== "string")
71746
71762
  throw new DocumentApiValidationError2("INVALID_INPUT", `create.contentControl content must be a string, got ${typeof input.content}.`, {
71747
71763
  field: "content",
@@ -117203,7 +117219,7 @@ var isRegExp = (value) => {
117203
117219
  state.kern = kernNode.attributes["w:val"];
117204
117220
  }
117205
117221
  }, SuperConverter;
117206
- var init_SuperConverter_w6yaFRT5_es = __esm(() => {
117222
+ var init_SuperConverter_BgwP1GeS_es = __esm(() => {
117207
117223
  init_rolldown_runtime_Bg48TavK_es();
117208
117224
  init_jszip_C49i9kUs_es();
117209
117225
  init_xml_js_CqGKpaft_es();
@@ -154449,7 +154465,7 @@ var init_SuperConverter_w6yaFRT5_es = __esm(() => {
154449
154465
  };
154450
154466
  });
154451
154467
 
154452
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-CHK8yJic.es.js
154468
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-zEz71NHQ.es.js
154453
154469
  function parseSizeUnit(val = "0") {
154454
154470
  const length3 = val.toString() || "0";
154455
154471
  const value = Number.parseFloat(length3);
@@ -156060,8 +156076,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
156060
156076
  return false;
156061
156077
  return Boolean(checker(attrs));
156062
156078
  };
156063
- var init_create_headless_toolbar_CHK8yJic_es = __esm(() => {
156064
- init_SuperConverter_w6yaFRT5_es();
156079
+ var init_create_headless_toolbar_zEz71NHQ_es = __esm(() => {
156080
+ init_SuperConverter_BgwP1GeS_es();
156065
156081
  init_constants_CGhJRd87_es();
156066
156082
  init_dist_B8HfvhaK_es();
156067
156083
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -204499,7 +204515,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
204499
204515
  init_remark_gfm_BhnWr3yf_es();
204500
204516
  });
204501
204517
 
204502
- // ../../packages/superdoc/dist/chunks/src-966rF_JP.es.js
204518
+ // ../../packages/superdoc/dist/chunks/src-DjgWBzME.es.js
204503
204519
  function deleteProps(obj, propOrProps) {
204504
204520
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
204505
204521
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -238713,8 +238729,7 @@ function groupUngroupWrapper(editor, input2, options) {
238713
238729
  }
238714
238730
  function createWrapper(editor, input2, options) {
238715
238731
  const commandName = input2.kind === "block" ? "insertStructuredContentBlock" : "insertStructuredContentInline";
238716
- const insertCmd = editor.commands?.[commandName];
238717
- if (typeof insertCmd !== "function")
238732
+ if (typeof editor.commands?.[commandName] !== "function")
238718
238733
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", `${commandName} command not available.`);
238719
238734
  const id2 = generateSdtId();
238720
238735
  const target = {
@@ -238767,17 +238782,26 @@ function createWrapper(editor, input2, options) {
238767
238782
  dispatchTransaction(editor, tr);
238768
238783
  return true;
238769
238784
  }
238785
+ if (input2.at) {
238786
+ const { absFrom, absTo } = resolveSelectionTarget(editor, input2.at);
238787
+ const { tr } = editor.state;
238788
+ tr.setSelection(TextSelection2.create(tr.doc, absFrom, absTo));
238789
+ dispatchTransaction(editor, tr);
238790
+ }
238791
+ const cmd = editor.commands?.[commandName];
238792
+ if (typeof cmd !== "function")
238793
+ return false;
238770
238794
  if (contentText !== undefined) {
238771
238795
  if (input2.kind === "block") {
238772
238796
  if (isCheckboxCreate)
238773
- return Boolean(insertCmd({
238797
+ return Boolean(cmd({
238774
238798
  attrs,
238775
238799
  json: {
238776
238800
  type: "paragraph",
238777
238801
  content: [buildCheckboxTextJson(checkboxSymbol)]
238778
238802
  }
238779
238803
  }));
238780
- return Boolean(insertCmd({
238804
+ return Boolean(cmd({
238781
238805
  attrs,
238782
238806
  json: {
238783
238807
  type: "paragraph",
@@ -238789,16 +238813,16 @@ function createWrapper(editor, input2, options) {
238789
238813
  }));
238790
238814
  }
238791
238815
  if (isCheckboxCreate)
238792
- return Boolean(insertCmd({
238816
+ return Boolean(cmd({
238793
238817
  attrs,
238794
238818
  json: buildCheckboxTextJson(checkboxSymbol)
238795
238819
  }));
238796
- return Boolean(insertCmd({
238820
+ return Boolean(cmd({
238797
238821
  attrs,
238798
238822
  text: contentText
238799
238823
  }));
238800
238824
  }
238801
- return Boolean(insertCmd({ attrs }));
238825
+ return Boolean(cmd({ attrs }));
238802
238826
  });
238803
238827
  }
238804
238828
  function createContentControlsAdapter(editor) {
@@ -266943,11 +266967,11 @@ var Node$13 = class Node$14 {
266943
266967
  before: before2,
266944
266968
  after: mergedAfter
266945
266969
  };
266946
- }, getTrackedChangeText = ({ nodes, mark: mark2, trackedChangeType, isDeletionInsertion }) => {
266970
+ }, getTrackedChangeText = ({ nodes, mark: mark2, trackedChangeType, isReplacement }) => {
266947
266971
  let trackedChangeText = "";
266948
266972
  let deletionText = "";
266949
266973
  let trackedChangeDisplayType = null;
266950
- if (trackedChangeType === "trackDelete" || isDeletionInsertion)
266974
+ if (trackedChangeType === "trackDelete" || isReplacement)
266951
266975
  deletionText = nodes.reduce((acc, node3) => {
266952
266976
  if (!node3.marks.find((nodeMark) => nodeMark.type.name === "trackDelete"))
266953
266977
  return acc;
@@ -266955,7 +266979,7 @@ var Node$13 = class Node$14 {
266955
266979
  acc += nodeText;
266956
266980
  return acc;
266957
266981
  }, "");
266958
- if (trackedChangeType === "trackInsert" || isDeletionInsertion)
266982
+ if (trackedChangeType === "trackInsert" || isReplacement)
266959
266983
  trackedChangeText = nodes.reduce((acc, node3) => {
266960
266984
  if (!node3.marks.find((nodeMark) => nodeMark.type.name === "trackInsert"))
266961
266985
  return acc;
@@ -266993,11 +267017,11 @@ var Node$13 = class Node$14 {
266993
267017
  const { name: trackedChangeType } = type;
266994
267018
  const { author, authorEmail, authorImage, date, importedAuthor } = attrs;
266995
267019
  const id2 = attrs.id;
266996
- let isDeletionInsertion = !!(marks.insertedMark && marks.deletionMark);
266997
- if (!isDeletionInsertion) {
267020
+ let isReplacement = !!(marks.insertedMark && marks.deletionMark);
267021
+ if (!isReplacement) {
266998
267022
  const hasInsertMark = trackedChangesWithId.some(({ mark: mark2 }) => mark2.type.name === TrackInsertMarkName);
266999
267023
  const hasDeleteMark = trackedChangesWithId.some(({ mark: mark2 }) => mark2.type.name === TrackDeleteMarkName);
267000
- isDeletionInsertion = hasInsertMark && hasDeleteMark;
267024
+ isReplacement = hasInsertMark && hasDeleteMark;
267001
267025
  }
267002
267026
  const nodesWithMark = [];
267003
267027
  trackedChangesWithId.forEach(({ from: from$1, to }) => {
@@ -267011,7 +267035,7 @@ var Node$13 = class Node$14 {
267011
267035
  });
267012
267036
  });
267013
267037
  let nodesToUse;
267014
- if (isDeletionInsertion) {
267038
+ if (isReplacement) {
267015
267039
  const hasInsertNode = nodesWithMark.some((node$1) => node$1.marks.find((nodeMark) => nodeMark.type.name === TrackInsertMarkName));
267016
267040
  const hasDeleteNode = nodesWithMark.some((node$1) => node$1.marks.find((nodeMark) => nodeMark.type.name === TrackDeleteMarkName));
267017
267041
  const fallbackNodes = [...!hasInsertNode && nodes?.length ? nodes : [], ...!hasDeleteNode && deletionNodes?.length ? deletionNodes : []];
@@ -267024,7 +267048,7 @@ var Node$13 = class Node$14 {
267024
267048
  nodes: nodesToUse,
267025
267049
  mark: trackedMark,
267026
267050
  trackedChangeType,
267027
- isDeletionInsertion,
267051
+ isReplacement,
267028
267052
  deletionNodes
267029
267053
  });
267030
267054
  if (!deletionText && !trackedChangeText)
@@ -267034,10 +267058,10 @@ var Node$13 = class Node$14 {
267034
267058
  type: "trackedChange",
267035
267059
  documentId,
267036
267060
  changeId: id2,
267037
- trackedChangeType: isDeletionInsertion ? "both" : trackedChangeType,
267061
+ trackedChangeType: isReplacement ? "both" : trackedChangeType,
267038
267062
  trackedChangeText,
267039
267063
  trackedChangeDisplayType,
267040
- deletedText: marks.deletionMark ? deletionText : null,
267064
+ deletedText: isReplacement || marks.deletionMark ? deletionText : null,
267041
267065
  author,
267042
267066
  authorEmail,
267043
267067
  ...authorImage && { authorImage },
@@ -288134,12 +288158,12 @@ var Node$13 = class Node$14 {
288134
288158
  return;
288135
288159
  console.log(...args$1);
288136
288160
  }, 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;
288137
- var init_src_966rF_JP_es = __esm(() => {
288161
+ var init_src_DjgWBzME_es = __esm(() => {
288138
288162
  init_rolldown_runtime_Bg48TavK_es();
288139
- init_SuperConverter_w6yaFRT5_es();
288163
+ init_SuperConverter_BgwP1GeS_es();
288140
288164
  init_jszip_C49i9kUs_es();
288141
288165
  init_uuid_qzgm05fK_es();
288142
- init_create_headless_toolbar_CHK8yJic_es();
288166
+ init_create_headless_toolbar_zEz71NHQ_es();
288143
288167
  init_constants_CGhJRd87_es();
288144
288168
  init_dist_B8HfvhaK_es();
288145
288169
  init_unified_Dsuw2be5_es();
@@ -322894,11 +322918,11 @@ var init_zipper_DbkgrypV_es = __esm(() => {
322894
322918
 
322895
322919
  // ../../packages/superdoc/dist/super-editor.es.js
322896
322920
  var init_super_editor_es = __esm(() => {
322897
- init_src_966rF_JP_es();
322898
- init_SuperConverter_w6yaFRT5_es();
322921
+ init_src_DjgWBzME_es();
322922
+ init_SuperConverter_BgwP1GeS_es();
322899
322923
  init_jszip_C49i9kUs_es();
322900
322924
  init_xml_js_CqGKpaft_es();
322901
- init_create_headless_toolbar_CHK8yJic_es();
322925
+ init_create_headless_toolbar_zEz71NHQ_es();
322902
322926
  init_constants_CGhJRd87_es();
322903
322927
  init_dist_B8HfvhaK_es();
322904
322928
  init_unified_Dsuw2be5_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.7.0-next.15",
3
+ "version": "0.7.0-next.17",
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.15",
38
- "@superdoc-dev/cli-darwin-x64": "0.7.0-next.15",
39
- "@superdoc-dev/cli-linux-x64": "0.7.0-next.15",
40
- "@superdoc-dev/cli-windows-x64": "0.7.0-next.15",
41
- "@superdoc-dev/cli-linux-arm64": "0.7.0-next.15"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.7.0-next.17",
38
+ "@superdoc-dev/cli-darwin-x64": "0.7.0-next.17",
39
+ "@superdoc-dev/cli-linux-x64": "0.7.0-next.17",
40
+ "@superdoc-dev/cli-linux-arm64": "0.7.0-next.17",
41
+ "@superdoc-dev/cli-windows-x64": "0.7.0-next.17"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",