@superdoc-dev/cli 0.17.0-next.31 → 0.17.0-next.32

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 +94 -32
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -68327,7 +68327,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
68327
68327
  emptyOptions2 = {};
68328
68328
  });
68329
68329
 
68330
- // ../../packages/superdoc/dist/chunks/SuperConverter-cG5SxcH9.es.js
68330
+ // ../../packages/superdoc/dist/chunks/SuperConverter-C3uAnS0b.es.js
68331
68331
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68332
68332
  const fieldValue = extension$1.config[field];
68333
68333
  if (typeof fieldValue === "function")
@@ -91279,13 +91279,23 @@ function findOrCreateRelationship(editor, source, options) {
91279
91279
  function maybeAddProtocol(text$2) {
91280
91280
  return /^www\./i.test(text$2) ? `https://${text$2}` : text$2;
91281
91281
  }
91282
+ function hasExplicitUrlIntent(text$2) {
91283
+ if (/^www\./i.test(text$2))
91284
+ return true;
91285
+ if (/^(mailto|tel|sms):/i.test(text$2))
91286
+ return true;
91287
+ return /^https?:\/\//i.test(text$2);
91288
+ }
91282
91289
  function detectPasteUrl(text$2, protocols = []) {
91283
91290
  const trimmed = text$2?.trim();
91284
91291
  if (!trimmed)
91285
91292
  return null;
91286
91293
  if (/\s/.test(trimmed))
91287
91294
  return null;
91288
- const result = sanitizeHref(maybeAddProtocol(trimmed), { allowedProtocols: buildAllowedProtocols2(protocols) });
91295
+ const allowedProtocols = buildAllowedProtocols2(protocols);
91296
+ if (!hasExplicitUrlIntent(trimmed))
91297
+ return null;
91298
+ const result = sanitizeHref(maybeAddProtocol(trimmed), { allowedProtocols });
91289
91299
  return result ? { href: result.href } : null;
91290
91300
  }
91291
91301
  function canAllocateRels(editor) {
@@ -103224,7 +103234,9 @@ function bundledAssetSignature(resolve2) {
103224
103234
  });
103225
103235
  }
103226
103236
  function installBundledSubstitutes(registry, options = {}) {
103227
- const resolve2 = options.resolveAssetUrl ?? ((context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file));
103237
+ const baseResolve = (context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file);
103238
+ const candidate = options.resolveAssetUrl;
103239
+ const resolve2 = typeof candidate === "function" ? candidate : baseResolve;
103228
103240
  const signature = bundledAssetSignature(resolve2);
103229
103241
  const installed = installedRegistries.get(registry);
103230
103242
  if (installed !== undefined) {
@@ -103233,6 +103245,8 @@ function installBundledSubstitutes(registry, options = {}) {
103233
103245
  return;
103234
103246
  }
103235
103247
  installedRegistries.set(registry, signature);
103248
+ if (candidate != null && typeof candidate !== "function")
103249
+ console.warn("[superdoc] fonts.resolveAssetUrl must be a function (context) => string; ignoring it and falling back to fonts.assetBaseUrl. Prefer @superdoc-dev/fonts, which wires it correctly.");
103236
103250
  for (const family$1 of BUNDLED_MANIFEST)
103237
103251
  for (const face of family$1.faces) {
103238
103252
  const context = {
@@ -103264,8 +103278,9 @@ function normalizeList(families) {
103264
103278
  function createBundledActivation(input) {
103265
103279
  if (!input.packConfigured)
103266
103280
  return BASELINE_BUNDLED;
103281
+ const includeProvided = input.include != null;
103267
103282
  const include = normalizeList(input.include);
103268
- const exclude = include ? undefined : normalizeList(input.exclude);
103283
+ const exclude = includeProvided ? undefined : normalizeList(input.exclude);
103269
103284
  if (!include && !exclude)
103270
103285
  return FULLY_ACTIVE_BUNDLED;
103271
103286
  if (include) {
@@ -103656,12 +103671,14 @@ function coerceCurationList(value, field) {
103656
103671
  function warnUnknownBundledSelection(selection) {
103657
103672
  if (!selection)
103658
103673
  return;
103674
+ const includeProvided = selection.include != null;
103659
103675
  const include = coerceCurationList(selection.include, "include");
103660
103676
  const exclude = coerceCurationList(selection.exclude, "exclude");
103661
- if (include.length && exclude.length)
103677
+ if (includeProvided && exclude.length > 0)
103662
103678
  console.warn("[superdoc] fonts.bundled: set `include` OR `exclude`, not both. Using `include` (the allow-list) and ignoring `exclude`. Prefer createSuperDocFonts(), which rejects this.");
103679
+ const effective = includeProvided ? include : exclude;
103663
103680
  const seen = /* @__PURE__ */ new Set;
103664
- for (const name of [...include, ...exclude]) {
103681
+ for (const name of effective) {
103665
103682
  const trimmed = typeof name === "string" ? name.trim() : "";
103666
103683
  if (!trimmed)
103667
103684
  continue;
@@ -103673,6 +103690,29 @@ function warnUnknownBundledSelection(selection) {
103673
103690
  console.warn(`[superdoc] fonts.bundled: "${trimmed}" is not a bundled font, so curating it has no effect${suggestion ? ` (did you mean "${suggestion}"?)` : ""}. Curate by Word family name, e.g. Calibri, Cambria, Times New Roman. Docs: https://docs.superdoc.dev/getting-started/fonts`);
103674
103691
  }
103675
103692
  }
103693
+ function sanitizeBundledSelection(selection) {
103694
+ if (!selection)
103695
+ return selection;
103696
+ const known = (value) => {
103697
+ if (!Array.isArray(value))
103698
+ return [];
103699
+ return value.filter((n) => typeof n === "string").filter((n) => BUNDLED_LOGICAL_KEYS.has(normalizeFamilyKey(n)));
103700
+ };
103701
+ const result = {};
103702
+ if (selection.include != null)
103703
+ result.include = known(selection.include);
103704
+ if (selection.exclude != null)
103705
+ result.exclude = known(selection.exclude);
103706
+ return result;
103707
+ }
103708
+ function deriveBundledActivationForConfig(config$43) {
103709
+ if (!config$43)
103710
+ return deriveBundledActivation(config$43);
103711
+ return deriveBundledActivation({
103712
+ ...config$43,
103713
+ bundled: sanitizeBundledSelection(config$43.bundled)
103714
+ });
103715
+ }
103676
103716
  function normalizeKey(family$1) {
103677
103717
  return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
103678
103718
  }
@@ -135370,7 +135410,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
135370
135410
  state.kern = kernNode.attributes["w:val"];
135371
135411
  }
135372
135412
  }, SuperConverter;
135373
- var init_SuperConverter_cG5SxcH9_es = __esm(() => {
135413
+ var init_SuperConverter_C3uAnS0b_es = __esm(() => {
135374
135414
  init_rolldown_runtime_Bg48TavK_es();
135375
135415
  init_jszip_C49i9kUs_es();
135376
135416
  init_xml_js_CqGKpaft_es();
@@ -176132,7 +176172,7 @@ var init_SuperConverter_cG5SxcH9_es = __esm(() => {
176132
176172
  };
176133
176173
  });
176134
176174
 
176135
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-tAtxEvrl.es.js
176175
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-CSJZe3lZ.es.js
176136
176176
  function parseSizeUnit(val = "0") {
176137
176177
  const length3 = val.toString() || "0";
176138
176178
  const value = Number.parseFloat(length3);
@@ -186781,8 +186821,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
186781
186821
  }
186782
186822
  };
186783
186823
  };
186784
- var init_create_headless_toolbar_tAtxEvrl_es = __esm(() => {
186785
- init_SuperConverter_cG5SxcH9_es();
186824
+ var init_create_headless_toolbar_CSJZe3lZ_es = __esm(() => {
186825
+ init_SuperConverter_C3uAnS0b_es();
186786
186826
  init_uuid_B2wVPhPi_es();
186787
186827
  init_constants_D9qj59G2_es();
186788
186828
  init_dist_B8HfvhaK_es();
@@ -235951,7 +235991,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
235951
235991
  init_remark_gfm_BhnWr3yf_es();
235952
235992
  });
235953
235993
 
235954
- // ../../packages/superdoc/dist/chunks/src-B-44dC3g.es.js
235994
+ // ../../packages/superdoc/dist/chunks/src-DwYnU5Rz.es.js
235955
235995
  function deleteProps(obj, propOrProps) {
235956
235996
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
235957
235997
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -307254,6 +307294,17 @@ var Node$13 = class Node$14 {
307254
307294
  } catch {
307255
307295
  return step3;
307256
307296
  }
307297
+ }, sliceHasInlineLeafContent = (slice2) => {
307298
+ let found2 = false;
307299
+ slice2.content.descendants((node3) => {
307300
+ if (found2)
307301
+ return false;
307302
+ if (node3.isInline && (node3.isText || node3.isLeaf)) {
307303
+ found2 = true;
307304
+ return false;
307305
+ }
307306
+ });
307307
+ return found2;
307257
307308
  }, replaceStep2 = ({ state, tr, step: step3, newTr, map: map$12, user, date, originalStep, originalStepIndex, replacements = "paired" }) => {
307258
307309
  const originalRange = {
307259
307310
  from: step3.from,
@@ -307440,6 +307491,7 @@ var Node$13 = class Node$14 {
307440
307491
  if (!hasInlineContent)
307441
307492
  return { handled: false };
307442
307493
  }
307494
+ const isStructuralShellDelete = step3.from !== step3.to && step3.slice.content.size > 0 && !sliceHasInlineLeafContent(step3.slice);
307443
307495
  let intent;
307444
307496
  try {
307445
307497
  const preserveExistingReviewState = tr.getMeta("protectTrackedReviewState") === true;
@@ -307453,7 +307505,7 @@ var Node$13 = class Node$14 {
307453
307505
  source,
307454
307506
  preserveExistingReviewState
307455
307507
  });
307456
- else if (step3.from !== step3.to && step3.slice.content.size === 0)
307508
+ else if (step3.from !== step3.to && (step3.slice.content.size === 0 || isStructuralShellDelete))
307457
307509
  intent = makeTextDeleteIntent({
307458
307510
  from: step3.from,
307459
307511
  to: step3.to,
@@ -307509,7 +307561,10 @@ var Node$13 = class Node$14 {
307509
307561
  map$12.appendMap(invertStep.getMap());
307510
307562
  const mirrorIndex = map$12.maps.length - 1;
307511
307563
  for (let i4 = beforeSteps;i4 < newTr.steps.length; i4 += 1)
307512
- map$12.appendMap(newTr.steps[i4].getMap(), mirrorIndex);
307564
+ if (isStructuralShellDelete)
307565
+ map$12.appendMap(newTr.steps[i4].getMap());
307566
+ else
307567
+ map$12.appendMap(newTr.steps[i4].getMap(), mirrorIndex);
307513
307568
  } else
307514
307569
  for (let i4 = beforeSteps;i4 < newTr.steps.length; i4 += 1)
307515
307570
  map$12.appendMap(newTr.steps[i4].getMap());
@@ -307528,7 +307583,7 @@ var Node$13 = class Node$14 {
307528
307583
  meta2.step = result.insertedStep;
307529
307584
  else if (result.insertedMark && result.insertedNodes?.length)
307530
307585
  meta2.step = { slice: { content: { content: result.insertedNodes } } };
307531
- if (result.selection?.kind === "near" && stepWasNormalized && !result.insertedMark)
307586
+ if (result.selection?.kind === "near" && (stepWasNormalized || isStructuralShellDelete) && !result.insertedMark)
307532
307587
  meta2.selectionPos = result.selection.pos;
307533
307588
  newTr.setMeta(TrackChangesBasePluginKey, meta2);
307534
307589
  newTr.setMeta(CommentsPluginKey, { type: "force" });
@@ -309528,7 +309583,10 @@ var Node$13 = class Node$14 {
309528
309583
  originalId: event.changeId
309529
309584
  }).some(({ mark: mark2 }) => mark2.attrs?.splitFromId === event.changeId))
309530
309585
  continue;
309531
- editor.emit("commentsUpdate", event);
309586
+ editor.emit("commentsUpdate", {
309587
+ ...event,
309588
+ decision
309589
+ });
309532
309590
  }
309533
309591
  const touched = result.touchedChangeIds instanceof Set ? result.touchedChangeIds : new Set(result.touchedChangeIds || []);
309534
309592
  const emittedFor = /* @__PURE__ */ new Set;
@@ -334116,7 +334174,7 @@ menclose::after {
334116
334174
  applyInitialConfig(config2) {
334117
334175
  this.#cancelPendingRuntimeReflow();
334118
334176
  warnUnknownBundledSelection(config2?.bundled);
334119
- this.#resolver.setActivation(deriveBundledActivation(config2));
334177
+ this.#resolver.setActivation(deriveBundledActivationForConfig(config2));
334120
334178
  if (!config2)
334121
334179
  return;
334122
334180
  const registered$1 = this.#registerFamilies(config2.families);
@@ -334342,13 +334400,13 @@ menclose::after {
334342
334400
  return;
334343
334401
  console.log(...args$1);
334344
334402
  }, 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;
334345
- var init_src_B_44dC3g_es = __esm(() => {
334403
+ var init_src_DwYnU5Rz_es = __esm(() => {
334346
334404
  init_rolldown_runtime_Bg48TavK_es();
334347
- init_SuperConverter_cG5SxcH9_es();
334405
+ init_SuperConverter_C3uAnS0b_es();
334348
334406
  init_jszip_C49i9kUs_es();
334349
334407
  init_xml_js_CqGKpaft_es();
334350
334408
  init_uuid_B2wVPhPi_es();
334351
- init_create_headless_toolbar_tAtxEvrl_es();
334409
+ init_create_headless_toolbar_CSJZe3lZ_es();
334352
334410
  init_constants_D9qj59G2_es();
334353
334411
  init_dist_B8HfvhaK_es();
334354
334412
  init_unified_Dsuw2be5_es();
@@ -357746,7 +357804,7 @@ function print() { __p += __j.call(arguments, '') }
357746
357804
  this.overflowItems = overflowItems.filter((item) => allConfigItems.includes(item.name.value));
357747
357805
  }
357748
357806
  #resolveToolbarFonts(configFonts) {
357749
- return composeToolbarFontOptions(this.superdoc?.fonts?.getDocumentFontOptions?.() ?? [], configFonts, deriveBundledActivation(this.superdoc?.config?.fonts));
357807
+ return composeToolbarFontOptions(this.superdoc?.fonts?.getDocumentFontOptions?.() ?? [], configFonts, deriveBundledActivationForConfig(this.superdoc?.config?.fonts));
357750
357808
  }
357751
357809
  #rebuildToolbarItems() {
357752
357810
  this.#makeToolbarItems({
@@ -363834,10 +363892,14 @@ function print() { __p += __j.call(arguments, '') }
363834
363892
  getRequiredFaces: () => this.#fontPlan?.requiredFaces ?? [],
363835
363893
  getUsedFaces: () => this.#fontPlan?.usedFaces ?? [],
363836
363894
  fontResolver: this.#fontResolver,
363837
- onRegistryResolved: (registry2) => installBundledSubstitutes(registry2, {
363838
- assetBaseUrl: this.#options.fontAssets?.assetBaseUrl,
363839
- resolveAssetUrl: this.#options.fontAssets?.resolveAssetUrl
363840
- }),
363895
+ onRegistryResolved: (registry2) => {
363896
+ if (!deriveBundledActivation(this.#options.fontAssets).packConfigured)
363897
+ return;
363898
+ installBundledSubstitutes(registry2, {
363899
+ assetBaseUrl: this.#options.fontAssets?.assetBaseUrl,
363900
+ resolveAssetUrl: this.#options.fontAssets?.resolveAssetUrl
363901
+ });
363902
+ },
363841
363903
  getFontEnvironment: () => {
363842
363904
  const ownerDoc = this.#visibleHost?.ownerDocument ?? (typeof document !== "undefined" ? document : null);
363843
363905
  const view = ownerDoc?.defaultView ?? (typeof window !== "undefined" ? window : null);
@@ -370127,11 +370189,11 @@ function print() { __p += __j.call(arguments, '') }
370127
370189
  ]);
370128
370190
  });
370129
370191
 
370130
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-CFVSuPWF.es.js
370192
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-B9SVqVK2.es.js
370131
370193
  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;
370132
- var init_create_super_doc_ui_CFVSuPWF_es = __esm(() => {
370133
- init_SuperConverter_cG5SxcH9_es();
370134
- init_create_headless_toolbar_tAtxEvrl_es();
370194
+ var init_create_super_doc_ui_B9SVqVK2_es = __esm(() => {
370195
+ init_SuperConverter_C3uAnS0b_es();
370196
+ init_create_headless_toolbar_CSJZe3lZ_es();
370135
370197
  DEFAULT_TEXT_ALIGN_OPTIONS = [
370136
370198
  {
370137
370199
  label: "Left",
@@ -370422,16 +370484,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
370422
370484
 
370423
370485
  // ../../packages/superdoc/dist/super-editor.es.js
370424
370486
  var init_super_editor_es = __esm(() => {
370425
- init_src_B_44dC3g_es();
370426
- init_SuperConverter_cG5SxcH9_es();
370487
+ init_src_DwYnU5Rz_es();
370488
+ init_SuperConverter_C3uAnS0b_es();
370427
370489
  init_jszip_C49i9kUs_es();
370428
370490
  init_xml_js_CqGKpaft_es();
370429
- init_create_headless_toolbar_tAtxEvrl_es();
370491
+ init_create_headless_toolbar_CSJZe3lZ_es();
370430
370492
  init_constants_D9qj59G2_es();
370431
370493
  init_dist_B8HfvhaK_es();
370432
370494
  init_unified_Dsuw2be5_es();
370433
370495
  init_DocxZipper_FUsfThjV_es();
370434
- init_create_super_doc_ui_CFVSuPWF_es();
370496
+ init_create_super_doc_ui_B9SVqVK2_es();
370435
370497
  init_ui_C5PAS9hY_es();
370436
370498
  init_eventemitter3_BnGqBE_Q_es();
370437
370499
  init_errors_CNaD6vcg_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.17.0-next.31",
3
+ "version": "0.17.0-next.32",
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/document-api": "0.0.1",
28
27
  "@superdoc/super-editor": "0.0.1",
28
+ "@superdoc/document-api": "0.0.1",
29
29
  "superdoc": "1.40.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-linux-x64": "0.17.0-next.31",
37
- "@superdoc-dev/cli-darwin-x64": "0.17.0-next.31",
38
- "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.31",
39
- "@superdoc-dev/cli-windows-x64": "0.17.0-next.31",
40
- "@superdoc-dev/cli-linux-arm64": "0.17.0-next.31"
36
+ "@superdoc-dev/cli-darwin-x64": "0.17.0-next.32",
37
+ "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.32",
38
+ "@superdoc-dev/cli-linux-x64": "0.17.0-next.32",
39
+ "@superdoc-dev/cli-linux-arm64": "0.17.0-next.32",
40
+ "@superdoc-dev/cli-windows-x64": "0.17.0-next.32"
41
41
  },
42
42
  "scripts": {
43
43
  "predev": "node scripts/ensure-superdoc-build.js",