@fictjs/runtime 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -0
- package/dist/advanced.cjs +9 -9
- package/dist/advanced.d.cts +4 -4
- package/dist/advanced.d.ts +4 -4
- package/dist/advanced.js +4 -4
- package/dist/{effect-DAzpH7Mm.d.cts → binding-BWchH3Kp.d.cts} +33 -24
- package/dist/{effect-DAzpH7Mm.d.ts → binding-BWchH3Kp.d.ts} +33 -24
- package/dist/{chunk-7YQK3XKY.js → chunk-DXG3TARY.js} +520 -518
- package/dist/chunk-DXG3TARY.js.map +1 -0
- package/dist/{chunk-TLDT76RV.js → chunk-FVX77557.js} +3 -3
- package/dist/{chunk-WRU3IZOA.js → chunk-JVYH76ZX.js} +3 -3
- package/dist/chunk-LBE6DC3V.cjs +768 -0
- package/dist/chunk-LBE6DC3V.cjs.map +1 -0
- package/dist/chunk-N6ODUM2Y.js +768 -0
- package/dist/chunk-N6ODUM2Y.js.map +1 -0
- package/dist/{chunk-PRF4QG73.cjs → chunk-OAM7HABA.cjs} +423 -246
- package/dist/chunk-OAM7HABA.cjs.map +1 -0
- package/dist/{chunk-CEV6TO5U.cjs → chunk-PD6IQY2Y.cjs} +8 -8
- package/dist/{chunk-CEV6TO5U.cjs.map → chunk-PD6IQY2Y.cjs.map} +1 -1
- package/dist/{chunk-HHDHQGJY.cjs → chunk-PG4QX2I2.cjs} +17 -17
- package/dist/{chunk-HHDHQGJY.cjs.map → chunk-PG4QX2I2.cjs.map} +1 -1
- package/dist/{chunk-4LCHQ7U4.js → chunk-T2LNV5Q5.js} +271 -94
- package/dist/chunk-T2LNV5Q5.js.map +1 -0
- package/dist/{chunk-FSCBL7RI.cjs → chunk-UBFDB6OL.cjs} +521 -519
- package/dist/chunk-UBFDB6OL.cjs.map +1 -0
- package/dist/{context-C4vBQbb4.d.ts → devtools-5AipK9CX.d.cts} +35 -35
- package/dist/{context-BFbHf9nC.d.cts → devtools-BDp76luf.d.ts} +35 -35
- package/dist/index.cjs +42 -42
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.dev.js +3 -3
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/internal-list.cjs +12 -0
- package/dist/internal-list.cjs.map +1 -0
- package/dist/internal-list.d.cts +2 -0
- package/dist/internal-list.d.ts +2 -0
- package/dist/internal-list.js +12 -0
- package/dist/internal-list.js.map +1 -0
- package/dist/internal.cjs +6 -746
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +6 -74
- package/dist/internal.d.ts +6 -74
- package/dist/internal.js +12 -752
- package/dist/internal.js.map +1 -1
- package/dist/list-DL5DOFcO.d.ts +71 -0
- package/dist/list-hP7hQ9Vk.d.cts +71 -0
- package/dist/loader.cjs +94 -15
- package/dist/loader.cjs.map +1 -1
- package/dist/loader.d.cts +16 -2
- package/dist/loader.d.ts +16 -2
- package/dist/loader.js +87 -8
- package/dist/loader.js.map +1 -1
- package/dist/{props-84UJeWO8.d.cts → props-BpZz0AOq.d.cts} +2 -2
- package/dist/{props-BRhFK50f.d.ts → props-CjLH0JE-.d.ts} +2 -2
- package/dist/{resume-i-A3EFox.d.cts → resume-BJ4oHLi_.d.cts} +3 -1
- package/dist/{resume-CqeQ3v_q.d.ts → resume-CuyJWXP_.d.ts} +3 -1
- package/dist/{scope-DlCBL1Ft.d.cts → scope-BJCtq8hJ.d.cts} +1 -1
- package/dist/{scope-D3DpsfoG.d.ts → scope-jPt5DHRT.d.ts} +1 -1
- package/package.json +8 -1
- package/src/binding.ts +113 -36
- package/src/cycle-guard.ts +3 -3
- package/src/internal/list.ts +7 -0
- package/src/internal.ts +1 -0
- package/src/list-helpers.ts +1 -1
- package/src/loader.ts +119 -9
- package/src/resume.ts +6 -3
- package/src/signal.ts +8 -1
- package/dist/chunk-4LCHQ7U4.js.map +0 -1
- package/dist/chunk-7YQK3XKY.js.map +0 -1
- package/dist/chunk-FSCBL7RI.cjs.map +0 -1
- package/dist/chunk-PRF4QG73.cjs.map +0 -1
- /package/dist/{chunk-TLDT76RV.js.map → chunk-FVX77557.js.map} +0 -0
- /package/dist/{chunk-WRU3IZOA.js.map → chunk-JVYH76ZX.js.map} +0 -0
package/README.md
CHANGED
|
@@ -15,3 +15,49 @@ yarn add @fictjs/runtime
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
You can visit [Fict](https://github.com/fictjs/fict) for more documentation.
|
|
18
|
+
|
|
19
|
+
## Dev/Prod Mode Contract (`__DEV__`)
|
|
20
|
+
|
|
21
|
+
Runtime dev-only branches use this precedence:
|
|
22
|
+
|
|
23
|
+
1. `__DEV__` (recommended, compile-time constant)
|
|
24
|
+
2. Fallback: `process.env.NODE_ENV !== 'production'` when `process` exists
|
|
25
|
+
|
|
26
|
+
For browser builds, define `__DEV__` explicitly in your bundler for predictable
|
|
27
|
+
DX and dead-code elimination:
|
|
28
|
+
|
|
29
|
+
- development: `__DEV__ = true`
|
|
30
|
+
- production: `__DEV__ = false`
|
|
31
|
+
|
|
32
|
+
## Runtime Stability Stress
|
|
33
|
+
|
|
34
|
+
Run stress scenarios for runtime correctness and reliability:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pnpm --dir packages/runtime test:stress
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Long profile:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pnpm --dir packages/runtime test:stress:long
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Root aliases are also available:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pnpm stress:runtime
|
|
50
|
+
pnpm stress:runtime:long
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Environment knobs:
|
|
54
|
+
|
|
55
|
+
- `FICT_RUNTIME_SOAK_ITERS`
|
|
56
|
+
- `FICT_RUNTIME_CHURN_CYCLES`
|
|
57
|
+
- `FICT_RUNTIME_CHURN_LIST_SIZE`
|
|
58
|
+
- `FICT_RUNTIME_LEAK_ROUNDS`
|
|
59
|
+
- `FICT_RUNTIME_LEAK_EFFECTS_PER_ROUND`
|
|
60
|
+
- `FICT_RUNTIME_MAX_HEAP_GROWTH_BYTES`
|
|
61
|
+
- `FICT_RUNTIME_BACKPRESSURE_UPDATES`
|
|
62
|
+
- `FICT_RUNTIME_BACKPRESSURE_TIMEOUT_MS`
|
|
63
|
+
- `FICT_RUNTIME_MAX_DRAIN_LATENCY_MS`
|
package/dist/advanced.cjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkPG4QX2I2cjs = require('./chunk-PG4QX2I2.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkPD6IQY2Ycjs = require('./chunk-PD6IQY2Y.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -18,7 +18,7 @@ var _chunkCEV6TO5Ucjs = require('./chunk-CEV6TO5U.cjs');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkOAM7HABAcjs = require('./chunk-OAM7HABA.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -28,13 +28,13 @@ var _chunkPRF4QG73cjs = require('./chunk-PRF4QG73.cjs');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunkUBFDB6OLcjs = require('./chunk-UBFDB6OL.cjs');
|
|
32
32
|
|
|
33
33
|
// src/versioned-signal.ts
|
|
34
34
|
function createVersionedSignal(initialValue, options) {
|
|
35
35
|
const equals = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _ => _.equals]), () => ( Object.is));
|
|
36
|
-
const value =
|
|
37
|
-
const version =
|
|
36
|
+
const value = _chunkUBFDB6OLcjs.signal.call(void 0, initialValue);
|
|
37
|
+
const version = _chunkUBFDB6OLcjs.signal.call(void 0, 0);
|
|
38
38
|
const bumpVersion = () => {
|
|
39
39
|
const next = version() + 1;
|
|
40
40
|
version(next);
|
|
@@ -55,8 +55,8 @@ function createVersionedSignal(initialValue, options) {
|
|
|
55
55
|
force: () => {
|
|
56
56
|
bumpVersion();
|
|
57
57
|
},
|
|
58
|
-
peekVersion: () =>
|
|
59
|
-
peekValue: () =>
|
|
58
|
+
peekVersion: () => _chunkUBFDB6OLcjs.untrack.call(void 0, () => version()),
|
|
59
|
+
peekValue: () => _chunkUBFDB6OLcjs.untrack.call(void 0, () => value())
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -83,5 +83,5 @@ function createVersionedSignal(initialValue, options) {
|
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
exports.createAttributeBinding =
|
|
86
|
+
exports.createAttributeBinding = _chunkOAM7HABAcjs.createAttributeBinding; exports.createChildBinding = _chunkOAM7HABAcjs.createChildBinding; exports.createClassBinding = _chunkOAM7HABAcjs.createClassBinding; exports.createContext = _chunkPG4QX2I2cjs.createContext; exports.createRenderEffect = _chunkUBFDB6OLcjs.createRenderEffect; exports.createScope = _chunkPD6IQY2Ycjs.createScope; exports.createSelector = _chunkUBFDB6OLcjs.createSelector; exports.createShow = _chunkOAM7HABAcjs.createShow; exports.createSignal = _chunkUBFDB6OLcjs.signal; exports.createStyleBinding = _chunkOAM7HABAcjs.createStyleBinding; exports.createTextBinding = _chunkOAM7HABAcjs.createTextBinding; exports.createVersionedSignal = createVersionedSignal; exports.effectScope = _chunkUBFDB6OLcjs.effectScope; exports.getDevtoolsHook = _chunkUBFDB6OLcjs.getDevtoolsHook; exports.hasContext = _chunkPG4QX2I2cjs.hasContext; exports.isReactive = _chunkOAM7HABAcjs.isReactive; exports.nonReactive = _chunkOAM7HABAcjs.nonReactive; exports.reactive = _chunkOAM7HABAcjs.reactive; exports.registerErrorHandler = _chunkUBFDB6OLcjs.registerErrorHandler; exports.runInScope = _chunkPD6IQY2Ycjs.runInScope; exports.setCycleProtectionOptions = _chunkUBFDB6OLcjs.setCycleProtectionOptions; exports.unwrap = _chunkOAM7HABAcjs.unwrap; exports.useContext = _chunkPG4QX2I2cjs.useContext;
|
|
87
87
|
//# sourceMappingURL=advanced.cjs.map
|
package/dist/advanced.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { R as ReactiveScope, c as createScope, r as runInScope } from './scope-
|
|
1
|
+
export { R as ReactiveScope, c as createScope, r as runInScope } from './scope-BJCtq8hJ.cjs';
|
|
2
2
|
export { S as Signal, c as createSelector, s as createSignal, e as effectScope } from './signal-C4ISF17w.cjs';
|
|
3
|
-
export { b as createAttributeBinding, a as createChildBinding, e as createClassBinding, h as createRenderEffect, f as createShow, d as createStyleBinding, c as createTextBinding, i as isReactive, n as nonReactive, r as reactive, g as registerErrorHandler, u as unwrap } from './
|
|
4
|
-
export { C as Context, F as FictDevtoolsHook, P as ProviderProps, c as createContext, g as getDevtoolsHook, h as hasContext, u as useContext } from './
|
|
3
|
+
export { b as createAttributeBinding, a as createChildBinding, e as createClassBinding, h as createRenderEffect, f as createShow, d as createStyleBinding, c as createTextBinding, i as isReactive, n as nonReactive, r as reactive, g as registerErrorHandler, u as unwrap } from './binding-BWchH3Kp.cjs';
|
|
4
|
+
export { C as Context, F as FictDevtoolsHook, P as ProviderProps, c as createContext, g as getDevtoolsHook, h as hasContext, u as useContext } from './devtools-5AipK9CX.cjs';
|
|
5
5
|
|
|
6
6
|
interface VersionedSignalOptions<T> {
|
|
7
7
|
equals?: (prev: T, next: T) => boolean;
|
|
@@ -26,7 +26,7 @@ interface VersionedSignal<T> {
|
|
|
26
26
|
declare function createVersionedSignal<T>(initialValue: T, options?: VersionedSignalOptions<T>): VersionedSignal<T>;
|
|
27
27
|
|
|
28
28
|
interface CycleProtectionOptions {
|
|
29
|
-
/** Enable cycle protection guards (enabled by default in
|
|
29
|
+
/** Enable cycle protection guards (enabled by default in dev mode) */
|
|
30
30
|
enabled?: boolean;
|
|
31
31
|
maxFlushCyclesPerMicrotask?: number;
|
|
32
32
|
maxEffectRunsPerFlush?: number;
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { R as ReactiveScope, c as createScope, r as runInScope } from './scope-
|
|
1
|
+
export { R as ReactiveScope, c as createScope, r as runInScope } from './scope-jPt5DHRT.js';
|
|
2
2
|
export { S as Signal, c as createSelector, s as createSignal, e as effectScope } from './signal-C4ISF17w.js';
|
|
3
|
-
export { b as createAttributeBinding, a as createChildBinding, e as createClassBinding, h as createRenderEffect, f as createShow, d as createStyleBinding, c as createTextBinding, i as isReactive, n as nonReactive, r as reactive, g as registerErrorHandler, u as unwrap } from './
|
|
4
|
-
export { C as Context, F as FictDevtoolsHook, P as ProviderProps, c as createContext, g as getDevtoolsHook, h as hasContext, u as useContext } from './
|
|
3
|
+
export { b as createAttributeBinding, a as createChildBinding, e as createClassBinding, h as createRenderEffect, f as createShow, d as createStyleBinding, c as createTextBinding, i as isReactive, n as nonReactive, r as reactive, g as registerErrorHandler, u as unwrap } from './binding-BWchH3Kp.js';
|
|
4
|
+
export { C as Context, F as FictDevtoolsHook, P as ProviderProps, c as createContext, g as getDevtoolsHook, h as hasContext, u as useContext } from './devtools-BDp76luf.js';
|
|
5
5
|
|
|
6
6
|
interface VersionedSignalOptions<T> {
|
|
7
7
|
equals?: (prev: T, next: T) => boolean;
|
|
@@ -26,7 +26,7 @@ interface VersionedSignal<T> {
|
|
|
26
26
|
declare function createVersionedSignal<T>(initialValue: T, options?: VersionedSignalOptions<T>): VersionedSignal<T>;
|
|
27
27
|
|
|
28
28
|
interface CycleProtectionOptions {
|
|
29
|
-
/** Enable cycle protection guards (enabled by default in
|
|
29
|
+
/** Enable cycle protection guards (enabled by default in dev mode) */
|
|
30
30
|
enabled?: boolean;
|
|
31
31
|
maxFlushCyclesPerMicrotask?: number;
|
|
32
32
|
maxEffectRunsPerFlush?: number;
|
package/dist/advanced.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
createContext,
|
|
3
3
|
hasContext,
|
|
4
4
|
useContext
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JVYH76ZX.js";
|
|
6
6
|
import {
|
|
7
7
|
createScope,
|
|
8
8
|
runInScope
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FVX77557.js";
|
|
10
10
|
import {
|
|
11
11
|
createAttributeBinding,
|
|
12
12
|
createChildBinding,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
nonReactive,
|
|
19
19
|
reactive,
|
|
20
20
|
unwrap
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-T2LNV5Q5.js";
|
|
22
22
|
import {
|
|
23
23
|
createRenderEffect,
|
|
24
24
|
createSelector,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
setCycleProtectionOptions,
|
|
29
29
|
signal,
|
|
30
30
|
untrack
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-DXG3TARY.js";
|
|
32
32
|
|
|
33
33
|
// src/versioned-signal.ts
|
|
34
34
|
function createVersionedSignal(initialValue, options) {
|
|
@@ -60,6 +60,28 @@ interface SuspenseToken {
|
|
|
60
60
|
then: Promise<unknown>['then'];
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
type LifecycleFn = () => void | Cleanup;
|
|
64
|
+
interface CreateRootOptions {
|
|
65
|
+
inherit?: boolean;
|
|
66
|
+
}
|
|
67
|
+
type ErrorHandler = (err: unknown, info?: ErrorInfo) => boolean | void;
|
|
68
|
+
declare function onMount(fn: LifecycleFn): void;
|
|
69
|
+
declare function onDestroy(fn: LifecycleFn): void;
|
|
70
|
+
declare function onCleanup(fn: Cleanup): void;
|
|
71
|
+
declare function createRoot<T>(fn: () => T, options?: CreateRootOptions): {
|
|
72
|
+
dispose: () => void;
|
|
73
|
+
value: T;
|
|
74
|
+
};
|
|
75
|
+
declare function registerErrorHandler(fn: ErrorHandler): void;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Effect callback run synchronously; async callbacks are not tracked after the first await.
|
|
79
|
+
* TypeScript will reject `async () => {}` here—split async work or read signals before awaiting.
|
|
80
|
+
*/
|
|
81
|
+
type Effect = () => void | Cleanup;
|
|
82
|
+
declare function createEffect(fn: Effect): () => void;
|
|
83
|
+
declare function createRenderEffect(fn: Effect): () => void;
|
|
84
|
+
|
|
63
85
|
/**
|
|
64
86
|
* Fict Reactive DOM Binding System
|
|
65
87
|
*
|
|
@@ -86,6 +108,15 @@ interface BindingHandle {
|
|
|
86
108
|
/** Dispose function to clean up the binding */
|
|
87
109
|
dispose: Cleanup;
|
|
88
110
|
}
|
|
111
|
+
interface ConditionalBindingOptions {
|
|
112
|
+
/**
|
|
113
|
+
* When true, track signal reads inside active branch render callbacks and
|
|
114
|
+
* re-run the branch callback on updates even if the top-level condition stays
|
|
115
|
+
* the same. This preserves reactivity for control-flow callbacks that cannot
|
|
116
|
+
* be lowered into fine-grained bindings.
|
|
117
|
+
*/
|
|
118
|
+
trackBranchReads?: boolean;
|
|
119
|
+
}
|
|
89
120
|
/** Managed child node with its dispose function */
|
|
90
121
|
/**
|
|
91
122
|
* Check if a value is reactive (a getter function that returns a value).
|
|
@@ -370,7 +401,7 @@ declare function assign(node: Element, props: Record<string, unknown>, isSVG?: b
|
|
|
370
401
|
* )
|
|
371
402
|
* ```
|
|
372
403
|
*/
|
|
373
|
-
declare function createConditional(condition: () => boolean, renderTrue: () => FictNode, createElementFn: CreateElementFn, renderFalse?: () => FictNode, startOverride?: Comment, endOverride?: Comment): BindingHandle;
|
|
404
|
+
declare function createConditional(condition: () => boolean, renderTrue: () => FictNode, createElementFn: CreateElementFn, renderFalse?: () => FictNode, startOverride?: Comment, endOverride?: Comment, options?: ConditionalBindingOptions): BindingHandle;
|
|
374
405
|
/**
|
|
375
406
|
* Create a show/hide binding that uses CSS display instead of DOM manipulation.
|
|
376
407
|
* More efficient than conditional when the content is expensive to create.
|
|
@@ -397,26 +428,4 @@ declare function createShow(el: Element & {
|
|
|
397
428
|
*/
|
|
398
429
|
declare function createPortal(container: ParentNode & Node, render: () => FictNode, createElementFn: CreateElementFn): BindingHandle;
|
|
399
430
|
|
|
400
|
-
type
|
|
401
|
-
interface CreateRootOptions {
|
|
402
|
-
inherit?: boolean;
|
|
403
|
-
}
|
|
404
|
-
type ErrorHandler = (err: unknown, info?: ErrorInfo) => boolean | void;
|
|
405
|
-
declare function onMount(fn: LifecycleFn): void;
|
|
406
|
-
declare function onDestroy(fn: LifecycleFn): void;
|
|
407
|
-
declare function onCleanup(fn: Cleanup): void;
|
|
408
|
-
declare function createRoot<T>(fn: () => T, options?: CreateRootOptions): {
|
|
409
|
-
dispose: () => void;
|
|
410
|
-
value: T;
|
|
411
|
-
};
|
|
412
|
-
declare function registerErrorHandler(fn: ErrorHandler): void;
|
|
413
|
-
|
|
414
|
-
/**
|
|
415
|
-
* Effect callback run synchronously; async callbacks are not tracked after the first await.
|
|
416
|
-
* TypeScript will reject `async () => {}` here—split async work or read signals before awaiting.
|
|
417
|
-
*/
|
|
418
|
-
type Effect = () => void | Cleanup;
|
|
419
|
-
declare function createEffect(fn: Effect): () => void;
|
|
420
|
-
declare function createRenderEffect(fn: Effect): () => void;
|
|
421
|
-
|
|
422
|
-
export { delegateEvents as $, bindText as A, type BaseProps as B, type Cleanup as C, type DOMElement as D, type Effect as E, type FictNode as F, bindAttribute as G, bindStyle as H, bindClass as I, setText as J, setAttr as K, setProp as L, setStyle as M, setClass as N, bindEvent as O, type PropsWithChildren as P, callEventHandler as Q, type RefObject as R, type SuspenseToken as S, bindProperty as T, bindRef as U, insert as V, insertBetween as W, createConditional as X, spread as Y, assign as Z, classList as _, createChildBinding as a, clearDelegatedEvents as a0, addEventListener as a1, type MaybeReactive as a2, type BindingHandle as a3, type CreateElementFn as a4, type AttributeSetter as a5, createAttributeBinding as b, createTextBinding as c, createStyleBinding as d, createClassBinding as e, createShow as f, registerErrorHandler as g, createRenderEffect as h, isReactive as i, createEffect as j, onDestroy as k, onCleanup as l, createRoot as m, nonReactive as n, onMount as o, createPortal as p, type FictVNode as q, reactive as r, type Component as s, type Ref as t, unwrap as u, type RefCallback as v, type StyleProp as w, type ClassProp as x, type EventHandler as y, type ErrorInfo as z };
|
|
431
|
+
export { type PropsWithChildren as $, insert as A, type BaseProps as B, insertBetween as C, createConditional as D, createPortal as E, type FictNode as F, spread as G, assign as H, classList as I, delegateEvents as J, clearDelegatedEvents as K, addEventListener as L, type MaybeReactive as M, onDestroy as N, type BindingHandle as O, type CreateElementFn as P, type AttributeSetter as Q, type DOMElement as R, type RefObject as S, type SuspenseToken as T, type Effect as U, onMount as V, onCleanup as W, createRoot as X, type FictVNode as Y, type Cleanup as Z, type Component as _, createChildBinding as a, type Ref as a0, type RefCallback as a1, type StyleProp as a2, type ClassProp as a3, type EventHandler as a4, type ErrorInfo as a5, createAttributeBinding as b, createTextBinding as c, createStyleBinding as d, createClassBinding as e, createShow as f, registerErrorHandler as g, createRenderEffect as h, isReactive as i, createEffect as j, bindText as k, bindAttribute as l, bindStyle as m, nonReactive as n, bindClass as o, setAttr as p, setProp as q, reactive as r, setText as s, setStyle as t, unwrap as u, setClass as v, bindEvent as w, callEventHandler as x, bindProperty as y, bindRef as z };
|
|
@@ -60,6 +60,28 @@ interface SuspenseToken {
|
|
|
60
60
|
then: Promise<unknown>['then'];
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
type LifecycleFn = () => void | Cleanup;
|
|
64
|
+
interface CreateRootOptions {
|
|
65
|
+
inherit?: boolean;
|
|
66
|
+
}
|
|
67
|
+
type ErrorHandler = (err: unknown, info?: ErrorInfo) => boolean | void;
|
|
68
|
+
declare function onMount(fn: LifecycleFn): void;
|
|
69
|
+
declare function onDestroy(fn: LifecycleFn): void;
|
|
70
|
+
declare function onCleanup(fn: Cleanup): void;
|
|
71
|
+
declare function createRoot<T>(fn: () => T, options?: CreateRootOptions): {
|
|
72
|
+
dispose: () => void;
|
|
73
|
+
value: T;
|
|
74
|
+
};
|
|
75
|
+
declare function registerErrorHandler(fn: ErrorHandler): void;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Effect callback run synchronously; async callbacks are not tracked after the first await.
|
|
79
|
+
* TypeScript will reject `async () => {}` here—split async work or read signals before awaiting.
|
|
80
|
+
*/
|
|
81
|
+
type Effect = () => void | Cleanup;
|
|
82
|
+
declare function createEffect(fn: Effect): () => void;
|
|
83
|
+
declare function createRenderEffect(fn: Effect): () => void;
|
|
84
|
+
|
|
63
85
|
/**
|
|
64
86
|
* Fict Reactive DOM Binding System
|
|
65
87
|
*
|
|
@@ -86,6 +108,15 @@ interface BindingHandle {
|
|
|
86
108
|
/** Dispose function to clean up the binding */
|
|
87
109
|
dispose: Cleanup;
|
|
88
110
|
}
|
|
111
|
+
interface ConditionalBindingOptions {
|
|
112
|
+
/**
|
|
113
|
+
* When true, track signal reads inside active branch render callbacks and
|
|
114
|
+
* re-run the branch callback on updates even if the top-level condition stays
|
|
115
|
+
* the same. This preserves reactivity for control-flow callbacks that cannot
|
|
116
|
+
* be lowered into fine-grained bindings.
|
|
117
|
+
*/
|
|
118
|
+
trackBranchReads?: boolean;
|
|
119
|
+
}
|
|
89
120
|
/** Managed child node with its dispose function */
|
|
90
121
|
/**
|
|
91
122
|
* Check if a value is reactive (a getter function that returns a value).
|
|
@@ -370,7 +401,7 @@ declare function assign(node: Element, props: Record<string, unknown>, isSVG?: b
|
|
|
370
401
|
* )
|
|
371
402
|
* ```
|
|
372
403
|
*/
|
|
373
|
-
declare function createConditional(condition: () => boolean, renderTrue: () => FictNode, createElementFn: CreateElementFn, renderFalse?: () => FictNode, startOverride?: Comment, endOverride?: Comment): BindingHandle;
|
|
404
|
+
declare function createConditional(condition: () => boolean, renderTrue: () => FictNode, createElementFn: CreateElementFn, renderFalse?: () => FictNode, startOverride?: Comment, endOverride?: Comment, options?: ConditionalBindingOptions): BindingHandle;
|
|
374
405
|
/**
|
|
375
406
|
* Create a show/hide binding that uses CSS display instead of DOM manipulation.
|
|
376
407
|
* More efficient than conditional when the content is expensive to create.
|
|
@@ -397,26 +428,4 @@ declare function createShow(el: Element & {
|
|
|
397
428
|
*/
|
|
398
429
|
declare function createPortal(container: ParentNode & Node, render: () => FictNode, createElementFn: CreateElementFn): BindingHandle;
|
|
399
430
|
|
|
400
|
-
type
|
|
401
|
-
interface CreateRootOptions {
|
|
402
|
-
inherit?: boolean;
|
|
403
|
-
}
|
|
404
|
-
type ErrorHandler = (err: unknown, info?: ErrorInfo) => boolean | void;
|
|
405
|
-
declare function onMount(fn: LifecycleFn): void;
|
|
406
|
-
declare function onDestroy(fn: LifecycleFn): void;
|
|
407
|
-
declare function onCleanup(fn: Cleanup): void;
|
|
408
|
-
declare function createRoot<T>(fn: () => T, options?: CreateRootOptions): {
|
|
409
|
-
dispose: () => void;
|
|
410
|
-
value: T;
|
|
411
|
-
};
|
|
412
|
-
declare function registerErrorHandler(fn: ErrorHandler): void;
|
|
413
|
-
|
|
414
|
-
/**
|
|
415
|
-
* Effect callback run synchronously; async callbacks are not tracked after the first await.
|
|
416
|
-
* TypeScript will reject `async () => {}` here—split async work or read signals before awaiting.
|
|
417
|
-
*/
|
|
418
|
-
type Effect = () => void | Cleanup;
|
|
419
|
-
declare function createEffect(fn: Effect): () => void;
|
|
420
|
-
declare function createRenderEffect(fn: Effect): () => void;
|
|
421
|
-
|
|
422
|
-
export { delegateEvents as $, bindText as A, type BaseProps as B, type Cleanup as C, type DOMElement as D, type Effect as E, type FictNode as F, bindAttribute as G, bindStyle as H, bindClass as I, setText as J, setAttr as K, setProp as L, setStyle as M, setClass as N, bindEvent as O, type PropsWithChildren as P, callEventHandler as Q, type RefObject as R, type SuspenseToken as S, bindProperty as T, bindRef as U, insert as V, insertBetween as W, createConditional as X, spread as Y, assign as Z, classList as _, createChildBinding as a, clearDelegatedEvents as a0, addEventListener as a1, type MaybeReactive as a2, type BindingHandle as a3, type CreateElementFn as a4, type AttributeSetter as a5, createAttributeBinding as b, createTextBinding as c, createStyleBinding as d, createClassBinding as e, createShow as f, registerErrorHandler as g, createRenderEffect as h, isReactive as i, createEffect as j, onDestroy as k, onCleanup as l, createRoot as m, nonReactive as n, onMount as o, createPortal as p, type FictVNode as q, reactive as r, type Component as s, type Ref as t, unwrap as u, type RefCallback as v, type StyleProp as w, type ClassProp as x, type EventHandler as y, type ErrorInfo as z };
|
|
431
|
+
export { type PropsWithChildren as $, insert as A, type BaseProps as B, insertBetween as C, createConditional as D, createPortal as E, type FictNode as F, spread as G, assign as H, classList as I, delegateEvents as J, clearDelegatedEvents as K, addEventListener as L, type MaybeReactive as M, onDestroy as N, type BindingHandle as O, type CreateElementFn as P, type AttributeSetter as Q, type DOMElement as R, type RefObject as S, type SuspenseToken as T, type Effect as U, onMount as V, onCleanup as W, createRoot as X, type FictVNode as Y, type Cleanup as Z, type Component as _, createChildBinding as a, type Ref as a0, type RefCallback as a1, type StyleProp as a2, type ClassProp as a3, type EventHandler as a4, type ErrorInfo as a5, createAttributeBinding as b, createTextBinding as c, createStyleBinding as d, createClassBinding as e, createShow as f, registerErrorHandler as g, createRenderEffect as h, isReactive as i, createEffect as j, bindText as k, bindAttribute as l, bindStyle as m, nonReactive as n, bindClass as o, setAttr as p, setProp as q, reactive as r, setText as s, setStyle as t, unwrap as u, setClass as v, bindEvent as w, callEventHandler as x, bindProperty as y, bindRef as z };
|