@superdoc-dev/cli 0.17.0-next.3 → 0.17.0-next.4

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 +230 -65
  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-CfRQprW6.es.js
68330
+ // ../../packages/superdoc/dist/chunks/SuperConverter-BaKhr4cp.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")
@@ -102479,32 +102479,37 @@ function buildFallback(row, physicalFamily, verdict, faceSlot) {
102479
102479
  lineBreakSafe: LINE_BREAK_SAFE_VERDICTS.has(verdict),
102480
102480
  faces: row.faces,
102481
102481
  evidenceId: row.evidenceId,
102482
+ generic: row.generic,
102482
102483
  ...glyphExceptions && glyphExceptions.length > 0 ? { glyphExceptions } : {}
102483
102484
  };
102484
102485
  }
102485
102486
  function decideRow(row, canRenderFamily$1) {
102486
- const { policyAction, physicalFamily, verdict, evidenceId } = row;
102487
+ const { policyAction, physicalFamily, verdict, evidenceId, generic } = row;
102487
102488
  if (policyAction === "preserve_only")
102488
102489
  return {
102489
102490
  kind: "preserve_only",
102490
- evidenceId
102491
+ evidenceId,
102492
+ generic
102491
102493
  };
102492
102494
  if (policyAction === "customer_supplied")
102493
102495
  return {
102494
102496
  kind: "customer_supplied",
102495
- evidenceId
102497
+ evidenceId,
102498
+ generic
102496
102499
  };
102497
102500
  if (physicalFamily === null)
102498
102501
  return {
102499
102502
  kind: "no_recommended_fallback",
102500
- evidenceId
102503
+ evidenceId,
102504
+ generic
102501
102505
  };
102502
102506
  if (canRenderFamily$1 && !canRenderFamily$1(physicalFamily))
102503
102507
  return {
102504
102508
  kind: "asset_missing",
102505
102509
  substituteFamily: physicalFamily,
102506
102510
  verdict,
102507
- evidenceId
102511
+ evidenceId,
102512
+ generic
102508
102513
  };
102509
102514
  return {
102510
102515
  kind: "fallback",
@@ -102523,7 +102528,8 @@ function decideRowForFace(row, face, canRenderFamily$1) {
102523
102528
  return {
102524
102529
  kind: "face_missing",
102525
102530
  substituteFamily: base$1.fallback.substituteFamily,
102526
- evidenceId: row.evidenceId
102531
+ evidenceId: row.evidenceId,
102532
+ generic: row.generic
102527
102533
  };
102528
102534
  const faceVerdict = row.faceVerdicts?.[face] ?? row.verdict;
102529
102535
  return {
@@ -102844,7 +102850,7 @@ function deriveOfferings() {
102844
102850
  return {
102845
102851
  logicalFamily: row.logicalFamily,
102846
102852
  physicalFamily: row.physicalFamily,
102847
- generic: row.physicalFamily && PHYSICAL_GENERIC[row.physicalFamily] || "sans-serif",
102853
+ generic: row.generic,
102848
102854
  offering: classifyOffering(row.policyAction, row.verdict, row.physicalFamily, bundled),
102849
102855
  bundled,
102850
102856
  verdict: row.verdict,
@@ -102853,12 +102859,11 @@ function deriveOfferings() {
102853
102859
  });
102854
102860
  return Object.freeze(offerings);
102855
102861
  }
102862
+ function compareLogicalFamily(a, b) {
102863
+ return a.logicalFamily.localeCompare(b.logicalFamily, "en", { sensitivity: "base" });
102864
+ }
102856
102865
  function getDefaultFontOfferings() {
102857
- const rank$1 = (name) => {
102858
- const i$1 = DEFAULT_FONT_ORDER.indexOf(name);
102859
- return i$1 === -1 ? DEFAULT_FONT_ORDER.length : i$1;
102860
- };
102861
- return FONT_OFFERINGS.filter((o) => o.offering === "default").sort((a, b) => rank$1(a.logicalFamily) - rank$1(b.logicalFamily));
102866
+ return FONT_OFFERINGS.filter((o) => o.offering === "default").sort(compareLogicalFamily);
102862
102867
  }
102863
102868
  function fontOfferingStack(offering) {
102864
102869
  return `${offering.logicalFamily}, ${offering.generic}`;
@@ -102872,6 +102877,33 @@ function getDefaultFontFamilyOptions() {
102872
102877
  value: fontOfferingStack(offering)
102873
102878
  }));
102874
102879
  }
102880
+ function normalizeKey(family$1) {
102881
+ return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
102882
+ }
102883
+ function isRegularFace(rec) {
102884
+ return rec.face?.weight === "400" && rec.face?.style === "normal";
102885
+ }
102886
+ function buildDocumentFontOptions(usedFaces, registry, resolver$1) {
102887
+ const faceRecords = buildFaceReport(usedFaces, registry, resolver$1);
102888
+ const agg = /* @__PURE__ */ new Map;
102889
+ for (const rec of faceRecords) {
102890
+ const key = normalizeKey(rec.logicalFamily);
102891
+ const existing = agg.get(key);
102892
+ if (!existing) {
102893
+ agg.set(key, rec);
102894
+ continue;
102895
+ }
102896
+ if (isRegularFace(rec) && !isRegularFace(existing))
102897
+ agg.set(key, rec);
102898
+ }
102899
+ const options = [];
102900
+ for (const rep of agg.values())
102901
+ options.push({
102902
+ logicalFamily: rep.logicalFamily,
102903
+ previewFamily: rep.physicalFamily
102904
+ });
102905
+ return options;
102906
+ }
102875
102907
  function writeAppStatistics(convertedXml, stats) {
102876
102908
  const elements = ensureElements$1(ensureAppPropertiesRoot(convertedXml));
102877
102909
  upsertSimpleElement(elements, "Words", String(stats.words));
@@ -130184,7 +130216,7 @@ var isRegExp = (value) => {
130184
130216
  const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
130185
130217
  console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
130186
130218
  }
130187
- }, registriesByFontSet, domlessRegistry = null, PHYSICAL_GENERIC, BUNDLED_FAMILIES, FONT_OFFERINGS, DEFAULT_FONT_ORDER, prepareCommentParaIds = (comment) => {
130219
+ }, registriesByFontSet, domlessRegistry = null, BUNDLED_FAMILIES, FONT_OFFERINGS, prepareCommentParaIds = (comment) => {
130188
130220
  return {
130189
130221
  ...comment,
130190
130222
  commentParaId: generateDocxRandomId()
@@ -134160,7 +134192,7 @@ var isRegExp = (value) => {
134160
134192
  state.kern = kernNode.attributes["w:val"];
134161
134193
  }
134162
134194
  }, SuperConverter;
134163
- var init_SuperConverter_CfRQprW6_es = __esm(() => {
134195
+ var init_SuperConverter_BaKhr4cp_es = __esm(() => {
134164
134196
  init_rolldown_runtime_Bg48TavK_es();
134165
134197
  init_jszip_C49i9kUs_es();
134166
134198
  init_xml_js_CqGKpaft_es();
@@ -171480,6 +171512,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171480
171512
  SUBSTITUTION_EVIDENCE$1 = [
171481
171513
  {
171482
171514
  evidenceId: "calibri",
171515
+ generic: "sans-serif",
171483
171516
  logicalFamily: "Calibri",
171484
171517
  physicalFamily: "Carlito",
171485
171518
  verdict: "metric_safe",
@@ -171506,6 +171539,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171506
171539
  },
171507
171540
  {
171508
171541
  evidenceId: "cambria",
171542
+ generic: "serif",
171509
171543
  logicalFamily: "Cambria",
171510
171544
  physicalFamily: "Caladea",
171511
171545
  verdict: "visual_only",
@@ -171549,6 +171583,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171549
171583
  },
171550
171584
  {
171551
171585
  evidenceId: "arial",
171586
+ generic: "sans-serif",
171552
171587
  logicalFamily: "Arial",
171553
171588
  physicalFamily: "Liberation Sans",
171554
171589
  verdict: "metric_safe",
@@ -171575,6 +171610,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171575
171610
  },
171576
171611
  {
171577
171612
  evidenceId: "times-new-roman",
171613
+ generic: "serif",
171578
171614
  logicalFamily: "Times New Roman",
171579
171615
  physicalFamily: "Liberation Serif",
171580
171616
  verdict: "metric_safe",
@@ -171601,6 +171637,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171601
171637
  },
171602
171638
  {
171603
171639
  evidenceId: "courier-new",
171640
+ generic: "monospace",
171604
171641
  logicalFamily: "Courier New",
171605
171642
  physicalFamily: "Liberation Mono",
171606
171643
  verdict: "metric_safe",
@@ -171627,6 +171664,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171627
171664
  },
171628
171665
  {
171629
171666
  evidenceId: "georgia",
171667
+ generic: "serif",
171630
171668
  logicalFamily: "Georgia",
171631
171669
  physicalFamily: "Gelasio",
171632
171670
  verdict: "near_metric",
@@ -171679,6 +171717,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171679
171717
  },
171680
171718
  {
171681
171719
  evidenceId: "arial-narrow",
171720
+ generic: "sans-serif",
171682
171721
  logicalFamily: "Arial Narrow",
171683
171722
  physicalFamily: "Liberation Sans Narrow",
171684
171723
  verdict: "visual_only",
@@ -171722,6 +171761,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171722
171761
  },
171723
171762
  {
171724
171763
  evidenceId: "aptos",
171764
+ generic: "sans-serif",
171725
171765
  logicalFamily: "Aptos",
171726
171766
  physicalFamily: null,
171727
171767
  verdict: "no_substitute",
@@ -171744,6 +171784,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171744
171784
  },
171745
171785
  {
171746
171786
  evidenceId: "consolas",
171787
+ generic: "monospace",
171747
171788
  logicalFamily: "Consolas",
171748
171789
  physicalFamily: "Inconsolata SemiExpanded",
171749
171790
  verdict: "cell_width_only",
@@ -171770,6 +171811,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171770
171811
  },
171771
171812
  {
171772
171813
  evidenceId: "verdana",
171814
+ generic: "sans-serif",
171773
171815
  logicalFamily: "Verdana",
171774
171816
  physicalFamily: null,
171775
171817
  verdict: "visual_only",
@@ -171792,6 +171834,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171792
171834
  },
171793
171835
  {
171794
171836
  evidenceId: "tahoma",
171837
+ generic: "sans-serif",
171795
171838
  logicalFamily: "Tahoma",
171796
171839
  physicalFamily: null,
171797
171840
  verdict: "visual_only",
@@ -171814,6 +171857,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171814
171857
  },
171815
171858
  {
171816
171859
  evidenceId: "trebuchet-ms",
171860
+ generic: "sans-serif",
171817
171861
  logicalFamily: "Trebuchet MS",
171818
171862
  physicalFamily: null,
171819
171863
  verdict: "visual_only",
@@ -171836,6 +171880,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171836
171880
  },
171837
171881
  {
171838
171882
  evidenceId: "comic-sans-ms",
171883
+ generic: "sans-serif",
171839
171884
  logicalFamily: "Comic Sans MS",
171840
171885
  physicalFamily: "Comic Neue",
171841
171886
  verdict: "visual_only",
@@ -171862,6 +171907,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171862
171907
  },
171863
171908
  {
171864
171909
  evidenceId: "candara",
171910
+ generic: "sans-serif",
171865
171911
  logicalFamily: "Candara",
171866
171912
  physicalFamily: null,
171867
171913
  verdict: "visual_only",
@@ -171884,6 +171930,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171884
171930
  },
171885
171931
  {
171886
171932
  evidenceId: "constantia",
171933
+ generic: "serif",
171887
171934
  logicalFamily: "Constantia",
171888
171935
  physicalFamily: null,
171889
171936
  verdict: "visual_only",
@@ -171906,6 +171953,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171906
171953
  },
171907
171954
  {
171908
171955
  evidenceId: "corbel",
171956
+ generic: "sans-serif",
171909
171957
  logicalFamily: "Corbel",
171910
171958
  physicalFamily: null,
171911
171959
  verdict: "visual_only",
@@ -171928,6 +171976,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171928
171976
  },
171929
171977
  {
171930
171978
  evidenceId: "lucida-console",
171979
+ generic: "monospace",
171931
171980
  logicalFamily: "Lucida Console",
171932
171981
  physicalFamily: "Cousine",
171933
171982
  verdict: "cell_width_only",
@@ -171954,6 +172003,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171954
172003
  },
171955
172004
  {
171956
172005
  evidenceId: "aptos-display",
172006
+ generic: "sans-serif",
171957
172007
  logicalFamily: "Aptos Display",
171958
172008
  physicalFamily: null,
171959
172009
  verdict: "customer_supplied",
@@ -171975,6 +172025,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171975
172025
  },
171976
172026
  {
171977
172027
  evidenceId: "cambria-math",
172028
+ generic: "serif",
171978
172029
  logicalFamily: "Cambria Math",
171979
172030
  physicalFamily: null,
171980
172031
  verdict: "preserve_only",
@@ -171996,6 +172047,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
171996
172047
  },
171997
172048
  {
171998
172049
  evidenceId: "helvetica",
172050
+ generic: "sans-serif",
171999
172051
  logicalFamily: "Helvetica",
172000
172052
  physicalFamily: "Liberation Sans",
172001
172053
  verdict: "metric_safe",
@@ -172022,6 +172074,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
172022
172074
  },
172023
172075
  {
172024
172076
  evidenceId: "calibri-light",
172077
+ generic: "sans-serif",
172025
172078
  logicalFamily: "Calibri Light",
172026
172079
  physicalFamily: "Carlito",
172027
172080
  verdict: "visual_only",
@@ -172048,6 +172101,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
172048
172101
  },
172049
172102
  {
172050
172103
  evidenceId: "baskerville-old-face",
172104
+ generic: "serif",
172051
172105
  logicalFamily: "Baskerville Old Face",
172052
172106
  physicalFamily: "Bacasime Antique",
172053
172107
  verdict: "visual_only",
@@ -172078,6 +172132,34 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
172078
172132
  advanceDelta: 0.4916,
172079
172133
  note: "Bacasime Antique Regular's no-break space (U+00A0) advance diverges ~49% from Baskerville Old Face; lines containing NBSP reflow. Every other Latin-core glyph is advance-identical, which is why this is visual_only with a single named exception, not near_metric."
172080
172134
  }]
172135
+ },
172136
+ {
172137
+ evidenceId: "cooper-black",
172138
+ generic: "serif",
172139
+ logicalFamily: "Cooper Black",
172140
+ physicalFamily: "Caprasimo",
172141
+ verdict: "metric_safe",
172142
+ faces: {
172143
+ regular: true,
172144
+ bold: false,
172145
+ italic: false,
172146
+ boldItalic: false
172147
+ },
172148
+ gates: {
172149
+ static: "pass",
172150
+ metric: "pass",
172151
+ layout: "not_run",
172152
+ ship: "not_run"
172153
+ },
172154
+ policyAction: "substitute",
172155
+ measurementRefs: ["cooper-black_regular__caprasimo#regular#w400#786ab84e#analytic_advance#2026-06-05"],
172156
+ exportRule: "preserve_original_name",
172157
+ advance: {
172158
+ meanDelta: 0,
172159
+ maxDelta: 0
172160
+ },
172161
+ candidateLicense: "OFL-1.1",
172162
+ faceVerdicts: { regular: "metric_safe" }
172081
172163
  }
172082
172164
  ];
172083
172165
  LINE_BREAK_SAFE_VERDICTS = new Set([
@@ -172106,22 +172188,8 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
172106
172188
  RENDER_ALL = { canRenderFamily: () => true };
172107
172189
  OS2_MIN_LENGTH = OS2_FSSELECTION + 2;
172108
172190
  registriesByFontSet = /* @__PURE__ */ new WeakMap;
172109
- PHYSICAL_GENERIC = Object.freeze({
172110
- Carlito: "sans-serif",
172111
- Caladea: "serif",
172112
- "Liberation Sans": "sans-serif",
172113
- "Liberation Serif": "serif",
172114
- "Liberation Mono": "monospace"
172115
- });
172116
172191
  BUNDLED_FAMILIES = new Set(BUNDLED_MANIFEST.map((f2) => f2.family));
172117
172192
  FONT_OFFERINGS = deriveOfferings();
172118
- DEFAULT_FONT_ORDER = [
172119
- "Calibri",
172120
- "Arial",
172121
- "Courier New",
172122
- "Times New Roman",
172123
- "Helvetica"
172124
- ];
172125
172193
  ALL_COMMENT_TARGETS = COMMENT_FILE_BASENAMES;
172126
172194
  REL_ID_NUMERIC_PATTERN = /rId|mi/g;
172127
172195
  FOOTNOTES_CONFIG$1 = {
@@ -173908,7 +173976,7 @@ var init_SuperConverter_CfRQprW6_es = __esm(() => {
173908
173976
  };
173909
173977
  });
173910
173978
 
173911
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DOEFHsWP.es.js
173979
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-B3wNa0zb.es.js
173912
173980
  function parseSizeUnit(val = "0") {
173913
173981
  const length3 = val.toString() || "0";
173914
173982
  const value = Number.parseFloat(length3);
@@ -184266,8 +184334,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
184266
184334
  }
184267
184335
  };
184268
184336
  };
184269
- var init_create_headless_toolbar_DOEFHsWP_es = __esm(() => {
184270
- init_SuperConverter_CfRQprW6_es();
184337
+ var init_create_headless_toolbar_B3wNa0zb_es = __esm(() => {
184338
+ init_SuperConverter_BaKhr4cp_es();
184271
184339
  init_uuid_B2wVPhPi_es();
184272
184340
  init_constants_D9qj59G2_es();
184273
184341
  init_dist_B8HfvhaK_es();
@@ -219787,7 +219855,7 @@ If you want to remount the same app, move your app creation logic into a factory
219787
219855
  var createVNodeWithArgsTransform = (...args2) => {
219788
219856
  return _createVNode(...vnodeArgsTransformer ? vnodeArgsTransformer(args2, currentRenderingInstance) : args2);
219789
219857
  };
219790
- var normalizeKey = ({ key: key2 }) => key2 != null ? key2 : null;
219858
+ var normalizeKey2 = ({ key: key2 }) => key2 != null ? key2 : null;
219791
219859
  var normalizeRef = ({
219792
219860
  ref: ref3,
219793
219861
  ref_key,
@@ -219804,7 +219872,7 @@ If you want to remount the same app, move your app creation logic into a factory
219804
219872
  __v_skip: true,
219805
219873
  type,
219806
219874
  props,
219807
- key: props && normalizeKey(props),
219875
+ key: props && normalizeKey2(props),
219808
219876
  ref: props && normalizeRef(props),
219809
219877
  scopeId: currentScopeId,
219810
219878
  slotScopeIds: null,
@@ -219904,7 +219972,7 @@ Component that was made reactive: `, type);
219904
219972
  __v_skip: true,
219905
219973
  type: vnode.type,
219906
219974
  props: mergedProps,
219907
- key: mergedProps && normalizeKey(mergedProps),
219975
+ key: mergedProps && normalizeKey2(mergedProps),
219908
219976
  ref: extraProps && extraProps.ref ? mergeRef && ref3 ? shared.isArray(ref3) ? ref3.concat(normalizeRef(extraProps)) : [ref3, normalizeRef(extraProps)] : normalizeRef(extraProps) : ref3,
219909
219977
  scopeId: vnode.scopeId,
219910
219978
  slotScopeIds: vnode.slotScopeIds,
@@ -233430,7 +233498,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
233430
233498
  init_remark_gfm_BhnWr3yf_es();
233431
233499
  });
233432
233500
 
233433
- // ../../packages/superdoc/dist/chunks/src-CDxARMZD.es.js
233501
+ // ../../packages/superdoc/dist/chunks/src-BU1mfNkI.es.js
233434
233502
  function deleteProps(obj, propOrProps) {
233435
233503
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
233436
233504
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -245788,6 +245856,36 @@ function scrollToElement(targetElement, options = {
245788
245856
  behavior: options.behavior
245789
245857
  });
245790
245858
  }
245859
+ function normalizeToolbarFamily(value) {
245860
+ return String(value ?? "").trim().toLowerCase();
245861
+ }
245862
+ function compareToolbarFontOptions(a2, b$1) {
245863
+ return String(a2.label ?? "").trim().localeCompare(String(b$1.label ?? "").trim(), "en", { sensitivity: "base" });
245864
+ }
245865
+ function composeToolbarFontOptions(documentOptions, configFonts) {
245866
+ if (configFonts)
245867
+ return configFonts;
245868
+ if (!documentOptions?.length)
245869
+ return;
245870
+ const seen = new Set(TOOLBAR_FONTS.map((option) => normalizeToolbarFamily(option.label)));
245871
+ const merged = [...TOOLBAR_FONTS];
245872
+ for (const option of documentOptions) {
245873
+ const dedupeKey = normalizeToolbarFamily(option.logicalFamily);
245874
+ if (seen.has(dedupeKey))
245875
+ continue;
245876
+ seen.add(dedupeKey);
245877
+ merged.push({
245878
+ label: option.logicalFamily,
245879
+ key: option.logicalFamily,
245880
+ fontWeight: 400,
245881
+ props: {
245882
+ style: { fontFamily: option.previewFamily || option.logicalFamily },
245883
+ "data-item": "btn-fontFamily-option"
245884
+ }
245885
+ });
245886
+ }
245887
+ return merged.length > TOOLBAR_FONTS.length ? merged.sort(compareToolbarFontOptions) : undefined;
245888
+ }
245791
245889
  function isExtensionRulesEnabled(extension3, enabled) {
245792
245890
  if (Array.isArray(enabled))
245793
245891
  return enabled.some((enabledExtension) => {
@@ -330322,6 +330420,17 @@ menclose::after {
330322
330420
  const declaredRows = buildFontReport(declared.filter((family2) => family2 && !usedFamilies.has(family2.toLowerCase())), registry2, resolver2);
330323
330421
  return [...faceRows, ...declaredRows];
330324
330422
  }
330423
+ getDocumentFontOptions() {
330424
+ try {
330425
+ const usedFaces = this.#getUsedFaces?.() ?? [];
330426
+ if (!usedFaces.length)
330427
+ return [];
330428
+ const { registry: registry2 } = this.#resolveContext();
330429
+ return buildDocumentFontOptions(usedFaces, registry2, this.#fontResolver ?? undefined);
330430
+ } catch {
330431
+ return [];
330432
+ }
330433
+ }
330325
330434
  async ensureReadyForMeasure() {
330326
330435
  if (this.#getRequiredFaces)
330327
330436
  return this.#ensureFacesReady(this.#getRequiredFaces);
@@ -330761,13 +330870,13 @@ menclose::after {
330761
330870
  return;
330762
330871
  console.log(...args$1);
330763
330872
  }, 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;
330764
- var init_src_CDxARMZD_es = __esm(() => {
330873
+ var init_src_BU1mfNkI_es = __esm(() => {
330765
330874
  init_rolldown_runtime_Bg48TavK_es();
330766
- init_SuperConverter_CfRQprW6_es();
330875
+ init_SuperConverter_BaKhr4cp_es();
330767
330876
  init_jszip_C49i9kUs_es();
330768
330877
  init_xml_js_CqGKpaft_es();
330769
330878
  init_uuid_B2wVPhPi_es();
330770
- init_create_headless_toolbar_DOEFHsWP_es();
330879
+ init_create_headless_toolbar_B3wNa0zb_es();
330771
330880
  init_constants_D9qj59G2_es();
330772
330881
  init_dist_B8HfvhaK_es();
330773
330882
  init_unified_Dsuw2be5_es();
@@ -352987,16 +353096,21 @@ function print() { __p += __j.call(arguments, '') }
352987
353096
  toolbarKey.value += 1;
352988
353097
  };
352989
353098
  const onResizeThrottled = throttle(onWindowResized, 300);
352990
- function teardownWindowListeners() {
353099
+ const onToolbarItemsChanged = () => {
353100
+ toolbarKey.value += 1;
353101
+ };
353102
+ function teardownListeners() {
352991
353103
  window.removeEventListener("resize", onResizeThrottled);
352992
353104
  window.removeEventListener("keydown", onKeyDown);
353105
+ proxy.$toolbar.off?.("toolbar-items-changed", onToolbarItemsChanged);
352993
353106
  containerResizeObserver?.disconnect();
352994
353107
  containerResizeObserver = null;
352995
353108
  }
352996
- function setupWindowListeners() {
352997
- teardownWindowListeners();
353109
+ function setupListeners() {
353110
+ teardownListeners();
352998
353111
  window.addEventListener("resize", onResizeThrottled);
352999
353112
  window.addEventListener("keydown", onKeyDown);
353113
+ proxy.$toolbar.on?.("toolbar-items-changed", onToolbarItemsChanged);
353000
353114
  if (typeof ResizeObserver !== "undefined" && proxy.$toolbar.config?.responsiveToContainer && proxy.$toolbar.toolbarContainer) {
353001
353115
  containerResizeObserver = new ResizeObserver(() => {
353002
353116
  onResizeThrottled();
@@ -353005,10 +353119,10 @@ function print() { __p += __j.call(arguments, '') }
353005
353119
  }
353006
353120
  updateCompactSideGroups();
353007
353121
  }
353008
- exports_vue.onMounted(setupWindowListeners);
353009
- exports_vue.onActivated(setupWindowListeners);
353010
- exports_vue.onDeactivated(teardownWindowListeners);
353011
- exports_vue.onBeforeUnmount(teardownWindowListeners);
353122
+ exports_vue.onMounted(setupListeners);
353123
+ exports_vue.onActivated(setupListeners);
353124
+ exports_vue.onDeactivated(teardownListeners);
353125
+ exports_vue.onBeforeUnmount(teardownListeners);
353012
353126
  const handleCommand = ({ item, argument, option }) => {
353013
353127
  proxy.$toolbar.emitCommand({
353014
353128
  item,
@@ -353087,7 +353201,7 @@ function print() { __p += __j.call(arguments, '') }
353087
353201
  ], 32);
353088
353202
  };
353089
353203
  }
353090
- }, [["__scopeId", "data-v-b83d488a"]]);
353204
+ }, [["__scopeId", "data-v-938eaa1b"]]);
353091
353205
  toolbarTexts = {
353092
353206
  bold: "Bold",
353093
353207
  fontFamily: "Font",
@@ -353218,8 +353332,10 @@ function print() { __p += __j.call(arguments, '') }
353218
353332
  this._boundEditorHandlers = {
353219
353333
  transaction: null,
353220
353334
  selectionUpdate: null,
353221
- focus: null
353335
+ focus: null,
353336
+ fontsChanged: null
353222
353337
  };
353338
+ this._lastFontOptionsSignature = "";
353223
353339
  this._restoreFocusTimeoutId = null;
353224
353340
  if (!this.config.selector && this.config.element)
353225
353341
  this.config.selector = this.config.element;
@@ -353278,24 +353394,40 @@ function print() { __p += __j.call(arguments, '') }
353278
353394
  if (this.config.groups && !Array.isArray(this.config.groups) && Object.keys(this.config.groups).length)
353279
353395
  this.config.toolbarGroups = Object.keys(this.config.groups);
353280
353396
  }
353397
+ #detachActiveEditorListeners() {
353398
+ if (!this.activeEditor || !this._boundEditorHandlers.transaction)
353399
+ return;
353400
+ this.activeEditor.off("transaction", this._boundEditorHandlers.transaction);
353401
+ this.activeEditor.off("selectionUpdate", this._boundEditorHandlers.selectionUpdate);
353402
+ this.activeEditor.off("focus", this._boundEditorHandlers.focus);
353403
+ this.activeEditor.off("fonts-changed", this._boundEditorHandlers.fontsChanged);
353404
+ this._boundEditorHandlers.transaction = null;
353405
+ this._boundEditorHandlers.selectionUpdate = null;
353406
+ this._boundEditorHandlers.focus = null;
353407
+ this._boundEditorHandlers.fontsChanged = null;
353408
+ }
353281
353409
  setActiveEditor(editor) {
353282
- if (this.activeEditor && this._boundEditorHandlers.transaction) {
353283
- this.activeEditor.off("transaction", this._boundEditorHandlers.transaction);
353284
- this.activeEditor.off("selectionUpdate", this._boundEditorHandlers.selectionUpdate);
353285
- this.activeEditor.off("focus", this._boundEditorHandlers.focus);
353286
- this._boundEditorHandlers.transaction = null;
353287
- this._boundEditorHandlers.selectionUpdate = null;
353288
- this._boundEditorHandlers.focus = null;
353410
+ const sameEditor = editor === this.activeEditor;
353411
+ const alreadyListening = Boolean(this._boundEditorHandlers.transaction);
353412
+ if (sameEditor && (!editor || alreadyListening)) {
353413
+ this.updateToolbarState();
353414
+ return;
353289
353415
  }
353416
+ this.#detachActiveEditorListeners();
353290
353417
  this.activeEditor = editor;
353291
353418
  if (editor) {
353292
353419
  this._boundEditorHandlers.transaction = this.onEditorTransaction.bind(this);
353293
353420
  this._boundEditorHandlers.selectionUpdate = this.onEditorSelectionUpdate.bind(this);
353294
353421
  this._boundEditorHandlers.focus = this.onEditorFocus.bind(this);
353422
+ this._boundEditorHandlers.fontsChanged = this.onEditorFontsChanged.bind(this);
353295
353423
  this.activeEditor.on("transaction", this._boundEditorHandlers.transaction);
353296
353424
  this.activeEditor.on("selectionUpdate", this._boundEditorHandlers.selectionUpdate);
353297
353425
  this.activeEditor.on("focus", this._boundEditorHandlers.focus);
353426
+ this.activeEditor.on("fonts-changed", this._boundEditorHandlers.fontsChanged);
353298
353427
  }
353428
+ this.#rebuildToolbarItems();
353429
+ this._lastFontOptionsSignature = this.#fontOptionsSignature();
353430
+ this.updateToolbarState();
353299
353431
  }
353300
353432
  getToolbarItemByGroup(groupName) {
353301
353433
  return this.toolbarItems.filter((item) => (item.group?.value || "center") === groupName);
@@ -353312,13 +353444,14 @@ function print() { __p += __j.call(arguments, '') }
353312
353444
  return this.config.responsiveToContainer ? containerWidth : documentWidth;
353313
353445
  }
353314
353446
  #makeToolbarItems({ superToolbar, icons: icons$1, texts, fonts, hideButtons, isDev = false } = {}) {
353447
+ const availableWidth = this.getAvailableWidth();
353315
353448
  const { defaultItems, overflowItems } = makeDefaultItems({
353316
353449
  superToolbar,
353317
353450
  toolbarIcons: icons$1,
353318
353451
  toolbarTexts: texts,
353319
- toolbarFonts: fonts,
353452
+ toolbarFonts: this.#resolveToolbarFonts(fonts),
353320
353453
  hideButtons,
353321
- availableWidth: this.getAvailableWidth(),
353454
+ availableWidth,
353322
353455
  role: this.role,
353323
353456
  isDev
353324
353457
  });
@@ -353331,6 +353464,26 @@ function print() { __p += __j.call(arguments, '') }
353331
353464
  this.toolbarItems = defaultItems.filter((item) => allConfigItems.includes(item.name.value)).filter((item) => !this.config.excludeItems.includes(item.name.value));
353332
353465
  this.overflowItems = overflowItems.filter((item) => allConfigItems.includes(item.name.value));
353333
353466
  }
353467
+ #resolveToolbarFonts(configFonts) {
353468
+ return composeToolbarFontOptions(this.superdoc?.fonts?.getDocumentFontOptions?.() ?? [], configFonts);
353469
+ }
353470
+ #rebuildToolbarItems() {
353471
+ this.#makeToolbarItems({
353472
+ superToolbar: this,
353473
+ icons: this.config.icons,
353474
+ texts: this.config.texts,
353475
+ fonts: this.config.fonts,
353476
+ hideButtons: this.config.hideButtons,
353477
+ isDev: this.isDev
353478
+ });
353479
+ this.emit("toolbar-items-changed");
353480
+ }
353481
+ #fontOptionsSignature() {
353482
+ if (this.config.fonts)
353483
+ return "custom-fonts";
353484
+ const options = this.superdoc?.fonts?.getDocumentFontOptions?.() ?? [];
353485
+ return JSON.stringify(options.map((option) => [option.logicalFamily, option.previewFamily]));
353486
+ }
353334
353487
  #initDefaultFonts() {
353335
353488
  if (!this.activeEditor || !this.activeEditor.converter)
353336
353489
  return;
@@ -353702,6 +353855,14 @@ function print() { __p += __j.call(arguments, '') }
353702
353855
  if (this.#restoreStickyMarksIfNeeded())
353703
353856
  this.updateToolbarState();
353704
353857
  }
353858
+ onEditorFontsChanged() {
353859
+ const signature = this.#fontOptionsSignature();
353860
+ if (signature !== this._lastFontOptionsSignature) {
353861
+ this._lastFontOptionsSignature = signature;
353862
+ this.#rebuildToolbarItems();
353863
+ }
353864
+ this.updateToolbarState();
353865
+ }
353705
353866
  onEditorFocus() {
353706
353867
  if (this.pendingMarkCommands.length) {
353707
353868
  this.onEditorSelectionUpdate();
@@ -353768,6 +353929,7 @@ function print() { __p += __j.call(arguments, '') }
353768
353929
  clearTimeout(this._restoreFocusTimeoutId);
353769
353930
  this._restoreFocusTimeoutId = null;
353770
353931
  }
353932
+ this.#detachActiveEditorListeners();
353771
353933
  this.destroyHeadlessToolbar();
353772
353934
  this.app?.unmount();
353773
353935
  }
@@ -360388,6 +360550,9 @@ function print() { __p += __j.call(arguments, '') }
360388
360550
  getFontReport() {
360389
360551
  return this.#fontGate?.getReport() ?? [];
360390
360552
  }
360553
+ getDocumentFontOptions() {
360554
+ return this.#fontGate?.getDocumentFontOptions() ?? [];
360555
+ }
360391
360556
  getMissingFonts() {
360392
360557
  return [...new Set(this.getFontReport().filter((record) => record.missing).map((record) => record.logicalFamily))];
360393
360558
  }
@@ -365672,11 +365837,11 @@ function print() { __p += __j.call(arguments, '') }
365672
365837
  ]);
365673
365838
  });
365674
365839
 
365675
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-CanMzNxA.es.js
365840
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-ClaBD_rO.es.js
365676
365841
  var 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;
365677
- var init_create_super_doc_ui_CanMzNxA_es = __esm(() => {
365678
- init_SuperConverter_CfRQprW6_es();
365679
- init_create_headless_toolbar_DOEFHsWP_es();
365842
+ var init_create_super_doc_ui_ClaBD_rO_es = __esm(() => {
365843
+ init_SuperConverter_BaKhr4cp_es();
365844
+ init_create_headless_toolbar_B3wNa0zb_es();
365680
365845
  headlessToolbarConstants = {
365681
365846
  DEFAULT_TEXT_ALIGN_OPTIONS: [
365682
365847
  {
@@ -365958,16 +366123,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
365958
366123
 
365959
366124
  // ../../packages/superdoc/dist/super-editor.es.js
365960
366125
  var init_super_editor_es = __esm(() => {
365961
- init_src_CDxARMZD_es();
365962
- init_SuperConverter_CfRQprW6_es();
366126
+ init_src_BU1mfNkI_es();
366127
+ init_SuperConverter_BaKhr4cp_es();
365963
366128
  init_jszip_C49i9kUs_es();
365964
366129
  init_xml_js_CqGKpaft_es();
365965
- init_create_headless_toolbar_DOEFHsWP_es();
366130
+ init_create_headless_toolbar_B3wNa0zb_es();
365966
366131
  init_constants_D9qj59G2_es();
365967
366132
  init_dist_B8HfvhaK_es();
365968
366133
  init_unified_Dsuw2be5_es();
365969
366134
  init_DocxZipper_FUsfThjV_es();
365970
- init_create_super_doc_ui_CanMzNxA_es();
366135
+ init_create_super_doc_ui_ClaBD_rO_es();
365971
366136
  init_ui_C5PAS9hY_es();
365972
366137
  init_eventemitter3_BnGqBE_Q_es();
365973
366138
  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.3",
3
+ "version": "0.17.0-next.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -25,19 +25,19 @@
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
27
  "@superdoc/document-api": "0.0.1",
28
- "superdoc": "1.39.0",
29
- "@superdoc/super-editor": "0.0.1"
28
+ "@superdoc/super-editor": "0.0.1",
29
+ "superdoc": "1.39.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-x64": "0.17.0-next.3",
37
- "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.3",
38
- "@superdoc-dev/cli-linux-x64": "0.17.0-next.3",
39
- "@superdoc-dev/cli-linux-arm64": "0.17.0-next.3",
40
- "@superdoc-dev/cli-windows-x64": "0.17.0-next.3"
36
+ "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.4",
37
+ "@superdoc-dev/cli-darwin-x64": "0.17.0-next.4",
38
+ "@superdoc-dev/cli-linux-x64": "0.17.0-next.4",
39
+ "@superdoc-dev/cli-linux-arm64": "0.17.0-next.4",
40
+ "@superdoc-dev/cli-windows-x64": "0.17.0-next.4"
41
41
  },
42
42
  "scripts": {
43
43
  "predev": "node scripts/ensure-superdoc-build.js",