keits 0.0.1 → 0.0.3
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/dist/dev/index.js +548 -430
- package/dist/dev/router.js +443 -0
- package/dist/dev/shared/element-C4DfKtZW.js +255 -0
- package/dist/dev/shared/graph-D6-x_CWC.js +324 -0
- package/dist/dev/shared/owner-DlUsXKXE.js +122 -0
- package/dist/dev/svg.js +70 -0
- package/dist/prod/index.js +359 -377
- package/dist/prod/router.js +343 -0
- package/dist/prod/shared/element-DUtXb3px.js +187 -0
- package/dist/prod/shared/graph-C_aA46c6.js +240 -0
- package/dist/prod/shared/owner-DgJNPM0P.js +104 -0
- package/dist/prod/svg.js +8 -0
- package/dist/types/async/index.d.ts +2 -0
- package/dist/types/async/lazy.d.ts +7 -0
- package/dist/types/async/resource.d.ts +23 -0
- package/dist/types/async/suspense-context.d.ts +4 -0
- package/dist/types/core/graph.d.ts +8 -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/flow/catch.d.ts +2 -0
- package/dist/types/flow/dynamic.d.ts +6 -0
- package/dist/types/flow/for.d.ts +7 -0
- package/dist/types/flow/if.d.ts +4 -0
- package/dist/types/flow/index.d.ts +8 -0
- package/dist/types/flow/portal.d.ts +2 -0
- package/dist/types/flow/range.d.ts +11 -0
- package/dist/types/flow/show.d.ts +1 -0
- package/dist/types/flow/suspense.d.ts +2 -0
- package/dist/types/flow/switch.d.ts +9 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/router/history.d.ts +21 -0
- package/dist/types/router/index.d.ts +3 -0
- package/dist/types/router/links.d.ts +1 -0
- package/dist/types/router/match.d.ts +15 -0
- package/dist/types/router/router.d.ts +10 -0
- package/dist/types/router/scroll.d.ts +5 -0
- package/dist/types/router/types.d.ts +87 -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 +31 -6
|
@@ -0,0 +1,240 @@
|
|
|
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 p() {
|
|
7
|
+
return e !== null;
|
|
8
|
+
}
|
|
9
|
+
function m(e) {
|
|
10
|
+
if (e.observers.length !== 0) {
|
|
11
|
+
o++;
|
|
12
|
+
try {
|
|
13
|
+
for (let t of e.observers) h(t, 2);
|
|
14
|
+
} finally {
|
|
15
|
+
C();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function h(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) h(t, 1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function g(e) {
|
|
28
|
+
if (e.state === 1) {
|
|
29
|
+
for (let t of e.sources) if (t.kind === 2 && (g(t), e.state === 2)) break;
|
|
30
|
+
}
|
|
31
|
+
e.state === 2 ? e.kind === 1 ? v(e) : _(e) : e.state = 0;
|
|
32
|
+
}
|
|
33
|
+
function _(e) {
|
|
34
|
+
let t;
|
|
35
|
+
e.computing = !0;
|
|
36
|
+
try {
|
|
37
|
+
let n = y(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 v(e) {
|
|
47
|
+
try {
|
|
48
|
+
y(e, e.fn);
|
|
49
|
+
} catch (t) {
|
|
50
|
+
z(t, e);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function y(o, s) {
|
|
54
|
+
L(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
|
+
b(o, i, a), e = c, t = l, n = u, i = d, a = f;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function b(e, t, n) {
|
|
64
|
+
if (e.disposed) {
|
|
65
|
+
if (t !== null) for (let n of t) x(n, e);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
let r = e.sources;
|
|
69
|
+
for (let t = n; t < r.length; t++) x(r[t], e);
|
|
70
|
+
if (r.length = n, t !== null) for (let e of t) r.push(e);
|
|
71
|
+
}
|
|
72
|
+
function x(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 S(e) {
|
|
77
|
+
o++;
|
|
78
|
+
try {
|
|
79
|
+
return e();
|
|
80
|
+
} finally {
|
|
81
|
+
C();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function C() {
|
|
85
|
+
--o === 0 && w();
|
|
86
|
+
}
|
|
87
|
+
function w() {
|
|
88
|
+
do
|
|
89
|
+
E(), l.length > 0 && T();
|
|
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 T() {
|
|
97
|
+
o++;
|
|
98
|
+
let e = l.splice(0);
|
|
99
|
+
try {
|
|
100
|
+
for (let { owner: t, fn: n } of e) if (!t?.disposed) try {
|
|
101
|
+
M(t, n);
|
|
102
|
+
} catch (e) {
|
|
103
|
+
z(e, t);
|
|
104
|
+
}
|
|
105
|
+
} finally {
|
|
106
|
+
o--;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function E() {
|
|
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, z(O(n), n)) : D(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 D(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--) g(t[e]);
|
|
127
|
+
g(e);
|
|
128
|
+
}
|
|
129
|
+
function O(e) {
|
|
130
|
+
return /* @__PURE__ */ Error("[keits] infinite update loop");
|
|
131
|
+
}
|
|
132
|
+
function k(t) {
|
|
133
|
+
let n = e;
|
|
134
|
+
e = null;
|
|
135
|
+
try {
|
|
136
|
+
return t();
|
|
137
|
+
} finally {
|
|
138
|
+
e = n;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function A(e) {
|
|
142
|
+
let n = t;
|
|
143
|
+
e.owner = n, n !== null && (n.children ??= []).push(e);
|
|
144
|
+
}
|
|
145
|
+
function j() {
|
|
146
|
+
return t;
|
|
147
|
+
}
|
|
148
|
+
function M(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 N(e) {
|
|
158
|
+
return t !== null && ((t.cleanups ??= []).push(e), !0);
|
|
159
|
+
}
|
|
160
|
+
function P(e) {
|
|
161
|
+
d > 0 || F(t, e);
|
|
162
|
+
}
|
|
163
|
+
function F(e, t) {
|
|
164
|
+
for (let n = e; n !== null; n = n.owner) if (n.kind === 3 && n.held) {
|
|
165
|
+
n.held.push({
|
|
166
|
+
owner: e,
|
|
167
|
+
fn: t
|
|
168
|
+
});
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
l.push({
|
|
172
|
+
owner: e,
|
|
173
|
+
fn: t
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function I(e) {
|
|
177
|
+
let t = {
|
|
178
|
+
kind: 3,
|
|
179
|
+
owner: null,
|
|
180
|
+
children: null,
|
|
181
|
+
cleanups: null,
|
|
182
|
+
disposed: !1,
|
|
183
|
+
handler: null,
|
|
184
|
+
held: []
|
|
185
|
+
};
|
|
186
|
+
return A(t), {
|
|
187
|
+
result: M(t, e),
|
|
188
|
+
release: () => {
|
|
189
|
+
let e = t.held;
|
|
190
|
+
if (e) {
|
|
191
|
+
t.held = null;
|
|
192
|
+
for (let { owner: t, fn: n } of e) F(t, n);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function L(e) {
|
|
198
|
+
let t = e.children, n = e.cleanups;
|
|
199
|
+
if (e.children = null, e.cleanups = null, t !== null) for (let e = t.length - 1; e >= 0; e--) R(t[e]);
|
|
200
|
+
if (n !== null) for (let t = n.length - 1; t >= 0; t--) try {
|
|
201
|
+
n[t]();
|
|
202
|
+
} catch (t) {
|
|
203
|
+
z(t, e);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function R(e) {
|
|
207
|
+
if (!e.disposed) {
|
|
208
|
+
if (e.disposed = !0, e.kind !== 3) {
|
|
209
|
+
for (let t of e.sources) x(t, e);
|
|
210
|
+
e.sources.length = 0, e.state = 0;
|
|
211
|
+
}
|
|
212
|
+
L(e);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function z(e, t) {
|
|
216
|
+
for (let n = t; n !== null; n = n.owner) {
|
|
217
|
+
if (n.kind !== 3 || n.handler === null || n.disposed) continue;
|
|
218
|
+
let t = n.handler;
|
|
219
|
+
try {
|
|
220
|
+
M(n.owner, () => t(e));
|
|
221
|
+
return;
|
|
222
|
+
} catch (t) {
|
|
223
|
+
e = t;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (o === 0) throw e;
|
|
227
|
+
u.push(e);
|
|
228
|
+
}
|
|
229
|
+
function B() {
|
|
230
|
+
return d > 0;
|
|
231
|
+
}
|
|
232
|
+
function V(e) {
|
|
233
|
+
d++;
|
|
234
|
+
try {
|
|
235
|
+
return e();
|
|
236
|
+
} finally {
|
|
237
|
+
d--;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
export { V as _, I as a, z as c, m as d, v as f, g, k as h, S as i, B as l, f as m, P as n, R as o, M as p, A as r, j as s, N as t, p as u };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { _ as e, c as t, d as n, g as r, i, m as a, n as o, o as s, p as c, r as l, s as u, t as d } from "./graph-C_aA46c6.js";
|
|
2
|
+
// src/core/signal.ts
|
|
3
|
+
function f(e, t) {
|
|
4
|
+
let r = {
|
|
5
|
+
kind: 0,
|
|
6
|
+
value: e,
|
|
7
|
+
equals: t?.equals ?? Object.is,
|
|
8
|
+
observers: [],
|
|
9
|
+
seenBy: 0
|
|
10
|
+
};
|
|
11
|
+
return Object.assign(() => (a(r), r.value), { set: (e) => {
|
|
12
|
+
let t = typeof e == "function" ? e(r.value) : e;
|
|
13
|
+
r.equals !== !1 && r.equals(r.value, t) || (r.value = t, n(r));
|
|
14
|
+
} });
|
|
15
|
+
}
|
|
16
|
+
// src/core/computed.ts
|
|
17
|
+
function p(e, t) {
|
|
18
|
+
let n = {
|
|
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(n), () => {
|
|
39
|
+
if (n.computing) throw m(n);
|
|
40
|
+
if (n.state !== 0 && r(n), a(n), n.hasError) throw n.error;
|
|
41
|
+
return n.value;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function m(e) {
|
|
45
|
+
return /* @__PURE__ */ Error("[keits] cycle detected");
|
|
46
|
+
}
|
|
47
|
+
// src/core/owner.ts
|
|
48
|
+
function h() {
|
|
49
|
+
return u();
|
|
50
|
+
}
|
|
51
|
+
function g(e, t) {
|
|
52
|
+
return c(e, t);
|
|
53
|
+
}
|
|
54
|
+
function _(e) {
|
|
55
|
+
let t = {
|
|
56
|
+
kind: 3,
|
|
57
|
+
owner: u(),
|
|
58
|
+
children: null,
|
|
59
|
+
cleanups: null,
|
|
60
|
+
disposed: !1,
|
|
61
|
+
handler: null
|
|
62
|
+
}, n = () => i(() => s(t));
|
|
63
|
+
return i(() => {
|
|
64
|
+
try {
|
|
65
|
+
return c(t, () => e(n));
|
|
66
|
+
} catch (e) {
|
|
67
|
+
throw s(t), e;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function v(e) {
|
|
72
|
+
d(e);
|
|
73
|
+
}
|
|
74
|
+
function y(e) {
|
|
75
|
+
o(e);
|
|
76
|
+
}
|
|
77
|
+
function b(e, n) {
|
|
78
|
+
let r = {
|
|
79
|
+
kind: 3,
|
|
80
|
+
owner: null,
|
|
81
|
+
children: null,
|
|
82
|
+
cleanups: null,
|
|
83
|
+
disposed: !1,
|
|
84
|
+
handler: n
|
|
85
|
+
};
|
|
86
|
+
return l(r), i(() => {
|
|
87
|
+
try {
|
|
88
|
+
return c(r, e);
|
|
89
|
+
} catch (e) {
|
|
90
|
+
t(e, r);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function x(t) {
|
|
96
|
+
return e(() => _((e) => {
|
|
97
|
+
try {
|
|
98
|
+
return t();
|
|
99
|
+
} finally {
|
|
100
|
+
e();
|
|
101
|
+
}
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
export { y as a, p as c, v as i, f as l, _ as n, x as o, h as r, g as s, b as t };
|
package/dist/prod/svg.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { r as e, t } from "./shared/element-DUtXb3px.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,23 @@
|
|
|
1
|
+
import type { Accessor } from "../core/types";
|
|
2
|
+
export type ResourceState = "unresolved" | "pending" | "ready" | "refreshing" | "errored";
|
|
3
|
+
export interface FetchInfo<T> {
|
|
4
|
+
signal: AbortSignal;
|
|
5
|
+
refetching: boolean;
|
|
6
|
+
value: T | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface ResourceOptions<T> {
|
|
9
|
+
initialValue?: T;
|
|
10
|
+
}
|
|
11
|
+
export interface Resource<T> extends Accessor<T | undefined> {
|
|
12
|
+
state: Accessor<ResourceState>;
|
|
13
|
+
loading: Accessor<boolean>;
|
|
14
|
+
error: Accessor<unknown>;
|
|
15
|
+
refetch(): Promise<void>;
|
|
16
|
+
mutate(value: T | undefined): void;
|
|
17
|
+
optimistic(update: (current: T | undefined) => T, action: () => PromiseLike<unknown>): Promise<boolean>;
|
|
18
|
+
}
|
|
19
|
+
type Fetcher<S, T> = (source: S, info: FetchInfo<T>) => T | PromiseLike<T>;
|
|
20
|
+
type Source<S> = () => S | null | undefined | false;
|
|
21
|
+
export declare function resource<T>(fetcher: (info: FetchInfo<T>) => T | PromiseLike<T>, options?: ResourceOptions<T>): Resource<T>;
|
|
22
|
+
export declare function resource<T, S>(source: Source<S>, fetcher: Fetcher<S, T>, options?: ResourceOptions<T>): Resource<T>;
|
|
23
|
+
export {};
|
|
@@ -48,6 +48,10 @@ export interface RootNode extends OwnerFields {
|
|
|
48
48
|
key: object;
|
|
49
49
|
value: unknown;
|
|
50
50
|
};
|
|
51
|
+
held?: {
|
|
52
|
+
owner: Owner | null;
|
|
53
|
+
fn: () => void;
|
|
54
|
+
}[] | null;
|
|
51
55
|
}
|
|
52
56
|
export type Source = SignalSource | ComputedNode;
|
|
53
57
|
export type Computation = EffectNode | ComputedNode;
|
|
@@ -66,6 +70,10 @@ export declare function getOwner(): Owner | null;
|
|
|
66
70
|
export declare function runWithOwner<T>(owner: Owner | null, fn: () => T): T;
|
|
67
71
|
export declare function addCleanup(fn: () => void): boolean;
|
|
68
72
|
export declare function addMount(fn: () => void): void;
|
|
73
|
+
export declare function deferMounts<T>(fn: () => T): {
|
|
74
|
+
result: T;
|
|
75
|
+
release: () => void;
|
|
76
|
+
};
|
|
69
77
|
export declare function dispose(node: Owner): void;
|
|
70
78
|
export declare function handleError(error: unknown, owner: Owner | null): void;
|
|
71
79
|
export declare function isStaticRender(): boolean;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Child, ElementFactory } from "./types";
|
|
2
|
+
export declare function html<K extends keyof HTMLElementTagNameMap>(tag: K): ElementFactory<HTMLElementTagNameMap[K]>;
|
|
3
|
+
export declare function createFactory(tag: string, namespace: string | null): (first?: unknown, children?: Child) => Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function applyEvent(element: Element, key: string, value: unknown): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface NodeHooks {
|
|
2
|
+
element(tag: string, namespace: string | null): Element;
|
|
3
|
+
text(value: string): Text;
|
|
4
|
+
marker(): Comment;
|
|
5
|
+
}
|
|
6
|
+
export declare const defaultHooks: NodeHooks;
|
|
7
|
+
export declare let hooks: NodeHooks;
|
|
8
|
+
export declare function setHooks(next: NodeHooks): NodeHooks;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./tags";
|
|
2
|
+
export { html } from "./element";
|
|
3
|
+
export { insert } from "./insert";
|
|
4
|
+
export { mount } from "./mount";
|
|
5
|
+
export { unsafeHTML } from "./unsafe";
|
|
6
|
+
export type { Child, ClassValue, ElementFactory, EventHandler, MaybeAccessor, Props, StyleValue } from "./types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SVG_NS = "http://www.w3.org/2000/svg";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function renderEffect(fn: () => void): void;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
export declare const $a: import("./types").ElementFactory<HTMLAnchorElement>;
|
|
2
|
+
export declare const $abbr: import("./types").ElementFactory<HTMLElement>;
|
|
3
|
+
export declare const $address: import("./types").ElementFactory<HTMLElement>;
|
|
4
|
+
export declare const $area: import("./types").ElementFactory<HTMLAreaElement>;
|
|
5
|
+
export declare const $article: import("./types").ElementFactory<HTMLElement>;
|
|
6
|
+
export declare const $aside: import("./types").ElementFactory<HTMLElement>;
|
|
7
|
+
export declare const $audio: import("./types").ElementFactory<HTMLAudioElement>;
|
|
8
|
+
export declare const $b: import("./types").ElementFactory<HTMLElement>;
|
|
9
|
+
export declare const $base: import("./types").ElementFactory<HTMLBaseElement>;
|
|
10
|
+
export declare const $bdi: import("./types").ElementFactory<HTMLElement>;
|
|
11
|
+
export declare const $bdo: import("./types").ElementFactory<HTMLElement>;
|
|
12
|
+
export declare const $blockquote: import("./types").ElementFactory<HTMLQuoteElement>;
|
|
13
|
+
export declare const $body: import("./types").ElementFactory<HTMLBodyElement>;
|
|
14
|
+
export declare const $br: import("./types").ElementFactory<HTMLBRElement>;
|
|
15
|
+
export declare const $button: import("./types").ElementFactory<HTMLButtonElement>;
|
|
16
|
+
export declare const $canvas: import("./types").ElementFactory<HTMLCanvasElement>;
|
|
17
|
+
export declare const $caption: import("./types").ElementFactory<HTMLTableCaptionElement>;
|
|
18
|
+
export declare const $cite: import("./types").ElementFactory<HTMLElement>;
|
|
19
|
+
export declare const $code: import("./types").ElementFactory<HTMLElement>;
|
|
20
|
+
export declare const $col: import("./types").ElementFactory<HTMLTableColElement>;
|
|
21
|
+
export declare const $colgroup: import("./types").ElementFactory<HTMLTableColElement>;
|
|
22
|
+
export declare const $data: import("./types").ElementFactory<HTMLDataElement>;
|
|
23
|
+
export declare const $datalist: import("./types").ElementFactory<HTMLDataListElement>;
|
|
24
|
+
export declare const $dd: import("./types").ElementFactory<HTMLElement>;
|
|
25
|
+
export declare const $del: import("./types").ElementFactory<HTMLModElement>;
|
|
26
|
+
export declare const $details: import("./types").ElementFactory<HTMLDetailsElement>;
|
|
27
|
+
export declare const $dfn: import("./types").ElementFactory<HTMLElement>;
|
|
28
|
+
export declare const $dialog: import("./types").ElementFactory<HTMLDialogElement>;
|
|
29
|
+
export declare const $div: import("./types").ElementFactory<HTMLDivElement>;
|
|
30
|
+
export declare const $dl: import("./types").ElementFactory<HTMLDListElement>;
|
|
31
|
+
export declare const $dt: import("./types").ElementFactory<HTMLElement>;
|
|
32
|
+
export declare const $em: import("./types").ElementFactory<HTMLElement>;
|
|
33
|
+
export declare const $embed: import("./types").ElementFactory<HTMLEmbedElement>;
|
|
34
|
+
export declare const $fieldset: import("./types").ElementFactory<HTMLFieldSetElement>;
|
|
35
|
+
export declare const $figcaption: import("./types").ElementFactory<HTMLElement>;
|
|
36
|
+
export declare const $figure: import("./types").ElementFactory<HTMLElement>;
|
|
37
|
+
export declare const $footer: import("./types").ElementFactory<HTMLElement>;
|
|
38
|
+
export declare const $form: import("./types").ElementFactory<HTMLFormElement>;
|
|
39
|
+
export declare const $h1: import("./types").ElementFactory<HTMLHeadingElement>;
|
|
40
|
+
export declare const $h2: import("./types").ElementFactory<HTMLHeadingElement>;
|
|
41
|
+
export declare const $h3: import("./types").ElementFactory<HTMLHeadingElement>;
|
|
42
|
+
export declare const $h4: import("./types").ElementFactory<HTMLHeadingElement>;
|
|
43
|
+
export declare const $h5: import("./types").ElementFactory<HTMLHeadingElement>;
|
|
44
|
+
export declare const $h6: import("./types").ElementFactory<HTMLHeadingElement>;
|
|
45
|
+
export declare const $head: import("./types").ElementFactory<HTMLHeadElement>;
|
|
46
|
+
export declare const $header: import("./types").ElementFactory<HTMLElement>;
|
|
47
|
+
export declare const $hgroup: import("./types").ElementFactory<HTMLElement>;
|
|
48
|
+
export declare const $hr: import("./types").ElementFactory<HTMLHRElement>;
|
|
49
|
+
export declare const $html: import("./types").ElementFactory<HTMLHtmlElement>;
|
|
50
|
+
export declare const $i: import("./types").ElementFactory<HTMLElement>;
|
|
51
|
+
export declare const $iframe: import("./types").ElementFactory<HTMLIFrameElement>;
|
|
52
|
+
export declare const $img: import("./types").ElementFactory<HTMLImageElement>;
|
|
53
|
+
export declare const $input: import("./types").ElementFactory<HTMLInputElement>;
|
|
54
|
+
export declare const $ins: import("./types").ElementFactory<HTMLModElement>;
|
|
55
|
+
export declare const $kbd: import("./types").ElementFactory<HTMLElement>;
|
|
56
|
+
export declare const $label: import("./types").ElementFactory<HTMLLabelElement>;
|
|
57
|
+
export declare const $legend: import("./types").ElementFactory<HTMLLegendElement>;
|
|
58
|
+
export declare const $li: import("./types").ElementFactory<HTMLLIElement>;
|
|
59
|
+
export declare const $link: import("./types").ElementFactory<HTMLLinkElement>;
|
|
60
|
+
export declare const $main: import("./types").ElementFactory<HTMLElement>;
|
|
61
|
+
export declare const $map: import("./types").ElementFactory<HTMLMapElement>;
|
|
62
|
+
export declare const $mark: import("./types").ElementFactory<HTMLElement>;
|
|
63
|
+
export declare const $menu: import("./types").ElementFactory<HTMLMenuElement>;
|
|
64
|
+
export declare const $meta: import("./types").ElementFactory<HTMLMetaElement>;
|
|
65
|
+
export declare const $meter: import("./types").ElementFactory<HTMLMeterElement>;
|
|
66
|
+
export declare const $nav: import("./types").ElementFactory<HTMLElement>;
|
|
67
|
+
export declare const $noscript: import("./types").ElementFactory<HTMLElement>;
|
|
68
|
+
export declare const $object: import("./types").ElementFactory<HTMLObjectElement>;
|
|
69
|
+
export declare const $ol: import("./types").ElementFactory<HTMLOListElement>;
|
|
70
|
+
export declare const $optgroup: import("./types").ElementFactory<HTMLOptGroupElement>;
|
|
71
|
+
export declare const $option: import("./types").ElementFactory<HTMLOptionElement>;
|
|
72
|
+
export declare const $output: import("./types").ElementFactory<HTMLOutputElement>;
|
|
73
|
+
export declare const $p: import("./types").ElementFactory<HTMLParagraphElement>;
|
|
74
|
+
export declare const $picture: import("./types").ElementFactory<HTMLPictureElement>;
|
|
75
|
+
export declare const $pre: import("./types").ElementFactory<HTMLPreElement>;
|
|
76
|
+
export declare const $progress: import("./types").ElementFactory<HTMLProgressElement>;
|
|
77
|
+
export declare const $q: import("./types").ElementFactory<HTMLQuoteElement>;
|
|
78
|
+
export declare const $rp: import("./types").ElementFactory<HTMLElement>;
|
|
79
|
+
export declare const $rt: import("./types").ElementFactory<HTMLElement>;
|
|
80
|
+
export declare const $ruby: import("./types").ElementFactory<HTMLElement>;
|
|
81
|
+
export declare const $s: import("./types").ElementFactory<HTMLElement>;
|
|
82
|
+
export declare const $samp: import("./types").ElementFactory<HTMLElement>;
|
|
83
|
+
export declare const $script: import("./types").ElementFactory<HTMLScriptElement>;
|
|
84
|
+
export declare const $search: import("./types").ElementFactory<HTMLElement>;
|
|
85
|
+
export declare const $section: import("./types").ElementFactory<HTMLElement>;
|
|
86
|
+
export declare const $select: import("./types").ElementFactory<HTMLSelectElement>;
|
|
87
|
+
export declare const $slot: import("./types").ElementFactory<HTMLSlotElement>;
|
|
88
|
+
export declare const $small: import("./types").ElementFactory<HTMLElement>;
|
|
89
|
+
export declare const $source: import("./types").ElementFactory<HTMLSourceElement>;
|
|
90
|
+
export declare const $span: import("./types").ElementFactory<HTMLSpanElement>;
|
|
91
|
+
export declare const $strong: import("./types").ElementFactory<HTMLElement>;
|
|
92
|
+
export declare const $style: import("./types").ElementFactory<HTMLStyleElement>;
|
|
93
|
+
export declare const $sub: import("./types").ElementFactory<HTMLElement>;
|
|
94
|
+
export declare const $summary: import("./types").ElementFactory<HTMLElement>;
|
|
95
|
+
export declare const $sup: import("./types").ElementFactory<HTMLElement>;
|
|
96
|
+
export declare const $table: import("./types").ElementFactory<HTMLTableElement>;
|
|
97
|
+
export declare const $tbody: import("./types").ElementFactory<HTMLTableSectionElement>;
|
|
98
|
+
export declare const $td: import("./types").ElementFactory<HTMLTableCellElement>;
|
|
99
|
+
export declare const $template: import("./types").ElementFactory<HTMLTemplateElement>;
|
|
100
|
+
export declare const $textarea: import("./types").ElementFactory<HTMLTextAreaElement>;
|
|
101
|
+
export declare const $tfoot: import("./types").ElementFactory<HTMLTableSectionElement>;
|
|
102
|
+
export declare const $th: import("./types").ElementFactory<HTMLTableCellElement>;
|
|
103
|
+
export declare const $thead: import("./types").ElementFactory<HTMLTableSectionElement>;
|
|
104
|
+
export declare const $time: import("./types").ElementFactory<HTMLTimeElement>;
|
|
105
|
+
export declare const $title: import("./types").ElementFactory<HTMLTitleElement>;
|
|
106
|
+
export declare const $tr: import("./types").ElementFactory<HTMLTableRowElement>;
|
|
107
|
+
export declare const $track: import("./types").ElementFactory<HTMLTrackElement>;
|
|
108
|
+
export declare const $u: import("./types").ElementFactory<HTMLElement>;
|
|
109
|
+
export declare const $ul: import("./types").ElementFactory<HTMLUListElement>;
|
|
110
|
+
export declare const $var: import("./types").ElementFactory<HTMLElement>;
|
|
111
|
+
export declare const $video: import("./types").ElementFactory<HTMLVideoElement>;
|
|
112
|
+
export declare const $wbr: import("./types").ElementFactory<HTMLElement>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type Child = Node | string | number | bigint | boolean | null | undefined | readonly Child[] | (() => Child);
|
|
2
|
+
type IfEquals<X, Y, Then, Else> = (<T>() => T extends X ? 1 : 2) extends <T>() => (T extends Y ? 1 : 2) ? Then : Else;
|
|
3
|
+
type WritableKeys<T> = {
|
|
4
|
+
[K in keyof T]-?: IfEquals<{
|
|
5
|
+
[Q in K]: T[K];
|
|
6
|
+
}, {
|
|
7
|
+
-readonly [Q in K]: T[K];
|
|
8
|
+
}, K, never>;
|
|
9
|
+
}[keyof T];
|
|
10
|
+
type Primitive = string | number | bigint | boolean | null | undefined;
|
|
11
|
+
type UnsafeKeys = "innerHTML" | "outerHTML" | "srcdoc";
|
|
12
|
+
export type MaybeAccessor<T> = T | (() => T);
|
|
13
|
+
type ElementProps<E> = {
|
|
14
|
+
[K in WritableKeys<E> as K extends UnsafeKeys ? never : E[K] extends Primitive ? K : never]?: MaybeAccessor<E[K]>;
|
|
15
|
+
};
|
|
16
|
+
export type AttributeValue = string | number | boolean | null | undefined;
|
|
17
|
+
export type AttributeProps = {
|
|
18
|
+
[key: `data-${string}`]: MaybeAccessor<AttributeValue>;
|
|
19
|
+
[key: `aria-${string}`]: MaybeAccessor<AttributeValue>;
|
|
20
|
+
};
|
|
21
|
+
export type ClassValue = string | null | undefined | false | {
|
|
22
|
+
readonly [name: string]: MaybeAccessor<boolean>;
|
|
23
|
+
} | readonly ClassValue[];
|
|
24
|
+
export type StyleValue = string | null | undefined | {
|
|
25
|
+
readonly [property: string]: MaybeAccessor<string | number | null | undefined>;
|
|
26
|
+
};
|
|
27
|
+
type EventMapOf<E> = E extends HTMLVideoElement ? HTMLVideoElementEventMap : E extends HTMLMediaElement ? HTMLMediaElementEventMap : E extends HTMLBodyElement ? HTMLBodyElementEventMap : E extends HTMLElement ? HTMLElementEventMap : E extends SVGElement ? SVGElementEventMap : ElementEventMap;
|
|
28
|
+
export type EventHandler<E extends Element, Ev extends Event> = (event: Ev & {
|
|
29
|
+
readonly currentTarget: E;
|
|
30
|
+
}) => unknown;
|
|
31
|
+
export type EventProps<E extends Element> = {
|
|
32
|
+
[K in keyof EventMapOf<E> & string as `on${K}`]?: EventHandler<E, EventMapOf<E>[K] & Event> | readonly [EventHandler<E, EventMapOf<E>[K] & Event>, AddEventListenerOptions];
|
|
33
|
+
};
|
|
34
|
+
export type Props<E extends Element> = ElementProps<E> & AttributeProps & EventProps<E> & {
|
|
35
|
+
class?: ClassValue | (() => ClassValue);
|
|
36
|
+
style?: StyleValue | (() => StyleValue);
|
|
37
|
+
ref?: (element: E) => void;
|
|
38
|
+
};
|
|
39
|
+
export interface ElementFactory<E extends Element> {
|
|
40
|
+
(children: Child): E;
|
|
41
|
+
(props?: Props<E> | null, children?: Child): E;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function unsafeHTML(markup: string): DocumentFragment;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Child } from "../dom/types";
|
|
2
|
+
export type Component<P> = (props: P) => Child;
|
|
3
|
+
type MaybeComponent<P> = Component<P> | null | undefined | false;
|
|
4
|
+
export declare function $dynamic(component: () => MaybeComponent<void>): Child;
|
|
5
|
+
export declare function $dynamic<P>(component: () => MaybeComponent<P>, props: P): Child;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Accessor } from "../core/types";
|
|
2
|
+
import type { Child } from "../dom/types";
|
|
3
|
+
export interface ForOptions {
|
|
4
|
+
fallback?: () => Child;
|
|
5
|
+
}
|
|
6
|
+
export declare function $for<T>(each: () => readonly T[] | null | undefined | false, render: (item: T, index: Accessor<number>) => Child, options?: ForOptions): Child;
|
|
7
|
+
export declare function longestIncreasing(sequence: readonly number[]): Set<number>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Accessor } from "../core/types";
|
|
2
|
+
import type { Child } from "../dom/types";
|
|
3
|
+
export type Truthy<T> = Exclude<T, null | undefined | false | 0 | "" | 0>;
|
|
4
|
+
export declare function $if<T>(when: () => T, then: (value: Accessor<Truthy<T>>) => Child, otherwise?: () => Child): Child;
|