Comparing version 2.6.47 to 2.6.48
326
dist/axii.js
@@ -1,2 +0,2 @@ | ||
import { isAtom as z, atom as U, RxList as j, RxSet as te, RxMap as re, arrayComputed as ne, TrackOpTypes as $, TriggerOpTypes as I, destroyComputed as F, reactive as He, ReactiveEffect as Le, computed as ue, autorun as de, Notifier as se, isReactive as pe } from "data0"; | ||
import { isAtom as z, atom as U, RxList as j, RxSet as te, RxMap as re, arrayComputed as ne, TrackOpTypes as $, TriggerOpTypes as N, destroyComputed as F, reactive as He, ReactiveEffect as Le, computed as ue, autorun as de, Notifier as se, isReactive as pe } from "data0"; | ||
export * from "data0"; | ||
@@ -54,7 +54,7 @@ function Re(t, e) { | ||
} | ||
const Ie = /^(boxShadow|textShadow|transition|animation|backgroundImage)/; | ||
const Ne = /^(boxShadow|textShadow|transition|animation|backgroundImage)/; | ||
function Z(t, e) { | ||
return e === void 0 ? "" : Array.isArray(e) ? Ie.test(t) ? e.join(",") : e.map((r) => Z(t, r)).join(" ") : typeof e == "number" && ve.test(t) ? $e(e) : e.toString(); | ||
return e === void 0 ? "" : Array.isArray(e) ? Ne.test(t) ? e.join(",") : e.map((r) => Z(t, r)).join(" ") : typeof e == "number" && ve.test(t) ? $e(e) : e.toString(); | ||
} | ||
function Ne(t, e, r) { | ||
function Ie(t, e, r) { | ||
try { | ||
@@ -79,5 +79,5 @@ t[e] = r; | ||
const Me = /^(strokeWidth|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeDashoffset|strokeDasharray|strokeOpacity|fillOpacity|stopOpacity)/; | ||
function G(t, e, r, n) { | ||
function B(t, e, r, n) { | ||
if (Array.isArray(r) && e !== "style" && e !== "className" && !De(e)) | ||
return G(t, e, r.at(-1), n); | ||
return B(t, e, r.at(-1), n); | ||
if (e === "uuid") { | ||
@@ -93,4 +93,4 @@ t.setAttribute("data-uuid", r); | ||
r ? t.addEventListener(i, o, s) : t.removeEventListener(i, o, s); | ||
const c = s ? t._captureListeners || (t._captureListeners = {}) : t._listeners || (t._listeners = {}); | ||
A((c == null ? void 0 : c[i]) === void 0, `${e} already listened`), c[i] = r; | ||
const a = s ? t._captureListeners || (t._captureListeners = {}) : t._listeners || (t._listeners = {}); | ||
A((a == null ? void 0 : a[i]) === void 0, `${e} already listened`), a[i] = r; | ||
return; | ||
@@ -100,4 +100,4 @@ } | ||
(!r || Array.isArray(r) && !r.length) && (t.style.cssText = r || ""), (Array.isArray(r) ? r : [r]).forEach((i) => { | ||
typeof i == "string" ? t.style.cssText = i : typeof i == "object" ? Re(i, (o, c) => { | ||
t.style[c] = Z(c, o); | ||
typeof i == "string" ? t.style.cssText = i : typeof i == "object" ? Re(i, (o, a) => { | ||
t.style[a] = Z(a, o); | ||
}) : A(!1, "style can only be string or object."); | ||
@@ -111,4 +111,4 @@ }); | ||
s.forEach((o) => { | ||
typeof o == "object" ? Object.entries(o).forEach(([c, a]) => { | ||
a && (i = `${i} ${c}`); | ||
typeof o == "object" ? Object.entries(o).forEach(([a, c]) => { | ||
c && (i = `${i} ${a}`); | ||
}) : typeof o == "string" ? i = `${i} ${o}` : A(!1, "className can only be string or {[k:string]:boolean}"); | ||
@@ -130,3 +130,3 @@ }), t.setAttribute("class", i); | ||
else if (e !== "list" && e !== "type" && !n && e in t) | ||
Ne(t, e, r === null ? "" : r), r == null && t.removeAttribute(e); | ||
Ie(t, e, r === null ? "" : r), r == null && t.removeAttribute(e); | ||
else { | ||
@@ -154,3 +154,3 @@ const s = n && e !== (e = e.replace(/^xlink\:?/, "")); | ||
return { type: t, props: s, children: o }; | ||
const c = [], a = [], f = [], p = []; | ||
const a = [], c = [], f = [], p = []; | ||
o == null || o.forEach((l, h) => { | ||
@@ -163,5 +163,5 @@ if (l != null) | ||
const u = l, y = u.unhandledChildren || []; | ||
a.push(...y.map((g) => ({ ...g, path: [h, ...g.path] }))); | ||
c.push(...y.map((g) => ({ ...g, path: [h, ...g.path] }))); | ||
const m = u.unhandledAttr || []; | ||
c.push(...m.map((g) => ({ ...g, path: [h, ...g.path] }))); | ||
a.push(...m.map((g) => ({ ...g, path: [h, ...g.path] }))); | ||
const E = u.refHandles || []; | ||
@@ -173,9 +173,9 @@ f.push(...E.map((g) => ({ ...g, path: [h, ...g.path] }))); | ||
const u = document.createComment("unhandledChild"); | ||
i.appendChild(u), a.push({ placeholder: u, child: l, path: [h] }); | ||
i.appendChild(u), c.push({ placeholder: u, child: l, path: [h] }); | ||
} | ||
}), s && (s.ref && (f.push({ handle: s.ref, path: [], el: i }), delete s.ref), s.detachStyle && (p.push({ el: i, style: s.detachStyle, path: [] }), delete s.detachStyle), Object.entries(s).forEach(([l, h]) => { | ||
C.isValidAttribute(l, h) ? G(i, l, h, n) : c.push({ el: i, key: l, value: h, path: [] }); | ||
C.isValidAttribute(l, h) ? B(i, l, h, n) : a.push({ el: i, key: l, value: h, path: [] }); | ||
})); | ||
const d = i; | ||
return a.length && (d.unhandledChildren = a), c && (d.unhandledAttr = c), f.length && (d.refHandles = f), p.length && (d.detachStyledChildren = p), i; | ||
return c.length && (d.unhandledChildren = c), a && (d.unhandledAttr = a), f.length && (d.refHandles = f), p.length && (d.detachStyledChildren = p), i; | ||
} | ||
@@ -277,8 +277,8 @@ function ie(t) { | ||
var s, i, o; | ||
function n(c) { | ||
var a; | ||
if (!((a = n.check) != null && a.call(n, c))) | ||
function n(a) { | ||
var c; | ||
if (!((c = n.check) != null && c.call(n, a))) | ||
return new Error("type check failed"); | ||
} | ||
return n.argv = r, n.stringify = (s = t.stringify) == null ? void 0 : s.bind(n), n.parse = (i = t.parse) == null ? void 0 : i.bind(n), n.check = (o = t.check) == null ? void 0 : o.bind(n), n.is = t.is || ((c) => c === e), n.zeroValue = t.zeroValue, n.required = t.required, n.createDefaultValue = t.createDefaultValue, n.coerce = t.coerce, n.required || Object.defineProperty(n, "isRequired", { | ||
return n.argv = r, n.stringify = (s = t.stringify) == null ? void 0 : s.bind(n), n.parse = (i = t.parse) == null ? void 0 : i.bind(n), n.check = (o = t.check) == null ? void 0 : o.bind(n), n.is = t.is || ((a) => a === e), n.zeroValue = t.zeroValue, n.required = t.required, n.createDefaultValue = t.createDefaultValue, n.coerce = t.coerce, n.required || Object.defineProperty(n, "isRequired", { | ||
get() { | ||
@@ -299,6 +299,6 @@ return P({ | ||
get() { | ||
return (c) => P({ | ||
return (a) => P({ | ||
...t, | ||
required: n.required, | ||
createDefaultValue: c, | ||
createDefaultValue: a, | ||
is: n.is | ||
@@ -318,9 +318,9 @@ })(...r); | ||
...o | ||
} = e, c = function(a) { | ||
if (typeof t == "function" && !t(a)) | ||
return new Error(`${a} type check failed`); | ||
if (typeof t == "string" && typeof a !== t) | ||
return new Error(`${a} is not ${t}`); | ||
} = e, a = function(c) { | ||
if (typeof t == "function" && !t(c)) | ||
return new Error(`${c} type check failed`); | ||
if (typeof t == "string" && typeof c !== t) | ||
return new Error(`${c} is not ${t}`); | ||
}; | ||
return c.stringify = r, c.parse = n, c.check = (a) => typeof t == "string" ? typeof a === t : t(a), c.is = s || ((a) => a === c), c.required = !!i, Object.assign(c, o), c.required || Object.defineProperty(c, "isRequired", { | ||
return a.stringify = r, a.parse = n, a.check = (c) => typeof t == "string" ? typeof c === t : t(c), a.is = s || ((c) => c === a), a.required = !!i, Object.assign(a, o), a.required || Object.defineProperty(a, "isRequired", { | ||
get() { | ||
@@ -330,20 +330,20 @@ return T(t, { | ||
required: !0, | ||
is: c.is | ||
is: a.is | ||
}); | ||
} | ||
}), c.createDefaultValue ? Object.defineProperty(c, "defaultValue", { | ||
}), a.createDefaultValue ? Object.defineProperty(a, "defaultValue", { | ||
get() { | ||
if (c.createDefaultValue) | ||
return c.createDefaultValue(); | ||
if (a.createDefaultValue) | ||
return a.createDefaultValue(); | ||
} | ||
}) : Object.defineProperty(c, "default", { | ||
}) : Object.defineProperty(a, "default", { | ||
get() { | ||
return (a) => T(t, { | ||
return (c) => T(t, { | ||
...e, | ||
required: c.required, | ||
createDefaultValue: a, | ||
is: c.is | ||
required: a.required, | ||
createDefaultValue: c, | ||
is: a.is | ||
}); | ||
} | ||
}), c.valueType = {}, c; | ||
}), a.valueType = {}, a; | ||
} | ||
@@ -363,3 +363,3 @@ const _e = P({ | ||
zeroValue: "" | ||
}, Ge = T("string", ze), Be = { | ||
}, Be = T("string", ze), Ge = { | ||
stringify(t) { | ||
@@ -374,3 +374,3 @@ return t.toString(); | ||
zeroValue: 0 | ||
}, qe = T("number", Be), We = { zeroValue: null }, Ke = T((t) => typeof t == "object" && !Array.isArray(t), We), Xe = T((t) => Array.isArray(t), {}), Ye = { zeroValue: !1 }, Ue = T("bool", Ye), Je = { | ||
}, qe = T("number", Ge), We = { zeroValue: null }, Ke = T((t) => typeof t == "object" && !Array.isArray(t), We), Xe = T((t) => Array.isArray(t), {}), Ye = { zeroValue: !1 }, Ue = T("bool", Ye), Je = { | ||
stringify(t) { | ||
@@ -393,3 +393,3 @@ return t.toString(); | ||
} | ||
}, B = T(() => !0, et), tt = P({ | ||
}, G = T(() => !0, et), tt = P({ | ||
check(t) { | ||
@@ -445,3 +445,3 @@ return this.argv[0].some((e) => e.check(t)); | ||
} | ||
}), it = B, ot = B, ct = B, at = Fe; | ||
}), it = G, ot = G, at = G, ct = Fe; | ||
function lt() { | ||
@@ -468,3 +468,3 @@ return P({ | ||
const O = { | ||
string: Ge, | ||
string: Be, | ||
number: qe, | ||
@@ -478,3 +478,3 @@ object: Ke, | ||
element: ot, | ||
elementType: ct, | ||
elementType: at, | ||
// instanceOf | ||
@@ -494,4 +494,4 @@ // 枚举值 | ||
// customProps/customArrayProps | ||
any: B, | ||
checkPropTypes: at, | ||
any: G, | ||
checkPropTypes: ct, | ||
// reactive types | ||
@@ -526,3 +526,3 @@ atom: lt, | ||
function() { | ||
if (this.manualTrack(e.source, $.METHOD, I.METHOD), this.manualTrack(e.source, $.EXPLICIT_KEY_CHANGE, I.EXPLICIT_KEY_CHANGE), e.hostsComputed) | ||
if (this.manualTrack(e.source, $.METHOD, N.METHOD), this.manualTrack(e.source, $.EXPLICIT_KEY_CHANGE, N.EXPLICIT_KEY_CHANGE), e.hostsComputed) | ||
throw new Error("should never recompute reactiveArray"); | ||
@@ -532,4 +532,4 @@ return e.source.map(e.createPlaceholder); | ||
function(n, s) { | ||
s.forEach(({ method: i, argv: o, result: c }) => { | ||
var a, f, p; | ||
s.forEach(({ method: i, argv: o, result: a }) => { | ||
var c, f, p; | ||
if (i === "push") { | ||
@@ -548,8 +548,8 @@ const d = o.map(e.createPlaceholder); | ||
n.splice(o[0], o[1], ...d); | ||
} else if (!i && c) | ||
(a = c.add) == null || a.forEach(({}) => { | ||
} else if (!i && a) | ||
(c = a.add) == null || c.forEach(({}) => { | ||
throw new Error("can not use obj[key] = value to add item to reactive array, use push instead."); | ||
}), (f = c.remove) == null || f.forEach(({}) => { | ||
}), (f = a.remove) == null || f.forEach(({}) => { | ||
throw new Error("can not use delete obj[key] to delete item, use splice instead."); | ||
}), (p = c.update) == null || p.forEach(({ key: d, newValue: l }) => { | ||
}), (p = a.update) == null || p.forEach(({ key: d, newValue: l }) => { | ||
n[d] = e.createPlaceholder(l); | ||
@@ -569,4 +569,4 @@ }); | ||
throw new Error("hostsComputed should not recompute"); | ||
this.manualTrack(e.placeholderAndItemComputed, $.METHOD, I.METHOD), this.manualTrack(e.placeholderAndItemComputed, $.EXPLICIT_KEY_CHANGE, I.EXPLICIT_KEY_CHANGE); | ||
const n = e.placeholderAndItemComputed.map(([o, c]) => L(o, c, { ...e.pathContext, hostPath: [...e.pathContext.hostPath, e] })), s = document.createDocumentFragment(); | ||
this.manualTrack(e.placeholderAndItemComputed, $.METHOD, N.METHOD), this.manualTrack(e.placeholderAndItemComputed, $.EXPLICIT_KEY_CHANGE, N.EXPLICIT_KEY_CHANGE); | ||
const n = e.placeholderAndItemComputed.map(([o, a]) => L(o, a, { ...e.pathContext, hostPath: [...e.pathContext.hostPath, e] })), s = document.createDocumentFragment(); | ||
return n.forEach((o) => { | ||
@@ -577,4 +577,4 @@ s.appendChild(o.placeholder), o.render(); | ||
function(n, s) { | ||
s.forEach(({ method: i, argv: o, result: c }) => { | ||
var a, f, p, d; | ||
s.forEach(({ method: i, argv: o, result: a }) => { | ||
var c, f, p, d; | ||
if (i === "push") { | ||
@@ -603,10 +603,10 @@ const l = o.map(e.createHost), h = document.createDocumentFragment(); | ||
const u = dt(o, n.length); | ||
S(l, ((a = n[o[0] + u]) == null ? void 0 : a.element) || e.placeholder), n.splice(o[0], u, ...h).forEach((m) => m.destroy()); | ||
S(l, ((c = n[o[0] + u]) == null ? void 0 : c.element) || e.placeholder), n.splice(o[0], u, ...h).forEach((m) => m.destroy()); | ||
} | ||
} else if (!i && c) | ||
(f = c.add) == null || f.forEach(({}) => { | ||
} else if (!i && a) | ||
(f = a.add) == null || f.forEach(({}) => { | ||
throw new Error("should never occur"); | ||
}), (p = c.remove) == null || p.forEach(({}) => { | ||
}), (p = a.remove) == null || p.forEach(({}) => { | ||
throw new Error("should never occur"); | ||
}), (d = c.update) == null || d.forEach(({ key: l, newValue: h }) => { | ||
}), (d = a.update) == null || d.forEach(({ key: l, newValue: h }) => { | ||
var u; | ||
@@ -626,5 +626,5 @@ n[l].destroy(), n[l] = e.createHost(h), S(n[l].placeholder, ((u = n[parseInt(l, 10) + 1]) == null ? void 0 : u.element) || e.placeholder), n[l].render(); | ||
} | ||
const ce = /* @__PURE__ */ new WeakSet(); | ||
const ae = /* @__PURE__ */ new WeakSet(); | ||
function mt({ container: t, content: e, destroyOnUnmount: r }, { useEffect: n, pathContext: s }) { | ||
typeof e != "function" && (ce.has(e) && console.error("static portal content can only be rendered once. Use function content for content has reactive parts."), ce.add(e)); | ||
typeof e != "function" && (ae.has(e) && console.error("static portal content can only be rendered once. Use function content for content has reactive parts."), ae.add(e)); | ||
const i = Ot(t, s); | ||
@@ -664,13 +664,13 @@ return i.render(e), n(() => () => { | ||
constructor({ type: e, props: r = {}, children: n }, s, i) { | ||
this.placeholder = s, this.pathContext = i, this.layoutEffects = /* @__PURE__ */ new Set(), this.effects = /* @__PURE__ */ new Set(), this.destroyCallback = /* @__PURE__ */ new Set(), this.layoutEffectDestroyHandles = /* @__PURE__ */ new Set(), this.refs = He({}), this.itemConfig = {}, this.frame = [], this.exposed = {}, this.createHTMLOrSVGElement = (o, c, a, ...f) => { | ||
var x, g, N, k; | ||
const p = typeof c == "function", d = a == null ? void 0 : a.as; | ||
if (a == null || delete a.as, A(d !== "self", '"self" is reserved, please use another element name.'), d && ((x = this.itemConfig[d]) != null && x.use) && ((g = this.itemConfig[d]) == null ? void 0 : g.use) instanceof Element) | ||
this.placeholder = s, this.pathContext = i, this.layoutEffects = /* @__PURE__ */ new Set(), this.effects = /* @__PURE__ */ new Set(), this.destroyCallback = /* @__PURE__ */ new Set(), this.layoutEffectDestroyHandles = /* @__PURE__ */ new Set(), this.refs = He({}), this.itemConfig = {}, this.frame = [], this.exposed = {}, this.createHTMLOrSVGElement = (o, a, c, ...f) => { | ||
var x, g, I, k; | ||
const p = typeof a == "function", d = c == null ? void 0 : c.as; | ||
if (c == null || delete c.as, A(d !== "self", '"self" is reserved, please use another element name.'), d && ((x = this.itemConfig[d]) != null && x.use) && ((g = this.itemConfig[d]) == null ? void 0 : g.use) instanceof Element) | ||
return this.itemConfig[d].use; | ||
let l = f, { props: h, componentProps: u } = this.separateProps(a); | ||
let l = f, { props: h, componentProps: u } = this.separateProps(c); | ||
const y = this.itemConfig[d]; | ||
d && y && (y.props && (p ? h = { ...a, ...y.props } : h = Et(a, y.props)), y.propMergeHandles && Object.entries(y.propMergeHandles).forEach(([b, R]) => { | ||
d && y && (y.props && (p ? h = { ...c, ...y.props } : h = Et(c, y.props)), y.propMergeHandles && Object.entries(y.propMergeHandles).forEach(([b, R]) => { | ||
h[b] = R.reduce((Te, xe) => xe(Te, u), h[b]); | ||
}), y.propsMergeHandle && (h = y.propsMergeHandle.reduce((b, R) => R(b, u), h)), y.children && (l = y.children)); | ||
const m = ((N = this.itemConfig[d]) == null ? void 0 : N.use) || c; | ||
const m = ((I = this.itemConfig[d]) == null ? void 0 : I.use) || a; | ||
typeof m == "function" && !p && (u[wt] = h, h = u), typeof m == "function" && ((k = y == null ? void 0 : y.configProps) != null && k.length) && Object.assign(h, { [q]: y.configProps }), d && (h.ref = H(h.ref).concat((b) => this.refs[d] = b)); | ||
@@ -683,20 +683,20 @@ const E = o ? je(m, h, ...l) : C(m, h, ...l); | ||
return E; | ||
}, this.createElement = this.createHTMLOrSVGElement.bind(this, !1), this.createSVGElement = this.createHTMLOrSVGElement.bind(this, !0), this.createPortal = (o, c) => C(mt, { container: c, content: o }), this.useLayoutEffect = (o) => { | ||
}, this.createElement = this.createHTMLOrSVGElement.bind(this, !1), this.createSVGElement = this.createHTMLOrSVGElement.bind(this, !0), this.createPortal = (o, a) => C(mt, { container: a, content: o }), this.useLayoutEffect = (o) => { | ||
this.layoutEffects.add(o); | ||
}, this.useEffect = (o) => { | ||
this.effects.add(o); | ||
}, this.createRef = yt, this.createRxRef = gt, this.cleanupsOfExternalTarget = /* @__PURE__ */ new Set(), this.createStateFromRef = (o, c) => { | ||
let a; | ||
}, this.createRef = yt, this.createRxRef = gt, this.cleanupsOfExternalTarget = /* @__PURE__ */ new Set(), this.createStateFromRef = (o, a) => { | ||
let c; | ||
const f = (d) => { | ||
c && a && this.cleanupsOfExternalTarget.delete(a), a == null || a(), d !== null ? (a = o(d, p), c && a && this.cleanupsOfExternalTarget.add(a)) : (a = void 0, p(null)); | ||
a && c && this.cleanupsOfExternalTarget.delete(c), c == null || c(), d !== null ? (c = o(d, p), a && c && this.cleanupsOfExternalTarget.add(c)) : (c = void 0, p(null)); | ||
}, p = new Proxy(U(null), { | ||
get: (d, l) => l === "ref" ? f : d[l] | ||
}); | ||
return c && p.ref(c), p; | ||
}, this.expose = (o, c) => (typeof o == "object" && c === void 0 ? Object.assign(this.exposed, o) : typeof c == "string" && (this.exposed[c] = o), o), this.onCleanup = (o) => { | ||
return a && p.ref(a), p; | ||
}, this.expose = (o, a) => (typeof o == "object" && a === void 0 ? Object.assign(this.exposed, o) : typeof a == "string" && (this.exposed[a] = o), o), this.onCleanup = (o) => { | ||
this.destroyCallback.add(o); | ||
}, this.runLayoutEffect = () => { | ||
this.layoutEffects.forEach((o) => { | ||
const c = o(); | ||
typeof c == "function" && this.layoutEffectDestroyHandles.add(c); | ||
const a = o(); | ||
typeof a == "function" && this.layoutEffectDestroyHandles.add(a); | ||
}); | ||
@@ -808,4 +808,4 @@ }, v.typeIds.has(e) || v.typeIds.set(e, v.typeIds.size), this.name = e.name, this.type = e, this.props = {}, this.refProp = r.ref, this.thisProp = r.__this, this.inputProps = r, this.children = n; | ||
this.frame = e(), this.innerHost = L(i, this.placeholder, { ...this.pathContext, hostPath: [...this.pathContext.hostPath, this] }), this.innerHost.render(), this.refProp && this.attachRef(this.refProp), this.thisProp && this.attachThis(this.thisProp), this.effects.forEach((o) => { | ||
const c = o(); | ||
typeof c == "function" && this.destroyCallback.add(c); | ||
const a = o(); | ||
typeof a == "function" && this.destroyCallback.add(a); | ||
}), this.pathContext.root.attached ? this.runLayoutEffect() : this.deleteLayoutEffectCallback = this.pathContext.root.on("attach", this.runLayoutEffect); | ||
@@ -842,3 +842,3 @@ } | ||
} | ||
function ae(t) { | ||
function ce(t) { | ||
return t != null && t.toString ? t.toString() : t === void 0 ? "undefined" : JSON.stringify(t); | ||
@@ -856,6 +856,6 @@ } | ||
if (this.element === this.placeholder) { | ||
const r = document.createTextNode(ae(e)); | ||
const r = document.createTextNode(ce(e)); | ||
this.parentElement.replaceChild(r, this.placeholder), this.element = r; | ||
} else | ||
this.element.nodeValue = ae(e); | ||
this.element.nodeValue = ce(e); | ||
} | ||
@@ -940,12 +940,12 @@ render() { | ||
if (n) { | ||
const c = this.elToStyleId.get(n); | ||
if (c) | ||
return c; | ||
const a = this.elToStyleId.get(n); | ||
if (a) | ||
return a; | ||
{ | ||
const a = `gen-${Math.random().toString(36).slice(2)}`; | ||
return this.elToStyleId.set(n, a), a; | ||
const c = `gen-${Math.random().toString(36).slice(2)}`; | ||
return this.elToStyleId.set(n, c), c; | ||
} | ||
} | ||
const s = e.findLastIndex((c) => c instanceof Q), i = s === -1 ? void 0 : e[s], o = s === -1 ? e : e.slice(s + 1); | ||
return `gen-${(i == null ? void 0 : i.typeId) ?? "global"}-${o.map((c) => c.pathContext.elementPath.join("_")).join("-")}-${r.join("_")}`; | ||
const s = e.findLastIndex((a) => a instanceof Q), i = s === -1 ? void 0 : e[s], o = s === -1 ? e : e.slice(s + 1); | ||
return `gen-${(i == null ? void 0 : i.typeId) ?? "global"}-${o.map((a) => a.pathContext.elementPath.join("_")).join("-")}-${r.join("_")}`; | ||
} | ||
@@ -958,19 +958,19 @@ stringifyStyleObject(e) { | ||
const o = this.getStyleSheetId(e, r, i ? null : s); | ||
let c = this.styleScripts.get(o); | ||
c || (c = new CSSStyleSheet(), document.adoptedStyleSheets = [...document.adoptedStyleSheets, c], this.styleScripts.set(o, c)), s.classList.add(o); | ||
const a = Array.isArray(n) ? n : [n]; | ||
c.replaceSync(this.generateStyleContent(`.${o}`, a[0]).join(` | ||
let a = this.styleScripts.get(o); | ||
a || (a = new CSSStyleSheet(), document.adoptedStyleSheets = [...document.adoptedStyleSheets, a], this.styleScripts.set(o, a)), s.classList.add(o); | ||
const c = Array.isArray(n) ? n : [n]; | ||
a.replaceSync(this.generateStyleContent(`.${o}`, c[0]).join(` | ||
`)); | ||
const f = X(a[0]); | ||
return f.length && he(s), Oe(a.slice(1).map((p) => () => { | ||
const f = X(c[0]); | ||
return f.length && he(s), Oe(c.slice(1).map((p) => () => { | ||
const [d, l, h] = this.separateStyleObject(p, f); | ||
if (l && this.generateStyleContent(`.${o}`, l).forEach((u) => { | ||
c.insertRule(u, c.cssRules.length); | ||
a.insertRule(u, a.cssRules.length); | ||
}), d) { | ||
const u = X(d); | ||
f.push(...u), this.generateStyleContent(`.${o}`, d).forEach((y) => { | ||
c.insertRule(y, c.cssRules.length); | ||
a.insertRule(y, a.cssRules.length); | ||
}); | ||
} | ||
h && G(s, "style", h), ee(p) && he(s); | ||
h && B(s, "style", h), ee(p) && he(s); | ||
})); | ||
@@ -1009,14 +1009,14 @@ } | ||
const n = { ...r }, s = [], i = {}; | ||
for (const a in n) | ||
a === "@keyframes" || a === "animation" ? (i[a] = n[a], delete n[a]) : this.isNestedStyleObject(a, n[a]) && (s.push([a, n[a]]), delete n[a]); | ||
for (const c in n) | ||
c === "@keyframes" || c === "animation" ? (i[c] = n[c], delete n[c]) : this.isNestedStyleObject(c, n[c]) && (s.push([c, n[c]]), delete n[c]); | ||
const o = [`${e} { | ||
${this.stringifyStyleObject(n)} | ||
}`], c = this.generateInlineAnimationContent(e, i); | ||
return c && o.push(c), s.reduce((a, [f, p]) => { | ||
}`], a = this.generateInlineAnimationContent(e, i); | ||
return a && o.push(a), s.reduce((c, [f, p]) => { | ||
if (f.startsWith("@")) | ||
return a.concat(`${f} { | ||
return c.concat(`${f} { | ||
${this.generateStyleContent(e, p)} | ||
}`); | ||
const d = /^(\s?)+&/.test(f) ? f.replace("&", e) : `${e} ${f}`; | ||
return a.concat(this.generateStyleContent(d, p)); | ||
return c.concat(this.generateStyleContent(d, p)); | ||
}, o); | ||
@@ -1059,5 +1059,5 @@ } | ||
const r = e instanceof SVGElement, { unhandledAttr: n } = e; | ||
this.attrAutoruns = [], n == null || n.forEach(({ el: s, key: i, value: o, path: c }) => { | ||
this.attrAutoruns = [], n == null || n.forEach(({ el: s, key: i, value: o, path: a }) => { | ||
i.includes(":") || this.attrAutoruns.push(de(() => { | ||
this.updateAttribute(s, i, o, c, r); | ||
this.updateAttribute(s, i, o, a, r); | ||
}, !0)); | ||
@@ -1067,6 +1067,6 @@ }); | ||
updateAttribute(e, r, n, s, i) { | ||
const o = Array.isArray(n) ? n.map((c) => M(c) ? c() : c) : M(n) ? n() : n; | ||
const o = Array.isArray(n) ? n.map((a) => M(a) ? a() : a) : M(n) ? n() : n; | ||
if (r === "style" && (Se(o) || ee(o) || be(o))) | ||
return Pe.styleManager.update(this.pathContext.hostPath, s, o, e, !1); | ||
G(e, r, o, i); | ||
B(e, r, o, i); | ||
} | ||
@@ -1102,8 +1102,8 @@ collectRefHandles() { | ||
}), await Promise.all(((s = this.detachStyledChildren) == null ? void 0 : s.map(({ el: f, style: p, path: d }) => this.updateAttribute(f, "style", p, d, f instanceof SVGElement))) || []); | ||
const c = Array.from(i), a = Array.from(o); | ||
const a = Array.from(i), c = Array.from(o); | ||
await Promise.all([ | ||
...c.map((f) => V(f, "transitionrun")), | ||
...c.map((f) => V(f, "transitionend")), | ||
...a.map((f) => V(f, "animationrun")), | ||
...a.map((f) => V(f, "animationend")) | ||
...a.map((f) => V(f, "transitionrun")), | ||
...a.map((f) => V(f, "transitionend")), | ||
...c.map((f) => V(f, "animationrun")), | ||
...c.map((f) => V(f, "animationend")) | ||
]); | ||
@@ -1181,6 +1181,6 @@ } | ||
function() { | ||
return this.manualTrack(e.hosts, $.METHOD, I.METHOD), this.manualTrack(e.hosts, $.EXPLICIT_KEY_CHANGE, I.EXPLICIT_KEY_CHANGE), S(e.renderNewHosts(e.hosts), e.placeholder), null; | ||
return this.manualTrack(e.hosts, $.METHOD, N.METHOD), this.manualTrack(e.hosts, $.EXPLICIT_KEY_CHANGE, N.EXPLICIT_KEY_CHANGE), S(e.renderNewHosts(e.hosts), e.placeholder), null; | ||
}, | ||
function(n, s) { | ||
s.forEach(({ method: i, argv: o, result: c, key: a, newValue: f, methodResult: p }, d) => { | ||
s.forEach(({ method: i, argv: o, result: a, key: c, newValue: f, methodResult: p }, d) => { | ||
var l; | ||
@@ -1194,6 +1194,6 @@ if (i === "splice") { | ||
p.forEach((m) => m.destroy()); | ||
} else if (i === void 0 && a !== void 0) { | ||
} else if (i === void 0 && c !== void 0) { | ||
const h = p; | ||
h == null || h.destroy(); | ||
const u = a; | ||
const u = c; | ||
S(e.hosts.at(u).placeholder, ((l = e.hosts.at(u + 1)) == null ? void 0 : l.element) || e.placeholder), e.hosts.at(u).render(); | ||
@@ -1213,9 +1213,11 @@ } else | ||
class Lt { | ||
constructor(e) { | ||
this.pathContext = e, this.element = document.createComment("empty"), this.placeholder = this.element; | ||
constructor(e, r) { | ||
this.pathContext = e, this.placeholder = r, this.element = document.createComment("empty"); | ||
} | ||
render() { | ||
var e; | ||
(e = this.placeholder.parentNode) == null || e.insertBefore(this.element, this.placeholder); | ||
} | ||
destroy(e) { | ||
e || this.placeholder.remove(); | ||
e || (this.element.remove(), this.placeholder.remove()); | ||
} | ||
@@ -1238,3 +1240,3 @@ } | ||
let n; | ||
return t instanceof j ? n = new Ht(t, e, r) : Array.isArray(t) ? pe(t) ? n = new pt(t, e, r) : n = new xt(t, e, r) : typeof t == "object" && typeof (t == null ? void 0 : t.type) == "function" ? n = new Q(t, e, r) : z(t) ? n = new St(t, e, r) : typeof t == "function" ? n = new bt(t, e, r) : t instanceof HTMLElement || t instanceof SVGElement || t instanceof DocumentFragment ? n = new Tt(t, e, r) : t == null ? n = new Lt(r) : typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? n = new Rt(t, e, r) : A(!1, `unknown child type ${t}`), n; | ||
return t instanceof j ? n = new Ht(t, e, r) : Array.isArray(t) ? pe(t) ? n = new pt(t, e, r) : n = new xt(t, e, r) : typeof t == "object" && typeof (t == null ? void 0 : t.type) == "function" ? n = new Q(t, e, r) : z(t) ? n = new St(t, e, r) : typeof t == "function" ? n = new bt(t, e, r) : t instanceof HTMLElement || t instanceof SVGElement || t instanceof DocumentFragment ? n = new Tt(t, e, r) : t == null ? n = new Lt(r, e) : typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? n = new Rt(t, e, r) : A(!1, `unknown child type ${t}`), n; | ||
} | ||
@@ -1260,10 +1262,10 @@ function Ot(t, e) { | ||
on(i, o) { | ||
let c = r.get(i); | ||
return c || r.set(i, c = /* @__PURE__ */ new Set()), c.add(o), () => { | ||
c.delete(o); | ||
let a = r.get(i); | ||
return a || r.set(i, a = /* @__PURE__ */ new Set()), a.add(o), () => { | ||
a.delete(o); | ||
}; | ||
}, | ||
dispatch(i, o) { | ||
var c; | ||
(c = r.get(i)) == null || c.forEach((a) => a(o)); | ||
var a; | ||
(a = r.get(i)) == null || a.forEach((c) => c(o)); | ||
} | ||
@@ -1279,3 +1281,3 @@ }; | ||
} | ||
const Ft = w((t) => t.key === "ArrowUp"), _t = w((t) => t.key === "ArrowDown"), zt = w((t) => t.key === "ArrowLeft"), Gt = w((t) => t.key === "ArrowRight"), Bt = w((t) => t.key === "Enter"), qt = w((t) => t.key === "Tab"), Wt = w((t) => t.key === "Escape"), Kt = w((t) => t.key === "Backspace"), Xt = w((t) => t.key === "Space"), Yt = w((t) => t.button === 0), Ut = w((t) => t.button === 2), Jt = w((t) => t.button === 1), Zt = (t, e) => w((r) => e != null && e.meta && !r.metaKey || e != null && e.ctrl && !r.ctrlKey || e != null && e.alt && !r.altKey || e != null && e.shift && !r.shiftKey ? !1 : r.key === t), Qt = w((t) => t.target === t.currentTarget); | ||
const Ft = w((t) => t.key === "ArrowUp"), _t = w((t) => t.key === "ArrowDown"), zt = w((t) => t.key === "ArrowLeft"), Bt = w((t) => t.key === "ArrowRight"), Gt = w((t) => t.key === "Enter"), qt = w((t) => t.key === "Tab"), Wt = w((t) => t.key === "Escape"), Kt = w((t) => t.key === "Backspace"), Xt = w((t) => t.key === "Space"), Yt = w((t) => t.button === 0), Ut = w((t) => t.button === 2), Jt = w((t) => t.button === 1), Zt = (t, e) => w((r) => e != null && e.meta && !r.metaKey || e != null && e.ctrl && !r.ctrlKey || e != null && e.alt && !r.altKey || e != null && e.shift && !r.shiftKey ? !1 : r.key === t), Qt = w((t) => t.target === t.currentTarget); | ||
function er(t) { | ||
@@ -1335,5 +1337,5 @@ let e; | ||
const $t = vt("Form"); | ||
function It({ name: t, children: e, onChange: r, onSubmit: n, onClear: s, onReset: i, values: o }, { | ||
createElement: c, | ||
context: a | ||
function Nt({ name: t, children: e, onChange: r, onSubmit: n, onClear: s, onReset: i, values: o }, { | ||
createElement: a, | ||
context: c | ||
}) { | ||
@@ -1344,4 +1346,4 @@ const f = {}, p = (m, E, x) => { | ||
if (x) { | ||
const g = o.get(m), N = g.findIndex((b) => b === E.value); | ||
N() > -1 && g.splice(N(), 1); | ||
const g = o.get(m), I = g.findIndex((b) => b === E.value); | ||
I() > -1 && g.splice(I(), 1); | ||
const k = f[m].findIndex((b) => b === E); | ||
@@ -1364,5 +1366,5 @@ k > -1 && f[m].splice(k, 1); | ||
}; | ||
return a.set($t, { name: t, register: p, unregister: d, onChange: y, submit: l, reset: h, clear: u }), e; | ||
return c.set($t, { name: t, register: p, unregister: d, onChange: y, submit: l, reset: h, clear: u }), e; | ||
} | ||
It.propTypes = { | ||
Nt.propTypes = { | ||
name: O.string.isRequired, | ||
@@ -1403,4 +1405,4 @@ values: O.rxMap(), | ||
return t.forEach((o) => { | ||
const c = () => s(); | ||
o.target.addEventListener(o.event, c), i.push(() => o.target.removeEventListener(o.event, c)); | ||
const a = () => s(); | ||
o.target.addEventListener(o.event, a), i.push(() => o.target.removeEventListener(o.event, a)); | ||
}), () => { | ||
@@ -1444,3 +1446,3 @@ i.forEach((o) => o()); | ||
}); | ||
function cr(t, e) { | ||
function ar(t, e) { | ||
if (t === window) { | ||
@@ -1468,3 +1470,3 @@ const r = () => { | ||
} | ||
function ar(t, e) { | ||
function cr(t, e) { | ||
const r = () => { | ||
@@ -1479,9 +1481,9 @@ e(!0); | ||
} | ||
const Nt = "dragmove"; | ||
const It = "dragmove"; | ||
function lr(t) { | ||
const e = (t == null ? void 0 : t.container) || document.body, r = (t == null ? void 0 : t.customEventName) || Nt; | ||
const e = (t == null ? void 0 : t.container) || document.body, r = (t == null ? void 0 : t.customEventName) || It; | ||
return function(s) { | ||
const i = (o) => { | ||
const c = o.clientX, a = o.clientY; | ||
let f = c, p = a; | ||
const a = o.clientX, c = o.clientY; | ||
let f = a, p = c; | ||
const d = (l) => { | ||
@@ -1491,4 +1493,4 @@ const h = { | ||
clientY: l.clientY, | ||
deltaXFromStart: l.clientX - c, | ||
deltaYFromStart: l.clientY - a, | ||
deltaXFromStart: l.clientX - a, | ||
deltaYFromStart: l.clientY - c, | ||
deltaX: l.clientX - f, | ||
@@ -1513,12 +1515,12 @@ deltaY: l.clientY - p | ||
return; | ||
const o = { clientX: i.clientX, offsetX: 0, clientY: i.clientY, offsetY: 0 }, c = (a) => { | ||
const o = { clientX: i.clientX, offsetX: 0, clientY: i.clientY, offsetY: 0 }, a = (c) => { | ||
n({ | ||
clientX: a.clientX, | ||
clientY: a.clientY, | ||
offsetX: a.clientX - o.clientX, | ||
offsetY: a.clientY - o.clientY | ||
clientX: c.clientX, | ||
clientY: c.clientY, | ||
offsetX: c.clientX - o.clientX, | ||
offsetY: c.clientY - o.clientY | ||
}); | ||
}; | ||
r.addEventListener("mousemove", c), document.addEventListener("mouseup", () => { | ||
n(null), r.removeEventListener("mousemove", c); | ||
r.addEventListener("mousemove", a), document.addEventListener("mouseup", () => { | ||
n(null), r.removeEventListener("mousemove", a); | ||
}, { once: !0 }); | ||
@@ -1559,5 +1561,5 @@ }; | ||
sr as ContextProvider, | ||
Nt as DEFAULT_DRAG_MOVE_EVENT, | ||
It as DEFAULT_DRAG_MOVE_EVENT, | ||
Ct as DataContext, | ||
It as Form, | ||
Nt as Form, | ||
$t as FormContext, | ||
@@ -1591,3 +1593,3 @@ Ee as Fragment, | ||
Wt as onESCKey, | ||
Bt as onEnterKey, | ||
Gt as onEnterKey, | ||
Zt as onKey, | ||
@@ -1597,3 +1599,3 @@ zt as onLeftKey, | ||
Jt as onMiddleMouseDown, | ||
Gt as onRightKey, | ||
Bt as onRightKey, | ||
Ut as onRightMouseDown, | ||
@@ -1604,5 +1606,5 @@ Qt as onSelf, | ||
Ft as onUpKey, | ||
ar as reactiveFocused, | ||
cr as reactiveFocused, | ||
ur as reactiveScrollPosition, | ||
cr as reactiveSize, | ||
ar as reactiveSize, | ||
Dt as setAutoUnitType, | ||
@@ -1609,0 +1611,0 @@ tr as withCurrentRange, |
{ | ||
"name": "axii", | ||
"version": "2.6.47", | ||
"version": "2.6.48", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
537279
2934