@gridsheet/preact-core 3.4.0 → 3.4.2

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.
@@ -1959,9 +1959,10 @@ let Y$1 = class Y {
1959
1959
  }
1960
1960
  /** @internal */
1961
1961
  processFormula(t, { idMap: e, ...s }) {
1962
+ var i, n;
1962
1963
  if ((typeof t == "string" || t instanceof String) && t.charAt(0) === "=") {
1963
- const i = new te$1(t.substring(1));
1964
- return i.tokenize(e), i.identify({ ...s, sheet: this }), i.dependencyIds.forEach((n) => this.addDependency(n, s.dependency)), s.dependency != null && (this._formulaHasAsync(i) ? this.registry.asyncFormulaCells.add(s.dependency) : this.registry.asyncFormulaCells.delete(s.dependency)), "=" + i.identifiedFormula;
1964
+ const o = new te$1(t.substring(1));
1965
+ return o.tokenize(e), o.identify({ ...s, sheet: this }), o.dependencyIds.forEach((a) => this.addDependency(a, s.dependency)), s.dependency != null && (this._formulaHasAsync(o) ? this.registry.asyncFormulaCells.add(s.dependency) : this.registry.asyncFormulaCells.delete(s.dependency), (n = (i = this.registry).onFormula) == null || n.call(i)), "=" + o.identifiedFormula;
1965
1966
  }
1966
1967
  return s.dependency != null && this.registry.asyncFormulaCells.delete(s.dependency), t;
1967
1968
  }
@@ -3281,7 +3282,7 @@ let Y$1 = class Y {
3281
3282
  if (!Dt.is(this._stripped))
3282
3283
  return this._stripped;
3283
3284
  let s = this;
3284
- for (; s instanceof Y; )
3285
+ for (; Y.is(s); )
3285
3286
  s = (i = Ve({ sheet: s, raise: t, at: e })[0]) == null ? void 0 : i[0];
3286
3287
  return this._stripped = s, this._stripped;
3287
3288
  }
@@ -3670,7 +3671,7 @@ const we = ({ value: r, sheet: t, point: e, raise: s = true, resolution: i = "RE
3670
3671
  throw t.finishSolvedCache(e, u), u;
3671
3672
  return u;
3672
3673
  }
3673
- return W$1.is(l) ? l = t.spill(e, l.matrix) : t.finishSolvedCache(e, l), i === "RESOLVED" && l instanceof Y$1 && (l = ut({ value: l, raise: s, at: n })), L.is(l) && t.finishSolvedCache(e, l), l;
3674
+ return W$1.is(l) ? l = t.spill(e, l.matrix) : t.finishSolvedCache(e, l), i === "RESOLVED" && Y$1.is(l) && (l = ut({ value: l, raise: s, at: n })), L.is(l) && t.finishSolvedCache(e, l), l;
3674
3675
  }, Ve = ({ sheet: r, raise: t = true, at: e }) => {
3675
3676
  const s = r.area;
3676
3677
  return r._toValueMatrix({ area: s, at: e, resolution: "SYSTEM" }).map((n, o) => {
@@ -3696,7 +3697,7 @@ const we = ({ value: r, sheet: t, point: e, raise: s = true, resolution: i = "RE
3696
3697
  }
3697
3698
  });
3698
3699
  });
3699
- }, ut = ({ value: r, at: t, raise: e = true }) => r instanceof Y$1 ? r.strip({ raise: e, at: t }) : r, xe = new _t("asyncCacheMiss"), Ci = (r) => r.some((t) => L.is(t)), ps = (r) => (r == null ? void 0 : r.__gsType) === "Sheet", Pt = (r, t) => {
3700
+ }, ut = ({ value: r, at: t, raise: e = true }) => Y$1.is(r) ? r.strip({ raise: e, at: t }) : r, xe = new _t("asyncCacheMiss"), Ci = (r) => r.some((t) => L.is(t)), ps = (r) => (r == null ? void 0 : r.__gsType) === "Sheet", Pt = (r, t) => {
3700
3701
  for (const e of r)
3701
3702
  if (L.is(e) || Array.isArray(e) && Pt(e, t) || W$1.is(e) && Pt(e.matrix, t) || ps(e) && Pt(e._toValueMatrix({ at: t }), t))
3702
3703
  return true;
@@ -3775,7 +3776,7 @@ const we = ({ value: r, sheet: t, point: e, raise: s = true, resolution: i = "RE
3775
3776
  return e;
3776
3777
  if (!r)
3777
3778
  return 0;
3778
- if (r instanceof Y$1) {
3779
+ if (Y$1.is(r)) {
3779
3780
  const n = ut({ value: r });
3780
3781
  return O(n, { alternative: e });
3781
3782
  }
@@ -3799,7 +3800,7 @@ const we = ({ value: r, sheet: t, point: e, raise: s = true, resolution: i = "RE
3799
3800
  return "0";
3800
3801
  if (!r)
3801
3802
  return "";
3802
- if (r instanceof Y$1) {
3803
+ if (Y$1.is(r)) {
3803
3804
  const t = ut({ value: r });
3804
3805
  return Q$1(t);
3805
3806
  }
@@ -3817,7 +3818,7 @@ const we = ({ value: r, sheet: t, point: e, raise: s = true, resolution: i = "RE
3817
3818
  return e;
3818
3819
  if (r === null)
3819
3820
  return false;
3820
- if (r instanceof Y$1) {
3821
+ if (Y$1.is(r)) {
3821
3822
  const i = ut({ value: r });
3822
3823
  return Wt(i, t);
3823
3824
  }
@@ -3835,7 +3836,7 @@ const we = ({ value: r, sheet: t, point: e, raise: s = true, resolution: i = "RE
3835
3836
  function Ni(r) {
3836
3837
  if (L.is(r) || r instanceof Date)
3837
3838
  return r;
3838
- if (r instanceof Y$1) {
3839
+ if (Y$1.is(r)) {
3839
3840
  const t = ut({ value: r });
3840
3841
  return Ni(t);
3841
3842
  }
@@ -3871,7 +3872,7 @@ const vi = /^(<=|>=|<>|>|<|=)?(.*)$/, ki = (r, t) => {
3871
3872
  }
3872
3873
  return Oe(r, n) === o;
3873
3874
  }, dt = (r, t, e) => {
3874
- if (r instanceof Y$1) {
3875
+ if (Y$1.is(r)) {
3875
3876
  const s = r.solve({ at: e });
3876
3877
  for (let i = 0; i < s.length; i++)
3877
3878
  for (let n = 0; n < s[i].length; n++)
@@ -4702,7 +4703,7 @@ class Pr extends A {
4702
4703
  ], this.category = "logical", this.broadcastDisabled = true;
4703
4704
  }
4704
4705
  main(t) {
4705
- return W$1.is(t) ? t : t instanceof Y$1 ? t._toValueMatrix() : Array.isArray(t) ? t : [[t]];
4706
+ return W$1.is(t) ? t : Y$1.is(t) ? t._toValueMatrix() : Array.isArray(t) ? t : [[t]];
4706
4707
  }
4707
4708
  }
4708
4709
  const gs = {
@@ -4767,18 +4768,19 @@ class Hr {
4767
4768
  onInsertCols: h,
4768
4769
  onSelect: u,
4769
4770
  onKeyUp: c,
4770
- onInit: f
4771
+ onInit: f,
4772
+ onFormula: d
4771
4773
  } = {}) {
4772
- this.sheetHead = 0, this.cellHead = 0, this.data = {}, this.systems = {}, this.sheetIdsByName = {}, this.contextsBySheetId = {}, this.choosingSheetId = 0, this.choosingAddress = "", this.editingSheetId = 0, this.editingAddress = "", this.paletteBySheetName = {}, this.lastFocused = null, this.solvedCaches = /* @__PURE__ */ new Map(), this.lastSpilledTargetIds = /* @__PURE__ */ new Set(), this.asyncFormulaCells = /* @__PURE__ */ new Set(), this.asyncPending = /* @__PURE__ */ new Map(), this.copyingSheetId = 0, this.copyingZone = Ms, this.cutting = false, this.histories = [], this.historyIndex = -1, this.historyLimit = Cs, this._componentSheetIds = /* @__PURE__ */ new Map(), this.ready = false, this.functions = {}, this.policies = {}, this.transmit = (d) => {
4773
- }, this.updateSheet = (d) => ({ type: 0, value: d }), t != null && (this.historyLimit = t), this.functions = {
4774
+ this.sheetHead = 0, this.cellHead = 0, this.data = {}, this.systems = {}, this.sheetIdsByName = {}, this.contextsBySheetId = {}, this.choosingSheetId = 0, this.choosingAddress = "", this.editingSheetId = 0, this.editingAddress = "", this.paletteBySheetName = {}, this.lastFocused = null, this.solvedCaches = /* @__PURE__ */ new Map(), this.lastSpilledTargetIds = /* @__PURE__ */ new Set(), this.asyncFormulaCells = /* @__PURE__ */ new Set(), this.asyncPending = /* @__PURE__ */ new Map(), this.copyingSheetId = 0, this.copyingZone = Ms, this.cutting = false, this.histories = [], this.historyIndex = -1, this.historyLimit = Cs, this._componentSheetIds = /* @__PURE__ */ new Map(), this.ready = false, this.functions = {}, this.policies = {}, this.transmit = (p) => {
4775
+ }, this.updateSheet = (p) => ({ type: 0, value: p }), t != null && (this.historyLimit = t), this.functions = {
4774
4776
  ...gs,
4775
4777
  ...e
4776
4778
  };
4777
- for (const d in this.functions) {
4778
- const p = this.functions[d];
4779
- p.__name = d;
4779
+ for (const p in this.functions) {
4780
+ const m = this.functions[p];
4781
+ m.__name = p;
4780
4782
  }
4781
- this.policies = s, this.onSave = i, this.onChange = n, this.onRemoveRows = o, this.onRemoveCols = a, this.onInsertRows = l, this.onInsertCols = h, this.onSelect = u, this.onKeyUp = c, this.onInit = f;
4783
+ this.policies = s, this.onSave = i, this.onChange = n, this.onRemoveRows = o, this.onRemoveCols = a, this.onInsertRows = l, this.onInsertCols = h, this.onSelect = u, this.onKeyUp = c, this.onInit = f, this.onFormula = d;
4782
4784
  }
4783
4785
  boot() {
4784
4786
  if (this.ready || Object.keys(this.contextsBySheetId).length === 0)
@@ -7186,4 +7188,4 @@ export {
7186
7188
  arrow as y,
7187
7189
  escape as z
7188
7190
  };
7189
- //# sourceMappingURL=hooks-BTcuh87d.mjs.map
7191
+ //# sourceMappingURL=hooks-Ij1DTX5N.mjs.map