ilha 0.14.5 → 0.14.6
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/define.d.ts +1 -1
- package/dist/define.js +1 -1
- package/dist/index.d.ts +14 -3
- package/dist/index.js +2 -2
- package/dist/jsx-dev-runtime.d.ts +2 -2
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/{mount-C5idXX3H.js → mount-DiIEX8s7.js} +37 -2
- package/dist/{types-CUQdA6hR.d.ts → types-CyoYWhJf.d.ts} +7 -2
- package/dist/{vnode-Bwx8ffNO.d.ts → vnode-C_BdUnIA.d.ts} +1 -1
- package/package.json +1 -1
package/dist/define.d.ts
CHANGED
package/dist/define.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as Instruction,
|
|
2
|
-
import { t as h } from "./vnode-
|
|
1
|
+
import { a as Instruction, c as UnsafeHtml, d as Yielded, i as Fragment, n as Component, t as AtomHandle, u as View } from "./types-CyoYWhJf.js";
|
|
2
|
+
import { t as h } from "./vnode-C_BdUnIA.js";
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Stream from "effect/Stream";
|
|
5
5
|
import * as Atom from "effect/unstable/reactivity/Atom";
|
|
@@ -74,4 +74,15 @@ interface MountOptions {
|
|
|
74
74
|
declare const mount: (el: Element, fn: Component, opts?: MountOptions) => (() => void);
|
|
75
75
|
declare const renderToString: (fn: Component, opts?: RenderToStringOptions) => Promise<string>;
|
|
76
76
|
//#endregion
|
|
77
|
-
|
|
77
|
+
//#region src/unsafe.d.ts
|
|
78
|
+
/**
|
|
79
|
+
* Mark a string as pre-rendered HTML and paint it without escaping.
|
|
80
|
+
* Use it for markup you built or sanitized yourself — SVG from an external
|
|
81
|
+
* library, Markdown rendered to HTML, embed codes. Never pass untrusted
|
|
82
|
+
* user input: unlike interpolated strings, this content is not escaped and
|
|
83
|
+
* scripts inserted this way do not run, but event attributes and other
|
|
84
|
+
* markup still apply.
|
|
85
|
+
*/
|
|
86
|
+
declare const unsafe: (html: string) => UnsafeHtml;
|
|
87
|
+
//#endregion
|
|
88
|
+
export { type AtomHandle, type Component, type ContextProviderProps, ErrorBoundary, type ErrorBoundaryProps, type ErrorFallback, type ErrorFallbackProps, Fragment, type IlhaContext, type MountOptions, type RenderToStringOptions, type UnsafeHtml, type View, type WatchOnceCleanup, atom, batch, context, createContext, h, mount, renderToString, unsafe, untrack, watch, when };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as interpret, c as handleOwner, d as untrack, f as wrapHandle, g as makeFiber, h as getFiber, i as runSetup, l as instr, m as closeFiber, n as renderToString, o as atom, p as clearFiberView, r as unsafe, s as batch, t as mount, u as isAtomHandle } from "./mount-DiIEX8s7.js";
|
|
2
2
|
import { d as errorView, i as Fragment, p as isFunction, t as h } from "./vnode-DEMDQ0eA.js";
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Stream from "effect/Stream";
|
|
@@ -180,4 +180,4 @@ const when = (stream, body) => instr(Effect.gen(function* whenBody() {
|
|
|
180
180
|
}));
|
|
181
181
|
|
|
182
182
|
//#endregion
|
|
183
|
-
export { ErrorBoundary, Fragment, atom, batch, context, createContext, h, mount, renderToString, untrack, watch, when };
|
|
183
|
+
export { ErrorBoundary, Fragment, atom, batch, context, createContext, h, mount, renderToString, unsafe, untrack, watch, when };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as Fragment } from "./types-
|
|
2
|
-
import { n as JSX } from "./vnode-
|
|
1
|
+
import { i as Fragment } from "./types-CyoYWhJf.js";
|
|
2
|
+
import { n as JSX } from "./vnode-C_BdUnIA.js";
|
|
3
3
|
import { jsx, jsxDEV, jsxs } from "./jsx-runtime.js";
|
|
4
4
|
export { Fragment, type JSX, jsx, jsxDEV, jsxs };
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as Fragment,
|
|
2
|
-
import { n as JSX, t as h } from "./vnode-
|
|
1
|
+
import { i as Fragment, o as JsxComponent, r as ComponentFn, s as PropBag, u as View } from "./types-CyoYWhJf.js";
|
|
2
|
+
import { n as JSX, t as h } from "./vnode-C_BdUnIA.js";
|
|
3
3
|
//#region src/jsx-runtime.d.ts
|
|
4
4
|
declare const jsx: (type: string | Fragment | ComponentFn | JsxComponent, props: PropBag | null, key?: string | number) => ReturnType<typeof h>;
|
|
5
5
|
declare const jsxs: (type: string | Fragment | ComponentFn | JsxComponent, props: PropBag | null, key?: string | number) => ReturnType<typeof h>;
|
|
@@ -784,6 +784,25 @@ const serializeStyleAttr = (value) => {
|
|
|
784
784
|
return serializeStyleEntries(value);
|
|
785
785
|
};
|
|
786
786
|
|
|
787
|
+
//#endregion
|
|
788
|
+
//#region src/unsafe.ts
|
|
789
|
+
/**
|
|
790
|
+
* Mark a string as pre-rendered HTML and paint it without escaping.
|
|
791
|
+
* Use it for markup you built or sanitized yourself — SVG from an external
|
|
792
|
+
* library, Markdown rendered to HTML, embed codes. Never pass untrusted
|
|
793
|
+
* user input: unlike interpolated strings, this content is not escaped and
|
|
794
|
+
* scripts inserted this way do not run, but event attributes and other
|
|
795
|
+
* markup still apply.
|
|
796
|
+
*/
|
|
797
|
+
const unsafe = (html) => ({
|
|
798
|
+
$$ilhaUnsafe: 1,
|
|
799
|
+
html
|
|
800
|
+
});
|
|
801
|
+
const isUnsafeHtml = (x) => {
|
|
802
|
+
if (!isObject(x)) return false;
|
|
803
|
+
return x.$$ilhaUnsafe === 1;
|
|
804
|
+
};
|
|
805
|
+
|
|
787
806
|
//#endregion
|
|
788
807
|
//#region src/paint-core.ts
|
|
789
808
|
const disposeHoles = (fiber, opts) => {
|
|
@@ -1066,6 +1085,7 @@ const createPainter = (ops) => {
|
|
|
1066
1085
|
};
|
|
1067
1086
|
paintFns.materialize = (view, fiber) => {
|
|
1068
1087
|
if (skip(view)) return [];
|
|
1088
|
+
if (isUnsafeHtml(view)) return ops.createRaw(view.html, fiber.root);
|
|
1069
1089
|
if (isTextish(view)) return [ops.createText(String(view))];
|
|
1070
1090
|
if (isAtomHandle(view)) return materializeAtom(view, fiber);
|
|
1071
1091
|
if (Stream.isStream(view)) return materializeStream(view, fiber);
|
|
@@ -1126,6 +1146,11 @@ const core$1 = createPainter({
|
|
|
1126
1146
|
if (root instanceof Element) root.replaceChildren();
|
|
1127
1147
|
},
|
|
1128
1148
|
createElement: (tag) => document.createElement(tag),
|
|
1149
|
+
createRaw: (html, parent) => {
|
|
1150
|
+
const range = document.createRange();
|
|
1151
|
+
range.selectNodeContents(parent);
|
|
1152
|
+
return [...range.createContextualFragment(html).childNodes];
|
|
1153
|
+
},
|
|
1129
1154
|
createSlotHost: (slotId) => {
|
|
1130
1155
|
const host = document.createElement("span");
|
|
1131
1156
|
if (slotId !== null) host.setAttribute(SLOT_ATTR, slotId);
|
|
@@ -1298,6 +1323,10 @@ const VOID = /* @__PURE__ */ new Set([
|
|
|
1298
1323
|
const RAW_TEXT = /* @__PURE__ */ new Set(["script", "style"]);
|
|
1299
1324
|
const escapeText = (s) => s.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
1300
1325
|
const escapeAttr = (s) => escapeText(s).replaceAll("\"", """);
|
|
1326
|
+
const createSsrRaw = (html) => ({
|
|
1327
|
+
html,
|
|
1328
|
+
kind: "raw"
|
|
1329
|
+
});
|
|
1301
1330
|
const createSsrText = (text) => ({
|
|
1302
1331
|
kind: "text",
|
|
1303
1332
|
text
|
|
@@ -1308,6 +1337,7 @@ const serializeRawText = (tag, text) => {
|
|
|
1308
1337
|
};
|
|
1309
1338
|
const serializeNode = (node) => {
|
|
1310
1339
|
if (node.kind === "text") return escapeText(node.text);
|
|
1340
|
+
if (node.kind === "raw") return node.html;
|
|
1311
1341
|
const parts = [];
|
|
1312
1342
|
for (const [name, value] of node.attrs) parts.push(`${name}="${escapeAttr(value)}"`);
|
|
1313
1343
|
const attr = parts.length > 0 ? ` ${parts.join(" ")}` : "";
|
|
@@ -1364,7 +1394,11 @@ const createSsrElement = (tag) => {
|
|
|
1364
1394
|
tag: lower,
|
|
1365
1395
|
tagName: lower.toUpperCase(),
|
|
1366
1396
|
get textContent() {
|
|
1367
|
-
return children.map((n) =>
|
|
1397
|
+
return children.map((n) => {
|
|
1398
|
+
if (n.kind === "text") return n.text;
|
|
1399
|
+
if (n.kind === "raw") return n.html;
|
|
1400
|
+
return n.textContent;
|
|
1401
|
+
}).join("");
|
|
1368
1402
|
},
|
|
1369
1403
|
set textContent(value) {
|
|
1370
1404
|
children.length = 0;
|
|
@@ -1435,6 +1469,7 @@ const ssrOps = {
|
|
|
1435
1469
|
bindEvents: bindSsrEvents,
|
|
1436
1470
|
clearRoot: (root) => ssrAs(root).replaceChildren(),
|
|
1437
1471
|
createElement: createSsrElement,
|
|
1472
|
+
createRaw: (html, _parent) => [createSsrRaw(html)],
|
|
1438
1473
|
createSlotHost: (slotId) => {
|
|
1439
1474
|
const host = createSsrElement("span");
|
|
1440
1475
|
if (slotId !== null) host.setAttribute(SLOT_ATTR, slotId);
|
|
@@ -1561,4 +1596,4 @@ const renderToString = async (fn, opts) => {
|
|
|
1561
1596
|
};
|
|
1562
1597
|
|
|
1563
1598
|
//#endregion
|
|
1564
|
-
export {
|
|
1599
|
+
export { interpret as a, handleOwner as c, untrack as d, wrapHandle as f, makeFiber as g, getFiber as h, runSetup as i, instr as l, closeFiber as m, renderToString as n, atom as o, clearFiberView as p, unsafe as r, batch as s, mount as t, isAtomHandle as u };
|
|
@@ -12,12 +12,17 @@ type EventHandler = (event: Event) => void;
|
|
|
12
12
|
interface PropBag {
|
|
13
13
|
readonly [key: string]: PropValue | undefined;
|
|
14
14
|
}
|
|
15
|
-
type View = VNode | JsonText | AtomHandle<unknown> | Stream.Stream<View, unknown, unknown> | GeneratorFn | Component | View[] | Iterable<View>;
|
|
15
|
+
type View = VNode | UnsafeHtml | JsonText | AtomHandle<unknown> | Stream.Stream<View, unknown, unknown> | GeneratorFn | Component | View[] | Iterable<View>;
|
|
16
16
|
declare const Fragment: unique symbol;
|
|
17
17
|
type Fragment = typeof Fragment;
|
|
18
18
|
type ComponentFn = (props: PropBag) => View | Promise<View | undefined> | undefined;
|
|
19
19
|
/** JSX/tag component with its own props shape (Provider, ErrorBoundary, …). */
|
|
20
20
|
type JsxComponent = (props: never) => View | Promise<View | undefined> | Generator<View, View | undefined, View> | undefined;
|
|
21
|
+
/** Raw HTML view produced by `unsafe()` — painted without escaping. */
|
|
22
|
+
interface UnsafeHtml {
|
|
23
|
+
readonly $$ilhaUnsafe: 1;
|
|
24
|
+
readonly html: string;
|
|
25
|
+
}
|
|
21
26
|
interface VNode {
|
|
22
27
|
readonly $$ilha: 1;
|
|
23
28
|
readonly type: string | Fragment | ComponentFn | JsxComponent;
|
|
@@ -40,4 +45,4 @@ interface AtomHandle<A> {
|
|
|
40
45
|
update: (f: (current: A) => A) => void;
|
|
41
46
|
}
|
|
42
47
|
//#endregion
|
|
43
|
-
export { Instruction as a,
|
|
48
|
+
export { Instruction as a, UnsafeHtml as c, Yielded as d, Fragment as i, VNode as l, Component as n, JsxComponent as o, ComponentFn as r, PropBag as s, AtomHandle as t, View as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as Fragment, l as VNode, o as JsxComponent, r as ComponentFn, s as PropBag, t as AtomHandle, u as View } from "./types-CyoYWhJf.js";
|
|
2
2
|
//#region src/jsx-types.d.ts
|
|
3
3
|
declare namespace JSX {
|
|
4
4
|
export type Element = View;
|