@fictjs/runtime 0.0.7 → 0.0.9

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/dist/slim.d.cts CHANGED
@@ -104,19 +104,19 @@ declare function bindText(textNode: Text, getValue: () => unknown): Cleanup;
104
104
  /**
105
105
  * Bind a reactive value to an element's attribute.
106
106
  */
107
- declare function bindAttribute(el: HTMLElement, key: string, getValue: () => unknown): Cleanup;
107
+ declare function bindAttribute(el: Element, key: string, getValue: () => unknown): Cleanup;
108
108
  /**
109
109
  * Bind a reactive value to an element's property.
110
110
  */
111
- declare function bindProperty(el: HTMLElement, key: string, getValue: () => unknown): Cleanup;
111
+ declare function bindProperty(el: Element, key: string, getValue: () => unknown): Cleanup;
112
112
  /**
113
113
  * Bind a reactive style value to an existing element.
114
114
  */
115
- declare function bindStyle(el: HTMLElement, getValue: () => string | Record<string, string | number> | null | undefined): Cleanup;
115
+ declare function bindStyle(el: Element, getValue: () => string | Record<string, string | number> | null | undefined): Cleanup;
116
116
  /**
117
117
  * Bind a reactive class value to an existing element.
118
118
  */
119
- declare function bindClass(el: HTMLElement, getValue: () => string | Record<string, boolean> | null | undefined): Cleanup;
119
+ declare function bindClass(el: Element, getValue: () => string | Record<string, boolean> | null | undefined): Cleanup;
120
120
  /**
121
121
  * Insert reactive content into a parent element.
122
122
  * This is a simpler API than createChildBinding for basic cases.
@@ -126,10 +126,10 @@ declare function bindClass(el: HTMLElement, getValue: () => string | Record<stri
126
126
  * @param markerOrCreateElement - Optional marker node to insert before, or createElementFn
127
127
  * @param createElementFn - Optional function to create DOM elements (when marker is provided)
128
128
  */
129
- declare function insert(parent: HTMLElement | DocumentFragment, getValue: () => FictNode, markerOrCreateElement?: Node | CreateElementFn, createElementFn?: CreateElementFn): Cleanup;
129
+ declare function insert(parent: ParentNode & Node, getValue: () => FictNode, markerOrCreateElement?: Node | CreateElementFn, createElementFn?: CreateElementFn): Cleanup;
130
130
  declare global {
131
- interface HTMLElement {
132
- _$host?: HTMLElement;
131
+ interface Element {
132
+ _$host?: Element;
133
133
  [key: `$$${string}`]: EventListener | [EventListener, unknown] | undefined;
134
134
  [key: `$$${string}Data`]: unknown;
135
135
  }
@@ -172,7 +172,7 @@ declare function clearDelegatedEvents(doc?: Document): void;
172
172
  * bindEvent(button, 'click', handler, { capture: true, passive: true, once: true })
173
173
  * ```
174
174
  */
175
- declare function bindEvent(el: HTMLElement, eventName: string, handler: EventListenerOrEventListenerObject | null | undefined, options?: boolean | AddEventListenerOptions): Cleanup;
175
+ declare function bindEvent(el: Element, eventName: string, handler: EventListenerOrEventListenerObject | null | undefined, options?: boolean | AddEventListenerOptions): Cleanup;
176
176
  /**
177
177
  * Bind a ref to an element.
178
178
  * Supports both callback refs and ref objects.
@@ -194,7 +194,7 @@ declare function bindEvent(el: HTMLElement, eventName: string, handler: EventLis
194
194
  * bindRef(el, () => props.ref)
195
195
  * ```
196
196
  */
197
- declare function bindRef(el: HTMLElement, ref: unknown): Cleanup;
197
+ declare function bindRef(el: Element, ref: unknown): Cleanup;
198
198
  /**
199
199
  * Create a conditional rendering binding.
200
200
  * Efficiently renders one of two branches based on a condition.
@@ -218,8 +218,9 @@ declare function createConditional(condition: () => boolean, renderTrue: () => F
218
218
  type KeyFn<T> = (item: T, index: number) => string | number;
219
219
  /**
220
220
  * Create a reactive list rendering binding with optional keying.
221
+ * The render callback receives signal accessors for the item and index.
221
222
  */
222
- declare function createList<T>(items: () => T[], renderItem: (item: T, index: number) => FictNode, createElementFn: CreateElementFn, getKey?: KeyFn<T>): BindingHandle;
223
+ declare function createList<T>(items: () => T[], renderItem: (item: SignalAccessor<T>, index: SignalAccessor<number>) => FictNode, createElementFn: CreateElementFn, getKey?: KeyFn<T>): BindingHandle;
223
224
 
224
225
  interface ReactiveScope {
225
226
  run<T>(fn: () => T): T;
@@ -430,7 +431,7 @@ declare function createKeyedListContainer<T = unknown>(): KeyedListContainer<T>;
430
431
  * @param render - Function that creates the DOM nodes and sets up bindings
431
432
  * @returns New KeyedBlock
432
433
  */
433
- declare function createKeyedBlock<T>(key: string | number, item: T, index: number, render: (item: SignalAccessor<T>, index: SignalAccessor<number>, key: string | number) => Node[], needsIndex?: boolean): KeyedBlock<T>;
434
+ 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>;
434
435
  /**
435
436
  * Find the first node after the start marker (for getting current anchor)
436
437
  */
package/dist/slim.d.ts CHANGED
@@ -104,19 +104,19 @@ declare function bindText(textNode: Text, getValue: () => unknown): Cleanup;
104
104
  /**
105
105
  * Bind a reactive value to an element's attribute.
106
106
  */
107
- declare function bindAttribute(el: HTMLElement, key: string, getValue: () => unknown): Cleanup;
107
+ declare function bindAttribute(el: Element, key: string, getValue: () => unknown): Cleanup;
108
108
  /**
109
109
  * Bind a reactive value to an element's property.
110
110
  */
111
- declare function bindProperty(el: HTMLElement, key: string, getValue: () => unknown): Cleanup;
111
+ declare function bindProperty(el: Element, key: string, getValue: () => unknown): Cleanup;
112
112
  /**
113
113
  * Bind a reactive style value to an existing element.
114
114
  */
115
- declare function bindStyle(el: HTMLElement, getValue: () => string | Record<string, string | number> | null | undefined): Cleanup;
115
+ declare function bindStyle(el: Element, getValue: () => string | Record<string, string | number> | null | undefined): Cleanup;
116
116
  /**
117
117
  * Bind a reactive class value to an existing element.
118
118
  */
119
- declare function bindClass(el: HTMLElement, getValue: () => string | Record<string, boolean> | null | undefined): Cleanup;
119
+ declare function bindClass(el: Element, getValue: () => string | Record<string, boolean> | null | undefined): Cleanup;
120
120
  /**
121
121
  * Insert reactive content into a parent element.
122
122
  * This is a simpler API than createChildBinding for basic cases.
@@ -126,10 +126,10 @@ declare function bindClass(el: HTMLElement, getValue: () => string | Record<stri
126
126
  * @param markerOrCreateElement - Optional marker node to insert before, or createElementFn
127
127
  * @param createElementFn - Optional function to create DOM elements (when marker is provided)
128
128
  */
129
- declare function insert(parent: HTMLElement | DocumentFragment, getValue: () => FictNode, markerOrCreateElement?: Node | CreateElementFn, createElementFn?: CreateElementFn): Cleanup;
129
+ declare function insert(parent: ParentNode & Node, getValue: () => FictNode, markerOrCreateElement?: Node | CreateElementFn, createElementFn?: CreateElementFn): Cleanup;
130
130
  declare global {
131
- interface HTMLElement {
132
- _$host?: HTMLElement;
131
+ interface Element {
132
+ _$host?: Element;
133
133
  [key: `$$${string}`]: EventListener | [EventListener, unknown] | undefined;
134
134
  [key: `$$${string}Data`]: unknown;
135
135
  }
@@ -172,7 +172,7 @@ declare function clearDelegatedEvents(doc?: Document): void;
172
172
  * bindEvent(button, 'click', handler, { capture: true, passive: true, once: true })
173
173
  * ```
174
174
  */
175
- declare function bindEvent(el: HTMLElement, eventName: string, handler: EventListenerOrEventListenerObject | null | undefined, options?: boolean | AddEventListenerOptions): Cleanup;
175
+ declare function bindEvent(el: Element, eventName: string, handler: EventListenerOrEventListenerObject | null | undefined, options?: boolean | AddEventListenerOptions): Cleanup;
176
176
  /**
177
177
  * Bind a ref to an element.
178
178
  * Supports both callback refs and ref objects.
@@ -194,7 +194,7 @@ declare function bindEvent(el: HTMLElement, eventName: string, handler: EventLis
194
194
  * bindRef(el, () => props.ref)
195
195
  * ```
196
196
  */
197
- declare function bindRef(el: HTMLElement, ref: unknown): Cleanup;
197
+ declare function bindRef(el: Element, ref: unknown): Cleanup;
198
198
  /**
199
199
  * Create a conditional rendering binding.
200
200
  * Efficiently renders one of two branches based on a condition.
@@ -218,8 +218,9 @@ declare function createConditional(condition: () => boolean, renderTrue: () => F
218
218
  type KeyFn<T> = (item: T, index: number) => string | number;
219
219
  /**
220
220
  * Create a reactive list rendering binding with optional keying.
221
+ * The render callback receives signal accessors for the item and index.
221
222
  */
222
- declare function createList<T>(items: () => T[], renderItem: (item: T, index: number) => FictNode, createElementFn: CreateElementFn, getKey?: KeyFn<T>): BindingHandle;
223
+ declare function createList<T>(items: () => T[], renderItem: (item: SignalAccessor<T>, index: SignalAccessor<number>) => FictNode, createElementFn: CreateElementFn, getKey?: KeyFn<T>): BindingHandle;
223
224
 
224
225
  interface ReactiveScope {
225
226
  run<T>(fn: () => T): T;
@@ -430,7 +431,7 @@ declare function createKeyedListContainer<T = unknown>(): KeyedListContainer<T>;
430
431
  * @param render - Function that creates the DOM nodes and sets up bindings
431
432
  * @returns New KeyedBlock
432
433
  */
433
- declare function createKeyedBlock<T>(key: string | number, item: T, index: number, render: (item: SignalAccessor<T>, index: SignalAccessor<number>, key: string | number) => Node[], needsIndex?: boolean): KeyedBlock<T>;
434
+ 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>;
434
435
  /**
435
436
  * Find the first node after the start marker (for getting current anchor)
436
437
  */