keits 0.1.0 → 0.1.1
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/forms.js +4 -1
- package/dist/dev/index.js +5 -3
- package/dist/dev/shared/element-Bgf6SNbW.js +21 -0
- package/dist/dev/shared/{hydrate-C8cOsDDH.js → hydrate-g_akkVyT.js} +1 -1
- package/dist/dev/shared/{element-DXwmUAnz.js → insert-DadcXJL8.js} +97 -21
- package/dist/dev/shared/{mount-CDB2HgN5.js → mount-BtpMEhSZ.js} +1 -1
- package/dist/dev/static.js +2 -2
- package/dist/dev/svg.js +2 -2
- package/dist/dev/testing.js +32 -12
- package/dist/prod/forms.js +40 -38
- package/dist/prod/index.js +36 -36
- package/dist/prod/shared/element-B-0tH1YW.js +15 -0
- package/dist/prod/shared/{hydrate-kKnJbkV7.js → hydrate-DhHCtdOz.js} +28 -28
- package/dist/prod/shared/insert-CbcOsYmu.js +192 -0
- package/dist/prod/shared/{mount-DbeKIoyD.js → mount-BEAO35S_.js} +1 -1
- package/dist/prod/static.js +2 -2
- package/dist/prod/svg.js +2 -2
- package/dist/prod/testing.js +35 -18
- package/dist/types/dom/props.d.ts +2 -0
- package/dist/types/testing/index.d.ts +12 -5
- package/package.json +7 -7
- package/dist/dev/shared/namespaces-Cz82B0Pr.js +0 -84
- package/dist/prod/shared/element-DCit4-3e.js +0 -129
- package/dist/prod/shared/namespaces-BSRrBJIU.js +0 -71
package/dist/prod/svg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as e } from "./shared/element-
|
|
2
|
-
import { t } from "./shared/
|
|
1
|
+
import { t as e } from "./shared/element-B-0tH1YW.js";
|
|
2
|
+
import { i as t } from "./shared/insert-CbcOsYmu.js";
|
|
3
3
|
// src/svg/element.ts
|
|
4
4
|
function n(n) {
|
|
5
5
|
return e(n, t);
|
package/dist/prod/testing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as e } from "./shared/mount-
|
|
2
|
-
import { n as t, r as n, t as r } from "./shared/hydrate-
|
|
1
|
+
import { t as e } from "./shared/mount-BEAO35S_.js";
|
|
2
|
+
import { n as t, r as n, t as r } from "./shared/hydrate-DhHCtdOz.js";
|
|
3
3
|
// src/testing/index.ts
|
|
4
4
|
var i = /* @__PURE__ */ new Set();
|
|
5
5
|
function a(t) {
|
|
@@ -74,20 +74,20 @@ function d(e, t) {
|
|
|
74
74
|
throw Error(`[keits/testing] Can't ${t} ${h(e)}: it isn't an <input> or <textarea>.`);
|
|
75
75
|
}
|
|
76
76
|
function f(e) {
|
|
77
|
-
let t = () => [...e.querySelectorAll("*")], n = (e) => {
|
|
78
|
-
let
|
|
79
|
-
return
|
|
80
|
-
}, r = (e, n = {}) => t().filter((t) => v(t) === e && (n.name === void 0 || m(
|
|
77
|
+
let t = () => [...e.querySelectorAll("*")], n = (e, n) => {
|
|
78
|
+
let r = t().filter((t) => m(p(t.textContent ?? ""), e, n));
|
|
79
|
+
return r.filter((e) => !r.some((t) => t !== e && e.contains(t)));
|
|
80
|
+
}, r = (e, n = {}) => t().filter((t) => v(t) === e && (n.name === void 0 || m(b(t), n.name))), i = (t, n) => {
|
|
81
81
|
if (t.length === 1) return t[0];
|
|
82
82
|
let r = p(e.textContent ?? "").slice(0, 200);
|
|
83
83
|
throw t.length === 0 ? Error(`[keits/testing] Found no element ${n}. The page says: "${r}"`) : Error(`[keits/testing] Found ${t.length} elements ${n}: ${t.map(h).join(", ")}. Make the query more specific.`);
|
|
84
84
|
}, a = (e, t) => `with role "${e}"${t?.name === void 0 ? "" : ` named ${String(t.name)}`}`;
|
|
85
85
|
return {
|
|
86
|
-
getByText: (e) => i(n(e), `with the text ${String(e)}`),
|
|
87
|
-
queryByText: (e) => n(e)[0] ?? null,
|
|
88
|
-
getAllByText: (e) => {
|
|
89
|
-
let
|
|
90
|
-
return
|
|
86
|
+
getByText: (e, t) => i(n(e, t), `with the text ${String(e)}`),
|
|
87
|
+
queryByText: (e, t) => n(e, t)[0] ?? null,
|
|
88
|
+
getAllByText: (e, t) => {
|
|
89
|
+
let r = n(e, t);
|
|
90
|
+
return r.length === 0 && i(r, `with the text ${String(e)}`), r;
|
|
91
91
|
},
|
|
92
92
|
getByRole: (e, t) => i(r(e, t), a(e, t)),
|
|
93
93
|
queryByRole: (e, t) => r(e, t)[0] ?? null,
|
|
@@ -95,11 +95,11 @@ function f(e) {
|
|
|
95
95
|
let n = r(e, t);
|
|
96
96
|
return n.length === 0 && i(n, a(e, t)), n;
|
|
97
97
|
},
|
|
98
|
-
getByLabelText: (e) => i(t().filter((t) => g(t) && _(t).some((t) => m(t, e))), `labelled ${String(e)}`),
|
|
98
|
+
getByLabelText: (e, n) => i(t().filter((t) => g(t) && _(t).some((t) => m(t, e, n))), `labelled ${String(e)}`),
|
|
99
99
|
getByTestId: (e) => i(t().filter((t) => t.getAttribute("data-testid") === e), `with data-testid "${e}"`)
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
var p = (e) => e.replace(/\s+/g, " ").trim(), m = (e, t) => typeof t == "string" ? e === t : t.test(e), h = (e) => `<${e.localName}${e.id ? `#${e.id}` : ""}>`, g = (e) => [
|
|
102
|
+
var p = (e) => e.replace(/\s+/g, " ").trim(), m = (e, t, n) => typeof t == "string" ? n?.exact === !1 ? e.toLowerCase().includes(p(t).toLowerCase()) : e === t : t.test(e), h = (e) => `<${e.localName}${e.id ? `#${e.id}` : ""}>`, g = (e) => [
|
|
103
103
|
"input",
|
|
104
104
|
"select",
|
|
105
105
|
"textarea",
|
|
@@ -121,10 +121,9 @@ function v(e) {
|
|
|
121
121
|
let t = (e.getAttribute("type") ?? "text").toLowerCase();
|
|
122
122
|
return t === "checkbox" || t === "radio" ? t : t === "button" || t === "submit" || t === "reset" ? "button" : t === "range" ? "slider" : t === "number" ? "spinbutton" : t === "search" ? "searchbox" : t === "hidden" ? null : "textbox";
|
|
123
123
|
}
|
|
124
|
-
return /^h[1-6]$/.test(n) ? "heading" : n === "a" ? e.hasAttribute("href") ? "link" : null : n === "img" ? e.getAttribute("alt") === "" ? "presentation" : "img" : {
|
|
124
|
+
return /^h[1-6]$/.test(n) ? "heading" : n === "th" ? e.getAttribute("scope") === "row" ? "rowheader" : "columnheader" : n === "select" ? e.hasAttribute("multiple") ? "listbox" : "combobox" : n === "a" ? e.hasAttribute("href") ? "link" : null : n === "img" ? e.getAttribute("alt") === "" ? "presentation" : "img" : {
|
|
125
125
|
button: "button",
|
|
126
126
|
textarea: "textbox",
|
|
127
|
-
select: "combobox",
|
|
128
127
|
ul: "list",
|
|
129
128
|
ol: "list",
|
|
130
129
|
li: "listitem",
|
|
@@ -132,13 +131,31 @@ function v(e) {
|
|
|
132
131
|
main: "main",
|
|
133
132
|
form: "form",
|
|
134
133
|
dialog: "dialog",
|
|
134
|
+
option: "option",
|
|
135
135
|
table: "table",
|
|
136
|
+
thead: "rowgroup",
|
|
137
|
+
tbody: "rowgroup",
|
|
138
|
+
tfoot: "rowgroup",
|
|
136
139
|
tr: "row",
|
|
137
|
-
|
|
140
|
+
td: "cell",
|
|
141
|
+
fieldset: "group",
|
|
142
|
+
aside: "complementary",
|
|
143
|
+
progress: "progressbar",
|
|
144
|
+
meter: "meter",
|
|
145
|
+
hr: "separator"
|
|
138
146
|
}[n] ?? null;
|
|
139
147
|
}
|
|
140
|
-
|
|
148
|
+
var y = {
|
|
149
|
+
table: "caption",
|
|
150
|
+
fieldset: "legend",
|
|
151
|
+
figure: "figcaption"
|
|
152
|
+
};
|
|
153
|
+
function b(e) {
|
|
141
154
|
let t = e.getAttribute("aria-label");
|
|
142
|
-
|
|
155
|
+
if (t !== null) return p(t);
|
|
156
|
+
let n = e.getAttribute("aria-labelledby");
|
|
157
|
+
if (n !== null) return p(n.split(/\s+/).map((t) => e.ownerDocument.getElementById(t)?.textContent ?? "").join(" "));
|
|
158
|
+
let r = y[e.localName];
|
|
159
|
+
return r === void 0 ? g(e) && e.localName !== "button" ? _(e)[0] ?? p(e.getAttribute("placeholder") ?? "") : e.localName === "img" ? p(e.getAttribute("alt") ?? "") : p(e.textContent ?? "") : p(e.querySelector(`:scope > ${r}`)?.textContent ?? "");
|
|
143
160
|
}
|
|
144
161
|
export { c as cleanup, l as flush, a as render, o as renderOnServer, u as user, f as within };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare const BLOCKED_URL = "about:invalid#keits-blocked";
|
|
2
2
|
export declare function applyProps(element: Element, props: Record<string, unknown>): void;
|
|
3
3
|
export declare function setProp(element: Element, key: string, value: unknown): void;
|
|
4
|
+
/** After keits changes the children of `parent`: if it's (in) a <select> given a `value`, select that value again. */
|
|
5
|
+
export declare function restoreSelectValue(parent: Node | null): void;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { Child } from "../dom/types";
|
|
2
2
|
/** Queries inside one element. They throw a readable error when nothing (or more than one) matches. */
|
|
3
3
|
export interface Queries {
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The one element whose text is `text` (the innermost, if they're nested). With `{ exact: false }`,
|
|
6
|
+
* a string matches any part of the text, ignoring case.
|
|
7
|
+
*/
|
|
8
|
+
getByText(text: string | RegExp, options?: TextOptions): HTMLElement;
|
|
9
|
+
queryByText(text: string | RegExp, options?: TextOptions): HTMLElement | null;
|
|
10
|
+
getAllByText(text: string | RegExp, options?: TextOptions): HTMLElement[];
|
|
8
11
|
/** By ARIA role (explicit, or what the tag means: button, link, textbox, checkbox, heading...), and accessible name. */
|
|
9
12
|
getByRole(role: string, options?: {
|
|
10
13
|
name?: string | RegExp;
|
|
@@ -16,10 +19,14 @@ export interface Queries {
|
|
|
16
19
|
name?: string | RegExp;
|
|
17
20
|
}): HTMLElement[];
|
|
18
21
|
/** The form control a <label> (or aria-label) names. */
|
|
19
|
-
getByLabelText(text: string | RegExp): HTMLElement;
|
|
22
|
+
getByLabelText(text: string | RegExp, options?: TextOptions): HTMLElement;
|
|
20
23
|
/** By data-testid, for things a user can't name. */
|
|
21
24
|
getByTestId(id: string): HTMLElement;
|
|
22
25
|
}
|
|
26
|
+
export interface TextOptions {
|
|
27
|
+
/** false: a string matches any part of the text, ignoring case. Default true: the whole text. */
|
|
28
|
+
exact?: boolean;
|
|
29
|
+
}
|
|
23
30
|
export interface Rendered extends Queries {
|
|
24
31
|
/** The element the app was mounted into. */
|
|
25
32
|
container: HTMLElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keits",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Fine-grained reactive TypeScript framework. Real DOM, no virtual DOM, zero dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"reactive",
|
|
@@ -75,14 +75,14 @@
|
|
|
75
75
|
"size-budget": {
|
|
76
76
|
"dist/prod/index.js": 7680,
|
|
77
77
|
"size/basic.js": 1792,
|
|
78
|
-
"size/dom-basic.js":
|
|
79
|
-
"size/svg-icon.js":
|
|
80
|
-
"size/data-app.js":
|
|
78
|
+
"size/dom-basic.js": 3456,
|
|
79
|
+
"size/svg-icon.js": 3456,
|
|
80
|
+
"size/data-app.js": 5312,
|
|
81
81
|
"size/router-app.js": 6400,
|
|
82
|
-
"size/api-app.js":
|
|
83
|
-
"size/forms-app.js":
|
|
82
|
+
"size/api-app.js": 7040,
|
|
83
|
+
"size/forms-app.js": 6784,
|
|
84
84
|
"size/head.js": 4096,
|
|
85
|
-
"size/islands.js":
|
|
85
|
+
"size/islands.js": 4224
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"vite": ">=8"
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { t as renderEffect } from "./render-effect-Uk9dDmuU.js";
|
|
2
|
-
// src/dom/hooks.ts
|
|
3
|
-
var defaultHooks = {
|
|
4
|
-
element: (tag, namespace) => namespace === null ? document.createElement(tag) : document.createElementNS(namespace, tag),
|
|
5
|
-
text: (value) => document.createTextNode(value),
|
|
6
|
-
marker: () => document.createComment(""),
|
|
7
|
-
fragment: () => document.createDocumentFragment()
|
|
8
|
-
};
|
|
9
|
-
var claimPauses = 0;
|
|
10
|
-
function withoutClaims(fn) {
|
|
11
|
-
claimPauses++;
|
|
12
|
-
try {
|
|
13
|
-
return fn();
|
|
14
|
-
} finally {
|
|
15
|
-
claimPauses--;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function claimsPaused() {
|
|
19
|
-
return claimPauses > 0;
|
|
20
|
-
}
|
|
21
|
-
var hooks = defaultHooks;
|
|
22
|
-
function setHooks(next) {
|
|
23
|
-
const previous = hooks;
|
|
24
|
-
hooks = next;
|
|
25
|
-
return previous;
|
|
26
|
-
}
|
|
27
|
-
// src/dom/insert.ts
|
|
28
|
-
function insert(parent, child, before = null) {
|
|
29
|
-
if (child === null || child === void 0 || typeof child === "boolean") return;
|
|
30
|
-
if (typeof child === "function") return insertDynamic(parent, child, before);
|
|
31
|
-
if (isChildArray(child)) {
|
|
32
|
-
for (const item of child) insert(parent, item, before);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (typeof child === "object") {
|
|
36
|
-
if (!child.nodeType) throw new Error("[keits] A child is a plain object, not text or an element. If it came from an API, check its type (see parse), or write String(value).");
|
|
37
|
-
parent.insertBefore(child, before);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
parent.insertBefore(hooks.text(String(child)), before);
|
|
41
|
-
}
|
|
42
|
-
function isChildArray(value) {
|
|
43
|
-
return Array.isArray(value);
|
|
44
|
-
}
|
|
45
|
-
function isTextValue(value) {
|
|
46
|
-
return value === null || typeof value !== "object" && typeof value !== "function";
|
|
47
|
-
}
|
|
48
|
-
function toText(value) {
|
|
49
|
-
return value === null || value === void 0 || typeof value === "boolean" ? "" : String(value);
|
|
50
|
-
}
|
|
51
|
-
function insertDynamic(parent, fn, before) {
|
|
52
|
-
const text = hooks.text("");
|
|
53
|
-
parent.insertBefore(text, before);
|
|
54
|
-
let start = null;
|
|
55
|
-
let end = null;
|
|
56
|
-
renderEffect(() => {
|
|
57
|
-
const value = fn();
|
|
58
|
-
if (start === null || end === null) {
|
|
59
|
-
if (isTextValue(value)) {
|
|
60
|
-
const next = toText(value);
|
|
61
|
-
if (text.data !== next) text.data = next;
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
start = hooks.marker();
|
|
65
|
-
end = hooks.marker();
|
|
66
|
-
text.before(start);
|
|
67
|
-
text.after(end);
|
|
68
|
-
text.remove();
|
|
69
|
-
}
|
|
70
|
-
clearRange(start, end);
|
|
71
|
-
insert(end.parentNode, value, end);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function clearRange(start, end) {
|
|
75
|
-
let node = start.nextSibling;
|
|
76
|
-
while (node !== null && node !== end) {
|
|
77
|
-
const next = node.nextSibling;
|
|
78
|
-
node.remove();
|
|
79
|
-
node = next;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// src/dom/namespaces.ts
|
|
83
|
-
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
84
|
-
export { hooks as a, defaultHooks as i, insert as n, setHooks as o, claimsPaused as r, withoutClaims as s, SVG_NS as t };
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { a as e, n as t } from "./namespaces-BSRrBJIU.js";
|
|
2
|
-
import { d as n, g as r, i, l as a, s as o } from "./graph-CR2WKbwr.js";
|
|
3
|
-
import { t as s } from "./unsafe-keys-C5PMlerl.js";
|
|
4
|
-
import { t as c } from "./render-effect-UFDi2Pfh.js";
|
|
5
|
-
// src/dom/events.ts
|
|
6
|
-
function l(e, t, r) {
|
|
7
|
-
let i = r, a;
|
|
8
|
-
if (Array.isArray(r) && ([i, a] = r), typeof i != "function") throw Error("[keits] bad handler");
|
|
9
|
-
n() || u(e, t.slice(2), i, a);
|
|
10
|
-
}
|
|
11
|
-
function u(e, t, n, s) {
|
|
12
|
-
let c = o();
|
|
13
|
-
e.addEventListener(t, (e) => {
|
|
14
|
-
i(() => {
|
|
15
|
-
try {
|
|
16
|
-
let t = r(c, () => n(e));
|
|
17
|
-
d(t) && t.then(void 0, (e) => i(() => a(e, c)));
|
|
18
|
-
} catch (e) {
|
|
19
|
-
a(e, c);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}, s);
|
|
23
|
-
}
|
|
24
|
-
function d(e) {
|
|
25
|
-
return typeof e?.then == "function";
|
|
26
|
-
}
|
|
27
|
-
// src/dom/props.ts
|
|
28
|
-
var f = /* @__PURE__ */ new Set([
|
|
29
|
-
"innerhtml",
|
|
30
|
-
"outerhtml",
|
|
31
|
-
"srcdoc"
|
|
32
|
-
]), p = /* @__PURE__ */ new Set([
|
|
33
|
-
"href",
|
|
34
|
-
"src",
|
|
35
|
-
"action",
|
|
36
|
-
"formaction",
|
|
37
|
-
"poster",
|
|
38
|
-
"cite",
|
|
39
|
-
"data",
|
|
40
|
-
"xlink:href",
|
|
41
|
-
"to",
|
|
42
|
-
"from",
|
|
43
|
-
"values"
|
|
44
|
-
]), m = "about:invalid#keits-blocked";
|
|
45
|
-
function h(e, t) {
|
|
46
|
-
for (let n in t) {
|
|
47
|
-
let r = t[n];
|
|
48
|
-
n !== "ref" && (n === "class" ? b(e, r) : n === "style" ? w(e, r) : n.toLowerCase().startsWith("on") ? l(e, n, r) : typeof r == "function" ? c(() => g(e, n, r())) : g(e, n, r));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function g(e, t, r) {
|
|
52
|
-
let i = t.toLowerCase();
|
|
53
|
-
if (f.has(i) || s.has(t) || i.startsWith("on") && typeof r == "string") throw Error("[keits] unsafe prop");
|
|
54
|
-
p.has(i) && r != null && r !== !1 && _(String(r)) && (r = m), t in e && e.namespaceURI !== "http://www.w3.org/2000/svg" ? (e[t] = r, n() && v(e, t, r)) : t.startsWith("aria-") && typeof r == "boolean" ? e.setAttribute(t, String(r)) : r == null || r === !1 ? e.removeAttribute(t) : e.setAttribute(t, r === !0 ? "" : String(r));
|
|
55
|
-
}
|
|
56
|
-
function _(e) {
|
|
57
|
-
return e.replace(/[\u0000-\u0020]/g, "").toLowerCase().split(";").some((e) => e.startsWith("javascript:"));
|
|
58
|
-
}
|
|
59
|
-
function v(e, t, n) {
|
|
60
|
-
t === "value" ? e.localName === "textarea" ? e.textContent = n == null ? "" : String(n) : e.localName === "select" ? y(e, n == null ? "" : String(n)) : n == null ? e.removeAttribute("value") : e.setAttribute("value", String(n)) : (t === "checked" || t === "selected") && e.toggleAttribute(t, n === !0);
|
|
61
|
-
}
|
|
62
|
-
function y(e, t) {
|
|
63
|
-
for (let n = e.firstChild; n !== null; n = n.nextSibling) {
|
|
64
|
-
if (n.nodeType !== 1) continue;
|
|
65
|
-
let e = n;
|
|
66
|
-
e.localName === "option" ? e.toggleAttribute("selected", (e.getAttribute("value") ?? e.textContent) === t) : y(e, t);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function b(e, t) {
|
|
70
|
-
if (typeof t == "function") {
|
|
71
|
-
c(() => x(e, C(t())));
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
let n = [], r = [];
|
|
75
|
-
S(t, n, (e, t) => r.push([e, t])), n.length > 0 && e.classList.add(...n);
|
|
76
|
-
for (let [t, n] of r) c(() => e.classList.toggle(t, n()));
|
|
77
|
-
}
|
|
78
|
-
function x(e, t) {
|
|
79
|
-
t === "" ? e.removeAttribute("class") : e.setAttribute("class", t);
|
|
80
|
-
}
|
|
81
|
-
function S(e, t, n) {
|
|
82
|
-
if (e) {
|
|
83
|
-
if (typeof e == "string") for (let n of e.split(/\s+/)) n && t.push(n);
|
|
84
|
-
else if (Array.isArray(e)) for (let r of e) S(r, t, n);
|
|
85
|
-
else for (let [r, i] of Object.entries(e)) typeof i == "function" ? n ? n(r, i) : i() && t.push(r) : i && t.push(r);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function C(e) {
|
|
89
|
-
let t = [];
|
|
90
|
-
return S(e, t), t.join(" ");
|
|
91
|
-
}
|
|
92
|
-
function w(e, t) {
|
|
93
|
-
let n = e.style;
|
|
94
|
-
if (typeof t == "function") {
|
|
95
|
-
let e = [];
|
|
96
|
-
c(() => {
|
|
97
|
-
let r = t();
|
|
98
|
-
if (typeof r == "string" || r == null) {
|
|
99
|
-
n.cssText = r ?? "", e = [];
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
let i = Object.keys(r);
|
|
103
|
-
for (let t of e) t in r || n.removeProperty(t);
|
|
104
|
-
for (let e of i) E(n, e, T(r[e]));
|
|
105
|
-
e = i;
|
|
106
|
-
});
|
|
107
|
-
} else if (typeof t == "string") n.cssText = t;
|
|
108
|
-
else if (t != null) for (let [e, r] of Object.entries(t)) typeof r == "function" ? c(() => E(n, e, r())) : E(n, e, r);
|
|
109
|
-
}
|
|
110
|
-
function T(e) {
|
|
111
|
-
return typeof e == "function" ? e() : e;
|
|
112
|
-
}
|
|
113
|
-
function E(e, t, n) {
|
|
114
|
-
n == null || n === "" ? e.removeProperty(t) : e.setProperty(t, String(n));
|
|
115
|
-
}
|
|
116
|
-
// src/dom/element.ts
|
|
117
|
-
function D(e) {
|
|
118
|
-
return O(e, null);
|
|
119
|
-
}
|
|
120
|
-
function O(n, r) {
|
|
121
|
-
return (i, a) => {
|
|
122
|
-
let o = e.element(n, r);
|
|
123
|
-
return k(i) ? (t(o, a), h(o, i), typeof i.ref == "function" && i.ref(o)) : i == null ? t(o, a) : t(o, i), o;
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function k(e) {
|
|
127
|
-
return typeof e == "object" && !!e && !Array.isArray(e) && typeof e.nodeType != "number";
|
|
128
|
-
}
|
|
129
|
-
export { D as n, O as t };
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./render-effect-UFDi2Pfh.js";
|
|
2
|
-
// src/dom/hooks.ts
|
|
3
|
-
var t = {
|
|
4
|
-
element: (e, t) => t === null ? document.createElement(e) : document.createElementNS(t, e),
|
|
5
|
-
text: (e) => document.createTextNode(e),
|
|
6
|
-
marker: () => document.createComment(""),
|
|
7
|
-
fragment: () => document.createDocumentFragment()
|
|
8
|
-
}, n = 0;
|
|
9
|
-
function r(e) {
|
|
10
|
-
n++;
|
|
11
|
-
try {
|
|
12
|
-
return e();
|
|
13
|
-
} finally {
|
|
14
|
-
n--;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function i() {
|
|
18
|
-
return n > 0;
|
|
19
|
-
}
|
|
20
|
-
var a = t;
|
|
21
|
-
function o(e) {
|
|
22
|
-
let t = a;
|
|
23
|
-
return a = e, t;
|
|
24
|
-
}
|
|
25
|
-
// src/dom/insert.ts
|
|
26
|
-
function s(e, t, n = null) {
|
|
27
|
-
if (t != null && typeof t != "boolean") {
|
|
28
|
-
if (typeof t == "function") return d(e, t, n);
|
|
29
|
-
if (c(t)) for (let r of t) s(e, r, n);
|
|
30
|
-
else if (typeof t == "object") {
|
|
31
|
-
if (!t.nodeType) throw Error("[keits] bad child");
|
|
32
|
-
e.insertBefore(t, n);
|
|
33
|
-
} else e.insertBefore(a.text(String(t)), n);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function c(e) {
|
|
37
|
-
return Array.isArray(e);
|
|
38
|
-
}
|
|
39
|
-
function l(e) {
|
|
40
|
-
return e === null || typeof e != "object" && typeof e != "function";
|
|
41
|
-
}
|
|
42
|
-
function u(e) {
|
|
43
|
-
return e == null || typeof e == "boolean" ? "" : String(e);
|
|
44
|
-
}
|
|
45
|
-
function d(t, n, r) {
|
|
46
|
-
let i = a.text("");
|
|
47
|
-
t.insertBefore(i, r);
|
|
48
|
-
let o = null, c = null;
|
|
49
|
-
e(() => {
|
|
50
|
-
let e = n();
|
|
51
|
-
if (o === null || c === null) {
|
|
52
|
-
if (l(e)) {
|
|
53
|
-
let t = u(e);
|
|
54
|
-
i.data !== t && (i.data = t);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
o = a.marker(), c = a.marker(), i.before(o), i.after(c), i.remove();
|
|
58
|
-
}
|
|
59
|
-
f(o, c), s(c.parentNode, e, c);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function f(e, t) {
|
|
63
|
-
let n = e.nextSibling;
|
|
64
|
-
for (; n !== null && n !== t;) {
|
|
65
|
-
let e = n.nextSibling;
|
|
66
|
-
n.remove(), n = e;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
// src/dom/namespaces.ts
|
|
70
|
-
var p = "http://www.w3.org/2000/svg";
|
|
71
|
-
export { a, t as i, s as n, o, i as r, r as s, p as t };
|