@superdoc-dev/cli 0.16.0-next.16 → 0.16.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 +96 -13
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -169886,7 +169886,7 @@ var init_SuperConverter_EumzHoTv_es = __esm(() => {
169886
169886
  };
169887
169887
  });
169888
169888
 
169889
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-CRyPCXZF.es.js
169889
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-1wW3u4ea.es.js
169890
169890
  function parseSizeUnit(val = "0") {
169891
169891
  const length3 = val.toString() || "0";
169892
169892
  const value = Number.parseFloat(length3);
@@ -173810,7 +173810,9 @@ function executeTextRewrite(editor, tr, target, step3, mapping) {
173810
173810
  tr.replaceWith(remap(change.docFrom), remap(change.docTo), content2);
173811
173811
  }
173812
173812
  }
173813
- } else {
173813
+ } else if (trimmedNew.length === 0)
173814
+ tr.delete(trimmedFrom, trimmedTo);
173815
+ else {
173814
173816
  const content2 = buildTextWithTabs(editor.state.schema, trimmedNew, asProseMirrorMarks(marks));
173815
173817
  tr.replaceWith(trimmedFrom, trimmedTo, content2);
173816
173818
  }
@@ -180217,7 +180219,7 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
180217
180219
  }
180218
180220
  };
180219
180221
  };
180220
- var init_create_headless_toolbar_CRyPCXZF_es = __esm(() => {
180222
+ var init_create_headless_toolbar_1wW3u4ea_es = __esm(() => {
180221
180223
  init_SuperConverter_EumzHoTv_es();
180222
180224
  init_uuid_qzgm05fK_es();
180223
180225
  init_constants_D_X7xF4s_es();
@@ -229381,7 +229383,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
229381
229383
  init_remark_gfm_BhnWr3yf_es();
229382
229384
  });
229383
229385
 
229384
- // ../../packages/superdoc/dist/chunks/src-CibMiO0y.es.js
229386
+ // ../../packages/superdoc/dist/chunks/src-Ct3813p1.es.js
229385
229387
  function deleteProps(obj, propOrProps) {
229386
229388
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
229387
229389
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -322859,13 +322861,13 @@ menclose::after {
322859
322861
  return;
322860
322862
  console.log(...args$1);
322861
322863
  }, 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;
322862
- var init_src_CibMiO0y_es = __esm(() => {
322864
+ var init_src_Ct3813p1_es = __esm(() => {
322863
322865
  init_rolldown_runtime_Bg48TavK_es();
322864
322866
  init_SuperConverter_EumzHoTv_es();
322865
322867
  init_jszip_C49i9kUs_es();
322866
322868
  init_xml_js_CqGKpaft_es();
322867
322869
  init_uuid_qzgm05fK_es();
322868
- init_create_headless_toolbar_CRyPCXZF_es();
322870
+ init_create_headless_toolbar_1wW3u4ea_es();
322869
322871
  init_constants_D_X7xF4s_es();
322870
322872
  init_dist_B8HfvhaK_es();
322871
322873
  init_unified_Dsuw2be5_es();
@@ -357264,11 +357266,11 @@ function print() { __p += __j.call(arguments, '') }
357264
357266
  ]);
357265
357267
  });
357266
357268
 
357267
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DcawZW5k.es.js
357269
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-D9QfUqai.es.js
357268
357270
  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;
357269
- var init_create_super_doc_ui_DcawZW5k_es = __esm(() => {
357271
+ var init_create_super_doc_ui_D9QfUqai_es = __esm(() => {
357270
357272
  init_SuperConverter_EumzHoTv_es();
357271
- init_create_headless_toolbar_CRyPCXZF_es();
357273
+ init_create_headless_toolbar_1wW3u4ea_es();
357272
357274
  MOD_ALIASES = new Set([
357273
357275
  "Mod",
357274
357276
  "Meta",
@@ -357310,16 +357312,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
357310
357312
 
357311
357313
  // ../../packages/superdoc/dist/super-editor.es.js
357312
357314
  var init_super_editor_es = __esm(() => {
357313
- init_src_CibMiO0y_es();
357315
+ init_src_Ct3813p1_es();
357314
357316
  init_SuperConverter_EumzHoTv_es();
357315
357317
  init_jszip_C49i9kUs_es();
357316
357318
  init_xml_js_CqGKpaft_es();
357317
- init_create_headless_toolbar_CRyPCXZF_es();
357319
+ init_create_headless_toolbar_1wW3u4ea_es();
357318
357320
  init_constants_D_X7xF4s_es();
357319
357321
  init_dist_B8HfvhaK_es();
357320
357322
  init_unified_Dsuw2be5_es();
357321
357323
  init_DocxZipper_nv_KfOqb_es();
357322
- init_create_super_doc_ui_DcawZW5k_es();
357324
+ init_create_super_doc_ui_D9QfUqai_es();
357323
357325
  init_ui_C5PAS9hY_es();
357324
357326
  init_eventemitter3_BnGqBE_Q_es();
357325
357327
  init_errors_CNaD6vcg_es();
@@ -410037,6 +410039,70 @@ function selectRepeatedActionableOneOfError(path2, errors2) {
410037
410039
  }
410038
410040
  return bestMessage;
410039
410041
  }
410042
+ function describeVariant(variant) {
410043
+ if ("const" in variant)
410044
+ return JSON.stringify(variant.const);
410045
+ if ("oneOf" in variant)
410046
+ return variant.oneOf.map(describeVariant).join(" | ");
410047
+ if (variant.enum)
410048
+ return variant.enum.map((entry) => JSON.stringify(entry)).join(" | ");
410049
+ if (variant.type === "object") {
410050
+ const properties = variant.properties ?? {};
410051
+ const required = new Set(variant.required ?? []);
410052
+ const keys6 = Object.keys(properties);
410053
+ if (keys6.length === 0)
410054
+ return "object";
410055
+ const parts = keys6.map((key2) => {
410056
+ const prop = properties[key2];
410057
+ if (prop && "const" in prop)
410058
+ return `${key2}: ${JSON.stringify(prop.const)}`;
410059
+ return required.has(key2) ? key2 : `${key2}?`;
410060
+ });
410061
+ return `{ ${parts.join(", ")} }`;
410062
+ }
410063
+ if (variant.type === "array")
410064
+ return "array";
410065
+ if (variant.type === "json")
410066
+ return "object";
410067
+ return variant.type ?? "value";
410068
+ }
410069
+ function getOneOfDiscriminator(variants) {
410070
+ const objectVariants = variants.filter((variant) => !("const" in variant) && !("oneOf" in variant) && variant.type === "object" && isRecord3(variant.properties));
410071
+ if (objectVariants.length < 2)
410072
+ return null;
410073
+ for (const key2 of Object.keys(objectVariants[0].properties)) {
410074
+ const sharedByAll = objectVariants.every((variant) => {
410075
+ const prop = variant.properties[key2];
410076
+ return prop != null && "const" in prop;
410077
+ });
410078
+ if (sharedByAll)
410079
+ return key2;
410080
+ }
410081
+ return null;
410082
+ }
410083
+ function variantConstFor(variant, key2) {
410084
+ if ("const" in variant || "oneOf" in variant || variant.type !== "object")
410085
+ return;
410086
+ const prop = variant.properties?.[key2];
410087
+ return prop && "const" in prop ? prop.const : undefined;
410088
+ }
410089
+ function truncateForError(serialized, max5 = 64) {
410090
+ return serialized.length > max5 ? `${serialized.slice(0, max5)}…` : serialized;
410091
+ }
410092
+ function describeReceived(value2) {
410093
+ if (value2 === null)
410094
+ return "null";
410095
+ if (Array.isArray(value2))
410096
+ return "an array";
410097
+ const valueType = typeof value2;
410098
+ if (valueType === "object") {
410099
+ const keys6 = Object.keys(value2);
410100
+ return keys6.length > 0 ? `an object with keys [${keys6.join(", ")}]` : "an empty object";
410101
+ }
410102
+ if (valueType === "string")
410103
+ return `a string (${truncateForError(JSON.stringify(value2))})`;
410104
+ return `a ${valueType} (${truncateForError(JSON.stringify(value2))})`;
410105
+ }
410040
410106
  function validateValueAgainstTypeSpec(value2, schema, path2) {
410041
410107
  if ("const" in schema) {
410042
410108
  if (value2 !== schema.const) {
@@ -410055,9 +410121,26 @@ function validateValueAgainstTypeSpec(value2, schema, path2) {
410055
410121
  errors2.push(error4 instanceof Error ? error4.message : String(error4));
410056
410122
  }
410057
410123
  }
410124
+ const discriminator = getOneOfDiscriminator(variants);
410125
+ if (discriminator && isRecord3(value2) && value2[discriminator] !== undefined) {
410126
+ const received = value2[discriminator];
410127
+ const matched = variants.find((variant) => variantConstFor(variant, discriminator) === received);
410128
+ if (matched) {
410129
+ try {
410130
+ validateValueAgainstTypeSpec(value2, matched, path2);
410131
+ return;
410132
+ } catch (error4) {
410133
+ const message2 = error4 instanceof Error ? error4.message : String(error4);
410134
+ throw new CliError("VALIDATION_ERROR", message2, { errors: errors2, selectedError: message2 });
410135
+ }
410136
+ }
410137
+ const allowedTags = variants.map((variant) => variantConstFor(variant, discriminator)).filter((tag) => tag !== undefined).map((tag) => JSON.stringify(tag));
410138
+ const unmatchedTagMessage = `${path2}.${discriminator} must be one of: ${allowedTags.join(", ")} (received ${truncateForError(JSON.stringify(received))}).`;
410139
+ throw new CliError("VALIDATION_ERROR", unmatchedTagMessage, { errors: errors2, selectedError: unmatchedTagMessage });
410140
+ }
410058
410141
  const allowedValues = extractConstValues(variants);
410059
410142
  const selectedError = selectRepeatedActionableOneOfError(path2, errors2);
410060
- const message = allowedValues.length > 0 ? `${path2} must be one of: ${allowedValues.join(", ")}.` : selectedError ?? `${path2} must match one of the allowed schema variants.`;
410143
+ const message = allowedValues.length > 0 ? `${path2} must be one of: ${allowedValues.join(", ")}.` : selectedError ?? `${path2} must match one of: ${variants.map(describeVariant).join(" | ")}. Received ${describeReceived(value2)}.`;
410061
410144
  throw new CliError("VALIDATION_ERROR", message, { errors: errors2, selectedError });
410062
410145
  }
410063
410146
  if (schema.type === "json")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.16.0-next.16",
3
+ "version": "0.16.0-next.17",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -24,8 +24,8 @@
24
24
  "@types/node": "22.19.2",
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
- "@superdoc/super-editor": "0.0.1",
28
27
  "@superdoc/document-api": "0.0.1",
28
+ "@superdoc/super-editor": "0.0.1",
29
29
  "superdoc": "1.38.0"
30
30
  },
31
31
  "module": "src/index.ts",
@@ -33,11 +33,11 @@
33
33
  "access": "public"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@superdoc-dev/cli-darwin-arm64": "0.16.0-next.16",
37
- "@superdoc-dev/cli-darwin-x64": "0.16.0-next.16",
38
- "@superdoc-dev/cli-linux-x64": "0.16.0-next.16",
39
- "@superdoc-dev/cli-linux-arm64": "0.16.0-next.16",
40
- "@superdoc-dev/cli-windows-x64": "0.16.0-next.16"
36
+ "@superdoc-dev/cli-darwin-arm64": "0.16.0-next.17",
37
+ "@superdoc-dev/cli-darwin-x64": "0.16.0-next.17",
38
+ "@superdoc-dev/cli-linux-arm64": "0.16.0-next.17",
39
+ "@superdoc-dev/cli-windows-x64": "0.16.0-next.17",
40
+ "@superdoc-dev/cli-linux-x64": "0.16.0-next.17"
41
41
  },
42
42
  "scripts": {
43
43
  "predev": "node scripts/ensure-superdoc-build.js",