@superdoc-dev/cli 0.17.0-next.30 → 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 +391 -145
  2. package/package.json +8 -8
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-DAuqlmYY.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")
@@ -68891,7 +68891,7 @@ function wsOptionsFor(type, preserveWhitespace, base$1) {
68891
68891
  return (preserveWhitespace ? OPT_PRESERVE_WS : 0) | (preserveWhitespace === "full" ? OPT_PRESERVE_WS_FULL : 0);
68892
68892
  return type && type.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base$1 & ~OPT_OPEN_LEFT;
68893
68893
  }
68894
- function normalizeList(dom) {
68894
+ function normalizeList$1(dom) {
68895
68895
  for (let child = dom.firstChild, prevItem = null;child; child = child.nextSibling) {
68896
68896
  let name = child.nodeType == 1 ? child.nodeName.toLowerCase() : null;
68897
68897
  if (name && listTags.hasOwnProperty(name) && prevItem) {
@@ -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) {
@@ -103198,7 +103208,110 @@ function familyWithFaces(name, license, faces) {
103198
103208
  faces
103199
103209
  };
103200
103210
  }
103201
- function normalizeFamilyKey$1(family$1) {
103211
+ function isBundledPackPresent() {
103212
+ return bundledPackPresent;
103213
+ }
103214
+ function withTrailingSlash(base$1) {
103215
+ return base$1.endsWith("/") ? base$1 : `${base$1}/`;
103216
+ }
103217
+ function joinUrl(base$1, file) {
103218
+ return `${withTrailingSlash(base$1)}${file}`;
103219
+ }
103220
+ function weightToken(weight) {
103221
+ return weight === "bold" ? "700" : "400";
103222
+ }
103223
+ function bundledAssetSignature(resolve2) {
103224
+ const family$1 = BUNDLED_MANIFEST[0];
103225
+ const face = family$1?.faces[0];
103226
+ if (!family$1 || !face)
103227
+ return "";
103228
+ return resolve2({
103229
+ file: face.file,
103230
+ family: family$1.family,
103231
+ weight: weightToken(face.weight),
103232
+ style: face.style,
103233
+ source: "bundled-substitute"
103234
+ });
103235
+ }
103236
+ function installBundledSubstitutes(registry, options = {}) {
103237
+ const baseResolve = (context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file);
103238
+ const candidate = options.resolveAssetUrl;
103239
+ const resolve2 = typeof candidate === "function" ? candidate : baseResolve;
103240
+ const signature = bundledAssetSignature(resolve2);
103241
+ const installed = installedRegistries.get(registry);
103242
+ if (installed !== undefined) {
103243
+ if (installed !== signature)
103244
+ console.warn(`[superdoc] bundled fonts are already registered for this document from "${installed}"; a later fonts config resolving to "${signature}" is ignored. Use one fonts.assetBaseUrl / fonts.resolveAssetUrl per document.`);
103245
+ return;
103246
+ }
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.");
103250
+ for (const family$1 of BUNDLED_MANIFEST)
103251
+ for (const face of family$1.faces) {
103252
+ const context = {
103253
+ file: face.file,
103254
+ family: family$1.family,
103255
+ weight: weightToken(face.weight),
103256
+ style: face.style,
103257
+ source: "bundled-substitute"
103258
+ };
103259
+ registry.register({
103260
+ family: family$1.family,
103261
+ source: `url(${resolve2(context)})`,
103262
+ descriptors: {
103263
+ weight: face.weight,
103264
+ style: face.style
103265
+ }
103266
+ });
103267
+ }
103268
+ }
103269
+ function normalizeKey$1(family$1) {
103270
+ return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
103271
+ }
103272
+ function normalizeList(families) {
103273
+ if (!Array.isArray(families))
103274
+ return;
103275
+ const out = [...new Set(families.filter((f2) => typeof f2 === "string").map(normalizeKey$1).filter(Boolean))].sort();
103276
+ return out.length > 0 ? out : undefined;
103277
+ }
103278
+ function createBundledActivation(input) {
103279
+ if (!input.packConfigured)
103280
+ return BASELINE_BUNDLED;
103281
+ const includeProvided = input.include != null;
103282
+ const include = normalizeList(input.include);
103283
+ const exclude = includeProvided ? undefined : normalizeList(input.exclude);
103284
+ if (!include && !exclude)
103285
+ return FULLY_ACTIVE_BUNDLED;
103286
+ if (include) {
103287
+ const set$1 = new Set(include);
103288
+ return Object.freeze({
103289
+ packConfigured: true,
103290
+ isActive: (family$1) => set$1.has(normalizeKey$1(family$1)),
103291
+ signature: JSON.stringify({
103292
+ p: true,
103293
+ i: include
103294
+ })
103295
+ });
103296
+ }
103297
+ const set = new Set(exclude);
103298
+ return Object.freeze({
103299
+ packConfigured: true,
103300
+ isActive: (family$1) => !set.has(normalizeKey$1(family$1)),
103301
+ signature: JSON.stringify({
103302
+ p: true,
103303
+ x: exclude
103304
+ })
103305
+ });
103306
+ }
103307
+ function deriveBundledActivation(config$43) {
103308
+ return createBundledActivation({
103309
+ packConfigured: !!(config$43?.resolveAssetUrl || config$43?.assetBaseUrl) || isBundledPackPresent(),
103310
+ include: config$43?.bundled?.include,
103311
+ exclude: config$43?.bundled?.exclude
103312
+ });
103313
+ }
103314
+ function normalizeFamilyKey$2(family$1) {
103202
103315
  return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
103203
103316
  }
103204
103317
  function sortPairs(pairs) {
@@ -103277,7 +103390,7 @@ function deriveBundledSubstitutes() {
103277
103390
  for (const row of SUBSTITUTION_EVIDENCE) {
103278
103391
  const fallback = getRenderableFallback(row.logicalFamily, { canRenderFamily });
103279
103392
  if (fallback?.policyAction === "substitute")
103280
- substitutes[normalizeFamilyKey$1(row.logicalFamily)] = fallback.substituteFamily;
103393
+ substitutes[normalizeFamilyKey$2(row.logicalFamily)] = fallback.substituteFamily;
103281
103394
  }
103282
103395
  return Object.freeze(substitutes);
103283
103396
  }
@@ -103286,7 +103399,7 @@ function deriveCategoryFallbacks() {
103286
103399
  for (const row of SUBSTITUTION_EVIDENCE) {
103287
103400
  const fallback = getRenderableFallback(row.logicalFamily, { canRenderFamily });
103288
103401
  if (fallback?.policyAction === "category_fallback")
103289
- fallbacks[normalizeFamilyKey$1(row.logicalFamily)] = fallback.substituteFamily;
103402
+ fallbacks[normalizeFamilyKey$2(row.logicalFamily)] = fallback.substituteFamily;
103290
103403
  }
103291
103404
  return Object.freeze(fallbacks);
103292
103405
  }
@@ -103296,8 +103409,8 @@ function stripFamilyQuotes(family$1) {
103296
103409
  function splitStack(cssFontFamily) {
103297
103410
  return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
103298
103411
  }
103299
- function createFontResolver() {
103300
- return new FontResolver;
103412
+ function createFontResolver(activation) {
103413
+ return new FontResolver(activation);
103301
103414
  }
103302
103415
  function resolveFontFamily(logicalFamily) {
103303
103416
  return defaultResolver.resolveFontFamily(logicalFamily);
@@ -103314,57 +103427,6 @@ function getFontConfigVersion() {
103314
103427
  function bumpFontConfigVersion() {
103315
103428
  return fontConfigVersion += 1;
103316
103429
  }
103317
- function withTrailingSlash(base$1) {
103318
- return base$1.endsWith("/") ? base$1 : `${base$1}/`;
103319
- }
103320
- function joinUrl(base$1, file) {
103321
- return `${withTrailingSlash(base$1)}${file}`;
103322
- }
103323
- function weightToken(weight) {
103324
- return weight === "bold" ? "700" : "400";
103325
- }
103326
- function bundledAssetSignature(resolve2) {
103327
- const family$1 = BUNDLED_MANIFEST[0];
103328
- const face = family$1?.faces[0];
103329
- if (!family$1 || !face)
103330
- return "";
103331
- return resolve2({
103332
- file: face.file,
103333
- family: family$1.family,
103334
- weight: weightToken(face.weight),
103335
- style: face.style,
103336
- source: "bundled-substitute"
103337
- });
103338
- }
103339
- function installBundledSubstitutes(registry, options = {}) {
103340
- const resolve2 = options.resolveAssetUrl ?? ((context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file));
103341
- const signature = bundledAssetSignature(resolve2);
103342
- const installed = installedRegistries.get(registry);
103343
- if (installed !== undefined) {
103344
- if (installed !== signature)
103345
- console.warn(`[superdoc] bundled fonts are already registered for this document from "${installed}"; a later fonts config resolving to "${signature}" is ignored. Use one fonts.assetBaseUrl / fonts.resolveAssetUrl per document.`);
103346
- return;
103347
- }
103348
- installedRegistries.set(registry, signature);
103349
- for (const family$1 of BUNDLED_MANIFEST)
103350
- for (const face of family$1.faces) {
103351
- const context = {
103352
- file: face.file,
103353
- family: family$1.family,
103354
- weight: weightToken(face.weight),
103355
- style: face.style,
103356
- source: "bundled-substitute"
103357
- };
103358
- registry.register({
103359
- family: family$1.family,
103360
- source: `url(${resolve2(context)})`,
103361
- descriptors: {
103362
- weight: face.weight,
103363
- style: face.style
103364
- }
103365
- });
103366
- }
103367
- }
103368
103430
  function toEvidence(fallback) {
103369
103431
  if (!fallback)
103370
103432
  return;
@@ -103477,7 +103539,7 @@ function canonicalizeFontSource(source) {
103477
103539
  inner = inner.slice(1, -1);
103478
103540
  return `url(${JSON.stringify(inner)})`;
103479
103541
  }
103480
- function normalizeFamilyKey(family$1) {
103542
+ function normalizeFamilyKey$1(family$1) {
103481
103543
  return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
103482
103544
  }
103483
103545
  function normalizeWeight(weight) {
@@ -103496,7 +103558,7 @@ function normalizeStyle(style) {
103496
103558
  return s.startsWith("italic") || s.startsWith("oblique") ? "italic" : "normal";
103497
103559
  }
103498
103560
  function faceKeyOf(family$1, weight, style) {
103499
- return `${normalizeFamilyKey(family$1)}|${weight}|${style}`;
103561
+ return `${normalizeFamilyKey$1(family$1)}|${weight}|${style}`;
103500
103562
  }
103501
103563
  function faceProbe(family$1, weight, style, size2) {
103502
103564
  return `${style === "italic" ? "italic " : ""}${weight} ${size2} ${quoteFamily(family$1)}`;
@@ -103548,8 +103610,10 @@ function deriveOfferings() {
103548
103610
  function compareLogicalFamily(a, b) {
103549
103611
  return a.logicalFamily.localeCompare(b.logicalFamily, "en", { sensitivity: "base" });
103550
103612
  }
103551
- function getBuiltInToolbarFontOfferings() {
103552
- return FONT_OFFERINGS.filter((o) => o.offering === "default" || o.bundled && ADVERTISED_BUILT_IN_TOOLBAR_FAMILIES.has(o.logicalFamily) && (o.offering === "qualified" || o.offering === "category_fallback")).sort(compareLogicalFamily);
103613
+ function getBuiltInToolbarFontOfferings(activation = BASELINE_BUNDLED) {
103614
+ if (!activation.packConfigured)
103615
+ return FONT_OFFERINGS.filter((o) => o.bundled && BUILT_IN_TOOLBAR_BASELINE_FAMILIES.has(o.logicalFamily)).sort(compareLogicalFamily);
103616
+ return FONT_OFFERINGS.filter((o) => (o.offering === "default" || o.bundled && ADVERTISED_BUILT_IN_TOOLBAR_FAMILIES.has(o.logicalFamily) && (o.offering === "qualified" || o.offering === "category_fallback")) && activation.isActive(o.logicalFamily)).sort(compareLogicalFamily);
103553
103617
  }
103554
103618
  function fontOfferingStack(offering) {
103555
103619
  return `${offering.logicalFamily}, ${offering.generic}`;
@@ -103557,12 +103621,98 @@ function fontOfferingStack(offering) {
103557
103621
  function fontOfferingRenderStack(offering) {
103558
103622
  return offering.physicalFamily ? `${offering.physicalFamily}, ${offering.generic}` : fontOfferingStack(offering);
103559
103623
  }
103560
- function getDefaultFontFamilyOptions() {
103561
- return getBuiltInToolbarFontOfferings().map((offering) => ({
103624
+ function getDefaultFontFamilyOptions(activation = BASELINE_BUNDLED) {
103625
+ return getBuiltInToolbarFontOfferings(activation).map((offering) => ({
103562
103626
  label: offering.logicalFamily,
103563
103627
  value: fontOfferingStack(offering)
103564
103628
  }));
103565
103629
  }
103630
+ function normalizeFamilyKey(family$1) {
103631
+ return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
103632
+ }
103633
+ function editDistance(a, b) {
103634
+ const m = a.length;
103635
+ const n = b.length;
103636
+ if (Math.abs(m - n) > 2)
103637
+ return 3;
103638
+ let prev = Array.from({ length: n + 1 }, (_, i$1) => i$1);
103639
+ for (let i$1 = 1;i$1 <= m; i$1 += 1) {
103640
+ const curr = [i$1];
103641
+ for (let j = 1;j <= n; j += 1) {
103642
+ const cost = a[i$1 - 1] === b[j - 1] ? 0 : 1;
103643
+ curr[j] = Math.min(curr[j - 1] + 1, prev[j] + 1, prev[j - 1] + cost);
103644
+ }
103645
+ prev = curr;
103646
+ }
103647
+ return prev[n];
103648
+ }
103649
+ function closestBundledFamily(name) {
103650
+ const key = normalizeFamilyKey(name);
103651
+ let best = null;
103652
+ let bestDist = 3;
103653
+ for (const family$1 of BUNDLED_LOGICAL_FAMILIES) {
103654
+ const dist = editDistance(key, normalizeFamilyKey(family$1));
103655
+ if (dist < bestDist) {
103656
+ bestDist = dist;
103657
+ best = family$1;
103658
+ }
103659
+ }
103660
+ return best;
103661
+ }
103662
+ function coerceCurationList(value, field) {
103663
+ if (value == null)
103664
+ return [];
103665
+ if (!Array.isArray(value)) {
103666
+ console.warn(`[superdoc] fonts.bundled.${field} must be an array of font names; ignoring it. Prefer createSuperDocFonts(), which rejects malformed curation.`);
103667
+ return [];
103668
+ }
103669
+ return value.filter((name) => typeof name === "string");
103670
+ }
103671
+ function warnUnknownBundledSelection(selection) {
103672
+ if (!selection)
103673
+ return;
103674
+ const includeProvided = selection.include != null;
103675
+ const include = coerceCurationList(selection.include, "include");
103676
+ const exclude = coerceCurationList(selection.exclude, "exclude");
103677
+ if (includeProvided && exclude.length > 0)
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;
103680
+ const seen = /* @__PURE__ */ new Set;
103681
+ for (const name of effective) {
103682
+ const trimmed = typeof name === "string" ? name.trim() : "";
103683
+ if (!trimmed)
103684
+ continue;
103685
+ const key = normalizeFamilyKey(trimmed);
103686
+ if (BUNDLED_LOGICAL_KEYS.has(key) || seen.has(key))
103687
+ continue;
103688
+ seen.add(key);
103689
+ const suggestion = closestBundledFamily(trimmed);
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`);
103691
+ }
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
+ }
103566
103716
  function normalizeKey(family$1) {
103567
103717
  return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
103568
103718
  }
@@ -115368,7 +115518,7 @@ var isRegExp = (value) => {
115368
115518
  this.localPreserveWS = true;
115369
115519
  let name = dom.nodeName.toLowerCase(), ruleID;
115370
115520
  if (listTags.hasOwnProperty(name) && this.parser.normalizeLists)
115371
- normalizeList(dom);
115521
+ normalizeList$1(dom);
115372
115522
  let rule = this.options.ruleFromNode && this.options.ruleFromNode(dom) || (ruleID = this.parser.matchTag(dom, this, matchAfter));
115373
115523
  out:
115374
115524
  if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {
@@ -130522,19 +130672,32 @@ var isRegExp = (value) => {
130522
130672
  tags.push(`</${name}>`);
130523
130673
  return tags;
130524
130674
  }
130525
- }, SETTLED_STATUSES, SUBSTITUTION_EVIDENCE$1, LINE_BREAK_SAFE_VERDICTS, BY_LOGICAL, BUNDLED_MANIFEST, SUBSTITUTION_EVIDENCE, bundledFamilies, canRenderFamily = (family$1) => bundledFamilies.has(family$1), BUNDLED_SUBSTITUTES, CATEGORY_FALLBACKS, FontResolver = class {
130675
+ }, SETTLED_STATUSES, SUBSTITUTION_EVIDENCE$1, LINE_BREAK_SAFE_VERDICTS, BY_LOGICAL, BUNDLED_MANIFEST, defaultAssetBase = "/fonts/", bundledPackPresent = false, installedRegistries, FULLY_ACTIVE_BUNDLED, BASELINE_BUNDLED, SUBSTITUTION_EVIDENCE, bundledFamilies, canRenderFamily = (family$1) => bundledFamilies.has(family$1), BUNDLED_SUBSTITUTES, CATEGORY_FALLBACKS, FontResolver = class {
130526
130676
  #overrides = /* @__PURE__ */ new Map;
130527
130677
  #embedded = /* @__PURE__ */ new Map;
130528
130678
  #version = 0;
130529
130679
  #cachedSignature = null;
130680
+ #activation;
130681
+ constructor(activation = FULLY_ACTIVE_BUNDLED) {
130682
+ this.#activation = activation;
130683
+ }
130684
+ setActivation(activation) {
130685
+ if (this.#activation.signature === activation.signature) {
130686
+ this.#activation = activation;
130687
+ return;
130688
+ }
130689
+ this.#activation = activation;
130690
+ this.#version += 1;
130691
+ this.#cachedSignature = null;
130692
+ }
130530
130693
  map(logicalFamily, physicalFamily) {
130531
- const key = normalizeFamilyKey$1(logicalFamily);
130694
+ const key = normalizeFamilyKey$2(logicalFamily);
130532
130695
  const physical = physicalFamily?.trim();
130533
130696
  if (!key || !physical)
130534
130697
  return;
130535
130698
  if (this.#overrides.get(key) === physical)
130536
130699
  return;
130537
- if (key === normalizeFamilyKey$1(physical)) {
130700
+ if (key === normalizeFamilyKey$2(physical)) {
130538
130701
  if (this.#overrides.delete(key)) {
130539
130702
  this.#version += 1;
130540
130703
  this.#cachedSignature = null;
@@ -130546,13 +130709,13 @@ var isRegExp = (value) => {
130546
130709
  this.#cachedSignature = null;
130547
130710
  }
130548
130711
  unmap(logicalFamily) {
130549
- if (this.#overrides.delete(normalizeFamilyKey$1(logicalFamily))) {
130712
+ if (this.#overrides.delete(normalizeFamilyKey$2(logicalFamily))) {
130550
130713
  this.#version += 1;
130551
130714
  this.#cachedSignature = null;
130552
130715
  }
130553
130716
  }
130554
130717
  mapEmbedded(logicalFamily, physicalFamily) {
130555
- const key = normalizeFamilyKey$1(logicalFamily);
130718
+ const key = normalizeFamilyKey$2(logicalFamily);
130556
130719
  const physical = physicalFamily?.trim();
130557
130720
  if (!key || !physical)
130558
130721
  return;
@@ -130583,44 +130746,58 @@ var isRegExp = (value) => {
130583
130746
  get signature() {
130584
130747
  if (this.#cachedSignature !== null)
130585
130748
  return this.#cachedSignature;
130586
- if (this.#overrides.size === 0 && this.#embedded.size === 0)
130749
+ const activation = this.#activation.signature;
130750
+ const hasOverrides = this.#overrides.size > 0;
130751
+ const hasEmbedded = this.#embedded.size > 0;
130752
+ if (!hasOverrides && !hasEmbedded && activation === "") {
130587
130753
  this.#cachedSignature = "";
130588
- else {
130589
- const overridePairs = sortPairs([...this.#overrides.entries()]);
130590
- this.#cachedSignature = this.#embedded.size === 0 ? JSON.stringify(overridePairs) : JSON.stringify({
130754
+ return this.#cachedSignature;
130755
+ }
130756
+ const overridePairs = sortPairs([...this.#overrides.entries()]);
130757
+ if (activation === "")
130758
+ this.#cachedSignature = !hasEmbedded ? JSON.stringify(overridePairs) : JSON.stringify({
130591
130759
  o: overridePairs,
130592
130760
  e: sortPairs([...this.#embedded.entries()])
130593
130761
  });
130762
+ else {
130763
+ const obj = { a: activation };
130764
+ if (hasOverrides)
130765
+ obj.o = overridePairs;
130766
+ if (hasEmbedded)
130767
+ obj.e = sortPairs([...this.#embedded.entries()]);
130768
+ this.#cachedSignature = JSON.stringify(obj);
130594
130769
  }
130595
130770
  return this.#cachedSignature;
130596
130771
  }
130597
130772
  #physicalFor(bareFamily) {
130598
- const key = normalizeFamilyKey$1(bareFamily);
130773
+ const key = normalizeFamilyKey$2(bareFamily);
130599
130774
  const override = this.#overrides.get(key);
130600
130775
  if (override)
130601
130776
  return {
130602
130777
  physical: override,
130603
130778
  reason: "custom_mapping"
130604
130779
  };
130605
- const bundled = BUNDLED_SUBSTITUTES[key];
130606
- if (bundled)
130607
- return {
130608
- physical: bundled,
130609
- reason: "bundled_substitute"
130610
- };
130611
- const category = CATEGORY_FALLBACKS[key];
130612
- if (category)
130613
- return {
130614
- physical: category,
130615
- reason: "category_fallback"
130616
- };
130780
+ if (this.#activation.isActive(bareFamily)) {
130781
+ const bundled = BUNDLED_SUBSTITUTES[key];
130782
+ if (bundled)
130783
+ return {
130784
+ physical: bundled,
130785
+ reason: "bundled_substitute"
130786
+ };
130787
+ const category = CATEGORY_FALLBACKS[key];
130788
+ if (category)
130789
+ return {
130790
+ physical: category,
130791
+ reason: "category_fallback"
130792
+ };
130793
+ }
130617
130794
  return {
130618
130795
  physical: bareFamily,
130619
130796
  reason: "as_requested"
130620
130797
  };
130621
130798
  }
130622
130799
  #resolveFaceLadder(primary, face, hasFace) {
130623
- const key = normalizeFamilyKey$1(primary);
130800
+ const key = normalizeFamilyKey$2(primary);
130624
130801
  const override = this.#overrides.get(key);
130625
130802
  if (override && hasFace(override, face.weight, face.style))
130626
130803
  return {
@@ -130638,10 +130815,13 @@ var isRegExp = (value) => {
130638
130815
  physical: primary,
130639
130816
  reason: "registered_face"
130640
130817
  };
130641
- const docfonts = resolveDocfontsFace(primary, face, hasFace);
130642
- if (docfonts)
130643
- return docfonts;
130644
- const bundled = BUNDLED_SUBSTITUTES[key];
130818
+ const active = this.#activation.isActive(primary);
130819
+ if (active) {
130820
+ const docfonts = resolveDocfontsFace(primary, face, hasFace);
130821
+ if (docfonts)
130822
+ return docfonts;
130823
+ }
130824
+ const bundled = active ? BUNDLED_SUBSTITUTES[key] : undefined;
130645
130825
  if (override || bundled)
130646
130826
  return {
130647
130827
  physical: primary,
@@ -130689,7 +130869,7 @@ var isRegExp = (value) => {
130689
130869
  if (parts.length === 0)
130690
130870
  return cssFontFamily;
130691
130871
  const { physical } = this.#resolveFaceLadder(parts[0], face, hasFace);
130692
- if (normalizeFamilyKey$1(physical) !== normalizeFamilyKey$1(parts[0]))
130872
+ if (normalizeFamilyKey$2(physical) !== normalizeFamilyKey$2(parts[0]))
130693
130873
  return [physical, ...parts.slice(1)].join(", ");
130694
130874
  return cssFontFamily;
130695
130875
  }
@@ -130704,7 +130884,7 @@ var isRegExp = (value) => {
130704
130884
  out.add(this.resolvePrimaryPhysicalFamily(family$1));
130705
130885
  return [...out];
130706
130886
  }
130707
- }, defaultResolver, DEFAULT_FONT_MEASURE_CONTEXT, fontConfigVersion = 0, defaultAssetBase = "/fonts/", installedRegistries, faceSlotFor = ({ weight, style }) => {
130887
+ }, defaultResolver, DEFAULT_FONT_MEASURE_CONTEXT, fontConfigVersion = 0, faceSlotFor = ({ weight, style }) => {
130708
130888
  const bold2 = weight === "700";
130709
130889
  const italic = style === "italic";
130710
130890
  if (bold2 && italic)
@@ -130714,7 +130894,7 @@ var isRegExp = (value) => {
130714
130894
  if (italic)
130715
130895
  return "italic";
130716
130896
  return "regular";
130717
- }, isRenderedSubstitute = (reason) => reason === "bundled_substitute" || reason === "category_fallback", RENDER_ALL, FS_TYPE_RESTRICTED = 2, FS_SELECTION_ITALIC = 1, BOLD_WEIGHT_THRESHOLD = 600, SFNT_TABLE_DIR_OFFSET = 12, SFNT_TABLE_RECORD_SIZE = 16, OS2_USWEIGHTCLASS = 4, OS2_FSTYPE = 8, OS2_FSSELECTION = 62, OS2_MIN_LENGTH, DEFAULT_FONT_LOAD_TIMEOUT_MS = 3000, DEFAULT_PROBE_SIZE = "16px", FontRegistry = class {
130897
+ }, isRenderedSubstitute = (reason) => reason === "bundled_substitute" || reason === "category_fallback", RENDER_ALL, FS_TYPE_RESTRICTED = 2, FS_SELECTION_ITALIC = 1, BOLD_WEIGHT_THRESHOLD = 600, SFNT_TABLE_DIR_OFFSET = 12, SFNT_TABLE_RECORD_SIZE = 16, OS2_USWEIGHTCLASS = 4, OS2_FSTYPE = 8, OS2_FSSELECTION = 62, OS2_MIN_LENGTH, BUNDLED_SUBSTITUTE_FAMILIES, DEFAULT_FONT_LOAD_TIMEOUT_MS = 3000, DEFAULT_PROBE_SIZE = "16px", FontRegistry = class {
130718
130898
  #fontSet;
130719
130899
  #FontFaceCtor;
130720
130900
  #probeSize;
@@ -130725,6 +130905,7 @@ var isRegExp = (value) => {
130725
130905
  #status = /* @__PURE__ */ new Map;
130726
130906
  #sources = /* @__PURE__ */ new Map;
130727
130907
  #warnedFailures = /* @__PURE__ */ new Set;
130908
+ #warnedBundledSubstituteFailure = false;
130728
130909
  #inflight = /* @__PURE__ */ new Map;
130729
130910
  #faceStatus = /* @__PURE__ */ new Map;
130730
130911
  #faceInflight = /* @__PURE__ */ new Map;
@@ -130786,7 +130967,7 @@ var isRegExp = (value) => {
130786
130967
  };
130787
130968
  }
130788
130969
  #trackFace(family$1, key) {
130789
- const fam = normalizeFamilyKey(family$1);
130970
+ const fam = normalizeFamilyKey$1(family$1);
130790
130971
  const set = this.#facesByFamily.get(fam) ?? /* @__PURE__ */ new Set;
130791
130972
  set.add(key);
130792
130973
  this.#facesByFamily.set(fam, set);
@@ -130840,7 +131021,7 @@ var isRegExp = (value) => {
130840
131021
  this.#providerFaceKeys.delete(key);
130841
131022
  this.#faceStatus.delete(key);
130842
131023
  this.#faceSources.delete(key);
130843
- const fam = normalizeFamilyKey(family$1);
131024
+ const fam = normalizeFamilyKey$1(family$1);
130844
131025
  const keys$1 = this.#facesByFamily.get(fam);
130845
131026
  if (keys$1) {
130846
131027
  keys$1.delete(key);
@@ -130855,7 +131036,7 @@ var isRegExp = (value) => {
130855
131036
  }
130856
131037
  getStatus(family$1) {
130857
131038
  const statuses = [];
130858
- const faceKeys = this.#facesByFamily.get(normalizeFamilyKey(family$1));
131039
+ const faceKeys = this.#facesByFamily.get(normalizeFamilyKey$1(family$1));
130859
131040
  if (faceKeys)
130860
131041
  for (const k of faceKeys)
130861
131042
  statuses.push(this.#faceStatus.get(k) ?? "unloaded");
@@ -130998,6 +131179,10 @@ var isRegExp = (value) => {
130998
131179
  }
130999
131180
  }
131000
131181
  #warnFaceFailureOnce(request, key) {
131182
+ if (BUNDLED_SUBSTITUTE_FAMILIES.has(request.family)) {
131183
+ this.#warnBundledSubstituteFailureOnce(request.family);
131184
+ return;
131185
+ }
131001
131186
  if (this.#warnedFaceFailures.has(key))
131002
131187
  return;
131003
131188
  this.#warnedFaceFailures.add(key);
@@ -131048,6 +131233,10 @@ var isRegExp = (value) => {
131048
131233
  }
131049
131234
  }
131050
131235
  #warnLoadFailureOnce(family$1) {
131236
+ if (BUNDLED_SUBSTITUTE_FAMILIES.has(family$1)) {
131237
+ this.#warnBundledSubstituteFailureOnce(family$1);
131238
+ return;
131239
+ }
131051
131240
  if (this.#warnedFailures.has(family$1))
131052
131241
  return;
131053
131242
  this.#warnedFailures.add(family$1);
@@ -131055,7 +131244,18 @@ var isRegExp = (value) => {
131055
131244
  const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
131056
131245
  console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
131057
131246
  }
131058
- }, registriesByFontSet, domlessRegistry = null, BUNDLED_FAMILIES, SUPPORTED_ALIAS_FAMILIES, ADVERTISED_BUILT_IN_TOOLBAR_FAMILIES, FONT_OFFERINGS, prepareCommentParaIds = (comment) => {
131247
+ #warnBundledSubstituteFailureOnce(family$1) {
131248
+ if (this.#warnedBundledSubstituteFailure)
131249
+ return;
131250
+ this.#warnedBundledSubstituteFailure = true;
131251
+ console.warn(`[superdoc] Bundled fallback fonts failed to load (e.g. "${family$1}"). Text will render with system fallbacks, so some fonts may look unchanged on machines that lack them. Fix one of:
131252
+ - install @superdoc-dev/fonts and pass it:
131253
+ import { superdocFonts } from '@superdoc-dev/fonts';
131254
+ new SuperDoc({ /* ... */ fonts: superdocFonts });
131255
+ - or set fonts.assetBaseUrl / fonts.resolveAssetUrl to where the bundled .woff2 are served.
131256
+ Docs: https://docs.superdoc.dev/getting-started/fonts`);
131257
+ }
131258
+ }, registriesByFontSet, domlessRegistry = null, BUNDLED_FAMILIES, SUPPORTED_ALIAS_FAMILIES, BUILT_IN_TOOLBAR_BASELINE_FAMILIES, ADVERTISED_BUILT_IN_TOOLBAR_FAMILIES, FONT_OFFERINGS, BUNDLED_LOGICAL_FAMILIES, BUNDLED_LOGICAL_KEYS, prepareCommentParaIds = (comment) => {
131059
131259
  return {
131060
131260
  ...comment,
131061
131261
  commentParaId: generateDocxRandomId()
@@ -135176,7 +135376,7 @@ var isRegExp = (value) => {
135176
135376
  sourceId: stringOf(primary.sourceId),
135177
135377
  revisionGroupId: stringOf(primary.revisionGroupId) || representativeRevisionId
135178
135378
  });
135179
- }, stringOf = (value) => typeof value === "string" ? value : value == null ? "" : String(value), groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES2, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.39.0", SUPERDOC_DOCUMENT_ORIGIN_PROPERTY = "SuperdocDocumentOrigin", STORED_DOCUMENT_ORIGINS, collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
135379
+ }, stringOf = (value) => typeof value === "string" ? value : value == null ? "" : String(value), groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES2, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.40.0", SUPERDOC_DOCUMENT_ORIGIN_PROPERTY = "SuperdocDocumentOrigin", STORED_DOCUMENT_ORIGINS, collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
135180
135380
  if (!runProps?.elements?.length || !state)
135181
135381
  return;
135182
135382
  const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
@@ -135210,7 +135410,7 @@ var isRegExp = (value) => {
135210
135410
  state.kern = kernNode.attributes["w:val"];
135211
135411
  }
135212
135412
  }, SuperConverter;
135213
- var init_SuperConverter_DAuqlmYY_es = __esm(() => {
135413
+ var init_SuperConverter_C3uAnS0b_es = __esm(() => {
135214
135414
  init_rolldown_runtime_Bg48TavK_es();
135215
135415
  init_jszip_C49i9kUs_es();
135216
135416
  init_xml_js_CqGKpaft_es();
@@ -174121,6 +174321,17 @@ var init_SuperConverter_DAuqlmYY_es = __esm(() => {
174121
174321
  }]),
174122
174322
  family("TeX Gyre Bonum", "TeXGyreBonum", "LicenseRef-GUST-Font-License-1.0")
174123
174323
  ]);
174324
+ installedRegistries = /* @__PURE__ */ new WeakMap;
174325
+ FULLY_ACTIVE_BUNDLED = Object.freeze({
174326
+ packConfigured: true,
174327
+ isActive: () => true,
174328
+ signature: ""
174329
+ });
174330
+ BASELINE_BUNDLED = Object.freeze({
174331
+ packConfigured: false,
174332
+ isActive: () => false,
174333
+ signature: JSON.stringify({ p: false })
174334
+ });
174124
174335
  SUBSTITUTION_EVIDENCE = SUBSTITUTION_EVIDENCE$1;
174125
174336
  bundledFamilies = new Set(BUNDLED_MANIFEST.map((f2) => f2.family));
174126
174337
  BUNDLED_SUBSTITUTES = deriveBundledSubstitutes();
@@ -174130,9 +174341,9 @@ var init_SuperConverter_DAuqlmYY_es = __esm(() => {
174130
174341
  resolvePhysical: (cssFontFamily, _face) => resolvePhysicalFamily(cssFontFamily),
174131
174342
  fontSignature: ""
174132
174343
  });
174133
- installedRegistries = /* @__PURE__ */ new WeakMap;
174134
174344
  RENDER_ALL = { canRenderFamily: () => true };
174135
174345
  OS2_MIN_LENGTH = OS2_FSSELECTION + 2;
174346
+ BUNDLED_SUBSTITUTE_FAMILIES = new Set(BUNDLED_MANIFEST.map((f2) => f2.family));
174136
174347
  registriesByFontSet = /* @__PURE__ */ new WeakMap;
174137
174348
  BUNDLED_FAMILIES = new Set(BUNDLED_MANIFEST.map((f2) => f2.family));
174138
174349
  SUPPORTED_ALIAS_FAMILIES = new Set([
@@ -174140,6 +174351,11 @@ var init_SuperConverter_DAuqlmYY_es = __esm(() => {
174140
174351
  "Courier",
174141
174352
  "Times"
174142
174353
  ]);
174354
+ BUILT_IN_TOOLBAR_BASELINE_FAMILIES = new Set([
174355
+ "Arial",
174356
+ "Courier New",
174357
+ "Times New Roman"
174358
+ ]);
174143
174359
  ADVERTISED_BUILT_IN_TOOLBAR_FAMILIES = new Set([
174144
174360
  "Arial Black",
174145
174361
  "Arial Narrow",
@@ -174160,6 +174376,8 @@ var init_SuperConverter_DAuqlmYY_es = __esm(() => {
174160
174376
  "Verdana"
174161
174377
  ]);
174162
174378
  FONT_OFFERINGS = deriveOfferings();
174379
+ BUNDLED_LOGICAL_FAMILIES = [...new Set(FONT_OFFERINGS.filter((o) => o.bundled).map((o) => o.logicalFamily))].sort((a, b) => a.localeCompare(b, "en", { sensitivity: "base" }));
174380
+ BUNDLED_LOGICAL_KEYS = new Set(BUNDLED_LOGICAL_FAMILIES.map(normalizeFamilyKey));
174163
174381
  ALL_COMMENT_TARGETS = COMMENT_FILE_BASENAMES;
174164
174382
  REL_ID_NUMERIC_PATTERN = /rId|mi/g;
174165
174383
  FOOTNOTES_CONFIG$1 = {
@@ -175954,7 +176172,7 @@ var init_SuperConverter_DAuqlmYY_es = __esm(() => {
175954
176172
  };
175955
176173
  });
175956
176174
 
175957
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BT0XKtIW.es.js
176175
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-CSJZe3lZ.es.js
175958
176176
  function parseSizeUnit(val = "0") {
175959
176177
  const length3 = val.toString() || "0";
175960
176178
  const value = Number.parseFloat(length3);
@@ -186603,8 +186821,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
186603
186821
  }
186604
186822
  };
186605
186823
  };
186606
- var init_create_headless_toolbar_BT0XKtIW_es = __esm(() => {
186607
- init_SuperConverter_DAuqlmYY_es();
186824
+ var init_create_headless_toolbar_CSJZe3lZ_es = __esm(() => {
186825
+ init_SuperConverter_C3uAnS0b_es();
186608
186826
  init_uuid_B2wVPhPi_es();
186609
186827
  init_constants_D9qj59G2_es();
186610
186828
  init_dist_B8HfvhaK_es();
@@ -235773,7 +235991,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
235773
235991
  init_remark_gfm_BhnWr3yf_es();
235774
235992
  });
235775
235993
 
235776
- // ../../packages/superdoc/dist/chunks/src-DGC_pZIT.es.js
235994
+ // ../../packages/superdoc/dist/chunks/src-DwYnU5Rz.es.js
235777
235995
  function deleteProps(obj, propOrProps) {
235778
235996
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
235779
235997
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -235847,7 +236065,7 @@ function prosemirrorToYXmlFragment(doc$12, xmlFragment) {
235847
236065
  }
235848
236066
  function getSuperdocVersion() {
235849
236067
  try {
235850
- return "1.39.0";
236068
+ return "1.40.0";
235851
236069
  } catch {
235852
236070
  return "unknown";
235853
236071
  }
@@ -248133,20 +248351,32 @@ function scrollToElement(targetElement, options = {
248133
248351
  behavior: options.behavior
248134
248352
  });
248135
248353
  }
248354
+ function toolbarFontOptionsFor(activation = BASELINE_BUNDLED) {
248355
+ return getBuiltInToolbarFontOfferings(activation).map((offering) => ({
248356
+ label: offering.logicalFamily,
248357
+ key: fontOfferingStack(offering),
248358
+ fontWeight: 400,
248359
+ props: {
248360
+ style: { fontFamily: fontOfferingRenderStack(offering) },
248361
+ "data-item": "btn-fontFamily-option"
248362
+ }
248363
+ }));
248364
+ }
248136
248365
  function normalizeToolbarFamily(value) {
248137
248366
  return String(value ?? "").trim().toLowerCase();
248138
248367
  }
248139
248368
  function compareToolbarFontOptions(a2, b$1) {
248140
248369
  return String(a2.label ?? "").trim().localeCompare(String(b$1.label ?? "").trim(), "en", { sensitivity: "base" });
248141
248370
  }
248142
- function composeToolbarFontOptions(documentOptions, configFonts) {
248371
+ function composeToolbarFontOptions(documentOptions, configFonts, activation = BASELINE_BUNDLED) {
248143
248372
  if (configFonts)
248144
248373
  return configFonts;
248145
- if (!documentOptions?.length)
248374
+ if (!activation.packConfigured && !documentOptions?.length)
248146
248375
  return;
248147
- const seen = new Set(TOOLBAR_FONTS.map((option) => normalizeToolbarFamily(option.label)));
248148
- const merged = [...TOOLBAR_FONTS];
248149
- for (const option of documentOptions) {
248376
+ const base5 = toolbarFontOptionsFor(activation);
248377
+ const seen = new Set(base5.map((option) => normalizeToolbarFamily(option.label)));
248378
+ const merged = [...base5];
248379
+ for (const option of documentOptions ?? []) {
248150
248380
  const dedupeKey = normalizeToolbarFamily(option.logicalFamily);
248151
248381
  if (seen.has(dedupeKey))
248152
248382
  continue;
@@ -248161,7 +248391,7 @@ function composeToolbarFontOptions(documentOptions, configFonts) {
248161
248391
  }
248162
248392
  });
248163
248393
  }
248164
- return merged.length > TOOLBAR_FONTS.length ? merged.sort(compareToolbarFontOptions) : undefined;
248394
+ return merged.sort(compareToolbarFontOptions);
248165
248395
  }
248166
248396
  function isExtensionRulesEnabled(extension3, enabled) {
248167
248397
  if (Array.isArray(enabled))
@@ -307064,6 +307294,17 @@ var Node$13 = class Node$14 {
307064
307294
  } catch {
307065
307295
  return step3;
307066
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;
307067
307308
  }, replaceStep2 = ({ state, tr, step: step3, newTr, map: map$12, user, date, originalStep, originalStepIndex, replacements = "paired" }) => {
307068
307309
  const originalRange = {
307069
307310
  from: step3.from,
@@ -307250,6 +307491,7 @@ var Node$13 = class Node$14 {
307250
307491
  if (!hasInlineContent)
307251
307492
  return { handled: false };
307252
307493
  }
307494
+ const isStructuralShellDelete = step3.from !== step3.to && step3.slice.content.size > 0 && !sliceHasInlineLeafContent(step3.slice);
307253
307495
  let intent;
307254
307496
  try {
307255
307497
  const preserveExistingReviewState = tr.getMeta("protectTrackedReviewState") === true;
@@ -307263,7 +307505,7 @@ var Node$13 = class Node$14 {
307263
307505
  source,
307264
307506
  preserveExistingReviewState
307265
307507
  });
307266
- else if (step3.from !== step3.to && step3.slice.content.size === 0)
307508
+ else if (step3.from !== step3.to && (step3.slice.content.size === 0 || isStructuralShellDelete))
307267
307509
  intent = makeTextDeleteIntent({
307268
307510
  from: step3.from,
307269
307511
  to: step3.to,
@@ -307319,7 +307561,10 @@ var Node$13 = class Node$14 {
307319
307561
  map$12.appendMap(invertStep.getMap());
307320
307562
  const mirrorIndex = map$12.maps.length - 1;
307321
307563
  for (let i4 = beforeSteps;i4 < newTr.steps.length; i4 += 1)
307322
- 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);
307323
307568
  } else
307324
307569
  for (let i4 = beforeSteps;i4 < newTr.steps.length; i4 += 1)
307325
307570
  map$12.appendMap(newTr.steps[i4].getMap());
@@ -307338,7 +307583,7 @@ var Node$13 = class Node$14 {
307338
307583
  meta2.step = result.insertedStep;
307339
307584
  else if (result.insertedMark && result.insertedNodes?.length)
307340
307585
  meta2.step = { slice: { content: { content: result.insertedNodes } } };
307341
- if (result.selection?.kind === "near" && stepWasNormalized && !result.insertedMark)
307586
+ if (result.selection?.kind === "near" && (stepWasNormalized || isStructuralShellDelete) && !result.insertedMark)
307342
307587
  meta2.selectionPos = result.selection.pos;
307343
307588
  newTr.setMeta(TrackChangesBasePluginKey, meta2);
307344
307589
  newTr.setMeta(CommentsPluginKey, { type: "force" });
@@ -309338,7 +309583,10 @@ var Node$13 = class Node$14 {
309338
309583
  originalId: event.changeId
309339
309584
  }).some(({ mark: mark2 }) => mark2.attrs?.splitFromId === event.changeId))
309340
309585
  continue;
309341
- editor.emit("commentsUpdate", event);
309586
+ editor.emit("commentsUpdate", {
309587
+ ...event,
309588
+ decision
309589
+ });
309342
309590
  }
309343
309591
  const touched = result.touchedChangeIds instanceof Set ? result.touchedChangeIds : new Set(result.touchedChangeIds || []);
309344
309592
  const emittedFor = /* @__PURE__ */ new Set;
@@ -313424,7 +313672,7 @@ var Node$13 = class Node$14 {
313424
313672
  domAvailabilityCache = false;
313425
313673
  return false;
313426
313674
  }
313427
- }, summaryVersion = "1.39.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
313675
+ }, summaryVersion = "1.40.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
313428
313676
  const container = document.createElement("div");
313429
313677
  container.innerHTML = html3;
313430
313678
  const result = [];
@@ -314610,7 +314858,7 @@ var Node$13 = class Node$14 {
314610
314858
  return () => {};
314611
314859
  const handle3 = setInterval(callback, intervalMs);
314612
314860
  return () => clearInterval(handle3);
314613
- }, HISTORY_UNSAFE_OPS, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, V2_COVERAGE, SNAPSHOT_VERSION_V2 = "sd-diff-snapshot/v2", PAYLOAD_VERSION_V1 = "sd-diff-payload/v1", PAYLOAD_VERSION_V2 = "sd-diff-payload/v2", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH2 = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN2, FOOTER_FILE_PATTERN2, SPECIAL_NOTE_TYPES, BOOKMARK_SCAN_REVISION_PREFIX = "bookmark-scan:", import_lib4, CUSTOM_XML_DATA_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", CUSTOM_XML_DATASTORE_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/customXml", SETTINGS_PART, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, REFERENCE_BLOCK_PREFIX, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, DOCUMENT_STAT_FIELD_TYPES, TOA_LEADER_REVERSE_MAP, EDGE_NODE_TYPES, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.39.0", PIXELS_PER_INCH2 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, TRACKED_REVIEW_MARK_NAMES2, isTrackedReviewMark = (mark2) => Boolean(mark2?.type?.name && TRACKED_REVIEW_MARK_NAMES2.has(mark2.type.name)), trackedReviewMarkKey = (mark2) => {
314861
+ }, HISTORY_UNSAFE_OPS, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, V2_COVERAGE, SNAPSHOT_VERSION_V2 = "sd-diff-snapshot/v2", PAYLOAD_VERSION_V1 = "sd-diff-payload/v1", PAYLOAD_VERSION_V2 = "sd-diff-payload/v2", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH2 = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN2, FOOTER_FILE_PATTERN2, SPECIAL_NOTE_TYPES, BOOKMARK_SCAN_REVISION_PREFIX = "bookmark-scan:", import_lib4, CUSTOM_XML_DATA_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", CUSTOM_XML_DATASTORE_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/customXml", SETTINGS_PART, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, REFERENCE_BLOCK_PREFIX, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, DOCUMENT_STAT_FIELD_TYPES, TOA_LEADER_REVERSE_MAP, EDGE_NODE_TYPES, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.40.0", PIXELS_PER_INCH2 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, TRACKED_REVIEW_MARK_NAMES2, isTrackedReviewMark = (mark2) => Boolean(mark2?.type?.name && TRACKED_REVIEW_MARK_NAMES2.has(mark2.type.name)), trackedReviewMarkKey = (mark2) => {
314614
314862
  if (!isTrackedReviewMark(mark2))
314615
314863
  return null;
314616
314864
  const id2 = typeof mark2.attrs?.id === "string" ? mark2.attrs.id : "";
@@ -333925,6 +334173,8 @@ menclose::after {
333925
334173
  }
333926
334174
  applyInitialConfig(config2) {
333927
334175
  this.#cancelPendingRuntimeReflow();
334176
+ warnUnknownBundledSelection(config2?.bundled);
334177
+ this.#resolver.setActivation(deriveBundledActivationForConfig(config2));
333928
334178
  if (!config2)
333929
334179
  return;
333930
334180
  const registered$1 = this.#registerFamilies(config2.families);
@@ -334150,13 +334400,13 @@ menclose::after {
334150
334400
  return;
334151
334401
  console.log(...args$1);
334152
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;
334153
- var init_src_DGC_pZIT_es = __esm(() => {
334403
+ var init_src_DwYnU5Rz_es = __esm(() => {
334154
334404
  init_rolldown_runtime_Bg48TavK_es();
334155
- init_SuperConverter_DAuqlmYY_es();
334405
+ init_SuperConverter_C3uAnS0b_es();
334156
334406
  init_jszip_C49i9kUs_es();
334157
334407
  init_xml_js_CqGKpaft_es();
334158
334408
  init_uuid_B2wVPhPi_es();
334159
- init_create_headless_toolbar_BT0XKtIW_es();
334409
+ init_create_headless_toolbar_CSJZe3lZ_es();
334160
334410
  init_constants_D9qj59G2_es();
334161
334411
  init_dist_B8HfvhaK_es();
334162
334412
  init_unified_Dsuw2be5_es();
@@ -354976,15 +355226,7 @@ function print() { __p += __j.call(arguments, '') }
354976
355226
  };
354977
355227
  }
354978
355228
  }, [["__scopeId", "data-v-d25821a5"]]);
354979
- TOOLBAR_FONTS = getBuiltInToolbarFontOfferings().map((offering) => ({
354980
- label: offering.logicalFamily,
354981
- key: fontOfferingStack(offering),
354982
- fontWeight: 400,
354983
- props: {
354984
- style: { fontFamily: fontOfferingRenderStack(offering) },
354985
- "data-item": "btn-fontFamily-option"
354986
- }
354987
- }));
355229
+ TOOLBAR_FONTS = toolbarFontOptionsFor(BASELINE_BUNDLED);
354988
355230
  TOOLBAR_FONT_SIZES = [
354989
355231
  {
354990
355232
  label: "8",
@@ -357562,7 +357804,7 @@ function print() { __p += __j.call(arguments, '') }
357562
357804
  this.overflowItems = overflowItems.filter((item) => allConfigItems.includes(item.name.value));
357563
357805
  }
357564
357806
  #resolveToolbarFonts(configFonts) {
357565
- return composeToolbarFontOptions(this.superdoc?.fonts?.getDocumentFontOptions?.() ?? [], configFonts);
357807
+ return composeToolbarFontOptions(this.superdoc?.fonts?.getDocumentFontOptions?.() ?? [], configFonts, deriveBundledActivationForConfig(this.superdoc?.config?.fonts));
357566
357808
  }
357567
357809
  #rebuildToolbarItems() {
357568
357810
  this.#makeToolbarItems({
@@ -363650,10 +363892,14 @@ function print() { __p += __j.call(arguments, '') }
363650
363892
  getRequiredFaces: () => this.#fontPlan?.requiredFaces ?? [],
363651
363893
  getUsedFaces: () => this.#fontPlan?.usedFaces ?? [],
363652
363894
  fontResolver: this.#fontResolver,
363653
- onRegistryResolved: (registry2) => installBundledSubstitutes(registry2, {
363654
- assetBaseUrl: this.#options.fontAssets?.assetBaseUrl,
363655
- resolveAssetUrl: this.#options.fontAssets?.resolveAssetUrl
363656
- }),
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
+ },
363657
363903
  getFontEnvironment: () => {
363658
363904
  const ownerDoc = this.#visibleHost?.ownerDocument ?? (typeof document !== "undefined" ? document : null);
363659
363905
  const view = ownerDoc?.defaultView ?? (typeof window !== "undefined" ? window : null);
@@ -369943,11 +370189,11 @@ function print() { __p += __j.call(arguments, '') }
369943
370189
  ]);
369944
370190
  });
369945
370191
 
369946
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-Zmv88GYo.es.js
370192
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-B9SVqVK2.es.js
369947
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;
369948
- var init_create_super_doc_ui_Zmv88GYo_es = __esm(() => {
369949
- init_SuperConverter_DAuqlmYY_es();
369950
- init_create_headless_toolbar_BT0XKtIW_es();
370194
+ var init_create_super_doc_ui_B9SVqVK2_es = __esm(() => {
370195
+ init_SuperConverter_C3uAnS0b_es();
370196
+ init_create_headless_toolbar_CSJZe3lZ_es();
369951
370197
  DEFAULT_TEXT_ALIGN_OPTIONS = [
369952
370198
  {
369953
370199
  label: "Left",
@@ -370238,16 +370484,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
370238
370484
 
370239
370485
  // ../../packages/superdoc/dist/super-editor.es.js
370240
370486
  var init_super_editor_es = __esm(() => {
370241
- init_src_DGC_pZIT_es();
370242
- init_SuperConverter_DAuqlmYY_es();
370487
+ init_src_DwYnU5Rz_es();
370488
+ init_SuperConverter_C3uAnS0b_es();
370243
370489
  init_jszip_C49i9kUs_es();
370244
370490
  init_xml_js_CqGKpaft_es();
370245
- init_create_headless_toolbar_BT0XKtIW_es();
370491
+ init_create_headless_toolbar_CSJZe3lZ_es();
370246
370492
  init_constants_D9qj59G2_es();
370247
370493
  init_dist_B8HfvhaK_es();
370248
370494
  init_unified_Dsuw2be5_es();
370249
370495
  init_DocxZipper_FUsfThjV_es();
370250
- init_create_super_doc_ui_Zmv88GYo_es();
370496
+ init_create_super_doc_ui_B9SVqVK2_es();
370251
370497
  init_ui_C5PAS9hY_es();
370252
370498
  init_eventemitter3_BnGqBE_Q_es();
370253
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.30",
3
+ "version": "0.17.0-next.32",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -24,20 +24,20 @@
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",
29
- "superdoc": "1.39.0"
28
+ "@superdoc/document-api": "0.0.1",
29
+ "superdoc": "1.40.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.17.0-next.30",
37
- "@superdoc-dev/cli-darwin-x64": "0.17.0-next.30",
38
- "@superdoc-dev/cli-linux-arm64": "0.17.0-next.30",
39
- "@superdoc-dev/cli-windows-x64": "0.17.0-next.30",
40
- "@superdoc-dev/cli-linux-x64": "0.17.0-next.30"
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",