@shadow-js/core 1.0.0 → 1.0.1
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/CHANGELOG.md +6 -0
- package/dist/dev/action.d.ts +0 -2
- package/dist/dev/action.js +1 -2
- package/dist/dev/cache.d.ts +0 -2
- package/dist/dev/cache.js +1 -2
- package/dist/dev/context.d.ts +0 -2
- package/dist/dev/context.js +1 -2
- package/dist/dev/effect.d.ts +0 -2
- package/dist/dev/effect.js +1 -2
- package/dist/dev/env.d.ts +0 -2
- package/dist/dev/env.js +1 -2
- package/dist/dev/events.d.ts +0 -2
- package/dist/dev/events.js +1 -2
- package/dist/dev/extend/index.d.ts +0 -2
- package/dist/dev/extend/index.js +1 -2
- package/dist/dev/external-store.d.ts +0 -2
- package/dist/dev/external-store.js +1 -2
- package/dist/dev/internal/concurrency.d.ts +0 -2
- package/dist/dev/internal/concurrency.js +1 -2
- package/dist/dev/internal/devtools.d.ts +0 -2
- package/dist/dev/internal/devtools.js +1 -2
- package/dist/dev/internal/diagnostics.d.ts +0 -2
- package/dist/dev/internal/diagnostics.js +1 -2
- package/dist/dev/internal/dispose.d.ts +0 -2
- package/dist/dev/internal/dispose.js +1 -2
- package/dist/dev/internal/flags.js +1 -2
- package/dist/dev/internal/graph.d.ts +0 -2
- package/dist/dev/internal/graph.js +1 -2
- package/dist/dev/internal/hydration-flag.d.ts +0 -2
- package/dist/dev/internal/hydration-flag.js +1 -2
- package/dist/dev/internal/messages.d.ts +0 -2
- package/dist/dev/internal/messages.js +1 -2
- package/dist/dev/internal/owner.d.ts +0 -2
- package/dist/dev/internal/owner.js +1 -2
- package/dist/dev/internal/queue.js +1 -2
- package/dist/dev/internal/scheduler.d.ts +0 -2
- package/dist/dev/internal/scheduler.js +1 -2
- package/dist/dev/internal/state.d.ts +0 -2
- package/dist/dev/internal/state.js +1 -2
- package/dist/dev/internal/suspension.d.ts +0 -2
- package/dist/dev/internal/suspension.js +1 -2
- package/dist/dev/internal/types.d.ts +0 -2
- package/dist/dev/list.d.ts +0 -2
- package/dist/dev/list.js +1 -2
- package/dist/dev/memo.d.ts +0 -2
- package/dist/dev/memo.js +1 -2
- package/dist/dev/optimistic.d.ts +0 -2
- package/dist/dev/optimistic.js +1 -2
- package/dist/dev/ownership.d.ts +0 -2
- package/dist/dev/ownership.js +1 -2
- package/dist/dev/props.d.ts +0 -2
- package/dist/dev/props.js +1 -2
- package/dist/dev/reaction.d.ts +0 -2
- package/dist/dev/reaction.js +1 -2
- package/dist/dev/reducer.d.ts +0 -2
- package/dist/dev/reducer.js +1 -2
- package/dist/dev/refs.d.ts +0 -2
- package/dist/dev/refs.js +1 -2
- package/dist/dev/resource.d.ts +0 -2
- package/dist/dev/resource.js +1 -2
- package/dist/dev/selector.d.ts +0 -2
- package/dist/dev/selector.js +1 -2
- package/dist/dev/signal.d.ts +0 -2
- package/dist/dev/signal.js +1 -2
- package/dist/dev/store/nodes.js +1 -2
- package/dist/dev/store/proxies.js +1 -2
- package/dist/dev/store/read.d.ts +0 -2
- package/dist/dev/store/read.js +1 -2
- package/dist/dev/store/reconcile.d.ts +0 -2
- package/dist/dev/store/reconcile.js +1 -2
- package/dist/dev/store/types.d.ts +0 -2
- package/dist/dev/store/use-store.d.ts +0 -2
- package/dist/dev/store/use-store.js +1 -2
- package/dist/dev/suspense.d.ts +0 -2
- package/dist/dev/suspense.js +1 -2
- package/dist/dev/transitions.d.ts +0 -2
- package/dist/dev/transitions.js +1 -2
- package/dist/server-dev/action.js +1 -2
- package/dist/server-dev/cache.js +1 -2
- package/dist/server-dev/context.js +1 -2
- package/dist/server-dev/effect.js +1 -2
- package/dist/server-dev/env.js +1 -2
- package/dist/server-dev/events.js +1 -2
- package/dist/server-dev/extend/index.js +1 -2
- package/dist/server-dev/external-store.js +1 -2
- package/dist/server-dev/internal/concurrency.js +1 -2
- package/dist/server-dev/internal/devtools.js +1 -2
- package/dist/server-dev/internal/diagnostics.js +1 -2
- package/dist/server-dev/internal/dispose.js +1 -2
- package/dist/server-dev/internal/flags.js +1 -2
- package/dist/server-dev/internal/graph.js +1 -2
- package/dist/server-dev/internal/hydration-flag.js +1 -2
- package/dist/server-dev/internal/messages.js +1 -2
- package/dist/server-dev/internal/owner.js +1 -2
- package/dist/server-dev/internal/queue.js +1 -2
- package/dist/server-dev/internal/scheduler.js +1 -2
- package/dist/server-dev/internal/state.js +1 -2
- package/dist/server-dev/internal/suspension.js +1 -2
- package/dist/server-dev/list.js +1 -2
- package/dist/server-dev/memo.js +1 -2
- package/dist/server-dev/optimistic.js +1 -2
- package/dist/server-dev/ownership.js +1 -2
- package/dist/server-dev/props.js +1 -2
- package/dist/server-dev/reaction.js +1 -2
- package/dist/server-dev/reducer.js +1 -2
- package/dist/server-dev/refs.js +1 -2
- package/dist/server-dev/resource.js +1 -2
- package/dist/server-dev/selector.js +1 -2
- package/dist/server-dev/signal.js +1 -2
- package/dist/server-dev/store/nodes.js +1 -2
- package/dist/server-dev/store/proxies.js +1 -2
- package/dist/server-dev/store/read.js +1 -2
- package/dist/server-dev/store/reconcile.js +1 -2
- package/dist/server-dev/store/use-store.js +1 -2
- package/dist/server-dev/suspense.js +1 -2
- package/dist/server-dev/transitions.js +1 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/dev/action.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Accessor } from "./internal/types.js";
|
|
2
|
-
//#region src/action.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* A state machine for a form-style action: `dispatch(...args)` runs `action(previous, ...args)`,
|
|
5
4
|
* tracks whether it is pending, and commits its result. The ShadowJS form of React's
|
|
@@ -32,5 +31,4 @@ import { Accessor } from "./internal/types.js";
|
|
|
32
31
|
* @since 1.0.0
|
|
33
32
|
*/
|
|
34
33
|
export declare function useAction<S, A extends unknown[]>(action: (previous: S, ...args: A) => S | PromiseLike<S>, initialState: S): [state: Accessor<S>, dispatch: (...args: A) => Promise<void>, pending: Accessor<boolean>];
|
|
35
|
-
//#endregion
|
|
36
34
|
//# sourceMappingURL=action.d.ts.map
|
package/dist/dev/action.js
CHANGED
|
@@ -3,7 +3,7 @@ import { batch } from "./internal/scheduler.js";
|
|
|
3
3
|
import { untrack } from "./ownership.js";
|
|
4
4
|
import { useSignal } from "./signal.js";
|
|
5
5
|
import { currentOwner } from "./extend/index.js";
|
|
6
|
-
|
|
6
|
+
// src/action.ts
|
|
7
7
|
function isPromiseLike(value) {
|
|
8
8
|
return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
9
9
|
}
|
|
@@ -84,7 +84,6 @@ function useAction(action, initialState) {
|
|
|
84
84
|
pending
|
|
85
85
|
];
|
|
86
86
|
}
|
|
87
|
-
//#endregion
|
|
88
87
|
export { useAction };
|
|
89
88
|
|
|
90
89
|
//# sourceMappingURL=action.js.map
|
package/dist/dev/cache.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/cache.d.ts
|
|
2
1
|
/** Options of {@link cache}. @since 1.0.0 */
|
|
3
2
|
export interface CacheOptions {
|
|
4
3
|
/**
|
|
@@ -31,5 +30,4 @@ export interface CacheOptions {
|
|
|
31
30
|
* @since 1.0.0
|
|
32
31
|
*/
|
|
33
32
|
export declare function cache<A extends unknown[], R>(fn: (...args: A) => R, options?: CacheOptions): (...args: A) => R;
|
|
34
|
-
//#endregion
|
|
35
33
|
//# sourceMappingURL=cache.d.ts.map
|
package/dist/dev/cache.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { currentOwner } from "./extend/index.js";
|
|
2
|
-
|
|
2
|
+
// src/cache.ts
|
|
3
3
|
function sameArgs(a, b) {
|
|
4
4
|
if (a.length !== b.length) return false;
|
|
5
5
|
for (let i = 0; i < a.length; i += 1) if (!Object.is(a[i], b[i])) return false;
|
|
@@ -56,7 +56,6 @@ function cache(fn, options) {
|
|
|
56
56
|
return value;
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
//#endregion
|
|
60
59
|
export { cache };
|
|
61
60
|
|
|
62
61
|
//# sourceMappingURL=cache.js.map
|
package/dist/dev/context.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/context.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* A context made by {@link createContext}: a value that a subtree receives from the nearest provider
|
|
4
3
|
* above it. The context is itself the provider component; `Provider` is the same function.
|
|
@@ -102,5 +101,4 @@ export declare function runWithContext<T, R>(context: Context<T>, value: T, fn:
|
|
|
102
101
|
* @since 1.0.0
|
|
103
102
|
*/
|
|
104
103
|
export declare function useContext<T>(context: Context<T>): T;
|
|
105
|
-
//#endregion
|
|
106
104
|
//# sourceMappingURL=context.d.ts.map
|
package/dist/dev/context.js
CHANGED
|
@@ -4,7 +4,7 @@ import { runWithOwner } from "./ownership.js";
|
|
|
4
4
|
import { useRenderEffect } from "./effect.js";
|
|
5
5
|
import { useSignal } from "./signal.js";
|
|
6
6
|
import { currentOwner } from "./extend/index.js";
|
|
7
|
-
|
|
7
|
+
// src/context.ts
|
|
8
8
|
/**
|
|
9
9
|
* Creates a context: a value that components read with {@link useContext} without passing it
|
|
10
10
|
* through props. Render the returned component around a subtree to provide a value. The value is
|
|
@@ -105,7 +105,6 @@ function useContext(context) {
|
|
|
105
105
|
if (context.defaultValue === void 0) throw new ShadowError("CONTEXT_MISSING");
|
|
106
106
|
return context.defaultValue;
|
|
107
107
|
}
|
|
108
|
-
//#endregion
|
|
109
108
|
export { createContext, runWithContext, useContext };
|
|
110
109
|
|
|
111
110
|
//# sourceMappingURL=context.js.map
|
package/dist/dev/effect.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Cleanup } from "./internal/types.js";
|
|
2
|
-
//#region src/effect.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Options of {@link useEffect} in its tracking form `useEffect(fn, options)`.
|
|
5
4
|
* @since 1.0.0
|
|
@@ -118,5 +117,4 @@ export declare function useRenderEffect<T>(compute: () => T, apply?: (value: T,
|
|
|
118
117
|
* @since 1.0.0
|
|
119
118
|
*/
|
|
120
119
|
export declare function onMount(fn: () => void | Cleanup): void;
|
|
121
|
-
//#endregion
|
|
122
120
|
//# sourceMappingURL=effect.d.ts.map
|
package/dist/dev/effect.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { warn } from "./internal/diagnostics.js";
|
|
2
2
|
import { untrack } from "./ownership.js";
|
|
3
3
|
import { createComputation, currentOwner } from "./extend/index.js";
|
|
4
|
-
|
|
4
|
+
// src/effect.ts
|
|
5
5
|
/** What a held effect computes while its gate is closed: nothing for `apply` to act on. */
|
|
6
6
|
const HELD = Symbol("held");
|
|
7
7
|
/** The nearest gate above the current owner (see `Owner.gate`), or null. */
|
|
@@ -105,7 +105,6 @@ function useRenderEffect(compute, apply) {
|
|
|
105
105
|
function onMount(fn) {
|
|
106
106
|
createEffect(() => untrack(fn), null, false, false, "onMount");
|
|
107
107
|
}
|
|
108
|
-
//#endregion
|
|
109
108
|
export { onMount, useEffect, useRenderEffect };
|
|
110
109
|
|
|
111
110
|
//# sourceMappingURL=effect.js.map
|
package/dist/dev/env.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/env.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* True in the server condition build, where effects never run and rendering produces strings. Use
|
|
4
3
|
* it to skip browser-only work. The value is fixed per build: the package export conditions
|
|
@@ -25,5 +24,4 @@ export declare const isServer: boolean;
|
|
|
25
24
|
* @since 1.0.0
|
|
26
25
|
*/
|
|
27
26
|
export declare const isDev: boolean;
|
|
28
|
-
//#endregion
|
|
29
27
|
//# sourceMappingURL=env.d.ts.map
|
package/dist/dev/env.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/env.ts
|
|
2
2
|
/**
|
|
3
3
|
* True in the server condition build, where effects never run and rendering produces strings. Use
|
|
4
4
|
* it to skip browser-only work. The value is fixed per build: the package export conditions
|
|
@@ -25,7 +25,6 @@ const isServer = false;
|
|
|
25
25
|
* @since 1.0.0
|
|
26
26
|
*/
|
|
27
27
|
const isDev = true;
|
|
28
|
-
//#endregion
|
|
29
28
|
export { isDev, isServer };
|
|
30
29
|
|
|
31
30
|
//# sourceMappingURL=env.js.map
|
package/dist/dev/events.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/events.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* A stable callback that always runs its handler untracked. The ShadowJS form of React's
|
|
4
3
|
* `useEffectEvent`: components run once and props are getters, so the handler already sees the
|
|
@@ -24,5 +23,4 @@
|
|
|
24
23
|
* @since 1.0.0
|
|
25
24
|
*/
|
|
26
25
|
export declare function useEvent<A extends unknown[], R>(handler: (...args: A) => R): (...args: A) => R;
|
|
27
|
-
//#endregion
|
|
28
26
|
//# sourceMappingURL=events.d.ts.map
|
package/dist/dev/events.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { untrack } from "./ownership.js";
|
|
2
|
-
|
|
2
|
+
// src/events.ts
|
|
3
3
|
/**
|
|
4
4
|
* A stable callback that always runs its handler untracked. The ShadowJS form of React's
|
|
5
5
|
* `useEffectEvent`: components run once and props are getters, so the handler already sees the
|
|
@@ -27,7 +27,6 @@ import { untrack } from "./ownership.js";
|
|
|
27
27
|
function useEvent(handler) {
|
|
28
28
|
return (...args) => untrack(() => handler(...args));
|
|
29
29
|
}
|
|
30
|
-
//#endregion
|
|
31
30
|
export { useEvent };
|
|
32
31
|
|
|
33
32
|
//# sourceMappingURL=events.js.map
|
|
@@ -11,7 +11,6 @@ import { ShadowError, WarningListener, resetWarningDedupe, setWarningListener, w
|
|
|
11
11
|
import { disposeTree } from "../internal/dispose.js";
|
|
12
12
|
import { isHydrating, withHydration } from "../internal/hydration-flag.js";
|
|
13
13
|
import { SUSPENSION, isSuspension } from "../internal/suspension.js";
|
|
14
|
-
//#region src/extend.d.ts
|
|
15
14
|
/**
|
|
16
15
|
* Returns the owner that adopts nodes created right now. The extension-API form of `getOwner`: use
|
|
17
16
|
* it in a primitive that attaches a node or a cleanup to its caller's owner.
|
|
@@ -326,6 +325,5 @@ export declare function refresh(node: Computation): void;
|
|
|
326
325
|
* @since 1.0.0
|
|
327
326
|
*/
|
|
328
327
|
export declare function createOwner(parent?: Owner | null): Owner;
|
|
329
|
-
//#endregion
|
|
330
328
|
export { type Accessor, type AnyFunction, type BoundaryHold, type Cleanup, Computation as ComputationNode, type ContextMap, DEVTOOLS_EVENT, type Equals, type ErrorHandler, MESSAGES, type MessageCode, Owner, SUSPENSION, type Setter, ShadowError, Signal as SignalNode, type SlotBranch, type SlotChoice, type SlotOwned, type SlotState, type SlotSwap, type Source as SourceNode, type TransitionHold, type WarningListener, addCleanup, batch, beginHold, createTransitionHold, report as devtoolsReport, disposeTree as disposeOwner, endHold, flush, flushSync, formatMessage, group, handleError, holdReader, inTransition, isHydrating, isSuspension, markObservers, observersOf, pauseOwner, readSignal, registerTransitionLane, resetWarningDedupe, resumeOwner, runWithContext, schedule, setWarningListener, sourcesOf, startTransition, track, transitionHooks, wakeSuspended, warn, withHydration };
|
|
331
329
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/dev/extend/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { disposeTree } from "../internal/dispose.js";
|
|
|
11
11
|
import { SUSPENSION, isSuspension } from "../internal/suspension.js";
|
|
12
12
|
import { beginHold, createTransitionHold, endHold, holdReader, inTransition, pauseOwner, registerTransitionLane, resumeOwner, startTransition, transitionHooks, wakeSuspended } from "../internal/concurrency.js";
|
|
13
13
|
import { isHydrating, withHydration } from "../internal/hydration-flag.js";
|
|
14
|
-
|
|
14
|
+
// src/extend.ts
|
|
15
15
|
/**
|
|
16
16
|
* The extension API: everything the built-in hooks (`useSignal`, `useMemo`, `useEffect`,
|
|
17
17
|
* `useStore`, `useResource`, `mapArray`, `useSelector`, contexts, ...) are built from. They import
|
|
@@ -311,7 +311,6 @@ function refresh(node) {
|
|
|
311
311
|
function createOwner(parent) {
|
|
312
312
|
return new Owner(parent === void 0 ? rt.owner : parent);
|
|
313
313
|
}
|
|
314
|
-
//#endregion
|
|
315
314
|
export { Computation as ComputationNode, DEVTOOLS_EVENT, MESSAGES, Owner, SUSPENSION, ShadowError, Signal as SignalNode, addCleanup, batch, beginHold, createComputation, createOwner, createSignalNode, createTransitionHold, currentListener, currentOwner, report as devtoolsReport, disposeTree as disposeOwner, endHold, flush, flushSync, formatMessage, group, handleError, holdReader, inTransition, isComputingMemo, isHydrating, isSuspension, isTracking, markObservers, notify, observersOf, pauseOwner, readComputation, readSignal, refresh, registerTransitionLane, resetWarningDedupe, resumeOwner, runInScope, runWithContext, schedule, setWarningListener, sourcesOf, startTransition, track, transitionHooks, wakeSuspended, warn, withHydration, writeSignal };
|
|
316
315
|
|
|
317
316
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Accessor, Equals } from "./internal/types.js";
|
|
2
|
-
//#region src/external-store.d.ts
|
|
3
2
|
/** Options of {@link useExternalStore}. @since 1.0.0 */
|
|
4
3
|
export interface ExternalStoreOptions<T> {
|
|
5
4
|
/**
|
|
@@ -56,5 +55,4 @@ export interface ExternalStoreOptions<T> {
|
|
|
56
55
|
* @since 1.0.0
|
|
57
56
|
*/
|
|
58
57
|
export declare function useExternalStore<T>(subscribe: (notify: () => void) => () => void, getSnapshot: () => T, options?: ExternalStoreOptions<T>): Accessor<T>;
|
|
59
|
-
//#endregion
|
|
60
58
|
//# sourceMappingURL=external-store.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { untrack } from "./ownership.js";
|
|
|
2
2
|
import { useEffect } from "./effect.js";
|
|
3
3
|
import { useSignal } from "./signal.js";
|
|
4
4
|
import { isHydrating } from "./internal/hydration-flag.js";
|
|
5
|
-
|
|
5
|
+
// src/external-store.ts
|
|
6
6
|
/**
|
|
7
7
|
* Reads a value that lives outside ShadowJS (a store, a browser API, an observable) as a reactive
|
|
8
8
|
* accessor. The one bridge for every external source, and the ShadowJS form of React's
|
|
@@ -54,7 +54,6 @@ function useExternalStore(subscribe, getSnapshot, options) {
|
|
|
54
54
|
});
|
|
55
55
|
return value;
|
|
56
56
|
}
|
|
57
|
-
//#endregion
|
|
58
57
|
export { useExternalStore };
|
|
59
58
|
|
|
60
59
|
//# sourceMappingURL=external-store.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Owner } from "./owner.js";
|
|
2
2
|
import { Hooks, TransitionHold } from "./state.js";
|
|
3
|
-
//#region src/internal/concurrency.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Installs the transition machinery (the transition lane, Activity pauses and Suspense holds) now
|
|
6
5
|
* instead of at the first `startTransition`. The machinery is created on first use so that an
|
|
@@ -209,5 +208,4 @@ export declare function pauseOwner(owner: Owner): void;
|
|
|
209
208
|
* @since 1.0.0
|
|
210
209
|
*/
|
|
211
210
|
export declare function resumeOwner(owner: Owner): void;
|
|
212
|
-
//#endregion
|
|
213
211
|
//# sourceMappingURL=concurrency.d.ts.map
|
|
@@ -10,7 +10,7 @@ import { runWithContext } from "../context.js";
|
|
|
10
10
|
import { SuspenseContext } from "../suspense.js";
|
|
11
11
|
import { disposeTree } from "./dispose.js";
|
|
12
12
|
import { SUSPENSION, isSuspension } from "./suspension.js";
|
|
13
|
-
|
|
13
|
+
// src/internal/concurrency.ts
|
|
14
14
|
/** Transition-lane effects run per macrotask; between two chunks urgent work and input can run. */
|
|
15
15
|
const LANE_CHUNK = 64;
|
|
16
16
|
/** Visits `root` and every node below it. Iterative: the depth is user controlled. */
|
|
@@ -626,7 +626,6 @@ function pauseOwner(owner) {
|
|
|
626
626
|
function resumeOwner(owner) {
|
|
627
627
|
rt.hooks?.resume(owner);
|
|
628
628
|
}
|
|
629
|
-
//#endregion
|
|
630
629
|
export { beginHold, createTransitionHold, endHold, holdReader, inTransition, pauseOwner, registerTransitionLane, resumeOwner, startTransition, transitionHooks, wakeSuspended };
|
|
631
630
|
|
|
632
631
|
//# sourceMappingURL=concurrency.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/internal/devtools.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The runtime's side of the devtools protocol (version 1, see `@shadow-js/devtools`). The runtime
|
|
4
3
|
* does not import that package: it looks up a global hook, in development builds only, and every
|
|
@@ -67,5 +66,4 @@ export declare const DEVTOOLS_EVENT: {
|
|
|
67
66
|
* @since 1.0.0
|
|
68
67
|
*/
|
|
69
68
|
export declare function report(kind: number, a?: unknown, b?: unknown, c?: unknown, d?: unknown, e?: unknown): void;
|
|
70
|
-
//#endregion
|
|
71
69
|
//# sourceMappingURL=devtools.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/devtools.ts
|
|
2
2
|
/**
|
|
3
3
|
* The runtime's side of the devtools protocol (version 1, see `@shadow-js/devtools`). The runtime
|
|
4
4
|
* does not import that package: it looks up a global hook, in development builds only, and every
|
|
@@ -71,7 +71,6 @@ function report(kind, a, b, c, d, e) {
|
|
|
71
71
|
const hook = Reflect.get(globalThis, KEY);
|
|
72
72
|
if (hook !== void 0 && hook.version === 1) hook.report(kind, a, b, c, d, e);
|
|
73
73
|
}
|
|
74
|
-
//#endregion
|
|
75
74
|
export { DEVTOOLS_EVENT, report };
|
|
76
75
|
|
|
77
76
|
//# sourceMappingURL=devtools.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MessageCode } from "./messages.js";
|
|
2
|
-
//#region src/internal/diagnostics.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* The error class of every diagnostic the runtime throws, carrying a stable code next to the
|
|
5
4
|
* message. Match on `code` rather than the message: the message is the full text in development
|
|
@@ -86,5 +85,4 @@ export declare function resetWarningDedupe(): void;
|
|
|
86
85
|
* @since 1.0.0
|
|
87
86
|
*/
|
|
88
87
|
export declare function warn(code: MessageCode): void;
|
|
89
|
-
//#endregion
|
|
90
88
|
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { formatMessage } from "./messages.js";
|
|
2
|
-
|
|
2
|
+
// src/internal/diagnostics.ts
|
|
3
3
|
/**
|
|
4
4
|
* The error class of every diagnostic the runtime throws, carrying a stable code next to the
|
|
5
5
|
* message. Match on `code` rather than the message: the message is the full text in development
|
|
@@ -96,7 +96,6 @@ function warn(code) {
|
|
|
96
96
|
if (listener !== void 0) listener(code, message);
|
|
97
97
|
else console.warn(message);
|
|
98
98
|
}
|
|
99
|
-
//#endregion
|
|
100
99
|
export { ShadowError, resetWarningDedupe, setWarningListener, warn };
|
|
101
100
|
|
|
102
101
|
//# sourceMappingURL=diagnostics.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Owner } from "./owner.js";
|
|
2
|
-
//#region src/internal/dispose.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Disposes an owner and everything below it: children first, newest first, then each node's
|
|
5
4
|
* cleanups, newest first. Use it to end an owner made with `createOwner`; disposing an owner that is
|
|
@@ -24,5 +23,4 @@ import { Owner } from "./owner.js";
|
|
|
24
23
|
* @since 1.0.0
|
|
25
24
|
*/
|
|
26
25
|
export declare function disposeTree(root: Owner): void;
|
|
27
|
-
//#endregion
|
|
28
26
|
//# sourceMappingURL=dispose.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { rt } from "./state.js";
|
|
|
2
2
|
import { disposeTree as disposeTree$1 } from "./owner.js";
|
|
3
3
|
import { hasPending } from "./queue.js";
|
|
4
4
|
import { flush } from "./scheduler.js";
|
|
5
|
-
|
|
5
|
+
// src/internal/dispose.ts
|
|
6
6
|
/**
|
|
7
7
|
* Disposes an owner and everything below it: children first, newest first, then each node's
|
|
8
8
|
* cleanups, newest first. Use it to end an owner made with `createOwner`; disposing an owner that is
|
|
@@ -43,7 +43,6 @@ function disposeTree(root) {
|
|
|
43
43
|
}
|
|
44
44
|
if (failed) throw failure;
|
|
45
45
|
}
|
|
46
|
-
//#endregion
|
|
47
46
|
export { disposeTree };
|
|
48
47
|
|
|
49
48
|
//# sourceMappingURL=dispose.js.map
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/flags.ts
|
|
2
2
|
/** Effect is queued in (or parked from) the transition lane, not the urgent queues. */
|
|
3
3
|
const FLAG_TRANSITION = 1024;
|
|
4
4
|
/** Effect was due while its owner was paused: it waits, unqueued, until the owner resumes. */
|
|
5
5
|
const FLAG_PARKED = 2048;
|
|
6
6
|
/** Computation threw a suspension: it keeps its previous value until its boundary releases it. */
|
|
7
7
|
const FLAG_SUSPENDED = 4096;
|
|
8
|
-
//#endregion
|
|
9
8
|
export { FLAG_PARKED, FLAG_SUSPENDED, FLAG_TRANSITION };
|
|
10
9
|
|
|
11
10
|
//# sourceMappingURL=flags.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Equals } from "./types.js";
|
|
2
2
|
import { Owner } from "./owner.js";
|
|
3
|
-
//#region src/internal/graph.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Anything that can be read reactively and notify observers: a signal, a memo, or a custom source
|
|
6
5
|
* of a primitive. Exported from `@shadow-js/core/extend` as `SourceNode`. Read one with
|
|
@@ -229,5 +228,4 @@ export declare function markObservers(source: Source): void;
|
|
|
229
228
|
* @since 1.0.0
|
|
230
229
|
*/
|
|
231
230
|
export declare function readSignal<T>(signal: Signal<T>): T;
|
|
232
|
-
//#endregion
|
|
233
231
|
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -3,7 +3,7 @@ import { ShadowError } from "./diagnostics.js";
|
|
|
3
3
|
import { nextSequence, rt } from "./state.js";
|
|
4
4
|
import { Owner, addCleanup, disposeChildren, handleError, hasErrorHandler } from "./owner.js";
|
|
5
5
|
import { enqueue } from "./queue.js";
|
|
6
|
-
|
|
6
|
+
// src/internal/graph.ts
|
|
7
7
|
const NO_SOURCES = Object.freeze([]);
|
|
8
8
|
/** Memo nesting depth after which pulls switch from recursion to the iterative walk. */
|
|
9
9
|
const DEEP_LIMIT = 128;
|
|
@@ -572,7 +572,6 @@ function settleEffect(node, result, failed, failure) {
|
|
|
572
572
|
if ((node.flags & 4) !== 0) node.runCleanups();
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
|
-
//#endregion
|
|
576
575
|
export { Computation, Signal, hasObservers, isFrozen, markObservers, observersOf, readMemo, readSignal, recompute, sourcesOf, track, unlinkSources, updateIfNecessary };
|
|
577
576
|
|
|
578
577
|
//# sourceMappingURL=graph.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/internal/hydration-flag.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Tells whether the code runs while `hydrate()` claims server markup. Read it at creation in a hook
|
|
4
3
|
* whose first render must match the server, as `useExternalStore` does to read its server snapshot.
|
|
@@ -29,5 +28,4 @@ export declare function isHydrating(): boolean;
|
|
|
29
28
|
* @since 1.0.0
|
|
30
29
|
*/
|
|
31
30
|
export declare function withHydration<T>(fn: () => T): T;
|
|
32
|
-
//#endregion
|
|
33
31
|
//# sourceMappingURL=hydration-flag.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { rt } from "./state.js";
|
|
2
|
-
|
|
2
|
+
// src/internal/hydration-flag.ts
|
|
3
3
|
/**
|
|
4
4
|
* Tells whether the code runs while `hydrate()` claims server markup. Read it at creation in a hook
|
|
5
5
|
* whose first render must match the server, as `useExternalStore` does to read its server snapshot.
|
|
@@ -40,7 +40,6 @@ function withHydration(fn) {
|
|
|
40
40
|
rt.hydrating = previous;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
//#endregion
|
|
44
43
|
export { isHydrating, withHydration };
|
|
45
44
|
|
|
46
45
|
//# sourceMappingURL=hydration-flag.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/internal/messages.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The diagnostic catalog: every code the runtime throws (as {@link ShadowError}) or warns with
|
|
4
3
|
* (through {@link warn}), mapped to its development text. Read it to show or match a diagnostic by
|
|
@@ -52,5 +51,4 @@ export type MessageCode = keyof typeof MESSAGES;
|
|
|
52
51
|
* @since 1.0.0
|
|
53
52
|
*/
|
|
54
53
|
export declare function formatMessage(code: MessageCode): string;
|
|
55
|
-
//#endregion
|
|
56
54
|
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/messages.ts
|
|
2
2
|
/**
|
|
3
3
|
* The diagnostic catalog: every code the runtime throws (as {@link ShadowError}) or warns with
|
|
4
4
|
* (through {@link warn}), mapped to its development text. Read it to show or match a diagnostic by
|
|
@@ -48,7 +48,6 @@ const MESSAGES = {
|
|
|
48
48
|
function formatMessage(code) {
|
|
49
49
|
return `[shadow ${code}] ${MESSAGES[code]}`;
|
|
50
50
|
}
|
|
51
|
-
//#endregion
|
|
52
51
|
export { MESSAGES, formatMessage };
|
|
53
52
|
|
|
54
53
|
//# sourceMappingURL=messages.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Cleanup, ErrorHandler } from "./types.js";
|
|
2
|
-
//#region src/internal/owner.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* The context values an owner sees, keyed by the symbol of each context. A provider creates a map
|
|
5
4
|
* whose prototype is its parent's map, so a lookup is one property read and never walks owners.
|
|
@@ -138,5 +137,4 @@ export declare function addCleanup(owner: Owner, cleanup: Cleanup): void;
|
|
|
138
137
|
* @since 1.0.0
|
|
139
138
|
*/
|
|
140
139
|
export declare function handleError(error: unknown, from: Owner | null): void;
|
|
141
|
-
//#endregion
|
|
142
140
|
//# sourceMappingURL=owner.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEVTOOLS_EVENT, report } from "./devtools.js";
|
|
2
2
|
import { rt } from "./state.js";
|
|
3
|
-
|
|
3
|
+
// src/internal/owner.ts
|
|
4
4
|
/**
|
|
5
5
|
* A node in the ownership tree: it owns the effects, memos and owners created under it, their
|
|
6
6
|
* cleanups and error handlers, and disposes them together. Create one with `createOwner` and end it
|
|
@@ -284,7 +284,6 @@ function reportUncaught(error) {
|
|
|
284
284
|
if (rt.flushing || rt.disposing > 0) rt.uncaught.push(error);
|
|
285
285
|
else throw error;
|
|
286
286
|
}
|
|
287
|
-
//#endregion
|
|
288
287
|
export { Owner, addCleanup, disposeChildren, disposeTree, handleError, hasErrorHandler };
|
|
289
288
|
|
|
290
289
|
//# sourceMappingURL=owner.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FLAG_PARKED, FLAG_TRANSITION } from "./flags.js";
|
|
2
2
|
import { rt } from "./state.js";
|
|
3
|
-
|
|
3
|
+
// src/internal/queue.ts
|
|
4
4
|
/** Urgent effects waiting for the next flush, split by phase (render effects run first). */
|
|
5
5
|
const renderQueue = [];
|
|
6
6
|
const userQueue = [];
|
|
@@ -40,7 +40,6 @@ function clearQueues() {
|
|
|
40
40
|
}
|
|
41
41
|
rt.hooks?.clear();
|
|
42
42
|
}
|
|
43
|
-
//#endregion
|
|
44
43
|
export { clearQueues, enqueue, hasPending, place, renderQueue, userQueue };
|
|
45
44
|
|
|
46
45
|
//# sourceMappingURL=queue.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/internal/scheduler.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Runs every pending effect now: what the scheduled microtask does. Drains the queues until nothing
|
|
4
3
|
* is pending; render effects always run before user effects, parents before children, siblings by
|
|
@@ -109,5 +108,4 @@ export declare function batch<T>(fn: () => T): T;
|
|
|
109
108
|
* @since 1.0.0
|
|
110
109
|
*/
|
|
111
110
|
export declare function flushSync<T = void>(fn?: () => T): T;
|
|
112
|
-
//#endregion
|
|
113
111
|
//# sourceMappingURL=scheduler.d.ts.map
|
|
@@ -5,7 +5,7 @@ import { rt } from "./state.js";
|
|
|
5
5
|
import { handleError } from "./owner.js";
|
|
6
6
|
import { clearQueues, hasPending, renderQueue, userQueue } from "./queue.js";
|
|
7
7
|
import { recompute, updateIfNecessary } from "./graph.js";
|
|
8
|
-
|
|
8
|
+
// src/internal/scheduler.ts
|
|
9
9
|
/**
|
|
10
10
|
* Flush passes allowed before the loop guard aborts (R-CODE-12).
|
|
11
11
|
* @internal
|
|
@@ -281,7 +281,6 @@ function flushSync(fn) {
|
|
|
281
281
|
if (failed) throw failure;
|
|
282
282
|
return result;
|
|
283
283
|
}
|
|
284
|
-
//#endregion
|
|
285
284
|
export { MAX_FLUSH_PASSES, batch, byCreation, flush, flushSync, group, isOrdered, reportUncaught, schedule };
|
|
286
285
|
|
|
287
286
|
//# sourceMappingURL=scheduler.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Owner } from "./owner.js";
|
|
2
2
|
import { Computation } from "./graph.js";
|
|
3
|
-
//#region src/internal/state.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* A hold for a value a transition builds while its reads wait for data (a `Show` branch built during a
|
|
6
5
|
* transition): the reads that wait count against this hold, not against the Suspense boundary around
|
|
@@ -137,5 +136,4 @@ export interface Hooks {
|
|
|
137
136
|
/** The engine side of `createTransitionHold`. */
|
|
138
137
|
createHold(onSettled: () => void): TransitionHold;
|
|
139
138
|
}
|
|
140
|
-
//#endregion
|
|
141
139
|
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/state.ts
|
|
2
2
|
/**
|
|
3
3
|
* The runtime registers (R-CODE-4): the only module-level mutable state of core besides
|
|
4
4
|
* monotonic counters. Every write is paired with a `finally` restore (R-CODE-5).
|
|
@@ -22,7 +22,6 @@ function nextSequence() {
|
|
|
22
22
|
counter += 1;
|
|
23
23
|
return counter;
|
|
24
24
|
}
|
|
25
|
-
//#endregion
|
|
26
25
|
export { nextSequence, rt };
|
|
27
26
|
|
|
28
27
|
//# sourceMappingURL=state.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/internal/suspension.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The value a reader throws when a transition reads data that is still loading inside a Suspense
|
|
4
3
|
* boundary that is showing content. The reader keeps its previous value (a memo keeps its value, an
|
|
@@ -39,5 +38,4 @@ export declare const SUSPENSION: {
|
|
|
39
38
|
* @since 1.0.0
|
|
40
39
|
*/
|
|
41
40
|
export declare function isSuspension(value: unknown): boolean;
|
|
42
|
-
//#endregion
|
|
43
41
|
//# sourceMappingURL=suspension.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/suspension.ts
|
|
2
2
|
/**
|
|
3
3
|
* The value a reader throws when a transition reads data that is still loading inside a Suspense
|
|
4
4
|
* boundary that is showing content. The reader keeps its previous value (a memo keeps its value, an
|
|
@@ -39,7 +39,6 @@ const SUSPENSION = /* @__PURE__ */ Object.freeze({ suspended: true });
|
|
|
39
39
|
function isSuspension(value) {
|
|
40
40
|
return value === SUSPENSION;
|
|
41
41
|
}
|
|
42
|
-
//#endregion
|
|
43
42
|
export { SUSPENSION, isSuspension };
|
|
44
43
|
|
|
45
44
|
//# sourceMappingURL=suspension.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/internal/types.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* A function that releases what an owner or an effect set up: a timer, a subscription, a listener.
|
|
4
3
|
* Register one with `onCleanup` (or `addCleanup` from `@shadow-js/core/extend`), or return one from
|
|
@@ -42,5 +41,4 @@ export interface Setter<T> {
|
|
|
42
41
|
* @since 1.0.0
|
|
43
42
|
*/
|
|
44
43
|
export type Equals<T> = false | ((prev: T, next: T) => boolean);
|
|
45
|
-
//#endregion
|
|
46
44
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/dev/list.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Accessor } from "./internal/types.js";
|
|
2
|
-
//#region src/list.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* A list as the list primitives read it. `null`, `undefined` and `false` count as an empty list.
|
|
5
4
|
* @since 1.0.0
|
|
@@ -89,5 +88,4 @@ export declare function mapArray<T, U>(list: ListSource<T>, map: (item: () => T,
|
|
|
89
88
|
export declare function indexArray<T, U>(list: ListSource<T>, map: (item: () => T, index: number) => U, options?: {
|
|
90
89
|
fallback?: () => U;
|
|
91
90
|
}): Accessor<U[]>;
|
|
92
|
-
//#endregion
|
|
93
91
|
//# sourceMappingURL=list.d.ts.map
|
package/dist/dev/list.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createRoot, getOwner, onCleanup, runWithOwner, untrack } from "./owners
|
|
|
5
5
|
import { disposeTree } from "./internal/dispose.js";
|
|
6
6
|
import { createSignalNode, writeSignal } from "./extend/index.js";
|
|
7
7
|
import { useMemo } from "./memo.js";
|
|
8
|
-
|
|
8
|
+
// src/list.ts
|
|
9
9
|
/**
|
|
10
10
|
* One mapped row: its own root, its mapped value, and the signals behind `item()` and `index()`. The signals are created
|
|
11
11
|
* by the first read, so a row whose callback never reads its index (or, unkeyed, its item) allocates neither.
|
|
@@ -276,7 +276,6 @@ function throwFailures(failures) {
|
|
|
276
276
|
if (failures.length === 1) throw failures[0];
|
|
277
277
|
throw new AggregateError(failures, "Several errors were thrown while disposing list rows.");
|
|
278
278
|
}
|
|
279
|
-
//#endregion
|
|
280
279
|
export { indexArray, mapArray };
|
|
281
280
|
|
|
282
281
|
//# sourceMappingURL=list.js.map
|