ilha 0.12.1 → 0.14.0
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/README.md +96 -302
- package/dist/define.d.ts +5 -0
- package/dist/define.js +18 -0
- package/dist/index.d.ts +35 -2
- package/dist/index.js +51 -2970
- package/dist/jsx-dev-runtime.d.ts +4 -2
- package/dist/jsx-dev-runtime.js +3 -2
- package/dist/jsx-runtime.d.ts +8 -2
- package/dist/jsx-runtime.js +7 -232
- package/dist/mount-Dcy4teaf.js +992 -0
- package/dist/types-DU46exHq.d.ts +33 -0
- package/dist/vnode-BZLcG8lC.d.ts +20 -0
- package/dist/vnode-DHN2EFHi.js +37 -0
- package/package.json +19 -15
- package/dist/index-BETRqz-0.d.ts +0 -377
- package/dist/internal.d.ts +0 -69
- package/dist/internal.js +0 -49
- package/dist/jsx-runtime-qnxoD2YJ.d.ts +0 -631
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { i as Fragment } from "./types-DU46exHq.js";
|
|
2
|
+
import { n as JSX } from "./vnode-BZLcG8lC.js";
|
|
3
|
+
import { jsx, jsxDEV, jsxs } from "./jsx-runtime.js";
|
|
4
|
+
export { Fragment, type JSX, jsx, jsxDEV, jsxs };
|
package/dist/jsx-dev-runtime.js
CHANGED
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { i as Fragment, s as View } from "./types-DU46exHq.js";
|
|
2
|
+
import { n as JSX, t as h } from "./vnode-BZLcG8lC.js";
|
|
3
|
+
//#region src/jsx-runtime.d.ts
|
|
4
|
+
declare const jsx: (type: string | typeof Fragment | ((p: Record<string, unknown>) => unknown), props: Record<string, unknown> | null, key?: string | number) => ReturnType<typeof h>;
|
|
5
|
+
declare const jsxs: (type: string | typeof Fragment | ((p: Record<string, unknown>) => unknown), props: Record<string, unknown> | null, key?: string | number) => ReturnType<typeof h>;
|
|
6
|
+
declare const jsxDEV: (type: string | typeof Fragment | ((p: Record<string, unknown>) => unknown), props: Record<string, unknown> | null, key?: string | number) => ReturnType<typeof h>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Fragment, type JSX, type View, h, jsx, jsxDEV, jsxs };
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -1,237 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { html, isSafeUrlAttrValue, isUrlAttributeName, raw, serializeStyle } from "./index.js";
|
|
1
|
+
import { i as Fragment, t as h } from "./vnode-DHN2EFHi.js";
|
|
3
2
|
|
|
4
3
|
//#region src/jsx-runtime.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const SIGNAL_ACCESSOR = Symbol.for("ilha.signalAccessor");
|
|
10
|
-
const ISLAND = Symbol.for("ilha.island");
|
|
11
|
-
const ISLAND_CALL = Symbol.for("ilha.islandCall");
|
|
12
|
-
const RENDER_PART = Symbol.for("ilha.renderPart");
|
|
13
|
-
const SAFE_NAME_RE = /^[A-Za-z_:][A-Za-z0-9:._-]*$/;
|
|
14
|
-
const SAFE_BIND_LOCAL_RE = /^[A-Za-z][A-Za-z0-9]*$/;
|
|
15
|
-
const SAFE_EVENT_PROP_RE = /^on([a-z][a-z0-9-]*)(?::(abortable|once|capture|passive))?$/;
|
|
16
|
-
const JSX_ATTRIBUTE_ALIASES = {
|
|
17
|
-
className: "class",
|
|
18
|
-
htmlFor: "for",
|
|
19
|
-
acceptCharset: "accept-charset",
|
|
20
|
-
httpEquiv: "http-equiv",
|
|
21
|
-
accentHeight: "accent-height",
|
|
22
|
-
alignmentBaseline: "alignment-baseline",
|
|
23
|
-
baselineShift: "baseline-shift",
|
|
24
|
-
clipPath: "clip-path",
|
|
25
|
-
clipRule: "clip-rule",
|
|
26
|
-
dominantBaseline: "dominant-baseline",
|
|
27
|
-
fillOpacity: "fill-opacity",
|
|
28
|
-
fillRule: "fill-rule",
|
|
29
|
-
floodColor: "flood-color",
|
|
30
|
-
floodOpacity: "flood-opacity",
|
|
31
|
-
fontFamily: "font-family",
|
|
32
|
-
fontSize: "font-size",
|
|
33
|
-
fontStyle: "font-style",
|
|
34
|
-
fontWeight: "font-weight",
|
|
35
|
-
markerEnd: "marker-end",
|
|
36
|
-
markerMid: "marker-mid",
|
|
37
|
-
markerStart: "marker-start",
|
|
38
|
-
stopColor: "stop-color",
|
|
39
|
-
stopOpacity: "stop-opacity",
|
|
40
|
-
strokeDasharray: "stroke-dasharray",
|
|
41
|
-
strokeDashoffset: "stroke-dashoffset",
|
|
42
|
-
strokeLinecap: "stroke-linecap",
|
|
43
|
-
strokeLinejoin: "stroke-linejoin",
|
|
44
|
-
strokeMiterlimit: "stroke-miterlimit",
|
|
45
|
-
strokeOpacity: "stroke-opacity",
|
|
46
|
-
strokeWidth: "stroke-width",
|
|
47
|
-
textAnchor: "text-anchor",
|
|
48
|
-
vectorEffect: "vector-effect",
|
|
49
|
-
xlinkHref: "xlink:href"
|
|
50
|
-
};
|
|
51
|
-
const STRING_BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
52
|
-
"contenteditable",
|
|
53
|
-
"draggable",
|
|
54
|
-
"spellcheck"
|
|
55
|
-
]);
|
|
56
|
-
const VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
57
|
-
"area",
|
|
58
|
-
"base",
|
|
59
|
-
"br",
|
|
60
|
-
"col",
|
|
61
|
-
"embed",
|
|
62
|
-
"hr",
|
|
63
|
-
"img",
|
|
64
|
-
"input",
|
|
65
|
-
"link",
|
|
66
|
-
"meta",
|
|
67
|
-
"param",
|
|
68
|
-
"source",
|
|
69
|
-
"track",
|
|
70
|
-
"wbr"
|
|
71
|
-
]);
|
|
72
|
-
function isRawHtml(v) {
|
|
73
|
-
return !!(v && typeof v === "object" && RAW in v);
|
|
74
|
-
}
|
|
75
|
-
function isSignalAccessor(v) {
|
|
76
|
-
return typeof v === "function" && SIGNAL_ACCESSOR in v;
|
|
77
|
-
}
|
|
78
|
-
function isIsland(v) {
|
|
79
|
-
return typeof v === "function" && ISLAND in v;
|
|
80
|
-
}
|
|
81
|
-
function isIslandCall(v) {
|
|
82
|
-
if (v == null || typeof v !== "object" && typeof v !== "function") return false;
|
|
83
|
-
if (ISLAND_CALL in v) return true;
|
|
84
|
-
return typeof v === "object" && "island" in v && isIsland(v.island);
|
|
85
|
-
}
|
|
86
|
-
function normalizeClass(value) {
|
|
87
|
-
if (Array.isArray(value)) return value.filter(Boolean).join(" ");
|
|
88
|
-
if (value && typeof value === "object") return Object.entries(value).filter(([, enabled]) => Boolean(enabled)).map(([name]) => name).join(" ");
|
|
89
|
-
return String(value);
|
|
90
|
-
}
|
|
91
|
-
function normalizeJsxChildren(props, children) {
|
|
92
|
-
const propChildren = props && "children" in props ? props.children : void 0;
|
|
93
|
-
return (children.length > 0 ? children : propChildren === void 0 ? [] : [propChildren]).flat(1);
|
|
94
|
-
}
|
|
95
|
-
function normalizeJsxSlotKey(rawKey) {
|
|
96
|
-
const key = String(rawKey);
|
|
97
|
-
if (key.trim().length === 0) throw new Error("jsx key requires a non-empty string.");
|
|
98
|
-
if (key.includes(":")) throw new Error(`jsx key cannot contain the slot separator ":" (got "${key}").`);
|
|
99
|
-
return key;
|
|
100
|
-
}
|
|
101
|
-
function extractJsxSlotKey(props, keyArg) {
|
|
102
|
-
const fromProps = props?.key;
|
|
103
|
-
const rawKey = keyArg ?? (typeof fromProps === "string" || typeof fromProps === "number" ? fromProps : void 0);
|
|
104
|
-
if (rawKey == null) return void 0;
|
|
105
|
-
return normalizeJsxSlotKey(rawKey);
|
|
106
|
-
}
|
|
107
|
-
function pushJsxAttr({ chunks, values, eventSpecs, tagName, name, value }) {
|
|
108
|
-
if (value == null || name === "children" || name === "key") return;
|
|
109
|
-
if (name === "__proto__" || name === "constructor" || name === "prototype") return;
|
|
110
|
-
if (name.startsWith("bind:")) {
|
|
111
|
-
const [prefix, localName, ...rest] = name.split(":");
|
|
112
|
-
if (prefix !== "bind" || rest.length > 0 || !localName || !SAFE_BIND_LOCAL_RE.test(localName)) return;
|
|
113
|
-
if (!isSignalAccessor(value)) return;
|
|
114
|
-
chunks[chunks.length - 1] += ` ${prefix}:${localName}=`;
|
|
115
|
-
values.push(value);
|
|
116
|
-
chunks.push("");
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (!SAFE_NAME_RE.test(name)) return;
|
|
120
|
-
const safeName = JSX_ATTRIBUTE_ALIASES[name] ?? name;
|
|
121
|
-
if (safeName.startsWith("on")) {
|
|
122
|
-
const eventMatch = SAFE_EVENT_PROP_RE.exec(safeName);
|
|
123
|
-
if (typeof value !== "function" || !eventMatch) return;
|
|
124
|
-
const eventName = eventMatch[1];
|
|
125
|
-
const modifier = eventMatch[2];
|
|
126
|
-
const index = __ilhaJsxEvent({
|
|
127
|
-
type: eventName,
|
|
128
|
-
handler: value,
|
|
129
|
-
modifier
|
|
130
|
-
});
|
|
131
|
-
if (index !== void 0) eventSpecs.push(`${eventName}:${index}`);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const securityName = safeName.toLowerCase();
|
|
135
|
-
if (securityName === "srcdoc") return;
|
|
136
|
-
const stringBoolean = securityName.startsWith("aria-") || STRING_BOOLEAN_ATTRIBUTES.has(securityName);
|
|
137
|
-
if (typeof value === "boolean" && stringBoolean) value = String(value);
|
|
138
|
-
else if (value === false) return;
|
|
139
|
-
if (safeName === "class" && !isRawHtml(value)) value = normalizeClass(value);
|
|
140
|
-
if (safeName === "style" && value && typeof value === "object" && !isRawHtml(value)) value = serializeStyle(value);
|
|
141
|
-
if (isUrlAttributeName(securityName) && !isSafeUrlAttrValue(tagName, securityName, typeof value === "string" ? value : String(value))) return;
|
|
142
|
-
if (value === true) {
|
|
143
|
-
chunks[chunks.length - 1] += ` ${safeName}`;
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
chunks[chunks.length - 1] += ` ${safeName}="`;
|
|
147
|
-
values.push(value);
|
|
148
|
-
chunks.push("\"");
|
|
149
|
-
}
|
|
150
|
-
function escapeAttrValue(value) {
|
|
151
|
-
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
152
|
-
}
|
|
153
|
-
function injectDataKey(out, key) {
|
|
154
|
-
const m = /^\s*<([a-zA-Z][a-zA-Z0-9:._-]*)/.exec(out.value);
|
|
155
|
-
if (!m) return out;
|
|
156
|
-
const openEnd = out.value.indexOf(">", m.index);
|
|
157
|
-
const openTag = out.value.slice(m.index, openEnd === -1 ? void 0 : openEnd);
|
|
158
|
-
if (/\sdata-key\s*=/.test(openTag)) return out;
|
|
159
|
-
const insertAt = m.index + m[0].length;
|
|
160
|
-
return raw(`${out.value.slice(0, insertAt)} data-key="${escapeAttrValue(key)}"${out.value.slice(insertAt)}`);
|
|
161
|
-
}
|
|
162
|
-
function renderJsxElement({ type, props, children, slotKey }) {
|
|
163
|
-
const chunks = [`<${type}`];
|
|
164
|
-
const values = [];
|
|
165
|
-
const eventSpecs = [];
|
|
166
|
-
if (props) for (const [name, value] of Object.entries(props)) pushJsxAttr({
|
|
167
|
-
chunks,
|
|
168
|
-
values,
|
|
169
|
-
eventSpecs,
|
|
170
|
-
tagName: type,
|
|
171
|
-
name,
|
|
172
|
-
value
|
|
173
|
-
});
|
|
174
|
-
if (slotKey !== void 0 && props?.["data-key"] == null) pushJsxAttr({
|
|
175
|
-
chunks,
|
|
176
|
-
values,
|
|
177
|
-
eventSpecs,
|
|
178
|
-
tagName: type,
|
|
179
|
-
name: "data-key",
|
|
180
|
-
value: slotKey
|
|
181
|
-
});
|
|
182
|
-
if (eventSpecs.length > 0) chunks[chunks.length - 1] += ` data-ilha-on="${eventSpecs.join(",")}"`;
|
|
183
|
-
chunks[chunks.length - 1] += ">";
|
|
184
|
-
if (!VOID_ELEMENTS.has(type)) {
|
|
185
|
-
for (const child of children) {
|
|
186
|
-
values.push(child);
|
|
187
|
-
chunks.push("");
|
|
188
|
-
}
|
|
189
|
-
chunks[chunks.length - 1] += `</${type}>`;
|
|
190
|
-
}
|
|
191
|
-
return html(toTemplateStrings(chunks), ...values);
|
|
192
|
-
}
|
|
193
|
-
function jsx(type, props, maybeKey, ...restChildren) {
|
|
194
|
-
const hasKeyArg = typeof maybeKey === "string" || typeof maybeKey === "number";
|
|
195
|
-
const keyFromArg = hasKeyArg ? maybeKey : void 0;
|
|
196
|
-
const normalizedChildren = normalizeJsxChildren(props, hasKeyArg || maybeKey === void 0 ? restChildren : [maybeKey, ...restChildren]);
|
|
197
|
-
const slotKey = extractJsxSlotKey(props, typeof keyFromArg === "string" || typeof keyFromArg === "number" ? keyFromArg : void 0);
|
|
198
|
-
if (typeof type === "function") {
|
|
199
|
-
const componentProps = {
|
|
200
|
-
...props,
|
|
201
|
-
...normalizedChildren.length > 0 ? { children: normalizedChildren } : {}
|
|
202
|
-
};
|
|
203
|
-
delete componentProps.key;
|
|
204
|
-
const out = type(Object.keys(componentProps).length ? componentProps : {});
|
|
205
|
-
if (isIslandCall(out)) {
|
|
206
|
-
if (slotKey !== void 0) out.key = slotKey;
|
|
207
|
-
return html`${out}`;
|
|
208
|
-
}
|
|
209
|
-
if (isRawHtml(out)) return slotKey !== void 0 ? injectDataKey(out, slotKey) : out;
|
|
210
|
-
if (typeof out === "string" && isIsland(type)) return __ilhaJsxSlot({
|
|
211
|
-
island: type,
|
|
212
|
-
props: componentProps,
|
|
213
|
-
key: slotKey
|
|
214
|
-
});
|
|
215
|
-
if (typeof out === "string") return html`${out}`;
|
|
216
|
-
if (typeof out === "object" && out !== null && Object.getPrototypeOf(out) === Object.prototype && out[RENDER_PART] === true && typeof out.toString === "function") return raw(String(out));
|
|
217
|
-
return html`${out}`;
|
|
218
|
-
}
|
|
219
|
-
return renderJsxElement({
|
|
220
|
-
type,
|
|
221
|
-
props,
|
|
222
|
-
children: normalizedChildren,
|
|
223
|
-
slotKey
|
|
224
|
-
});
|
|
225
|
-
}
|
|
4
|
+
const jsx = (type, props, key) => h(type, key === void 0 ? props : {
|
|
5
|
+
...props,
|
|
6
|
+
key
|
|
7
|
+
});
|
|
226
8
|
const jsxs = jsx;
|
|
227
|
-
|
|
228
|
-
const normalizedChildren = normalizeJsxChildren(props, children);
|
|
229
|
-
const chunks = ["", ...normalizedChildren.map(() => "")];
|
|
230
|
-
return html(toTemplateStrings(chunks), ...normalizedChildren);
|
|
231
|
-
}
|
|
232
|
-
function jsxDEV(type, props, maybeKey, _source, _self) {
|
|
233
|
-
return jsx(type, props, maybeKey);
|
|
234
|
-
}
|
|
9
|
+
const jsxDEV = jsx;
|
|
235
10
|
|
|
236
11
|
//#endregion
|
|
237
|
-
export { Fragment, jsx, jsxDEV, jsxs };
|
|
12
|
+
export { Fragment, h, jsx, jsxDEV, jsxs };
|