@superdoc-dev/cli 0.16.0-next.10 → 0.16.0-next.11

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 +108 -11
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -228965,7 +228965,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
228965
228965
  init_remark_gfm_BhnWr3yf_es();
228966
228966
  });
228967
228967
 
228968
- // ../../packages/superdoc/dist/chunks/src-DKMFU0g3.es.js
228968
+ // ../../packages/superdoc/dist/chunks/src-DWFNPbG8.es.js
228969
228969
  function deleteProps(obj, propOrProps) {
228970
228970
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
228971
228971
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -321734,7 +321734,80 @@ menclose::after {
321734
321734
  }
321735
321735
  }
321736
321736
  }
321737
- }, ENDNOTE_MARKER_DATA_ATTR = "data-sd-endnote-number", DEFAULT_MARKER_FONT_FAMILY = "Arial", DEFAULT_MARKER_FONT_SIZE = 12, FontReadinessGate = class {
321737
+ }, ENDNOTE_MARKER_DATA_ATTR = "data-sd-endnote-number", DEFAULT_MARKER_FONT_FAMILY = "Arial", DEFAULT_MARKER_FONT_SIZE = 12, FontLateLoadReflowScheduler = class {
321738
+ #quietMs;
321739
+ #cooldownMs;
321740
+ #flush;
321741
+ #scheduleTimeout;
321742
+ #cancelTimeout;
321743
+ #pending = /* @__PURE__ */ new Set;
321744
+ #quietHandle = null;
321745
+ #cooldownHandle = null;
321746
+ #trailing = false;
321747
+ constructor(options) {
321748
+ this.#quietMs = options.quietMs ?? 250;
321749
+ this.#cooldownMs = options.cooldownMs ?? 2000;
321750
+ this.#flush = options.flush;
321751
+ this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
321752
+ this.#cancelTimeout = options.cancelTimeout ?? ((handle3) => globalThis.clearTimeout(handle3));
321753
+ }
321754
+ schedule(changedFaceKeys) {
321755
+ let added = false;
321756
+ for (const key2 of changedFaceKeys)
321757
+ if (!this.#pending.has(key2)) {
321758
+ this.#pending.add(key2);
321759
+ added = true;
321760
+ }
321761
+ if (!added)
321762
+ return;
321763
+ if (this.#cooldownHandle !== null) {
321764
+ this.#trailing = true;
321765
+ return;
321766
+ }
321767
+ if (this.#quietHandle !== null)
321768
+ return;
321769
+ this.#quietHandle = this.#scheduleTimeout(() => this.#onQuietElapsed(), this.#quietMs);
321770
+ }
321771
+ cancel() {
321772
+ this.#clearTimers();
321773
+ this.#pending.clear();
321774
+ this.#trailing = false;
321775
+ }
321776
+ #onQuietElapsed() {
321777
+ this.#quietHandle = null;
321778
+ this.#doFlush("quiet");
321779
+ }
321780
+ #onCooldownElapsed() {
321781
+ this.#cooldownHandle = null;
321782
+ if (this.#trailing && this.#pending.size > 0)
321783
+ this.#doFlush("throttle");
321784
+ }
321785
+ #doFlush(reason) {
321786
+ this.#trailing = false;
321787
+ try {
321788
+ if (this.#pending.size > 0) {
321789
+ const faceKeys = [...this.#pending];
321790
+ this.#pending.clear();
321791
+ this.#flush({
321792
+ reason,
321793
+ faceKeys
321794
+ });
321795
+ }
321796
+ } catch {} finally {
321797
+ this.#cooldownHandle = this.#scheduleTimeout(() => this.#onCooldownElapsed(), this.#cooldownMs);
321798
+ }
321799
+ }
321800
+ #clearTimers() {
321801
+ if (this.#quietHandle !== null) {
321802
+ this.#cancelTimeout(this.#quietHandle);
321803
+ this.#quietHandle = null;
321804
+ }
321805
+ if (this.#cooldownHandle !== null) {
321806
+ this.#cancelTimeout(this.#cooldownHandle);
321807
+ this.#cooldownHandle = null;
321808
+ }
321809
+ }
321810
+ }, FontReadinessGate = class {
321738
321811
  #getDocumentFonts;
321739
321812
  #getRequiredFaces;
321740
321813
  #resolveFamilies;
@@ -321753,6 +321826,7 @@ menclose::after {
321753
321826
  #seenAvailableFaces = /* @__PURE__ */ new Set;
321754
321827
  #lastSummary = null;
321755
321828
  #loadingDoneHandler = null;
321829
+ #lateLoadScheduler;
321756
321830
  constructor(options) {
321757
321831
  this.#getDocumentFonts = options.getDocumentFonts;
321758
321832
  this.#getRequiredFaces = options.getRequiredFaces ?? null;
@@ -321763,6 +321837,13 @@ menclose::after {
321763
321837
  this.#onRegistryResolved = options.onRegistryResolved ?? null;
321764
321838
  this.#timeoutMs = options.timeoutMs ?? 3000;
321765
321839
  this.#invalidateCaches = options.invalidateCaches ?? defaultInvalidate;
321840
+ this.#lateLoadScheduler = new FontLateLoadReflowScheduler({
321841
+ quietMs: options.reflowQuietMs,
321842
+ cooldownMs: options.reflowCooldownMs,
321843
+ flush: () => this.#flushLateFontLoads(),
321844
+ scheduleTimeout: options.scheduleTimeout,
321845
+ cancelTimeout: options.cancelTimeout
321846
+ });
321766
321847
  }
321767
321848
  get fontConfigVersion() {
321768
321849
  return this.#fontConfigVersion;
@@ -321845,17 +321926,29 @@ menclose::after {
321845
321926
  notifyFontConfigChanged() {
321846
321927
  this.#fontConfigVersion += 1;
321847
321928
  bumpFontConfigVersion();
321848
- this.#seenAvailable.clear();
321849
- this.#seenAvailableFaces.clear();
321850
- this.#requiredSignature = "";
321929
+ this.#resetRequiredAndSeen();
321930
+ this.#lateLoadScheduler.cancel();
321851
321931
  this.#invalidateCaches();
321852
321932
  this.#requestReflow();
321853
321933
  }
321934
+ resetForDocumentChange() {
321935
+ this.#lateLoadScheduler.cancel();
321936
+ this.#resetRequiredAndSeen();
321937
+ }
321938
+ #resetRequiredAndSeen() {
321939
+ this.#requiredSignature = "";
321940
+ this.#requiredFaceKeys = /* @__PURE__ */ new Set;
321941
+ this.#requiredFamilies = /* @__PURE__ */ new Set;
321942
+ this.#seenAvailable.clear();
321943
+ this.#seenAvailableFaces.clear();
321944
+ this.#lastSummary = null;
321945
+ }
321854
321946
  dispose() {
321855
321947
  const fontSet = this.#context?.fontSet ?? null;
321856
321948
  if (fontSet && this.#loadingDoneHandler && typeof fontSet.removeEventListener === "function")
321857
321949
  fontSet.removeEventListener("loadingdone", this.#loadingDoneHandler);
321858
321950
  this.#loadingDoneHandler = null;
321951
+ this.#lateLoadScheduler.cancel();
321859
321952
  }
321860
321953
  #resolveContext() {
321861
321954
  if (this.#context && this.#context.fontSet)
@@ -321887,7 +321980,7 @@ menclose::after {
321887
321980
  const faces = event?.fontfaces ?? [];
321888
321981
  if (faces.length === 0)
321889
321982
  return;
321890
- let changed = false;
321983
+ const changedKeys = [];
321891
321984
  if (this.#requiredFaceKeys.size > 0) {
321892
321985
  const loadedFaceKeys = new Set(faces.map((face) => faceKeyOf(face.family, normalizeWeightToken(face.weight), normalizeStyleToken(face.style))));
321893
321986
  for (const key2 of this.#requiredFaceKeys) {
@@ -321895,7 +321988,7 @@ menclose::after {
321895
321988
  continue;
321896
321989
  if (loadedFaceKeys.has(key2)) {
321897
321990
  this.#seenAvailableFaces.add(key2);
321898
- changed = true;
321991
+ changedKeys.push(key2);
321899
321992
  }
321900
321993
  }
321901
321994
  } else {
@@ -321905,15 +321998,18 @@ menclose::after {
321905
321998
  continue;
321906
321999
  if (loadedFamilies.has(normalizeFamilyKey(family$1))) {
321907
322000
  this.#seenAvailable.add(family$1);
321908
- changed = true;
322001
+ changedKeys.push(normalizeFamilyKey(family$1));
321909
322002
  }
321910
322003
  }
321911
322004
  }
321912
- if (!changed)
322005
+ if (changedKeys.length === 0)
321913
322006
  return;
321914
322007
  this.#fontConfigVersion += 1;
321915
322008
  bumpFontConfigVersion();
321916
322009
  this.#invalidateCaches();
322010
+ this.#lateLoadScheduler.schedule(changedKeys);
322011
+ }
322012
+ #flushLateFontLoads() {
321917
322013
  this.#requestReflow();
321918
322014
  }
321919
322015
  }, FACE_STATUS_PRIORITY, DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE, NATIVE_SELECTION_STYLES = `
@@ -321993,7 +322089,7 @@ menclose::after {
321993
322089
  return;
321994
322090
  console.log(...args$1);
321995
322091
  }, 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;
321996
- var init_src_DKMFU0g3_es = __esm(() => {
322092
+ var init_src_DWFNPbG8_es = __esm(() => {
321997
322093
  init_rolldown_runtime_Bg48TavK_es();
321998
322094
  init_SuperConverter_D9c2ow57_es();
321999
322095
  init_jszip_C49i9kUs_es();
@@ -352418,6 +352514,7 @@ function print() { __p += __j.call(arguments, '') }
352418
352514
  handler: handleCollaborationReady
352419
352515
  });
352420
352516
  const handleDocumentReplaced = () => {
352517
+ this.#fontGate?.resetForDocumentChange();
352421
352518
  this.#refreshHeaderFooterStructureThenRerender({ purgeCachedEditors: true });
352422
352519
  };
352423
352520
  this.#editor.on("documentReplaced", handleDocumentReplaced);
@@ -356386,7 +356483,7 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
356386
356483
 
356387
356484
  // ../../packages/superdoc/dist/super-editor.es.js
356388
356485
  var init_super_editor_es = __esm(() => {
356389
- init_src_DKMFU0g3_es();
356486
+ init_src_DWFNPbG8_es();
356390
356487
  init_SuperConverter_D9c2ow57_es();
356391
356488
  init_jszip_C49i9kUs_es();
356392
356489
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.16.0-next.10",
3
+ "version": "0.16.0-next.11",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -33,11 +33,11 @@
33
33
  "access": "public"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@superdoc-dev/cli-darwin-arm64": "0.16.0-next.10",
37
- "@superdoc-dev/cli-darwin-x64": "0.16.0-next.10",
38
- "@superdoc-dev/cli-linux-x64": "0.16.0-next.10",
39
- "@superdoc-dev/cli-windows-x64": "0.16.0-next.10",
40
- "@superdoc-dev/cli-linux-arm64": "0.16.0-next.10"
36
+ "@superdoc-dev/cli-darwin-x64": "0.16.0-next.11",
37
+ "@superdoc-dev/cli-darwin-arm64": "0.16.0-next.11",
38
+ "@superdoc-dev/cli-linux-arm64": "0.16.0-next.11",
39
+ "@superdoc-dev/cli-linux-x64": "0.16.0-next.11",
40
+ "@superdoc-dev/cli-windows-x64": "0.16.0-next.11"
41
41
  },
42
42
  "scripts": {
43
43
  "predev": "node scripts/ensure-superdoc-build.js",