@fictjs/runtime 0.0.12 → 0.0.13
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 +2330 -3203
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -141
- package/dist/index.d.ts +7 -141
- package/dist/index.dev.js +2526 -2836
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +2331 -3197
- package/dist/index.js.map +1 -1
- package/package.json +1 -6
- package/src/binding.ts +25 -422
- package/src/constants.ts +368 -344
- package/src/cycle-guard.ts +124 -97
- package/src/dom.ts +19 -25
- package/src/effect.ts +4 -0
- package/src/hooks.ts +9 -1
- package/src/index.ts +1 -19
- package/src/lifecycle.ts +13 -2
- package/src/list-helpers.ts +6 -65
- package/src/signal.ts +59 -39
- package/dist/slim.cjs +0 -3854
- package/dist/slim.cjs.map +0 -1
- package/dist/slim.d.cts +0 -504
- package/dist/slim.d.ts +0 -504
- package/dist/slim.js +0 -3802
- package/dist/slim.js.map +0 -1
- package/src/slim.ts +0 -69
package/dist/index.d.cts
CHANGED
|
@@ -111,6 +111,10 @@ interface SuspenseToken {
|
|
|
111
111
|
then: Promise<unknown>['then'];
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Effect callback run synchronously; async callbacks are not tracked after the first await.
|
|
116
|
+
* TypeScript will reject `async () => {}` here—split async work or read signals before awaiting.
|
|
117
|
+
*/
|
|
114
118
|
type Effect = () => void | Cleanup;
|
|
115
119
|
declare function createEffect(fn: Effect): () => void;
|
|
116
120
|
declare const $effect: typeof createEffect;
|
|
@@ -142,6 +146,7 @@ interface BindingHandle {
|
|
|
142
146
|
/** Dispose function to clean up the binding */
|
|
143
147
|
dispose: Cleanup;
|
|
144
148
|
}
|
|
149
|
+
/** Managed child node with its dispose function */
|
|
145
150
|
/**
|
|
146
151
|
* Check if a value is reactive (a getter function)
|
|
147
152
|
* Note: Event handlers (functions that take arguments) are NOT reactive values
|
|
@@ -157,28 +162,6 @@ declare function unwrap<T>(value: MaybeReactive<T>): T;
|
|
|
157
162
|
* optional data payload followed by the event.
|
|
158
163
|
*/
|
|
159
164
|
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
165
|
/**
|
|
183
166
|
* Create a text node that reactively updates when the value changes.
|
|
184
167
|
*
|
|
@@ -390,13 +373,6 @@ declare function assign(node: Element, props: Record<string, unknown>, isSVG?: b
|
|
|
390
373
|
* ```
|
|
391
374
|
*/
|
|
392
375
|
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
376
|
/**
|
|
401
377
|
* Create a show/hide binding that uses CSS display instead of DOM manipulation.
|
|
402
378
|
* More efficient than conditional when the content is expensive to create.
|
|
@@ -515,16 +491,6 @@ type PropGetter<T> = (() => T) & {
|
|
|
515
491
|
declare function useProp<T>(getter: () => T): PropGetter<T>;
|
|
516
492
|
|
|
517
493
|
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
494
|
declare function onMount(fn: LifecycleFn): void;
|
|
529
495
|
declare function onDestroy(fn: LifecycleFn): void;
|
|
530
496
|
declare function onCleanup(fn: Cleanup): void;
|
|
@@ -639,7 +605,7 @@ interface CycleProtectionOptions {
|
|
|
639
605
|
enableWindowWarning?: boolean;
|
|
640
606
|
devMode?: boolean;
|
|
641
607
|
}
|
|
642
|
-
declare
|
|
608
|
+
declare let setCycleProtectionOptions: (opts: CycleProtectionOptions) => void;
|
|
643
609
|
|
|
644
610
|
declare const Fragment: unique symbol;
|
|
645
611
|
declare namespace JSX {
|
|
@@ -1374,10 +1340,6 @@ declare function Suspense(props: SuspenseProps): FictNode;
|
|
|
1374
1340
|
* Borrowed from dom-expressions for comprehensive DOM support.
|
|
1375
1341
|
*/
|
|
1376
1342
|
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
1343
|
declare const Properties: Set<string>;
|
|
1382
1344
|
/**
|
|
1383
1345
|
* Properties that represent children/content
|
|
@@ -1391,22 +1353,12 @@ declare const Aliases: Record<string, string>;
|
|
|
1391
1353
|
* Get the property alias for a given attribute and tag name
|
|
1392
1354
|
*/
|
|
1393
1355
|
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
1356
|
declare const DelegatedEvents: Set<string>;
|
|
1399
|
-
/**
|
|
1400
|
-
* SVG element names (excluding common ones that overlap with HTML)
|
|
1401
|
-
*/
|
|
1402
1357
|
declare const SVGElements: Set<string>;
|
|
1403
1358
|
/**
|
|
1404
1359
|
* SVG attribute namespaces
|
|
1405
1360
|
*/
|
|
1406
1361
|
declare const SVGNamespace: Record<string, string>;
|
|
1407
|
-
/**
|
|
1408
|
-
* CSS properties that don't need a unit (like 'px')
|
|
1409
|
-
*/
|
|
1410
1362
|
declare const UnitlessStyles: Set<string>;
|
|
1411
1363
|
|
|
1412
1364
|
/**
|
|
@@ -1482,50 +1434,6 @@ declare function removeNodes(nodes: Node[]): void;
|
|
|
1482
1434
|
* They provide low-level primitives for DOM node manipulation without rebuilding.
|
|
1483
1435
|
*/
|
|
1484
1436
|
|
|
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
1437
|
/**
|
|
1530
1438
|
* Binding handle returned by createKeyedList for compiler-generated code
|
|
1531
1439
|
*/
|
|
@@ -1542,14 +1450,6 @@ interface KeyedListBinding {
|
|
|
1542
1450
|
dispose: () => void;
|
|
1543
1451
|
}
|
|
1544
1452
|
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
1453
|
/**
|
|
1554
1454
|
* Move nodes to a position before the anchor node.
|
|
1555
1455
|
* This is optimized to avoid unnecessary DOM operations.
|
|
@@ -1559,40 +1459,6 @@ interface MarkerBlock {
|
|
|
1559
1459
|
* @param anchor - Node to insert before (or null for end)
|
|
1560
1460
|
*/
|
|
1561
1461
|
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
1462
|
/**
|
|
1597
1463
|
* Check if a node is between two markers
|
|
1598
1464
|
*/
|
|
@@ -1608,4 +1474,4 @@ declare function isNodeBetweenMarkers(node: Node, startMarker: Comment, endMarke
|
|
|
1608
1474
|
*/
|
|
1609
1475
|
declare function createKeyedList<T>(getItems: () => T[], keyFn: (item: T, index: number) => string | number, renderItem: FineGrainedRenderItem<T>, needsIndex?: boolean): KeyedListBinding;
|
|
1610
1476
|
|
|
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
|
|
1477
|
+
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 KeyedListBinding, 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, createKeyedList, createMemo, createPortal, createPropsProxy, createRef, createRenderEffect, createRoot, createScope, createSelector, createShow, signal as createSignal, createStore, createStyleBinding, createSuspenseToken, createTextBinding, createVersionedSignal, delegateEvents, effectScope, getDevtoolsHook, getPropAlias, insert, insertNodesBefore, isNodeBetweenMarkers, isReactive, mergeProps, moveNodesBefore, onCleanup, onDestroy, onMount, __fictProp as prop, reconcileArrays, removeNodes, render, runInScope, setCycleProtectionOptions, spread, startTransition, template, toNodeArray, untrack, unwrap, useDeferredValue, useProp, useTransition };
|
package/dist/index.d.ts
CHANGED
|
@@ -111,6 +111,10 @@ interface SuspenseToken {
|
|
|
111
111
|
then: Promise<unknown>['then'];
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Effect callback run synchronously; async callbacks are not tracked after the first await.
|
|
116
|
+
* TypeScript will reject `async () => {}` here—split async work or read signals before awaiting.
|
|
117
|
+
*/
|
|
114
118
|
type Effect = () => void | Cleanup;
|
|
115
119
|
declare function createEffect(fn: Effect): () => void;
|
|
116
120
|
declare const $effect: typeof createEffect;
|
|
@@ -142,6 +146,7 @@ interface BindingHandle {
|
|
|
142
146
|
/** Dispose function to clean up the binding */
|
|
143
147
|
dispose: Cleanup;
|
|
144
148
|
}
|
|
149
|
+
/** Managed child node with its dispose function */
|
|
145
150
|
/**
|
|
146
151
|
* Check if a value is reactive (a getter function)
|
|
147
152
|
* Note: Event handlers (functions that take arguments) are NOT reactive values
|
|
@@ -157,28 +162,6 @@ declare function unwrap<T>(value: MaybeReactive<T>): T;
|
|
|
157
162
|
* optional data payload followed by the event.
|
|
158
163
|
*/
|
|
159
164
|
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
165
|
/**
|
|
183
166
|
* Create a text node that reactively updates when the value changes.
|
|
184
167
|
*
|
|
@@ -390,13 +373,6 @@ declare function assign(node: Element, props: Record<string, unknown>, isSVG?: b
|
|
|
390
373
|
* ```
|
|
391
374
|
*/
|
|
392
375
|
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
376
|
/**
|
|
401
377
|
* Create a show/hide binding that uses CSS display instead of DOM manipulation.
|
|
402
378
|
* More efficient than conditional when the content is expensive to create.
|
|
@@ -515,16 +491,6 @@ type PropGetter<T> = (() => T) & {
|
|
|
515
491
|
declare function useProp<T>(getter: () => T): PropGetter<T>;
|
|
516
492
|
|
|
517
493
|
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
494
|
declare function onMount(fn: LifecycleFn): void;
|
|
529
495
|
declare function onDestroy(fn: LifecycleFn): void;
|
|
530
496
|
declare function onCleanup(fn: Cleanup): void;
|
|
@@ -639,7 +605,7 @@ interface CycleProtectionOptions {
|
|
|
639
605
|
enableWindowWarning?: boolean;
|
|
640
606
|
devMode?: boolean;
|
|
641
607
|
}
|
|
642
|
-
declare
|
|
608
|
+
declare let setCycleProtectionOptions: (opts: CycleProtectionOptions) => void;
|
|
643
609
|
|
|
644
610
|
declare const Fragment: unique symbol;
|
|
645
611
|
declare namespace JSX {
|
|
@@ -1374,10 +1340,6 @@ declare function Suspense(props: SuspenseProps): FictNode;
|
|
|
1374
1340
|
* Borrowed from dom-expressions for comprehensive DOM support.
|
|
1375
1341
|
*/
|
|
1376
1342
|
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
1343
|
declare const Properties: Set<string>;
|
|
1382
1344
|
/**
|
|
1383
1345
|
* Properties that represent children/content
|
|
@@ -1391,22 +1353,12 @@ declare const Aliases: Record<string, string>;
|
|
|
1391
1353
|
* Get the property alias for a given attribute and tag name
|
|
1392
1354
|
*/
|
|
1393
1355
|
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
1356
|
declare const DelegatedEvents: Set<string>;
|
|
1399
|
-
/**
|
|
1400
|
-
* SVG element names (excluding common ones that overlap with HTML)
|
|
1401
|
-
*/
|
|
1402
1357
|
declare const SVGElements: Set<string>;
|
|
1403
1358
|
/**
|
|
1404
1359
|
* SVG attribute namespaces
|
|
1405
1360
|
*/
|
|
1406
1361
|
declare const SVGNamespace: Record<string, string>;
|
|
1407
|
-
/**
|
|
1408
|
-
* CSS properties that don't need a unit (like 'px')
|
|
1409
|
-
*/
|
|
1410
1362
|
declare const UnitlessStyles: Set<string>;
|
|
1411
1363
|
|
|
1412
1364
|
/**
|
|
@@ -1482,50 +1434,6 @@ declare function removeNodes(nodes: Node[]): void;
|
|
|
1482
1434
|
* They provide low-level primitives for DOM node manipulation without rebuilding.
|
|
1483
1435
|
*/
|
|
1484
1436
|
|
|
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
1437
|
/**
|
|
1530
1438
|
* Binding handle returned by createKeyedList for compiler-generated code
|
|
1531
1439
|
*/
|
|
@@ -1542,14 +1450,6 @@ interface KeyedListBinding {
|
|
|
1542
1450
|
dispose: () => void;
|
|
1543
1451
|
}
|
|
1544
1452
|
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
1453
|
/**
|
|
1554
1454
|
* Move nodes to a position before the anchor node.
|
|
1555
1455
|
* This is optimized to avoid unnecessary DOM operations.
|
|
@@ -1559,40 +1459,6 @@ interface MarkerBlock {
|
|
|
1559
1459
|
* @param anchor - Node to insert before (or null for end)
|
|
1560
1460
|
*/
|
|
1561
1461
|
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
1462
|
/**
|
|
1597
1463
|
* Check if a node is between two markers
|
|
1598
1464
|
*/
|
|
@@ -1608,4 +1474,4 @@ declare function isNodeBetweenMarkers(node: Node, startMarker: Comment, endMarke
|
|
|
1608
1474
|
*/
|
|
1609
1475
|
declare function createKeyedList<T>(getItems: () => T[], keyFn: (item: T, index: number) => string | number, renderItem: FineGrainedRenderItem<T>, needsIndex?: boolean): KeyedListBinding;
|
|
1610
1476
|
|
|
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
|
|
1477
|
+
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 KeyedListBinding, 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, createKeyedList, createMemo, createPortal, createPropsProxy, createRef, createRenderEffect, createRoot, createScope, createSelector, createShow, signal as createSignal, createStore, createStyleBinding, createSuspenseToken, createTextBinding, createVersionedSignal, delegateEvents, effectScope, getDevtoolsHook, getPropAlias, insert, insertNodesBefore, isNodeBetweenMarkers, isReactive, mergeProps, moveNodesBefore, onCleanup, onDestroy, onMount, __fictProp as prop, reconcileArrays, removeNodes, render, runInScope, setCycleProtectionOptions, spread, startTransition, template, toNodeArray, untrack, unwrap, useDeferredValue, useProp, useTransition };
|