@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
|
@@ -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,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
|
|
@@ -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
|
|
@@ -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,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,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,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
|
|
@@ -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,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,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
|
package/dist/server-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
|
package/dist/server-dev/memo.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createComputation, readComputation } from "./extend/index.js";
|
|
2
|
-
|
|
2
|
+
// src/memo.ts
|
|
3
3
|
/**
|
|
4
4
|
* Creates a cached derivation that recomputes only when a dependency actually changed.
|
|
5
5
|
* Dependencies are discovered on every run, so branches that are not taken are not tracked.
|
|
@@ -35,7 +35,6 @@ function useMemo(fn, options) {
|
|
|
35
35
|
});
|
|
36
36
|
return () => readComputation(node);
|
|
37
37
|
}
|
|
38
|
-
//#endregion
|
|
39
38
|
export { useMemo };
|
|
40
39
|
|
|
41
40
|
//# sourceMappingURL=memo.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useSignal } from "./signal.js";
|
|
2
2
|
import { useMemo } from "./memo.js";
|
|
3
|
-
|
|
3
|
+
// src/optimistic.ts
|
|
4
4
|
/**
|
|
5
5
|
* Optimistic state: shows `reducer` applied over the real value for every action whose
|
|
6
6
|
* `settled` promise is still pending. When the promise settles (either way) the action is
|
|
@@ -39,7 +39,6 @@ function useOptimistic(source, reducer) {
|
|
|
39
39
|
};
|
|
40
40
|
return [state, apply];
|
|
41
41
|
}
|
|
42
|
-
//#endregion
|
|
43
42
|
export { useOptimistic };
|
|
44
43
|
|
|
45
44
|
//# sourceMappingURL=optimistic.js.map
|
|
@@ -2,7 +2,7 @@ import { ShadowError, warn } from "./internal/diagnostics.js";
|
|
|
2
2
|
import { Owner, addCleanup, handleError } from "./internal/owner.js";
|
|
3
3
|
import { disposeTree } from "./internal/dispose.js";
|
|
4
4
|
import { currentOwner, runInScope } from "./extend/index.js";
|
|
5
|
-
|
|
5
|
+
// src/ownership.ts
|
|
6
6
|
/**
|
|
7
7
|
* Runs `fn` without subscribing the running computation to anything `fn` reads. Use it inside an
|
|
8
8
|
* effect or a memo to read a value without re-running when that value changes. The current owner
|
|
@@ -255,7 +255,6 @@ function useId() {
|
|
|
255
255
|
owner.idCount += 1;
|
|
256
256
|
return `s${path.join("-")}_${sequence}`;
|
|
257
257
|
}
|
|
258
|
-
//#endregion
|
|
259
258
|
export { catchError, createRoot, getOwner, onCleanup, onError, runWithOwner, untrack, useId };
|
|
260
259
|
|
|
261
260
|
//# sourceMappingURL=ownership.js.map
|
package/dist/server-dev/props.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { untrack } from "./ownership.js";
|
|
2
2
|
import { useMemo } from "./memo.js";
|
|
3
|
-
|
|
3
|
+
// src/props.ts
|
|
4
4
|
/**
|
|
5
5
|
* Keys that never take part in a merge or a split. Reading them through a props object that came
|
|
6
6
|
* from JSON or from user input could reach `Object.prototype`, so they are skipped everywhere.
|
|
@@ -276,7 +276,6 @@ function children(fn) {
|
|
|
276
276
|
}
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
|
-
//#endregion
|
|
280
279
|
export { children, mergeProps, splitProps };
|
|
281
280
|
|
|
282
281
|
//# sourceMappingURL=props.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { untrack } from "./ownership.js";
|
|
2
2
|
import { disposeTree } from "./internal/dispose.js";
|
|
3
3
|
import { createComputation, createOwner, currentOwner, runInScope } from "./extend/index.js";
|
|
4
|
-
|
|
4
|
+
// src/reaction.ts
|
|
5
5
|
/**
|
|
6
6
|
* Creates a tracker that reports the first change of what it reads. `useReaction(onInvalidate)`
|
|
7
7
|
* returns `track(fn)`: `fn` runs at once (synchronously) and the signals it reads are recorded.
|
|
@@ -55,7 +55,6 @@ function useReaction(onInvalidate) {
|
|
|
55
55
|
});
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
//#endregion
|
|
59
58
|
export { useReaction };
|
|
60
59
|
|
|
61
60
|
//# sourceMappingURL=reaction.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSignal } from "./signal.js";
|
|
2
|
-
|
|
2
|
+
// src/reducer.ts
|
|
3
3
|
/**
|
|
4
4
|
* A state cell whose writes go through a reducer: `dispatch(action)` stores
|
|
5
5
|
* `reducer(state, action)`. Equivalent to `useSignal` with the transition written in one place,
|
|
@@ -33,7 +33,6 @@ function useReducer(reducer, initialState, options) {
|
|
|
33
33
|
};
|
|
34
34
|
return [state, dispatch];
|
|
35
35
|
}
|
|
36
|
-
//#endregion
|
|
37
36
|
export { useReducer };
|
|
38
37
|
|
|
39
38
|
//# sourceMappingURL=reducer.js.map
|
package/dist/server-dev/refs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { onCleanup, untrack } from "./ownership.js";
|
|
2
|
-
|
|
2
|
+
// src/refs.ts
|
|
3
3
|
/**
|
|
4
4
|
* Creates a {@link Ref}. Calling it with a value stores the value; calling it with `undefined`
|
|
5
5
|
* clears it. The same object works as a plain ref callback, so no `forwardRef` is needed.
|
|
@@ -52,7 +52,6 @@ function useImperativeHandle(ref, create) {
|
|
|
52
52
|
ref(untrack(create));
|
|
53
53
|
onCleanup(() => ref(void 0));
|
|
54
54
|
}
|
|
55
|
-
//#endregion
|
|
56
55
|
export { createRef, useImperativeHandle };
|
|
57
56
|
|
|
58
57
|
//# sourceMappingURL=refs.js.map
|
|
@@ -6,7 +6,7 @@ import { useContext } from "./context.js";
|
|
|
6
6
|
import { ResourceCacheContext, SuspenseContext } from "./suspense.js";
|
|
7
7
|
import { holdReader, inTransition } from "./internal/concurrency.js";
|
|
8
8
|
import { createSignalNode, currentListener, currentOwner, writeSignal } from "./extend/index.js";
|
|
9
|
-
|
|
9
|
+
// src/resource.ts
|
|
10
10
|
/**
|
|
11
11
|
* A signal cell whose writes are allowed everywhere (see {@link createSignalNode}). `distinct`
|
|
12
12
|
* false notifies on every write, true only when the value changes.
|
|
@@ -170,7 +170,6 @@ function useResource(first, second, third) {
|
|
|
170
170
|
});
|
|
171
171
|
return read;
|
|
172
172
|
}
|
|
173
|
-
//#endregion
|
|
174
173
|
export { useResource };
|
|
175
174
|
|
|
176
175
|
//# sourceMappingURL=resource.js.map
|
|
@@ -2,7 +2,7 @@ import { track } from "./internal/graph.js";
|
|
|
2
2
|
import { onCleanup, untrack } from "./ownership.js";
|
|
3
3
|
import "./effect.js";
|
|
4
4
|
import { isTracking } from "./extend/index.js";
|
|
5
|
-
|
|
5
|
+
// src/selector.ts
|
|
6
6
|
/**
|
|
7
7
|
* The boolean for one key, shared by every reader that asked about that key. It is a reactive source itself (the
|
|
8
8
|
* shape `track` and `notify` take), so a key costs one object where a separate signal would cost two.
|
|
@@ -76,7 +76,6 @@ function useSelector(source, equals) {
|
|
|
76
76
|
};
|
|
77
77
|
return isSelected;
|
|
78
78
|
}
|
|
79
|
-
//#endregion
|
|
80
79
|
export { useSelector };
|
|
81
80
|
|
|
82
81
|
//# sourceMappingURL=selector.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readSignal } from "./internal/graph.js";
|
|
2
2
|
import { untrack } from "./ownership.js";
|
|
3
3
|
import { createSignalNode, writeSignal } from "./extend/index.js";
|
|
4
|
-
|
|
4
|
+
// src/signal.ts
|
|
5
5
|
/**
|
|
6
6
|
* Creates a reactive cell holding one value: the low-level primitive `useStore` builds on. Reads
|
|
7
7
|
* inside effects and memos subscribe them; writes notify them. Works at module scope.
|
|
@@ -33,7 +33,6 @@ function useSignal(value, options) {
|
|
|
33
33
|
});
|
|
34
34
|
return [read, write];
|
|
35
35
|
}
|
|
36
|
-
//#endregion
|
|
37
36
|
export { useSignal };
|
|
38
37
|
|
|
39
38
|
//# sourceMappingURL=signal.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { track } from "../internal/graph.js";
|
|
2
2
|
import { createSignalNode, isTracking, notify as notify$1 } from "../extend/index.js";
|
|
3
|
-
|
|
3
|
+
// src/store/nodes.ts
|
|
4
4
|
/** Keys that could reach `Object.prototype` if written; they are never stored as own properties. */
|
|
5
5
|
const RESERVED_KEYS = /* @__PURE__ */ new Set([
|
|
6
6
|
"__proto__",
|
|
@@ -186,7 +186,6 @@ function deleteRaw(target, key) {
|
|
|
186
186
|
notify(node.keys);
|
|
187
187
|
return true;
|
|
188
188
|
}
|
|
189
|
-
//#endregion
|
|
190
189
|
export { NODES, RAW, deleteRaw, isReservedKey, isWrappable, nodeOf, readRaw, trackKeys, trackProperty, unwrapDeep, unwrapValue, writeRaw };
|
|
191
190
|
|
|
192
191
|
//# sourceMappingURL=nodes.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RAW, deleteRaw, isReservedKey, isWrappable, nodeOf, readRaw, trackKeys, trackProperty, unwrapValue, writeRaw } from "./nodes.js";
|
|
2
|
-
|
|
2
|
+
// src/store/proxies.ts
|
|
3
3
|
/**
|
|
4
4
|
* One `setStore` call. Drafts made for it are cached here, so a draft object keeps its identity
|
|
5
5
|
* inside the update, and they stop accepting writes when the call returns.
|
|
@@ -154,7 +154,6 @@ function draftOf(raw, tx) {
|
|
|
154
154
|
tx.drafts.set(raw, proxy);
|
|
155
155
|
return proxy;
|
|
156
156
|
}
|
|
157
|
-
//#endregion
|
|
158
157
|
export { Transaction, draftOf, readProxyOf };
|
|
159
158
|
|
|
160
159
|
//# sourceMappingURL=proxies.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isReservedKey, isWrappable, readRaw, unwrapValue } from "./nodes.js";
|
|
2
|
-
|
|
2
|
+
// src/store/read.ts
|
|
3
3
|
/**
|
|
4
4
|
* Returns the raw data behind a store. Reads and writes on the result bypass tracking and
|
|
5
5
|
* notification, so writing to it is a bug; use it for identity checks and passing data on.
|
|
@@ -66,7 +66,6 @@ function snapshot(store) {
|
|
|
66
66
|
}
|
|
67
67
|
return out;
|
|
68
68
|
}
|
|
69
|
-
//#endregion
|
|
70
69
|
export { snapshot, unwrap };
|
|
71
70
|
|
|
72
71
|
//# sourceMappingURL=read.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { deleteRaw, isReservedKey, isWrappable, unwrapValue, writeRaw } from "./nodes.js";
|
|
2
|
-
|
|
2
|
+
// src/store/reconcile.ts
|
|
3
3
|
/** Each reconciler function maps to its spec. Keys are the reconciler functions themselves. */
|
|
4
4
|
const SPECS = /* @__PURE__ */ new WeakMap();
|
|
5
5
|
/**
|
|
@@ -180,7 +180,6 @@ function mergeArray(target, source, spec, enqueue) {
|
|
|
180
180
|
function produce(update) {
|
|
181
181
|
return update;
|
|
182
182
|
}
|
|
183
|
-
//#endregion
|
|
184
183
|
export { applyReconcile, produce, reconcile, specOf };
|
|
185
184
|
|
|
186
185
|
//# sourceMappingURL=reconcile.js.map
|
|
@@ -8,7 +8,7 @@ import { isReservedKey, isWrappable, unwrapValue } from "./nodes.js";
|
|
|
8
8
|
import { snapshot } from "./read.js";
|
|
9
9
|
import { applyReconcile, reconcile, specOf } from "./reconcile.js";
|
|
10
10
|
import { Transaction, draftOf, readProxyOf } from "./proxies.js";
|
|
11
|
-
|
|
11
|
+
// src/store/use-store.ts
|
|
12
12
|
function isPlainObject(value) {
|
|
13
13
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
14
14
|
const prototype = Object.getPrototypeOf(value);
|
|
@@ -162,7 +162,6 @@ function wrapCell(value) {
|
|
|
162
162
|
const raw = unwrapValue(value);
|
|
163
163
|
return isWrappable(raw) ? readProxyOf(raw) : value;
|
|
164
164
|
}
|
|
165
|
-
//#endregion
|
|
166
165
|
export { useStore };
|
|
167
166
|
|
|
168
167
|
//# sourceMappingURL=use-store.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext } from "./context.js";
|
|
2
|
-
|
|
2
|
+
// src/suspense.ts
|
|
3
3
|
/**
|
|
4
4
|
* The context through which an asynchronous source finds the nearest `<Suspense>` boundary. Each
|
|
5
5
|
* boundary provides its {@link SuspenseTracker}; the value is `null` outside any boundary. Read it
|
|
@@ -39,7 +39,6 @@ const SuspenseContext = /* @__PURE__ */ createContext(null, { name: "Suspense" }
|
|
|
39
39
|
* @since 1.0.0
|
|
40
40
|
*/
|
|
41
41
|
const ResourceCacheContext = /* @__PURE__ */ createContext(null, { name: "ResourceCache" });
|
|
42
|
-
//#endregion
|
|
43
42
|
export { ResourceCacheContext, SuspenseContext };
|
|
44
43
|
|
|
45
44
|
//# sourceMappingURL=suspense.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { untrack } from "./ownership.js";
|
|
2
2
|
import { useSignal } from "./signal.js";
|
|
3
3
|
import { startTransition } from "./internal/concurrency.js";
|
|
4
|
-
|
|
4
|
+
// src/transitions.ts
|
|
5
5
|
/**
|
|
6
6
|
* Runs `fn` as a transition and reports whether it is pending. Returns `[isPending, start]`:
|
|
7
7
|
* `isPending` is true from `start(fn)` until the transition has been applied (including any Suspense
|
|
@@ -80,7 +80,6 @@ function useTransition() {
|
|
|
80
80
|
function useDeferredValue(source, options) {
|
|
81
81
|
return source;
|
|
82
82
|
}
|
|
83
|
-
//#endregion
|
|
84
83
|
export { useDeferredValue, useTransition };
|
|
85
84
|
|
|
86
85
|
//# sourceMappingURL=transitions.js.map
|