@pie-element/placement-ordering 14.1.2-next.8 → 14.1.2-next.9

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, E as t, O as n, S as r, T as i, _ as a, c as o, d as s, f as c, i as l, k as u, l as d, o as f, p, r as m, t as h, w as g, x as _, y as v } from "../browser-Bd36Xf5z.js";
2
- import { $ as y, A as b, At as x, B as S, C, Ct as w, D as ee, Dt as T, E as te, Et as E, F as ne, Ft as re, G as ie, H as D, I as ae, It as oe, J as se, K as ce, L as le, Lt as ue, M as O, Mt as de, N as k, Nt as fe, O as pe, Ot as me, P as he, Pt as ge, Q as _e, R as ve, Rt as ye, S as be, St as xe, Tt as A, U as Se, V as j, W as Ce, X as we, Y as Te, Z as Ee, _ as De, _t as Oe, a as ke, b as Ae, bt as je, d as Me, dt as Ne, et as Pe, f as Fe, ft as Ie, g as Le, gt as Re, h as ze, ht as Be, i as Ve, it as He, j as Ue, jt as We, k as Ge, kt as Ke, m as qe, mt as M, n as Je, nt as Ye, o as Xe, p as Ze, pt as Qe, q as $e, r as et, rt as tt, st as N, t as nt, tt as rt, vt as it, w as at, wt as ot, x as st, xt as ct, y as lt, yt as ut, z as dt, zt as ft } from "../drag-provider-BdfhGCEU.js";
2
+ import { $ as y, A as b, At as x, B as S, C, Ct as w, D as ee, Dt as T, E as te, Et as E, F as ne, Ft as re, G as ie, H as D, I as ae, It as oe, J as se, K as ce, L as le, Lt as ue, M as O, Mt as de, N as k, Nt as fe, O as pe, Ot as me, P as he, Pt as ge, Q as _e, R as ve, Rt as ye, S as be, St as xe, Tt as A, U as Se, V as j, W as Ce, X as we, Y as Te, Z as Ee, _ as De, _t as Oe, a as ke, b as Ae, bt as je, d as Me, dt as Ne, et as Pe, f as Fe, ft as Ie, g as Le, gt as Re, h as ze, ht as Be, i as Ve, it as He, j as Ue, jt as We, k as Ge, kt as Ke, m as qe, mt as M, n as Je, nt as Ye, o as Xe, p as Ze, pt as Qe, q as $e, r as et, rt as tt, st as N, t as nt, tt as rt, vt as it, w as at, wt as ot, x as st, xt as ct, y as lt, yt as ut, z as dt, zt as ft } from "../drag-provider-B5wazJHM.js";
3
3
  import * as P from "react";
4
4
  import pt, { Component as mt, createContext as ht, createElement as gt, createRef as _t, forwardRef as vt, memo as yt, useCallback as bt, useContext as xt, useDebugValue as St, useEffect as Ct, useLayoutEffect as wt, useMemo as Tt, useRef as Et, useState as Dt, version as Ot } from "react";
5
5
  import { createRoot as kt } from "react-dom/client";
@@ -41018,34 +41018,55 @@ var MJ = pS.create({
41018
41018
  },
41019
41019
  addNodeView() {
41020
41020
  if (!this.options.resize || !this.options.resize.enabled || typeof document > "u") return null;
41021
- let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize;
41022
- return ({ node: i, getPos: a, HTMLAttributes: o, editor: s }) => {
41023
- let c = document.createElement("img");
41024
- Object.entries(o).forEach(([e, t]) => {
41021
+ let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize, i = /* @__PURE__ */ new Set([
41022
+ "src",
41023
+ "width",
41024
+ "height"
41025
+ ]);
41026
+ return ({ node: a, getPos: o, HTMLAttributes: s, editor: c }) => {
41027
+ let l = document.createElement("img");
41028
+ l.draggable = !1;
41029
+ let u = tx(this.options.HTMLAttributes, s);
41030
+ Object.entries(u).forEach(([e, t]) => {
41025
41031
  if (t != null) switch (e) {
41032
+ case "src":
41026
41033
  case "width":
41027
41034
  case "height": break;
41028
- default:
41029
- c.setAttribute(e, t);
41030
- break;
41035
+ default: l.setAttribute(e, t);
41031
41036
  }
41032
- }), c.src = o.src;
41033
- let l = new BS({
41034
- element: c,
41035
- editor: s,
41036
- node: i,
41037
- getPos: a,
41037
+ }), u.src !== null && (l.src = u.src);
41038
+ let d = { ...s }, f = (e) => {
41039
+ if (typeof e == "string" && e !== "") {
41040
+ l.getAttribute("src") !== e && (l.src = e);
41041
+ return;
41042
+ }
41043
+ l.hasAttribute("src") && l.removeAttribute("src"), l.src !== "" && (l.src = "");
41044
+ };
41045
+ f(s.src);
41046
+ let p = new BS({
41047
+ element: l,
41048
+ editor: c,
41049
+ node: a,
41050
+ getPos: o,
41038
41051
  onResize: (e, t) => {
41039
- c.style.width = `${e}px`, c.style.height = `${t}px`;
41052
+ l.style.width = `${e}px`, l.style.height = `${t}px`;
41040
41053
  },
41041
41054
  onCommit: (e, t) => {
41042
- let n = a();
41055
+ let n = o();
41043
41056
  n !== void 0 && this.editor.chain().setNodeSelection(n).updateAttributes(this.name, {
41044
41057
  width: e,
41045
41058
  height: t
41046
41059
  }).run();
41047
41060
  },
41048
- onUpdate: (e, t, n) => e.type === i.type,
41061
+ onUpdate: (e) => {
41062
+ if (e.type !== a.type) return !1;
41063
+ let t = nx(e, c.extensionManager.attributes.filter((t) => t.type === e.type.name));
41064
+ return Object.keys(d).forEach((e) => {
41065
+ !i.has(e) && !(e in t) && l.removeAttribute(e);
41066
+ }), Object.entries(t).forEach(([e, t]) => {
41067
+ i.has(e) || (t == null ? l.removeAttribute(e) : l.setAttribute(e, t));
41068
+ }), f(t.src), d = t, !0;
41069
+ },
41049
41070
  options: {
41050
41071
  directions: e,
41051
41072
  min: {
@@ -41054,10 +41075,10 @@ var MJ = pS.create({
41054
41075
  },
41055
41076
  preserveAspectRatio: r === !0
41056
41077
  }
41057
- }), u = l.dom;
41058
- return u.style.visibility = "hidden", u.style.pointerEvents = "none", c.onload = () => {
41059
- u.style.visibility = "", u.style.pointerEvents = "";
41060
- }, l;
41078
+ }), m = p.dom, h = () => {
41079
+ m.style.visibility = "", m.style.pointerEvents = "";
41080
+ };
41081
+ return m.style.visibility = "hidden", m.style.pointerEvents = "none", l.complete && l.naturalWidth > 0 ? h() : (l.onload = h, l.onerror = h), p;
41061
41082
  };
41062
41083
  },
41063
41084
  addCommands() {