solid-deps 0.0.6 → 0.0.8
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 +52 -11
- package/package.json +17 -6
- package/src/hybrid-scope.mjs +47 -0
- package/src/index.mjs +2 -1
- package/types/index.d.mts +13 -2
package/README.md
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
# solid-deps
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Restore Solid 2's reactive **tracking or owner context** for synchronous callbacks after an `await`.
|
|
4
4
|
|
|
5
|
-
`
|
|
5
|
+
By default, `createScope()` chooses **one of two behaviors at capture time**:
|
|
6
|
+
|
|
7
|
+
- **Tracking observer present (effect or memo):** capture the observer cycle and attach late reactive reads to it. Stale and disposed scopes reject calls.
|
|
8
|
+
- **Plain owner present (component/owner body without tracking):** restore that owner using `runWithOwner()` for synchronous callbacks. This restores context and owned cleanups/children **but does not subscribe signals**.
|
|
9
|
+
|
|
10
|
+
For a strictly observer-only factory, use `createObserverScope()`. The explicit owner argument to `createScope(owner)` continues to require a tracking Computed for backwards compatibility. `createOwnerScope()` is unchanged.
|
|
6
11
|
|
|
7
12
|
## Install
|
|
8
13
|
|
|
@@ -16,9 +21,35 @@ Or with Bun:
|
|
|
16
21
|
bun add solid-deps solid-js@2.0.0-rc.18 @solidjs/signals@2.0.0-rc.18
|
|
17
22
|
```
|
|
18
23
|
|
|
19
|
-
**Compatibility:**
|
|
24
|
+
**Compatibility:** This hybrid feature is tested with Solid 2.0.0-rc.17 **and** 2.0.0-rc.18; rc.20 is pending verification. The preexisting package was tested with Solid 2.0.0-rc.17 **and** 2.0.0-rc.18 production, development and observe builds (Node/ESM regression and package consumer tests, plus real Chromium owner-bound bridge scenarios). `solid-deps` recognizes validated descriptive development fields directly and discovers unknown or minified graph fields at runtime. Other Solid 2 versions may work if they retain compatible internal graph semantics, but are not yet verified. Your app and `solid-deps` must share one `@solidjs/signals` runtime instance. SSR is not supported.
|
|
25
|
+
|
|
26
|
+
## Quick start: hybrid `createScope()`
|
|
27
|
+
|
|
28
|
+
**Component body (plain-owner fallback):**
|
|
20
29
|
|
|
21
|
-
|
|
30
|
+
```tsx
|
|
31
|
+
import { getOwner, onCleanup } from 'solid-js';
|
|
32
|
+
import { createScope } from 'solid-deps';
|
|
33
|
+
|
|
34
|
+
function Component() {
|
|
35
|
+
const scope = createScope(); // No tracking observer; captures component owner
|
|
36
|
+
|
|
37
|
+
async function load() {
|
|
38
|
+
await fetch('/api/items');
|
|
39
|
+
scope(() => {
|
|
40
|
+
console.log(getOwner() !== null); // restored owner
|
|
41
|
+
onCleanup(() => console.log('component disposed'));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
void load();
|
|
46
|
+
return <div>Loaded asynchronously</div>;
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Read accessors under this plain-owner fallback **do not** create subscriptions in the component. `runWithOwner()` deliberately clears tracking. Children and cleanups created inside the callback belong to the captured owner and are disposed with it. The callback itself must be synchronous; if it contains `await`, context is **not** restored after the `await`. Promise-returning callbacks are rejected.
|
|
51
|
+
|
|
52
|
+
**Tracked effect or memo:**
|
|
22
53
|
|
|
23
54
|
Capture a dependency scope inside the tracked part of your computation. Call it after `await` to attach signal reads to that same computation:
|
|
24
55
|
|
|
@@ -52,7 +83,9 @@ export default function Counter() {
|
|
|
52
83
|
}
|
|
53
84
|
```
|
|
54
85
|
|
|
55
|
-
`scope(callback)` is a **callable function** whose result is
|
|
86
|
+
`scope(callback)` is a **callable function** whose result is the callback's return value. **Only in the tracked-observer branch**, it grafts reactive sources read synchronously by the callback into the captured observer. It does **not** restore that observer's original owner context: reads run under a temporary tracking observer and their subscriptions are transferred.
|
|
87
|
+
|
|
88
|
+
In the plain-owner branch, it uses `runWithOwner()` and does **not** graft dependencies. The branch is fixed when `createScope()` is called, even if the wrapper is invoked from a different context later.
|
|
56
89
|
|
|
57
90
|
A scope can be called multiple times while its captured observer cycle is still current:
|
|
58
91
|
|
|
@@ -108,7 +141,7 @@ A later pending transition behaves differently from an initial pending read. If
|
|
|
108
141
|
|
|
109
142
|
## Alternative: `createOwnerScope()`
|
|
110
143
|
|
|
111
|
-
`createScope()` is **cycle-bound**: when the effect recomputes, an earlier scope becomes stale. Use `createOwnerScope()` when an older asynchronous callback deliberately needs to attach reads to the **same still-live effect**, even after that effect has rerun.
|
|
144
|
+
`createScope()` is **cycle-bound when an observer is captured**: when the effect recomputes, an earlier scope becomes stale. Use `createOwnerScope()` when an older asynchronous callback deliberately needs to attach reads to the **same still-live effect**, even after that effect has rerun.
|
|
112
145
|
|
|
113
146
|
```tsx
|
|
114
147
|
import { createEffect, createSignal } from 'solid-js';
|
|
@@ -139,7 +172,7 @@ This example deliberately leaves the timeout running to demonstrate owner-bound
|
|
|
139
172
|
|
|
140
173
|
Comparison:
|
|
141
174
|
|
|
142
|
-
| | `createScope()` | `createOwnerScope()` |
|
|
175
|
+
| | `createScope()` (observer branch) | `createOwnerScope()` |
|
|
143
176
|
| --- | --- | --- |
|
|
144
177
|
| Captures | Computation and dependency generation | Computation identity only |
|
|
145
178
|
| Reusable after a normal effect rerun | No — throws `StaleScopeError` | Yes, while the effect is alive |
|
|
@@ -151,9 +184,15 @@ Owner-bound callbacks do **not** restore Solid ownership context, transfer to a
|
|
|
151
184
|
|
|
152
185
|
## API
|
|
153
186
|
|
|
154
|
-
### `createScope(owner?)`
|
|
187
|
+
### `createScope(owner?)` / `createHybridScope(owner?)`
|
|
188
|
+
|
|
189
|
+
The default and explicit hybrid alias are the same function. Without arguments, capture the current tracking observer if present; otherwise capture the current plain owner. If neither exists, throw immediately. With an **explicit owner** argument, preserve the preexisting strict observer-only behavior: the supplied owner must be a tracking Computed.
|
|
190
|
+
|
|
191
|
+
When an observer is captured, calls attach reads to its captured dependency generation. When only a plain owner is captured, calls restore owner/context synchronously, without tracking reactive dependencies. A disposed owner throws `DisposedScopeError` before the callback executes.
|
|
192
|
+
|
|
193
|
+
### `createObserverScope(owner?)`
|
|
155
194
|
|
|
156
|
-
|
|
195
|
+
The strict observer-only equivalent of the pre-hybrid `createScope()`. Use it when a missing tracking computation must be an error even inside a component owner. It has the same stale-cycle and disposed behavior as the original graph attachment factory.
|
|
157
196
|
|
|
158
197
|
```ts
|
|
159
198
|
const scope = createScope(); // Capture current tracked observer implicitly
|
|
@@ -162,7 +201,7 @@ const scope2 = createScope(owner); // Explicit existing computation owner
|
|
|
162
201
|
const value = scope(() => signal());
|
|
163
202
|
```
|
|
164
203
|
|
|
165
|
-
The implicit form must be invoked
|
|
204
|
+
The implicit form must be invoked **before `await`**, while the intended observer or owner is active. The explicit owner parameter remains strictly observer-only; it must be a tracking computation, not a plain root/component owner.
|
|
166
205
|
|
|
167
206
|
A scope call:
|
|
168
207
|
|
|
@@ -286,6 +325,8 @@ export interface AttachReadResult<T> {
|
|
|
286
325
|
}
|
|
287
326
|
|
|
288
327
|
export declare function createScope(owner?: Owner | null): Scope;
|
|
328
|
+
export declare function createHybridScope(owner?: Owner | null): Scope;
|
|
329
|
+
export declare function createObserverScope(owner?: Owner | null): Scope;
|
|
289
330
|
export declare function createOwnerScope(owner?: Owner | null): Scope;
|
|
290
331
|
export declare function captureOwnerCycle(owner?: Owner | null): OwnerCycle;
|
|
291
332
|
export declare function attachRead<T>(
|
|
@@ -549,7 +590,7 @@ Target: Solid 2 with `@solidjs/signals` compatible with `>=2.0.0-rc.17 <3.0.0`.
|
|
|
549
590
|
|
|
550
591
|
## Online Solid playground check
|
|
551
592
|
|
|
552
|
-
A copy-pasteable `main.tsx` is available in the source ZIP at `examples/online-playground/main.tsx`. Install `solid-deps@0.0.
|
|
593
|
+
A copy-pasteable `main.tsx` is available in the source ZIP at `examples/online-playground/main.tsx`. Install `solid-deps@0.0.6`, ensure the playground runs a Solid 2 browser build with a shared signals runtime, and use **Run runtime checks**. It reports successful automatic layout discovery, async dependency attachment, deduplication, future updates, stale cycles, and disposal.
|
|
553
594
|
|
|
554
595
|
## Opt-in native pending parity: `createRetainedScope()`
|
|
555
596
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-deps",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Experimental
|
|
3
|
+
"version": "0.0.8",
|
|
4
|
+
"description": "Experimental Solid 2 late-dependency tracking and hybrid owner fallback",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"src/discover.mjs",
|
|
24
24
|
"src/retained-scope.mjs",
|
|
25
25
|
"src/index.mjs",
|
|
26
|
+
"src/hybrid-scope.mjs",
|
|
26
27
|
"types/index.d.mts",
|
|
27
28
|
"README.md",
|
|
28
29
|
"LICENSE",
|
|
@@ -44,9 +45,9 @@
|
|
|
44
45
|
],
|
|
45
46
|
"scripts": {
|
|
46
47
|
"setup": "node scripts/setup.mjs",
|
|
47
|
-
"test": "node --conditions=browser --test test/test.mjs test/test-async.mjs test/test-return.mjs test/test-scope.mjs test/test-manifest.mjs test/test-graph-hardening.mjs test/test-async-transitions.mjs test/test-transaction-integrity.mjs test/test-scheduler-lifecycle.mjs test/test-release-hardening.mjs test/test-discovery.mjs test/test-fastpath.mjs test/test-owner-bound-research.mjs test/test-owner-scope.mjs test/test-notready-lifecycle.mjs test/test-loading-suspension.mjs test/test-loading-recovery-research.mjs test/test-native-notready-parity.mjs test/test-pending-status-propagation.mjs test/test-retained-scope.mjs test/test-research-retained.mjs test/test-parallel-parity.mjs test/test-batched-reads.mjs test/test-direct-links-research.mjs test/test-delegated-scope-research.mjs test/test-owner-cached-delegated.mjs test/test-sharded-delegated.mjs test/test-memory-conformance.mjs test/test-optimized-delegated.mjs test/test-unified-scope-contract.mjs test/test-unified-advanced-contract.mjs test/test-delegated-advanced-contract.mjs test/test-delegated-retention-contract.mjs test/test-delegated-default-dev19.mjs test/test-delegated-pending-bridge-dev25.mjs",
|
|
48
|
-
"test:dev": "node --conditions=browser --conditions=development --test test/test.mjs test/test-async.mjs test/test-return.mjs test/test-scope.mjs test/test-manifest.mjs test/test-graph-hardening.mjs test/test-async-transitions.mjs test/test-transaction-integrity.mjs test/test-scheduler-lifecycle.mjs test/test-release-hardening.mjs test/test-discovery.mjs test/test-fastpath.mjs test/test-owner-bound-research.mjs test/test-owner-scope.mjs test/test-notready-lifecycle.mjs test/test-loading-suspension.mjs test/test-loading-recovery-research.mjs test/test-native-notready-parity.mjs test/test-pending-status-propagation.mjs test/test-retained-scope.mjs test/test-research-retained.mjs test/test-parallel-parity.mjs test/test-batched-reads.mjs test/test-direct-links-research.mjs test/test-delegated-scope-research.mjs test/test-owner-cached-delegated.mjs test/test-sharded-delegated.mjs test/test-memory-conformance.mjs test/test-optimized-delegated.mjs test/test-unified-scope-contract.mjs test/test-unified-advanced-contract.mjs test/test-delegated-advanced-contract.mjs test/test-delegated-retention-contract.mjs test/test-delegated-default-dev19.mjs test/test-delegated-pending-bridge-dev25.mjs",
|
|
49
|
-
"test:observe": "node --conditions=browser --conditions=observe --test test/test.mjs test/test-async.mjs test/test-return.mjs test/test-scope.mjs test/test-manifest.mjs test/test-graph-hardening.mjs test/test-async-transitions.mjs test/test-transaction-integrity.mjs test/test-scheduler-lifecycle.mjs test/test-release-hardening.mjs test/test-discovery.mjs test/test-fastpath.mjs test/test-owner-bound-research.mjs test/test-owner-scope.mjs test/test-notready-lifecycle.mjs test/test-loading-suspension.mjs test/test-loading-recovery-research.mjs test/test-native-notready-parity.mjs test/test-pending-status-propagation.mjs test/test-retained-scope.mjs test/test-research-retained.mjs test/test-parallel-parity.mjs test/test-batched-reads.mjs test/test-direct-links-research.mjs test/test-delegated-scope-research.mjs test/test-owner-cached-delegated.mjs test/test-sharded-delegated.mjs test/test-memory-conformance.mjs test/test-optimized-delegated.mjs test/test-unified-scope-contract.mjs test/test-unified-advanced-contract.mjs test/test-delegated-advanced-contract.mjs test/test-delegated-retention-contract.mjs test/test-delegated-default-dev19.mjs test/test-delegated-pending-bridge-dev25.mjs",
|
|
48
|
+
"test": "node --conditions=browser --test test/test.mjs test/test-async.mjs test/test-return.mjs test/test-scope.mjs test/test-manifest.mjs test/test-graph-hardening.mjs test/test-async-transitions.mjs test/test-transaction-integrity.mjs test/test-scheduler-lifecycle.mjs test/test-release-hardening.mjs test/test-discovery.mjs test/test-fastpath.mjs test/test-owner-bound-research.mjs test/test-owner-scope.mjs test/test-notready-lifecycle.mjs test/test-loading-suspension.mjs test/test-loading-recovery-research.mjs test/test-native-notready-parity.mjs test/test-pending-status-propagation.mjs test/test-retained-scope.mjs test/test-research-retained.mjs test/test-parallel-parity.mjs test/test-batched-reads.mjs test/test-direct-links-research.mjs test/test-delegated-scope-research.mjs test/test-owner-cached-delegated.mjs test/test-sharded-delegated.mjs test/test-memory-conformance.mjs test/test-optimized-delegated.mjs test/test-unified-scope-contract.mjs test/test-unified-advanced-contract.mjs test/test-delegated-advanced-contract.mjs test/test-delegated-retention-contract.mjs test/test-delegated-default-dev19.mjs test/test-delegated-pending-bridge-dev25.mjs test/test-hybrid-scope.mjs",
|
|
49
|
+
"test:dev": "node --conditions=browser --conditions=development --test test/test.mjs test/test-async.mjs test/test-return.mjs test/test-scope.mjs test/test-manifest.mjs test/test-graph-hardening.mjs test/test-async-transitions.mjs test/test-transaction-integrity.mjs test/test-scheduler-lifecycle.mjs test/test-release-hardening.mjs test/test-discovery.mjs test/test-fastpath.mjs test/test-owner-bound-research.mjs test/test-owner-scope.mjs test/test-notready-lifecycle.mjs test/test-loading-suspension.mjs test/test-loading-recovery-research.mjs test/test-native-notready-parity.mjs test/test-pending-status-propagation.mjs test/test-retained-scope.mjs test/test-research-retained.mjs test/test-parallel-parity.mjs test/test-batched-reads.mjs test/test-direct-links-research.mjs test/test-delegated-scope-research.mjs test/test-owner-cached-delegated.mjs test/test-sharded-delegated.mjs test/test-memory-conformance.mjs test/test-optimized-delegated.mjs test/test-unified-scope-contract.mjs test/test-unified-advanced-contract.mjs test/test-delegated-advanced-contract.mjs test/test-delegated-retention-contract.mjs test/test-delegated-default-dev19.mjs test/test-delegated-pending-bridge-dev25.mjs test/test-hybrid-scope.mjs",
|
|
50
|
+
"test:observe": "node --conditions=browser --conditions=observe --test test/test.mjs test/test-async.mjs test/test-return.mjs test/test-scope.mjs test/test-manifest.mjs test/test-graph-hardening.mjs test/test-async-transitions.mjs test/test-transaction-integrity.mjs test/test-scheduler-lifecycle.mjs test/test-release-hardening.mjs test/test-discovery.mjs test/test-fastpath.mjs test/test-owner-bound-research.mjs test/test-owner-scope.mjs test/test-notready-lifecycle.mjs test/test-loading-suspension.mjs test/test-loading-recovery-research.mjs test/test-native-notready-parity.mjs test/test-pending-status-propagation.mjs test/test-retained-scope.mjs test/test-research-retained.mjs test/test-parallel-parity.mjs test/test-batched-reads.mjs test/test-direct-links-research.mjs test/test-delegated-scope-research.mjs test/test-owner-cached-delegated.mjs test/test-sharded-delegated.mjs test/test-memory-conformance.mjs test/test-optimized-delegated.mjs test/test-unified-scope-contract.mjs test/test-unified-advanced-contract.mjs test/test-delegated-advanced-contract.mjs test/test-delegated-retention-contract.mjs test/test-delegated-default-dev19.mjs test/test-delegated-pending-bridge-dev25.mjs test/test-hybrid-scope.mjs",
|
|
50
51
|
"test:all": "node scripts/run-tests.mjs",
|
|
51
52
|
"test:package": "node scripts/smoke-package.mjs",
|
|
52
53
|
"test:browser": "node --test test/browser/playwright.test.mjs",
|
|
@@ -57,11 +58,21 @@
|
|
|
57
58
|
"test:unified-contract": "node --conditions=browser --test test/test-unified-scope-contract.mjs test/test-unified-advanced-contract.mjs test/test-delegated-retention-contract.mjs test/test-delegated-default-dev19.mjs && node --conditions=browser --conditions=development --test test/test-unified-scope-contract.mjs test/test-unified-advanced-contract.mjs test/test-delegated-retention-contract.mjs test/test-delegated-default-dev19.mjs && node --conditions=browser --conditions=observe --test test/test-unified-scope-contract.mjs test/test-unified-advanced-contract.mjs test/test-delegated-retention-contract.mjs test/test-delegated-default-dev19.mjs",
|
|
58
59
|
"bench:realistic": "node --conditions=browser --expose-gc research/benchmark-realistic-scopes-dev17.mjs",
|
|
59
60
|
"test:matrix": "node scripts/test-matrix.mjs",
|
|
60
|
-
"setup:browser": "node scripts/setup-browser.mjs"
|
|
61
|
+
"setup:browser": "node scripts/setup-browser.mjs",
|
|
62
|
+
"test:hybrid:browser": "node scripts/browser-hybrid-chromium.mjs --rc=17 && node scripts/browser-hybrid-chromium.mjs --rc=18 && node scripts/setup.mjs --rc=17",
|
|
63
|
+
"test:rc20": "node scripts/test-matrix.mjs --rc=20",
|
|
64
|
+
"test:hybrid:types": "tsc -p tsconfig.hybrid.json"
|
|
61
65
|
},
|
|
62
66
|
"devDependencies": {
|
|
63
67
|
"@solidjs/signals": "2.0.0-rc.17",
|
|
64
68
|
"solid-js": "2.0.0-rc.17",
|
|
65
69
|
"playwright-core": "^1.56.0"
|
|
70
|
+
},
|
|
71
|
+
"typesVersions": {
|
|
72
|
+
"*": {
|
|
73
|
+
"delegated": [
|
|
74
|
+
"types/delegated.d.mts"
|
|
75
|
+
]
|
|
76
|
+
}
|
|
66
77
|
}
|
|
67
78
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One factory for two explicitly separate execution contexts:
|
|
3
|
+
* - tracked computation: attach reads to its captured observer cycle;
|
|
4
|
+
* - plain owned scope: re-enter its owner without reactive attachment.
|
|
5
|
+
*
|
|
6
|
+
* Never mix both semantics in a single invocation. An explicitly supplied
|
|
7
|
+
* observer retains the legacy strict observer-only behavior.
|
|
8
|
+
*/
|
|
9
|
+
import { getObserver, getOwner, isDisposed, runWithOwner } from '@solidjs/signals';
|
|
10
|
+
import {
|
|
11
|
+
createScope as createTrackedScope,
|
|
12
|
+
DisposedScopeError
|
|
13
|
+
} from './attach-read.mjs';
|
|
14
|
+
|
|
15
|
+
/** Original strict, cycle-bound, observer-only factory. */
|
|
16
|
+
export const createObserverScope = createTrackedScope;
|
|
17
|
+
|
|
18
|
+
function ownerFallback(owner) {
|
|
19
|
+
return function scope(callback) {
|
|
20
|
+
if (typeof callback !== 'function') throw new TypeError('scope requires a synchronous callback');
|
|
21
|
+
if (isDisposed(owner)) throw new DisposedScopeError();
|
|
22
|
+
const value = runWithOwner(owner, callback);
|
|
23
|
+
if (value != null && typeof value.then === 'function')
|
|
24
|
+
throw new TypeError('scope callback must be synchronous; split at await before calling scope');
|
|
25
|
+
return value;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Capture either the current tracking observer or, if none, the current owner.
|
|
31
|
+
* An explicit target preserves the legacy createScope(observer) contract:
|
|
32
|
+
* it MUST be a tracking Computed, not a plain owner.
|
|
33
|
+
*/
|
|
34
|
+
export function createHybridScope(owner) {
|
|
35
|
+
if (arguments.length !== 0) return createTrackedScope(owner);
|
|
36
|
+
const observer = getObserver();
|
|
37
|
+
if (observer) return createTrackedScope(observer);
|
|
38
|
+
const capturedOwner = getOwner();
|
|
39
|
+
if (!capturedOwner) {
|
|
40
|
+
throw new Error('createScope requires an active Solid tracking observer or owner');
|
|
41
|
+
}
|
|
42
|
+
if (isDisposed(capturedOwner)) throw new DisposedScopeError();
|
|
43
|
+
return ownerFallback(capturedOwner);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Default factory for owner-scope transforms. */
|
|
47
|
+
export const createScope = createHybridScope;
|
package/src/index.mjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { createRetainedScope } from './retained-scope.mjs';
|
|
2
|
-
export {
|
|
2
|
+
export { createScope, createHybridScope, createObserverScope } from './hybrid-scope.mjs';
|
|
3
|
+
export { attachRead, attachReads, captureOwnerCycle, createOwnerScope, inspectDeps, StaleScopeError, DisposedScopeError } from './attach-read.mjs';
|
package/types/index.d.mts
CHANGED
|
@@ -42,11 +42,22 @@ export declare class DisposedScopeError extends Error {
|
|
|
42
42
|
export declare function captureOwnerCycle(owner?: Owner | null): OwnerCycle;
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
45
|
+
* Hybrid default: capture a tracking observer cycle when available, otherwise
|
|
46
|
+
* capture a plain Solid owner and restore it using runWithOwner() for each
|
|
47
|
+
* synchronous callback. The owner-only branch does not subscribe signal reads.
|
|
48
|
+
* An explicitly passed owner must still be a tracking Computed (the legacy
|
|
49
|
+
* createScope(observer) behavior); plain-owner fallback is implicit only.
|
|
50
|
+
* Calls after observer supersession throw StaleScopeError; calls after
|
|
51
|
+
* either owner is disposed throw DisposedScopeError.
|
|
47
52
|
*/
|
|
48
53
|
export declare function createScope(owner?: Owner | null): Scope;
|
|
49
54
|
|
|
55
|
+
/** Same implementation as createScope: explicit name for the hybrid factory. */
|
|
56
|
+
export declare function createHybridScope(owner?: Owner | null): Scope;
|
|
57
|
+
|
|
58
|
+
/** Strict legacy factory: requires a tracking observer, even under a plain owner. */
|
|
59
|
+
export declare function createObserverScope(owner?: Owner | null): Scope;
|
|
60
|
+
|
|
50
61
|
/**
|
|
51
62
|
* Create an owner-bound callable scope. Unlike createScope(), it stays valid
|
|
52
63
|
* across normal reruns of the same computation and rejects final disposal.
|