@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/index.cjs +2287 -2329
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -26
- package/dist/index.d.ts +29 -26
- package/dist/index.dev.js +2295 -2336
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +2287 -2329
- package/dist/index.js.map +1 -1
- package/dist/slim.cjs +1858 -1850
- package/dist/slim.cjs.map +1 -1
- package/dist/slim.d.cts +12 -11
- package/dist/slim.d.ts +12 -11
- package/dist/slim.js +1858 -1850
- package/dist/slim.js.map +1 -1
- package/package.json +1 -1
- package/src/binding.ts +78 -83
- package/src/dom.ts +75 -33
- package/src/error-boundary.ts +3 -1
- package/src/list-helpers.ts +16 -3
- package/src/ref.ts +1 -1
- package/src/store.ts +30 -2
- package/src/types.ts +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -88,13 +88,13 @@ interface ErrorInfo {
|
|
|
88
88
|
/** Event handler type for type-safe event handling */
|
|
89
89
|
type EventHandler<E extends Event = Event> = (event: E) => void;
|
|
90
90
|
/** Ref callback type */
|
|
91
|
-
type RefCallback<T extends
|
|
91
|
+
type RefCallback<T extends Element = HTMLElement> = (element: T) => void;
|
|
92
92
|
/** Ref object type (for future use with createRef) */
|
|
93
|
-
interface RefObject<T extends
|
|
93
|
+
interface RefObject<T extends Element = HTMLElement> {
|
|
94
94
|
current: T | null;
|
|
95
95
|
}
|
|
96
96
|
/** Ref type that can be either callback or object */
|
|
97
|
-
type Ref<T extends
|
|
97
|
+
type Ref<T extends Element = HTMLElement> = RefCallback<T> | RefObject<T>;
|
|
98
98
|
/** CSS style value - can be string or number (number becomes px) */
|
|
99
99
|
type StyleValue = string | number;
|
|
100
100
|
/** CSS style object */
|
|
@@ -198,7 +198,7 @@ declare function createTextBinding(value: MaybeReactive<unknown>): Text;
|
|
|
198
198
|
*/
|
|
199
199
|
declare function bindText(textNode: Text, getValue: () => unknown): Cleanup;
|
|
200
200
|
/** Attribute setter function type */
|
|
201
|
-
type AttributeSetter = (el:
|
|
201
|
+
type AttributeSetter = (el: Element, key: string, value: unknown) => void;
|
|
202
202
|
/**
|
|
203
203
|
* Create a reactive attribute binding on an element.
|
|
204
204
|
*
|
|
@@ -211,35 +211,35 @@ type AttributeSetter = (el: HTMLElement, key: string, value: unknown) => void;
|
|
|
211
211
|
* createAttributeBinding(button, 'disabled', () => !$isValid(), setAttribute)
|
|
212
212
|
* ```
|
|
213
213
|
*/
|
|
214
|
-
declare function createAttributeBinding(el:
|
|
214
|
+
declare function createAttributeBinding(el: Element, key: string, value: MaybeReactive<unknown>, setter: AttributeSetter): void;
|
|
215
215
|
/**
|
|
216
216
|
* Bind a reactive value to an element's attribute.
|
|
217
217
|
*/
|
|
218
|
-
declare function bindAttribute(el:
|
|
218
|
+
declare function bindAttribute(el: Element, key: string, getValue: () => unknown): Cleanup;
|
|
219
219
|
/**
|
|
220
220
|
* Bind a reactive value to an element's property.
|
|
221
221
|
*/
|
|
222
|
-
declare function bindProperty(el:
|
|
222
|
+
declare function bindProperty(el: Element, key: string, getValue: () => unknown): Cleanup;
|
|
223
223
|
/**
|
|
224
224
|
* Apply styles to an element, supporting reactive style objects/strings.
|
|
225
225
|
*/
|
|
226
|
-
declare function createStyleBinding(el:
|
|
226
|
+
declare function createStyleBinding(el: Element, value: MaybeReactive<string | Record<string, string | number> | null | undefined>): void;
|
|
227
227
|
/**
|
|
228
228
|
* Bind a reactive style value to an existing element.
|
|
229
229
|
*/
|
|
230
|
-
declare function bindStyle(el:
|
|
230
|
+
declare function bindStyle(el: Element, getValue: () => string | Record<string, string | number> | null | undefined): Cleanup;
|
|
231
231
|
/**
|
|
232
232
|
* Apply class to an element, supporting reactive class values.
|
|
233
233
|
*/
|
|
234
|
-
declare function createClassBinding(el:
|
|
234
|
+
declare function createClassBinding(el: Element, value: MaybeReactive<string | Record<string, boolean> | null | undefined>): void;
|
|
235
235
|
/**
|
|
236
236
|
* Bind a reactive class value to an existing element.
|
|
237
237
|
*/
|
|
238
|
-
declare function bindClass(el:
|
|
238
|
+
declare function bindClass(el: Element, getValue: () => string | Record<string, boolean> | null | undefined): Cleanup;
|
|
239
239
|
/**
|
|
240
240
|
* Exported classList function for direct use (compatible with dom-expressions)
|
|
241
241
|
*/
|
|
242
|
-
declare function classList(node:
|
|
242
|
+
declare function classList(node: Element, value: Record<string, boolean> | null | undefined, prev?: Record<string, boolean>): Record<string, boolean>;
|
|
243
243
|
/**
|
|
244
244
|
* Insert reactive content into a parent element.
|
|
245
245
|
* This is a simpler API than createChildBinding for basic cases.
|
|
@@ -249,7 +249,7 @@ declare function classList(node: HTMLElement, value: Record<string, boolean> | n
|
|
|
249
249
|
* @param markerOrCreateElement - Optional marker node to insert before, or createElementFn
|
|
250
250
|
* @param createElementFn - Optional function to create DOM elements (when marker is provided)
|
|
251
251
|
*/
|
|
252
|
-
declare function insert(parent:
|
|
252
|
+
declare function insert(parent: ParentNode & Node, getValue: () => FictNode, markerOrCreateElement?: Node | CreateElementFn, createElementFn?: CreateElementFn): Cleanup;
|
|
253
253
|
/**
|
|
254
254
|
* Create a reactive child binding that updates when the child value changes.
|
|
255
255
|
* This is used for dynamic expressions like `{show && <Modal />}` or `{items.map(...)}`.
|
|
@@ -263,10 +263,10 @@ declare function insert(parent: HTMLElement | DocumentFragment, getValue: () =>
|
|
|
263
263
|
* createChildBinding(parent, () => $show() && jsx(Modal, {}), createElement)
|
|
264
264
|
* ```
|
|
265
265
|
*/
|
|
266
|
-
declare function createChildBinding(parent:
|
|
266
|
+
declare function createChildBinding(parent: ParentNode & Node, getValue: () => FictNode, createElementFn: CreateElementFn): BindingHandle;
|
|
267
267
|
declare global {
|
|
268
|
-
interface
|
|
269
|
-
_$host?:
|
|
268
|
+
interface Element {
|
|
269
|
+
_$host?: Element;
|
|
270
270
|
[key: `$$${string}`]: EventListener | [EventListener, unknown] | undefined;
|
|
271
271
|
[key: `$$${string}Data`]: unknown;
|
|
272
272
|
}
|
|
@@ -302,7 +302,7 @@ declare function clearDelegatedEvents(doc?: Document): void;
|
|
|
302
302
|
* @param handler - The event handler or [handler, data] tuple
|
|
303
303
|
* @param delegate - Whether to use delegation (auto-detected based on event name)
|
|
304
304
|
*/
|
|
305
|
-
declare function addEventListener(node:
|
|
305
|
+
declare function addEventListener(node: Element, name: string, handler: EventListener | [EventListener, unknown] | null | undefined, delegate?: boolean): void;
|
|
306
306
|
/**
|
|
307
307
|
* Bind an event listener to an element.
|
|
308
308
|
* Uses event delegation for better performance when applicable.
|
|
@@ -319,7 +319,7 @@ declare function addEventListener(node: HTMLElement, name: string, handler: Even
|
|
|
319
319
|
* bindEvent(button, 'click', handler, { capture: true, passive: true, once: true })
|
|
320
320
|
* ```
|
|
321
321
|
*/
|
|
322
|
-
declare function bindEvent(el:
|
|
322
|
+
declare function bindEvent(el: Element, eventName: string, handler: EventListenerOrEventListenerObject | null | undefined, options?: boolean | AddEventListenerOptions): Cleanup;
|
|
323
323
|
/**
|
|
324
324
|
* Bind a ref to an element.
|
|
325
325
|
* Supports both callback refs and ref objects.
|
|
@@ -341,7 +341,7 @@ declare function bindEvent(el: HTMLElement, eventName: string, handler: EventLis
|
|
|
341
341
|
* bindRef(el, () => props.ref)
|
|
342
342
|
* ```
|
|
343
343
|
*/
|
|
344
|
-
declare function bindRef(el:
|
|
344
|
+
declare function bindRef(el: Element, ref: unknown): Cleanup;
|
|
345
345
|
/**
|
|
346
346
|
* Apply spread props to an element with reactive updates.
|
|
347
347
|
* This handles dynamic spread like `<div {...props}>`.
|
|
@@ -358,7 +358,7 @@ declare function bindRef(el: HTMLElement, ref: unknown): Cleanup;
|
|
|
358
358
|
* spread(el, props, false, false)
|
|
359
359
|
* ```
|
|
360
360
|
*/
|
|
361
|
-
declare function spread(node:
|
|
361
|
+
declare function spread(node: Element, props?: Record<string, unknown>, isSVG?: boolean, skipChildren?: boolean): Record<string, unknown>;
|
|
362
362
|
/**
|
|
363
363
|
* Assign props to a node, tracking previous values for efficient updates.
|
|
364
364
|
* This is the core prop assignment logic used by spread.
|
|
@@ -370,7 +370,7 @@ declare function spread(node: HTMLElement, props?: Record<string, unknown>, isSV
|
|
|
370
370
|
* @param prevProps - Previous props for comparison
|
|
371
371
|
* @param skipRef - Whether to skip ref handling
|
|
372
372
|
*/
|
|
373
|
-
declare function assign(node:
|
|
373
|
+
declare function assign(node: Element, props: Record<string, unknown>, isSVG?: boolean, skipChildren?: boolean, prevProps?: Record<string, unknown>, skipRef?: boolean): void;
|
|
374
374
|
/**
|
|
375
375
|
* Create a conditional rendering binding.
|
|
376
376
|
* Efficiently renders one of two branches based on a condition.
|
|
@@ -394,8 +394,9 @@ declare function createConditional(condition: () => boolean, renderTrue: () => F
|
|
|
394
394
|
type KeyFn<T> = (item: T, index: number) => string | number;
|
|
395
395
|
/**
|
|
396
396
|
* Create a reactive list rendering binding with optional keying.
|
|
397
|
+
* The render callback receives signal accessors for the item and index.
|
|
397
398
|
*/
|
|
398
|
-
declare function createList<T>(items: () => T[], renderItem: (item: T
|
|
399
|
+
declare function createList<T>(items: () => T[], renderItem: (item: SignalAccessor<T>, index: SignalAccessor<number>) => FictNode, createElementFn: CreateElementFn, getKey?: KeyFn<T>): BindingHandle;
|
|
399
400
|
/**
|
|
400
401
|
* Create a show/hide binding that uses CSS display instead of DOM manipulation.
|
|
401
402
|
* More efficient than conditional when the content is expensive to create.
|
|
@@ -405,7 +406,9 @@ declare function createList<T>(items: () => T[], renderItem: (item: T, index: nu
|
|
|
405
406
|
* createShow(container, () => $visible())
|
|
406
407
|
* ```
|
|
407
408
|
*/
|
|
408
|
-
declare function createShow(el:
|
|
409
|
+
declare function createShow(el: Element & {
|
|
410
|
+
style: CSSStyleDeclaration;
|
|
411
|
+
}, condition: () => boolean, displayValue?: string): void;
|
|
409
412
|
/**
|
|
410
413
|
* Create a portal that renders content into a different DOM container.
|
|
411
414
|
*
|
|
@@ -418,7 +421,7 @@ declare function createShow(el: HTMLElement, condition: () => boolean, displayVa
|
|
|
418
421
|
* )
|
|
419
422
|
* ```
|
|
420
423
|
*/
|
|
421
|
-
declare function createPortal(container:
|
|
424
|
+
declare function createPortal(container: ParentNode & Node, render: () => FictNode, createElementFn: CreateElementFn): BindingHandle;
|
|
422
425
|
|
|
423
426
|
interface ReactiveScope {
|
|
424
427
|
run<T>(fn: () => T): T;
|
|
@@ -549,7 +552,7 @@ declare function createRoot<T>(fn: () => T): {
|
|
|
549
552
|
* }
|
|
550
553
|
* ```
|
|
551
554
|
*/
|
|
552
|
-
declare function createRef<T extends
|
|
555
|
+
declare function createRef<T extends Element = HTMLElement>(): RefObject<T>;
|
|
553
556
|
|
|
554
557
|
/**
|
|
555
558
|
* Execute a function with low-priority scheduling.
|
|
@@ -1580,7 +1583,7 @@ declare function createKeyedListContainer<T = unknown>(): KeyedListContainer<T>;
|
|
|
1580
1583
|
* @param render - Function that creates the DOM nodes and sets up bindings
|
|
1581
1584
|
* @returns New KeyedBlock
|
|
1582
1585
|
*/
|
|
1583
|
-
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>;
|
|
1586
|
+
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>;
|
|
1584
1587
|
/**
|
|
1585
1588
|
* Find the first node after the start marker (for getting current anchor)
|
|
1586
1589
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -88,13 +88,13 @@ interface ErrorInfo {
|
|
|
88
88
|
/** Event handler type for type-safe event handling */
|
|
89
89
|
type EventHandler<E extends Event = Event> = (event: E) => void;
|
|
90
90
|
/** Ref callback type */
|
|
91
|
-
type RefCallback<T extends
|
|
91
|
+
type RefCallback<T extends Element = HTMLElement> = (element: T) => void;
|
|
92
92
|
/** Ref object type (for future use with createRef) */
|
|
93
|
-
interface RefObject<T extends
|
|
93
|
+
interface RefObject<T extends Element = HTMLElement> {
|
|
94
94
|
current: T | null;
|
|
95
95
|
}
|
|
96
96
|
/** Ref type that can be either callback or object */
|
|
97
|
-
type Ref<T extends
|
|
97
|
+
type Ref<T extends Element = HTMLElement> = RefCallback<T> | RefObject<T>;
|
|
98
98
|
/** CSS style value - can be string or number (number becomes px) */
|
|
99
99
|
type StyleValue = string | number;
|
|
100
100
|
/** CSS style object */
|
|
@@ -198,7 +198,7 @@ declare function createTextBinding(value: MaybeReactive<unknown>): Text;
|
|
|
198
198
|
*/
|
|
199
199
|
declare function bindText(textNode: Text, getValue: () => unknown): Cleanup;
|
|
200
200
|
/** Attribute setter function type */
|
|
201
|
-
type AttributeSetter = (el:
|
|
201
|
+
type AttributeSetter = (el: Element, key: string, value: unknown) => void;
|
|
202
202
|
/**
|
|
203
203
|
* Create a reactive attribute binding on an element.
|
|
204
204
|
*
|
|
@@ -211,35 +211,35 @@ type AttributeSetter = (el: HTMLElement, key: string, value: unknown) => void;
|
|
|
211
211
|
* createAttributeBinding(button, 'disabled', () => !$isValid(), setAttribute)
|
|
212
212
|
* ```
|
|
213
213
|
*/
|
|
214
|
-
declare function createAttributeBinding(el:
|
|
214
|
+
declare function createAttributeBinding(el: Element, key: string, value: MaybeReactive<unknown>, setter: AttributeSetter): void;
|
|
215
215
|
/**
|
|
216
216
|
* Bind a reactive value to an element's attribute.
|
|
217
217
|
*/
|
|
218
|
-
declare function bindAttribute(el:
|
|
218
|
+
declare function bindAttribute(el: Element, key: string, getValue: () => unknown): Cleanup;
|
|
219
219
|
/**
|
|
220
220
|
* Bind a reactive value to an element's property.
|
|
221
221
|
*/
|
|
222
|
-
declare function bindProperty(el:
|
|
222
|
+
declare function bindProperty(el: Element, key: string, getValue: () => unknown): Cleanup;
|
|
223
223
|
/**
|
|
224
224
|
* Apply styles to an element, supporting reactive style objects/strings.
|
|
225
225
|
*/
|
|
226
|
-
declare function createStyleBinding(el:
|
|
226
|
+
declare function createStyleBinding(el: Element, value: MaybeReactive<string | Record<string, string | number> | null | undefined>): void;
|
|
227
227
|
/**
|
|
228
228
|
* Bind a reactive style value to an existing element.
|
|
229
229
|
*/
|
|
230
|
-
declare function bindStyle(el:
|
|
230
|
+
declare function bindStyle(el: Element, getValue: () => string | Record<string, string | number> | null | undefined): Cleanup;
|
|
231
231
|
/**
|
|
232
232
|
* Apply class to an element, supporting reactive class values.
|
|
233
233
|
*/
|
|
234
|
-
declare function createClassBinding(el:
|
|
234
|
+
declare function createClassBinding(el: Element, value: MaybeReactive<string | Record<string, boolean> | null | undefined>): void;
|
|
235
235
|
/**
|
|
236
236
|
* Bind a reactive class value to an existing element.
|
|
237
237
|
*/
|
|
238
|
-
declare function bindClass(el:
|
|
238
|
+
declare function bindClass(el: Element, getValue: () => string | Record<string, boolean> | null | undefined): Cleanup;
|
|
239
239
|
/**
|
|
240
240
|
* Exported classList function for direct use (compatible with dom-expressions)
|
|
241
241
|
*/
|
|
242
|
-
declare function classList(node:
|
|
242
|
+
declare function classList(node: Element, value: Record<string, boolean> | null | undefined, prev?: Record<string, boolean>): Record<string, boolean>;
|
|
243
243
|
/**
|
|
244
244
|
* Insert reactive content into a parent element.
|
|
245
245
|
* This is a simpler API than createChildBinding for basic cases.
|
|
@@ -249,7 +249,7 @@ declare function classList(node: HTMLElement, value: Record<string, boolean> | n
|
|
|
249
249
|
* @param markerOrCreateElement - Optional marker node to insert before, or createElementFn
|
|
250
250
|
* @param createElementFn - Optional function to create DOM elements (when marker is provided)
|
|
251
251
|
*/
|
|
252
|
-
declare function insert(parent:
|
|
252
|
+
declare function insert(parent: ParentNode & Node, getValue: () => FictNode, markerOrCreateElement?: Node | CreateElementFn, createElementFn?: CreateElementFn): Cleanup;
|
|
253
253
|
/**
|
|
254
254
|
* Create a reactive child binding that updates when the child value changes.
|
|
255
255
|
* This is used for dynamic expressions like `{show && <Modal />}` or `{items.map(...)}`.
|
|
@@ -263,10 +263,10 @@ declare function insert(parent: HTMLElement | DocumentFragment, getValue: () =>
|
|
|
263
263
|
* createChildBinding(parent, () => $show() && jsx(Modal, {}), createElement)
|
|
264
264
|
* ```
|
|
265
265
|
*/
|
|
266
|
-
declare function createChildBinding(parent:
|
|
266
|
+
declare function createChildBinding(parent: ParentNode & Node, getValue: () => FictNode, createElementFn: CreateElementFn): BindingHandle;
|
|
267
267
|
declare global {
|
|
268
|
-
interface
|
|
269
|
-
_$host?:
|
|
268
|
+
interface Element {
|
|
269
|
+
_$host?: Element;
|
|
270
270
|
[key: `$$${string}`]: EventListener | [EventListener, unknown] | undefined;
|
|
271
271
|
[key: `$$${string}Data`]: unknown;
|
|
272
272
|
}
|
|
@@ -302,7 +302,7 @@ declare function clearDelegatedEvents(doc?: Document): void;
|
|
|
302
302
|
* @param handler - The event handler or [handler, data] tuple
|
|
303
303
|
* @param delegate - Whether to use delegation (auto-detected based on event name)
|
|
304
304
|
*/
|
|
305
|
-
declare function addEventListener(node:
|
|
305
|
+
declare function addEventListener(node: Element, name: string, handler: EventListener | [EventListener, unknown] | null | undefined, delegate?: boolean): void;
|
|
306
306
|
/**
|
|
307
307
|
* Bind an event listener to an element.
|
|
308
308
|
* Uses event delegation for better performance when applicable.
|
|
@@ -319,7 +319,7 @@ declare function addEventListener(node: HTMLElement, name: string, handler: Even
|
|
|
319
319
|
* bindEvent(button, 'click', handler, { capture: true, passive: true, once: true })
|
|
320
320
|
* ```
|
|
321
321
|
*/
|
|
322
|
-
declare function bindEvent(el:
|
|
322
|
+
declare function bindEvent(el: Element, eventName: string, handler: EventListenerOrEventListenerObject | null | undefined, options?: boolean | AddEventListenerOptions): Cleanup;
|
|
323
323
|
/**
|
|
324
324
|
* Bind a ref to an element.
|
|
325
325
|
* Supports both callback refs and ref objects.
|
|
@@ -341,7 +341,7 @@ declare function bindEvent(el: HTMLElement, eventName: string, handler: EventLis
|
|
|
341
341
|
* bindRef(el, () => props.ref)
|
|
342
342
|
* ```
|
|
343
343
|
*/
|
|
344
|
-
declare function bindRef(el:
|
|
344
|
+
declare function bindRef(el: Element, ref: unknown): Cleanup;
|
|
345
345
|
/**
|
|
346
346
|
* Apply spread props to an element with reactive updates.
|
|
347
347
|
* This handles dynamic spread like `<div {...props}>`.
|
|
@@ -358,7 +358,7 @@ declare function bindRef(el: HTMLElement, ref: unknown): Cleanup;
|
|
|
358
358
|
* spread(el, props, false, false)
|
|
359
359
|
* ```
|
|
360
360
|
*/
|
|
361
|
-
declare function spread(node:
|
|
361
|
+
declare function spread(node: Element, props?: Record<string, unknown>, isSVG?: boolean, skipChildren?: boolean): Record<string, unknown>;
|
|
362
362
|
/**
|
|
363
363
|
* Assign props to a node, tracking previous values for efficient updates.
|
|
364
364
|
* This is the core prop assignment logic used by spread.
|
|
@@ -370,7 +370,7 @@ declare function spread(node: HTMLElement, props?: Record<string, unknown>, isSV
|
|
|
370
370
|
* @param prevProps - Previous props for comparison
|
|
371
371
|
* @param skipRef - Whether to skip ref handling
|
|
372
372
|
*/
|
|
373
|
-
declare function assign(node:
|
|
373
|
+
declare function assign(node: Element, props: Record<string, unknown>, isSVG?: boolean, skipChildren?: boolean, prevProps?: Record<string, unknown>, skipRef?: boolean): void;
|
|
374
374
|
/**
|
|
375
375
|
* Create a conditional rendering binding.
|
|
376
376
|
* Efficiently renders one of two branches based on a condition.
|
|
@@ -394,8 +394,9 @@ declare function createConditional(condition: () => boolean, renderTrue: () => F
|
|
|
394
394
|
type KeyFn<T> = (item: T, index: number) => string | number;
|
|
395
395
|
/**
|
|
396
396
|
* Create a reactive list rendering binding with optional keying.
|
|
397
|
+
* The render callback receives signal accessors for the item and index.
|
|
397
398
|
*/
|
|
398
|
-
declare function createList<T>(items: () => T[], renderItem: (item: T
|
|
399
|
+
declare function createList<T>(items: () => T[], renderItem: (item: SignalAccessor<T>, index: SignalAccessor<number>) => FictNode, createElementFn: CreateElementFn, getKey?: KeyFn<T>): BindingHandle;
|
|
399
400
|
/**
|
|
400
401
|
* Create a show/hide binding that uses CSS display instead of DOM manipulation.
|
|
401
402
|
* More efficient than conditional when the content is expensive to create.
|
|
@@ -405,7 +406,9 @@ declare function createList<T>(items: () => T[], renderItem: (item: T, index: nu
|
|
|
405
406
|
* createShow(container, () => $visible())
|
|
406
407
|
* ```
|
|
407
408
|
*/
|
|
408
|
-
declare function createShow(el:
|
|
409
|
+
declare function createShow(el: Element & {
|
|
410
|
+
style: CSSStyleDeclaration;
|
|
411
|
+
}, condition: () => boolean, displayValue?: string): void;
|
|
409
412
|
/**
|
|
410
413
|
* Create a portal that renders content into a different DOM container.
|
|
411
414
|
*
|
|
@@ -418,7 +421,7 @@ declare function createShow(el: HTMLElement, condition: () => boolean, displayVa
|
|
|
418
421
|
* )
|
|
419
422
|
* ```
|
|
420
423
|
*/
|
|
421
|
-
declare function createPortal(container:
|
|
424
|
+
declare function createPortal(container: ParentNode & Node, render: () => FictNode, createElementFn: CreateElementFn): BindingHandle;
|
|
422
425
|
|
|
423
426
|
interface ReactiveScope {
|
|
424
427
|
run<T>(fn: () => T): T;
|
|
@@ -549,7 +552,7 @@ declare function createRoot<T>(fn: () => T): {
|
|
|
549
552
|
* }
|
|
550
553
|
* ```
|
|
551
554
|
*/
|
|
552
|
-
declare function createRef<T extends
|
|
555
|
+
declare function createRef<T extends Element = HTMLElement>(): RefObject<T>;
|
|
553
556
|
|
|
554
557
|
/**
|
|
555
558
|
* Execute a function with low-priority scheduling.
|
|
@@ -1580,7 +1583,7 @@ declare function createKeyedListContainer<T = unknown>(): KeyedListContainer<T>;
|
|
|
1580
1583
|
* @param render - Function that creates the DOM nodes and sets up bindings
|
|
1581
1584
|
* @returns New KeyedBlock
|
|
1582
1585
|
*/
|
|
1583
|
-
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>;
|
|
1586
|
+
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>;
|
|
1584
1587
|
/**
|
|
1585
1588
|
* Find the first node after the start marker (for getting current anchor)
|
|
1586
1589
|
*/
|