ilha 0.11.0 → 0.12.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 +181 -784
- package/dist/index-DZI0fEmR.d.ts +374 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1667 -1816
- package/dist/internal.d.ts +61 -0
- package/dist/internal.js +39 -0
- package/dist/jsx-dev-runtime.d.ts +1 -1
- package/dist/{jsx-runtime-B-viVOB1.d.ts → jsx-runtime-BCGuHwTg.d.ts} +1 -3
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js +11 -28
- package/package.json +7 -2
- package/dist/index-Cx35Xugv.d.ts +0 -445
package/dist/index-Cx35Xugv.d.ts
DELETED
|
@@ -1,445 +0,0 @@
|
|
|
1
|
-
//#region src/index.d.ts
|
|
2
|
-
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
3
|
-
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
4
|
-
}
|
|
5
|
-
declare namespace StandardSchemaV1 {
|
|
6
|
-
interface Props<Input = unknown, Output = Input> {
|
|
7
|
-
readonly version: 1;
|
|
8
|
-
readonly vendor: string;
|
|
9
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
10
|
-
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
11
|
-
}
|
|
12
|
-
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
13
|
-
interface SuccessResult<Output> {
|
|
14
|
-
readonly value: Output;
|
|
15
|
-
readonly issues?: undefined;
|
|
16
|
-
}
|
|
17
|
-
interface FailureResult {
|
|
18
|
-
readonly issues: ReadonlyArray<Issue>;
|
|
19
|
-
}
|
|
20
|
-
interface Issue {
|
|
21
|
-
readonly message: string;
|
|
22
|
-
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
23
|
-
}
|
|
24
|
-
interface PathSegment {
|
|
25
|
-
readonly key: PropertyKey;
|
|
26
|
-
}
|
|
27
|
-
interface Types<Input = unknown, Output = Input> {
|
|
28
|
-
readonly input: Input;
|
|
29
|
-
readonly output: Output;
|
|
30
|
-
}
|
|
31
|
-
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
32
|
-
}
|
|
33
|
-
declare const RAW: unique symbol;
|
|
34
|
-
declare const SIGNAL_ACCESSOR: unique symbol;
|
|
35
|
-
declare const ISLAND: unique symbol;
|
|
36
|
-
declare const ISLAND_CALL: unique symbol;
|
|
37
|
-
/** @internal Internal hook used by a parent's mountSlots to mount a child island and
|
|
38
|
-
* retain a handle to push updated props into it on subsequent parent
|
|
39
|
-
* re-renders. Not part of the public surface. */
|
|
40
|
-
declare const ISLAND_MOUNT_INTERNAL: unique symbol;
|
|
41
|
-
/** @internal Live mount handles keyed by host element. Lets @ilha/router adopt
|
|
42
|
-
* islands hydrated by `ilha.mount()` (whose handles it never saw) and push new
|
|
43
|
-
* loader props into them in place instead of remounting. Entries are removed
|
|
44
|
-
* on unmount. Not part of the public surface. */
|
|
45
|
-
declare const ISLAND_MOUNT_HANDLES: WeakMap<Element, {
|
|
46
|
-
unmount: () => void | Promise<void>;
|
|
47
|
-
updateProps: (props?: Record<string, unknown>) => void;
|
|
48
|
-
}>;
|
|
49
|
-
interface RawHtml {
|
|
50
|
-
[RAW]: true;
|
|
51
|
-
value: string;
|
|
52
|
-
}
|
|
53
|
-
interface IslandCall {
|
|
54
|
-
[ISLAND_CALL]: true;
|
|
55
|
-
island: AnyIsland;
|
|
56
|
-
props: Record<string, unknown> | undefined;
|
|
57
|
-
key: string | undefined;
|
|
58
|
-
}
|
|
59
|
-
type NativeEventModifier = "abortable" | "once" | "capture" | "passive";
|
|
60
|
-
interface NativeEventContext {
|
|
61
|
-
readonly signal: AbortSignal;
|
|
62
|
-
}
|
|
63
|
-
type NativeEventHandler<E extends Event = Event> = (event: E, context: NativeEventContext) => unknown;
|
|
64
|
-
type NonFunctionValue<T> = T extends ((...args: any[]) => any) ? never : T;
|
|
65
|
-
type SignalSetter<T> = NonFunctionValue<T> | ((previous: T) => T);
|
|
66
|
-
declare const SIGNAL_WRITER_TYPE: unique symbol;
|
|
67
|
-
/** @internal Type-level write target carried by signal accessors. */
|
|
68
|
-
interface SignalWriter<T> {
|
|
69
|
-
readonly [SIGNAL_WRITER_TYPE]?: (value: T) => void;
|
|
70
|
-
}
|
|
71
|
-
interface MarkedSignalAccessor<T> extends SignalWriter<T> {
|
|
72
|
-
(): T;
|
|
73
|
-
(...args: [value: SignalSetter<T>]): void;
|
|
74
|
-
select<S>(selector: (state: T) => S): MarkedSignalAccessor<S>;
|
|
75
|
-
[SIGNAL_ACCESSOR]: true;
|
|
76
|
-
}
|
|
77
|
-
declare function ilhaRaw(value: string): RawHtml;
|
|
78
|
-
declare function ilhaCss(strings: TemplateStringsArray | string, ...values: (string | number)[]): string;
|
|
79
|
-
declare function ilhaHtml(strings: TemplateStringsArray, ...values: unknown[]): RawHtml;
|
|
80
|
-
type ContextSignal<T> = {
|
|
81
|
-
(): T;
|
|
82
|
-
(value: SignalSetter<T>): void;
|
|
83
|
-
};
|
|
84
|
-
declare function ilhaContextFn<T>(key: string, initial: T): ContextSignal<T>;
|
|
85
|
-
/**
|
|
86
|
-
* Create a free-standing reactive signal that lives outside any island.
|
|
87
|
-
* Useful for sharing state across islands without prop drilling, or for
|
|
88
|
-
* binding form inputs to module-level state via the `bind:value=${signal}`
|
|
89
|
-
* template syntax.
|
|
90
|
-
*
|
|
91
|
-
* The returned accessor is a getter when called with no arguments and a
|
|
92
|
-
* setter when called with one. Reading it inside a `.derived()`, `.effect()`,
|
|
93
|
-
* or `.render()` automatically subscribes the surrounding reactive scope —
|
|
94
|
-
* so when the signal changes, dependents re-run as if it were local state.
|
|
95
|
-
*/
|
|
96
|
-
declare function ilhaSignal<T>(initial: T): SignalAccessor<T>;
|
|
97
|
-
/**
|
|
98
|
-
* Create a free-standing read-only reactive value derived from other signals.
|
|
99
|
-
* The computation is lazy and cached: `fn` re-runs only when a signal it read
|
|
100
|
-
* changed and the computed is read again. Reading it inside a `.derived()`,
|
|
101
|
-
* `.effect()`, `.render()`, or top-level `effect()` subscribes that scope —
|
|
102
|
-
* dependents re-run when the computed's value changes.
|
|
103
|
-
*
|
|
104
|
-
* ```ts
|
|
105
|
-
* const items = ilha.signal([1, 2, 3]);
|
|
106
|
-
* const total = ilha.computed(() => items().reduce((a, b) => a + b, 0));
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
declare function ilhaComputed<T>(fn: () => T): SignalAccessor<T>;
|
|
110
|
-
/**
|
|
111
|
-
* Run a free-standing reactive effect outside any island. `fn` runs once
|
|
112
|
-
* immediately and again whenever a signal it read changes. It may return a
|
|
113
|
-
* cleanup function, invoked before each re-run and on stop. Signal writes
|
|
114
|
-
* inside the effect are batched. Returns a stop function that disposes the
|
|
115
|
-
* effect and runs the final cleanup.
|
|
116
|
-
*
|
|
117
|
-
* ```ts
|
|
118
|
-
* const stop = effect(() => {
|
|
119
|
-
* document.title = `${cart.count()} items`;
|
|
120
|
-
* });
|
|
121
|
-
* ```
|
|
122
|
-
*/
|
|
123
|
-
declare function ilhaEffect(fn: () => void | (() => void)): () => void;
|
|
124
|
-
/**
|
|
125
|
-
* Run `fn` with reactive tracking suspended. Reading signals inside `fn`
|
|
126
|
-
* returns their current value without subscribing the surrounding scope.
|
|
127
|
-
* Use this in effects/deriveds when you want to peek at state without
|
|
128
|
-
* causing a re-run on its changes.
|
|
129
|
-
*/
|
|
130
|
-
declare function untrack<T>(fn: () => T): T;
|
|
131
|
-
/**
|
|
132
|
-
* Run `fn` as an atomic batch — multiple signal writes inside the callback
|
|
133
|
-
* produce a single propagation pass, so dependents (effects, deriveds,
|
|
134
|
-
* island re-renders) see the final state and run once instead of once per
|
|
135
|
-
* write. Returns whatever `fn` returns.
|
|
136
|
-
*
|
|
137
|
-
* Note: `.on()` handlers and `.effect()` runs are batched implicitly, so
|
|
138
|
-
* you only need this when triggering multiple writes from outside an
|
|
139
|
-
* island (e.g. from a top-level event listener or async callback).
|
|
140
|
-
*/
|
|
141
|
-
declare function batch<T>(fn: () => T): T;
|
|
142
|
-
interface DerivedValue<T> {
|
|
143
|
-
loading: boolean;
|
|
144
|
-
value: T | undefined;
|
|
145
|
-
error: Error | undefined;
|
|
146
|
-
}
|
|
147
|
-
type DerivedAccessor<T> = {
|
|
148
|
-
readonly loading: boolean;
|
|
149
|
-
readonly value: T | undefined;
|
|
150
|
-
readonly error: Error | undefined;
|
|
151
|
-
(): T | undefined;
|
|
152
|
-
(value: T): void;
|
|
153
|
-
};
|
|
154
|
-
type DerivedFnContext<TInput, TStateMap extends Record<string, unknown>> = {
|
|
155
|
-
state: IslandState<TStateMap>;
|
|
156
|
-
input: TInput;
|
|
157
|
-
signal: AbortSignal;
|
|
158
|
-
};
|
|
159
|
-
type DerivedFn<TInput, TStateMap extends Record<string, unknown>, V> = (ctx: DerivedFnContext<TInput, TStateMap>) => V | Promise<V>;
|
|
160
|
-
interface DerivedEntry<TInput, TStateMap extends Record<string, unknown>> {
|
|
161
|
-
key: string;
|
|
162
|
-
fn: DerivedFn<TInput, TStateMap, unknown>;
|
|
163
|
-
}
|
|
164
|
-
type IslandDerived<TDerivedMap extends Record<string, unknown>> = { readonly [K in keyof TDerivedMap]: DerivedAccessor<TDerivedMap[K]>; };
|
|
165
|
-
type ExternalSignal<T = unknown> = SignalAccessor<T>;
|
|
166
|
-
type SignalAccessor<T> = MarkedSignalAccessor<T>;
|
|
167
|
-
type MergeState<TStateMap extends Record<string, unknown>, K extends string, V> = Omit<TStateMap, K> & Record<K, V>;
|
|
168
|
-
type IslandState<TStateMap extends Record<string, unknown>> = { readonly [K in keyof TStateMap]-?: SignalAccessor<TStateMap[K]>; };
|
|
169
|
-
interface HydratableOptions {
|
|
170
|
-
name: string;
|
|
171
|
-
as?: string;
|
|
172
|
-
snapshot?: boolean | {
|
|
173
|
-
state?: boolean;
|
|
174
|
-
derived?: boolean;
|
|
175
|
-
};
|
|
176
|
-
skipOnMount?: boolean;
|
|
177
|
-
}
|
|
178
|
-
interface Island<TInput = Record<string, unknown>, _TStateMap extends Record<string, unknown> = Record<string, unknown>> {
|
|
179
|
-
(props?: Partial<TInput>): string | Promise<string>;
|
|
180
|
-
toString(props?: Partial<TInput>): string;
|
|
181
|
-
mount(host: Element, props?: Partial<TInput>): () => void;
|
|
182
|
-
hydratable(props: Partial<TInput>, options: HydratableOptions): Promise<string>;
|
|
183
|
-
key(key: string): KeyedIsland<TInput>;
|
|
184
|
-
/**
|
|
185
|
-
* Register this island as a custom element, usable from plain HTML or any
|
|
186
|
-
* framework: `Counter.define("x-counter", { observe: ["label"] })` then
|
|
187
|
-
* `<x-counter label="hi"></x-counter>`. Observed attributes become string
|
|
188
|
-
* input props and re-resolve input on change; richer props can be assigned
|
|
189
|
-
* via the element's `props` property. Mounts on connect, unmounts on
|
|
190
|
-
* disconnect. No-op (with a dev warning) where customElements is missing.
|
|
191
|
-
*/
|
|
192
|
-
define(tagName: string, options?: {
|
|
193
|
-
observe?: string[];
|
|
194
|
-
}): void;
|
|
195
|
-
[ISLAND]: true;
|
|
196
|
-
}
|
|
197
|
-
interface KeyedIsland<TInput> {
|
|
198
|
-
(props?: Partial<TInput>): IslandCall;
|
|
199
|
-
[ISLAND_CALL]: true;
|
|
200
|
-
}
|
|
201
|
-
type AnyIsland = Island<any, any>;
|
|
202
|
-
type AnyActionFn = (props: any, ctx: any) => unknown;
|
|
203
|
-
type ActionMap = Record<string, AnyActionFn>;
|
|
204
|
-
type ActionCall<P> = [P] extends [undefined] ? () => void : unknown extends P ? () => void : (props: P) => void;
|
|
205
|
-
type ActionAccessor<P = undefined, R = void> = ActionCall<P> & {
|
|
206
|
-
readonly pending: boolean;
|
|
207
|
-
readonly data: Awaited<R> | undefined;
|
|
208
|
-
readonly error: Error | undefined;
|
|
209
|
-
};
|
|
210
|
-
type IslandActions<TActionMap extends ActionMap> = { readonly [K in keyof TActionMap]: TActionMap[K] extends ((props: infer P, ctx: any) => infer R) ? ActionAccessor<P, R> : never; };
|
|
211
|
-
type ActionContext<TInput, TStateMap extends Record<string, unknown>, TDerivedMap extends Record<string, unknown> = Record<never, never>> = {
|
|
212
|
-
state: IslandState<TStateMap>;
|
|
213
|
-
derived: IslandDerived<TDerivedMap>;
|
|
214
|
-
input: TInput;
|
|
215
|
-
host: Element;
|
|
216
|
-
signal: AbortSignal;
|
|
217
|
-
};
|
|
218
|
-
type RenderContext<TInput, TStateMap extends Record<string, unknown>, TDerivedMap extends Record<string, unknown>, TActionMap extends ActionMap = Record<never, never>> = {
|
|
219
|
-
state: IslandState<TStateMap>;
|
|
220
|
-
derived: IslandDerived<TDerivedMap>;
|
|
221
|
-
action: IslandActions<TActionMap>;
|
|
222
|
-
input: TInput;
|
|
223
|
-
};
|
|
224
|
-
type EffectContext<TInput, TStateMap extends Record<string, unknown>, TDerivedMap extends Record<string, unknown> = Record<never, never>, TActionMap extends ActionMap = Record<never, never>> = {
|
|
225
|
-
state: IslandState<TStateMap>;
|
|
226
|
-
derived: IslandDerived<TDerivedMap>;
|
|
227
|
-
action: IslandActions<TActionMap>;
|
|
228
|
-
input: TInput;
|
|
229
|
-
host: Element;
|
|
230
|
-
/**
|
|
231
|
-
* AbortSignal that aborts when the effect re-runs (because a dependency
|
|
232
|
-
* changed) or when the island unmounts. Pass to `fetch` or check
|
|
233
|
-
* `signal.aborted` after `await` boundaries to bail out of stale work
|
|
234
|
-
* without needing a manual cleanup function.
|
|
235
|
-
*/
|
|
236
|
-
signal: AbortSignal;
|
|
237
|
-
};
|
|
238
|
-
type OnMountContext<TInput, TStateMap extends Record<string, unknown>, TDerivedMap extends Record<string, unknown> = Record<never, never>, TActionMap extends ActionMap = Record<never, never>> = {
|
|
239
|
-
state: IslandState<TStateMap>;
|
|
240
|
-
derived: IslandDerived<TDerivedMap>;
|
|
241
|
-
action: IslandActions<TActionMap>;
|
|
242
|
-
input: TInput;
|
|
243
|
-
host: Element;
|
|
244
|
-
hydrated: boolean;
|
|
245
|
-
/** AbortSignal that aborts when the island unmounts. */
|
|
246
|
-
signal: AbortSignal;
|
|
247
|
-
};
|
|
248
|
-
type HandlerContext<TInput, TStateMap extends Record<string, unknown>, TDerivedMap extends Record<string, unknown> = Record<never, never>, TActionMap extends ActionMap = Record<never, never>> = {
|
|
249
|
-
state: IslandState<TStateMap>;
|
|
250
|
-
derived: IslandDerived<TDerivedMap>;
|
|
251
|
-
action: IslandActions<TActionMap>;
|
|
252
|
-
input: TInput;
|
|
253
|
-
host: Element;
|
|
254
|
-
target: Element;
|
|
255
|
-
event: Event;
|
|
256
|
-
/**
|
|
257
|
-
* AbortSignal that fires when the island unmounts. If the handler's selector
|
|
258
|
-
* was registered with the `:abortable` modifier, the signal is also aborted
|
|
259
|
-
* when the same listener fires again on the same target (giving you free
|
|
260
|
-
* race-cancellation for things like search-as-you-type fetches). Pass this
|
|
261
|
-
* to `fetch`, `AbortController`-aware APIs, or check `signal.aborted`
|
|
262
|
-
* after `await` boundaries to bail out of stale work.
|
|
263
|
-
*/
|
|
264
|
-
signal: AbortSignal;
|
|
265
|
-
};
|
|
266
|
-
type HTMLEventFor<E extends string> = E extends keyof HTMLElementEventMap ? HTMLElementEventMap[E] : Event;
|
|
267
|
-
type HTMLTargetFor<E extends string> = E extends keyof HTMLElementEventMap ? NonNullable<HTMLElementEventMap[E]["target"]> extends Element ? NonNullable<HTMLElementEventMap[E]["target"]> : Element : Element;
|
|
268
|
-
type HandlerContextFor<TInput, TStateMap extends Record<string, unknown>, TEventName extends string, TDerivedMap extends Record<string, unknown> = Record<never, never>, TActionMap extends ActionMap = Record<never, never>> = {
|
|
269
|
-
state: IslandState<TStateMap>;
|
|
270
|
-
derived: IslandDerived<TDerivedMap>;
|
|
271
|
-
action: IslandActions<TActionMap>;
|
|
272
|
-
input: TInput;
|
|
273
|
-
host: Element;
|
|
274
|
-
target: HTMLTargetFor<TEventName>;
|
|
275
|
-
event: HTMLEventFor<TEventName>;
|
|
276
|
-
/**
|
|
277
|
-
* AbortSignal that fires when the island unmounts. If the handler's selector
|
|
278
|
-
* was registered with the `:abortable` modifier, the signal is also aborted
|
|
279
|
-
* when the same listener fires again on the same target.
|
|
280
|
-
*/
|
|
281
|
-
signal: AbortSignal;
|
|
282
|
-
};
|
|
283
|
-
type StateInit<TInput, V> = V | ((input: TInput) => V);
|
|
284
|
-
interface StateEntry<TInput> {
|
|
285
|
-
key: string;
|
|
286
|
-
init: StateInit<TInput, unknown>;
|
|
287
|
-
}
|
|
288
|
-
/** A state key fed by a generator (`.stream()`). The runtime iterates the
|
|
289
|
-
* generator and writes each yielded value into the state signal. During SSR
|
|
290
|
-
* only the first value is pulled so it can render inline; on the client the
|
|
291
|
-
* generator is consumed continuously. */
|
|
292
|
-
interface StreamEntry<TInput> {
|
|
293
|
-
key: string;
|
|
294
|
-
fn: StreamFn<TInput>;
|
|
295
|
-
}
|
|
296
|
-
type StreamFnContext<TInput> = {
|
|
297
|
-
input: TInput;
|
|
298
|
-
/** Aborts when the island unmounts. Pass through to fetch/SSE layers. */
|
|
299
|
-
signal: AbortSignal;
|
|
300
|
-
};
|
|
301
|
-
type StreamFn<TInput, V = unknown> = (ctx: StreamFnContext<TInput>) => AsyncGenerator<V> | Generator<V>;
|
|
302
|
-
interface ActionEntry<TInput, TStateMap extends Record<string, unknown>, TDerivedMap extends Record<string, unknown>> {
|
|
303
|
-
key: string;
|
|
304
|
-
fn: (props: unknown, ctx: ActionContext<TInput, TStateMap, TDerivedMap>) => unknown;
|
|
305
|
-
}
|
|
306
|
-
interface OnEntry<TInput, TStateMap extends Record<string, unknown>, TDerivedMap extends Record<string, unknown> = Record<never, never>, TActionMap extends ActionMap = Record<never, never>> {
|
|
307
|
-
selector: string;
|
|
308
|
-
event: string;
|
|
309
|
-
options: AddEventListenerOptions;
|
|
310
|
-
abortable: boolean;
|
|
311
|
-
handler: (ctx: HandlerContext<TInput, TStateMap, TDerivedMap, TActionMap>) => void | Promise<void>;
|
|
312
|
-
}
|
|
313
|
-
interface EffectEntry<TInput, TStateMap extends Record<string, unknown>, TDerivedMap extends Record<string, unknown>, TActionMap extends ActionMap = Record<never, never>> {
|
|
314
|
-
fn: (ctx: EffectContext<TInput, TStateMap, TDerivedMap, TActionMap>) => (() => void) | void;
|
|
315
|
-
}
|
|
316
|
-
/** Where the error originated. `"on"` covers sync throws and async rejections
|
|
317
|
-
* from `.on()` handlers; `"effect"` covers sync throws from `.effect()` runs
|
|
318
|
-
* (async work spawned inside an effect is not awaited by the runtime). */
|
|
319
|
-
type ErrorSource = "on" | "effect" | "mount" | "transition" | "action" | "stream";
|
|
320
|
-
/**
|
|
321
|
-
* Register a global error handler invoked when any island reports an error
|
|
322
|
-
* (from .on, .effect, .onMount, or transitions) and has no local .onError()
|
|
323
|
-
* handler. Returns an unsubscribe function. Islands with their own .onError()
|
|
324
|
-
* are handled locally and do not reach the global sink.
|
|
325
|
-
*/
|
|
326
|
-
declare function onUncaughtError(fn: (error: Error, source: ErrorSource) => void): () => void;
|
|
327
|
-
type ErrorContext<TInput, TStateMap extends Record<string, unknown>, TDerivedMap extends Record<string, unknown> = Record<never, never>, TActionMap extends ActionMap = Record<never, never>> = {
|
|
328
|
-
error: Error;
|
|
329
|
-
source: ErrorSource;
|
|
330
|
-
state: IslandState<TStateMap>;
|
|
331
|
-
derived: IslandDerived<TDerivedMap>;
|
|
332
|
-
action: IslandActions<TActionMap>;
|
|
333
|
-
input: TInput;
|
|
334
|
-
host: Element;
|
|
335
|
-
};
|
|
336
|
-
interface OnErrorEntry<TInput, TStateMap extends Record<string, unknown>, TDerivedMap extends Record<string, unknown>, TActionMap extends ActionMap = Record<never, never>> {
|
|
337
|
-
fn: (ctx: ErrorContext<TInput, TStateMap, TDerivedMap, TActionMap>) => void;
|
|
338
|
-
}
|
|
339
|
-
interface OnMountEntry<TInput, TStateMap extends Record<string, unknown>, TDerivedMap extends Record<string, unknown>, TActionMap extends ActionMap = Record<never, never>> {
|
|
340
|
-
fn: (ctx: OnMountContext<TInput, TStateMap, TDerivedMap, TActionMap>) => (() => void) | void;
|
|
341
|
-
}
|
|
342
|
-
interface TransitionOptions {
|
|
343
|
-
enter?: (host: Element) => Promise<void> | void;
|
|
344
|
-
leave?: (host: Element) => Promise<void> | void;
|
|
345
|
-
}
|
|
346
|
-
interface MountOptions {
|
|
347
|
-
root?: Element;
|
|
348
|
-
lazy?: boolean;
|
|
349
|
-
}
|
|
350
|
-
interface MountResult {
|
|
351
|
-
unmount: () => void | Promise<void>;
|
|
352
|
-
}
|
|
353
|
-
interface BuilderConfig<TInput, TStateMap extends Record<string, unknown>, TDerivedMap extends Record<string, unknown>, TActionMap extends ActionMap = Record<never, never>> {
|
|
354
|
-
schema: StandardSchemaV1 | null;
|
|
355
|
-
/** Shallow defaults merged before props (POJO `.input({ ... })` only). */
|
|
356
|
-
defaultInput: Record<string, unknown> | null;
|
|
357
|
-
states: StateEntry<TInput>[];
|
|
358
|
-
streams: StreamEntry<TInput>[];
|
|
359
|
-
deriveds: DerivedEntry<TInput, TStateMap>[];
|
|
360
|
-
actions: ActionEntry<TInput, TStateMap, TDerivedMap>[];
|
|
361
|
-
ons: OnEntry<TInput, TStateMap, TDerivedMap, TActionMap>[];
|
|
362
|
-
effects: EffectEntry<TInput, TStateMap, TDerivedMap, TActionMap>[];
|
|
363
|
-
onMounts: OnMountEntry<TInput, TStateMap, TDerivedMap, TActionMap>[];
|
|
364
|
-
onErrors: OnErrorEntry<TInput, TStateMap, TDerivedMap, TActionMap>[];
|
|
365
|
-
transition: TransitionOptions | null;
|
|
366
|
-
css: string | null;
|
|
367
|
-
/** Slot wrapper tag when this island is embedded in a parent (default div). */
|
|
368
|
-
as: string | null;
|
|
369
|
-
}
|
|
370
|
-
declare class IlhaBuilder<TInput extends Record<string, unknown>, TStateMap extends Record<string, unknown>, TDerivedMap extends Record<string, unknown> = Record<never, never>, TActionMap extends ActionMap = Record<never, never>> {
|
|
371
|
-
readonly _cfg: BuilderConfig<TInput, TStateMap, TDerivedMap, TActionMap>;
|
|
372
|
-
constructor(cfg: BuilderConfig<TInput, TStateMap, TDerivedMap, TActionMap>);
|
|
373
|
-
input<T extends Record<string, unknown>>(): IlhaBuilder<T, Record<never, never>, Record<never, never>, Record<never, never>>;
|
|
374
|
-
input<S extends StandardSchemaV1>(schema: S): IlhaBuilder<StandardSchemaV1.InferOutput<S> & Record<string, unknown>, Record<never, never>, Record<never, never>, Record<never, never>>;
|
|
375
|
-
input<T extends Record<string, unknown>>(defaults: T): IlhaBuilder<T, Record<never, never>, Record<never, never>, Record<never, never>>;
|
|
376
|
-
as<Tag extends string>(tag: Tag): IlhaBuilder<TInput, TStateMap, TDerivedMap, TActionMap>;
|
|
377
|
-
state<V = undefined, K extends string = string>(key: K, init?: StateInit<TInput, V> | undefined): IlhaBuilder<TInput, MergeState<TStateMap, K, V>, TDerivedMap, TActionMap>;
|
|
378
|
-
stream<K extends string, V>(key: K, fn: StreamFn<TInput, V>): IlhaBuilder<TInput, MergeState<TStateMap, K, V>, TDerivedMap, TActionMap>;
|
|
379
|
-
derived<K extends string, V>(key: K, fn: DerivedFn<TInput, TStateMap, V>): IlhaBuilder<TInput, TStateMap, TDerivedMap & Record<K, V>, TActionMap>;
|
|
380
|
-
action<K extends string, P = undefined, R = void>(key: K, fn: (props: P, ctx: ActionContext<TInput, TStateMap, TDerivedMap>) => R): IlhaBuilder<TInput, TStateMap, TDerivedMap, TActionMap & Record<K, typeof fn>>;
|
|
381
|
-
on<S extends string>(selectorOrCombined: S, handler: (ctx: S extends `${string}@${infer E}:${string}` ? HandlerContextFor<TInput, TStateMap, E, TDerivedMap, TActionMap> : S extends `${string}@${infer E}` ? HandlerContextFor<TInput, TStateMap, E, TDerivedMap, TActionMap> : HandlerContext<TInput, TStateMap, TDerivedMap, TActionMap>) => void | Promise<void>): IlhaBuilder<TInput, TStateMap, TDerivedMap, TActionMap>;
|
|
382
|
-
effect(fn: (ctx: EffectContext<TInput, TStateMap, TDerivedMap, TActionMap>) => (() => void) | void): IlhaBuilder<TInput, TStateMap, TDerivedMap, TActionMap>;
|
|
383
|
-
onMount(fn: (ctx: OnMountContext<TInput, TStateMap, TDerivedMap, TActionMap>) => (() => void) | void): IlhaBuilder<TInput, TStateMap, TDerivedMap, TActionMap>;
|
|
384
|
-
onError(fn: (ctx: ErrorContext<TInput, TStateMap, TDerivedMap, TActionMap>) => void): IlhaBuilder<TInput, TStateMap, TDerivedMap, TActionMap>;
|
|
385
|
-
transition(opts: TransitionOptions): IlhaBuilder<TInput, TStateMap, TDerivedMap, TActionMap>;
|
|
386
|
-
css(strings: TemplateStringsArray | string, ...values: (string | number)[]): IlhaBuilder<TInput, TStateMap, TDerivedMap, TActionMap>;
|
|
387
|
-
render(fn: (ctx: RenderContext<TInput, TStateMap, TDerivedMap, TActionMap>) => string | RawHtml): Island<TInput, TStateMap>;
|
|
388
|
-
}
|
|
389
|
-
declare function ilhaFrom<TInput, TStateMap extends Record<string, unknown>>(selector: string | Element, island: Island<TInput, TStateMap>, props?: Partial<TInput>): (() => void) | null;
|
|
390
|
-
type IslandRegistry = Record<string, AnyIsland>;
|
|
391
|
-
declare function mountAll(registry: IslandRegistry, options?: MountOptions): MountResult;
|
|
392
|
-
type RootInput = Record<string, unknown>;
|
|
393
|
-
type RootState = Record<never, never>;
|
|
394
|
-
type RootDerived = Record<never, never>;
|
|
395
|
-
type RootActions = Record<never, never>;
|
|
396
|
-
type RootBuilder = IlhaBuilder<RootInput, RootState, RootDerived, RootActions>;
|
|
397
|
-
type DirectIslandFactory = <TInput extends Record<string, unknown> = RootInput>(fn: (ctx: RenderContext<TInput, RootState, RootDerived, RootActions>) => string | RawHtml) => Island<TInput, RootState>;
|
|
398
|
-
declare const ilha: RootBuilder & DirectIslandFactory & {
|
|
399
|
-
html: typeof ilhaHtml;
|
|
400
|
-
raw: typeof ilhaRaw;
|
|
401
|
-
mount: typeof mountAll;
|
|
402
|
-
from: typeof ilhaFrom;
|
|
403
|
-
context: typeof ilhaContextFn & {
|
|
404
|
-
/** Remove a context signal from the registry. Returns true if it existed. */
|
|
405
|
-
delete(key: string): boolean;
|
|
406
|
-
/** Remove all context signals from the registry (e.g. between tests). */
|
|
407
|
-
clear(): void;
|
|
408
|
-
};
|
|
409
|
-
signal: typeof ilhaSignal;
|
|
410
|
-
computed: typeof ilhaComputed;
|
|
411
|
-
batch: typeof batch;
|
|
412
|
-
untrack: typeof untrack;
|
|
413
|
-
onUncaughtError: typeof onUncaughtError;
|
|
414
|
-
};
|
|
415
|
-
/** @internal Used by the separate JSX runtime to register a native event handler. */
|
|
416
|
-
declare function __ilhaJsxEvent({ type, handler, modifier }: {
|
|
417
|
-
type: string;
|
|
418
|
-
handler: NativeEventHandler;
|
|
419
|
-
modifier?: NativeEventModifier;
|
|
420
|
-
}): number | undefined;
|
|
421
|
-
/** @internal Used by the separate JSX runtime entry to preserve island slot composition. */
|
|
422
|
-
declare function __ilhaJsxSlot({ island, props, key }: {
|
|
423
|
-
island: unknown;
|
|
424
|
-
props: Record<string, unknown> | undefined;
|
|
425
|
-
key: string | undefined;
|
|
426
|
-
}): RawHtml;
|
|
427
|
-
/**
|
|
428
|
-
* Morph an element's children toward `html`, patching in place: surviving
|
|
429
|
-
* elements keep their identity, listeners, and focus (see the morph engine).
|
|
430
|
-
* Falls back to an innerHTML write when the root tags don't match.
|
|
431
|
-
*/
|
|
432
|
-
declare function morph(host: Element, html: string): void;
|
|
433
|
-
declare const html: typeof ilhaHtml;
|
|
434
|
-
declare const raw: typeof ilhaRaw;
|
|
435
|
-
declare const css: typeof ilhaCss;
|
|
436
|
-
declare const mount: typeof mountAll;
|
|
437
|
-
declare const from: typeof ilhaFrom;
|
|
438
|
-
declare const context: typeof ilhaContextFn & {
|
|
439
|
-
/** Remove a context signal from the registry. Returns true if it existed. */
|
|
440
|
-
delete(key: string): boolean;
|
|
441
|
-
/** Remove all context signals from the registry (e.g. between tests). */
|
|
442
|
-
clear(): void;
|
|
443
|
-
};
|
|
444
|
-
//#endregion
|
|
445
|
-
export { StreamFnContext as A, ilhaEffect as B, NativeEventModifier as C, SignalSetter as D, SignalAccessor as E, css as F, raw as G, morph as H, from as I, untrack as K, html as L, __ilhaJsxSlot as M, batch as N, SignalWriter as O, context as P, ilha as R, NativeEventHandler as S, RawHtml as T, mount as U, ilhaSignal as V, onUncaughtError as W, IslandState as _, EffectContext as a, MountResult as b, ExternalSignal as c, HydratableOptions as d, ISLAND_MOUNT_HANDLES as f, IslandDerived as g, IslandActions as h, DerivedValue as i, __ilhaJsxEvent as j, StreamFn as k, HandlerContext as l, Island as m, ActionContext as n, ErrorContext as o, ISLAND_MOUNT_INTERNAL as p, DerivedAccessor as r, ErrorSource as s, ActionAccessor as t, HandlerContextFor as u, KeyedIsland as v, OnMountContext as w, NativeEventContext as x, MountOptions as y, ilhaComputed as z };
|