@wardic/dom 1.1.0 → 1.1.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/dist/DomProjectionSystem.js +3 -3
- package/dist/DomProjectionSystem.js.map +1 -1
- package/dist/FlushGate.d.ts +6 -6
- package/dist/FlushGate.d.ts.map +1 -1
- package/dist/FlushGate.js +7 -5
- package/dist/FlushGate.js.map +1 -1
- package/dist/ReorderController.js +3 -3
- package/dist/ReorderController.js.map +1 -1
- package/dist/Report.d.ts +1 -1
- package/dist/Report.d.ts.map +1 -1
- package/dist/Report.js +3 -2
- package/dist/Report.js.map +1 -1
- package/dist/Style.d.ts +2 -1
- package/dist/Style.d.ts.map +1 -1
- package/dist/Style.js +3 -1
- package/dist/Style.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/batch-handoff.d.ts +25 -0
- package/dist/internal/batch-handoff.d.ts.map +1 -0
- package/dist/internal/batch-handoff.js +64 -0
- package/dist/internal/batch-handoff.js.map +1 -0
- package/dist/internal/gate-environment.d.ts +4 -0
- package/dist/internal/gate-environment.d.ts.map +1 -0
- package/dist/internal/gate-environment.js +21 -0
- package/dist/internal/gate-environment.js.map +1 -0
- package/dist/internal/projection.js +14 -14
- package/dist/internal/projection.js.map +1 -1
- package/dist/internal/reorder.d.ts +2 -2
- package/dist/internal/reorder.d.ts.map +1 -1
- package/dist/internal/reorder.js +2 -2
- package/dist/internal/reorder.js.map +1 -1
- package/dist/internal/starting-style.d.ts +0 -83
- package/dist/internal/starting-style.d.ts.map +1 -1
- package/dist/internal/starting-style.js +16 -143
- package/dist/internal/starting-style.js.map +1 -1
- package/dist/unstable/AppearAnimations.d.ts +191 -0
- package/dist/unstable/AppearAnimations.d.ts.map +1 -0
- package/dist/unstable/AppearAnimations.js +561 -0
- package/dist/unstable/AppearAnimations.js.map +1 -0
- package/dist/unstable/BatchMembers.d.ts +513 -0
- package/dist/unstable/BatchMembers.d.ts.map +1 -0
- package/dist/unstable/BatchMembers.js +2490 -0
- package/dist/unstable/BatchMembers.js.map +1 -0
- package/dist/unstable/DomValues.d.ts +25 -0
- package/dist/unstable/DomValues.d.ts.map +1 -0
- package/dist/unstable/DomValues.js +45 -0
- package/dist/unstable/DomValues.js.map +1 -0
- package/dist/unstable/DragConstraints.d.ts +48 -0
- package/dist/unstable/DragConstraints.d.ts.map +1 -0
- package/dist/unstable/DragConstraints.js +49 -0
- package/dist/unstable/DragConstraints.js.map +1 -0
- package/dist/unstable/DragControls.d.ts +50 -0
- package/dist/unstable/DragControls.d.ts.map +1 -0
- package/dist/unstable/DragControls.js +55 -0
- package/dist/unstable/DragControls.js.map +1 -0
- package/dist/unstable/DragDefaults.d.ts +34 -0
- package/dist/unstable/DragDefaults.d.ts.map +1 -0
- package/dist/unstable/DragDefaults.js +47 -0
- package/dist/unstable/DragDefaults.js.map +1 -0
- package/dist/unstable/DragTrack.d.ts +236 -0
- package/dist/unstable/DragTrack.d.ts.map +1 -0
- package/dist/unstable/DragTrack.js +646 -0
- package/dist/unstable/DragTrack.js.map +1 -0
- package/dist/unstable/DragTransition.d.ts +22 -0
- package/dist/unstable/DragTransition.d.ts.map +1 -0
- package/dist/unstable/DragTransition.js +31 -0
- package/dist/unstable/DragTransition.js.map +1 -0
- package/dist/unstable/ElementSetup.d.ts +144 -0
- package/dist/unstable/ElementSetup.d.ts.map +1 -0
- package/dist/unstable/ElementSetup.js +297 -0
- package/dist/unstable/ElementSetup.js.map +1 -0
- package/dist/unstable/Feature.d.ts +221 -0
- package/dist/unstable/Feature.d.ts.map +1 -0
- package/dist/unstable/Feature.js +281 -0
- package/dist/unstable/Feature.js.map +1 -0
- package/dist/unstable/GestureFeatures.d.ts +30 -0
- package/dist/unstable/GestureFeatures.d.ts.map +1 -0
- package/dist/unstable/GestureFeatures.js +32 -0
- package/dist/unstable/GestureFeatures.js.map +1 -0
- package/dist/unstable/GestureInfo.d.ts +61 -0
- package/dist/unstable/GestureInfo.d.ts.map +1 -0
- package/dist/unstable/GestureInfo.js +23 -0
- package/dist/unstable/GestureInfo.js.map +1 -0
- package/dist/unstable/Imperative.d.ts +214 -0
- package/dist/unstable/Imperative.d.ts.map +1 -0
- package/dist/unstable/Imperative.js +768 -0
- package/dist/unstable/Imperative.js.map +1 -0
- package/dist/unstable/Instant.d.ts +46 -0
- package/dist/unstable/Instant.d.ts.map +1 -0
- package/dist/unstable/Instant.js +49 -0
- package/dist/unstable/Instant.js.map +1 -0
- package/dist/unstable/LayoutGroup.d.ts +14 -0
- package/dist/unstable/LayoutGroup.d.ts.map +1 -0
- package/dist/unstable/LayoutGroup.js +31 -0
- package/dist/unstable/LayoutGroup.js.map +1 -0
- package/dist/unstable/LayoutMember.d.ts +127 -0
- package/dist/unstable/LayoutMember.d.ts.map +1 -0
- package/dist/unstable/LayoutMember.js +176 -0
- package/dist/unstable/LayoutMember.js.map +1 -0
- package/dist/unstable/LiveStyle.d.ts +171 -0
- package/dist/unstable/LiveStyle.d.ts.map +1 -0
- package/dist/unstable/LiveStyle.js +329 -0
- package/dist/unstable/LiveStyle.js.map +1 -0
- package/dist/unstable/MemberHold.d.ts +3 -0
- package/dist/unstable/MemberHold.d.ts.map +1 -0
- package/dist/unstable/MemberHold.js +223 -0
- package/dist/unstable/MemberHold.js.map +1 -0
- package/dist/unstable/OwnerScope.d.ts +16 -0
- package/dist/unstable/OwnerScope.d.ts.map +1 -0
- package/dist/unstable/OwnerScope.js +35 -0
- package/dist/unstable/OwnerScope.js.map +1 -0
- package/dist/unstable/PresenceController.d.ts +128 -0
- package/dist/unstable/PresenceController.d.ts.map +1 -0
- package/dist/unstable/PresenceController.js +1427 -0
- package/dist/unstable/PresenceController.js.map +1 -0
- package/dist/unstable/Press.d.ts +26 -0
- package/dist/unstable/Press.d.ts.map +1 -0
- package/dist/unstable/Press.js +19 -0
- package/dist/unstable/Press.js.map +1 -0
- package/dist/unstable/ServerInterpolators.d.ts +17 -0
- package/dist/unstable/ServerInterpolators.d.ts.map +1 -0
- package/dist/unstable/ServerInterpolators.js +20 -0
- package/dist/unstable/ServerInterpolators.js.map +1 -0
- package/dist/unstable/WardConfig.d.ts +567 -0
- package/dist/unstable/WardConfig.d.ts.map +1 -0
- package/dist/unstable/WardConfig.js +2 -0
- package/dist/unstable/WardConfig.js.map +1 -0
- package/dist/unstable/features/All.d.ts +24 -0
- package/dist/unstable/features/All.d.ts.map +1 -0
- package/dist/unstable/features/All.js +20 -0
- package/dist/unstable/features/All.js.map +1 -0
- package/dist/unstable/features/Colors.d.ts +12 -0
- package/dist/unstable/features/Colors.d.ts.map +1 -0
- package/dist/unstable/features/Colors.js +38 -0
- package/dist/unstable/features/Colors.js.map +1 -0
- package/dist/unstable/features/DomAnimation.d.ts +16 -0
- package/dist/unstable/features/DomAnimation.d.ts.map +1 -0
- package/dist/unstable/features/DomAnimation.js +19 -0
- package/dist/unstable/features/DomAnimation.js.map +1 -0
- package/dist/unstable/features/DomMax.d.ts +12 -0
- package/dist/unstable/features/DomMax.d.ts.map +1 -0
- package/dist/unstable/features/DomMax.js +14 -0
- package/dist/unstable/features/DomMax.js.map +1 -0
- package/dist/unstable/features/Drag.d.ts +5 -0
- package/dist/unstable/features/Drag.d.ts.map +1 -0
- package/dist/unstable/features/Drag.js +32 -0
- package/dist/unstable/features/Drag.js.map +1 -0
- package/dist/unstable/features/Focus.d.ts +5 -0
- package/dist/unstable/features/Focus.d.ts.map +1 -0
- package/dist/unstable/features/Focus.js +20 -0
- package/dist/unstable/features/Focus.js.map +1 -0
- package/dist/unstable/features/Hover.d.ts +5 -0
- package/dist/unstable/features/Hover.d.ts.map +1 -0
- package/dist/unstable/features/Hover.js +20 -0
- package/dist/unstable/features/Hover.js.map +1 -0
- package/dist/unstable/features/InView.d.ts +5 -0
- package/dist/unstable/features/InView.d.ts.map +1 -0
- package/dist/unstable/features/InView.js +20 -0
- package/dist/unstable/features/InView.js.map +1 -0
- package/dist/unstable/features/Input.d.ts +28 -0
- package/dist/unstable/features/Input.d.ts.map +1 -0
- package/dist/unstable/features/Input.js +31 -0
- package/dist/unstable/features/Input.js.map +1 -0
- package/dist/unstable/features/Keys.d.ts +95 -0
- package/dist/unstable/features/Keys.d.ts.map +1 -0
- package/dist/unstable/features/Keys.js +44 -0
- package/dist/unstable/features/Keys.js.map +1 -0
- package/dist/unstable/features/Layout.d.ts +43 -0
- package/dist/unstable/features/Layout.d.ts.map +1 -0
- package/dist/unstable/features/Layout.js +44 -0
- package/dist/unstable/features/Layout.js.map +1 -0
- package/dist/unstable/features/Pan.d.ts +5 -0
- package/dist/unstable/features/Pan.d.ts.map +1 -0
- package/dist/unstable/features/Pan.js +20 -0
- package/dist/unstable/features/Pan.js.map +1 -0
- package/dist/unstable/features/Press.d.ts +13 -0
- package/dist/unstable/features/Press.d.ts.map +1 -0
- package/dist/unstable/features/Press.js +10 -0
- package/dist/unstable/features/Press.js.map +1 -0
- package/dist/unstable/features/Scroll.d.ts +20 -0
- package/dist/unstable/features/Scroll.d.ts.map +1 -0
- package/dist/unstable/features/Scroll.js +34 -0
- package/dist/unstable/features/Scroll.js.map +1 -0
- package/dist/unstable/features/TimelineKeys.d.ts +7 -0
- package/dist/unstable/features/TimelineKeys.d.ts.map +1 -0
- package/dist/unstable/features/TimelineKeys.js +103 -0
- package/dist/unstable/features/TimelineKeys.js.map +1 -0
- package/package.json +4 -3
- package/src/DomProjectionSystem.ts +3 -3
- package/src/FlushGate.ts +11 -9
- package/src/ReorderController.ts +3 -3
- package/src/Report.ts +3 -7
- package/src/Style.ts +4 -1
- package/src/index.ts +1 -1
- package/src/internal/batch-handoff.ts +75 -0
- package/src/internal/gate-environment.ts +21 -0
- package/src/internal/projection.ts +14 -14
- package/src/internal/reorder.ts +4 -4
- package/src/internal/starting-style.ts +5 -204
- package/src/unstable/AppearAnimations.ts +837 -0
- package/src/unstable/BatchMembers.ts +3085 -0
- package/src/unstable/DomValues.ts +53 -0
- package/src/unstable/DragConstraints.ts +107 -0
- package/src/unstable/DragControls.ts +98 -0
- package/src/unstable/DragDefaults.ts +57 -0
- package/src/unstable/DragTrack.ts +959 -0
- package/src/unstable/DragTransition.ts +46 -0
- package/src/unstable/ElementSetup.ts +411 -0
- package/src/unstable/Feature.ts +494 -0
- package/src/unstable/GestureFeatures.ts +38 -0
- package/src/unstable/GestureInfo.ts +85 -0
- package/src/unstable/Imperative.ts +1037 -0
- package/src/unstable/Instant.ts +93 -0
- package/src/unstable/LayoutGroup.ts +36 -0
- package/src/unstable/LayoutMember.ts +319 -0
- package/src/unstable/LiveStyle.ts +497 -0
- package/src/unstable/MemberHold.ts +211 -0
- package/src/unstable/OwnerScope.ts +35 -0
- package/src/unstable/PresenceController.ts +1747 -0
- package/src/unstable/Press.ts +43 -0
- package/src/unstable/ServerInterpolators.ts +39 -0
- package/src/unstable/WardConfig.ts +704 -0
- package/src/unstable/features/All.ts +39 -0
- package/src/unstable/features/Colors.ts +40 -0
- package/src/unstable/features/DomAnimation.ts +19 -0
- package/src/unstable/features/DomMax.ts +14 -0
- package/src/unstable/features/Drag.ts +34 -0
- package/src/unstable/features/Focus.ts +21 -0
- package/src/unstable/features/Hover.ts +21 -0
- package/src/unstable/features/InView.ts +21 -0
- package/src/unstable/features/Input.ts +37 -0
- package/src/unstable/features/Keys.ts +124 -0
- package/src/unstable/features/Layout.ts +75 -0
- package/src/unstable/features/Pan.ts +21 -0
- package/src/unstable/features/Press.ts +21 -0
- package/src/unstable/features/Scroll.ts +35 -0
- package/src/unstable/features/TimelineKeys.ts +115 -0
- package/dist/internal/gate.d.ts +0 -199
- package/dist/internal/gate.d.ts.map +0 -1
- package/dist/internal/gate.js +0 -570
- package/dist/internal/gate.js.map +0 -1
- package/dist/internal/report.d.ts +0 -30
- package/dist/internal/report.d.ts.map +0 -1
- package/dist/internal/report.js +0 -60
- package/dist/internal/report.js.map +0 -1
- package/dist/internal/runner.d.ts +0 -22
- package/dist/internal/runner.d.ts.map +0 -1
- package/dist/internal/runner.js +0 -62
- package/dist/internal/runner.js.map +0 -1
- package/src/internal/gate.ts +0 -706
- package/src/internal/report.ts +0 -69
- package/src/internal/runner.ts +0 -78
package/dist/internal/report.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Where a binding's failure stops (ADR-0030, decision 4): `reportFailure` logs it at Error and
|
|
3
|
-
* reports it to the Environment's `ErrorReporter`s. Core doesn't report: the Frame loop hands each
|
|
4
|
-
* run's failure to its caller (ADR-0027, decision 7), and a Tier 2 caller may recover. A binding
|
|
5
|
-
* boundary that ends a fiber nobody observes calls this, so a failure there reaches the console
|
|
6
|
-
* and an app's reporters instead of stopping its feature with nothing said.
|
|
7
|
-
*
|
|
8
|
-
* An app installs its reporters on the Environment it hands the provider,
|
|
9
|
-
* `ErrorReporter.layer([…])` merged into `env`; Wardic ships none. With none installed, a report
|
|
10
|
-
* is one `getRef` and a size check, on the failure path only. A reporter built with
|
|
11
|
-
* `ErrorReporter.make` dedupes a cause and its original error, so a failure that crosses two
|
|
12
|
-
* boundaries reports once: pass the cause on as it came, never wrapped.
|
|
13
|
-
*
|
|
14
|
-
* Tier 2 (ADR-0008): for binding authors.
|
|
15
|
-
*/
|
|
16
|
-
import * as Bool from "effect/Boolean";
|
|
17
|
-
import * as Cause from "effect/Cause";
|
|
18
|
-
import * as Effect from "effect/Effect";
|
|
19
|
-
import * as ErrorReporter from "effect/ErrorReporter";
|
|
20
|
-
import * as LogLevel from "effect/LogLevel";
|
|
21
|
-
import * as Predicate from "effect/Predicate";
|
|
22
|
-
import * as References from "effect/References";
|
|
23
|
-
/**
|
|
24
|
-
* `cause` logged at Error as `message`, with the cause, and handed to the Environment's
|
|
25
|
-
* `ErrorReporter`s. An interruption is neither: it's how a run is removed, by a retarget, an unmount or a
|
|
26
|
-
* dispose. Annotate the log by piping `Effect.annotateLogs` onto it.
|
|
27
|
-
*/
|
|
28
|
-
export const reportFailure = (message, cause) => Bool.match(Cause.hasInterruptsOnly(cause), {
|
|
29
|
-
onTrue: () => Effect.void,
|
|
30
|
-
onFalse: () => Effect.logError(message, cause).pipe(Effect.andThen(ErrorReporter.report(cause))),
|
|
31
|
-
});
|
|
32
|
-
/**
|
|
33
|
-
* Whether a Debug log would be kept, as Effect's `MinimumLogLevel` says. Run it once (a runtime, a
|
|
34
|
-
* build) and keep the answer, not once a log.
|
|
35
|
-
*/
|
|
36
|
-
// #618: the spine reads it alone, so an app that logs nothing else doesn't ship debugOf's log.
|
|
37
|
-
export const debugKept = /*#__PURE__*/ Effect.map(References.MinimumLogLevel, (level) => Bool.not(LogLevel.isGreaterThan(level, "Debug")));
|
|
38
|
-
/**
|
|
39
|
-
* A lifecycle debug log for `scope` (`wardic.projection`, say): `log(event, annotations?)` logs
|
|
40
|
-
* `scope: event` at Debug, forked on `runner`, with the annotations. Whether a Debug log would be kept
|
|
41
|
-
* is read once, here ({@link debugKept}): when it wouldn't, `on` is `false` and `log` returns at once,
|
|
42
|
-
* forking nothing. A site that builds its annotations per element checks `on` first.
|
|
43
|
-
*/
|
|
44
|
-
// #618 (M4): each call forked a fiber whatever the level, 0.3-0.5 µs to log nothing (one per layout
|
|
45
|
-
// node's mount and unmount); core's Frame loop reads the level once as this does (frameLoop.ts).
|
|
46
|
-
export const debugOf = (runner, scope) => {
|
|
47
|
-
const on = runner.runSync(debugKept);
|
|
48
|
-
const log = (event, annotations) => {
|
|
49
|
-
if (!on)
|
|
50
|
-
return;
|
|
51
|
-
const logged = Effect.logDebug(`${scope}: ${event}`);
|
|
52
|
-
if (Predicate.isUndefined(annotations)) {
|
|
53
|
-
runner.runFork(logged);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
runner.runFork(Effect.annotateLogs(logged, annotations));
|
|
57
|
-
};
|
|
58
|
-
return Object.assign(log, { on });
|
|
59
|
-
};
|
|
60
|
-
//# sourceMappingURL=report.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/internal/report.ts"],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,EAAE,WAAqC,EAAQ,EAAE;QACzE,IAAI,CAAC,EAAE;YAAE,OAAM;QACf,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,KAAK,KAAK,EAAE,CAAC,CAAA;QACpD,IAAI,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;YACvC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACtB,OAAM;QACR,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAA;IAC1D,CAAC,CAAA;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;AACnC,CAAC,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
import * as Fiber from "effect/Fiber";
|
|
3
|
-
import * as Scope from "effect/Scope";
|
|
4
|
-
/** Runs Effects synchronously, and forked into the Scope it was made in. */
|
|
5
|
-
export interface Runner<R> {
|
|
6
|
-
readonly runSync: <A, E>(effect: Effect.Effect<A, E, R>) => A;
|
|
7
|
-
readonly runFork: <A, E>(effect: Effect.Effect<A, E, R>) => Fiber.Fiber<A, E>;
|
|
8
|
-
/**
|
|
9
|
-
* The Scope it was made in: what a service built with it keeps its own fibers in, so closing the
|
|
10
|
-
* Scope ends them, after the service's own cleanup, and awaits them.
|
|
11
|
-
*/
|
|
12
|
-
readonly scope: Scope.Scope;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* A runner over the current context, without a sync scheduler, holding its forks in a set of its own
|
|
16
|
-
* until the current Scope closes and interrupts them (#746: what a `FiberSet` held, so an app ships no
|
|
17
|
-
* FiberSet); a fork after that is interrupted at once. It forks with that context itself (`Effect.runForkWith`), not through
|
|
18
|
-
* `FiberSet.runtime`, which reads the context again in the current fiber, where the building call's
|
|
19
|
-
* scheduler still is: `Effect.provideContext` merges into a fiber's context, it doesn't replace it.
|
|
20
|
-
*/
|
|
21
|
-
export declare const makeRunner: <R>() => Effect.Effect<Runner<R>, never, R | Scope.Scope>;
|
|
22
|
-
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/internal/runner.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,4EAA4E;AAC5E,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAA;IAC7D,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAC7E;;;OAGG;IAEH,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAA;CAC5B;AAED;;;;;;GAMG;AAGH,eAAO,MAAM,UAAU,GAAI,CAAC,OAAK,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAyB5E,CAAA"}
|
package/dist/internal/runner.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A Layer-built service's runner (#132, ADR-0041): how `FlushGate.make` and `DomProjectionSystem.make`
|
|
3
|
-
* run their Effects after they're built, synchronously and forked, on the context their Layer was
|
|
4
|
-
* built in, forking into its Scope.
|
|
5
|
-
*
|
|
6
|
-
* The context drops a sync scheduler, and keeps any other (ADR-0041, *Amendment (#208)*). A
|
|
7
|
-
* binding's first read builds the Layer inside a `ManagedRuntime.runSync`, whose fiber carries a sync
|
|
8
|
-
* `MixedScheduler`: kept, it would pin every later fork to that scheduler, which resumes a fork's
|
|
9
|
-
* yields on a microtask, where Effect's default resumes them on a macrotask. Without it, forks use
|
|
10
|
-
* the default, as a `ManagedRuntime`'s do. A host's own async scheduler, provided in the Layers it
|
|
11
|
-
* hands Wardic (Foldkit's microtask `MixedScheduler`), is the host's choice: forks keep it (ADR-0027,
|
|
12
|
-
* decision 6: a fork inherits the scheduler it's forked under). A host that provides a *sync* one is
|
|
13
|
-
* overridden too: a sync scheduler is for draining a `runSync`.
|
|
14
|
-
*/
|
|
15
|
-
import * as Bool from "effect/Boolean";
|
|
16
|
-
import * as Context from "effect/Context";
|
|
17
|
-
import * as Effect from "effect/Effect";
|
|
18
|
-
import * as Fiber from "effect/Fiber";
|
|
19
|
-
import * as Scheduler from "effect/Scheduler";
|
|
20
|
-
import * as Scope from "effect/Scope";
|
|
21
|
-
/**
|
|
22
|
-
* A runner over the current context, without a sync scheduler, holding its forks in a set of its own
|
|
23
|
-
* until the current Scope closes and interrupts them (#746: what a `FiberSet` held, so an app ships no
|
|
24
|
-
* FiberSet); a fork after that is interrupted at once. It forks with that context itself (`Effect.runForkWith`), not through
|
|
25
|
-
* `FiberSet.runtime`, which reads the context again in the current fiber, where the building call's
|
|
26
|
-
* scheduler still is: `Effect.provideContext` merges into a fiber's context, it doesn't replace it.
|
|
27
|
-
*/
|
|
28
|
-
// Not `Effect.fnUntraced`, as effect-4's guide prefers: TypeScript can't carry `R` through it, and the
|
|
29
|
-
// runner's context would be `unknown` (#618, H1).
|
|
30
|
-
export const makeRunner = () => Effect.gen(function* () {
|
|
31
|
-
const context = withoutSyncScheduler(yield* Effect.context());
|
|
32
|
-
const fibers = new Set();
|
|
33
|
-
let closed = false;
|
|
34
|
-
yield* Effect.addFinalizer(() => Effect.suspend(() => {
|
|
35
|
-
closed = true;
|
|
36
|
-
return Fiber.interruptAll(fibers);
|
|
37
|
-
}));
|
|
38
|
-
const fork = Effect.runForkWith(context);
|
|
39
|
-
const runFork = (effect) => {
|
|
40
|
-
const fiber = fork(effect);
|
|
41
|
-
if (closed) {
|
|
42
|
-
fiber.interruptUnsafe();
|
|
43
|
-
return fiber;
|
|
44
|
-
}
|
|
45
|
-
fibers.add(fiber);
|
|
46
|
-
fiber.addObserver(() => {
|
|
47
|
-
if (!closed)
|
|
48
|
-
fibers.delete(fiber);
|
|
49
|
-
});
|
|
50
|
-
return fiber;
|
|
51
|
-
};
|
|
52
|
-
return { runSync: Effect.runSyncWith(context), runFork, scope: Context.get(context, Scope.Scope) };
|
|
53
|
-
});
|
|
54
|
-
/**
|
|
55
|
-
* `context` without its scheduler when that one is sync (`runSync`'s), else as it is: a host's
|
|
56
|
-
* async scheduler stays, and with none stored the context has Effect's default already.
|
|
57
|
-
*/
|
|
58
|
-
const withoutSyncScheduler = (context) => Bool.match(Context.get(context, Scheduler.Scheduler).executionMode === "sync", {
|
|
59
|
-
onTrue: () => Context.omit(Scheduler.Scheduler)(context),
|
|
60
|
-
onFalse: () => context,
|
|
61
|
-
});
|
|
62
|
-
//# sourceMappingURL=runner.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/internal/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAcrC;;;;;;GAMG;AACH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