ilha 0.16.2 → 0.16.3

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 CHANGED
@@ -1,4 +1,4 @@
1
- # ilha 0.16.2 — agent guide
1
+ # ilha 0.16.3 — agent guide
2
2
 
3
3
  Generated from `src/index.ts` by `scripts/agent-docs.ts`. Do not edit by hand.
4
4
 
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/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.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.
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.2",
3
+ "version": "0.16.3",
4
4
  "description": "Generator-first island UI on Effect",
5
5
  "keywords": [
6
6
  "effect",