@fictjs/runtime 0.0.12 → 0.0.14

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.
Files changed (65) hide show
  1. package/dist/advanced.cjs +79 -0
  2. package/dist/advanced.cjs.map +1 -0
  3. package/dist/advanced.d.cts +50 -0
  4. package/dist/advanced.d.ts +50 -0
  5. package/dist/advanced.js +79 -0
  6. package/dist/advanced.js.map +1 -0
  7. package/dist/chunk-624QY53A.cjs +45 -0
  8. package/dist/chunk-624QY53A.cjs.map +1 -0
  9. package/dist/chunk-F3AIYQB7.js +45 -0
  10. package/dist/chunk-F3AIYQB7.js.map +1 -0
  11. package/dist/chunk-GJTYOFMO.cjs +109 -0
  12. package/dist/chunk-GJTYOFMO.cjs.map +1 -0
  13. package/dist/chunk-IUZXKAAY.js +109 -0
  14. package/dist/chunk-IUZXKAAY.js.map +1 -0
  15. package/dist/{slim.cjs → chunk-PMF6MWEV.cjs} +2557 -3110
  16. package/dist/chunk-PMF6MWEV.cjs.map +1 -0
  17. package/dist/{slim.js → chunk-RY4WDS6R.js} +2596 -3097
  18. package/dist/chunk-RY4WDS6R.js.map +1 -0
  19. package/dist/context-B7UYnfzM.d.ts +153 -0
  20. package/dist/context-UXySaqI_.d.cts +153 -0
  21. package/dist/effect-Auji1rz9.d.cts +350 -0
  22. package/dist/effect-Auji1rz9.d.ts +350 -0
  23. package/dist/index.cjs +108 -4441
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +5 -1492
  26. package/dist/index.d.ts +5 -1492
  27. package/dist/index.dev.js +1020 -2788
  28. package/dist/index.dev.js.map +1 -1
  29. package/dist/index.js +63 -4301
  30. package/dist/index.js.map +1 -1
  31. package/dist/internal.cjs +901 -0
  32. package/dist/internal.cjs.map +1 -0
  33. package/dist/internal.d.cts +158 -0
  34. package/dist/internal.d.ts +158 -0
  35. package/dist/internal.js +901 -0
  36. package/dist/internal.js.map +1 -0
  37. package/dist/{jsx-dev-runtime.d.ts → props-CrOMYbLv.d.cts} +107 -18
  38. package/dist/{jsx-dev-runtime.d.cts → props-ES0Ag_Wd.d.ts} +107 -18
  39. package/dist/scope-DKYzWfTn.d.cts +55 -0
  40. package/dist/scope-S6eAzBJZ.d.ts +55 -0
  41. package/package.json +10 -5
  42. package/src/advanced.ts +101 -0
  43. package/src/binding.ts +25 -422
  44. package/src/constants.ts +345 -344
  45. package/src/context.ts +300 -0
  46. package/src/cycle-guard.ts +124 -97
  47. package/src/delegated-events.ts +24 -0
  48. package/src/dom.ts +19 -25
  49. package/src/effect.ts +4 -0
  50. package/src/hooks.ts +9 -1
  51. package/src/index.ts +41 -130
  52. package/src/internal.ts +130 -0
  53. package/src/lifecycle.ts +13 -2
  54. package/src/list-helpers.ts +6 -65
  55. package/src/props.ts +48 -46
  56. package/src/signal.ts +59 -39
  57. package/src/store.ts +47 -7
  58. package/src/versioned-signal.ts +3 -3
  59. package/dist/jsx-runtime.d.cts +0 -671
  60. package/dist/jsx-runtime.d.ts +0 -671
  61. package/dist/slim.cjs.map +0 -1
  62. package/dist/slim.d.cts +0 -504
  63. package/dist/slim.d.ts +0 -504
  64. package/dist/slim.js.map +0 -1
  65. package/src/slim.ts +0 -69
package/dist/index.d.ts CHANGED
@@ -1,537 +1,7 @@
1
- /**
2
- * Signal accessor - function to get/set signal value
3
- */
4
- interface SignalAccessor<T> {
5
- (): T;
6
- (value: T): void;
7
- }
8
- /**
9
- * Computed accessor - function to get computed value
10
- */
11
- type ComputedAccessor<T> = () => T;
12
- /**
13
- * Effect scope disposer - function to dispose an effect scope
14
- */
15
- type EffectScopeDisposer = () => void;
16
- /**
17
- * Create a reactive signal
18
- * @param initialValue - The initial value
19
- * @returns A signal accessor function
20
- */
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;
28
- declare const $state: <T>(value: T) => T;
29
- /**
30
- * Create a selector signal that efficiently updates only when the selected key matches.
31
- * Useful for large lists where only one item is selected.
32
- *
33
- * @param source - The source signal returning the current key
34
- * @param equalityFn - Optional equality function
35
- * @returns A selector function that takes a key and returns a boolean signal accessor
36
- */
37
- declare function createSelector<T>(source: () => T, equalityFn?: (a: T, b: T) => boolean): (key: T) => boolean;
38
-
39
- type Store<T> = T;
40
- /**
41
- * Create a Store: a reactive proxy that allows fine-grained access and mutation.
42
- *
43
- * @param initialValue - The initial state object
44
- * @returns [store, setStore]
45
- */
46
- declare function createStore<T extends object>(initialValue: T): [Store<T>, (fn: (state: T) => void | T) => void];
47
-
48
- type Memo<T> = () => T;
49
- declare function createMemo<T>(fn: () => T): Memo<T>;
50
- declare const $memo: typeof createMemo;
51
-
52
- /** Any DOM node that can be rendered */
53
- type DOMElement = Node;
54
- /** Cleanup function type */
55
- type Cleanup = () => void;
56
- /** Fict Virtual Node - represents a component or element in the virtual tree */
57
- interface FictVNode {
58
- /** Element type: tag name, Fragment symbol, or component function */
59
- type: string | symbol | ((props: Record<string, unknown>) => FictNode);
60
- /** Props passed to the element/component */
61
- props: Record<string, unknown> | null;
62
- /** Optional key for list rendering optimization */
63
- key?: string | undefined;
64
- }
65
- /**
66
- * Fict Node - represents any renderable value
67
- * This type covers all possible values that can appear in JSX
68
- */
69
- type FictNode = FictVNode | FictNode[] | Node | string | number | boolean | null | undefined;
70
- /** Props that all components receive */
71
- interface BaseProps {
72
- /** Optional key for list rendering */
73
- key?: string | number;
74
- /** Optional children */
75
- children?: FictNode | FictNode[];
76
- }
77
- /** A Fict component function */
78
- type Component<P extends Record<string, unknown> = Record<string, unknown>> = (props: P & BaseProps) => FictNode;
79
- /** Props with children */
80
- type PropsWithChildren<P = unknown> = P & {
81
- children?: FictNode | FictNode[];
82
- };
83
- interface ErrorInfo {
84
- source: 'render' | 'effect' | 'event' | 'renderChild' | 'cleanup';
85
- componentName?: string;
86
- eventName?: string;
87
- }
88
- /** Event handler type for type-safe event handling */
89
- type EventHandler<E extends Event = Event> = (event: E) => void;
90
- /** Ref callback type */
91
- type RefCallback<T extends Element = HTMLElement> = (element: T) => void;
92
- /** Ref object type (for future use with createRef) */
93
- interface RefObject<T extends Element = HTMLElement> {
94
- current: T | null;
95
- }
96
- /** Ref type that can be either callback or object */
97
- type Ref<T extends Element = HTMLElement> = RefCallback<T> | RefObject<T>;
98
- /** CSS style value - can be string or number (number becomes px) */
99
- type StyleValue = string | number;
100
- /** CSS style object */
101
- type CSSStyleObject = {
102
- [K in keyof CSSStyleDeclaration]?: StyleValue;
103
- } & Record<string, StyleValue>;
104
- /** Style prop type - can be string or object */
105
- type StyleProp = string | CSSStyleObject | null | undefined;
106
- /** Class object for conditional classes */
107
- type ClassObject = Record<string, boolean | undefined | null>;
108
- /** Class prop type - can be string or object */
109
- type ClassProp = string | ClassObject | null | undefined;
110
- interface SuspenseToken {
111
- then: Promise<unknown>['then'];
112
- }
113
-
114
- type Effect = () => void | Cleanup;
115
- declare function createEffect(fn: Effect): () => void;
116
- declare const $effect: typeof createEffect;
117
- declare function createRenderEffect(fn: Effect): () => void;
118
-
119
- /**
120
- * Fict Reactive DOM Binding System
121
- *
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
130
- */
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
- }
145
- /**
146
- * Check if a value is reactive (a getter function)
147
- * Note: Event handlers (functions that take arguments) are NOT reactive values
148
- */
149
- declare function isReactive(value: unknown): value is () => unknown;
150
- /**
151
- * Unwrap a potentially reactive value to get the actual value
152
- */
153
- declare function unwrap<T>(value: MaybeReactive<T>): T;
154
- /**
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.
158
- */
159
- declare function callEventHandler(handler: EventListenerOrEventListenerObject | null | undefined, event: Event, node?: EventTarget | null, data?: unknown): void;
160
- /**
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).
164
- *
165
- * @param value - A potentially proxied primitive value
166
- * @returns The raw primitive value
167
- *
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
- * )
179
- * ```
180
- */
181
- declare function unwrapPrimitive<T>(value: T): T;
182
- /**
183
- * Create a text node that reactively updates when the value changes.
184
- *
185
- * @example
186
- * ```ts
187
- * // Static text
188
- * createTextBinding("Hello")
189
- *
190
- * // Reactive text (compiler output)
191
- * createTextBinding(() => $count())
192
- * ```
193
- */
194
- declare function createTextBinding(value: MaybeReactive<unknown>): Text;
195
- /**
196
- * Bind a reactive value to an existing text node.
197
- * This is a convenience function for binding to existing DOM nodes.
198
- */
199
- declare function bindText(textNode: Text, getValue: () => unknown): Cleanup;
200
- /** Attribute setter function type */
201
- type AttributeSetter = (el: Element, key: string, value: unknown) => void;
202
- /**
203
- * Create a reactive attribute binding on an element.
204
- *
205
- * @example
206
- * ```ts
207
- * // Static attribute
208
- * createAttributeBinding(button, 'disabled', false, setAttribute)
209
- *
210
- * // Reactive attribute (compiler output)
211
- * createAttributeBinding(button, 'disabled', () => !$isValid(), setAttribute)
212
- * ```
213
- */
214
- declare function createAttributeBinding(el: Element, key: string, value: MaybeReactive<unknown>, setter: AttributeSetter): void;
215
- /**
216
- * Bind a reactive value to an element's attribute.
217
- */
218
- declare function bindAttribute(el: Element, key: string, getValue: () => unknown): Cleanup;
219
- /**
220
- * Bind a reactive value to an element's property.
221
- */
222
- declare function bindProperty(el: Element, key: string, getValue: () => unknown): Cleanup;
223
- /**
224
- * Apply styles to an element, supporting reactive style objects/strings.
225
- */
226
- declare function createStyleBinding(el: Element, 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: Element, 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: Element, 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: Element, 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: Element, 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.
246
- *
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: ParentNode & Node, 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(...)}`.
256
- *
257
- * @example
258
- * ```ts
259
- * // Reactive child (compiler output for {count})
260
- * createChildBinding(parent, () => $count(), createElement)
261
- *
262
- * // Reactive conditional (compiler output for {show && <Modal />})
263
- * createChildBinding(parent, () => $show() && jsx(Modal, {}), createElement)
264
- * ```
265
- */
266
- declare function createChildBinding(parent: ParentNode & Node, getValue: () => FictNode, createElementFn: CreateElementFn): BindingHandle;
267
- declare global {
268
- interface Element {
269
- _$host?: Element;
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.
279
- *
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'])
287
- * ```
288
- */
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: Element, 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: Element, 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: Element, 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: Element, 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: Element, 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
- * The render callback receives signal accessors for the item and index.
398
- */
399
- declare function createList<T>(items: () => T[], renderItem: (item: SignalAccessor<T>, index: SignalAccessor<number>) => FictNode, createElementFn: CreateElementFn, getKey?: KeyFn<T>): BindingHandle;
400
- /**
401
- * Create a show/hide binding that uses CSS display instead of DOM manipulation.
402
- * More efficient than conditional when the content is expensive to create.
403
- *
404
- * @example
405
- * ```ts
406
- * createShow(container, () => $visible())
407
- * ```
408
- */
409
- declare function createShow(el: Element & {
410
- style: CSSStyleDeclaration;
411
- }, condition: () => boolean, displayValue?: string): void;
412
- /**
413
- * Create a portal that renders content into a different DOM container.
414
- *
415
- * @example
416
- * ```ts
417
- * createPortal(
418
- * document.body,
419
- * () => jsx(Modal, { children: 'Hello' }),
420
- * createElement
421
- * )
422
- * ```
423
- */
424
- declare function createPortal(container: ParentNode & Node, render: () => FictNode, createElementFn: CreateElementFn): BindingHandle;
425
-
426
- interface ReactiveScope {
427
- run<T>(fn: () => T): T;
428
- stop(): void;
429
- }
430
- /**
431
- * Create an explicit reactive scope that can contain effects/memos and be stopped manually.
432
- * The scope registers with the current root for cleanup.
433
- */
434
- declare function createScope(): ReactiveScope;
435
- /**
436
- * Run a block of reactive code inside a managed scope that follows a boolean flag.
437
- * When the flag turns false, the scope is disposed and all contained effects/memos are cleaned up.
438
- */
439
- declare function runInScope(flag: MaybeReactive<boolean>, fn: () => void): void;
440
-
441
- interface HookContext {
442
- slots: unknown[];
443
- cursor: number;
444
- rendering?: boolean;
445
- }
446
- declare function __fictUseContext(): HookContext;
447
- declare function __fictPushContext(): HookContext;
448
- declare function __fictPopContext(): void;
449
- declare function __fictResetContext(): void;
450
- declare function __fictUseSignal<T>(ctx: HookContext, initial: T, slot?: number): SignalAccessor<T>;
451
- declare function __fictUseMemo<T>(ctx: HookContext, fn: () => T, slot?: number): ComputedAccessor<T>;
452
- declare function __fictUseEffect(ctx: HookContext, fn: () => void, slot?: number): void;
453
- declare function __fictRender<T>(ctx: HookContext, fn: () => T): T;
454
-
455
- interface VersionedSignalOptions<T> {
456
- equals?: (prev: T, next: T) => boolean;
457
- }
458
- interface VersionedSignal<T> {
459
- /** Reactive read that tracks both the value and version counter */
460
- read: () => T;
461
- /** Write a new value, forcing a version bump when value is equal */
462
- write: (next: T) => void;
463
- /** Force a version bump without changing the value */
464
- force: () => void;
465
- /** Read the current version without creating a dependency */
466
- peekVersion: () => number;
467
- /** Read the current value without tracking */
468
- peekValue: () => T;
469
- }
470
- /**
471
- * Create a signal wrapper that forces subscribers to update when the same reference is written.
472
- *
473
- * Useful for compiler-generated keyed list items where updates may reuse the same object reference.
474
- */
475
- declare function createVersionedSignal<T>(initialValue: T, options?: VersionedSignalOptions<T>): VersionedSignal<T>;
476
-
477
- /**
478
- * @internal
479
- * Marks a zero-arg getter so props proxy can lazily evaluate it.
480
- * Users normally never call this directly; the compiler injects it.
481
- */
482
- declare function __fictProp<T>(getter: () => T): () => T;
483
- declare function createPropsProxy<T extends Record<string, unknown>>(props: T): T;
484
- /**
485
- * Create a rest-like props object while preserving prop getters.
486
- * Excludes the specified keys from the returned object.
487
- */
488
- declare function __fictPropsRest<T extends Record<string, unknown>>(props: T, exclude: (string | number | symbol)[]): Record<string, unknown>;
489
- /**
490
- * Merge multiple props-like objects while preserving lazy getters.
491
- * Later sources override earlier ones.
492
- *
493
- * Uses lazy lookup strategy - properties are only accessed when read,
494
- * avoiding upfront iteration of all keys.
495
- */
496
- type MergeSource<T extends Record<string, unknown>> = T | (() => T);
497
- declare function mergeProps<T extends Record<string, unknown>>(...sources: (MergeSource<T> | null | undefined)[]): Record<string, unknown>;
498
- type PropGetter<T> = (() => T) & {
499
- __fictProp: true;
500
- };
501
- /**
502
- * Memoize a prop getter to cache expensive computations.
503
- * Use when prop expressions involve heavy calculations.
504
- *
505
- * @example
506
- * ```tsx
507
- * // Without useProp - recomputes on every access
508
- * <Child data={expensiveComputation(list, filter)} />
509
- *
510
- * // With useProp - cached until dependencies change, auto-unwrapped by props proxy
511
- * const memoizedData = useProp(() => expensiveComputation(list, filter))
512
- * <Child data={memoizedData} />
513
- * ```
514
- */
515
- declare function useProp<T>(getter: () => T): PropGetter<T>;
516
-
517
- type LifecycleFn = () => void | Cleanup;
518
- interface RootContext {
519
- parent?: RootContext | undefined;
520
- onMountCallbacks?: LifecycleFn[];
521
- cleanups: Cleanup[];
522
- destroyCallbacks: Cleanup[];
523
- errorHandlers?: ErrorHandler[];
524
- suspenseHandlers?: SuspenseHandler[];
525
- }
526
- type ErrorHandler = (err: unknown, info?: ErrorInfo) => boolean | void;
527
- type SuspenseHandler = (token: SuspenseToken | PromiseLike<unknown>) => boolean | void;
528
- declare function onMount(fn: LifecycleFn): void;
529
- declare function onDestroy(fn: LifecycleFn): void;
530
- declare function onCleanup(fn: Cleanup): void;
531
- declare function createRoot<T>(fn: () => T): {
532
- dispose: () => void;
533
- value: T;
534
- };
1
+ export { F as Fragment, J as JSX, M as Memo, e as createElement, c as createMemo, d as createRoot, m as mergeProps, b as onCleanup, a as onDestroy, o as onMount, p as prop, r as render } from './props-ES0Ag_Wd.js';
2
+ import { R as RefObject, B as BaseProps, F as FictNode, S as SuspenseToken } from './effect-Auji1rz9.js';
3
+ export { p as ClassProp, C as Cleanup, l as Component, D as DOMElement, E as Effect, r as ErrorInfo, q as EventHandler, k as FictVNode, P as PropsWithChildren, m as Ref, n as RefCallback, o as StyleProp, h as createEffect, j as createPortal } from './effect-Auji1rz9.js';
4
+ export { C as Context, P as ProviderProps, c as createContext, h as hasContext, u as useContext } from './context-B7UYnfzM.js';
535
5
 
536
6
  /**
537
7
  * Create a ref object for DOM element references.
@@ -630,722 +100,6 @@ declare function useDeferredValue<T>(getValue: () => T): () => T;
630
100
  declare function batch<T>(fn: () => T): T;
631
101
  declare function untrack<T>(fn: () => T): T;
632
102
 
633
- interface CycleProtectionOptions {
634
- maxFlushCyclesPerMicrotask?: number;
635
- maxEffectRunsPerFlush?: number;
636
- windowSize?: number;
637
- highUsageRatio?: number;
638
- maxRootReentrantDepth?: number;
639
- enableWindowWarning?: boolean;
640
- devMode?: boolean;
641
- }
642
- declare function setCycleProtectionOptions(opts: CycleProtectionOptions): void;
643
-
644
- declare const Fragment: unique symbol;
645
- declare namespace JSX {
646
- type Element = FictNode;
647
- interface IntrinsicElements {
648
- html: HTMLAttributes<HTMLHtmlElement>;
649
- head: HTMLAttributes<HTMLHeadElement>;
650
- body: HTMLAttributes<HTMLBodyElement>;
651
- title: HTMLAttributes<HTMLTitleElement>;
652
- meta: MetaHTMLAttributes<HTMLMetaElement>;
653
- link: LinkHTMLAttributes<HTMLLinkElement>;
654
- style: StyleHTMLAttributes<HTMLStyleElement>;
655
- script: ScriptHTMLAttributes<HTMLScriptElement>;
656
- noscript: HTMLAttributes<HTMLElement>;
657
- div: HTMLAttributes<HTMLDivElement>;
658
- span: HTMLAttributes<HTMLSpanElement>;
659
- main: HTMLAttributes<HTMLElement>;
660
- header: HTMLAttributes<HTMLElement>;
661
- footer: HTMLAttributes<HTMLElement>;
662
- section: HTMLAttributes<HTMLElement>;
663
- article: HTMLAttributes<HTMLElement>;
664
- aside: HTMLAttributes<HTMLElement>;
665
- nav: HTMLAttributes<HTMLElement>;
666
- address: HTMLAttributes<HTMLElement>;
667
- h1: HTMLAttributes<HTMLHeadingElement>;
668
- h2: HTMLAttributes<HTMLHeadingElement>;
669
- h3: HTMLAttributes<HTMLHeadingElement>;
670
- h4: HTMLAttributes<HTMLHeadingElement>;
671
- h5: HTMLAttributes<HTMLHeadingElement>;
672
- h6: HTMLAttributes<HTMLHeadingElement>;
673
- hgroup: HTMLAttributes<HTMLElement>;
674
- p: HTMLAttributes<HTMLParagraphElement>;
675
- blockquote: BlockquoteHTMLAttributes<HTMLQuoteElement>;
676
- pre: HTMLAttributes<HTMLPreElement>;
677
- figure: HTMLAttributes<HTMLElement>;
678
- figcaption: HTMLAttributes<HTMLElement>;
679
- hr: HTMLAttributes<HTMLHRElement>;
680
- br: HTMLAttributes<HTMLBRElement>;
681
- wbr: HTMLAttributes<HTMLElement>;
682
- a: AnchorHTMLAttributes<HTMLAnchorElement>;
683
- abbr: HTMLAttributes<HTMLElement>;
684
- b: HTMLAttributes<HTMLElement>;
685
- bdi: HTMLAttributes<HTMLElement>;
686
- bdo: HTMLAttributes<HTMLElement>;
687
- cite: HTMLAttributes<HTMLElement>;
688
- code: HTMLAttributes<HTMLElement>;
689
- data: DataHTMLAttributes<HTMLDataElement>;
690
- dfn: HTMLAttributes<HTMLElement>;
691
- em: HTMLAttributes<HTMLElement>;
692
- i: HTMLAttributes<HTMLElement>;
693
- kbd: HTMLAttributes<HTMLElement>;
694
- mark: HTMLAttributes<HTMLElement>;
695
- q: QuoteHTMLAttributes<HTMLQuoteElement>;
696
- rp: HTMLAttributes<HTMLElement>;
697
- rt: HTMLAttributes<HTMLElement>;
698
- ruby: HTMLAttributes<HTMLElement>;
699
- s: HTMLAttributes<HTMLElement>;
700
- samp: HTMLAttributes<HTMLElement>;
701
- small: HTMLAttributes<HTMLElement>;
702
- strong: HTMLAttributes<HTMLElement>;
703
- sub: HTMLAttributes<HTMLElement>;
704
- sup: HTMLAttributes<HTMLElement>;
705
- time: TimeHTMLAttributes<HTMLTimeElement>;
706
- u: HTMLAttributes<HTMLElement>;
707
- var: HTMLAttributes<HTMLElement>;
708
- ul: HTMLAttributes<HTMLUListElement>;
709
- ol: OlHTMLAttributes<HTMLOListElement>;
710
- li: LiHTMLAttributes<HTMLLIElement>;
711
- dl: HTMLAttributes<HTMLDListElement>;
712
- dt: HTMLAttributes<HTMLElement>;
713
- dd: HTMLAttributes<HTMLElement>;
714
- menu: HTMLAttributes<HTMLMenuElement>;
715
- table: TableHTMLAttributes<HTMLTableElement>;
716
- caption: HTMLAttributes<HTMLTableCaptionElement>;
717
- colgroup: ColgroupHTMLAttributes<HTMLTableColElement>;
718
- col: ColHTMLAttributes<HTMLTableColElement>;
719
- thead: HTMLAttributes<HTMLTableSectionElement>;
720
- tbody: HTMLAttributes<HTMLTableSectionElement>;
721
- tfoot: HTMLAttributes<HTMLTableSectionElement>;
722
- tr: HTMLAttributes<HTMLTableRowElement>;
723
- th: ThHTMLAttributes<HTMLTableCellElement>;
724
- td: TdHTMLAttributes<HTMLTableCellElement>;
725
- form: FormHTMLAttributes<HTMLFormElement>;
726
- fieldset: FieldsetHTMLAttributes<HTMLFieldSetElement>;
727
- legend: HTMLAttributes<HTMLLegendElement>;
728
- label: LabelHTMLAttributes<HTMLLabelElement>;
729
- input: InputHTMLAttributes<HTMLInputElement>;
730
- button: ButtonHTMLAttributes<HTMLButtonElement>;
731
- select: SelectHTMLAttributes<HTMLSelectElement>;
732
- datalist: HTMLAttributes<HTMLDataListElement>;
733
- optgroup: OptgroupHTMLAttributes<HTMLOptGroupElement>;
734
- option: OptionHTMLAttributes<HTMLOptionElement>;
735
- textarea: TextareaHTMLAttributes<HTMLTextAreaElement>;
736
- output: OutputHTMLAttributes<HTMLOutputElement>;
737
- progress: ProgressHTMLAttributes<HTMLProgressElement>;
738
- meter: MeterHTMLAttributes<HTMLMeterElement>;
739
- details: DetailsHTMLAttributes<HTMLDetailsElement>;
740
- summary: HTMLAttributes<HTMLElement>;
741
- dialog: DialogHTMLAttributes<HTMLDialogElement>;
742
- img: ImgHTMLAttributes<HTMLImageElement>;
743
- picture: HTMLAttributes<HTMLPictureElement>;
744
- source: SourceHTMLAttributes<HTMLSourceElement>;
745
- audio: AudioVideoHTMLAttributes<HTMLAudioElement>;
746
- video: AudioVideoHTMLAttributes<HTMLVideoElement>;
747
- track: TrackHTMLAttributes<HTMLTrackElement>;
748
- map: MapHTMLAttributes<HTMLMapElement>;
749
- area: AreaHTMLAttributes<HTMLAreaElement>;
750
- iframe: IframeHTMLAttributes<HTMLIFrameElement>;
751
- embed: EmbedHTMLAttributes<HTMLEmbedElement>;
752
- object: ObjectHTMLAttributes<HTMLObjectElement>;
753
- param: ParamHTMLAttributes<HTMLParamElement>;
754
- canvas: CanvasHTMLAttributes<HTMLCanvasElement>;
755
- svg: SVGAttributes<SVGSVGElement>;
756
- path: SVGAttributes<SVGPathElement>;
757
- circle: SVGAttributes<SVGCircleElement>;
758
- rect: SVGAttributes<SVGRectElement>;
759
- line: SVGAttributes<SVGLineElement>;
760
- polyline: SVGAttributes<SVGPolylineElement>;
761
- polygon: SVGAttributes<SVGPolygonElement>;
762
- ellipse: SVGAttributes<SVGEllipseElement>;
763
- g: SVGAttributes<SVGGElement>;
764
- defs: SVGAttributes<SVGDefsElement>;
765
- use: SVGAttributes<SVGUseElement>;
766
- text: SVGAttributes<SVGTextElement>;
767
- tspan: SVGAttributes<SVGTSpanElement>;
768
- template: HTMLAttributes<HTMLTemplateElement>;
769
- slot: SlotHTMLAttributes<HTMLSlotElement>;
770
- portal: HTMLAttributes<HTMLElement>;
771
- }
772
- interface ElementChildrenAttribute {
773
- children: unknown;
774
- }
775
- }
776
- interface HTMLAttributes<T> {
777
- children?: FictNode | FictNode[];
778
- key?: string | number;
779
- id?: string;
780
- class?: string;
781
- style?: string | Record<string, string | number>;
782
- title?: string;
783
- lang?: string;
784
- dir?: 'ltr' | 'rtl' | 'auto';
785
- hidden?: boolean | 'hidden' | 'until-found';
786
- tabIndex?: number;
787
- draggable?: boolean | 'true' | 'false';
788
- contentEditable?: boolean | 'true' | 'false' | 'inherit';
789
- spellCheck?: boolean | 'true' | 'false';
790
- translate?: 'yes' | 'no';
791
- inert?: boolean;
792
- popover?: 'auto' | 'manual';
793
- autofocus?: boolean;
794
- slot?: string;
795
- accessKey?: string;
796
- onClick?: (e: MouseEvent) => void;
797
- onDblClick?: (e: MouseEvent) => void;
798
- onMouseDown?: (e: MouseEvent) => void;
799
- onMouseUp?: (e: MouseEvent) => void;
800
- onMouseMove?: (e: MouseEvent) => void;
801
- onMouseEnter?: (e: MouseEvent) => void;
802
- onMouseLeave?: (e: MouseEvent) => void;
803
- onMouseOver?: (e: MouseEvent) => void;
804
- onMouseOut?: (e: MouseEvent) => void;
805
- onContextMenu?: (e: MouseEvent) => void;
806
- onInput?: (e: InputEvent) => void;
807
- onChange?: (e: Event) => void;
808
- onSubmit?: (e: SubmitEvent) => void;
809
- onReset?: (e: Event) => void;
810
- onKeyDown?: (e: KeyboardEvent) => void;
811
- onKeyUp?: (e: KeyboardEvent) => void;
812
- onKeyPress?: (e: KeyboardEvent) => void;
813
- onFocus?: (e: FocusEvent) => void;
814
- onBlur?: (e: FocusEvent) => void;
815
- onScroll?: (e: Event) => void;
816
- onWheel?: (e: WheelEvent) => void;
817
- onLoad?: (e: Event) => void;
818
- onError?: (e: Event) => void;
819
- onDrag?: (e: DragEvent) => void;
820
- onDragStart?: (e: DragEvent) => void;
821
- onDragEnd?: (e: DragEvent) => void;
822
- onDragEnter?: (e: DragEvent) => void;
823
- onDragLeave?: (e: DragEvent) => void;
824
- onDragOver?: (e: DragEvent) => void;
825
- onDrop?: (e: DragEvent) => void;
826
- onTouchStart?: (e: TouchEvent) => void;
827
- onTouchMove?: (e: TouchEvent) => void;
828
- onTouchEnd?: (e: TouchEvent) => void;
829
- onTouchCancel?: (e: TouchEvent) => void;
830
- onAnimationStart?: (e: AnimationEvent) => void;
831
- onAnimationEnd?: (e: AnimationEvent) => void;
832
- onAnimationIteration?: (e: AnimationEvent) => void;
833
- onTransitionEnd?: (e: TransitionEvent) => void;
834
- onPointerDown?: (e: PointerEvent) => void;
835
- onPointerUp?: (e: PointerEvent) => void;
836
- onPointerMove?: (e: PointerEvent) => void;
837
- onPointerEnter?: (e: PointerEvent) => void;
838
- onPointerLeave?: (e: PointerEvent) => void;
839
- onPointerOver?: (e: PointerEvent) => void;
840
- onPointerOut?: (e: PointerEvent) => void;
841
- onPointerCancel?: (e: PointerEvent) => void;
842
- ref?: ((el: T | null) => void) | {
843
- current: T | null;
844
- };
845
- role?: string;
846
- 'aria-hidden'?: boolean | 'true' | 'false';
847
- 'aria-label'?: string;
848
- 'aria-labelledby'?: string;
849
- 'aria-describedby'?: string;
850
- 'aria-live'?: 'off' | 'polite' | 'assertive';
851
- 'aria-atomic'?: boolean | 'true' | 'false';
852
- 'aria-busy'?: boolean | 'true' | 'false';
853
- 'aria-current'?: boolean | 'true' | 'false' | 'page' | 'step' | 'location' | 'date' | 'time';
854
- 'aria-disabled'?: boolean | 'true' | 'false';
855
- 'aria-expanded'?: boolean | 'true' | 'false';
856
- 'aria-haspopup'?: boolean | 'true' | 'false' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
857
- 'aria-pressed'?: boolean | 'true' | 'false' | 'mixed';
858
- 'aria-selected'?: boolean | 'true' | 'false';
859
- 'aria-checked'?: boolean | 'true' | 'false' | 'mixed';
860
- 'aria-controls'?: string;
861
- 'aria-owns'?: string;
862
- 'aria-activedescendant'?: string;
863
- 'aria-valuemin'?: number;
864
- 'aria-valuemax'?: number;
865
- 'aria-valuenow'?: number;
866
- 'aria-valuetext'?: string;
867
- 'aria-orientation'?: 'horizontal' | 'vertical';
868
- 'aria-readonly'?: boolean | 'true' | 'false';
869
- 'aria-required'?: boolean | 'true' | 'false';
870
- 'aria-invalid'?: boolean | 'true' | 'false' | 'grammar' | 'spelling';
871
- 'aria-errormessage'?: string;
872
- 'aria-modal'?: boolean | 'true' | 'false';
873
- 'aria-placeholder'?: string;
874
- 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other';
875
- 'aria-colcount'?: number;
876
- 'aria-colindex'?: number;
877
- 'aria-colspan'?: number;
878
- 'aria-rowcount'?: number;
879
- 'aria-rowindex'?: number;
880
- 'aria-rowspan'?: number;
881
- 'aria-setsize'?: number;
882
- 'aria-posinset'?: number;
883
- 'aria-level'?: number;
884
- 'aria-multiselectable'?: boolean | 'true' | 'false';
885
- 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both';
886
- 'aria-details'?: string;
887
- 'aria-keyshortcuts'?: string;
888
- 'aria-roledescription'?: string;
889
- [key: `data-${string}`]: string | number | boolean | undefined;
890
- }
891
- interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> {
892
- href?: string;
893
- target?: '_self' | '_blank' | '_parent' | '_top' | string;
894
- rel?: string;
895
- download?: boolean | string;
896
- hreflang?: string;
897
- type?: string;
898
- referrerPolicy?: ReferrerPolicy;
899
- ping?: string;
900
- }
901
- interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> {
902
- type?: 'button' | 'submit' | 'reset';
903
- disabled?: boolean;
904
- name?: string;
905
- value?: string;
906
- form?: string;
907
- formAction?: string;
908
- formEncType?: string;
909
- formMethod?: string;
910
- formNoValidate?: boolean;
911
- formTarget?: string;
912
- popovertarget?: string;
913
- popovertargetaction?: 'show' | 'hide' | 'toggle';
914
- }
915
- interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
916
- type?: string;
917
- value?: string | number | readonly string[];
918
- defaultValue?: string | number | readonly string[];
919
- checked?: boolean;
920
- defaultChecked?: boolean;
921
- disabled?: boolean;
922
- placeholder?: string;
923
- name?: string;
924
- form?: string;
925
- required?: boolean;
926
- readonly?: boolean;
927
- multiple?: boolean;
928
- min?: number | string;
929
- max?: number | string;
930
- minLength?: number;
931
- maxLength?: number;
932
- step?: number | string;
933
- pattern?: string;
934
- size?: number;
935
- accept?: string;
936
- capture?: boolean | 'user' | 'environment';
937
- list?: string;
938
- autoComplete?: string;
939
- autoCapitalize?: string;
940
- inputMode?: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
941
- enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
942
- height?: number | string;
943
- width?: number | string;
944
- alt?: string;
945
- src?: string;
946
- formAction?: string;
947
- formEncType?: string;
948
- formMethod?: string;
949
- formNoValidate?: boolean;
950
- formTarget?: string;
951
- }
952
- interface FormHTMLAttributes<T> extends HTMLAttributes<T> {
953
- action?: string;
954
- method?: 'get' | 'post' | 'dialog';
955
- encType?: string;
956
- target?: string;
957
- name?: string;
958
- noValidate?: boolean;
959
- autoComplete?: 'on' | 'off';
960
- acceptCharset?: string;
961
- }
962
- interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
963
- src?: string;
964
- alt?: string;
965
- width?: number | string;
966
- height?: number | string;
967
- srcSet?: string;
968
- sizes?: string;
969
- loading?: 'eager' | 'lazy';
970
- decoding?: 'async' | 'auto' | 'sync';
971
- crossOrigin?: 'anonymous' | 'use-credentials';
972
- referrerPolicy?: ReferrerPolicy;
973
- useMap?: string;
974
- isMap?: boolean;
975
- fetchPriority?: 'auto' | 'high' | 'low';
976
- }
977
- interface TextareaHTMLAttributes<T> extends HTMLAttributes<T> {
978
- value?: string | number;
979
- defaultValue?: string;
980
- disabled?: boolean;
981
- placeholder?: string;
982
- name?: string;
983
- form?: string;
984
- required?: boolean;
985
- readonly?: boolean;
986
- rows?: number;
987
- cols?: number;
988
- minLength?: number;
989
- maxLength?: number;
990
- wrap?: 'hard' | 'soft' | 'off';
991
- autoComplete?: string;
992
- }
993
- interface SelectHTMLAttributes<T> extends HTMLAttributes<T> {
994
- value?: string | number | readonly string[];
995
- defaultValue?: string | number | readonly string[];
996
- disabled?: boolean;
997
- name?: string;
998
- form?: string;
999
- required?: boolean;
1000
- multiple?: boolean;
1001
- size?: number;
1002
- autoComplete?: string;
1003
- }
1004
- interface OptionHTMLAttributes<T> extends HTMLAttributes<T> {
1005
- value?: string | number;
1006
- disabled?: boolean;
1007
- selected?: boolean;
1008
- label?: string;
1009
- }
1010
- interface OptgroupHTMLAttributes<T> extends HTMLAttributes<T> {
1011
- disabled?: boolean;
1012
- label?: string;
1013
- }
1014
- interface LabelHTMLAttributes<T> extends HTMLAttributes<T> {
1015
- for?: string;
1016
- htmlFor?: string;
1017
- form?: string;
1018
- }
1019
- interface FieldsetHTMLAttributes<T> extends HTMLAttributes<T> {
1020
- disabled?: boolean;
1021
- name?: string;
1022
- form?: string;
1023
- }
1024
- interface OutputHTMLAttributes<T> extends HTMLAttributes<T> {
1025
- for?: string;
1026
- htmlFor?: string;
1027
- form?: string;
1028
- name?: string;
1029
- }
1030
- interface ProgressHTMLAttributes<T> extends HTMLAttributes<T> {
1031
- value?: number | string;
1032
- max?: number | string;
1033
- }
1034
- interface MeterHTMLAttributes<T> extends HTMLAttributes<T> {
1035
- value?: number | string;
1036
- min?: number | string;
1037
- max?: number | string;
1038
- low?: number | string;
1039
- high?: number | string;
1040
- optimum?: number | string;
1041
- }
1042
- interface TableHTMLAttributes<T> extends HTMLAttributes<T> {
1043
- cellPadding?: number | string;
1044
- cellSpacing?: number | string;
1045
- border?: number | string;
1046
- }
1047
- interface ThHTMLAttributes<T> extends HTMLAttributes<T> {
1048
- colSpan?: number;
1049
- rowSpan?: number;
1050
- scope?: 'row' | 'col' | 'rowgroup' | 'colgroup';
1051
- abbr?: string;
1052
- headers?: string;
1053
- }
1054
- interface TdHTMLAttributes<T> extends HTMLAttributes<T> {
1055
- colSpan?: number;
1056
- rowSpan?: number;
1057
- headers?: string;
1058
- }
1059
- interface ColHTMLAttributes<T> extends HTMLAttributes<T> {
1060
- span?: number;
1061
- }
1062
- interface ColgroupHTMLAttributes<T> extends HTMLAttributes<T> {
1063
- span?: number;
1064
- }
1065
- interface OlHTMLAttributes<T> extends HTMLAttributes<T> {
1066
- start?: number;
1067
- reversed?: boolean;
1068
- type?: '1' | 'a' | 'A' | 'i' | 'I';
1069
- }
1070
- interface LiHTMLAttributes<T> extends HTMLAttributes<T> {
1071
- value?: number;
1072
- }
1073
- interface AudioVideoHTMLAttributes<T> extends HTMLAttributes<T> {
1074
- src?: string;
1075
- controls?: boolean;
1076
- autoPlay?: boolean;
1077
- loop?: boolean;
1078
- muted?: boolean;
1079
- preload?: 'none' | 'metadata' | 'auto';
1080
- crossOrigin?: 'anonymous' | 'use-credentials';
1081
- poster?: string;
1082
- width?: number | string;
1083
- height?: number | string;
1084
- playsInline?: boolean;
1085
- disableRemotePlayback?: boolean;
1086
- onPlay?: (e: Event) => void;
1087
- onPause?: (e: Event) => void;
1088
- onEnded?: (e: Event) => void;
1089
- onTimeUpdate?: (e: Event) => void;
1090
- onVolumeChange?: (e: Event) => void;
1091
- onSeeking?: (e: Event) => void;
1092
- onSeeked?: (e: Event) => void;
1093
- onLoadedData?: (e: Event) => void;
1094
- onLoadedMetadata?: (e: Event) => void;
1095
- onCanPlay?: (e: Event) => void;
1096
- onCanPlayThrough?: (e: Event) => void;
1097
- onWaiting?: (e: Event) => void;
1098
- onPlaying?: (e: Event) => void;
1099
- onProgress?: (e: Event) => void;
1100
- onDurationChange?: (e: Event) => void;
1101
- onRateChange?: (e: Event) => void;
1102
- onStalled?: (e: Event) => void;
1103
- onSuspend?: (e: Event) => void;
1104
- onEmptied?: (e: Event) => void;
1105
- }
1106
- interface SourceHTMLAttributes<T> extends HTMLAttributes<T> {
1107
- src?: string;
1108
- srcSet?: string;
1109
- sizes?: string;
1110
- type?: string;
1111
- media?: string;
1112
- width?: number | string;
1113
- height?: number | string;
1114
- }
1115
- interface TrackHTMLAttributes<T> extends HTMLAttributes<T> {
1116
- src?: string;
1117
- srcLang?: string;
1118
- label?: string;
1119
- kind?: 'subtitles' | 'captions' | 'descriptions' | 'chapters' | 'metadata';
1120
- default?: boolean;
1121
- }
1122
- interface IframeHTMLAttributes<T> extends HTMLAttributes<T> {
1123
- src?: string;
1124
- srcDoc?: string;
1125
- name?: string;
1126
- width?: number | string;
1127
- height?: number | string;
1128
- allow?: string;
1129
- allowFullScreen?: boolean;
1130
- sandbox?: string;
1131
- loading?: 'eager' | 'lazy';
1132
- referrerPolicy?: ReferrerPolicy;
1133
- }
1134
- interface EmbedHTMLAttributes<T> extends HTMLAttributes<T> {
1135
- src?: string;
1136
- type?: string;
1137
- width?: number | string;
1138
- height?: number | string;
1139
- }
1140
- interface ObjectHTMLAttributes<T> extends HTMLAttributes<T> {
1141
- data?: string;
1142
- type?: string;
1143
- name?: string;
1144
- width?: number | string;
1145
- height?: number | string;
1146
- form?: string;
1147
- useMap?: string;
1148
- }
1149
- interface ParamHTMLAttributes<T> extends HTMLAttributes<T> {
1150
- name?: string;
1151
- value?: string;
1152
- }
1153
- interface CanvasHTMLAttributes<T> extends HTMLAttributes<T> {
1154
- width?: number | string;
1155
- height?: number | string;
1156
- }
1157
- interface MapHTMLAttributes<T> extends HTMLAttributes<T> {
1158
- name?: string;
1159
- }
1160
- interface AreaHTMLAttributes<T> extends HTMLAttributes<T> {
1161
- alt?: string;
1162
- coords?: string;
1163
- href?: string;
1164
- hreflang?: string;
1165
- download?: boolean | string;
1166
- rel?: string;
1167
- shape?: 'rect' | 'circle' | 'poly' | 'default';
1168
- target?: string;
1169
- referrerPolicy?: ReferrerPolicy;
1170
- ping?: string;
1171
- }
1172
- interface DetailsHTMLAttributes<T> extends HTMLAttributes<T> {
1173
- open?: boolean;
1174
- onToggle?: (e: Event) => void;
1175
- }
1176
- interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
1177
- open?: boolean;
1178
- onClose?: (e: Event) => void;
1179
- onCancel?: (e: Event) => void;
1180
- }
1181
- interface BlockquoteHTMLAttributes<T> extends HTMLAttributes<T> {
1182
- cite?: string;
1183
- }
1184
- interface QuoteHTMLAttributes<T> extends HTMLAttributes<T> {
1185
- cite?: string;
1186
- }
1187
- interface TimeHTMLAttributes<T> extends HTMLAttributes<T> {
1188
- dateTime?: string;
1189
- }
1190
- interface DataHTMLAttributes<T> extends HTMLAttributes<T> {
1191
- value?: string;
1192
- }
1193
- interface MetaHTMLAttributes<T> extends HTMLAttributes<T> {
1194
- name?: string;
1195
- content?: string;
1196
- httpEquiv?: string;
1197
- charSet?: string;
1198
- property?: string;
1199
- }
1200
- interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
1201
- href?: string;
1202
- rel?: string;
1203
- type?: string;
1204
- media?: string;
1205
- as?: string;
1206
- crossOrigin?: 'anonymous' | 'use-credentials';
1207
- referrerPolicy?: ReferrerPolicy;
1208
- sizes?: string;
1209
- hreflang?: string;
1210
- integrity?: string;
1211
- fetchPriority?: 'auto' | 'high' | 'low';
1212
- disabled?: boolean;
1213
- }
1214
- interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
1215
- media?: string;
1216
- nonce?: string;
1217
- blocking?: string;
1218
- }
1219
- interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
1220
- src?: string;
1221
- type?: string;
1222
- async?: boolean;
1223
- defer?: boolean;
1224
- crossOrigin?: 'anonymous' | 'use-credentials';
1225
- integrity?: string;
1226
- noModule?: boolean;
1227
- nonce?: string;
1228
- referrerPolicy?: ReferrerPolicy;
1229
- fetchPriority?: 'auto' | 'high' | 'low';
1230
- blocking?: string;
1231
- }
1232
- interface SlotHTMLAttributes<T> extends HTMLAttributes<T> {
1233
- name?: string;
1234
- onSlotchange?: (e: Event) => void;
1235
- }
1236
- interface SVGAttributes<T> extends HTMLAttributes<T> {
1237
- viewBox?: string;
1238
- xmlns?: string;
1239
- xmlnsXlink?: string;
1240
- fill?: string;
1241
- stroke?: string;
1242
- strokeWidth?: string | number;
1243
- strokeLinecap?: 'butt' | 'round' | 'square';
1244
- strokeLinejoin?: 'miter' | 'round' | 'bevel';
1245
- strokeDasharray?: string;
1246
- strokeDashoffset?: string | number;
1247
- strokeOpacity?: string | number;
1248
- fillOpacity?: string | number;
1249
- opacity?: string | number;
1250
- transform?: string;
1251
- transformOrigin?: string;
1252
- clipPath?: string;
1253
- mask?: string;
1254
- filter?: string;
1255
- d?: string;
1256
- cx?: string | number;
1257
- cy?: string | number;
1258
- r?: string | number;
1259
- rx?: string | number;
1260
- ry?: string | number;
1261
- x?: string | number;
1262
- y?: string | number;
1263
- x1?: string | number;
1264
- y1?: string | number;
1265
- x2?: string | number;
1266
- y2?: string | number;
1267
- width?: string | number;
1268
- height?: string | number;
1269
- points?: string;
1270
- pathLength?: string | number;
1271
- textAnchor?: 'start' | 'middle' | 'end';
1272
- dominantBaseline?: string;
1273
- dx?: string | number;
1274
- dy?: string | number;
1275
- fontSize?: string | number;
1276
- fontFamily?: string;
1277
- fontWeight?: string | number;
1278
- href?: string;
1279
- xlinkHref?: string;
1280
- gradientUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
1281
- gradientTransform?: string;
1282
- spreadMethod?: 'pad' | 'reflect' | 'repeat';
1283
- offset?: string | number;
1284
- stopColor?: string;
1285
- stopOpacity?: string | number;
1286
- clipPathUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
1287
- maskUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
1288
- maskContentUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
1289
- preserveAspectRatio?: string;
1290
- markerStart?: string;
1291
- markerMid?: string;
1292
- markerEnd?: string;
1293
- vectorEffect?: string;
1294
- }
1295
-
1296
- /**
1297
- * Fict DOM Rendering System
1298
- *
1299
- * This module provides DOM rendering capabilities with reactive bindings.
1300
- * It transforms JSX virtual nodes into actual DOM elements, automatically
1301
- * setting up reactive updates for dynamic values.
1302
- *
1303
- * Key Features:
1304
- * - Reactive text content: `{count}` updates when count changes
1305
- * - Reactive attributes: `disabled={!isValid}` updates reactively
1306
- * - Reactive children: `{show && <Modal />}` handles conditionals
1307
- * - List rendering: `{items.map(...)}` with efficient keyed updates
1308
- */
1309
-
1310
- /**
1311
- * Render a Fict view into a container element.
1312
- *
1313
- * @param view - A function that returns the view to render
1314
- * @param container - The DOM container to render into
1315
- * @returns A teardown function to unmount the view
1316
- *
1317
- * @example
1318
- * ```ts
1319
- * const unmount = render(() => <App />, document.getElementById('root')!)
1320
- * // Later: unmount()
1321
- * ```
1322
- */
1323
- declare function render(view: () => FictNode, container: HTMLElement): () => void;
1324
- /**
1325
- * Create a DOM element from a Fict node.
1326
- * This is the main entry point for converting virtual nodes to real DOM.
1327
- *
1328
- * Supports:
1329
- * - Native DOM nodes (passed through)
1330
- * - Null/undefined/false (empty text node)
1331
- * - Arrays (DocumentFragment)
1332
- * - Strings/numbers (text nodes)
1333
- * - Booleans (empty text node)
1334
- * - VNodes (components or HTML elements)
1335
- * - Reactive values (functions returning any of the above)
1336
- */
1337
- declare function createElement(node: FictNode): DOMElement;
1338
- /**
1339
- * Create a template cloning factory from an HTML string.
1340
- * Used by the compiler for efficient DOM generation.
1341
- *
1342
- * @param html - The HTML string to create a template from
1343
- * @param isImportNode - Use importNode for elements like img/iframe
1344
- * @param isSVG - Whether the template is SVG content
1345
- * @param isMathML - Whether the template is MathML content
1346
- */
1347
- declare function template(html: string, isImportNode?: boolean, isSVG?: boolean, isMathML?: boolean): () => Node;
1348
-
1349
103
  interface ErrorBoundaryProps extends BaseProps {
1350
104
  fallback: FictNode | ((err: unknown) => FictNode);
1351
105
  onError?: (err: unknown) => void;
@@ -1367,245 +121,4 @@ interface SuspenseHandle {
1367
121
  declare function createSuspenseToken(): SuspenseHandle;
1368
122
  declare function Suspense(props: SuspenseProps): FictNode;
1369
123
 
1370
- /**
1371
- * Fict DOM Constants
1372
- *
1373
- * Property constants and configurations for DOM attribute handling.
1374
- * Borrowed from dom-expressions for comprehensive DOM support.
1375
- */
1376
- declare const BooleanAttributes: Set<string>;
1377
- /**
1378
- * Properties that should be set via DOM property (not attribute)
1379
- * Includes camelCase versions of boolean attributes
1380
- */
1381
- declare const Properties: Set<string>;
1382
- /**
1383
- * Properties that represent children/content
1384
- */
1385
- declare const ChildProperties: Set<string>;
1386
- /**
1387
- * React compatibility aliases (className -> class)
1388
- */
1389
- declare const Aliases: Record<string, string>;
1390
- /**
1391
- * Get the property alias for a given attribute and tag name
1392
- */
1393
- declare function getPropAlias(prop: string, tagName: string): string | undefined;
1394
- /**
1395
- * Events that should use event delegation for performance
1396
- * These events bubble and are commonly used across many elements
1397
- */
1398
- declare const DelegatedEvents: Set<string>;
1399
- /**
1400
- * SVG element names (excluding common ones that overlap with HTML)
1401
- */
1402
- declare const SVGElements: Set<string>;
1403
- /**
1404
- * SVG attribute namespaces
1405
- */
1406
- declare const SVGNamespace: Record<string, string>;
1407
- /**
1408
- * CSS properties that don't need a unit (like 'px')
1409
- */
1410
- declare const UnitlessStyles: Set<string>;
1411
-
1412
- /**
1413
- * Fict DOM Reconciliation
1414
- *
1415
- * Efficient array reconciliation algorithm based on udomdiff.
1416
- * https://github.com/WebReflection/udomdiff
1417
- *
1418
- * This algorithm uses a 5-step strategy:
1419
- * 1. Common prefix - skip matching nodes at start
1420
- * 2. Common suffix - skip matching nodes at end
1421
- * 3. Append - insert remaining new nodes
1422
- * 4. Remove - remove remaining old nodes
1423
- * 5. Swap/Map fallback - handle complex rearrangements
1424
- *
1425
- * Most real-world updates (95%+) use fast paths without building a Map.
1426
- */
1427
- /**
1428
- * Reconcile two arrays of DOM nodes, efficiently updating the DOM.
1429
- *
1430
- * @param parentNode - The parent element containing the nodes
1431
- * @param a - The old array of nodes (currently in DOM)
1432
- * @param b - The new array of nodes (target state)
1433
- *
1434
- * **Note:** This function may mutate the input array `a` during the swap
1435
- * optimization (step 5a). If you need to preserve the original array,
1436
- * pass a shallow copy: `reconcileArrays(parent, [...oldNodes], newNodes)`.
1437
- *
1438
- * @example
1439
- * ```ts
1440
- * const oldNodes = [node1, node2, node3]
1441
- * const newNodes = [node1, node4, node3] // node2 replaced with node4
1442
- * reconcileArrays(parent, oldNodes, newNodes)
1443
- * ```
1444
- */
1445
- declare function reconcileArrays(parentNode: ParentNode, a: Node[], b: Node[]): void;
1446
-
1447
- interface FictDevtoolsHook {
1448
- registerSignal: (id: number, value: unknown) => void;
1449
- updateSignal: (id: number, value: unknown) => void;
1450
- registerEffect: (id: number) => void;
1451
- effectRun: (id: number) => void;
1452
- cycleDetected?: (payload: {
1453
- reason: string;
1454
- detail?: Record<string, unknown>;
1455
- }) => void;
1456
- }
1457
- declare function getDevtoolsHook(): FictDevtoolsHook | undefined;
1458
-
1459
- /**
1460
- * Low-level DOM node helpers shared across runtime modules.
1461
- * Keep this file dependency-free to avoid module cycles.
1462
- */
1463
- /**
1464
- * Convert a value to a flat array of DOM nodes.
1465
- * Defensively handles proxies and non-DOM values.
1466
- */
1467
- declare function toNodeArray(node: Node | Node[] | unknown): Node[];
1468
- /**
1469
- * Insert nodes before an anchor node, preserving order.
1470
- * Uses DocumentFragment for batch insertion when inserting multiple nodes.
1471
- */
1472
- declare function insertNodesBefore(parent: ParentNode & Node, nodes: Node[], anchor: Node | null): void;
1473
- /**
1474
- * Remove an array of nodes from the DOM.
1475
- */
1476
- declare function removeNodes(nodes: Node[]): void;
1477
-
1478
- /**
1479
- * List Helpers for Compiler-Generated Fine-Grained Updates
1480
- *
1481
- * These helpers are used by the compiler to generate efficient keyed list rendering.
1482
- * They provide low-level primitives for DOM node manipulation without rebuilding.
1483
- */
1484
-
1485
- /**
1486
- * A keyed block represents a single item in a list with its associated DOM nodes and state
1487
- */
1488
- interface KeyedBlock<T = unknown> {
1489
- /** Unique key for this block */
1490
- key: string | number;
1491
- /** DOM nodes belonging to this block */
1492
- nodes: Node[];
1493
- /** Root context for lifecycle management */
1494
- root: RootContext;
1495
- /** Signal containing the current item value */
1496
- item: SignalAccessor<T>;
1497
- /** Signal containing the current index */
1498
- index: SignalAccessor<number>;
1499
- /** Last raw item value assigned to this block */
1500
- rawItem: T;
1501
- /** Last raw index value assigned to this block */
1502
- rawIndex: number;
1503
- }
1504
- /**
1505
- * Container for managing keyed list blocks
1506
- */
1507
- interface KeyedListContainer<T = unknown> {
1508
- /** Start marker comment node */
1509
- startMarker: Comment;
1510
- /** End marker comment node */
1511
- endMarker: Comment;
1512
- /** Map of key to block */
1513
- blocks: Map<string | number, KeyedBlock<T>>;
1514
- /** Scratch map reused for the next render */
1515
- nextBlocks: Map<string | number, KeyedBlock<T>>;
1516
- /** Current nodes in DOM order (including markers) */
1517
- currentNodes: Node[];
1518
- /** Next-frame node buffer to avoid reallocations */
1519
- nextNodes: Node[];
1520
- /** Ordered blocks in current DOM order */
1521
- orderedBlocks: KeyedBlock<T>[];
1522
- /** Next-frame ordered block buffer to avoid reallocations */
1523
- nextOrderedBlocks: KeyedBlock<T>[];
1524
- /** Track position of keys in the ordered buffer to handle duplicates */
1525
- orderedIndexByKey: Map<string | number, number>;
1526
- /** Cleanup function */
1527
- dispose: () => void;
1528
- }
1529
- /**
1530
- * Binding handle returned by createKeyedList for compiler-generated code
1531
- */
1532
- interface KeyedListBinding {
1533
- /** Document fragment placeholder inserted by the compiler/runtime */
1534
- marker: DocumentFragment;
1535
- /** Start marker comment node */
1536
- startMarker: Comment;
1537
- /** End marker comment node */
1538
- endMarker: Comment;
1539
- /** Flush pending items - call after markers are inserted into DOM */
1540
- flush?: () => void;
1541
- /** Cleanup function */
1542
- dispose: () => void;
1543
- }
1544
- type FineGrainedRenderItem<T> = (itemSig: SignalAccessor<T>, indexSig: SignalAccessor<number>, key: string | number) => Node[];
1545
- /**
1546
- * A block identified by start/end comment markers.
1547
- */
1548
- interface MarkerBlock {
1549
- start: Comment;
1550
- end: Comment;
1551
- root?: RootContext;
1552
- }
1553
- /**
1554
- * Move nodes to a position before the anchor node.
1555
- * This is optimized to avoid unnecessary DOM operations.
1556
- *
1557
- * @param parent - Parent node to move nodes within
1558
- * @param nodes - Array of nodes to move
1559
- * @param anchor - Node to insert before (or null for end)
1560
- */
1561
- declare function moveNodesBefore(parent: Node, nodes: Node[], anchor: Node | null): void;
1562
- /**
1563
- * Remove an array of nodes from the DOM
1564
- *
1565
- * @param nodes - Array of nodes to remove
1566
- */
1567
- /**
1568
- * Move an entire marker-delimited block (including markers) before the anchor.
1569
- */
1570
- declare function moveMarkerBlock(parent: Node, block: MarkerBlock, anchor: Node | null): void;
1571
- /**
1572
- * Destroy a marker-delimited block, removing nodes and destroying the associated root.
1573
- */
1574
- declare function destroyMarkerBlock(block: MarkerBlock): void;
1575
- /**
1576
- * Create a container for managing a keyed list.
1577
- * This sets up the marker nodes and provides cleanup.
1578
- *
1579
- * @returns Container object with markers, blocks map, and dispose function
1580
- */
1581
- declare function createKeyedListContainer<T = unknown>(): KeyedListContainer<T>;
1582
- /**
1583
- * Create a new keyed block with the given render function
1584
- *
1585
- * @param key - Unique key for this block
1586
- * @param item - Initial item value
1587
- * @param index - Initial index
1588
- * @param render - Function that creates the DOM nodes and sets up bindings
1589
- * @returns New KeyedBlock
1590
- */
1591
- declare function createKeyedBlock<T>(key: string | number, item: T, index: number, render: (item: SignalAccessor<T>, index: SignalAccessor<number>, key: string | number) => Node[], needsIndex?: boolean, hostRoot?: RootContext): KeyedBlock<T>;
1592
- /**
1593
- * Find the first node after the start marker (for getting current anchor)
1594
- */
1595
- declare function getFirstNodeAfter(marker: Comment): Node | null;
1596
- /**
1597
- * Check if a node is between two markers
1598
- */
1599
- declare function isNodeBetweenMarkers(node: Node, startMarker: Comment, endMarker: Comment): boolean;
1600
- /**
1601
- * Create a keyed list binding with automatic diffing and DOM updates.
1602
- * This is used by compiler-generated code for efficient list rendering.
1603
- *
1604
- * @param getItems - Function that returns the current array of items
1605
- * @param keyFn - Function to extract unique key from each item
1606
- * @param renderItem - Function that creates DOM nodes for each item
1607
- * @returns Binding handle with markers and dispose function
1608
- */
1609
- declare function createKeyedList<T>(getItems: () => T[], keyFn: (item: T, index: number) => string | number, renderItem: FineGrainedRenderItem<T>, needsIndex?: boolean): KeyedListBinding;
1610
-
1611
- 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 };
124
+ export { BaseProps, ErrorBoundary, FictNode, RefObject, Suspense, SuspenseToken, batch, createRef, createSuspenseToken, startTransition, untrack, useDeferredValue, useTransition };