@pie-element/math-templated 7.1.1-next.18 → 7.1.1-next.20

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.
@@ -1,5 +1,5 @@
1
1
  import { C as e, a as t, c as n, d as r, g as i, h as a, i as o, l as s, m as c, n as l, o as u, r as d, s as f, t as p, u as m, v as h, x as g } from "../browser-_ggI30Zt.js";
2
- import { $ as _, A as v, At as y, B as b, C as x, Ct as S, D as C, Dt as w, E as ee, Et as T, F as te, H as E, I as ne, J as re, L as ie, M as D, Mt as ae, N as oe, Nt as se, O as ce, Ot as le, P as O, Q as ue, R as de, S as fe, St as k, T as pe, Tt as me, U as he, V as ge, W as _e, X as ve, Y as A, Z as ye, _t as j, a as be, at as M, b as xe, bt as Se, ct as Ce, d as we, dt as Te, et as Ee, f as De, ft as Oe, g as ke, gt as Ae, h as je, ht as Me, i as Ne, j as Pe, jt as Fe, k as N, kt as Ie, lt as Le, m as Re, mt as ze, n as Be, nt as Ve, ot as He, p as Ue, pt as We, q as Ge, r as Ke, rt as qe, st as P, t as Je, tt as Ye, u as Xe, ut as F, v as Ze, vt as Qe, w as $e, wt as et, x as tt, xt as I, yt as nt, z as rt } from "../horizontal-keypad-xHeOxFVV.js";
2
+ import { $ as _, A as v, At as y, B as b, C as x, Ct as S, D as C, Dt as w, E as ee, Et as T, F as te, H as E, I as ne, J as re, L as ie, M as D, Mt as ae, N as oe, Nt as se, O as ce, Ot as le, P as O, Q as ue, R as de, S as fe, St as k, T as pe, Tt as me, U as he, V as ge, W as _e, X as ve, Y as A, Z as ye, _t as j, a as be, at as M, b as xe, bt as Se, ct as Ce, d as we, dt as Te, et as Ee, f as De, ft as Oe, g as ke, gt as Ae, h as je, ht as Me, i as Ne, j as Pe, jt as Fe, k as N, kt as Ie, lt as Le, m as Re, mt as ze, n as Be, nt as Ve, ot as He, p as Ue, pt as We, q as Ge, r as Ke, rt as qe, st as P, t as Je, tt as Ye, u as Xe, ut as F, v as Ze, vt as Qe, w as $e, wt as et, x as tt, xt as I, yt as nt, z as rt } from "../horizontal-keypad-CZf7f3Vs.js";
3
3
  import * as L from "react";
4
4
  import it, { Component as at, createContext as ot, createElement as st, createRef as ct, forwardRef as lt, memo as ut, useCallback as dt, useContext as ft, useDebugValue as pt, useEffect as R, useLayoutEffect as mt, useMemo as ht, useRef as gt, useState as _t, version as vt } from "react";
5
5
  import { createRoot as yt } from "react-dom/client";
@@ -34060,34 +34060,55 @@ var NB = Kh.create({
34060
34060
  },
34061
34061
  addNodeView() {
34062
34062
  if (!this.options.resize || !this.options.resize.enabled || typeof document > "u") return null;
34063
- let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize;
34064
- return ({ node: i, getPos: a, HTMLAttributes: o, editor: s }) => {
34065
- let c = document.createElement("img");
34066
- Object.entries(o).forEach(([e, t]) => {
34063
+ let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize, i = /* @__PURE__ */ new Set([
34064
+ "src",
34065
+ "width",
34066
+ "height"
34067
+ ]);
34068
+ return ({ node: a, getPos: o, HTMLAttributes: s, editor: c }) => {
34069
+ let l = document.createElement("img");
34070
+ l.draggable = !1;
34071
+ let u = Pm(this.options.HTMLAttributes, s);
34072
+ Object.entries(u).forEach(([e, t]) => {
34067
34073
  if (t != null) switch (e) {
34074
+ case "src":
34068
34075
  case "width":
34069
34076
  case "height": break;
34070
- default:
34071
- c.setAttribute(e, t);
34072
- break;
34077
+ default: l.setAttribute(e, t);
34073
34078
  }
34074
- }), c.src = o.src;
34075
- let l = new yg({
34076
- element: c,
34077
- editor: s,
34078
- node: i,
34079
- getPos: a,
34079
+ }), u.src !== null && (l.src = u.src);
34080
+ let d = { ...s }, f = (e) => {
34081
+ if (typeof e == "string" && e !== "") {
34082
+ l.getAttribute("src") !== e && (l.src = e);
34083
+ return;
34084
+ }
34085
+ l.hasAttribute("src") && l.removeAttribute("src"), l.src !== "" && (l.src = "");
34086
+ };
34087
+ f(s.src);
34088
+ let p = new yg({
34089
+ element: l,
34090
+ editor: c,
34091
+ node: a,
34092
+ getPos: o,
34080
34093
  onResize: (e, t) => {
34081
- c.style.width = `${e}px`, c.style.height = `${t}px`;
34094
+ l.style.width = `${e}px`, l.style.height = `${t}px`;
34082
34095
  },
34083
34096
  onCommit: (e, t) => {
34084
- let n = a();
34097
+ let n = o();
34085
34098
  n !== void 0 && this.editor.chain().setNodeSelection(n).updateAttributes(this.name, {
34086
34099
  width: e,
34087
34100
  height: t
34088
34101
  }).run();
34089
34102
  },
34090
- onUpdate: (e, t, n) => e.type === i.type,
34103
+ onUpdate: (e) => {
34104
+ if (e.type !== a.type) return !1;
34105
+ let t = Fm(e, c.extensionManager.attributes.filter((t) => t.type === e.type.name));
34106
+ return Object.keys(d).forEach((e) => {
34107
+ !i.has(e) && !(e in t) && l.removeAttribute(e);
34108
+ }), Object.entries(t).forEach(([e, t]) => {
34109
+ i.has(e) || (t == null ? l.removeAttribute(e) : l.setAttribute(e, t));
34110
+ }), f(t.src), d = t, !0;
34111
+ },
34091
34112
  options: {
34092
34113
  directions: e,
34093
34114
  min: {
@@ -34096,10 +34117,10 @@ var NB = Kh.create({
34096
34117
  },
34097
34118
  preserveAspectRatio: r === !0
34098
34119
  }
34099
- }), u = l.dom;
34100
- return u.style.visibility = "hidden", u.style.pointerEvents = "none", c.onload = () => {
34101
- u.style.visibility = "", u.style.pointerEvents = "";
34102
- }, l;
34120
+ }), m = p.dom, h = () => {
34121
+ m.style.visibility = "", m.style.pointerEvents = "";
34122
+ };
34123
+ return m.style.visibility = "hidden", m.style.pointerEvents = "none", l.complete && l.naturalWidth > 0 ? h() : (l.onload = h, l.onerror = h), p;
34103
34124
  };
34104
34125
  },
34105
34126
  addCommands() {