ilha 0.16.2 → 0.17.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/AGENTS.md +1 -1
- package/MIGRATIONS.json +10 -0
- package/MIGRATIONS.md +19 -0
- package/dist/debug.d.ts +16 -0
- package/dist/debug.js +29 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/jsx-dev-runtime.d.ts +1 -1
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/jsx-runtime.js +2 -2
- package/dist/{mount-nRxVumCX.js → mount-DasU5vUu.js} +1 -1
- package/dist/{paint-core-cWLlHxoA.js → paint-core-CeZAur6B.js} +1 -1
- package/dist/renderer.js +1 -1
- package/dist/test.js +1 -1
- package/dist/{vnode-C_vM-l5s.js → vnode-BCzd8Wty.js} +6 -1
- package/dist/{vnode-rJ7hy6yD.d.ts → vnode-_Uzvb-v-.d.ts} +14 -4
- package/llms.txt +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
package/MIGRATIONS.json
CHANGED
|
@@ -101,6 +101,16 @@
|
|
|
101
101
|
"docs": "https://ilha.build/guide/ui/state",
|
|
102
102
|
"before": "const save = atom(Atom.fn((draft: Draft) => saveDraft(draft)));\nsave.set(draft as never);",
|
|
103
103
|
"after": "const save = atom(Atom.fn((draft: Draft) => saveDraft(draft)));\nsave.set(draft);"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"id": "h-typed-props",
|
|
107
|
+
"kind": "changed",
|
|
108
|
+
"api": "h",
|
|
109
|
+
"import": "ilha",
|
|
110
|
+
"replacement": "h() is type-checked like JSX. Intrinsic tags take exactly their JSX props; unknown tags, misspelt attributes, and wrongly typed handlers are compile errors. Custom elements (`my-widget`) still take any props. A tag typed as plain `string` (or props typed as `Record<string, unknown>`) no longer type-checks: narrow the tag to `keyof JSX.IntrinsicElements` and type the props as `JSX.IntrinsicElements[tag]`.",
|
|
111
|
+
"docs": "https://ilha.build/guide/recipes/h",
|
|
112
|
+
"before": "h(\"button\", { onClick: \"alert(1)\" }, \"x\");",
|
|
113
|
+
"after": "h(\"button\", { type: \"button\", onclick: () => go() }, \"x\");"
|
|
104
114
|
}
|
|
105
115
|
]
|
|
106
116
|
}
|
package/MIGRATIONS.md
CHANGED
|
@@ -217,3 +217,22 @@ After:
|
|
|
217
217
|
const save = atom(Atom.fn((draft: Draft) => saveDraft(draft)));
|
|
218
218
|
save.set(draft);
|
|
219
219
|
```
|
|
220
|
+
|
|
221
|
+
## h
|
|
222
|
+
|
|
223
|
+
- Status: changed
|
|
224
|
+
- Import: `ilha`
|
|
225
|
+
- Replacement: h() is type-checked like JSX. Intrinsic tags take exactly their JSX props; unknown tags, misspelt attributes, and wrongly typed handlers are compile errors. Custom elements (`my-widget`) still take any props. A tag typed as plain `string` (or props typed as `Record<string, unknown>`) no longer type-checks: narrow the tag to `keyof JSX.IntrinsicElements` and type the props as `JSX.IntrinsicElements[tag]`.
|
|
226
|
+
- Docs: https://ilha.build/guide/recipes/h
|
|
227
|
+
|
|
228
|
+
Before:
|
|
229
|
+
|
|
230
|
+
```ts
|
|
231
|
+
h("button", { onClick: "alert(1)" }, "x");
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
After:
|
|
235
|
+
|
|
236
|
+
```ts
|
|
237
|
+
h("button", { type: "button", onclick: () => go() }, "x");
|
|
238
|
+
```
|
package/dist/debug.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { t as SnapshotValue } from "./snapshot-BFdyCq2T.js";
|
|
2
|
+
import * as Atom from "effect/reactivity/Atom";
|
|
2
3
|
/** An atom value made JSON-safe: functions and Effects become `<…>` strings. */
|
|
3
4
|
export type InspectValue = SnapshotValue | string;
|
|
4
5
|
export interface IlhaInspectAtom {
|
|
@@ -21,6 +22,13 @@ export type SetAtomResult = {
|
|
|
21
22
|
ok: false;
|
|
22
23
|
reason: string;
|
|
23
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Reduce any value to JSON, naming what JSON cannot carry. Powers
|
|
27
|
+
* `inspect()` and the `@ilha/model` message log: functions, Effects, and
|
|
28
|
+
* class instances become `<…>` strings, `Option` becomes a tagged record,
|
|
29
|
+
* cycles become `"<circular>"`, and containers deeper than 6 stay folded.
|
|
30
|
+
*/
|
|
31
|
+
export declare const summarizeValue: <T>(value: T) => InspectValue;
|
|
24
32
|
/**
|
|
25
33
|
* JSON-serializable trees of the live roots: component names, atom values,
|
|
26
34
|
* and child components. Pass `host` to inspect one root or component host.
|
|
@@ -30,6 +38,14 @@ export declare const inspect: (host?: Element) => IlhaInspectNode[];
|
|
|
30
38
|
export declare const roots: () => Element[];
|
|
31
39
|
/** The element an inspected component paints into, to highlight or measure. */
|
|
32
40
|
export declare const element: (id: string) => Element | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Live primitive atoms of component `id`, in declaration order, or
|
|
43
|
+
* `undefined` for an unknown id. Devtools bridges join these against their
|
|
44
|
+
* own registries — `@ilha/model` keys its message log by the state atom —
|
|
45
|
+
* because summarized JSON cannot carry object identity. `inspect()` itself
|
|
46
|
+
* is unchanged: no new fields, no new cost.
|
|
47
|
+
*/
|
|
48
|
+
export declare const atomsOf: (id: string) => readonly Atom.Atom<unknown>[] | undefined;
|
|
33
49
|
/**
|
|
34
50
|
* Replace atom `index` of component `id` with a JSON `value`. Only writable
|
|
35
51
|
* state atoms accept it; derived atoms and Effect atoms report why they cannot.
|
package/dist/debug.js
CHANGED
|
@@ -2,6 +2,7 @@ import { r as rootListeners, t as liveRoots } from "./start-j8x3mJSh.js";
|
|
|
2
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
|
+
import * as Option from "effect/Option";
|
|
5
6
|
import * as Stream from "effect/Stream";
|
|
6
7
|
import * as AsyncResult from "effect/reactivity/AsyncResult";
|
|
7
8
|
|
|
@@ -44,6 +45,13 @@ const summarizeAsync = (value, depth, seen) => {
|
|
|
44
45
|
if (payload._tag === "Some") return walk.summarize(payload.value, depth, seen);
|
|
45
46
|
return AsyncResult.isWaiting(value) ? "<AsyncResult waiting>" : "<AsyncResult initial>";
|
|
46
47
|
};
|
|
48
|
+
const summarizeOption = (value, depth, seen) => {
|
|
49
|
+
if (depth >= MAX_DEPTH) return "<Option>";
|
|
50
|
+
return Option.isSome(value) ? {
|
|
51
|
+
_tag: "Some",
|
|
52
|
+
value: walk.summarize(value.value, depth + 1, seen)
|
|
53
|
+
} : { _tag: "None" };
|
|
54
|
+
};
|
|
47
55
|
const summarizeList = (items, depth, seen) => {
|
|
48
56
|
if (depth >= MAX_DEPTH) return `<Array(${items.length})>`;
|
|
49
57
|
const out = items.slice(0, MAX_ITEMS).map((item) => walk.summarize(item, depth + 1, seen));
|
|
@@ -86,6 +94,7 @@ const summarizeContainer = (value, depth, seen) => {
|
|
|
86
94
|
if (seen.has(value)) return "<circular>";
|
|
87
95
|
seen.add(value);
|
|
88
96
|
try {
|
|
97
|
+
if (Option.isOption(value)) return summarizeOption(value, depth, seen);
|
|
89
98
|
if (Array.isArray(value)) return summarizeList(value, depth, seen);
|
|
90
99
|
return isPlainObject(value) ? summarizeRecord(value, depth, seen) : `<${constructorName(value)}>`;
|
|
91
100
|
} finally {
|
|
@@ -95,6 +104,13 @@ const summarizeContainer = (value, depth, seen) => {
|
|
|
95
104
|
/** Reduce any value to JSON, naming what JSON cannot carry. */
|
|
96
105
|
const summarize = (value, depth, seen) => isObject(value) || Array.isArray(value) ? summarizeContainer(value, depth, seen) : summarizeLeaf(value);
|
|
97
106
|
walk.summarize = summarize;
|
|
107
|
+
/**
|
|
108
|
+
* Reduce any value to JSON, naming what JSON cannot carry. Powers
|
|
109
|
+
* `inspect()` and the `@ilha/model` message log: functions, Effects, and
|
|
110
|
+
* class instances become `<…>` strings, `Option` becomes a tagged record,
|
|
111
|
+
* cycles become `"<circular>"`, and containers deeper than 6 stay folded.
|
|
112
|
+
*/
|
|
113
|
+
const summarizeValue = (value) => summarize(value, 0, /* @__PURE__ */ new WeakSet());
|
|
98
114
|
const ids = /* @__PURE__ */ new WeakMap();
|
|
99
115
|
let lastId = 0;
|
|
100
116
|
const idOf = (fiber) => {
|
|
@@ -173,6 +189,18 @@ const element = (id) => {
|
|
|
173
189
|
return isDomElement(root) ? root : void 0;
|
|
174
190
|
};
|
|
175
191
|
/**
|
|
192
|
+
* Live primitive atoms of component `id`, in declaration order, or
|
|
193
|
+
* `undefined` for an unknown id. Devtools bridges join these against their
|
|
194
|
+
* own registries — `@ilha/model` keys its message log by the state atom —
|
|
195
|
+
* because summarized JSON cannot carry object identity. `inspect()` itself
|
|
196
|
+
* is unchanged: no new fields, no new cost.
|
|
197
|
+
*/
|
|
198
|
+
const atomsOf = (id) => {
|
|
199
|
+
const fiber = findFiber(id);
|
|
200
|
+
if (fiber === void 0) return;
|
|
201
|
+
return [...fiber.primitives ?? []];
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
176
204
|
* Replace atom `index` of component `id` with a JSON `value`. Only writable
|
|
177
205
|
* state atoms accept it; derived atoms and Effect atoms report why they cannot.
|
|
178
206
|
*/
|
|
@@ -213,4 +241,4 @@ const onChange = (listener) => {
|
|
|
213
241
|
};
|
|
214
242
|
};
|
|
215
243
|
|
|
216
|
-
export { element, inspect, onChange, roots, setAtom };
|
|
244
|
+
export { atomsOf, element, inspect, onChange, roots, setAtom, summarizeValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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-a9_yNjbT.js";
|
|
2
|
-
import {
|
|
2
|
+
import { n as h } from "./vnode-_Uzvb-v-.js";
|
|
3
3
|
import { r as watch } from "./runtime-3jr7FulJ.js";
|
|
4
4
|
import { n as mount, r as renderToString, t as RenderToStringOptions } from "./mount-ChhKs7A2.js";
|
|
5
5
|
import * as Atom from "effect/reactivity/Atom";
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
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-j8x3mJSh.js";
|
|
2
2
|
import { i as errorView, o as isFunction } from "./shared-Bz14CT7Z.js";
|
|
3
|
-
import { n as unsafe } from "./paint-core-
|
|
4
|
-
import { r as renderToString, t as mount } from "./mount-
|
|
5
|
-
import {
|
|
3
|
+
import { n as unsafe } from "./paint-core-CeZAur6B.js";
|
|
4
|
+
import { r as renderToString, t as mount } from "./mount-DasU5vUu.js";
|
|
5
|
+
import { i as Fragment, n as h } from "./vnode-BCzd8Wty.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";
|
package/dist/jsx-dev-runtime.js
CHANGED
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as View, d as JsxComponent, o as ComponentFn, p as PropBag, s as Fragment } from "./types-a9_yNjbT.js";
|
|
2
|
-
import { n as JSX, t as
|
|
3
|
-
export declare const jsx: (type: string | Fragment | ComponentFn | JsxComponent, props: PropBag | null, key?: string | number) => ReturnType<typeof
|
|
2
|
+
import { n as h, r as JSX, t as createVNode } from "./vnode-_Uzvb-v-.js";
|
|
3
|
+
export declare const jsx: (type: string | Fragment | ComponentFn | JsxComponent, props: PropBag | null, key?: string | number) => ReturnType<typeof createVNode>;
|
|
4
4
|
export declare const jsxs: typeof jsx;
|
|
5
5
|
export declare const jsxDEV: typeof jsx;
|
|
6
6
|
export { Fragment, type JSX, type View, h };
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as Fragment, n as h, t as createVNode } from "./vnode-BCzd8Wty.js";
|
|
2
2
|
|
|
3
3
|
// src/jsx-runtime.ts
|
|
4
|
-
const jsx = (type, props, key) =>
|
|
4
|
+
const jsx = (type, props, key) => createVNode(type, key === void 0 ? props : {
|
|
5
5
|
...props,
|
|
6
6
|
key
|
|
7
7
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as startRoot, v as ilhaError, y as ilhaWarn } from "./start-j8x3mJSh.js";
|
|
2
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-
|
|
3
|
+
import { i as bindEvents, r as adoptEvents, t as createPainter } from "./paint-core-CeZAur6B.js";
|
|
4
4
|
|
|
5
5
|
// src/morph.ts
|
|
6
6
|
const PRESERVE_ATTR = "data-morph-preserve";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
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-j8x3mJSh.js";
|
|
2
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 {
|
|
3
|
+
import { i as Fragment, r as isVNode } from "./vnode-BCzd8Wty.js";
|
|
4
4
|
import * as Effect from "effect/Effect";
|
|
5
5
|
import * as Stream from "effect/Stream";
|
|
6
6
|
|
package/dist/renderer.js
CHANGED
package/dist/test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { f as toError, l as isString } from "./shared-Bz14CT7Z.js";
|
|
2
|
-
import { n as mountWithRuntime, r as renderToString } from "./mount-
|
|
2
|
+
import { n as mountWithRuntime, r as renderToString } from "./mount-DasU5vUu.js";
|
|
3
3
|
import { inspect } from "./debug.js";
|
|
4
4
|
|
|
5
5
|
// src/test.ts
|
|
@@ -4,6 +4,11 @@ import { a as hasBrand } from "./shared-Bz14CT7Z.js";
|
|
|
4
4
|
const Fragment = Symbol("ilha.Fragment");
|
|
5
5
|
|
|
6
6
|
// src/vnode.ts
|
|
7
|
+
/**
|
|
8
|
+
* Untyped factory behind `h`; the JSX runtime forwards through here.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
7
12
|
const createVNode = (type, props, ...rest) => {
|
|
8
13
|
const { key, children, ...own } = props ?? {};
|
|
9
14
|
return {
|
|
@@ -17,4 +22,4 @@ const createVNode = (type, props, ...rest) => {
|
|
|
17
22
|
const h = createVNode;
|
|
18
23
|
const isVNode = (x) => hasBrand(x, "$$ilha");
|
|
19
24
|
|
|
20
|
-
export {
|
|
25
|
+
export { Fragment as i, h as n, isVNode as r, createVNode as t };
|
|
@@ -574,6 +574,7 @@ declare namespace JSX {
|
|
|
574
574
|
use: SVGAttributes & {
|
|
575
575
|
href?: Attr;
|
|
576
576
|
};
|
|
577
|
+
foreignObject: SVGAttributes;
|
|
577
578
|
symbol: SVGAttributes;
|
|
578
579
|
text: SVGAttributes;
|
|
579
580
|
tspan: SVGAttributes;
|
|
@@ -590,12 +591,21 @@ declare namespace JSX {
|
|
|
590
591
|
export {};
|
|
591
592
|
}
|
|
592
593
|
/**
|
|
593
|
-
*
|
|
594
|
-
*
|
|
594
|
+
* Untyped factory behind `h`; the JSX runtime forwards through here.
|
|
595
|
+
*
|
|
596
|
+
* @internal
|
|
597
|
+
*/
|
|
598
|
+
declare const createVNode: (type: string | Fragment | ComponentFn | JsxComponent, props: PropBag | null | undefined, ...rest: View[]) => VNode;
|
|
599
|
+
/**
|
|
600
|
+
* Build a vnode. Intrinsic tags take exactly the props JSX accepts, so an
|
|
601
|
+
* unknown tag, a misspelt attribute or a wrongly typed handler is a compile
|
|
602
|
+
* error here exactly as in JSX. Custom elements (`my-widget`) stay a plain
|
|
603
|
+
* prop bag, and components keep their own prop types.
|
|
595
604
|
*/
|
|
596
605
|
interface HFn {
|
|
606
|
+
<K extends keyof JSX.IntrinsicElements>(type: K, props: JSX.IntrinsicElements[K] | null | undefined, ...rest: View[]): VNode;
|
|
597
607
|
<P>(type: (props: P) => ReturnType<JsxComponent>, props: P | null | undefined, ...rest: View[]): VNode;
|
|
598
|
-
(type: string | Fragment | ComponentFn | JsxComponent, props: PropBag | null | undefined, ...rest: View[]): VNode;
|
|
608
|
+
(type: `${string}-${string}` | Fragment | ComponentFn | JsxComponent, props: PropBag | null | undefined, ...rest: View[]): VNode;
|
|
599
609
|
}
|
|
600
610
|
declare const h: HFn;
|
|
601
|
-
export {
|
|
611
|
+
export { h as n, JSX as r, createVNode 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.
|
|
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.17.0.
|
|
4
4
|
|
|
5
5
|
Start with the canonical-usage table: exactly one API per task, plus a never-do list.
|
|
6
6
|
|