keits 0.0.0-stage → 0.0.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.
- package/LICENSE +21 -0
- package/README.md +126 -2
- package/dist/dev/index.js +435 -0
- package/dist/dev/shared/element-By0uLZli.js +544 -0
- package/dist/dev/svg.js +70 -0
- package/dist/prod/index.js +258 -0
- package/dist/prod/shared/element-C8c5hIhH.js +394 -0
- package/dist/prod/svg.js +8 -0
- package/dist/types/core/computed.d.ts +6 -0
- package/dist/types/core/context.d.ts +11 -0
- package/dist/types/core/effect.d.ts +4 -0
- package/dist/types/core/env.d.ts +1 -0
- package/dist/types/core/graph.d.ts +73 -0
- package/dist/types/core/owner.d.ts +12 -0
- package/dist/types/core/signal.d.ts +15 -0
- package/dist/types/core/store.d.ts +13 -0
- package/dist/types/core/types.d.ts +1 -0
- package/dist/types/dom/element.d.ts +3 -0
- package/dist/types/dom/events.d.ts +1 -0
- package/dist/types/dom/hooks.d.ts +8 -0
- package/dist/types/dom/index.d.ts +6 -0
- package/dist/types/dom/insert.d.ts +2 -0
- package/dist/types/dom/mount.d.ts +2 -0
- package/dist/types/dom/namespaces.d.ts +1 -0
- package/dist/types/dom/props.d.ts +3 -0
- package/dist/types/dom/render-effect.d.ts +1 -0
- package/dist/types/dom/tags.d.ts +112 -0
- package/dist/types/dom/types.d.ts +43 -0
- package/dist/types/dom/unsafe.d.ts +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/svg/element.d.ts +2 -0
- package/dist/types/svg/index.d.ts +3 -0
- package/dist/types/svg/tags.d.ts +63 -0
- package/dist/types/svg/types.d.ts +13 -0
- package/package.json +34 -3
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, s as m, u as h, v as g, x as _, y as v } from "./shared/element-C8c5hIhH.js";
|
|
2
|
+
// src/core/signal.ts
|
|
3
|
+
function y(e, t) {
|
|
4
|
+
let n = {
|
|
5
|
+
kind: 0,
|
|
6
|
+
value: e,
|
|
7
|
+
equals: t?.equals ?? Object.is,
|
|
8
|
+
observers: [],
|
|
9
|
+
seenBy: 0
|
|
10
|
+
};
|
|
11
|
+
return Object.assign(() => (g(n), n.value), { set: (e) => {
|
|
12
|
+
let t = typeof e == "function" ? e(n.value) : e;
|
|
13
|
+
n.equals !== !1 && n.equals(n.value, t) || (n.value = t, o(n));
|
|
14
|
+
} });
|
|
15
|
+
}
|
|
16
|
+
// src/core/computed.ts
|
|
17
|
+
function b(e, t) {
|
|
18
|
+
let r = {
|
|
19
|
+
kind: 2,
|
|
20
|
+
fn: e,
|
|
21
|
+
value: void 0,
|
|
22
|
+
equals: t?.equals ?? Object.is,
|
|
23
|
+
hasValue: !1,
|
|
24
|
+
hasError: !1,
|
|
25
|
+
error: void 0,
|
|
26
|
+
computing: !1,
|
|
27
|
+
state: 2,
|
|
28
|
+
sources: [],
|
|
29
|
+
observers: [],
|
|
30
|
+
seenBy: 0,
|
|
31
|
+
flushId: 0,
|
|
32
|
+
flushRuns: 0,
|
|
33
|
+
owner: null,
|
|
34
|
+
children: null,
|
|
35
|
+
cleanups: null,
|
|
36
|
+
disposed: !1
|
|
37
|
+
};
|
|
38
|
+
return l(r), () => {
|
|
39
|
+
if (r.computing) throw x(r);
|
|
40
|
+
if (r.state !== 0 && n(r), g(r), r.hasError) throw r.error;
|
|
41
|
+
return r.value;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function x(e) {
|
|
45
|
+
return /* @__PURE__ */ Error("[keits] cycle detected");
|
|
46
|
+
}
|
|
47
|
+
// src/core/env.ts
|
|
48
|
+
var S = typeof window > "u";
|
|
49
|
+
// src/core/owner.ts
|
|
50
|
+
function C() {
|
|
51
|
+
return a();
|
|
52
|
+
}
|
|
53
|
+
function w(t, n) {
|
|
54
|
+
return e(t, n);
|
|
55
|
+
}
|
|
56
|
+
function T(t) {
|
|
57
|
+
let n = {
|
|
58
|
+
kind: 3,
|
|
59
|
+
owner: a(),
|
|
60
|
+
children: null,
|
|
61
|
+
cleanups: null,
|
|
62
|
+
disposed: !1,
|
|
63
|
+
handler: null
|
|
64
|
+
}, r = () => h(() => i(n));
|
|
65
|
+
return h(() => {
|
|
66
|
+
try {
|
|
67
|
+
return e(n, () => t(r));
|
|
68
|
+
} catch (e) {
|
|
69
|
+
throw i(n), e;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function E(e) {
|
|
74
|
+
m(e);
|
|
75
|
+
}
|
|
76
|
+
function D(e) {
|
|
77
|
+
r(e);
|
|
78
|
+
}
|
|
79
|
+
function ee(t, n) {
|
|
80
|
+
let r = {
|
|
81
|
+
kind: 3,
|
|
82
|
+
owner: null,
|
|
83
|
+
children: null,
|
|
84
|
+
cleanups: null,
|
|
85
|
+
disposed: !1,
|
|
86
|
+
handler: n
|
|
87
|
+
};
|
|
88
|
+
return l(r), h(() => {
|
|
89
|
+
try {
|
|
90
|
+
return e(r, t);
|
|
91
|
+
} catch (e) {
|
|
92
|
+
p(e, r);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function te(e) {
|
|
98
|
+
return _(() => T((t) => {
|
|
99
|
+
try {
|
|
100
|
+
return e();
|
|
101
|
+
} finally {
|
|
102
|
+
t();
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
// src/core/context.ts
|
|
107
|
+
function O(e, t) {
|
|
108
|
+
return { defaultValue: e };
|
|
109
|
+
}
|
|
110
|
+
function k(t, n, r) {
|
|
111
|
+
let i = {
|
|
112
|
+
kind: 3,
|
|
113
|
+
owner: null,
|
|
114
|
+
children: null,
|
|
115
|
+
cleanups: null,
|
|
116
|
+
disposed: !1,
|
|
117
|
+
handler: null,
|
|
118
|
+
context: {
|
|
119
|
+
key: t,
|
|
120
|
+
value: n
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
return l(i), e(i, r);
|
|
124
|
+
}
|
|
125
|
+
function A(e) {
|
|
126
|
+
for (let t = a(); t !== null; t = t.owner) if (t.kind === 3 && t.context?.key === e) return t.context.value;
|
|
127
|
+
return e.defaultValue;
|
|
128
|
+
}
|
|
129
|
+
// src/core/store.ts
|
|
130
|
+
var j = Symbol("raw"), M = Symbol("shape"), N = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), F = 0;
|
|
131
|
+
function I(e, t) {
|
|
132
|
+
let n = z(e);
|
|
133
|
+
return [n, (e) => {
|
|
134
|
+
F++;
|
|
135
|
+
try {
|
|
136
|
+
v(() => h(() => e(n)));
|
|
137
|
+
} finally {
|
|
138
|
+
F--;
|
|
139
|
+
}
|
|
140
|
+
}];
|
|
141
|
+
}
|
|
142
|
+
function L(e) {
|
|
143
|
+
if (typeof e == "object" && e) {
|
|
144
|
+
let t = e[j];
|
|
145
|
+
if (t !== void 0) return t;
|
|
146
|
+
}
|
|
147
|
+
return e;
|
|
148
|
+
}
|
|
149
|
+
function R(e) {
|
|
150
|
+
if (typeof e != "object" || !e) return !1;
|
|
151
|
+
if (Array.isArray(e)) return !0;
|
|
152
|
+
let t = Object.getPrototypeOf(e);
|
|
153
|
+
return t === Object.prototype || t === null;
|
|
154
|
+
}
|
|
155
|
+
function z(e) {
|
|
156
|
+
if (!R(e)) return e;
|
|
157
|
+
let t = N.get(e);
|
|
158
|
+
return t === void 0 && (t = new Proxy(e, U), N.set(e, t)), t;
|
|
159
|
+
}
|
|
160
|
+
function B(e, t) {
|
|
161
|
+
let n = P.get(e);
|
|
162
|
+
n === void 0 && P.set(e, n = /* @__PURE__ */ new Map());
|
|
163
|
+
let r = n.get(t);
|
|
164
|
+
return r === void 0 && n.set(t, r = {
|
|
165
|
+
kind: 0,
|
|
166
|
+
observers: [],
|
|
167
|
+
seenBy: 0
|
|
168
|
+
}), r;
|
|
169
|
+
}
|
|
170
|
+
function V(e, t) {
|
|
171
|
+
let n = P.get(e)?.get(t);
|
|
172
|
+
n !== void 0 && o(n);
|
|
173
|
+
}
|
|
174
|
+
function H(e) {
|
|
175
|
+
return !1;
|
|
176
|
+
}
|
|
177
|
+
var U = {
|
|
178
|
+
get(e, t) {
|
|
179
|
+
if (t === j) return e;
|
|
180
|
+
let n = e[t];
|
|
181
|
+
return s() && (Object.hasOwn(e, t) || !(t in e)) && g(B(e, t)), z(n);
|
|
182
|
+
},
|
|
183
|
+
has(e, t) {
|
|
184
|
+
return s() && g(B(e, t)), t in e;
|
|
185
|
+
},
|
|
186
|
+
ownKeys(e) {
|
|
187
|
+
return s() && g(B(e, M)), Reflect.ownKeys(e);
|
|
188
|
+
},
|
|
189
|
+
set(e, t, n) {
|
|
190
|
+
if (F === 0) {
|
|
191
|
+
let t = H(e);
|
|
192
|
+
if (t) throw t;
|
|
193
|
+
return !1;
|
|
194
|
+
}
|
|
195
|
+
let r = e, i = L(n), a = Object.hasOwn(e, t), o = r[t], s = Array.isArray(e), c = s ? e.length : 0;
|
|
196
|
+
if (a && Object.is(o, i)) return !0;
|
|
197
|
+
if (r[t] = i, V(e, t), a || V(e, M), s) {
|
|
198
|
+
let n = e.length;
|
|
199
|
+
if (n !== c) {
|
|
200
|
+
t !== "length" && V(e, "length"), V(e, M);
|
|
201
|
+
for (let t = n; t < c; t++) V(e, String(t));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return !0;
|
|
205
|
+
},
|
|
206
|
+
deleteProperty(e, t) {
|
|
207
|
+
if (F === 0) {
|
|
208
|
+
let t = H(e);
|
|
209
|
+
if (t) throw t;
|
|
210
|
+
return !1;
|
|
211
|
+
}
|
|
212
|
+
return Object.hasOwn(e, t) && (delete e[t], V(e, t), V(e, M)), !0;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
function W(e, t, n = {}) {
|
|
216
|
+
G(z(L(e)), L(t), n.key);
|
|
217
|
+
}
|
|
218
|
+
function G(e, t, n) {
|
|
219
|
+
let r = L(e), i = e;
|
|
220
|
+
if (Array.isArray(r) && Array.isArray(t)) {
|
|
221
|
+
let e = /* @__PURE__ */ new Map();
|
|
222
|
+
if (n !== void 0) for (let t of r) R(t) && e.set(t[n], t);
|
|
223
|
+
for (let a = 0; a < t.length; a++) {
|
|
224
|
+
let o = t[a], s = n !== void 0 && R(o) ? e.get(o[n]) : r[a];
|
|
225
|
+
i[a] = K(s, o, n);
|
|
226
|
+
}
|
|
227
|
+
r.length !== t.length && (i.length = t.length);
|
|
228
|
+
} else {
|
|
229
|
+
for (let e of Object.keys(t)) i[e] = K(r[e], t[e], n);
|
|
230
|
+
for (let e of Object.keys(r)) Object.hasOwn(t, e) || delete i[e];
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function K(e, t, n) {
|
|
234
|
+
return R(e) && R(t) && Array.isArray(e) === Array.isArray(t) ? (G(z(e), t, n), e) : t;
|
|
235
|
+
}
|
|
236
|
+
// src/dom/tags.ts
|
|
237
|
+
var q = /* @__PURE__ */ d("a"), J = /* @__PURE__ */ d("abbr"), Y = /* @__PURE__ */ d("address"), X = /* @__PURE__ */ d("area"), Z = /* @__PURE__ */ d("article"), Q = /* @__PURE__ */ d("aside"), ne = /* @__PURE__ */ d("audio"), re = /* @__PURE__ */ d("b"), ie = /* @__PURE__ */ d("base"), ae = /* @__PURE__ */ d("bdi"), oe = /* @__PURE__ */ d("bdo"), se = /* @__PURE__ */ d("blockquote"), ce = /* @__PURE__ */ d("body"), le = /* @__PURE__ */ d("br"), ue = /* @__PURE__ */ d("button"), de = /* @__PURE__ */ d("canvas"), fe = /* @__PURE__ */ d("caption"), pe = /* @__PURE__ */ d("cite"), me = /* @__PURE__ */ d("code"), he = /* @__PURE__ */ d("col"), ge = /* @__PURE__ */ d("colgroup"), _e = /* @__PURE__ */ d("data"), ve = /* @__PURE__ */ d("datalist"), ye = /* @__PURE__ */ d("dd"), be = /* @__PURE__ */ d("del"), xe = /* @__PURE__ */ d("details"), Se = /* @__PURE__ */ d("dfn"), Ce = /* @__PURE__ */ d("dialog"), we = /* @__PURE__ */ d("div"), Te = /* @__PURE__ */ d("dl"), Ee = /* @__PURE__ */ d("dt"), De = /* @__PURE__ */ d("em"), Oe = /* @__PURE__ */ d("embed"), ke = /* @__PURE__ */ d("fieldset"), Ae = /* @__PURE__ */ d("figcaption"), je = /* @__PURE__ */ d("figure"), Me = /* @__PURE__ */ d("footer"), Ne = /* @__PURE__ */ d("form"), Pe = /* @__PURE__ */ d("h1"), Fe = /* @__PURE__ */ d("h2"), Ie = /* @__PURE__ */ d("h3"), Le = /* @__PURE__ */ d("h4"), Re = /* @__PURE__ */ d("h5"), ze = /* @__PURE__ */ d("h6"), Be = /* @__PURE__ */ d("head"), Ve = /* @__PURE__ */ d("header"), He = /* @__PURE__ */ d("hgroup"), Ue = /* @__PURE__ */ d("hr"), We = /* @__PURE__ */ d("html"), Ge = /* @__PURE__ */ d("i"), Ke = /* @__PURE__ */ d("iframe"), qe = /* @__PURE__ */ d("img"), Je = /* @__PURE__ */ d("input"), Ye = /* @__PURE__ */ d("ins"), Xe = /* @__PURE__ */ d("kbd"), Ze = /* @__PURE__ */ d("label"), Qe = /* @__PURE__ */ d("legend"), $e = /* @__PURE__ */ d("li"), et = /* @__PURE__ */ d("link"), tt = /* @__PURE__ */ d("main"), nt = /* @__PURE__ */ d("map"), rt = /* @__PURE__ */ d("mark"), it = /* @__PURE__ */ d("menu"), at = /* @__PURE__ */ d("meta"), ot = /* @__PURE__ */ d("meter"), st = /* @__PURE__ */ d("nav"), ct = /* @__PURE__ */ d("noscript"), lt = /* @__PURE__ */ d("object"), ut = /* @__PURE__ */ d("ol"), dt = /* @__PURE__ */ d("optgroup"), ft = /* @__PURE__ */ d("option"), pt = /* @__PURE__ */ d("output"), mt = /* @__PURE__ */ d("p"), ht = /* @__PURE__ */ d("picture"), gt = /* @__PURE__ */ d("pre"), _t = /* @__PURE__ */ d("progress"), vt = /* @__PURE__ */ d("q"), yt = /* @__PURE__ */ d("rp"), bt = /* @__PURE__ */ d("rt"), xt = /* @__PURE__ */ d("ruby"), St = /* @__PURE__ */ d("s"), Ct = /* @__PURE__ */ d("samp"), wt = /* @__PURE__ */ d("script"), Tt = /* @__PURE__ */ d("search"), Et = /* @__PURE__ */ d("section"), Dt = /* @__PURE__ */ d("select"), Ot = /* @__PURE__ */ d("slot"), kt = /* @__PURE__ */ d("small"), At = /* @__PURE__ */ d("source"), jt = /* @__PURE__ */ d("span"), Mt = /* @__PURE__ */ d("strong"), Nt = /* @__PURE__ */ d("style"), Pt = /* @__PURE__ */ d("sub"), Ft = /* @__PURE__ */ d("summary"), It = /* @__PURE__ */ d("sup"), Lt = /* @__PURE__ */ d("table"), Rt = /* @__PURE__ */ d("tbody"), zt = /* @__PURE__ */ d("td"), Bt = /* @__PURE__ */ d("template"), $ = /* @__PURE__ */ d("textarea"), Vt = /* @__PURE__ */ d("tfoot"), Ht = /* @__PURE__ */ d("th"), Ut = /* @__PURE__ */ d("thead"), Wt = /* @__PURE__ */ d("time"), Gt = /* @__PURE__ */ d("title"), Kt = /* @__PURE__ */ d("tr"), qt = /* @__PURE__ */ d("track"), Jt = /* @__PURE__ */ d("u"), Yt = /* @__PURE__ */ d("ul"), Xt = /* @__PURE__ */ d("var"), Zt = /* @__PURE__ */ d("video"), Qt = /* @__PURE__ */ d("wbr");
|
|
238
|
+
// src/dom/mount.ts
|
|
239
|
+
function $t(e, n) {
|
|
240
|
+
if (n === null) throw Error("[keits] no target");
|
|
241
|
+
let r = t.marker(), i = t.marker();
|
|
242
|
+
n.append(r, i);
|
|
243
|
+
let a = T((t) => (c(n, e(), i), t));
|
|
244
|
+
return () => {
|
|
245
|
+
a();
|
|
246
|
+
let e = r;
|
|
247
|
+
for (; e !== null;) {
|
|
248
|
+
let t = e === i ? null : e.nextSibling;
|
|
249
|
+
e.remove(), e = t;
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
// src/dom/unsafe.ts
|
|
254
|
+
function en(e) {
|
|
255
|
+
let t = document.createElement("template");
|
|
256
|
+
return t.innerHTML = e, t.content;
|
|
257
|
+
}
|
|
258
|
+
export { q as $a, J as $abbr, Y as $address, X as $area, Z as $article, Q as $aside, ne as $audio, re as $b, ie as $base, ae as $bdi, oe as $bdo, se as $blockquote, ce as $body, le as $br, ue as $button, de as $canvas, fe as $caption, pe as $cite, me as $code, he as $col, ge as $colgroup, _e as $data, ve as $datalist, ye as $dd, be as $del, xe as $details, Se as $dfn, Ce as $dialog, we as $div, Te as $dl, Ee as $dt, De as $em, Oe as $embed, ke as $fieldset, Ae as $figcaption, je as $figure, Me as $footer, Ne as $form, Pe as $h1, Fe as $h2, Ie as $h3, Le as $h4, Re as $h5, ze as $h6, Be as $head, Ve as $header, He as $hgroup, Ue as $hr, We as $html, Ge as $i, Ke as $iframe, qe as $img, Je as $input, Ye as $ins, Xe as $kbd, Ze as $label, Qe as $legend, $e as $li, et as $link, tt as $main, nt as $map, rt as $mark, it as $menu, at as $meta, ot as $meter, st as $nav, ct as $noscript, lt as $object, ut as $ol, dt as $optgroup, ft as $option, pt as $output, mt as $p, ht as $picture, gt as $pre, _t as $progress, vt as $q, yt as $rp, bt as $rt, xt as $ruby, St as $s, Ct as $samp, wt as $script, Tt as $search, Et as $section, Dt as $select, Ot as $slot, kt as $small, At as $source, jt as $span, Mt as $strong, Nt as $style, Pt as $sub, Ft as $summary, It as $sup, Lt as $table, Rt as $tbody, zt as $td, Bt as $template, $ as $textarea, Vt as $tfoot, Ht as $th, Ut as $thead, Wt as $time, Gt as $title, Kt as $tr, qt as $track, Jt as $u, Yt as $ul, Xt as $var, Zt as $video, Qt as $wbr, h as batch, ee as catchError, b as computed, O as createContext, T as createRoot, f as effect, C as getOwner, d as html, c as insert, S as isServer, u as isStaticRender, $t as mount, E as onCleanup, D as onMount, k as provide, W as reconcile, te as renderStatic, w as runWithOwner, y as signal, I as store, en as unsafeHTML, v as untrack, L as unwrap, A as useContext };
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
var e = null, t = null, n = 0, r = 0, i = null, a = 0, o = 0, s = 0, c = [], l = [], u = [], d = 0;
|
|
2
|
+
function f(t) {
|
|
3
|
+
let r = e;
|
|
4
|
+
r !== null && t.seenBy !== n && (t.seenBy = n, i === null && r.sources[a] === t ? a++ : ((i ??= []).push(t), t.observers.push(r)));
|
|
5
|
+
}
|
|
6
|
+
function ee() {
|
|
7
|
+
return e !== null;
|
|
8
|
+
}
|
|
9
|
+
function p(e) {
|
|
10
|
+
if (e.observers.length !== 0) {
|
|
11
|
+
o++;
|
|
12
|
+
try {
|
|
13
|
+
for (let t of e.observers) m(t, 2);
|
|
14
|
+
} finally {
|
|
15
|
+
S();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function m(e, t) {
|
|
20
|
+
if (e.state >= t) return;
|
|
21
|
+
let n = e.state === 0;
|
|
22
|
+
if (e.state = t, n) {
|
|
23
|
+
if (e.kind === 1) c.push(e);
|
|
24
|
+
else for (let t of e.observers) m(t, 1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function h(e) {
|
|
28
|
+
if (e.state === 1) {
|
|
29
|
+
for (let t of e.sources) if (t.kind === 2 && (h(t), e.state === 2)) break;
|
|
30
|
+
}
|
|
31
|
+
e.state === 2 ? e.kind === 1 ? _(e) : g(e) : e.state = 0;
|
|
32
|
+
}
|
|
33
|
+
function g(e) {
|
|
34
|
+
let t;
|
|
35
|
+
e.computing = !0;
|
|
36
|
+
try {
|
|
37
|
+
let n = v(e, () => e.fn(e.value));
|
|
38
|
+
t = !e.hasValue || e.hasError || e.equals === !1 || !e.equals(e.value, n), t && (e.value = n), e.hasValue = !0, e.hasError = !1, e.error = void 0;
|
|
39
|
+
} catch (n) {
|
|
40
|
+
t = !0, e.hasError = !0, e.error = n;
|
|
41
|
+
} finally {
|
|
42
|
+
e.computing = !1;
|
|
43
|
+
}
|
|
44
|
+
if (t) for (let t of e.observers) t.state === 1 && (t.state = 2);
|
|
45
|
+
}
|
|
46
|
+
function _(e) {
|
|
47
|
+
try {
|
|
48
|
+
v(e, e.fn);
|
|
49
|
+
} catch (t) {
|
|
50
|
+
j(t, e);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function v(o, s) {
|
|
54
|
+
k(o);
|
|
55
|
+
let c = e, l = t, u = n, d = i, f = a;
|
|
56
|
+
e = o, t = o, n = ++r, i = null, a = 0, o.state = 0;
|
|
57
|
+
try {
|
|
58
|
+
return s();
|
|
59
|
+
} finally {
|
|
60
|
+
y(o, i, a), e = c, t = l, n = u, i = d, a = f;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function y(e, t, n) {
|
|
64
|
+
if (e.disposed) {
|
|
65
|
+
if (t !== null) for (let n of t) b(n, e);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
let r = e.sources;
|
|
69
|
+
for (let t = n; t < r.length; t++) b(r[t], e);
|
|
70
|
+
if (r.length = n, t !== null) for (let e of t) r.push(e);
|
|
71
|
+
}
|
|
72
|
+
function b(e, t) {
|
|
73
|
+
let n = e.observers, r = n.lastIndexOf(t);
|
|
74
|
+
r !== -1 && (n[r] = n[n.length - 1], n.pop());
|
|
75
|
+
}
|
|
76
|
+
function x(e) {
|
|
77
|
+
o++;
|
|
78
|
+
try {
|
|
79
|
+
return e();
|
|
80
|
+
} finally {
|
|
81
|
+
S();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function S() {
|
|
85
|
+
--o === 0 && C();
|
|
86
|
+
}
|
|
87
|
+
function C() {
|
|
88
|
+
do
|
|
89
|
+
T(), l.length > 0 && w();
|
|
90
|
+
while (c.length > 0 || l.length > 0);
|
|
91
|
+
if (u.length > 0) {
|
|
92
|
+
let e = u.splice(0);
|
|
93
|
+
throw e.length === 1 ? e[0] : AggregateError(e, "[keits] multiple unhandled errors");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function w() {
|
|
97
|
+
o++;
|
|
98
|
+
let e = l.splice(0);
|
|
99
|
+
try {
|
|
100
|
+
for (let { owner: t, fn: n } of e) if (!t?.disposed) try {
|
|
101
|
+
O(t, n);
|
|
102
|
+
} catch (e) {
|
|
103
|
+
j(e, t);
|
|
104
|
+
}
|
|
105
|
+
} finally {
|
|
106
|
+
o--;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function T() {
|
|
110
|
+
o++;
|
|
111
|
+
let e = ++s, t = !1;
|
|
112
|
+
try {
|
|
113
|
+
for (let t = 0; t < c.length; t++) {
|
|
114
|
+
let n = c[t];
|
|
115
|
+
n.state !== 0 && (n.flushId !== e && (n.flushId = e, n.flushRuns = 0), ++n.flushRuns > 100 ? (n.state = 0, j(ne(n), n)) : te(n));
|
|
116
|
+
}
|
|
117
|
+
t = !0;
|
|
118
|
+
} finally {
|
|
119
|
+
if (!t) for (let e of c) e.state = 0;
|
|
120
|
+
c.length = 0, o--;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function te(e) {
|
|
124
|
+
let t = [];
|
|
125
|
+
for (let n = e.owner; n !== null; n = n.owner) n.kind !== 3 && n.state !== 0 && t.push(n);
|
|
126
|
+
for (let e = t.length - 1; e >= 0; e--) h(t[e]);
|
|
127
|
+
h(e);
|
|
128
|
+
}
|
|
129
|
+
function ne(e) {
|
|
130
|
+
return /* @__PURE__ */ Error("[keits] infinite update loop");
|
|
131
|
+
}
|
|
132
|
+
function re(t) {
|
|
133
|
+
let n = e;
|
|
134
|
+
e = null;
|
|
135
|
+
try {
|
|
136
|
+
return t();
|
|
137
|
+
} finally {
|
|
138
|
+
e = n;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function E(e) {
|
|
142
|
+
let n = t;
|
|
143
|
+
e.owner = n, n !== null && (n.children ??= []).push(e);
|
|
144
|
+
}
|
|
145
|
+
function D() {
|
|
146
|
+
return t;
|
|
147
|
+
}
|
|
148
|
+
function O(n, r) {
|
|
149
|
+
let i = t, a = e;
|
|
150
|
+
t = n, e = null;
|
|
151
|
+
try {
|
|
152
|
+
return r();
|
|
153
|
+
} finally {
|
|
154
|
+
t = i, e = a;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function ie(e) {
|
|
158
|
+
return t !== null && ((t.cleanups ??= []).push(e), !0);
|
|
159
|
+
}
|
|
160
|
+
function ae(e) {
|
|
161
|
+
d > 0 || l.push({
|
|
162
|
+
owner: t,
|
|
163
|
+
fn: e
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function k(e) {
|
|
167
|
+
let t = e.children, n = e.cleanups;
|
|
168
|
+
if (e.children = null, e.cleanups = null, t !== null) for (let e = t.length - 1; e >= 0; e--) A(t[e]);
|
|
169
|
+
if (n !== null) for (let t = n.length - 1; t >= 0; t--) try {
|
|
170
|
+
n[t]();
|
|
171
|
+
} catch (t) {
|
|
172
|
+
j(t, e);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function A(e) {
|
|
176
|
+
if (!e.disposed) {
|
|
177
|
+
if (e.disposed = !0, e.kind !== 3) {
|
|
178
|
+
for (let t of e.sources) b(t, e);
|
|
179
|
+
e.sources.length = 0, e.state = 0;
|
|
180
|
+
}
|
|
181
|
+
k(e);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function j(e, t) {
|
|
185
|
+
for (let n = t; n !== null; n = n.owner) {
|
|
186
|
+
if (n.kind !== 3 || n.handler === null || n.disposed) continue;
|
|
187
|
+
let t = n.handler;
|
|
188
|
+
try {
|
|
189
|
+
O(n.owner, () => t(e));
|
|
190
|
+
return;
|
|
191
|
+
} catch (t) {
|
|
192
|
+
e = t;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (o === 0) throw e;
|
|
196
|
+
u.push(e);
|
|
197
|
+
}
|
|
198
|
+
function M() {
|
|
199
|
+
return d > 0;
|
|
200
|
+
}
|
|
201
|
+
function N(e) {
|
|
202
|
+
d++;
|
|
203
|
+
try {
|
|
204
|
+
return e();
|
|
205
|
+
} finally {
|
|
206
|
+
d--;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// src/core/effect.ts
|
|
210
|
+
function P(e, t) {
|
|
211
|
+
if (M()) return;
|
|
212
|
+
let n = {
|
|
213
|
+
kind: 1,
|
|
214
|
+
fn: e,
|
|
215
|
+
state: 0,
|
|
216
|
+
sources: [],
|
|
217
|
+
flushId: 0,
|
|
218
|
+
flushRuns: 0,
|
|
219
|
+
owner: null,
|
|
220
|
+
children: null,
|
|
221
|
+
cleanups: null,
|
|
222
|
+
disposed: !1
|
|
223
|
+
};
|
|
224
|
+
E(n), x(() => _(n));
|
|
225
|
+
}
|
|
226
|
+
var F = {
|
|
227
|
+
element: (e, t) => t === null ? document.createElement(e) : document.createElementNS(t, e),
|
|
228
|
+
text: (e) => document.createTextNode(e),
|
|
229
|
+
marker: () => document.createComment("")
|
|
230
|
+
};
|
|
231
|
+
// src/dom/render-effect.ts
|
|
232
|
+
function I(e) {
|
|
233
|
+
M() ? e() : P(e);
|
|
234
|
+
}
|
|
235
|
+
// src/dom/insert.ts
|
|
236
|
+
function L(e, t, n = null) {
|
|
237
|
+
if (t != null && typeof t != "boolean") {
|
|
238
|
+
if (typeof t == "function") return V(e, t, n);
|
|
239
|
+
if (R(t)) for (let r of t) L(e, r, n);
|
|
240
|
+
else typeof t == "object" ? e.insertBefore(t, n) : e.insertBefore(F.text(String(t)), n);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function R(e) {
|
|
244
|
+
return Array.isArray(e);
|
|
245
|
+
}
|
|
246
|
+
function z(e) {
|
|
247
|
+
return e === null || typeof e != "object" && typeof e != "function";
|
|
248
|
+
}
|
|
249
|
+
function B(e) {
|
|
250
|
+
return e == null || typeof e == "boolean" ? "" : String(e);
|
|
251
|
+
}
|
|
252
|
+
function V(e, t, n) {
|
|
253
|
+
let r = F.text("");
|
|
254
|
+
e.insertBefore(r, n);
|
|
255
|
+
let i = null, a = null;
|
|
256
|
+
I(() => {
|
|
257
|
+
let e = t();
|
|
258
|
+
if (i === null || a === null) {
|
|
259
|
+
if (z(e)) {
|
|
260
|
+
let t = B(e);
|
|
261
|
+
r.data !== t && (r.data = t);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
i = F.marker(), a = F.marker(), r.before(i), r.after(a), r.remove();
|
|
265
|
+
}
|
|
266
|
+
H(i, a), L(a.parentNode, e, a);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
function H(e, t) {
|
|
270
|
+
let n = e.nextSibling;
|
|
271
|
+
for (; n !== null && n !== t;) {
|
|
272
|
+
let e = n.nextSibling;
|
|
273
|
+
n.remove(), n = e;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// src/dom/events.ts
|
|
277
|
+
function U(e, t, n) {
|
|
278
|
+
let r = n, i;
|
|
279
|
+
if (Array.isArray(n) && ([r, i] = n), typeof r != "function") throw Error("[keits] bad handler");
|
|
280
|
+
M() || W(e, t.slice(2), r, i);
|
|
281
|
+
}
|
|
282
|
+
function W(e, t, n, r) {
|
|
283
|
+
let i = D();
|
|
284
|
+
e.addEventListener(t, (e) => {
|
|
285
|
+
x(() => {
|
|
286
|
+
try {
|
|
287
|
+
let t = O(i, () => n(e));
|
|
288
|
+
G(t) && t.then(void 0, (e) => x(() => j(e, i)));
|
|
289
|
+
} catch (e) {
|
|
290
|
+
j(e, i);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}, r);
|
|
294
|
+
}
|
|
295
|
+
function G(e) {
|
|
296
|
+
return typeof e?.then == "function";
|
|
297
|
+
}
|
|
298
|
+
// src/dom/namespaces.ts
|
|
299
|
+
var K = "http://www.w3.org/2000/svg", oe = /* @__PURE__ */ new Set([
|
|
300
|
+
"innerHTML",
|
|
301
|
+
"outerHTML",
|
|
302
|
+
"srcdoc"
|
|
303
|
+
]), q = /* @__PURE__ */ new Set([
|
|
304
|
+
"href",
|
|
305
|
+
"src",
|
|
306
|
+
"action",
|
|
307
|
+
"formAction",
|
|
308
|
+
"formaction",
|
|
309
|
+
"poster",
|
|
310
|
+
"cite",
|
|
311
|
+
"data",
|
|
312
|
+
"xlink:href"
|
|
313
|
+
]), se = "about:invalid#keits-blocked";
|
|
314
|
+
function J(e, t) {
|
|
315
|
+
for (let n in t) {
|
|
316
|
+
let r = t[n];
|
|
317
|
+
n !== "ref" && (n === "class" ? le(e, r) : n === "style" ? fe(e, r) : n.startsWith("on") ? U(e, n, r) : typeof r == "function" ? I(() => Y(e, n, r())) : Y(e, n, r));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function Y(e, t, n) {
|
|
321
|
+
if (oe.has(t)) throw Error("[keits] unsafe prop");
|
|
322
|
+
q.has(t) && typeof n == "string" && X(n) && (n = se), t in e && e.namespaceURI !== "http://www.w3.org/2000/svg" ? (e[t] = n, M() && ce(e, t, n)) : n == null || n === !1 ? e.removeAttribute(t) : e.setAttribute(t, n === !0 ? "" : String(n));
|
|
323
|
+
}
|
|
324
|
+
function X(e) {
|
|
325
|
+
return e.replace(/[\u0000-\u0020]/g, "").toLowerCase().startsWith("javascript");
|
|
326
|
+
}
|
|
327
|
+
function ce(e, t, n) {
|
|
328
|
+
t === "value" ? e.localName === "textarea" ? e.textContent = n == null ? "" : String(n) : n == null ? e.removeAttribute("value") : e.setAttribute("value", String(n)) : (t === "checked" || t === "selected") && e.toggleAttribute(t, n === !0);
|
|
329
|
+
}
|
|
330
|
+
function le(e, t) {
|
|
331
|
+
if (typeof t == "function") {
|
|
332
|
+
I(() => ue(e, de(t())));
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
let n = [];
|
|
336
|
+
Z(t, n, (t, n) => {
|
|
337
|
+
I(() => e.classList.toggle(t, n()));
|
|
338
|
+
}), n.length > 0 && e.classList.add(...n);
|
|
339
|
+
}
|
|
340
|
+
function ue(e, t) {
|
|
341
|
+
t === "" ? e.removeAttribute("class") : e.setAttribute("class", t);
|
|
342
|
+
}
|
|
343
|
+
function Z(e, t, n) {
|
|
344
|
+
if (e) {
|
|
345
|
+
if (typeof e == "string") for (let n of e.split(/\s+/)) n && t.push(n);
|
|
346
|
+
else if (Array.isArray(e)) for (let r of e) Z(r, t, n);
|
|
347
|
+
else for (let [r, i] of Object.entries(e)) typeof i == "function" ? n ? n(r, i) : i() && t.push(r) : i && t.push(r);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
function de(e) {
|
|
351
|
+
let t = [];
|
|
352
|
+
return Z(e, t), t.join(" ");
|
|
353
|
+
}
|
|
354
|
+
function fe(e, t) {
|
|
355
|
+
let n = e.style;
|
|
356
|
+
if (typeof t == "function") {
|
|
357
|
+
let e = [];
|
|
358
|
+
I(() => {
|
|
359
|
+
let r = t();
|
|
360
|
+
if (typeof r == "string" || r == null) {
|
|
361
|
+
n.cssText = r ?? "", e = [];
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
let i = Object.keys(r);
|
|
365
|
+
for (let t of e) t in r || n.removeProperty(t);
|
|
366
|
+
for (let e of i) Q(n, e, pe(r[e]));
|
|
367
|
+
e = i;
|
|
368
|
+
});
|
|
369
|
+
} else if (typeof t == "string") n.cssText = t;
|
|
370
|
+
else if (t != null) for (let [e, r] of Object.entries(t)) typeof r == "function" ? I(() => Q(n, e, r())) : Q(n, e, r);
|
|
371
|
+
}
|
|
372
|
+
function pe(e) {
|
|
373
|
+
return typeof e == "function" ? e() : e;
|
|
374
|
+
}
|
|
375
|
+
function Q(e, t, n) {
|
|
376
|
+
n == null || n === "" ? e.removeProperty(t) : e.setProperty(t, String(n));
|
|
377
|
+
}
|
|
378
|
+
// src/dom/element.ts
|
|
379
|
+
function me(e) {
|
|
380
|
+
return (t, n) => {
|
|
381
|
+
let r = F.element(e, null);
|
|
382
|
+
return $(t) ? (J(r, t), L(r, n), typeof t.ref == "function" && t.ref(r)) : t == null ? L(r, n) : L(r, t), r;
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
function he(e, t) {
|
|
386
|
+
return (n, r) => {
|
|
387
|
+
let i = F.element(e, t);
|
|
388
|
+
return $(n) ? (J(i, n), L(i, r), typeof n.ref == "function" && n.ref(i)) : n == null ? L(i, r) : L(i, n), i;
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
function $(e) {
|
|
392
|
+
return typeof e == "object" && !!e && !Array.isArray(e) && typeof e.nodeType != "number";
|
|
393
|
+
}
|
|
394
|
+
export { O as _, F as a, h as b, ae as c, A as d, D as f, p as g, ee as h, L as i, E as l, M as m, me as n, P as o, j as p, K as r, ie as s, he as t, x as u, f as v, N as x, re as y };
|
package/dist/prod/svg.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { r as e, t } from "./shared/element-C8c5hIhH.js";
|
|
2
|
+
// src/svg/element.ts
|
|
3
|
+
function n(n) {
|
|
4
|
+
return t(n, e);
|
|
5
|
+
}
|
|
6
|
+
// src/svg/tags.ts
|
|
7
|
+
var r = /* @__PURE__ */ n("a"), i = /* @__PURE__ */ n("animate"), a = /* @__PURE__ */ n("animateMotion"), o = /* @__PURE__ */ n("animateTransform"), s = /* @__PURE__ */ n("circle"), c = /* @__PURE__ */ n("clipPath"), l = /* @__PURE__ */ n("defs"), u = /* @__PURE__ */ n("desc"), d = /* @__PURE__ */ n("ellipse"), f = /* @__PURE__ */ n("feBlend"), p = /* @__PURE__ */ n("feColorMatrix"), m = /* @__PURE__ */ n("feComponentTransfer"), h = /* @__PURE__ */ n("feComposite"), g = /* @__PURE__ */ n("feConvolveMatrix"), _ = /* @__PURE__ */ n("feDiffuseLighting"), v = /* @__PURE__ */ n("feDisplacementMap"), y = /* @__PURE__ */ n("feDistantLight"), b = /* @__PURE__ */ n("feDropShadow"), x = /* @__PURE__ */ n("feFlood"), S = /* @__PURE__ */ n("feFuncA"), C = /* @__PURE__ */ n("feFuncB"), w = /* @__PURE__ */ n("feFuncG"), T = /* @__PURE__ */ n("feFuncR"), E = /* @__PURE__ */ n("feGaussianBlur"), D = /* @__PURE__ */ n("feImage"), O = /* @__PURE__ */ n("feMerge"), k = /* @__PURE__ */ n("feMergeNode"), A = /* @__PURE__ */ n("feMorphology"), j = /* @__PURE__ */ n("feOffset"), M = /* @__PURE__ */ n("fePointLight"), N = /* @__PURE__ */ n("feSpecularLighting"), P = /* @__PURE__ */ n("feSpotLight"), F = /* @__PURE__ */ n("feTile"), I = /* @__PURE__ */ n("feTurbulence"), L = /* @__PURE__ */ n("filter"), ee = /* @__PURE__ */ n("foreignObject"), R = /* @__PURE__ */ n("g"), z = /* @__PURE__ */ n("image"), B = /* @__PURE__ */ n("line"), V = /* @__PURE__ */ n("linearGradient"), H = /* @__PURE__ */ n("marker"), U = /* @__PURE__ */ n("mask"), W = /* @__PURE__ */ n("metadata"), G = /* @__PURE__ */ n("mpath"), K = /* @__PURE__ */ n("path"), q = /* @__PURE__ */ n("pattern"), J = /* @__PURE__ */ n("polygon"), Y = /* @__PURE__ */ n("polyline"), X = /* @__PURE__ */ n("radialGradient"), Z = /* @__PURE__ */ n("rect"), Q = /* @__PURE__ */ n("script"), $ = /* @__PURE__ */ n("set"), te = /* @__PURE__ */ n("stop"), ne = /* @__PURE__ */ n("style"), re = /* @__PURE__ */ n("svg"), ie = /* @__PURE__ */ n("switch"), ae = /* @__PURE__ */ n("symbol"), oe = /* @__PURE__ */ n("text"), se = /* @__PURE__ */ n("textPath"), ce = /* @__PURE__ */ n("title"), le = /* @__PURE__ */ n("tspan"), ue = /* @__PURE__ */ n("use"), de = /* @__PURE__ */ n("view");
|
|
8
|
+
export { r as $a, i as $animate, a as $animateMotion, o as $animateTransform, s as $circle, c as $clipPath, l as $defs, u as $desc, d as $ellipse, f as $feBlend, p as $feColorMatrix, m as $feComponentTransfer, h as $feComposite, g as $feConvolveMatrix, _ as $feDiffuseLighting, v as $feDisplacementMap, y as $feDistantLight, b as $feDropShadow, x as $feFlood, S as $feFuncA, C as $feFuncB, w as $feFuncG, T as $feFuncR, E as $feGaussianBlur, D as $feImage, O as $feMerge, k as $feMergeNode, A as $feMorphology, j as $feOffset, M as $fePointLight, N as $feSpecularLighting, P as $feSpotLight, F as $feTile, I as $feTurbulence, L as $filter, ee as $foreignObject, R as $g, z as $image, B as $line, V as $linearGradient, H as $marker, U as $mask, W as $metadata, G as $mpath, K as $path, q as $pattern, J as $polygon, Y as $polyline, X as $radialGradient, Z as $rect, Q as $script, $ as $set, te as $stop, ne as $style, re as $svg, ie as $switch, ae as $symbol, oe as $text, se as $textPath, ce as $title, le as $tspan, ue as $use, de as $view, n as svg };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface Context<T> {
|
|
2
|
+
readonly defaultValue: T;
|
|
3
|
+
readonly name?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ContextOptions {
|
|
6
|
+
name?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function createContext<T>(): Context<T | undefined>;
|
|
9
|
+
export declare function createContext<T>(defaultValue: T, options?: ContextOptions): Context<T>;
|
|
10
|
+
export declare function provide<T, R>(context: Context<T>, value: NoInfer<T>, fn: () => R): R;
|
|
11
|
+
export declare function useContext<T>(context: Context<T>): T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isServer: boolean;
|