ilha 0.16.0 → 0.16.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/AGENTS.md +1 -1
- package/README.md +1 -1
- package/dist/debug.d.ts +2 -4
- package/dist/debug.js +3 -4
- package/dist/index.d.ts +4 -16
- package/dist/index.js +9 -13
- package/dist/jsx-dev-runtime.d.ts +2 -2
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime.d.ts +2 -4
- package/dist/jsx-runtime.js +2 -3
- package/dist/{mount-BwuJsiDH.js → mount-CLPxbsAX.js} +9 -15
- package/dist/{mount-3Ggg67T0.d.ts → mount-DWQcWHqc.d.ts} +1 -3
- package/dist/{paint-core-D1n4lbpF.js → paint-core-BDV_pKgC.js} +7 -11
- package/dist/renderer.d.ts +2 -8
- package/dist/renderer.js +3 -4
- package/dist/{runtime-BCdKBqYp.d.ts → runtime-Z5KugPXX.d.ts} +2 -6
- package/dist/{shared-vpgYXytd.js → shared-Bz14CT7Z.js} +1 -2
- package/dist/{snapshot-BDC74QwI.d.ts → snapshot-rTWQB3iQ.d.ts} +1 -3
- package/dist/{start-B-e1dG5U.js → start-KNXoCAb9.js} +6 -11
- package/dist/test.d.ts +3 -5
- package/dist/test.js +3 -4
- package/dist/{types-NhEiBvwy.d.ts → types-PD4B3pFq.d.ts} +0 -2
- package/dist/{vnode-DJ25Jn3D.js → vnode-C_vM-l5s.js} +3 -5
- package/dist/{vnode-DskooLPD.d.ts → vnode-R5QcXzyp.d.ts} +1 -5
- package/llms.txt +1 -1
- package/package.json +3 -4
package/AGENTS.md
CHANGED
package/README.md
CHANGED
|
@@ -73,8 +73,8 @@ Atoms hold data. Do not store JSX in an atom.
|
|
|
73
73
|
Paint [Effect `Stream`](https://www.effect.website/docs/v4/api/effect/Stream) values. Yield a stream of views from a generator, or return one from an async component:
|
|
74
74
|
|
|
75
75
|
```tsx
|
|
76
|
-
import * as Stream from "effect/Stream";
|
|
77
76
|
import * as Atom from "effect/reactivity/Atom";
|
|
77
|
+
import * as Stream from "effect/Stream";
|
|
78
78
|
import { atom } from "ilha";
|
|
79
79
|
|
|
80
80
|
function* List() {
|
package/dist/debug.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as SnapshotValue } from "./snapshot-
|
|
2
|
-
//#region src/debug.d.ts
|
|
1
|
+
import { t as SnapshotValue } from "./snapshot-rTWQB3iQ.js";
|
|
3
2
|
/** An atom value made JSON-safe: functions and Effects become `<…>` strings. */
|
|
4
3
|
export type InspectValue = SnapshotValue | string;
|
|
5
4
|
export interface IlhaInspectAtom {
|
|
@@ -41,5 +40,4 @@ export declare const setAtom: <T extends SnapshotValue>(id: string, index: numbe
|
|
|
41
40
|
* runs synchronously, so coalesce in it if you re-read the whole tree.
|
|
42
41
|
* Returns an unsubscribe function.
|
|
43
42
|
*/
|
|
44
|
-
export declare const onChange: (listener: () => void) => (() => void);
|
|
45
|
-
//#endregion
|
|
43
|
+
export declare const onChange: (listener: () => void) => (() => void);
|
package/dist/debug.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { r as rootListeners, t as liveRoots } from "./start-
|
|
2
|
-
import { c as isObject, l as isString, o as isFunction, r as SLOT_ATTR } from "./shared-
|
|
1
|
+
import { r as rootListeners, t as liveRoots } from "./start-KNXoCAb9.js";
|
|
2
|
+
import { c as isObject, l as isString, o as isFunction, r as SLOT_ATTR } from "./shared-Bz14CT7Z.js";
|
|
3
3
|
import * as Atom from "effect/reactivity/Atom";
|
|
4
4
|
import * as Effect from "effect/Effect";
|
|
5
5
|
import * as Stream from "effect/Stream";
|
|
6
6
|
import * as AsyncResult from "effect/reactivity/AsyncResult";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/debug.ts
|
|
9
9
|
/**
|
|
10
10
|
* Introspection for tests, devtools, and coding agents (`ilha/debug`).
|
|
11
11
|
*
|
|
@@ -213,5 +213,4 @@ const onChange = (listener) => {
|
|
|
213
213
|
};
|
|
214
214
|
};
|
|
215
215
|
|
|
216
|
-
//#endregion
|
|
217
216
|
export { element, inspect, onChange, roots, setAtom };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { _ as View, a as Component, b as WatchOnceCleanup, f as MountOptions, h as UnsafeHtml, i as AtomOptions, l as Instruction, n as AtomHandle, r as AtomLazyOptions, s as Fragment, t as AtomEquality, v as WatchCallback, x as Yielded, y as WatchContext } from "./types-
|
|
2
|
-
import { t as h } from "./vnode-
|
|
3
|
-
import { r as watch } from "./runtime-
|
|
4
|
-
import { n as mount, r as renderToString, t as RenderToStringOptions } from "./mount-
|
|
1
|
+
import { _ as View, a as Component, b as WatchOnceCleanup, f as MountOptions, h as UnsafeHtml, i as AtomOptions, l as Instruction, n as AtomHandle, r as AtomLazyOptions, s as Fragment, t as AtomEquality, v as WatchCallback, x as Yielded, y as WatchContext } from "./types-PD4B3pFq.js";
|
|
2
|
+
import { t as h } from "./vnode-R5QcXzyp.js";
|
|
3
|
+
import { r as watch } from "./runtime-Z5KugPXX.js";
|
|
4
|
+
import { n as mount, r as renderToString, t as RenderToStringOptions } from "./mount-DWQcWHqc.js";
|
|
5
5
|
import * as Atom from "effect/reactivity/Atom";
|
|
6
6
|
import * as Effect from "effect/Effect";
|
|
7
7
|
import * as Stream from "effect/Stream";
|
|
8
8
|
import { AtomRegistry } from "effect/reactivity/AtomRegistry";
|
|
9
9
|
import * as AsyncResult from "effect/reactivity/AsyncResult";
|
|
10
|
-
//#region src/context.d.ts
|
|
11
10
|
interface ContextProviderProps<A> {
|
|
12
11
|
value: A;
|
|
13
12
|
children?: View;
|
|
@@ -20,8 +19,6 @@ interface IlhaContext<A> {
|
|
|
20
19
|
export declare const createContext: <A>(defaultValue: A) => IlhaContext<A>;
|
|
21
20
|
/** Read a context value as an atom handle. Subscribes the active fiber on read. */
|
|
22
21
|
export declare const context: <A>(ctx: IlhaContext<A>) => AtomHandle<A>;
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/diagnostics.d.ts
|
|
25
22
|
/** Stable diagnostic codes. Each one has a page at `https://ilha.build/errors/<code>`. */
|
|
26
23
|
type IlhaCode = "ILHA001" | "ILHA002" | "ILHA003" | "ILHA004" | "ILHA005" | "ILHA006" | "ILHA007";
|
|
27
24
|
/** Error thrown by ilha with a stable `code`, a `fix` hint and a `docs` URL. */
|
|
@@ -31,8 +28,6 @@ export declare class IlhaError extends Error {
|
|
|
31
28
|
readonly docs: string;
|
|
32
29
|
constructor(code: IlhaCode, detail?: string);
|
|
33
30
|
}
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/error-boundary.d.ts
|
|
36
31
|
interface ErrorFallbackProps {
|
|
37
32
|
error: Error;
|
|
38
33
|
reset: () => void;
|
|
@@ -45,8 +40,6 @@ interface ErrorBoundaryProps {
|
|
|
45
40
|
}
|
|
46
41
|
/** Catch subtree failures and paint a fallback. Supports reset(). */
|
|
47
42
|
export declare const ErrorBoundary: (props: ErrorBoundaryProps) => View;
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/atom.d.ts
|
|
50
43
|
/** Read atoms inside `fn` without subscribing the active render. Sync only. */
|
|
51
44
|
export declare const untrack: <A>(fn: () => A) => A;
|
|
52
45
|
interface AtomFn {
|
|
@@ -62,12 +55,8 @@ interface AtomFn {
|
|
|
62
55
|
}
|
|
63
56
|
export declare const atom: AtomFn;
|
|
64
57
|
export declare const batch: (f: () => void) => void;
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region src/when.d.ts
|
|
67
58
|
/** Rerun `body` for every value of `stream`, replacing the previous run. */
|
|
68
59
|
export declare const when: <A, E = never, R = never>(stream: Stream.Stream<A, E, R>, body: (value: A) => Generator<Yielded, View | undefined, View>) => Instruction<void, E>;
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region src/unsafe.d.ts
|
|
71
60
|
/**
|
|
72
61
|
* Mark a string as pre-rendered HTML and paint it without escaping.
|
|
73
62
|
* Use it for markup you built or sanitized yourself — SVG from an external
|
|
@@ -77,5 +66,4 @@ export declare const when: <A, E = never, R = never>(stream: Stream.Stream<A, E,
|
|
|
77
66
|
* markup still apply.
|
|
78
67
|
*/
|
|
79
68
|
export declare const unsafe: (html: string) => UnsafeHtml;
|
|
80
|
-
//#endregion
|
|
81
69
|
export { type AtomEquality, type AtomHandle, type AtomLazyOptions, type AtomOptions, type Component, type ContextProviderProps, type ErrorBoundaryProps, type ErrorFallback, type ErrorFallbackProps, Fragment, type IlhaCode, type IlhaContext, type MountOptions, type RenderToStringOptions, type UnsafeHtml, type View, type WatchCallback, type WatchContext, type WatchOnceCleanup, h, mount, renderToString, watch };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { _ as IlhaError, c as batch, d as untrack, f as wrapHandle, g as makeFiber, h as getFiber, i as runSetup, l as instr, m as closeFiber, o as interpret, p as clearFiberView, s as atom } from "./start-
|
|
2
|
-
import { i as errorView, o as isFunction } from "./shared-
|
|
3
|
-
import { n as unsafe } from "./paint-core-
|
|
4
|
-
import { r as renderToString, t as mount } from "./mount-
|
|
5
|
-
import { r as Fragment, t as h } from "./vnode-
|
|
1
|
+
import { _ as IlhaError, c as batch, d as untrack, f as wrapHandle, g as makeFiber, h as getFiber, i as runSetup, l as instr, m as closeFiber, o as interpret, p as clearFiberView, s as atom } from "./start-KNXoCAb9.js";
|
|
2
|
+
import { i as errorView, o as isFunction } from "./shared-Bz14CT7Z.js";
|
|
3
|
+
import { n as unsafe } from "./paint-core-BDV_pKgC.js";
|
|
4
|
+
import { r as renderToString, t as mount } from "./mount-CLPxbsAX.js";
|
|
5
|
+
import { r as Fragment, t as h } from "./vnode-C_vM-l5s.js";
|
|
6
6
|
import * as Atom from "effect/reactivity/Atom";
|
|
7
7
|
import * as Effect from "effect/Effect";
|
|
8
8
|
import * as Stream from "effect/Stream";
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// src/context.ts
|
|
11
11
|
const fallbacks = /* @__PURE__ */ new WeakMap();
|
|
12
12
|
const createContext = (defaultValue) => {
|
|
13
13
|
const id = Symbol("ilha.context");
|
|
@@ -40,8 +40,7 @@ const context = (ctx) => {
|
|
|
40
40
|
return wrapHandle(found ?? Atom.make(ctx.defaultValue), fiber);
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
//#region src/error-boundary.ts
|
|
43
|
+
// src/error-boundary.ts
|
|
45
44
|
/** Catch subtree failures and paint a fallback. Supports reset(). */
|
|
46
45
|
const ErrorBoundary = (props) => {
|
|
47
46
|
const fiber = getFiber();
|
|
@@ -64,8 +63,7 @@ const ErrorBoundary = (props) => {
|
|
|
64
63
|
return props.children;
|
|
65
64
|
};
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
//#region src/watch.ts
|
|
66
|
+
// src/watch.ts
|
|
69
67
|
const ONCE = Symbol("ilha.watch.once");
|
|
70
68
|
/**
|
|
71
69
|
* Serial runs of one watch slot. Each run gets a fresh signal; starting the
|
|
@@ -140,8 +138,7 @@ const watch = Object.assign((source, fn) => {
|
|
|
140
138
|
return runner.cancel;
|
|
141
139
|
}) });
|
|
142
140
|
|
|
143
|
-
|
|
144
|
-
//#region src/when.ts
|
|
141
|
+
// src/when.ts
|
|
145
142
|
/** Rerun `body` for every value of `stream`, replacing the previous run. */
|
|
146
143
|
const when = (stream, body) => instr(Effect.suspend(() => {
|
|
147
144
|
const parent = getFiber();
|
|
@@ -158,5 +155,4 @@ const when = (stream, body) => instr(Effect.suspend(() => {
|
|
|
158
155
|
})).pipe(Effect.asVoid);
|
|
159
156
|
}));
|
|
160
157
|
|
|
161
|
-
//#endregion
|
|
162
158
|
export { ErrorBoundary, Fragment, IlhaError, atom, batch, context, createContext, h, mount, renderToString, unsafe, untrack, watch, when };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as Fragment } from "./types-
|
|
2
|
-
import { n as JSX } from "./vnode-
|
|
1
|
+
import { s as Fragment } from "./types-PD4B3pFq.js";
|
|
2
|
+
import { n as JSX } from "./vnode-R5QcXzyp.js";
|
|
3
3
|
import { jsx, jsxDEV, jsxs } from "./jsx-runtime.js";
|
|
4
4
|
export { Fragment, type JSX, jsx, jsxDEV, jsxs };
|
package/dist/jsx-dev-runtime.js
CHANGED
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { _ as View, d as JsxComponent, o as ComponentFn, p as PropBag, s as Fragment } from "./types-
|
|
2
|
-
import { n as JSX, t as h } from "./vnode-
|
|
3
|
-
//#region src/jsx-runtime.d.ts
|
|
1
|
+
import { _ as View, d as JsxComponent, o as ComponentFn, p as PropBag, s as Fragment } from "./types-PD4B3pFq.js";
|
|
2
|
+
import { n as JSX, t as h } from "./vnode-R5QcXzyp.js";
|
|
4
3
|
export declare const jsx: (type: string | Fragment | ComponentFn | JsxComponent, props: PropBag | null, key?: string | number) => ReturnType<typeof h>;
|
|
5
4
|
export declare const jsxs: typeof jsx;
|
|
6
5
|
export declare const jsxDEV: typeof jsx;
|
|
7
|
-
//#endregion
|
|
8
6
|
export { Fragment, type JSX, type View, h };
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as Fragment, t as h } from "./vnode-
|
|
1
|
+
import { r as Fragment, t as h } from "./vnode-C_vM-l5s.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/jsx-runtime.ts
|
|
4
4
|
const jsx = (type, props, key) => h(type, key === void 0 ? props : {
|
|
5
5
|
...props,
|
|
6
6
|
key
|
|
@@ -8,5 +8,4 @@ const jsx = (type, props, key) => h(type, key === void 0 ? props : {
|
|
|
8
8
|
const jsxs = jsx;
|
|
9
9
|
const jsxDEV = jsx;
|
|
10
10
|
|
|
11
|
-
//#endregion
|
|
12
11
|
export { Fragment, h, jsx, jsxDEV, jsxs };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as startRoot, v as ilhaError, y as ilhaWarn } from "./start-
|
|
2
|
-
import { c as isObject, n as KEY_ATTR, r as SLOT_ATTR } from "./shared-
|
|
3
|
-
import { i as bindEvents, r as adoptEvents, t as createPainter } from "./paint-core-
|
|
1
|
+
import { a as startRoot, v as ilhaError, y as ilhaWarn } from "./start-KNXoCAb9.js";
|
|
2
|
+
import { c as isObject, n as KEY_ATTR, r as SLOT_ATTR } from "./shared-Bz14CT7Z.js";
|
|
3
|
+
import { i as bindEvents, r as adoptEvents, t as createPainter } from "./paint-core-BDV_pKgC.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/morph.ts
|
|
6
6
|
const PRESERVE_ATTR = "data-morph-preserve";
|
|
7
7
|
const STAND_IN_ATTR = "data-ilha-reuse";
|
|
8
8
|
const FORM_ATTR = /^(?:value|checked|selected)$/u;
|
|
@@ -327,8 +327,7 @@ const hydrateInner = (from, to) => {
|
|
|
327
327
|
}
|
|
328
328
|
};
|
|
329
329
|
|
|
330
|
-
|
|
331
|
-
//#region src/paint.ts
|
|
330
|
+
// src/paint.ts
|
|
332
331
|
const toggleAttr = (el, name, on) => {
|
|
333
332
|
if (on) el.setAttribute(name, "");
|
|
334
333
|
else el.removeAttribute(name);
|
|
@@ -385,8 +384,7 @@ const { paint: paint$1 } = createPainter({
|
|
|
385
384
|
}
|
|
386
385
|
});
|
|
387
386
|
|
|
388
|
-
|
|
389
|
-
//#region src/snapshot.ts
|
|
387
|
+
// src/snapshot.ts
|
|
390
388
|
const MAX_SNAPSHOT_CHARS = 262144;
|
|
391
389
|
const MAX_SNAPSHOT_DEPTH = 32;
|
|
392
390
|
const UNSAFE_KEY = /^(?:__proto__|constructor|prototype)$/u;
|
|
@@ -412,8 +410,7 @@ const decodeSnapshot = (raw) => {
|
|
|
412
410
|
return Array.isArray(values) ? values : void 0;
|
|
413
411
|
};
|
|
414
412
|
|
|
415
|
-
|
|
416
|
-
//#region src/ssr-dom.ts
|
|
413
|
+
// src/ssr-dom.ts
|
|
417
414
|
const VOID = /^(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/u;
|
|
418
415
|
/** Tags whose children are raw text — content is not HTML-escaped. */
|
|
419
416
|
const RAW_TEXT = /^(?:script|style)$/u;
|
|
@@ -477,8 +474,7 @@ const serializeNode = (node, bare = false) => {
|
|
|
477
474
|
return `${open}${inner}</${tag}>`;
|
|
478
475
|
};
|
|
479
476
|
|
|
480
|
-
|
|
481
|
-
//#region src/ssr-paint.ts
|
|
477
|
+
// src/ssr-paint.ts
|
|
482
478
|
const WHITESPACE_RUN = /\s+/gu;
|
|
483
479
|
/**
|
|
484
480
|
* Mark the first option whose value is `value` selected and clear the rest,
|
|
@@ -527,8 +523,7 @@ const { paint } = createPainter({
|
|
|
527
523
|
}
|
|
528
524
|
});
|
|
529
525
|
|
|
530
|
-
|
|
531
|
-
//#region src/mount.ts
|
|
526
|
+
// src/mount.ts
|
|
532
527
|
const readSnapshot = (el) => {
|
|
533
528
|
const raw = (el.matches("[data-ilha]") ? el : el.querySelector("[data-ilha]"))?.getAttribute("data-ilha-state");
|
|
534
529
|
if (raw) return decodeSnapshot(raw);
|
|
@@ -581,5 +576,4 @@ const renderToString = async (fn, opts) => {
|
|
|
581
576
|
return state ? `<template${state}></template>${inner}` : inner;
|
|
582
577
|
};
|
|
583
578
|
|
|
584
|
-
//#endregion
|
|
585
579
|
export { mountWithRuntime as n, renderToString as r, mount as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { a as Component, f as MountOptions } from "./types-
|
|
2
|
-
//#region src/mount.d.ts
|
|
1
|
+
import { a as Component, f as MountOptions } from "./types-PD4B3pFq.js";
|
|
3
2
|
interface RenderToStringOptions {
|
|
4
3
|
/** Embed atom state for hydration. Default `true`. */
|
|
5
4
|
snapshot?: boolean;
|
|
@@ -10,5 +9,4 @@ interface RenderToStringOptions {
|
|
|
10
9
|
}
|
|
11
10
|
declare const mount: (el: Element, fn: Component, opts?: MountOptions) => (() => void);
|
|
12
11
|
declare const renderToString: (fn: Component, opts?: RenderToStringOptions) => Promise<string>;
|
|
13
|
-
//#endregion
|
|
14
12
|
export { mount as n, renderToString as r, RenderToStringOptions as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { g as makeFiber, i as runSetup, m as closeFiber, n as notifyRoots, r as rootListeners, u as isAtomHandle, y as ilhaWarn } from "./start-
|
|
2
|
-
import { a as hasBrand, c as isObject, d as skip, l as isString, n as KEY_ATTR, o as isFunction, p as unwrap, r as SLOT_ATTR, s as isIterable, t as KEEP, u as noop } from "./shared-
|
|
3
|
-
import { n as isVNode, r as Fragment } from "./vnode-
|
|
1
|
+
import { g as makeFiber, i as runSetup, m as closeFiber, n as notifyRoots, r as rootListeners, u as isAtomHandle, y as ilhaWarn } from "./start-KNXoCAb9.js";
|
|
2
|
+
import { a as hasBrand, c as isObject, d as skip, l as isString, n as KEY_ATTR, o as isFunction, p as unwrap, r as SLOT_ATTR, s as isIterable, t as KEEP, u as noop } from "./shared-Bz14CT7Z.js";
|
|
3
|
+
import { n as isVNode, r as Fragment } from "./vnode-C_vM-l5s.js";
|
|
4
4
|
import * as Effect from "effect/Effect";
|
|
5
5
|
import * as Stream from "effect/Stream";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/events.ts
|
|
8
8
|
const EVENT_PROP = /^on(?:[A-Z].{2,}|[a-z]{3,}$)/u;
|
|
9
9
|
/** `onClick` / `onclick` → `click`; non-event props → `undefined`. */
|
|
10
10
|
const eventTypeFromProp = (key) => EVENT_PROP.test(key) ? key.slice(2).toLowerCase() : void 0;
|
|
@@ -43,8 +43,7 @@ const adoptEvents = (live, fresh) => {
|
|
|
43
43
|
if (fresh.__ilhaFiber) install(live, fresh.__ilhaHandlers, fresh.__ilhaFiber);
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
//#region src/security.ts
|
|
46
|
+
// src/security.ts
|
|
48
47
|
const SAFE_CSS_PROP = /^-{0,2}[a-zA-Z][a-zA-Z0-9-]*$/u;
|
|
49
48
|
const URL_ATTR = /(?:^|:)(?:href|src|srcset|imagesrcset|action|formaction|cite|data|poster)$/iu;
|
|
50
49
|
const SRCSET_ATTR = /^(?:srcset|imagesrcset)$/iu;
|
|
@@ -72,8 +71,7 @@ const serializeStyleAttr = (value) => {
|
|
|
72
71
|
}) : Object.entries(value)).filter(([k, v]) => k && v !== null && v !== void 0 && SAFE_CSS_PROP.test(k) && isSafeStyleValue(String(v))).map(([k, v]) => `${(k ?? "").replaceAll(/[A-Z]/gu, (m) => `-${m.toLowerCase()}`)}:${String(v)}`).join(";");
|
|
73
72
|
};
|
|
74
73
|
|
|
75
|
-
|
|
76
|
-
//#region src/unsafe.ts
|
|
74
|
+
// src/unsafe.ts
|
|
77
75
|
/**
|
|
78
76
|
* Mark a string as pre-rendered HTML and paint it without escaping.
|
|
79
77
|
* Use it for markup you built or sanitized yourself — SVG from an external
|
|
@@ -88,8 +86,7 @@ const unsafe = (html) => ({
|
|
|
88
86
|
});
|
|
89
87
|
const isUnsafeHtml = (x) => hasBrand(x, "$$ilhaUnsafe");
|
|
90
88
|
|
|
91
|
-
|
|
92
|
-
//#region src/paint-core.ts
|
|
89
|
+
// src/paint-core.ts
|
|
93
90
|
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
94
91
|
const MATHML_NS = "http://www.w3.org/1998/Math/MathML";
|
|
95
92
|
const elementNs = (lower, parent) => {
|
|
@@ -346,5 +343,4 @@ const createPainter = (ops) => {
|
|
|
346
343
|
return self;
|
|
347
344
|
};
|
|
348
345
|
|
|
349
|
-
//#endregion
|
|
350
346
|
export { bindEvents as i, unsafe as n, adoptEvents as r, createPainter as t };
|
package/dist/renderer.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { _ as View, a as Component, c as IlhaRuntime, m as PropValue, p as PropBag } from "./types-
|
|
2
|
-
import { n as getFiber, t as FiberLocal } from "./runtime-
|
|
3
|
-
//#region src/paint-core.d.ts
|
|
1
|
+
import { _ as View, a as Component, c as IlhaRuntime, m as PropValue, p as PropBag } from "./types-PD4B3pFq.js";
|
|
2
|
+
import { n as getFiber, t as FiberLocal } from "./runtime-Z5KugPXX.js";
|
|
4
3
|
/** Structural element API shared by DOM `Element`, the SSR shim, and custom hosts. */
|
|
5
4
|
interface PaintEl<Node> {
|
|
6
5
|
readonly tagName: string;
|
|
@@ -47,11 +46,7 @@ interface Painter<Node> {
|
|
|
47
46
|
paint: (fiber: FiberLocal, view: View) => void;
|
|
48
47
|
materialize: (view: View, fiber: FiberLocal) => Node[];
|
|
49
48
|
}
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/events.d.ts
|
|
52
49
|
export declare const bindEvents: (el: Element, props: PropBag, fiber: FiberLocal) => void;
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region src/renderer.d.ts
|
|
55
50
|
export interface RendererMountOptions {
|
|
56
51
|
/**
|
|
57
52
|
* Called with a failing root component, and with a nested component no
|
|
@@ -79,5 +74,4 @@ export interface HostRenderer<Node> {
|
|
|
79
74
|
}
|
|
80
75
|
/** Build a renderer for a host described by `ops`. */
|
|
81
76
|
export declare const createRenderer: <Node, El extends PaintEl<Node> & Node>(ops: PaintOps<Node, El>) => HostRenderer<Node>;
|
|
82
|
-
//#endregion
|
|
83
77
|
export { type Component, type FiberLocal, type FormControlKey, type IlhaRuntime, type PaintEl, type PaintOps, type Painter, type PropBag, type PropValue, type View, getFiber };
|
package/dist/renderer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as startRoot, h as getFiber } from "./start-
|
|
2
|
-
import { i as bindEvents, t as createPainter } from "./paint-core-
|
|
1
|
+
import { a as startRoot, h as getFiber } from "./start-KNXoCAb9.js";
|
|
2
|
+
import { i as bindEvents, t as createPainter } from "./paint-core-BDV_pKgC.js";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/renderer.ts
|
|
5
5
|
/**
|
|
6
6
|
* Host renderer seam.
|
|
7
7
|
*
|
|
@@ -39,5 +39,4 @@ const createRenderer = (ops) => {
|
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
//#endregion
|
|
43
42
|
export { bindEvents, createRenderer, getFiber };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { _ as View, b as WatchOnceCleanup, c as IlhaRuntime, l as Instruction, n as AtomHandle, p as PropBag, v as WatchCallback, y as WatchContext } from "./types-
|
|
2
|
-
import "./snapshot-
|
|
1
|
+
import { _ as View, b as WatchOnceCleanup, c as IlhaRuntime, l as Instruction, n as AtomHandle, p as PropBag, v as WatchCallback, y as WatchContext } from "./types-PD4B3pFq.js";
|
|
2
|
+
import "./snapshot-rTWQB3iQ.js";
|
|
3
3
|
import * as Atom from "effect/reactivity/Atom";
|
|
4
4
|
import * as Effect from "effect/Effect";
|
|
5
5
|
import * as Stream from "effect/Stream";
|
|
6
6
|
import { AtomRegistry } from "effect/reactivity/AtomRegistry";
|
|
7
7
|
import * as Scope from "effect/Scope";
|
|
8
|
-
//#region src/watch.d.ts
|
|
9
8
|
/** Values delivered to watch callbacks. */
|
|
10
9
|
type WatchValue = string | number | boolean | bigint | null | undefined | readonly WatchValue[] | WatchRecord;
|
|
11
10
|
interface WatchRecord {
|
|
@@ -31,8 +30,6 @@ interface WatchFn {
|
|
|
31
30
|
once: (fn: WatchRun) => Instruction<void>;
|
|
32
31
|
}
|
|
33
32
|
declare const watch: WatchFn;
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/runtime.d.ts
|
|
36
33
|
/** A disposable a paint leaves behind: a child fiber, subscription, or ref. */
|
|
37
34
|
interface Hole {
|
|
38
35
|
dispose: () => void;
|
|
@@ -87,5 +84,4 @@ interface FiberLocal {
|
|
|
87
84
|
fail: <E>(e: E) => void;
|
|
88
85
|
}
|
|
89
86
|
declare const getFiber: () => FiberLocal;
|
|
90
|
-
//#endregion
|
|
91
87
|
export { getFiber as n, watch as r, FiberLocal as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as AsyncResult from "effect/reactivity/AsyncResult";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/shared.ts
|
|
4
4
|
const KEY_ATTR = "data-ilha-key";
|
|
5
5
|
const SLOT_ATTR = "data-ilha-slot";
|
|
6
6
|
const isString = (value) => typeof value === "string";
|
|
@@ -32,5 +32,4 @@ const errorView = (e) => ({
|
|
|
32
32
|
type: "pre"
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
//#endregion
|
|
36
35
|
export { hasBrand as a, isObject as c, skip as d, toError as f, errorView as i, isString as l, KEY_ATTR as n, isFunction as o, unwrap as p, SLOT_ATTR as r, isIterable as s, KEEP as t, noop as u };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { u as JsonText } from "./types-
|
|
2
|
-
//#region src/snapshot.d.ts
|
|
1
|
+
import { u as JsonText } from "./types-PD4B3pFq.js";
|
|
3
2
|
/** JSON values accepted in SSR hydrate snapshots. */
|
|
4
3
|
type SnapshotValue = JsonText | SnapshotObject | readonly SnapshotValue[];
|
|
5
4
|
interface SnapshotObject {
|
|
6
5
|
readonly [key: string]: SnapshotValue | undefined;
|
|
7
6
|
}
|
|
8
|
-
//#endregion
|
|
9
7
|
export { SnapshotValue as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as hasBrand, f as toError, i as errorView, o as isFunction, u as noop } from "./shared-
|
|
1
|
+
import { a as hasBrand, f as toError, i as errorView, o as isFunction, u as noop } from "./shared-Bz14CT7Z.js";
|
|
2
2
|
import * as Atom from "effect/reactivity/Atom";
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Equal from "effect/Equal";
|
|
@@ -9,7 +9,7 @@ import * as Exit from "effect/Exit";
|
|
|
9
9
|
import * as Registry from "effect/reactivity/AtomRegistry";
|
|
10
10
|
import * as Scope from "effect/Scope";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
// src/diagnostics.ts
|
|
13
13
|
const DOCS_ORIGIN = "https://ilha.build/errors";
|
|
14
14
|
const CATALOG = {
|
|
15
15
|
ILHA001: {
|
|
@@ -68,8 +68,7 @@ const ilhaWarn = (code, detail) => {
|
|
|
68
68
|
console.warn(ilhaError(code, detail).message);
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
//#region src/runtime.ts
|
|
71
|
+
// src/runtime.ts
|
|
73
72
|
const stack = [];
|
|
74
73
|
const getActiveFiber = () => stack.findLast((x) => !x.closed);
|
|
75
74
|
const getFiber = () => {
|
|
@@ -200,8 +199,7 @@ const makeFiber = (runtime, root, paint, opts) => {
|
|
|
200
199
|
return fiber;
|
|
201
200
|
};
|
|
202
201
|
|
|
203
|
-
|
|
204
|
-
//#region src/atom.ts
|
|
202
|
+
// src/atom.ts
|
|
205
203
|
/** Wrap an effect as a `yield*`-able, awaitable instruction bound to the active fiber. */
|
|
206
204
|
const instr = (effect) => {
|
|
207
205
|
const fiber = getFiber();
|
|
@@ -394,8 +392,7 @@ const atom = Object.assign((init, options) => {
|
|
|
394
392
|
}, { lazy: (init, options) => useSlot(options?.snapshot !== false, (fiber, seed) => holdState(fiber, Atom.make(seed === void 0 ? init() : seed))) });
|
|
395
393
|
const { batch } = Atom;
|
|
396
394
|
|
|
397
|
-
|
|
398
|
-
//#region src/interpret.ts
|
|
395
|
+
// src/interpret.ts
|
|
399
396
|
/** Drive a generator component: paint yielded views, run yielded effects. */
|
|
400
397
|
const interpret = (gen, fiber) => {
|
|
401
398
|
const iter = gen();
|
|
@@ -434,8 +431,7 @@ const interpret = (gen, fiber) => {
|
|
|
434
431
|
resume();
|
|
435
432
|
};
|
|
436
433
|
|
|
437
|
-
|
|
438
|
-
//#region src/start.ts
|
|
434
|
+
// src/start.ts
|
|
439
435
|
/** Render `fn` into `fiber` and rerender when an atom it read changes. */
|
|
440
436
|
const runSetup = (fiber, fn) => {
|
|
441
437
|
const render = () => {
|
|
@@ -511,5 +507,4 @@ const startRoot = ({ fn, root, paint, ssr, hydrate, snapshot, onError, onIdle, o
|
|
|
511
507
|
};
|
|
512
508
|
};
|
|
513
509
|
|
|
514
|
-
//#endregion
|
|
515
510
|
export { IlhaError as _, startRoot as a, batch as c, untrack as d, wrapHandle as f, makeFiber as g, getFiber as h, runSetup as i, instr as l, closeFiber as m, notifyRoots as n, interpret as o, clearFiberView as p, rootListeners as r, atom as s, liveRoots as t, isAtomHandle as u, ilhaError as v, ilhaWarn as y };
|
package/dist/test.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { a as Component } from "./types-
|
|
2
|
-
import { t as SnapshotValue } from "./snapshot-
|
|
1
|
+
import { a as Component } from "./types-PD4B3pFq.js";
|
|
2
|
+
import { t as SnapshotValue } from "./snapshot-rTWQB3iQ.js";
|
|
3
3
|
import { IlhaInspectNode } from "./debug.js";
|
|
4
|
-
import { t as RenderToStringOptions } from "./mount-
|
|
5
|
-
//#region src/test.d.ts
|
|
4
|
+
import { t as RenderToStringOptions } from "./mount-DWQcWHqc.js";
|
|
6
5
|
export interface RenderOptions {
|
|
7
6
|
/** Render on the server first and inject the HTML into the container. Default `false`. */
|
|
8
7
|
ssr?: boolean;
|
|
@@ -62,5 +61,4 @@ export declare const renderHtml: (fn: Component, opts?: RenderToStringOptions) =
|
|
|
62
61
|
* `await ui.settled()` before reading `html()`.
|
|
63
62
|
*/
|
|
64
63
|
export declare const render: (fn: Component, opts?: RenderOptions) => TestUi;
|
|
65
|
-
//#endregion
|
|
66
64
|
export type { IlhaInspectNode };
|
package/dist/test.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { f as toError, l as isString } from "./shared-
|
|
2
|
-
import { n as mountWithRuntime, r as renderToString } from "./mount-
|
|
1
|
+
import { f as toError, l as isString } from "./shared-Bz14CT7Z.js";
|
|
2
|
+
import { n as mountWithRuntime, r as renderToString } from "./mount-CLPxbsAX.js";
|
|
3
3
|
import { inspect } from "./debug.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/test.ts
|
|
6
6
|
const MICROTASK_TURNS = 4;
|
|
7
7
|
const SNIPPET_LENGTH = 400;
|
|
8
8
|
const requireDocument = () => {
|
|
@@ -175,5 +175,4 @@ const render = (fn, opts = {}) => {
|
|
|
175
175
|
};
|
|
176
176
|
};
|
|
177
177
|
|
|
178
|
-
//#endregion
|
|
179
178
|
export { render, renderHtml };
|
|
@@ -2,7 +2,6 @@ import { AtomRegistry } from "effect/reactivity/AtomRegistry";
|
|
|
2
2
|
import { Closeable } from "effect/Scope";
|
|
3
3
|
import { Effect, Stream } from "effect";
|
|
4
4
|
import { Atom } from "effect/reactivity";
|
|
5
|
-
//#region src/types.d.ts
|
|
6
5
|
type JsonText = string | number | bigint | boolean | null | undefined;
|
|
7
6
|
/** Runtime prop bag values painted onto elements / passed to components. */
|
|
8
7
|
type PropValue = JsonText | PropBag | StyleObject | EventHandler | AtomHandle<JsonText> | readonly PropValue[];
|
|
@@ -116,5 +115,4 @@ interface MountOptions {
|
|
|
116
115
|
*/
|
|
117
116
|
onIdle?: () => void;
|
|
118
117
|
}
|
|
119
|
-
//#endregion
|
|
120
118
|
export { View as _, Component as a, WatchOnceCleanup as b, IlhaRuntime as c, JsxComponent as d, MountOptions as f, VNode as g, UnsafeHtml as h, AtomOptions as i, Instruction as l, PropValue as m, AtomHandle as n, ComponentFn as o, PropBag as p, AtomLazyOptions as r, Fragment as s, AtomEquality as t, JsonText as u, WatchCallback as v, Yielded as x, WatchContext as y };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { a as hasBrand } from "./shared-
|
|
1
|
+
import { a as hasBrand } from "./shared-Bz14CT7Z.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/types.ts
|
|
4
4
|
const Fragment = Symbol("ilha.Fragment");
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
//#region src/vnode.ts
|
|
6
|
+
// src/vnode.ts
|
|
8
7
|
const createVNode = (type, props, ...rest) => {
|
|
9
8
|
const { key, children, ...own } = props ?? {};
|
|
10
9
|
return {
|
|
@@ -18,5 +17,4 @@ const createVNode = (type, props, ...rest) => {
|
|
|
18
17
|
const h = createVNode;
|
|
19
18
|
const isVNode = (x) => hasBrand(x, "$$ilha");
|
|
20
19
|
|
|
21
|
-
//#endregion
|
|
22
20
|
export { isVNode as n, Fragment as r, h as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { _ as View, d as JsxComponent, g as VNode, n as AtomHandle, o as ComponentFn, p as PropBag, s as Fragment } from "./types-
|
|
2
|
-
//#region src/jsx-types.d.ts
|
|
1
|
+
import { _ as View, d as JsxComponent, g as VNode, n as AtomHandle, o as ComponentFn, p as PropBag, s as Fragment } from "./types-PD4B3pFq.js";
|
|
3
2
|
declare namespace JSX {
|
|
4
3
|
export type Element = View;
|
|
5
4
|
export type ElementType = string | ((props: never) => View | Promise<View | undefined> | Generator<View, View | undefined, View> | undefined);
|
|
@@ -590,8 +589,6 @@ declare namespace JSX {
|
|
|
590
589
|
}
|
|
591
590
|
export {};
|
|
592
591
|
}
|
|
593
|
-
//#endregion
|
|
594
|
-
//#region src/vnode.d.ts
|
|
595
592
|
/**
|
|
596
593
|
* Build a vnode. A component with typed props gets its props checked against
|
|
597
594
|
* that type; elements and untyped components take a plain prop bag.
|
|
@@ -601,5 +598,4 @@ interface HFn {
|
|
|
601
598
|
(type: string | Fragment | ComponentFn | JsxComponent, props: PropBag | null | undefined, ...rest: View[]): VNode;
|
|
602
599
|
}
|
|
603
600
|
declare const h: HFn;
|
|
604
|
-
//#endregion
|
|
605
601
|
export { JSX as n, h as t };
|
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ilha
|
|
2
2
|
|
|
3
|
-
> Tiny, isomorphic islands UI library on Effect 4. Function components, order-based `atom()` slots, JSX, SSR via `renderToString`, hydration via `mount(host, C, { hydrate: true })`. Version 0.16.
|
|
3
|
+
> Tiny, isomorphic islands UI library on Effect 4. Function components, order-based `atom()` slots, JSX, SSR via `renderToString`, hydration via `mount(host, C, { hydrate: true })`. Version 0.16.1.
|
|
4
4
|
|
|
5
5
|
Start with the canonical-usage table: exactly one API per task, plus a never-do list.
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ilha",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "Generator-first island UI on Effect",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect",
|
|
@@ -74,10 +74,9 @@
|
|
|
74
74
|
"typecheck": "tsc -p tsconfig.types.json --noEmit"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"
|
|
78
|
-
"effect": "^4.0.0"
|
|
77
|
+
"effect": "^4.1.0"
|
|
79
78
|
},
|
|
80
79
|
"peerDependencies": {
|
|
81
|
-
"effect": "^4.
|
|
80
|
+
"effect": "^4.1.0"
|
|
82
81
|
}
|
|
83
82
|
}
|