keits 0.0.1 → 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.
@@ -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 };
@@ -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,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,2 @@
1
+ import type { Child } from "./types";
2
+ export declare function insert(parent: Node, child: Child, before?: Node | null): void;
@@ -0,0 +1,2 @@
1
+ import type { Child } from "./types";
2
+ export declare function mount(app: () => Child, target: Element | null): () => void;
@@ -0,0 +1 @@
1
+ export declare const SVG_NS = "http://www.w3.org/2000/svg";
@@ -0,0 +1,3 @@
1
+ export declare const BLOCKED_URL = "about:invalid#keits-blocked";
2
+ export declare function applyProps(element: Element, props: Record<string, unknown>): void;
3
+ export declare function setProp(element: Element, key: string, value: unknown): void;
@@ -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
+ (props?: Props<E> | null, children?: Child): E;
41
+ (children: Child): E;
42
+ }
43
+ export {};
@@ -0,0 +1 @@
1
+ export declare function unsafeHTML(markup: string): DocumentFragment;
@@ -7,3 +7,4 @@ export { isServer } from "./core/env";
7
7
  export { catchError, createRoot, getOwner, onCleanup, onMount, renderStatic, runWithOwner, type Owner } from "./core/owner";
8
8
  export { createContext, provide, useContext, type Context, type ContextOptions } from "./core/context";
9
9
  export { reconcile, store, unwrap, type ReconcileOptions, type SetStore, type Store, type StoreOptions } from "./core/store";
10
+ export * from "./dom/index";
@@ -0,0 +1,2 @@
1
+ import type { SvgElementFactory } from "./types";
2
+ export declare function svg<K extends keyof SVGElementTagNameMap>(tag: K): SvgElementFactory<SVGElementTagNameMap[K]>;
@@ -0,0 +1,3 @@
1
+ export * from "./tags";
2
+ export { svg } from "./element";
3
+ export type { SvgAttributeName, SvgElementFactory, SvgProps } from "./types";