@fictjs/runtime 0.0.3 → 0.0.5
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 +1 -1
- package/dist/index.cjs +761 -707
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +889 -858
- package/dist/index.d.ts +889 -858
- package/dist/index.dev.js +765 -710
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +758 -708
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.d.cts +671 -0
- package/dist/jsx-dev-runtime.d.ts +671 -0
- package/dist/slim.cjs +119 -37
- package/dist/slim.cjs.map +1 -1
- package/dist/slim.d.cts +31 -4
- package/dist/slim.d.ts +31 -4
- package/dist/slim.js +117 -38
- package/dist/slim.js.map +1 -1
- package/package.json +2 -2
- package/src/binding.ts +49 -31
- package/src/index.ts +3 -0
- package/src/scope.ts +55 -0
- package/src/slim.ts +1 -0
package/dist/index.d.cts
CHANGED
|
@@ -9,12 +9,22 @@ interface SignalAccessor<T> {
|
|
|
9
9
|
* Computed accessor - function to get computed value
|
|
10
10
|
*/
|
|
11
11
|
type ComputedAccessor<T> = () => T;
|
|
12
|
+
/**
|
|
13
|
+
* Effect scope disposer - function to dispose an effect scope
|
|
14
|
+
*/
|
|
15
|
+
type EffectScopeDisposer = () => void;
|
|
12
16
|
/**
|
|
13
17
|
* Create a reactive signal
|
|
14
18
|
* @param initialValue - The initial value
|
|
15
19
|
* @returns A signal accessor function
|
|
16
20
|
*/
|
|
17
21
|
declare function signal<T>(initialValue: T): SignalAccessor<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Create a reactive effect scope
|
|
24
|
+
* @param fn - The scope function
|
|
25
|
+
* @returns An effect scope disposer function
|
|
26
|
+
*/
|
|
27
|
+
declare function effectScope(fn: () => void): EffectScopeDisposer;
|
|
18
28
|
declare const $state: <T>(value: T) => T;
|
|
19
29
|
/**
|
|
20
30
|
* Create a selector signal that efficiently updates only when the selected key matches.
|
|
@@ -106,468 +116,787 @@ declare function createEffect(fn: Effect): () => void;
|
|
|
106
116
|
declare const $effect: typeof createEffect;
|
|
107
117
|
declare function createRenderEffect(fn: Effect): () => void;
|
|
108
118
|
|
|
109
|
-
interface HookContext {
|
|
110
|
-
slots: unknown[];
|
|
111
|
-
cursor: number;
|
|
112
|
-
}
|
|
113
|
-
declare function __fictUseContext(): HookContext;
|
|
114
|
-
declare function __fictPushContext(): HookContext;
|
|
115
|
-
declare function __fictPopContext(): void;
|
|
116
|
-
declare function __fictResetContext(): void;
|
|
117
|
-
declare function __fictUseSignal<T>(ctx: HookContext, initial: T, slot?: number): SignalAccessor<T>;
|
|
118
|
-
declare function __fictUseMemo<T>(ctx: HookContext, fn: () => T, slot?: number): ComputedAccessor<T>;
|
|
119
|
-
declare function __fictUseEffect(ctx: HookContext, fn: () => void, slot?: number): void;
|
|
120
|
-
declare function __fictRender<T>(ctx: HookContext, fn: () => T): T;
|
|
121
|
-
|
|
122
|
-
interface VersionedSignalOptions<T> {
|
|
123
|
-
equals?: (prev: T, next: T) => boolean;
|
|
124
|
-
}
|
|
125
|
-
interface VersionedSignal<T> {
|
|
126
|
-
/** Reactive read that tracks both the value and version counter */
|
|
127
|
-
read: () => T;
|
|
128
|
-
/** Write a new value, forcing a version bump when value is equal */
|
|
129
|
-
write: (next: T) => void;
|
|
130
|
-
/** Force a version bump without changing the value */
|
|
131
|
-
force: () => void;
|
|
132
|
-
/** Read the current version without creating a dependency */
|
|
133
|
-
peekVersion: () => number;
|
|
134
|
-
/** Read the current value without tracking */
|
|
135
|
-
peekValue: () => T;
|
|
136
|
-
}
|
|
137
119
|
/**
|
|
138
|
-
*
|
|
120
|
+
* Fict Reactive DOM Binding System
|
|
139
121
|
*
|
|
140
|
-
*
|
|
122
|
+
* This module provides the core mechanisms for reactive DOM updates.
|
|
123
|
+
* It bridges the gap between Fict's reactive system (signals, effects)
|
|
124
|
+
* and the DOM, enabling fine-grained updates without a virtual DOM.
|
|
125
|
+
*
|
|
126
|
+
* Design Philosophy:
|
|
127
|
+
* - Values wrapped in functions `() => T` are treated as reactive
|
|
128
|
+
* - Static values are applied once without tracking
|
|
129
|
+
* - The compiler transforms JSX expressions to use these primitives
|
|
141
130
|
*/
|
|
142
|
-
declare function createVersionedSignal<T>(initialValue: T, options?: VersionedSignalOptions<T>): VersionedSignal<T>;
|
|
143
131
|
|
|
132
|
+
/** A reactive value that can be either static or a getter function */
|
|
133
|
+
type MaybeReactive<T> = T | (() => T);
|
|
134
|
+
/** Internal type for createElement function reference */
|
|
135
|
+
type CreateElementFn = (node: FictNode) => Node;
|
|
136
|
+
/** Handle returned by conditional/list bindings for cleanup */
|
|
137
|
+
interface BindingHandle {
|
|
138
|
+
/** Marker node(s) used for positioning */
|
|
139
|
+
marker: Comment | DocumentFragment;
|
|
140
|
+
/** Flush pending content - call after markers are inserted into DOM */
|
|
141
|
+
flush?: () => void;
|
|
142
|
+
/** Dispose function to clean up the binding */
|
|
143
|
+
dispose: Cleanup;
|
|
144
|
+
}
|
|
144
145
|
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* Users normally never call this directly; the compiler injects it.
|
|
146
|
+
* Check if a value is reactive (a getter function)
|
|
147
|
+
* Note: Event handlers (functions that take arguments) are NOT reactive values
|
|
148
148
|
*/
|
|
149
|
-
declare function
|
|
150
|
-
declare function createPropsProxy<T extends Record<string, unknown>>(props: T): T;
|
|
149
|
+
declare function isReactive(value: unknown): value is () => unknown;
|
|
151
150
|
/**
|
|
152
|
-
*
|
|
153
|
-
* Excludes the specified keys from the returned object.
|
|
151
|
+
* Unwrap a potentially reactive value to get the actual value
|
|
154
152
|
*/
|
|
155
|
-
declare function
|
|
153
|
+
declare function unwrap<T>(value: MaybeReactive<T>): T;
|
|
156
154
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* Uses lazy lookup strategy - properties are only accessed when read,
|
|
161
|
-
* avoiding upfront iteration of all keys.
|
|
155
|
+
* Invoke an event handler or handler accessor in a safe way.
|
|
156
|
+
* Supports handlers that return another handler and handlers that expect an
|
|
157
|
+
* optional data payload followed by the event.
|
|
162
158
|
*/
|
|
163
|
-
|
|
164
|
-
declare function mergeProps<T extends Record<string, unknown>>(...sources: (MergeSource<T> | null | undefined)[]): Record<string, unknown>;
|
|
165
|
-
type PropGetter<T> = (() => T) & {
|
|
166
|
-
__fictProp: true;
|
|
167
|
-
};
|
|
159
|
+
declare function callEventHandler(handler: EventListenerOrEventListenerObject | null | undefined, event: Event, node?: EventTarget | null, data?: unknown): void;
|
|
168
160
|
/**
|
|
169
|
-
*
|
|
170
|
-
*
|
|
161
|
+
* Unwrap a primitive proxy value to get the raw primitive value.
|
|
162
|
+
* This is primarily useful for advanced scenarios where you need the actual
|
|
163
|
+
* primitive type (e.g., for typeof checks or strict equality comparisons).
|
|
171
164
|
*
|
|
172
|
-
* @
|
|
173
|
-
*
|
|
174
|
-
* // Without useProp - recomputes on every access
|
|
175
|
-
* <Child data={expensiveComputation(list, filter)} />
|
|
165
|
+
* @param value - A potentially proxied primitive value
|
|
166
|
+
* @returns The raw primitive value
|
|
176
167
|
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* createList(
|
|
171
|
+
* () => [1, 2, 3],
|
|
172
|
+
* (item) => {
|
|
173
|
+
* const raw = unwrapPrimitive(item)
|
|
174
|
+
* typeof raw === 'number' // true
|
|
175
|
+
* raw === 1 // true (for first item)
|
|
176
|
+
* },
|
|
177
|
+
* item => item
|
|
178
|
+
* )
|
|
180
179
|
* ```
|
|
181
180
|
*/
|
|
182
|
-
declare function
|
|
183
|
-
|
|
184
|
-
type LifecycleFn = () => void | Cleanup;
|
|
185
|
-
interface RootContext {
|
|
186
|
-
parent?: RootContext | undefined;
|
|
187
|
-
onMountCallbacks?: LifecycleFn[];
|
|
188
|
-
cleanups: Cleanup[];
|
|
189
|
-
destroyCallbacks: Cleanup[];
|
|
190
|
-
errorHandlers?: ErrorHandler[];
|
|
191
|
-
suspenseHandlers?: SuspenseHandler[];
|
|
192
|
-
}
|
|
193
|
-
type ErrorHandler = (err: unknown, info?: ErrorInfo) => boolean | void;
|
|
194
|
-
type SuspenseHandler = (token: SuspenseToken | PromiseLike<unknown>) => boolean | void;
|
|
195
|
-
declare function onMount(fn: LifecycleFn): void;
|
|
196
|
-
declare function onDestroy(fn: LifecycleFn): void;
|
|
197
|
-
declare function onCleanup(fn: Cleanup): void;
|
|
198
|
-
declare function createRoot<T>(fn: () => T): {
|
|
199
|
-
dispose: () => void;
|
|
200
|
-
value: T;
|
|
201
|
-
};
|
|
202
|
-
|
|
181
|
+
declare function unwrapPrimitive<T>(value: T): T;
|
|
203
182
|
/**
|
|
204
|
-
* Create a
|
|
205
|
-
*
|
|
206
|
-
* @returns A ref object with a `current` property initialized to `null`
|
|
183
|
+
* Create a text node that reactively updates when the value changes.
|
|
207
184
|
*
|
|
208
185
|
* @example
|
|
209
|
-
* ```
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* function Component() {
|
|
213
|
-
* const inputRef = createRef<HTMLInputElement>()
|
|
214
|
-
*
|
|
215
|
-
* $effect(() => {
|
|
216
|
-
* inputRef.current?.focus()
|
|
217
|
-
* })
|
|
186
|
+
* ```ts
|
|
187
|
+
* // Static text
|
|
188
|
+
* createTextBinding("Hello")
|
|
218
189
|
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
190
|
+
* // Reactive text (compiler output)
|
|
191
|
+
* createTextBinding(() => $count())
|
|
221
192
|
* ```
|
|
222
193
|
*/
|
|
223
|
-
declare function
|
|
224
|
-
|
|
194
|
+
declare function createTextBinding(value: MaybeReactive<unknown>): Text;
|
|
225
195
|
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
* This keeps the UI responsive during expensive operations.
|
|
229
|
-
*
|
|
230
|
-
* @param fn - The function to execute in transition context
|
|
231
|
-
*
|
|
232
|
-
* @example
|
|
233
|
-
* ```tsx
|
|
234
|
-
* const handleInput = (e) => {
|
|
235
|
-
* query = e.target.value // High priority: immediate
|
|
236
|
-
* startTransition(() => {
|
|
237
|
-
* // Low priority: processed after high priority updates
|
|
238
|
-
* filteredItems = allItems.filter(x => x.includes(query))
|
|
239
|
-
* })
|
|
240
|
-
* }
|
|
241
|
-
* ```
|
|
196
|
+
* Bind a reactive value to an existing text node.
|
|
197
|
+
* This is a convenience function for binding to existing DOM nodes.
|
|
242
198
|
*/
|
|
243
|
-
declare function
|
|
199
|
+
declare function bindText(textNode: Text, getValue: () => unknown): Cleanup;
|
|
200
|
+
/** Attribute setter function type */
|
|
201
|
+
type AttributeSetter = (el: HTMLElement, key: string, value: unknown) => void;
|
|
244
202
|
/**
|
|
245
|
-
*
|
|
246
|
-
* Returns a pending signal and a startTransition function.
|
|
247
|
-
*
|
|
248
|
-
* @returns A tuple of [isPending accessor, startTransition function]
|
|
203
|
+
* Create a reactive attribute binding on an element.
|
|
249
204
|
*
|
|
250
205
|
* @example
|
|
251
|
-
* ```
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
* const [isPending, start] = useTransition()
|
|
255
|
-
*
|
|
256
|
-
* const handleChange = (e) => {
|
|
257
|
-
* query = e.target.value
|
|
258
|
-
* start(() => {
|
|
259
|
-
* // Expensive filtering happens in low priority
|
|
260
|
-
* filteredResults = expensiveFilter(allData, query)
|
|
261
|
-
* })
|
|
262
|
-
* }
|
|
206
|
+
* ```ts
|
|
207
|
+
* // Static attribute
|
|
208
|
+
* createAttributeBinding(button, 'disabled', false, setAttribute)
|
|
263
209
|
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
* <input value={query} onInput={handleChange} />
|
|
267
|
-
* {isPending() && <Spinner />}
|
|
268
|
-
* <Results items={filteredResults} />
|
|
269
|
-
* </>
|
|
270
|
-
* )
|
|
271
|
-
* }
|
|
210
|
+
* // Reactive attribute (compiler output)
|
|
211
|
+
* createAttributeBinding(button, 'disabled', () => !$isValid(), setAttribute)
|
|
272
212
|
* ```
|
|
273
213
|
*/
|
|
274
|
-
declare function
|
|
214
|
+
declare function createAttributeBinding(el: HTMLElement, key: string, value: MaybeReactive<unknown>, setter: AttributeSetter): void;
|
|
275
215
|
/**
|
|
276
|
-
*
|
|
277
|
-
|
|
278
|
-
|
|
216
|
+
* Bind a reactive value to an element's attribute.
|
|
217
|
+
*/
|
|
218
|
+
declare function bindAttribute(el: HTMLElement, key: string, getValue: () => unknown): Cleanup;
|
|
219
|
+
/**
|
|
220
|
+
* Bind a reactive value to an element's property.
|
|
221
|
+
*/
|
|
222
|
+
declare function bindProperty(el: HTMLElement, key: string, getValue: () => unknown): Cleanup;
|
|
223
|
+
/**
|
|
224
|
+
* Apply styles to an element, supporting reactive style objects/strings.
|
|
225
|
+
*/
|
|
226
|
+
declare function createStyleBinding(el: HTMLElement, value: MaybeReactive<string | Record<string, string | number> | null | undefined>): void;
|
|
227
|
+
/**
|
|
228
|
+
* Bind a reactive style value to an existing element.
|
|
229
|
+
*/
|
|
230
|
+
declare function bindStyle(el: HTMLElement, getValue: () => string | Record<string, string | number> | null | undefined): Cleanup;
|
|
231
|
+
/**
|
|
232
|
+
* Apply class to an element, supporting reactive class values.
|
|
233
|
+
*/
|
|
234
|
+
declare function createClassBinding(el: HTMLElement, value: MaybeReactive<string | Record<string, boolean> | null | undefined>): void;
|
|
235
|
+
/**
|
|
236
|
+
* Bind a reactive class value to an existing element.
|
|
237
|
+
*/
|
|
238
|
+
declare function bindClass(el: HTMLElement, getValue: () => string | Record<string, boolean> | null | undefined): Cleanup;
|
|
239
|
+
/**
|
|
240
|
+
* Exported classList function for direct use (compatible with dom-expressions)
|
|
241
|
+
*/
|
|
242
|
+
declare function classList(node: HTMLElement, value: Record<string, boolean> | null | undefined, prev?: Record<string, boolean>): Record<string, boolean>;
|
|
243
|
+
/**
|
|
244
|
+
* Insert reactive content into a parent element.
|
|
245
|
+
* This is a simpler API than createChildBinding for basic cases.
|
|
279
246
|
*
|
|
280
|
-
* @param
|
|
281
|
-
* @
|
|
247
|
+
* @param parent - The parent element to insert into
|
|
248
|
+
* @param getValue - Function that returns the value to render
|
|
249
|
+
* @param markerOrCreateElement - Optional marker node to insert before, or createElementFn
|
|
250
|
+
* @param createElementFn - Optional function to create DOM elements (when marker is provided)
|
|
251
|
+
*/
|
|
252
|
+
declare function insert(parent: HTMLElement | DocumentFragment, getValue: () => FictNode, markerOrCreateElement?: Node | CreateElementFn, createElementFn?: CreateElementFn): Cleanup;
|
|
253
|
+
/**
|
|
254
|
+
* Create a reactive child binding that updates when the child value changes.
|
|
255
|
+
* This is used for dynamic expressions like `{show && <Modal />}` or `{items.map(...)}`.
|
|
282
256
|
*
|
|
283
257
|
* @example
|
|
284
|
-
* ```
|
|
285
|
-
*
|
|
286
|
-
*
|
|
258
|
+
* ```ts
|
|
259
|
+
* // Reactive child (compiler output for {count})
|
|
260
|
+
* createChildBinding(parent, () => $count(), createElement)
|
|
287
261
|
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
262
|
+
* // Reactive conditional (compiler output for {show && <Modal />})
|
|
263
|
+
* createChildBinding(parent, () => $show() && jsx(Modal, {}), createElement)
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
declare function createChildBinding(parent: HTMLElement | DocumentFragment, getValue: () => FictNode, createElementFn: CreateElementFn): BindingHandle;
|
|
267
|
+
declare global {
|
|
268
|
+
interface HTMLElement {
|
|
269
|
+
_$host?: HTMLElement;
|
|
270
|
+
[key: `$$${string}`]: EventListener | [EventListener, unknown] | undefined;
|
|
271
|
+
[key: `$$${string}Data`]: unknown;
|
|
272
|
+
}
|
|
273
|
+
interface Document extends Record<string, unknown> {
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Initialize event delegation for a set of event names.
|
|
278
|
+
* Events will be handled at the document level and dispatched to the appropriate handlers.
|
|
290
279
|
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
280
|
+
* @param eventNames - Array of event names to delegate
|
|
281
|
+
* @param doc - The document to attach handlers to (default: window.document)
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```ts
|
|
285
|
+
* // Called automatically by the compiler for delegated events
|
|
286
|
+
* delegateEvents(['click', 'input', 'keydown'])
|
|
293
287
|
* ```
|
|
294
288
|
*/
|
|
295
|
-
declare function
|
|
289
|
+
declare function delegateEvents(eventNames: string[], doc?: Document): void;
|
|
290
|
+
/**
|
|
291
|
+
* Clear all delegated event handlers from a document.
|
|
292
|
+
*
|
|
293
|
+
* @param doc - The document to clear handlers from (default: window.document)
|
|
294
|
+
*/
|
|
295
|
+
declare function clearDelegatedEvents(doc?: Document): void;
|
|
296
|
+
/**
|
|
297
|
+
* Add an event listener to an element.
|
|
298
|
+
* If the event is in DelegatedEvents, it uses event delegation for better performance.
|
|
299
|
+
*
|
|
300
|
+
* @param node - The element to add the listener to
|
|
301
|
+
* @param name - The event name (lowercase)
|
|
302
|
+
* @param handler - The event handler or [handler, data] tuple
|
|
303
|
+
* @param delegate - Whether to use delegation (auto-detected based on event name)
|
|
304
|
+
*/
|
|
305
|
+
declare function addEventListener(node: HTMLElement, name: string, handler: EventListener | [EventListener, unknown] | null | undefined, delegate?: boolean): void;
|
|
306
|
+
/**
|
|
307
|
+
* Bind an event listener to an element.
|
|
308
|
+
* Uses event delegation for better performance when applicable.
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```ts
|
|
312
|
+
* // Static event
|
|
313
|
+
* bindEvent(button, 'click', handleClick)
|
|
314
|
+
*
|
|
315
|
+
* // Reactive event (compiler output)
|
|
316
|
+
* bindEvent(button, 'click', () => $handler())
|
|
317
|
+
*
|
|
318
|
+
* // With modifiers
|
|
319
|
+
* bindEvent(button, 'click', handler, { capture: true, passive: true, once: true })
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
declare function bindEvent(el: HTMLElement, eventName: string, handler: EventListenerOrEventListenerObject | null | undefined, options?: boolean | AddEventListenerOptions): Cleanup;
|
|
323
|
+
/**
|
|
324
|
+
* Bind a ref to an element.
|
|
325
|
+
* Supports both callback refs and ref objects.
|
|
326
|
+
*
|
|
327
|
+
* @param el - The element to bind the ref to
|
|
328
|
+
* @param ref - Either a callback function, a ref object, or a reactive getter
|
|
329
|
+
* @returns Cleanup function
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```ts
|
|
333
|
+
* // Callback ref
|
|
334
|
+
* bindRef(el, (element) => { store.input = element })
|
|
335
|
+
*
|
|
336
|
+
* // Ref object
|
|
337
|
+
* const inputRef = createRef()
|
|
338
|
+
* bindRef(el, inputRef)
|
|
339
|
+
*
|
|
340
|
+
* // Reactive ref (compiler output)
|
|
341
|
+
* bindRef(el, () => props.ref)
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
declare function bindRef(el: HTMLElement, ref: unknown): Cleanup;
|
|
345
|
+
/**
|
|
346
|
+
* Apply spread props to an element with reactive updates.
|
|
347
|
+
* This handles dynamic spread like `<div {...props}>`.
|
|
348
|
+
*
|
|
349
|
+
* @param node - The element to apply props to
|
|
350
|
+
* @param props - The props object (may have reactive getters)
|
|
351
|
+
* @param isSVG - Whether this is an SVG element
|
|
352
|
+
* @param skipChildren - Whether to skip children handling
|
|
353
|
+
* @returns The previous props for tracking changes
|
|
354
|
+
*
|
|
355
|
+
* @example
|
|
356
|
+
* ```ts
|
|
357
|
+
* // Compiler output for <div {...props} />
|
|
358
|
+
* spread(el, props, false, false)
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
declare function spread(node: HTMLElement, props?: Record<string, unknown>, isSVG?: boolean, skipChildren?: boolean): Record<string, unknown>;
|
|
362
|
+
/**
|
|
363
|
+
* Assign props to a node, tracking previous values for efficient updates.
|
|
364
|
+
* This is the core prop assignment logic used by spread.
|
|
365
|
+
*
|
|
366
|
+
* @param node - The element to assign props to
|
|
367
|
+
* @param props - New props object
|
|
368
|
+
* @param isSVG - Whether this is an SVG element
|
|
369
|
+
* @param skipChildren - Whether to skip children handling
|
|
370
|
+
* @param prevProps - Previous props for comparison
|
|
371
|
+
* @param skipRef - Whether to skip ref handling
|
|
372
|
+
*/
|
|
373
|
+
declare function assign(node: HTMLElement, props: Record<string, unknown>, isSVG?: boolean, skipChildren?: boolean, prevProps?: Record<string, unknown>, skipRef?: boolean): void;
|
|
374
|
+
/**
|
|
375
|
+
* Create a conditional rendering binding.
|
|
376
|
+
* Efficiently renders one of two branches based on a condition.
|
|
377
|
+
*
|
|
378
|
+
* This is an optimized version for `{condition ? <A /> : <B />}` patterns
|
|
379
|
+
* where both branches are known statically.
|
|
380
|
+
*
|
|
381
|
+
* @example
|
|
382
|
+
* ```ts
|
|
383
|
+
* // Compiler output for {show ? <A /> : <B />}
|
|
384
|
+
* createConditional(
|
|
385
|
+
* () => $show(),
|
|
386
|
+
* () => jsx(A, {}),
|
|
387
|
+
* () => jsx(B, {}),
|
|
388
|
+
* createElement
|
|
389
|
+
* )
|
|
390
|
+
* ```
|
|
391
|
+
*/
|
|
392
|
+
declare function createConditional(condition: () => boolean, renderTrue: () => FictNode, createElementFn: CreateElementFn, renderFalse?: () => FictNode): BindingHandle;
|
|
393
|
+
/** Key extractor function type */
|
|
394
|
+
type KeyFn<T> = (item: T, index: number) => string | number;
|
|
395
|
+
/**
|
|
396
|
+
* Create a reactive list rendering binding with optional keying.
|
|
397
|
+
*/
|
|
398
|
+
declare function createList<T>(items: () => T[], renderItem: (item: T, index: number) => FictNode, createElementFn: CreateElementFn, getKey?: KeyFn<T>): BindingHandle;
|
|
399
|
+
/**
|
|
400
|
+
* Create a show/hide binding that uses CSS display instead of DOM manipulation.
|
|
401
|
+
* More efficient than conditional when the content is expensive to create.
|
|
402
|
+
*
|
|
403
|
+
* @example
|
|
404
|
+
* ```ts
|
|
405
|
+
* createShow(container, () => $visible())
|
|
406
|
+
* ```
|
|
407
|
+
*/
|
|
408
|
+
declare function createShow(el: HTMLElement, condition: () => boolean, displayValue?: string): void;
|
|
409
|
+
/**
|
|
410
|
+
* Create a portal that renders content into a different DOM container.
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```ts
|
|
414
|
+
* createPortal(
|
|
415
|
+
* document.body,
|
|
416
|
+
* () => jsx(Modal, { children: 'Hello' }),
|
|
417
|
+
* createElement
|
|
418
|
+
* )
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
421
|
+
declare function createPortal(container: HTMLElement, render: () => FictNode, createElementFn: CreateElementFn): BindingHandle;
|
|
296
422
|
|
|
297
|
-
|
|
298
|
-
|
|
423
|
+
interface ReactiveScope {
|
|
424
|
+
run<T>(fn: () => T): T;
|
|
425
|
+
stop(): void;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Create an explicit reactive scope that can contain effects/memos and be stopped manually.
|
|
429
|
+
* The scope registers with the current root for cleanup.
|
|
430
|
+
*/
|
|
431
|
+
declare function createScope(): ReactiveScope;
|
|
432
|
+
/**
|
|
433
|
+
* Run a block of reactive code inside a managed scope that follows a boolean flag.
|
|
434
|
+
* When the flag turns false, the scope is disposed and all contained effects/memos are cleaned up.
|
|
435
|
+
*/
|
|
436
|
+
declare function runInScope(flag: MaybeReactive<boolean>, fn: () => void): void;
|
|
299
437
|
|
|
300
|
-
interface
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
windowSize?: number;
|
|
304
|
-
highUsageRatio?: number;
|
|
305
|
-
maxRootReentrantDepth?: number;
|
|
306
|
-
enableWindowWarning?: boolean;
|
|
307
|
-
devMode?: boolean;
|
|
438
|
+
interface HookContext {
|
|
439
|
+
slots: unknown[];
|
|
440
|
+
cursor: number;
|
|
308
441
|
}
|
|
309
|
-
declare function
|
|
442
|
+
declare function __fictUseContext(): HookContext;
|
|
443
|
+
declare function __fictPushContext(): HookContext;
|
|
444
|
+
declare function __fictPopContext(): void;
|
|
445
|
+
declare function __fictResetContext(): void;
|
|
446
|
+
declare function __fictUseSignal<T>(ctx: HookContext, initial: T, slot?: number): SignalAccessor<T>;
|
|
447
|
+
declare function __fictUseMemo<T>(ctx: HookContext, fn: () => T, slot?: number): ComputedAccessor<T>;
|
|
448
|
+
declare function __fictUseEffect(ctx: HookContext, fn: () => void, slot?: number): void;
|
|
449
|
+
declare function __fictRender<T>(ctx: HookContext, fn: () => T): T;
|
|
310
450
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
type Element = FictNode;
|
|
314
|
-
interface IntrinsicElements {
|
|
315
|
-
html: HTMLAttributes<HTMLHtmlElement>;
|
|
316
|
-
head: HTMLAttributes<HTMLHeadElement>;
|
|
317
|
-
body: HTMLAttributes<HTMLBodyElement>;
|
|
318
|
-
title: HTMLAttributes<HTMLTitleElement>;
|
|
319
|
-
meta: MetaHTMLAttributes<HTMLMetaElement>;
|
|
320
|
-
link: LinkHTMLAttributes<HTMLLinkElement>;
|
|
321
|
-
style: StyleHTMLAttributes<HTMLStyleElement>;
|
|
322
|
-
script: ScriptHTMLAttributes<HTMLScriptElement>;
|
|
323
|
-
noscript: HTMLAttributes<HTMLElement>;
|
|
324
|
-
div: HTMLAttributes<HTMLDivElement>;
|
|
325
|
-
span: HTMLAttributes<HTMLSpanElement>;
|
|
326
|
-
main: HTMLAttributes<HTMLElement>;
|
|
327
|
-
header: HTMLAttributes<HTMLElement>;
|
|
328
|
-
footer: HTMLAttributes<HTMLElement>;
|
|
329
|
-
section: HTMLAttributes<HTMLElement>;
|
|
330
|
-
article: HTMLAttributes<HTMLElement>;
|
|
331
|
-
aside: HTMLAttributes<HTMLElement>;
|
|
332
|
-
nav: HTMLAttributes<HTMLElement>;
|
|
333
|
-
address: HTMLAttributes<HTMLElement>;
|
|
334
|
-
h1: HTMLAttributes<HTMLHeadingElement>;
|
|
335
|
-
h2: HTMLAttributes<HTMLHeadingElement>;
|
|
336
|
-
h3: HTMLAttributes<HTMLHeadingElement>;
|
|
337
|
-
h4: HTMLAttributes<HTMLHeadingElement>;
|
|
338
|
-
h5: HTMLAttributes<HTMLHeadingElement>;
|
|
339
|
-
h6: HTMLAttributes<HTMLHeadingElement>;
|
|
340
|
-
hgroup: HTMLAttributes<HTMLElement>;
|
|
341
|
-
p: HTMLAttributes<HTMLParagraphElement>;
|
|
342
|
-
blockquote: BlockquoteHTMLAttributes<HTMLQuoteElement>;
|
|
343
|
-
pre: HTMLAttributes<HTMLPreElement>;
|
|
344
|
-
figure: HTMLAttributes<HTMLElement>;
|
|
345
|
-
figcaption: HTMLAttributes<HTMLElement>;
|
|
346
|
-
hr: HTMLAttributes<HTMLHRElement>;
|
|
347
|
-
br: HTMLAttributes<HTMLBRElement>;
|
|
348
|
-
wbr: HTMLAttributes<HTMLElement>;
|
|
349
|
-
a: AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
350
|
-
abbr: HTMLAttributes<HTMLElement>;
|
|
351
|
-
b: HTMLAttributes<HTMLElement>;
|
|
352
|
-
bdi: HTMLAttributes<HTMLElement>;
|
|
353
|
-
bdo: HTMLAttributes<HTMLElement>;
|
|
354
|
-
cite: HTMLAttributes<HTMLElement>;
|
|
355
|
-
code: HTMLAttributes<HTMLElement>;
|
|
356
|
-
data: DataHTMLAttributes<HTMLDataElement>;
|
|
357
|
-
dfn: HTMLAttributes<HTMLElement>;
|
|
358
|
-
em: HTMLAttributes<HTMLElement>;
|
|
359
|
-
i: HTMLAttributes<HTMLElement>;
|
|
360
|
-
kbd: HTMLAttributes<HTMLElement>;
|
|
361
|
-
mark: HTMLAttributes<HTMLElement>;
|
|
362
|
-
q: QuoteHTMLAttributes<HTMLQuoteElement>;
|
|
363
|
-
rp: HTMLAttributes<HTMLElement>;
|
|
364
|
-
rt: HTMLAttributes<HTMLElement>;
|
|
365
|
-
ruby: HTMLAttributes<HTMLElement>;
|
|
366
|
-
s: HTMLAttributes<HTMLElement>;
|
|
367
|
-
samp: HTMLAttributes<HTMLElement>;
|
|
368
|
-
small: HTMLAttributes<HTMLElement>;
|
|
369
|
-
strong: HTMLAttributes<HTMLElement>;
|
|
370
|
-
sub: HTMLAttributes<HTMLElement>;
|
|
371
|
-
sup: HTMLAttributes<HTMLElement>;
|
|
372
|
-
time: TimeHTMLAttributes<HTMLTimeElement>;
|
|
373
|
-
u: HTMLAttributes<HTMLElement>;
|
|
374
|
-
var: HTMLAttributes<HTMLElement>;
|
|
375
|
-
ul: HTMLAttributes<HTMLUListElement>;
|
|
376
|
-
ol: OlHTMLAttributes<HTMLOListElement>;
|
|
377
|
-
li: LiHTMLAttributes<HTMLLIElement>;
|
|
378
|
-
dl: HTMLAttributes<HTMLDListElement>;
|
|
379
|
-
dt: HTMLAttributes<HTMLElement>;
|
|
380
|
-
dd: HTMLAttributes<HTMLElement>;
|
|
381
|
-
menu: HTMLAttributes<HTMLMenuElement>;
|
|
382
|
-
table: TableHTMLAttributes<HTMLTableElement>;
|
|
383
|
-
caption: HTMLAttributes<HTMLTableCaptionElement>;
|
|
384
|
-
colgroup: ColgroupHTMLAttributes<HTMLTableColElement>;
|
|
385
|
-
col: ColHTMLAttributes<HTMLTableColElement>;
|
|
386
|
-
thead: HTMLAttributes<HTMLTableSectionElement>;
|
|
387
|
-
tbody: HTMLAttributes<HTMLTableSectionElement>;
|
|
388
|
-
tfoot: HTMLAttributes<HTMLTableSectionElement>;
|
|
389
|
-
tr: HTMLAttributes<HTMLTableRowElement>;
|
|
390
|
-
th: ThHTMLAttributes<HTMLTableCellElement>;
|
|
391
|
-
td: TdHTMLAttributes<HTMLTableCellElement>;
|
|
392
|
-
form: FormHTMLAttributes<HTMLFormElement>;
|
|
393
|
-
fieldset: FieldsetHTMLAttributes<HTMLFieldSetElement>;
|
|
394
|
-
legend: HTMLAttributes<HTMLLegendElement>;
|
|
395
|
-
label: LabelHTMLAttributes<HTMLLabelElement>;
|
|
396
|
-
input: InputHTMLAttributes<HTMLInputElement>;
|
|
397
|
-
button: ButtonHTMLAttributes<HTMLButtonElement>;
|
|
398
|
-
select: SelectHTMLAttributes<HTMLSelectElement>;
|
|
399
|
-
datalist: HTMLAttributes<HTMLDataListElement>;
|
|
400
|
-
optgroup: OptgroupHTMLAttributes<HTMLOptGroupElement>;
|
|
401
|
-
option: OptionHTMLAttributes<HTMLOptionElement>;
|
|
402
|
-
textarea: TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
403
|
-
output: OutputHTMLAttributes<HTMLOutputElement>;
|
|
404
|
-
progress: ProgressHTMLAttributes<HTMLProgressElement>;
|
|
405
|
-
meter: MeterHTMLAttributes<HTMLMeterElement>;
|
|
406
|
-
details: DetailsHTMLAttributes<HTMLDetailsElement>;
|
|
407
|
-
summary: HTMLAttributes<HTMLElement>;
|
|
408
|
-
dialog: DialogHTMLAttributes<HTMLDialogElement>;
|
|
409
|
-
img: ImgHTMLAttributes<HTMLImageElement>;
|
|
410
|
-
picture: HTMLAttributes<HTMLPictureElement>;
|
|
411
|
-
source: SourceHTMLAttributes<HTMLSourceElement>;
|
|
412
|
-
audio: AudioVideoHTMLAttributes<HTMLAudioElement>;
|
|
413
|
-
video: AudioVideoHTMLAttributes<HTMLVideoElement>;
|
|
414
|
-
track: TrackHTMLAttributes<HTMLTrackElement>;
|
|
415
|
-
map: MapHTMLAttributes<HTMLMapElement>;
|
|
416
|
-
area: AreaHTMLAttributes<HTMLAreaElement>;
|
|
417
|
-
iframe: IframeHTMLAttributes<HTMLIFrameElement>;
|
|
418
|
-
embed: EmbedHTMLAttributes<HTMLEmbedElement>;
|
|
419
|
-
object: ObjectHTMLAttributes<HTMLObjectElement>;
|
|
420
|
-
param: ParamHTMLAttributes<HTMLParamElement>;
|
|
421
|
-
canvas: CanvasHTMLAttributes<HTMLCanvasElement>;
|
|
422
|
-
svg: SVGAttributes<SVGSVGElement>;
|
|
423
|
-
path: SVGAttributes<SVGPathElement>;
|
|
424
|
-
circle: SVGAttributes<SVGCircleElement>;
|
|
425
|
-
rect: SVGAttributes<SVGRectElement>;
|
|
426
|
-
line: SVGAttributes<SVGLineElement>;
|
|
427
|
-
polyline: SVGAttributes<SVGPolylineElement>;
|
|
428
|
-
polygon: SVGAttributes<SVGPolygonElement>;
|
|
429
|
-
ellipse: SVGAttributes<SVGEllipseElement>;
|
|
430
|
-
g: SVGAttributes<SVGGElement>;
|
|
431
|
-
defs: SVGAttributes<SVGDefsElement>;
|
|
432
|
-
use: SVGAttributes<SVGUseElement>;
|
|
433
|
-
text: SVGAttributes<SVGTextElement>;
|
|
434
|
-
tspan: SVGAttributes<SVGTSpanElement>;
|
|
435
|
-
template: HTMLAttributes<HTMLTemplateElement>;
|
|
436
|
-
slot: SlotHTMLAttributes<HTMLSlotElement>;
|
|
437
|
-
portal: HTMLAttributes<HTMLElement>;
|
|
438
|
-
}
|
|
439
|
-
interface ElementChildrenAttribute {
|
|
440
|
-
children: unknown;
|
|
441
|
-
}
|
|
451
|
+
interface VersionedSignalOptions<T> {
|
|
452
|
+
equals?: (prev: T, next: T) => boolean;
|
|
442
453
|
}
|
|
443
|
-
interface
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
draggable?: boolean | 'true' | 'false';
|
|
455
|
-
contentEditable?: boolean | 'true' | 'false' | 'inherit';
|
|
456
|
-
spellCheck?: boolean | 'true' | 'false';
|
|
457
|
-
translate?: 'yes' | 'no';
|
|
458
|
-
inert?: boolean;
|
|
459
|
-
popover?: 'auto' | 'manual';
|
|
460
|
-
autofocus?: boolean;
|
|
461
|
-
slot?: string;
|
|
462
|
-
accessKey?: string;
|
|
463
|
-
onClick?: (e: MouseEvent) => void;
|
|
464
|
-
onDblClick?: (e: MouseEvent) => void;
|
|
465
|
-
onMouseDown?: (e: MouseEvent) => void;
|
|
466
|
-
onMouseUp?: (e: MouseEvent) => void;
|
|
467
|
-
onMouseMove?: (e: MouseEvent) => void;
|
|
468
|
-
onMouseEnter?: (e: MouseEvent) => void;
|
|
469
|
-
onMouseLeave?: (e: MouseEvent) => void;
|
|
470
|
-
onMouseOver?: (e: MouseEvent) => void;
|
|
471
|
-
onMouseOut?: (e: MouseEvent) => void;
|
|
472
|
-
onContextMenu?: (e: MouseEvent) => void;
|
|
473
|
-
onInput?: (e: InputEvent) => void;
|
|
474
|
-
onChange?: (e: Event) => void;
|
|
475
|
-
onSubmit?: (e: SubmitEvent) => void;
|
|
476
|
-
onReset?: (e: Event) => void;
|
|
477
|
-
onKeyDown?: (e: KeyboardEvent) => void;
|
|
478
|
-
onKeyUp?: (e: KeyboardEvent) => void;
|
|
479
|
-
onKeyPress?: (e: KeyboardEvent) => void;
|
|
480
|
-
onFocus?: (e: FocusEvent) => void;
|
|
481
|
-
onBlur?: (e: FocusEvent) => void;
|
|
482
|
-
onScroll?: (e: Event) => void;
|
|
483
|
-
onWheel?: (e: WheelEvent) => void;
|
|
484
|
-
onLoad?: (e: Event) => void;
|
|
485
|
-
onError?: (e: Event) => void;
|
|
486
|
-
onDrag?: (e: DragEvent) => void;
|
|
487
|
-
onDragStart?: (e: DragEvent) => void;
|
|
488
|
-
onDragEnd?: (e: DragEvent) => void;
|
|
489
|
-
onDragEnter?: (e: DragEvent) => void;
|
|
490
|
-
onDragLeave?: (e: DragEvent) => void;
|
|
491
|
-
onDragOver?: (e: DragEvent) => void;
|
|
492
|
-
onDrop?: (e: DragEvent) => void;
|
|
493
|
-
onTouchStart?: (e: TouchEvent) => void;
|
|
494
|
-
onTouchMove?: (e: TouchEvent) => void;
|
|
495
|
-
onTouchEnd?: (e: TouchEvent) => void;
|
|
496
|
-
onTouchCancel?: (e: TouchEvent) => void;
|
|
497
|
-
onAnimationStart?: (e: AnimationEvent) => void;
|
|
498
|
-
onAnimationEnd?: (e: AnimationEvent) => void;
|
|
499
|
-
onAnimationIteration?: (e: AnimationEvent) => void;
|
|
500
|
-
onTransitionEnd?: (e: TransitionEvent) => void;
|
|
501
|
-
onPointerDown?: (e: PointerEvent) => void;
|
|
502
|
-
onPointerUp?: (e: PointerEvent) => void;
|
|
503
|
-
onPointerMove?: (e: PointerEvent) => void;
|
|
504
|
-
onPointerEnter?: (e: PointerEvent) => void;
|
|
505
|
-
onPointerLeave?: (e: PointerEvent) => void;
|
|
506
|
-
onPointerOver?: (e: PointerEvent) => void;
|
|
507
|
-
onPointerOut?: (e: PointerEvent) => void;
|
|
508
|
-
onPointerCancel?: (e: PointerEvent) => void;
|
|
509
|
-
ref?: ((el: T | null) => void) | {
|
|
510
|
-
current: T | null;
|
|
511
|
-
};
|
|
512
|
-
role?: string;
|
|
513
|
-
'aria-hidden'?: boolean | 'true' | 'false';
|
|
514
|
-
'aria-label'?: string;
|
|
515
|
-
'aria-labelledby'?: string;
|
|
516
|
-
'aria-describedby'?: string;
|
|
517
|
-
'aria-live'?: 'off' | 'polite' | 'assertive';
|
|
518
|
-
'aria-atomic'?: boolean | 'true' | 'false';
|
|
519
|
-
'aria-busy'?: boolean | 'true' | 'false';
|
|
520
|
-
'aria-current'?: boolean | 'true' | 'false' | 'page' | 'step' | 'location' | 'date' | 'time';
|
|
521
|
-
'aria-disabled'?: boolean | 'true' | 'false';
|
|
522
|
-
'aria-expanded'?: boolean | 'true' | 'false';
|
|
523
|
-
'aria-haspopup'?: boolean | 'true' | 'false' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
|
|
524
|
-
'aria-pressed'?: boolean | 'true' | 'false' | 'mixed';
|
|
525
|
-
'aria-selected'?: boolean | 'true' | 'false';
|
|
526
|
-
'aria-checked'?: boolean | 'true' | 'false' | 'mixed';
|
|
527
|
-
'aria-controls'?: string;
|
|
528
|
-
'aria-owns'?: string;
|
|
529
|
-
'aria-activedescendant'?: string;
|
|
530
|
-
'aria-valuemin'?: number;
|
|
531
|
-
'aria-valuemax'?: number;
|
|
532
|
-
'aria-valuenow'?: number;
|
|
533
|
-
'aria-valuetext'?: string;
|
|
534
|
-
'aria-orientation'?: 'horizontal' | 'vertical';
|
|
535
|
-
'aria-readonly'?: boolean | 'true' | 'false';
|
|
536
|
-
'aria-required'?: boolean | 'true' | 'false';
|
|
537
|
-
'aria-invalid'?: boolean | 'true' | 'false' | 'grammar' | 'spelling';
|
|
538
|
-
'aria-errormessage'?: string;
|
|
539
|
-
'aria-modal'?: boolean | 'true' | 'false';
|
|
540
|
-
'aria-placeholder'?: string;
|
|
541
|
-
'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other';
|
|
542
|
-
'aria-colcount'?: number;
|
|
543
|
-
'aria-colindex'?: number;
|
|
544
|
-
'aria-colspan'?: number;
|
|
545
|
-
'aria-rowcount'?: number;
|
|
546
|
-
'aria-rowindex'?: number;
|
|
547
|
-
'aria-rowspan'?: number;
|
|
548
|
-
'aria-setsize'?: number;
|
|
549
|
-
'aria-posinset'?: number;
|
|
550
|
-
'aria-level'?: number;
|
|
551
|
-
'aria-multiselectable'?: boolean | 'true' | 'false';
|
|
552
|
-
'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both';
|
|
553
|
-
'aria-details'?: string;
|
|
554
|
-
'aria-keyshortcuts'?: string;
|
|
555
|
-
'aria-roledescription'?: string;
|
|
556
|
-
[key: `data-${string}`]: string | number | boolean | undefined;
|
|
454
|
+
interface VersionedSignal<T> {
|
|
455
|
+
/** Reactive read that tracks both the value and version counter */
|
|
456
|
+
read: () => T;
|
|
457
|
+
/** Write a new value, forcing a version bump when value is equal */
|
|
458
|
+
write: (next: T) => void;
|
|
459
|
+
/** Force a version bump without changing the value */
|
|
460
|
+
force: () => void;
|
|
461
|
+
/** Read the current version without creating a dependency */
|
|
462
|
+
peekVersion: () => number;
|
|
463
|
+
/** Read the current value without tracking */
|
|
464
|
+
peekValue: () => T;
|
|
557
465
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
466
|
+
/**
|
|
467
|
+
* Create a signal wrapper that forces subscribers to update when the same reference is written.
|
|
468
|
+
*
|
|
469
|
+
* Useful for compiler-generated keyed list items where updates may reuse the same object reference.
|
|
470
|
+
*/
|
|
471
|
+
declare function createVersionedSignal<T>(initialValue: T, options?: VersionedSignalOptions<T>): VersionedSignal<T>;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* @internal
|
|
475
|
+
* Marks a zero-arg getter so props proxy can lazily evaluate it.
|
|
476
|
+
* Users normally never call this directly; the compiler injects it.
|
|
477
|
+
*/
|
|
478
|
+
declare function __fictProp<T>(getter: () => T): () => T;
|
|
479
|
+
declare function createPropsProxy<T extends Record<string, unknown>>(props: T): T;
|
|
480
|
+
/**
|
|
481
|
+
* Create a rest-like props object while preserving prop getters.
|
|
482
|
+
* Excludes the specified keys from the returned object.
|
|
483
|
+
*/
|
|
484
|
+
declare function __fictPropsRest<T extends Record<string, unknown>>(props: T, exclude: (string | number | symbol)[]): Record<string, unknown>;
|
|
485
|
+
/**
|
|
486
|
+
* Merge multiple props-like objects while preserving lazy getters.
|
|
487
|
+
* Later sources override earlier ones.
|
|
488
|
+
*
|
|
489
|
+
* Uses lazy lookup strategy - properties are only accessed when read,
|
|
490
|
+
* avoiding upfront iteration of all keys.
|
|
491
|
+
*/
|
|
492
|
+
type MergeSource<T extends Record<string, unknown>> = T | (() => T);
|
|
493
|
+
declare function mergeProps<T extends Record<string, unknown>>(...sources: (MergeSource<T> | null | undefined)[]): Record<string, unknown>;
|
|
494
|
+
type PropGetter<T> = (() => T) & {
|
|
495
|
+
__fictProp: true;
|
|
496
|
+
};
|
|
497
|
+
/**
|
|
498
|
+
* Memoize a prop getter to cache expensive computations.
|
|
499
|
+
* Use when prop expressions involve heavy calculations.
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* ```tsx
|
|
503
|
+
* // Without useProp - recomputes on every access
|
|
504
|
+
* <Child data={expensiveComputation(list, filter)} />
|
|
505
|
+
*
|
|
506
|
+
* // With useProp - cached until dependencies change, auto-unwrapped by props proxy
|
|
507
|
+
* const memoizedData = useProp(() => expensiveComputation(list, filter))
|
|
508
|
+
* <Child data={memoizedData} />
|
|
509
|
+
* ```
|
|
510
|
+
*/
|
|
511
|
+
declare function useProp<T>(getter: () => T): PropGetter<T>;
|
|
512
|
+
|
|
513
|
+
type LifecycleFn = () => void | Cleanup;
|
|
514
|
+
interface RootContext {
|
|
515
|
+
parent?: RootContext | undefined;
|
|
516
|
+
onMountCallbacks?: LifecycleFn[];
|
|
517
|
+
cleanups: Cleanup[];
|
|
518
|
+
destroyCallbacks: Cleanup[];
|
|
519
|
+
errorHandlers?: ErrorHandler[];
|
|
520
|
+
suspenseHandlers?: SuspenseHandler[];
|
|
567
521
|
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
522
|
+
type ErrorHandler = (err: unknown, info?: ErrorInfo) => boolean | void;
|
|
523
|
+
type SuspenseHandler = (token: SuspenseToken | PromiseLike<unknown>) => boolean | void;
|
|
524
|
+
declare function onMount(fn: LifecycleFn): void;
|
|
525
|
+
declare function onDestroy(fn: LifecycleFn): void;
|
|
526
|
+
declare function onCleanup(fn: Cleanup): void;
|
|
527
|
+
declare function createRoot<T>(fn: () => T): {
|
|
528
|
+
dispose: () => void;
|
|
529
|
+
value: T;
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Create a ref object for DOM element references.
|
|
534
|
+
*
|
|
535
|
+
* @returns A ref object with a `current` property initialized to `null`
|
|
536
|
+
*
|
|
537
|
+
* @example
|
|
538
|
+
* ```tsx
|
|
539
|
+
* import { createRef } from 'fict'
|
|
540
|
+
*
|
|
541
|
+
* function Component() {
|
|
542
|
+
* const inputRef = createRef<HTMLInputElement>()
|
|
543
|
+
*
|
|
544
|
+
* $effect(() => {
|
|
545
|
+
* inputRef.current?.focus()
|
|
546
|
+
* })
|
|
547
|
+
*
|
|
548
|
+
* return <input ref={inputRef} />
|
|
549
|
+
* }
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
declare function createRef<T extends HTMLElement = HTMLElement>(): RefObject<T>;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Execute a function with low-priority scheduling.
|
|
556
|
+
* Updates triggered inside the callback will be processed after any high-priority updates.
|
|
557
|
+
* This keeps the UI responsive during expensive operations.
|
|
558
|
+
*
|
|
559
|
+
* @param fn - The function to execute in transition context
|
|
560
|
+
*
|
|
561
|
+
* @example
|
|
562
|
+
* ```tsx
|
|
563
|
+
* const handleInput = (e) => {
|
|
564
|
+
* query = e.target.value // High priority: immediate
|
|
565
|
+
* startTransition(() => {
|
|
566
|
+
* // Low priority: processed after high priority updates
|
|
567
|
+
* filteredItems = allItems.filter(x => x.includes(query))
|
|
568
|
+
* })
|
|
569
|
+
* }
|
|
570
|
+
* ```
|
|
571
|
+
*/
|
|
572
|
+
declare function startTransition(fn: () => void): void;
|
|
573
|
+
/**
|
|
574
|
+
* React-style useTransition hook.
|
|
575
|
+
* Returns a pending signal and a startTransition function.
|
|
576
|
+
*
|
|
577
|
+
* @returns A tuple of [isPending accessor, startTransition function]
|
|
578
|
+
*
|
|
579
|
+
* @example
|
|
580
|
+
* ```tsx
|
|
581
|
+
* function SearchComponent() {
|
|
582
|
+
* let query = $state('')
|
|
583
|
+
* const [isPending, start] = useTransition()
|
|
584
|
+
*
|
|
585
|
+
* const handleChange = (e) => {
|
|
586
|
+
* query = e.target.value
|
|
587
|
+
* start(() => {
|
|
588
|
+
* // Expensive filtering happens in low priority
|
|
589
|
+
* filteredResults = expensiveFilter(allData, query)
|
|
590
|
+
* })
|
|
591
|
+
* }
|
|
592
|
+
*
|
|
593
|
+
* return (
|
|
594
|
+
* <>
|
|
595
|
+
* <input value={query} onInput={handleChange} />
|
|
596
|
+
* {isPending() && <Spinner />}
|
|
597
|
+
* <Results items={filteredResults} />
|
|
598
|
+
* </>
|
|
599
|
+
* )
|
|
600
|
+
* }
|
|
601
|
+
* ```
|
|
602
|
+
*/
|
|
603
|
+
declare function useTransition(): [() => boolean, (fn: () => void) => void];
|
|
604
|
+
/**
|
|
605
|
+
* Creates a deferred version of a value that updates with low priority.
|
|
606
|
+
* The returned accessor will lag behind the source value during rapid updates,
|
|
607
|
+
* allowing high-priority work to complete first.
|
|
608
|
+
*
|
|
609
|
+
* @param getValue - Accessor function that returns the source value
|
|
610
|
+
* @returns Accessor function that returns the deferred value
|
|
611
|
+
*
|
|
612
|
+
* @example
|
|
613
|
+
* ```tsx
|
|
614
|
+
* function SearchResults({ query }) {
|
|
615
|
+
* const deferredQuery = useDeferredValue(() => query)
|
|
616
|
+
*
|
|
617
|
+
* // deferredQuery lags behind query during rapid typing
|
|
618
|
+
* const results = expensiveSearch(deferredQuery())
|
|
619
|
+
*
|
|
620
|
+
* return <ResultList items={results} />
|
|
621
|
+
* }
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
declare function useDeferredValue<T>(getValue: () => T): () => T;
|
|
625
|
+
|
|
626
|
+
declare function batch<T>(fn: () => T): T;
|
|
627
|
+
declare function untrack<T>(fn: () => T): T;
|
|
628
|
+
|
|
629
|
+
interface CycleProtectionOptions {
|
|
630
|
+
maxFlushCyclesPerMicrotask?: number;
|
|
631
|
+
maxEffectRunsPerFlush?: number;
|
|
632
|
+
windowSize?: number;
|
|
633
|
+
highUsageRatio?: number;
|
|
634
|
+
maxRootReentrantDepth?: number;
|
|
635
|
+
enableWindowWarning?: boolean;
|
|
636
|
+
devMode?: boolean;
|
|
637
|
+
}
|
|
638
|
+
declare function setCycleProtectionOptions(opts: CycleProtectionOptions): void;
|
|
639
|
+
|
|
640
|
+
declare const Fragment: unique symbol;
|
|
641
|
+
declare namespace JSX {
|
|
642
|
+
type Element = FictNode;
|
|
643
|
+
interface IntrinsicElements {
|
|
644
|
+
html: HTMLAttributes<HTMLHtmlElement>;
|
|
645
|
+
head: HTMLAttributes<HTMLHeadElement>;
|
|
646
|
+
body: HTMLAttributes<HTMLBodyElement>;
|
|
647
|
+
title: HTMLAttributes<HTMLTitleElement>;
|
|
648
|
+
meta: MetaHTMLAttributes<HTMLMetaElement>;
|
|
649
|
+
link: LinkHTMLAttributes<HTMLLinkElement>;
|
|
650
|
+
style: StyleHTMLAttributes<HTMLStyleElement>;
|
|
651
|
+
script: ScriptHTMLAttributes<HTMLScriptElement>;
|
|
652
|
+
noscript: HTMLAttributes<HTMLElement>;
|
|
653
|
+
div: HTMLAttributes<HTMLDivElement>;
|
|
654
|
+
span: HTMLAttributes<HTMLSpanElement>;
|
|
655
|
+
main: HTMLAttributes<HTMLElement>;
|
|
656
|
+
header: HTMLAttributes<HTMLElement>;
|
|
657
|
+
footer: HTMLAttributes<HTMLElement>;
|
|
658
|
+
section: HTMLAttributes<HTMLElement>;
|
|
659
|
+
article: HTMLAttributes<HTMLElement>;
|
|
660
|
+
aside: HTMLAttributes<HTMLElement>;
|
|
661
|
+
nav: HTMLAttributes<HTMLElement>;
|
|
662
|
+
address: HTMLAttributes<HTMLElement>;
|
|
663
|
+
h1: HTMLAttributes<HTMLHeadingElement>;
|
|
664
|
+
h2: HTMLAttributes<HTMLHeadingElement>;
|
|
665
|
+
h3: HTMLAttributes<HTMLHeadingElement>;
|
|
666
|
+
h4: HTMLAttributes<HTMLHeadingElement>;
|
|
667
|
+
h5: HTMLAttributes<HTMLHeadingElement>;
|
|
668
|
+
h6: HTMLAttributes<HTMLHeadingElement>;
|
|
669
|
+
hgroup: HTMLAttributes<HTMLElement>;
|
|
670
|
+
p: HTMLAttributes<HTMLParagraphElement>;
|
|
671
|
+
blockquote: BlockquoteHTMLAttributes<HTMLQuoteElement>;
|
|
672
|
+
pre: HTMLAttributes<HTMLPreElement>;
|
|
673
|
+
figure: HTMLAttributes<HTMLElement>;
|
|
674
|
+
figcaption: HTMLAttributes<HTMLElement>;
|
|
675
|
+
hr: HTMLAttributes<HTMLHRElement>;
|
|
676
|
+
br: HTMLAttributes<HTMLBRElement>;
|
|
677
|
+
wbr: HTMLAttributes<HTMLElement>;
|
|
678
|
+
a: AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
679
|
+
abbr: HTMLAttributes<HTMLElement>;
|
|
680
|
+
b: HTMLAttributes<HTMLElement>;
|
|
681
|
+
bdi: HTMLAttributes<HTMLElement>;
|
|
682
|
+
bdo: HTMLAttributes<HTMLElement>;
|
|
683
|
+
cite: HTMLAttributes<HTMLElement>;
|
|
684
|
+
code: HTMLAttributes<HTMLElement>;
|
|
685
|
+
data: DataHTMLAttributes<HTMLDataElement>;
|
|
686
|
+
dfn: HTMLAttributes<HTMLElement>;
|
|
687
|
+
em: HTMLAttributes<HTMLElement>;
|
|
688
|
+
i: HTMLAttributes<HTMLElement>;
|
|
689
|
+
kbd: HTMLAttributes<HTMLElement>;
|
|
690
|
+
mark: HTMLAttributes<HTMLElement>;
|
|
691
|
+
q: QuoteHTMLAttributes<HTMLQuoteElement>;
|
|
692
|
+
rp: HTMLAttributes<HTMLElement>;
|
|
693
|
+
rt: HTMLAttributes<HTMLElement>;
|
|
694
|
+
ruby: HTMLAttributes<HTMLElement>;
|
|
695
|
+
s: HTMLAttributes<HTMLElement>;
|
|
696
|
+
samp: HTMLAttributes<HTMLElement>;
|
|
697
|
+
small: HTMLAttributes<HTMLElement>;
|
|
698
|
+
strong: HTMLAttributes<HTMLElement>;
|
|
699
|
+
sub: HTMLAttributes<HTMLElement>;
|
|
700
|
+
sup: HTMLAttributes<HTMLElement>;
|
|
701
|
+
time: TimeHTMLAttributes<HTMLTimeElement>;
|
|
702
|
+
u: HTMLAttributes<HTMLElement>;
|
|
703
|
+
var: HTMLAttributes<HTMLElement>;
|
|
704
|
+
ul: HTMLAttributes<HTMLUListElement>;
|
|
705
|
+
ol: OlHTMLAttributes<HTMLOListElement>;
|
|
706
|
+
li: LiHTMLAttributes<HTMLLIElement>;
|
|
707
|
+
dl: HTMLAttributes<HTMLDListElement>;
|
|
708
|
+
dt: HTMLAttributes<HTMLElement>;
|
|
709
|
+
dd: HTMLAttributes<HTMLElement>;
|
|
710
|
+
menu: HTMLAttributes<HTMLMenuElement>;
|
|
711
|
+
table: TableHTMLAttributes<HTMLTableElement>;
|
|
712
|
+
caption: HTMLAttributes<HTMLTableCaptionElement>;
|
|
713
|
+
colgroup: ColgroupHTMLAttributes<HTMLTableColElement>;
|
|
714
|
+
col: ColHTMLAttributes<HTMLTableColElement>;
|
|
715
|
+
thead: HTMLAttributes<HTMLTableSectionElement>;
|
|
716
|
+
tbody: HTMLAttributes<HTMLTableSectionElement>;
|
|
717
|
+
tfoot: HTMLAttributes<HTMLTableSectionElement>;
|
|
718
|
+
tr: HTMLAttributes<HTMLTableRowElement>;
|
|
719
|
+
th: ThHTMLAttributes<HTMLTableCellElement>;
|
|
720
|
+
td: TdHTMLAttributes<HTMLTableCellElement>;
|
|
721
|
+
form: FormHTMLAttributes<HTMLFormElement>;
|
|
722
|
+
fieldset: FieldsetHTMLAttributes<HTMLFieldSetElement>;
|
|
723
|
+
legend: HTMLAttributes<HTMLLegendElement>;
|
|
724
|
+
label: LabelHTMLAttributes<HTMLLabelElement>;
|
|
725
|
+
input: InputHTMLAttributes<HTMLInputElement>;
|
|
726
|
+
button: ButtonHTMLAttributes<HTMLButtonElement>;
|
|
727
|
+
select: SelectHTMLAttributes<HTMLSelectElement>;
|
|
728
|
+
datalist: HTMLAttributes<HTMLDataListElement>;
|
|
729
|
+
optgroup: OptgroupHTMLAttributes<HTMLOptGroupElement>;
|
|
730
|
+
option: OptionHTMLAttributes<HTMLOptionElement>;
|
|
731
|
+
textarea: TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
732
|
+
output: OutputHTMLAttributes<HTMLOutputElement>;
|
|
733
|
+
progress: ProgressHTMLAttributes<HTMLProgressElement>;
|
|
734
|
+
meter: MeterHTMLAttributes<HTMLMeterElement>;
|
|
735
|
+
details: DetailsHTMLAttributes<HTMLDetailsElement>;
|
|
736
|
+
summary: HTMLAttributes<HTMLElement>;
|
|
737
|
+
dialog: DialogHTMLAttributes<HTMLDialogElement>;
|
|
738
|
+
img: ImgHTMLAttributes<HTMLImageElement>;
|
|
739
|
+
picture: HTMLAttributes<HTMLPictureElement>;
|
|
740
|
+
source: SourceHTMLAttributes<HTMLSourceElement>;
|
|
741
|
+
audio: AudioVideoHTMLAttributes<HTMLAudioElement>;
|
|
742
|
+
video: AudioVideoHTMLAttributes<HTMLVideoElement>;
|
|
743
|
+
track: TrackHTMLAttributes<HTMLTrackElement>;
|
|
744
|
+
map: MapHTMLAttributes<HTMLMapElement>;
|
|
745
|
+
area: AreaHTMLAttributes<HTMLAreaElement>;
|
|
746
|
+
iframe: IframeHTMLAttributes<HTMLIFrameElement>;
|
|
747
|
+
embed: EmbedHTMLAttributes<HTMLEmbedElement>;
|
|
748
|
+
object: ObjectHTMLAttributes<HTMLObjectElement>;
|
|
749
|
+
param: ParamHTMLAttributes<HTMLParamElement>;
|
|
750
|
+
canvas: CanvasHTMLAttributes<HTMLCanvasElement>;
|
|
751
|
+
svg: SVGAttributes<SVGSVGElement>;
|
|
752
|
+
path: SVGAttributes<SVGPathElement>;
|
|
753
|
+
circle: SVGAttributes<SVGCircleElement>;
|
|
754
|
+
rect: SVGAttributes<SVGRectElement>;
|
|
755
|
+
line: SVGAttributes<SVGLineElement>;
|
|
756
|
+
polyline: SVGAttributes<SVGPolylineElement>;
|
|
757
|
+
polygon: SVGAttributes<SVGPolygonElement>;
|
|
758
|
+
ellipse: SVGAttributes<SVGEllipseElement>;
|
|
759
|
+
g: SVGAttributes<SVGGElement>;
|
|
760
|
+
defs: SVGAttributes<SVGDefsElement>;
|
|
761
|
+
use: SVGAttributes<SVGUseElement>;
|
|
762
|
+
text: SVGAttributes<SVGTextElement>;
|
|
763
|
+
tspan: SVGAttributes<SVGTSpanElement>;
|
|
764
|
+
template: HTMLAttributes<HTMLTemplateElement>;
|
|
765
|
+
slot: SlotHTMLAttributes<HTMLSlotElement>;
|
|
766
|
+
portal: HTMLAttributes<HTMLElement>;
|
|
767
|
+
}
|
|
768
|
+
interface ElementChildrenAttribute {
|
|
769
|
+
children: unknown;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
interface HTMLAttributes<T> {
|
|
773
|
+
children?: FictNode | FictNode[];
|
|
774
|
+
key?: string | number;
|
|
775
|
+
id?: string;
|
|
776
|
+
class?: string;
|
|
777
|
+
style?: string | Record<string, string | number>;
|
|
778
|
+
title?: string;
|
|
779
|
+
lang?: string;
|
|
780
|
+
dir?: 'ltr' | 'rtl' | 'auto';
|
|
781
|
+
hidden?: boolean | 'hidden' | 'until-found';
|
|
782
|
+
tabIndex?: number;
|
|
783
|
+
draggable?: boolean | 'true' | 'false';
|
|
784
|
+
contentEditable?: boolean | 'true' | 'false' | 'inherit';
|
|
785
|
+
spellCheck?: boolean | 'true' | 'false';
|
|
786
|
+
translate?: 'yes' | 'no';
|
|
787
|
+
inert?: boolean;
|
|
788
|
+
popover?: 'auto' | 'manual';
|
|
789
|
+
autofocus?: boolean;
|
|
790
|
+
slot?: string;
|
|
791
|
+
accessKey?: string;
|
|
792
|
+
onClick?: (e: MouseEvent) => void;
|
|
793
|
+
onDblClick?: (e: MouseEvent) => void;
|
|
794
|
+
onMouseDown?: (e: MouseEvent) => void;
|
|
795
|
+
onMouseUp?: (e: MouseEvent) => void;
|
|
796
|
+
onMouseMove?: (e: MouseEvent) => void;
|
|
797
|
+
onMouseEnter?: (e: MouseEvent) => void;
|
|
798
|
+
onMouseLeave?: (e: MouseEvent) => void;
|
|
799
|
+
onMouseOver?: (e: MouseEvent) => void;
|
|
800
|
+
onMouseOut?: (e: MouseEvent) => void;
|
|
801
|
+
onContextMenu?: (e: MouseEvent) => void;
|
|
802
|
+
onInput?: (e: InputEvent) => void;
|
|
803
|
+
onChange?: (e: Event) => void;
|
|
804
|
+
onSubmit?: (e: SubmitEvent) => void;
|
|
805
|
+
onReset?: (e: Event) => void;
|
|
806
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
|
807
|
+
onKeyUp?: (e: KeyboardEvent) => void;
|
|
808
|
+
onKeyPress?: (e: KeyboardEvent) => void;
|
|
809
|
+
onFocus?: (e: FocusEvent) => void;
|
|
810
|
+
onBlur?: (e: FocusEvent) => void;
|
|
811
|
+
onScroll?: (e: Event) => void;
|
|
812
|
+
onWheel?: (e: WheelEvent) => void;
|
|
813
|
+
onLoad?: (e: Event) => void;
|
|
814
|
+
onError?: (e: Event) => void;
|
|
815
|
+
onDrag?: (e: DragEvent) => void;
|
|
816
|
+
onDragStart?: (e: DragEvent) => void;
|
|
817
|
+
onDragEnd?: (e: DragEvent) => void;
|
|
818
|
+
onDragEnter?: (e: DragEvent) => void;
|
|
819
|
+
onDragLeave?: (e: DragEvent) => void;
|
|
820
|
+
onDragOver?: (e: DragEvent) => void;
|
|
821
|
+
onDrop?: (e: DragEvent) => void;
|
|
822
|
+
onTouchStart?: (e: TouchEvent) => void;
|
|
823
|
+
onTouchMove?: (e: TouchEvent) => void;
|
|
824
|
+
onTouchEnd?: (e: TouchEvent) => void;
|
|
825
|
+
onTouchCancel?: (e: TouchEvent) => void;
|
|
826
|
+
onAnimationStart?: (e: AnimationEvent) => void;
|
|
827
|
+
onAnimationEnd?: (e: AnimationEvent) => void;
|
|
828
|
+
onAnimationIteration?: (e: AnimationEvent) => void;
|
|
829
|
+
onTransitionEnd?: (e: TransitionEvent) => void;
|
|
830
|
+
onPointerDown?: (e: PointerEvent) => void;
|
|
831
|
+
onPointerUp?: (e: PointerEvent) => void;
|
|
832
|
+
onPointerMove?: (e: PointerEvent) => void;
|
|
833
|
+
onPointerEnter?: (e: PointerEvent) => void;
|
|
834
|
+
onPointerLeave?: (e: PointerEvent) => void;
|
|
835
|
+
onPointerOver?: (e: PointerEvent) => void;
|
|
836
|
+
onPointerOut?: (e: PointerEvent) => void;
|
|
837
|
+
onPointerCancel?: (e: PointerEvent) => void;
|
|
838
|
+
ref?: ((el: T | null) => void) | {
|
|
839
|
+
current: T | null;
|
|
840
|
+
};
|
|
841
|
+
role?: string;
|
|
842
|
+
'aria-hidden'?: boolean | 'true' | 'false';
|
|
843
|
+
'aria-label'?: string;
|
|
844
|
+
'aria-labelledby'?: string;
|
|
845
|
+
'aria-describedby'?: string;
|
|
846
|
+
'aria-live'?: 'off' | 'polite' | 'assertive';
|
|
847
|
+
'aria-atomic'?: boolean | 'true' | 'false';
|
|
848
|
+
'aria-busy'?: boolean | 'true' | 'false';
|
|
849
|
+
'aria-current'?: boolean | 'true' | 'false' | 'page' | 'step' | 'location' | 'date' | 'time';
|
|
850
|
+
'aria-disabled'?: boolean | 'true' | 'false';
|
|
851
|
+
'aria-expanded'?: boolean | 'true' | 'false';
|
|
852
|
+
'aria-haspopup'?: boolean | 'true' | 'false' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
|
|
853
|
+
'aria-pressed'?: boolean | 'true' | 'false' | 'mixed';
|
|
854
|
+
'aria-selected'?: boolean | 'true' | 'false';
|
|
855
|
+
'aria-checked'?: boolean | 'true' | 'false' | 'mixed';
|
|
856
|
+
'aria-controls'?: string;
|
|
857
|
+
'aria-owns'?: string;
|
|
858
|
+
'aria-activedescendant'?: string;
|
|
859
|
+
'aria-valuemin'?: number;
|
|
860
|
+
'aria-valuemax'?: number;
|
|
861
|
+
'aria-valuenow'?: number;
|
|
862
|
+
'aria-valuetext'?: string;
|
|
863
|
+
'aria-orientation'?: 'horizontal' | 'vertical';
|
|
864
|
+
'aria-readonly'?: boolean | 'true' | 'false';
|
|
865
|
+
'aria-required'?: boolean | 'true' | 'false';
|
|
866
|
+
'aria-invalid'?: boolean | 'true' | 'false' | 'grammar' | 'spelling';
|
|
867
|
+
'aria-errormessage'?: string;
|
|
868
|
+
'aria-modal'?: boolean | 'true' | 'false';
|
|
869
|
+
'aria-placeholder'?: string;
|
|
870
|
+
'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other';
|
|
871
|
+
'aria-colcount'?: number;
|
|
872
|
+
'aria-colindex'?: number;
|
|
873
|
+
'aria-colspan'?: number;
|
|
874
|
+
'aria-rowcount'?: number;
|
|
875
|
+
'aria-rowindex'?: number;
|
|
876
|
+
'aria-rowspan'?: number;
|
|
877
|
+
'aria-setsize'?: number;
|
|
878
|
+
'aria-posinset'?: number;
|
|
879
|
+
'aria-level'?: number;
|
|
880
|
+
'aria-multiselectable'?: boolean | 'true' | 'false';
|
|
881
|
+
'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both';
|
|
882
|
+
'aria-details'?: string;
|
|
883
|
+
'aria-keyshortcuts'?: string;
|
|
884
|
+
'aria-roledescription'?: string;
|
|
885
|
+
[key: `data-${string}`]: string | number | boolean | undefined;
|
|
886
|
+
}
|
|
887
|
+
interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
888
|
+
href?: string;
|
|
889
|
+
target?: '_self' | '_blank' | '_parent' | '_top' | string;
|
|
890
|
+
rel?: string;
|
|
891
|
+
download?: boolean | string;
|
|
892
|
+
hreflang?: string;
|
|
893
|
+
type?: string;
|
|
894
|
+
referrerPolicy?: ReferrerPolicy;
|
|
895
|
+
ping?: string;
|
|
896
|
+
}
|
|
897
|
+
interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
898
|
+
type?: 'button' | 'submit' | 'reset';
|
|
899
|
+
disabled?: boolean;
|
|
571
900
|
name?: string;
|
|
572
901
|
value?: string;
|
|
573
902
|
form?: string;
|
|
@@ -809,454 +1138,156 @@ interface ObjectHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
|
809
1138
|
type?: string;
|
|
810
1139
|
name?: string;
|
|
811
1140
|
width?: number | string;
|
|
812
|
-
height?: number | string;
|
|
813
|
-
form?: string;
|
|
814
|
-
useMap?: string;
|
|
815
|
-
}
|
|
816
|
-
interface ParamHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
817
|
-
name?: string;
|
|
818
|
-
value?: string;
|
|
819
|
-
}
|
|
820
|
-
interface CanvasHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
821
|
-
width?: number | string;
|
|
822
|
-
height?: number | string;
|
|
823
|
-
}
|
|
824
|
-
interface MapHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
825
|
-
name?: string;
|
|
826
|
-
}
|
|
827
|
-
interface AreaHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
828
|
-
alt?: string;
|
|
829
|
-
coords?: string;
|
|
830
|
-
href?: string;
|
|
831
|
-
hreflang?: string;
|
|
832
|
-
download?: boolean | string;
|
|
833
|
-
rel?: string;
|
|
834
|
-
shape?: 'rect' | 'circle' | 'poly' | 'default';
|
|
835
|
-
target?: string;
|
|
836
|
-
referrerPolicy?: ReferrerPolicy;
|
|
837
|
-
ping?: string;
|
|
838
|
-
}
|
|
839
|
-
interface DetailsHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
840
|
-
open?: boolean;
|
|
841
|
-
onToggle?: (e: Event) => void;
|
|
842
|
-
}
|
|
843
|
-
interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
844
|
-
open?: boolean;
|
|
845
|
-
onClose?: (e: Event) => void;
|
|
846
|
-
onCancel?: (e: Event) => void;
|
|
847
|
-
}
|
|
848
|
-
interface BlockquoteHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
849
|
-
cite?: string;
|
|
850
|
-
}
|
|
851
|
-
interface QuoteHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
852
|
-
cite?: string;
|
|
853
|
-
}
|
|
854
|
-
interface TimeHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
855
|
-
dateTime?: string;
|
|
856
|
-
}
|
|
857
|
-
interface DataHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
858
|
-
value?: string;
|
|
859
|
-
}
|
|
860
|
-
interface MetaHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
861
|
-
name?: string;
|
|
862
|
-
content?: string;
|
|
863
|
-
httpEquiv?: string;
|
|
864
|
-
charSet?: string;
|
|
865
|
-
property?: string;
|
|
866
|
-
}
|
|
867
|
-
interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
868
|
-
href?: string;
|
|
869
|
-
rel?: string;
|
|
870
|
-
type?: string;
|
|
871
|
-
media?: string;
|
|
872
|
-
as?: string;
|
|
873
|
-
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
874
|
-
referrerPolicy?: ReferrerPolicy;
|
|
875
|
-
sizes?: string;
|
|
876
|
-
hreflang?: string;
|
|
877
|
-
integrity?: string;
|
|
878
|
-
fetchPriority?: 'auto' | 'high' | 'low';
|
|
879
|
-
disabled?: boolean;
|
|
1141
|
+
height?: number | string;
|
|
1142
|
+
form?: string;
|
|
1143
|
+
useMap?: string;
|
|
880
1144
|
}
|
|
881
|
-
interface
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
blocking?: string;
|
|
1145
|
+
interface ParamHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1146
|
+
name?: string;
|
|
1147
|
+
value?: string;
|
|
885
1148
|
}
|
|
886
|
-
interface
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
async?: boolean;
|
|
890
|
-
defer?: boolean;
|
|
891
|
-
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
892
|
-
integrity?: string;
|
|
893
|
-
noModule?: boolean;
|
|
894
|
-
nonce?: string;
|
|
895
|
-
referrerPolicy?: ReferrerPolicy;
|
|
896
|
-
fetchPriority?: 'auto' | 'high' | 'low';
|
|
897
|
-
blocking?: string;
|
|
1149
|
+
interface CanvasHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1150
|
+
width?: number | string;
|
|
1151
|
+
height?: number | string;
|
|
898
1152
|
}
|
|
899
|
-
interface
|
|
1153
|
+
interface MapHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
900
1154
|
name?: string;
|
|
901
|
-
onSlotchange?: (e: Event) => void;
|
|
902
1155
|
}
|
|
903
|
-
interface
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
xmlnsXlink?: string;
|
|
907
|
-
fill?: string;
|
|
908
|
-
stroke?: string;
|
|
909
|
-
strokeWidth?: string | number;
|
|
910
|
-
strokeLinecap?: 'butt' | 'round' | 'square';
|
|
911
|
-
strokeLinejoin?: 'miter' | 'round' | 'bevel';
|
|
912
|
-
strokeDasharray?: string;
|
|
913
|
-
strokeDashoffset?: string | number;
|
|
914
|
-
strokeOpacity?: string | number;
|
|
915
|
-
fillOpacity?: string | number;
|
|
916
|
-
opacity?: string | number;
|
|
917
|
-
transform?: string;
|
|
918
|
-
transformOrigin?: string;
|
|
919
|
-
clipPath?: string;
|
|
920
|
-
mask?: string;
|
|
921
|
-
filter?: string;
|
|
922
|
-
d?: string;
|
|
923
|
-
cx?: string | number;
|
|
924
|
-
cy?: string | number;
|
|
925
|
-
r?: string | number;
|
|
926
|
-
rx?: string | number;
|
|
927
|
-
ry?: string | number;
|
|
928
|
-
x?: string | number;
|
|
929
|
-
y?: string | number;
|
|
930
|
-
x1?: string | number;
|
|
931
|
-
y1?: string | number;
|
|
932
|
-
x2?: string | number;
|
|
933
|
-
y2?: string | number;
|
|
934
|
-
width?: string | number;
|
|
935
|
-
height?: string | number;
|
|
936
|
-
points?: string;
|
|
937
|
-
pathLength?: string | number;
|
|
938
|
-
textAnchor?: 'start' | 'middle' | 'end';
|
|
939
|
-
dominantBaseline?: string;
|
|
940
|
-
dx?: string | number;
|
|
941
|
-
dy?: string | number;
|
|
942
|
-
fontSize?: string | number;
|
|
943
|
-
fontFamily?: string;
|
|
944
|
-
fontWeight?: string | number;
|
|
1156
|
+
interface AreaHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1157
|
+
alt?: string;
|
|
1158
|
+
coords?: string;
|
|
945
1159
|
href?: string;
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
clipPathUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
|
|
954
|
-
maskUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
|
|
955
|
-
maskContentUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
|
|
956
|
-
preserveAspectRatio?: string;
|
|
957
|
-
markerStart?: string;
|
|
958
|
-
markerMid?: string;
|
|
959
|
-
markerEnd?: string;
|
|
960
|
-
vectorEffect?: string;
|
|
1160
|
+
hreflang?: string;
|
|
1161
|
+
download?: boolean | string;
|
|
1162
|
+
rel?: string;
|
|
1163
|
+
shape?: 'rect' | 'circle' | 'poly' | 'default';
|
|
1164
|
+
target?: string;
|
|
1165
|
+
referrerPolicy?: ReferrerPolicy;
|
|
1166
|
+
ping?: string;
|
|
961
1167
|
}
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
*
|
|
966
|
-
* This module provides the core mechanisms for reactive DOM updates.
|
|
967
|
-
* It bridges the gap between Fict's reactive system (signals, effects)
|
|
968
|
-
* and the DOM, enabling fine-grained updates without a virtual DOM.
|
|
969
|
-
*
|
|
970
|
-
* Design Philosophy:
|
|
971
|
-
* - Values wrapped in functions `() => T` are treated as reactive
|
|
972
|
-
* - Static values are applied once without tracking
|
|
973
|
-
* - The compiler transforms JSX expressions to use these primitives
|
|
974
|
-
*/
|
|
975
|
-
|
|
976
|
-
/** A reactive value that can be either static or a getter function */
|
|
977
|
-
type MaybeReactive<T> = T | (() => T);
|
|
978
|
-
/** Internal type for createElement function reference */
|
|
979
|
-
type CreateElementFn = (node: FictNode) => Node;
|
|
980
|
-
/** Handle returned by conditional/list bindings for cleanup */
|
|
981
|
-
interface BindingHandle {
|
|
982
|
-
/** Marker node(s) used for positioning */
|
|
983
|
-
marker: Comment | DocumentFragment;
|
|
984
|
-
/** Flush pending content - call after markers are inserted into DOM */
|
|
985
|
-
flush?: () => void;
|
|
986
|
-
/** Dispose function to clean up the binding */
|
|
987
|
-
dispose: Cleanup;
|
|
1168
|
+
interface DetailsHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1169
|
+
open?: boolean;
|
|
1170
|
+
onToggle?: (e: Event) => void;
|
|
988
1171
|
}
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
_$host?: HTMLElement;
|
|
1108
|
-
[key: `$$${string}`]: EventListener | [EventListener, unknown] | undefined;
|
|
1109
|
-
[key: `$$${string}Data`]: unknown;
|
|
1110
|
-
}
|
|
1111
|
-
interface Document extends Record<string, unknown> {
|
|
1112
|
-
}
|
|
1172
|
+
interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1173
|
+
open?: boolean;
|
|
1174
|
+
onClose?: (e: Event) => void;
|
|
1175
|
+
onCancel?: (e: Event) => void;
|
|
1176
|
+
}
|
|
1177
|
+
interface BlockquoteHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1178
|
+
cite?: string;
|
|
1179
|
+
}
|
|
1180
|
+
interface QuoteHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1181
|
+
cite?: string;
|
|
1182
|
+
}
|
|
1183
|
+
interface TimeHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1184
|
+
dateTime?: string;
|
|
1185
|
+
}
|
|
1186
|
+
interface DataHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1187
|
+
value?: string;
|
|
1188
|
+
}
|
|
1189
|
+
interface MetaHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1190
|
+
name?: string;
|
|
1191
|
+
content?: string;
|
|
1192
|
+
httpEquiv?: string;
|
|
1193
|
+
charSet?: string;
|
|
1194
|
+
property?: string;
|
|
1195
|
+
}
|
|
1196
|
+
interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1197
|
+
href?: string;
|
|
1198
|
+
rel?: string;
|
|
1199
|
+
type?: string;
|
|
1200
|
+
media?: string;
|
|
1201
|
+
as?: string;
|
|
1202
|
+
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
1203
|
+
referrerPolicy?: ReferrerPolicy;
|
|
1204
|
+
sizes?: string;
|
|
1205
|
+
hreflang?: string;
|
|
1206
|
+
integrity?: string;
|
|
1207
|
+
fetchPriority?: 'auto' | 'high' | 'low';
|
|
1208
|
+
disabled?: boolean;
|
|
1209
|
+
}
|
|
1210
|
+
interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1211
|
+
media?: string;
|
|
1212
|
+
nonce?: string;
|
|
1213
|
+
blocking?: string;
|
|
1214
|
+
}
|
|
1215
|
+
interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1216
|
+
src?: string;
|
|
1217
|
+
type?: string;
|
|
1218
|
+
async?: boolean;
|
|
1219
|
+
defer?: boolean;
|
|
1220
|
+
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
1221
|
+
integrity?: string;
|
|
1222
|
+
noModule?: boolean;
|
|
1223
|
+
nonce?: string;
|
|
1224
|
+
referrerPolicy?: ReferrerPolicy;
|
|
1225
|
+
fetchPriority?: 'auto' | 'high' | 'low';
|
|
1226
|
+
blocking?: string;
|
|
1227
|
+
}
|
|
1228
|
+
interface SlotHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1229
|
+
name?: string;
|
|
1230
|
+
onSlotchange?: (e: Event) => void;
|
|
1231
|
+
}
|
|
1232
|
+
interface SVGAttributes<T> extends HTMLAttributes<T> {
|
|
1233
|
+
viewBox?: string;
|
|
1234
|
+
xmlns?: string;
|
|
1235
|
+
xmlnsXlink?: string;
|
|
1236
|
+
fill?: string;
|
|
1237
|
+
stroke?: string;
|
|
1238
|
+
strokeWidth?: string | number;
|
|
1239
|
+
strokeLinecap?: 'butt' | 'round' | 'square';
|
|
1240
|
+
strokeLinejoin?: 'miter' | 'round' | 'bevel';
|
|
1241
|
+
strokeDasharray?: string;
|
|
1242
|
+
strokeDashoffset?: string | number;
|
|
1243
|
+
strokeOpacity?: string | number;
|
|
1244
|
+
fillOpacity?: string | number;
|
|
1245
|
+
opacity?: string | number;
|
|
1246
|
+
transform?: string;
|
|
1247
|
+
transformOrigin?: string;
|
|
1248
|
+
clipPath?: string;
|
|
1249
|
+
mask?: string;
|
|
1250
|
+
filter?: string;
|
|
1251
|
+
d?: string;
|
|
1252
|
+
cx?: string | number;
|
|
1253
|
+
cy?: string | number;
|
|
1254
|
+
r?: string | number;
|
|
1255
|
+
rx?: string | number;
|
|
1256
|
+
ry?: string | number;
|
|
1257
|
+
x?: string | number;
|
|
1258
|
+
y?: string | number;
|
|
1259
|
+
x1?: string | number;
|
|
1260
|
+
y1?: string | number;
|
|
1261
|
+
x2?: string | number;
|
|
1262
|
+
y2?: string | number;
|
|
1263
|
+
width?: string | number;
|
|
1264
|
+
height?: string | number;
|
|
1265
|
+
points?: string;
|
|
1266
|
+
pathLength?: string | number;
|
|
1267
|
+
textAnchor?: 'start' | 'middle' | 'end';
|
|
1268
|
+
dominantBaseline?: string;
|
|
1269
|
+
dx?: string | number;
|
|
1270
|
+
dy?: string | number;
|
|
1271
|
+
fontSize?: string | number;
|
|
1272
|
+
fontFamily?: string;
|
|
1273
|
+
fontWeight?: string | number;
|
|
1274
|
+
href?: string;
|
|
1275
|
+
xlinkHref?: string;
|
|
1276
|
+
gradientUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
|
|
1277
|
+
gradientTransform?: string;
|
|
1278
|
+
spreadMethod?: 'pad' | 'reflect' | 'repeat';
|
|
1279
|
+
offset?: string | number;
|
|
1280
|
+
stopColor?: string;
|
|
1281
|
+
stopOpacity?: string | number;
|
|
1282
|
+
clipPathUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
|
|
1283
|
+
maskUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
|
|
1284
|
+
maskContentUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
|
|
1285
|
+
preserveAspectRatio?: string;
|
|
1286
|
+
markerStart?: string;
|
|
1287
|
+
markerMid?: string;
|
|
1288
|
+
markerEnd?: string;
|
|
1289
|
+
vectorEffect?: string;
|
|
1113
1290
|
}
|
|
1114
|
-
/**
|
|
1115
|
-
* Initialize event delegation for a set of event names.
|
|
1116
|
-
* Events will be handled at the document level and dispatched to the appropriate handlers.
|
|
1117
|
-
*
|
|
1118
|
-
* @param eventNames - Array of event names to delegate
|
|
1119
|
-
* @param doc - The document to attach handlers to (default: window.document)
|
|
1120
|
-
*
|
|
1121
|
-
* @example
|
|
1122
|
-
* ```ts
|
|
1123
|
-
* // Called automatically by the compiler for delegated events
|
|
1124
|
-
* delegateEvents(['click', 'input', 'keydown'])
|
|
1125
|
-
* ```
|
|
1126
|
-
*/
|
|
1127
|
-
declare function delegateEvents(eventNames: string[], doc?: Document): void;
|
|
1128
|
-
/**
|
|
1129
|
-
* Clear all delegated event handlers from a document.
|
|
1130
|
-
*
|
|
1131
|
-
* @param doc - The document to clear handlers from (default: window.document)
|
|
1132
|
-
*/
|
|
1133
|
-
declare function clearDelegatedEvents(doc?: Document): void;
|
|
1134
|
-
/**
|
|
1135
|
-
* Add an event listener to an element.
|
|
1136
|
-
* If the event is in DelegatedEvents, it uses event delegation for better performance.
|
|
1137
|
-
*
|
|
1138
|
-
* @param node - The element to add the listener to
|
|
1139
|
-
* @param name - The event name (lowercase)
|
|
1140
|
-
* @param handler - The event handler or [handler, data] tuple
|
|
1141
|
-
* @param delegate - Whether to use delegation (auto-detected based on event name)
|
|
1142
|
-
*/
|
|
1143
|
-
declare function addEventListener(node: HTMLElement, name: string, handler: EventListener | [EventListener, unknown] | null | undefined, delegate?: boolean): void;
|
|
1144
|
-
/**
|
|
1145
|
-
* Bind an event listener to an element.
|
|
1146
|
-
* Uses event delegation for better performance when applicable.
|
|
1147
|
-
*
|
|
1148
|
-
* @example
|
|
1149
|
-
* ```ts
|
|
1150
|
-
* // Static event
|
|
1151
|
-
* bindEvent(button, 'click', handleClick)
|
|
1152
|
-
*
|
|
1153
|
-
* // Reactive event (compiler output)
|
|
1154
|
-
* bindEvent(button, 'click', () => $handler())
|
|
1155
|
-
*
|
|
1156
|
-
* // With modifiers
|
|
1157
|
-
* bindEvent(button, 'click', handler, { capture: true, passive: true, once: true })
|
|
1158
|
-
* ```
|
|
1159
|
-
*/
|
|
1160
|
-
declare function bindEvent(el: HTMLElement, eventName: string, handler: EventListenerOrEventListenerObject | null | undefined, options?: boolean | AddEventListenerOptions): Cleanup;
|
|
1161
|
-
/**
|
|
1162
|
-
* Bind a ref to an element.
|
|
1163
|
-
* Supports both callback refs and ref objects.
|
|
1164
|
-
*
|
|
1165
|
-
* @param el - The element to bind the ref to
|
|
1166
|
-
* @param ref - Either a callback function, a ref object, or a reactive getter
|
|
1167
|
-
* @returns Cleanup function
|
|
1168
|
-
*
|
|
1169
|
-
* @example
|
|
1170
|
-
* ```ts
|
|
1171
|
-
* // Callback ref
|
|
1172
|
-
* bindRef(el, (element) => { store.input = element })
|
|
1173
|
-
*
|
|
1174
|
-
* // Ref object
|
|
1175
|
-
* const inputRef = createRef()
|
|
1176
|
-
* bindRef(el, inputRef)
|
|
1177
|
-
*
|
|
1178
|
-
* // Reactive ref (compiler output)
|
|
1179
|
-
* bindRef(el, () => props.ref)
|
|
1180
|
-
* ```
|
|
1181
|
-
*/
|
|
1182
|
-
declare function bindRef(el: HTMLElement, ref: unknown): Cleanup;
|
|
1183
|
-
/**
|
|
1184
|
-
* Apply spread props to an element with reactive updates.
|
|
1185
|
-
* This handles dynamic spread like `<div {...props}>`.
|
|
1186
|
-
*
|
|
1187
|
-
* @param node - The element to apply props to
|
|
1188
|
-
* @param props - The props object (may have reactive getters)
|
|
1189
|
-
* @param isSVG - Whether this is an SVG element
|
|
1190
|
-
* @param skipChildren - Whether to skip children handling
|
|
1191
|
-
* @returns The previous props for tracking changes
|
|
1192
|
-
*
|
|
1193
|
-
* @example
|
|
1194
|
-
* ```ts
|
|
1195
|
-
* // Compiler output for <div {...props} />
|
|
1196
|
-
* spread(el, props, false, false)
|
|
1197
|
-
* ```
|
|
1198
|
-
*/
|
|
1199
|
-
declare function spread(node: HTMLElement, props?: Record<string, unknown>, isSVG?: boolean, skipChildren?: boolean): Record<string, unknown>;
|
|
1200
|
-
/**
|
|
1201
|
-
* Assign props to a node, tracking previous values for efficient updates.
|
|
1202
|
-
* This is the core prop assignment logic used by spread.
|
|
1203
|
-
*
|
|
1204
|
-
* @param node - The element to assign props to
|
|
1205
|
-
* @param props - New props object
|
|
1206
|
-
* @param isSVG - Whether this is an SVG element
|
|
1207
|
-
* @param skipChildren - Whether to skip children handling
|
|
1208
|
-
* @param prevProps - Previous props for comparison
|
|
1209
|
-
* @param skipRef - Whether to skip ref handling
|
|
1210
|
-
*/
|
|
1211
|
-
declare function assign(node: HTMLElement, props: Record<string, unknown>, isSVG?: boolean, skipChildren?: boolean, prevProps?: Record<string, unknown>, skipRef?: boolean): void;
|
|
1212
|
-
/**
|
|
1213
|
-
* Create a conditional rendering binding.
|
|
1214
|
-
* Efficiently renders one of two branches based on a condition.
|
|
1215
|
-
*
|
|
1216
|
-
* This is an optimized version for `{condition ? <A /> : <B />}` patterns
|
|
1217
|
-
* where both branches are known statically.
|
|
1218
|
-
*
|
|
1219
|
-
* @example
|
|
1220
|
-
* ```ts
|
|
1221
|
-
* // Compiler output for {show ? <A /> : <B />}
|
|
1222
|
-
* createConditional(
|
|
1223
|
-
* () => $show(),
|
|
1224
|
-
* () => jsx(A, {}),
|
|
1225
|
-
* () => jsx(B, {}),
|
|
1226
|
-
* createElement
|
|
1227
|
-
* )
|
|
1228
|
-
* ```
|
|
1229
|
-
*/
|
|
1230
|
-
declare function createConditional(condition: () => boolean, renderTrue: () => FictNode, createElementFn: CreateElementFn, renderFalse?: () => FictNode): BindingHandle;
|
|
1231
|
-
/** Key extractor function type */
|
|
1232
|
-
type KeyFn<T> = (item: T, index: number) => string | number;
|
|
1233
|
-
/**
|
|
1234
|
-
* Create a reactive list rendering binding with optional keying.
|
|
1235
|
-
*/
|
|
1236
|
-
declare function createList<T>(items: () => T[], renderItem: (item: T, index: number) => FictNode, createElementFn: CreateElementFn, getKey?: KeyFn<T>): BindingHandle;
|
|
1237
|
-
/**
|
|
1238
|
-
* Create a show/hide binding that uses CSS display instead of DOM manipulation.
|
|
1239
|
-
* More efficient than conditional when the content is expensive to create.
|
|
1240
|
-
*
|
|
1241
|
-
* @example
|
|
1242
|
-
* ```ts
|
|
1243
|
-
* createShow(container, () => $visible())
|
|
1244
|
-
* ```
|
|
1245
|
-
*/
|
|
1246
|
-
declare function createShow(el: HTMLElement, condition: () => boolean, displayValue?: string): void;
|
|
1247
|
-
/**
|
|
1248
|
-
* Create a portal that renders content into a different DOM container.
|
|
1249
|
-
*
|
|
1250
|
-
* @example
|
|
1251
|
-
* ```ts
|
|
1252
|
-
* createPortal(
|
|
1253
|
-
* document.body,
|
|
1254
|
-
* () => jsx(Modal, { children: 'Hello' }),
|
|
1255
|
-
* createElement
|
|
1256
|
-
* )
|
|
1257
|
-
* ```
|
|
1258
|
-
*/
|
|
1259
|
-
declare function createPortal(container: HTMLElement, render: () => FictNode, createElementFn: CreateElementFn): BindingHandle;
|
|
1260
1291
|
|
|
1261
1292
|
/**
|
|
1262
1293
|
* Fict DOM Rendering System
|
|
@@ -1569,4 +1600,4 @@ declare function isNodeBetweenMarkers(node: Node, startMarker: Comment, endMarke
|
|
|
1569
1600
|
*/
|
|
1570
1601
|
declare function createKeyedList<T>(getItems: () => T[], keyFn: (item: T, index: number) => string | number, renderItem: FineGrainedRenderItem<T>, needsIndex?: boolean): KeyedListBinding;
|
|
1571
1602
|
|
|
1572
|
-
export { $effect, $memo, $state, Aliases, type AttributeSetter, type BaseProps, type BindingHandle, BooleanAttributes, ChildProperties, type ClassProp, type Cleanup, type Component, type CreateElementFn, type DOMElement, DelegatedEvents, type Effect, ErrorBoundary, type ErrorInfo, type EventHandler, type FictDevtoolsHook, type FictNode, type FictVNode, Fragment, JSX, type KeyFn, type KeyedBlock, type KeyedListBinding, type KeyedListContainer, type MarkerBlock, type MaybeReactive, type Memo, Properties, type PropsWithChildren, type Ref, type RefCallback, type RefObject, SVGElements, SVGNamespace, type SignalAccessor as Signal, type Store, type StyleProp, Suspense, type SuspenseToken, UnitlessStyles, type VersionedSignal, type VersionedSignalOptions, __fictPopContext, __fictProp, __fictPropsRest, __fictPushContext, __fictRender, __fictResetContext, __fictUseContext, __fictUseEffect, __fictUseMemo, __fictUseSignal, addEventListener, assign, batch, bindAttribute, bindClass, bindEvent, bindProperty, bindRef, bindStyle, bindText, classList, clearDelegatedEvents, createAttributeBinding, createChildBinding, createClassBinding, createConditional, createEffect, createElement, createKeyedBlock, createKeyedList, createKeyedListContainer, createList, createMemo, createPortal, createPropsProxy, createRef, createRenderEffect, createRoot, createSelector, createShow, signal as createSignal, createStore, createStyleBinding, createSuspenseToken, createTextBinding, createVersionedSignal, delegateEvents, destroyMarkerBlock, getDevtoolsHook, getFirstNodeAfter, getPropAlias, insert, insertNodesBefore, isNodeBetweenMarkers, isReactive, mergeProps, moveMarkerBlock, moveNodesBefore, onCleanup, onDestroy, onMount, __fictProp as prop, reconcileArrays, removeNodes, render, setCycleProtectionOptions, spread, startTransition, template, toNodeArray, untrack, unwrap, unwrapPrimitive, useDeferredValue, useProp, useTransition };
|
|
1603
|
+
export { $effect, $memo, $state, Aliases, type AttributeSetter, type BaseProps, type BindingHandle, BooleanAttributes, ChildProperties, type ClassProp, type Cleanup, type Component, type CreateElementFn, type DOMElement, DelegatedEvents, type Effect, ErrorBoundary, type ErrorInfo, type EventHandler, type FictDevtoolsHook, type FictNode, type FictVNode, Fragment, JSX, type KeyFn, type KeyedBlock, type KeyedListBinding, type KeyedListContainer, type MarkerBlock, type MaybeReactive, type Memo, Properties, type PropsWithChildren, type ReactiveScope, type Ref, type RefCallback, type RefObject, SVGElements, SVGNamespace, type SignalAccessor as Signal, type Store, type StyleProp, Suspense, type SuspenseToken, UnitlessStyles, type VersionedSignal, type VersionedSignalOptions, __fictPopContext, __fictProp, __fictPropsRest, __fictPushContext, __fictRender, __fictResetContext, __fictUseContext, __fictUseEffect, __fictUseMemo, __fictUseSignal, addEventListener, assign, batch, bindAttribute, bindClass, bindEvent, bindProperty, bindRef, bindStyle, bindText, callEventHandler, classList, clearDelegatedEvents, createAttributeBinding, createChildBinding, createClassBinding, createConditional, createEffect, createElement, createKeyedBlock, createKeyedList, createKeyedListContainer, createList, createMemo, createPortal, createPropsProxy, createRef, createRenderEffect, createRoot, createScope, createSelector, createShow, signal as createSignal, createStore, createStyleBinding, createSuspenseToken, createTextBinding, createVersionedSignal, delegateEvents, destroyMarkerBlock, effectScope, getDevtoolsHook, getFirstNodeAfter, getPropAlias, insert, insertNodesBefore, isNodeBetweenMarkers, isReactive, mergeProps, moveMarkerBlock, moveNodesBefore, onCleanup, onDestroy, onMount, __fictProp as prop, reconcileArrays, removeNodes, render, runInScope, setCycleProtectionOptions, spread, startTransition, template, toNodeArray, untrack, unwrap, unwrapPrimitive, useDeferredValue, useProp, useTransition };
|