Comparing version
@@ -1,11 +0,11 @@ | ||
import { currentContext as x, contextStack as w } from "./contexts.js"; | ||
import { useEffect as a } from "./signals.js"; | ||
const d = Symbol("insert"), O = Symbol("append"), A = Symbol("assign"), I = Symbol("set"), R = Symbol("create"), v = Symbol("listeners"), y = Symbol("on"), P = Symbol("childrenIndex"), S = Symbol("remove"), l = Symbol("context"), E = Symbol("call"), T = Symbol("empty"), g = Symbol("parent"), f = Symbol("cleanup"), c = Object.prototype; | ||
c[P] = function() { | ||
import { currentContext as x, contextStack as C } from "./contexts.js"; | ||
import { useEffect as S } from "./signals.js"; | ||
const b = Symbol("insert"), w = Symbol("append"), A = Symbol("assign"), I = Symbol("set"), R = Symbol("create"), a = Symbol("listeners"), d = Symbol("on"), O = Symbol("childrenIndex"), y = Symbol("remove"), l = Symbol("context"), E = Symbol("call"), T = Symbol("empty"), g = Symbol("parent"), f = Symbol("cleanup"), c = Object.prototype; | ||
c[O] = function() { | ||
return -1; | ||
}; | ||
c[d] = function() { | ||
c[b] = function() { | ||
return this; | ||
}; | ||
c[S] = function() { | ||
c[y] = function() { | ||
return this; | ||
@@ -16,12 +16,12 @@ }; | ||
}; | ||
c[O] = function(...t) { | ||
c[w] = function(...t) { | ||
return p(this, t, this), this; | ||
}; | ||
c[f] = function(t) { | ||
const o = this[v], n = o.cleanup, s = !!this[S]; | ||
const o = this[a], n = o.cleanup, s = !!this[y]; | ||
if (n) for (const r of n) r(s); | ||
delete o.cleanup, !t && s && this[S](); | ||
delete o.cleanup, !t && s && this[y](); | ||
}; | ||
c[y] = function(t, o) { | ||
const n = this[v]; | ||
c[d] = function(t, o) { | ||
const n = this[a]; | ||
return n[t] ?? (n[t] = []), n[t].push(o), this; | ||
@@ -31,14 +31,14 @@ }; | ||
const n = o.pop(); | ||
return j(this, o)[n] = t, this; | ||
return v(this, o)[n] = t, this; | ||
}; | ||
c[A] = function(t, ...o) { | ||
const n = o.pop(), s = j(this, o); | ||
return a(() => s[n] = t()), this; | ||
const n = o.pop(), s = v(this, o); | ||
return S(() => s[n] = t()), this; | ||
}; | ||
c[E] = function(t, ...o) { | ||
const n = o.pop(), s = j(this, o), r = s[n].bind(s); | ||
return a(() => r(...t())), this; | ||
const n = o.pop(), s = v(this, o), r = s[n].bind(s); | ||
return S(() => r(...t())), this; | ||
}; | ||
const h = Symbol("l"); | ||
Object.defineProperty(c, v, { | ||
Object.defineProperty(c, a, { | ||
get() { | ||
@@ -54,12 +54,12 @@ return this[h] ?? (this[h] = {}), this[h]; | ||
let e = s; | ||
a(() => { | ||
S(() => { | ||
const i = new Object(); | ||
n[y]("cleanup", (b) => i[f](b)), n[l] ?? (n[l] = x()), i[l] = { | ||
n[d]("cleanup", () => i[f]()), n[l] ?? (n[l] = x()), i[l] = { | ||
...n[l], | ||
[d]: (...b) => p(t, b, i, e), | ||
[b]: (...P) => p(t, P, i, e), | ||
[g]: i | ||
}, w.push(i[l]); | ||
const C = p(t, [u()], i, e); | ||
return w.pop(), r ?? (r = C), () => { | ||
e = { v: t[P](C) }, i[f](); | ||
}, C.push(i[l]); | ||
const j = p(t, [u()], i, e); | ||
return C.pop(), r ?? (r = j), () => { | ||
e = { v: t[O](j) }, i[f](); | ||
}; | ||
@@ -71,4 +71,4 @@ }); | ||
} else { | ||
const e = t[d](u ?? t[T](), s.v); | ||
s.v > -1 && s.v++, e[l] = n[l], n[y]("cleanup", (i) => e[f](i)), r ?? (r = e); | ||
const e = t[b](u ?? t[T](), s.v); | ||
s.v > -1 && s.v++, e[l] = n[l], n[d]("cleanup", (i) => e[f](i)), r ?? (r = e); | ||
} | ||
@@ -78,12 +78,12 @@ } | ||
} | ||
function j(t, o) { | ||
function v(t, o) { | ||
for (; o.length; ) t = t[o.shift()]; | ||
return t; | ||
} | ||
const B = (t, o) => o[O](t); | ||
const B = (t, o) => o[w](t); | ||
export { | ||
O as append, | ||
w as append, | ||
A as assign, | ||
E as call, | ||
P as childrenIndex, | ||
O as childrenIndex, | ||
f as cleanup, | ||
@@ -93,9 +93,9 @@ l as context, | ||
T as empty, | ||
d as insert, | ||
v as listeners, | ||
y as on, | ||
b as insert, | ||
a as listeners, | ||
d as on, | ||
g as parent, | ||
S as remove, | ||
y as remove, | ||
B as render, | ||
I as set | ||
}; |
{ | ||
"name": "battuta", | ||
"private": false, | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
62633
0