@wardic/dom 0.0.0-stage → 1.0.0-rc.2
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/LICENSE +21 -0
- package/README.md +8 -2
- package/THIRD_PARTY_NOTICES.md +145 -0
- package/dist/Appear.d.ts +24 -0
- package/dist/Appear.d.ts.map +1 -0
- package/dist/Appear.js +25 -0
- package/dist/Appear.js.map +1 -0
- package/dist/Color.d.ts +14 -0
- package/dist/Color.d.ts.map +1 -0
- package/dist/Color.js +16 -0
- package/dist/Color.js.map +1 -0
- package/dist/DomAnnouncer.d.ts +13 -0
- package/dist/DomAnnouncer.d.ts.map +1 -0
- package/dist/DomAnnouncer.js +14 -0
- package/dist/DomAnnouncer.js.map +1 -0
- package/dist/DomClock.d.ts +11 -0
- package/dist/DomClock.d.ts.map +1 -0
- package/dist/DomClock.js +12 -0
- package/dist/DomClock.js.map +1 -0
- package/dist/DomDefaultTransition.d.ts +12 -0
- package/dist/DomDefaultTransition.d.ts.map +1 -0
- package/dist/DomDefaultTransition.js +13 -0
- package/dist/DomDefaultTransition.js.map +1 -0
- package/dist/DomInput.d.ts +13 -0
- package/dist/DomInput.d.ts.map +1 -0
- package/dist/DomInput.js +15 -0
- package/dist/DomInput.js.map +1 -0
- package/dist/DomInterpolators.d.ts +13 -0
- package/dist/DomInterpolators.d.ts.map +1 -0
- package/dist/DomInterpolators.js +14 -0
- package/dist/DomInterpolators.js.map +1 -0
- package/dist/DomKeyRules.d.ts +13 -0
- package/dist/DomKeyRules.d.ts.map +1 -0
- package/dist/DomKeyRules.js +14 -0
- package/dist/DomKeyRules.js.map +1 -0
- package/dist/DomPositionalKeys.d.ts +13 -0
- package/dist/DomPositionalKeys.d.ts.map +1 -0
- package/dist/DomPositionalKeys.js +14 -0
- package/dist/DomPositionalKeys.js.map +1 -0
- package/dist/DomProbe.d.ts +13 -0
- package/dist/DomProbe.d.ts.map +1 -0
- package/dist/DomProbe.js +14 -0
- package/dist/DomProbe.js.map +1 -0
- package/dist/DomProjectionSystem.d.ts +28 -0
- package/dist/DomProjectionSystem.d.ts.map +1 -0
- package/dist/DomProjectionSystem.js +41 -0
- package/dist/DomProjectionSystem.js.map +1 -0
- package/dist/DomRenderer.d.ts +13 -0
- package/dist/DomRenderer.d.ts.map +1 -0
- package/dist/DomRenderer.js +15 -0
- package/dist/DomRenderer.js.map +1 -0
- package/dist/FlushGate.d.ts +48 -0
- package/dist/FlushGate.d.ts.map +1 -0
- package/dist/FlushGate.js +62 -0
- package/dist/FlushGate.js.map +1 -0
- package/dist/MeasuredPair.d.ts +14 -0
- package/dist/MeasuredPair.d.ts.map +1 -0
- package/dist/MeasuredPair.js +16 -0
- package/dist/MeasuredPair.js.map +1 -0
- package/dist/OwnValues.d.ts +14 -0
- package/dist/OwnValues.d.ts.map +1 -0
- package/dist/OwnValues.js +15 -0
- package/dist/OwnValues.js.map +1 -0
- package/dist/ProjectionSystem.d.ts +34 -0
- package/dist/ProjectionSystem.d.ts.map +1 -0
- package/dist/ProjectionSystem.js +29 -0
- package/dist/ProjectionSystem.js.map +1 -0
- package/dist/ReorderController.d.ts +41 -0
- package/dist/ReorderController.d.ts.map +1 -0
- package/dist/ReorderController.js +44 -0
- package/dist/ReorderController.js.map +1 -0
- package/dist/Report.d.ts +12 -0
- package/dist/Report.d.ts.map +1 -0
- package/dist/Report.js +13 -0
- package/dist/Report.js.map +1 -0
- package/dist/ScrollOffset.d.ts +34 -0
- package/dist/ScrollOffset.d.ts.map +1 -0
- package/dist/ScrollOffset.js +42 -0
- package/dist/ScrollOffset.js.map +1 -0
- package/dist/Style.d.ts +15 -0
- package/dist/Style.d.ts.map +1 -0
- package/dist/Style.js +17 -0
- package/dist/Style.js.map +1 -0
- package/dist/Svg.d.ts +13 -0
- package/dist/Svg.d.ts.map +1 -0
- package/dist/Svg.js +14 -0
- package/dist/Svg.js.map +1 -0
- package/dist/Variables.d.ts +13 -0
- package/dist/Variables.d.ts.map +1 -0
- package/dist/Variables.js +14 -0
- package/dist/Variables.js.map +1 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/announcer.d.ts +50 -0
- package/dist/internal/announcer.d.ts.map +1 -0
- package/dist/internal/announcer.js +115 -0
- package/dist/internal/announcer.js.map +1 -0
- package/dist/internal/appear.d.ts +169 -0
- package/dist/internal/appear.d.ts.map +1 -0
- package/dist/internal/appear.js +499 -0
- package/dist/internal/appear.js.map +1 -0
- package/dist/internal/auto-scroll.d.ts +24 -0
- package/dist/internal/auto-scroll.d.ts.map +1 -0
- package/dist/internal/auto-scroll.js +124 -0
- package/dist/internal/auto-scroll.js.map +1 -0
- package/dist/internal/clock.d.ts +19 -0
- package/dist/internal/clock.d.ts.map +1 -0
- package/dist/internal/clock.js +39 -0
- package/dist/internal/clock.js.map +1 -0
- package/dist/internal/colors.d.ts +45 -0
- package/dist/internal/colors.d.ts.map +1 -0
- package/dist/internal/colors.js +193 -0
- package/dist/internal/colors.js.map +1 -0
- package/dist/internal/complex.d.ts +24 -0
- package/dist/internal/complex.d.ts.map +1 -0
- package/dist/internal/complex.js +28 -0
- package/dist/internal/complex.js.map +1 -0
- package/dist/internal/content-watch.d.ts +20 -0
- package/dist/internal/content-watch.d.ts.map +1 -0
- package/dist/internal/content-watch.js +76 -0
- package/dist/internal/content-watch.js.map +1 -0
- package/dist/internal/default-transition.d.ts +25 -0
- package/dist/internal/default-transition.d.ts.map +1 -0
- package/dist/internal/default-transition.js +41 -0
- package/dist/internal/default-transition.js.map +1 -0
- package/dist/internal/drag-defaults.d.ts +18 -0
- package/dist/internal/drag-defaults.d.ts.map +1 -0
- package/dist/internal/drag-defaults.js +38 -0
- package/dist/internal/drag-defaults.js.map +1 -0
- package/dist/internal/gate.d.ts +186 -0
- package/dist/internal/gate.d.ts.map +1 -0
- package/dist/internal/gate.js +453 -0
- package/dist/internal/gate.js.map +1 -0
- package/dist/internal/input.d.ts +41 -0
- package/dist/internal/input.d.ts.map +1 -0
- package/dist/internal/input.js +476 -0
- package/dist/internal/input.js.map +1 -0
- package/dist/internal/interpolators.d.ts +19 -0
- package/dist/internal/interpolators.d.ts.map +1 -0
- package/dist/internal/interpolators.js +30 -0
- package/dist/internal/interpolators.js.map +1 -0
- package/dist/internal/key-rules.d.ts +11 -0
- package/dist/internal/key-rules.d.ts.map +1 -0
- package/dist/internal/key-rules.js +244 -0
- package/dist/internal/key-rules.js.map +1 -0
- package/dist/internal/measure.d.ts +150 -0
- package/dist/internal/measure.d.ts.map +1 -0
- package/dist/internal/measure.js +278 -0
- package/dist/internal/measure.js.map +1 -0
- package/dist/internal/measured-pairs.d.ts +38 -0
- package/dist/internal/measured-pairs.d.ts.map +1 -0
- package/dist/internal/measured-pairs.js +251 -0
- package/dist/internal/measured-pairs.js.map +1 -0
- package/dist/internal/own-values.d.ts +35 -0
- package/dist/internal/own-values.d.ts.map +1 -0
- package/dist/internal/own-values.js +117 -0
- package/dist/internal/own-values.js.map +1 -0
- package/dist/internal/pass-ends.d.ts +21 -0
- package/dist/internal/pass-ends.d.ts.map +1 -0
- package/dist/internal/pass-ends.js +14 -0
- package/dist/internal/pass-ends.js.map +1 -0
- package/dist/internal/positional-keys.d.ts +16 -0
- package/dist/internal/positional-keys.d.ts.map +1 -0
- package/dist/internal/positional-keys.js +21 -0
- package/dist/internal/positional-keys.js.map +1 -0
- package/dist/internal/probe.d.ts +10 -0
- package/dist/internal/probe.d.ts.map +1 -0
- package/dist/internal/probe.js +117 -0
- package/dist/internal/probe.js.map +1 -0
- package/dist/internal/projection-defaults.d.ts +34 -0
- package/dist/internal/projection-defaults.d.ts.map +1 -0
- package/dist/internal/projection-defaults.js +21 -0
- package/dist/internal/projection-defaults.js.map +1 -0
- package/dist/internal/projection.d.ts +529 -0
- package/dist/internal/projection.d.ts.map +1 -0
- package/dist/internal/projection.js +4990 -0
- package/dist/internal/projection.js.map +1 -0
- package/dist/internal/renderer.d.ts +86 -0
- package/dist/internal/renderer.d.ts.map +1 -0
- package/dist/internal/renderer.js +616 -0
- package/dist/internal/renderer.js.map +1 -0
- package/dist/internal/reorder.d.ts +159 -0
- package/dist/internal/reorder.d.ts.map +1 -0
- package/dist/internal/reorder.js +437 -0
- package/dist/internal/reorder.js.map +1 -0
- package/dist/internal/report.d.ts +30 -0
- package/dist/internal/report.d.ts.map +1 -0
- package/dist/internal/report.js +60 -0
- package/dist/internal/report.js.map +1 -0
- package/dist/internal/require-global.d.ts +11 -0
- package/dist/internal/require-global.d.ts.map +1 -0
- package/dist/internal/require-global.js +31 -0
- package/dist/internal/require-global.js.map +1 -0
- package/dist/internal/reveal.d.ts +16 -0
- package/dist/internal/reveal.d.ts.map +1 -0
- package/dist/internal/reveal.js +66 -0
- package/dist/internal/reveal.js.map +1 -0
- package/dist/internal/runner.d.ts +21 -0
- package/dist/internal/runner.d.ts.map +1 -0
- package/dist/internal/runner.js +48 -0
- package/dist/internal/runner.js.map +1 -0
- package/dist/internal/scale-correction.d.ts +80 -0
- package/dist/internal/scale-correction.d.ts.map +1 -0
- package/dist/internal/scale-correction.js +227 -0
- package/dist/internal/scale-correction.js.map +1 -0
- package/dist/internal/scroll.d.ts +35 -0
- package/dist/internal/scroll.d.ts.map +1 -0
- package/dist/internal/scroll.js +244 -0
- package/dist/internal/scroll.js.map +1 -0
- package/dist/internal/scrollers.d.ts +35 -0
- package/dist/internal/scrollers.d.ts.map +1 -0
- package/dist/internal/scrollers.js +38 -0
- package/dist/internal/scrollers.js.map +1 -0
- package/dist/internal/starting-style.d.ts +141 -0
- package/dist/internal/starting-style.d.ts.map +1 -0
- package/dist/internal/starting-style.js +300 -0
- package/dist/internal/starting-style.js.map +1 -0
- package/dist/internal/svg.d.ts +60 -0
- package/dist/internal/svg.d.ts.map +1 -0
- package/dist/internal/svg.js +257 -0
- package/dist/internal/svg.js.map +1 -0
- package/dist/internal/variables.d.ts +45 -0
- package/dist/internal/variables.d.ts.map +1 -0
- package/dist/internal/variables.js +92 -0
- package/dist/internal/variables.js.map +1 -0
- package/package.json +65 -4
- package/src/Appear.ts +45 -0
- package/src/Color.ts +24 -0
- package/src/DomAnnouncer.ts +22 -0
- package/src/DomClock.ts +13 -0
- package/src/DomDefaultTransition.ts +16 -0
- package/src/DomInput.ts +22 -0
- package/src/DomInterpolators.ts +16 -0
- package/src/DomKeyRules.ts +17 -0
- package/src/DomPositionalKeys.ts +16 -0
- package/src/DomProbe.ts +15 -0
- package/src/DomProjectionSystem.ts +44 -0
- package/src/DomRenderer.ts +26 -0
- package/src/FlushGate.ts +81 -0
- package/src/MeasuredPair.ts +15 -0
- package/src/OwnValues.ts +19 -0
- package/src/ProjectionSystem.ts +51 -0
- package/src/ReorderController.ts +72 -0
- package/src/Report.ts +17 -0
- package/src/ScrollOffset.ts +54 -0
- package/src/Style.ts +37 -0
- package/src/Svg.ts +21 -0
- package/src/Variables.ts +17 -0
- package/src/index.ts +106 -0
- package/src/internal/announcer.ts +132 -0
- package/src/internal/appear.ts +739 -0
- package/src/internal/auto-scroll.ts +176 -0
- package/src/internal/clock.ts +45 -0
- package/src/internal/colors.ts +258 -0
- package/src/internal/complex.ts +29 -0
- package/src/internal/content-watch.ts +84 -0
- package/src/internal/culori.d.ts +58 -0
- package/src/internal/default-transition.ts +50 -0
- package/src/internal/drag-defaults.ts +54 -0
- package/src/internal/gate.ts +593 -0
- package/src/internal/input.ts +579 -0
- package/src/internal/interpolators.ts +33 -0
- package/src/internal/key-rules.ts +357 -0
- package/src/internal/measure.ts +357 -0
- package/src/internal/measured-pairs.ts +297 -0
- package/src/internal/own-values.ts +166 -0
- package/src/internal/pass-ends.ts +23 -0
- package/src/internal/positional-keys.ts +24 -0
- package/src/internal/probe.ts +176 -0
- package/src/internal/projection-defaults.ts +45 -0
- package/src/internal/projection.ts +5999 -0
- package/src/internal/renderer.ts +646 -0
- package/src/internal/reorder.ts +604 -0
- package/src/internal/report.ts +69 -0
- package/src/internal/require-global.ts +46 -0
- package/src/internal/reveal.ts +69 -0
- package/src/internal/runner.ts +64 -0
- package/src/internal/scale-correction.ts +310 -0
- package/src/internal/scroll.ts +356 -0
- package/src/internal/scrollers.ts +51 -0
- package/src/internal/starting-style.ts +396 -0
- package/src/internal/svg.ts +300 -0
- package/src/internal/variables.ts +145 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `makeFlushGate` — the deferred **Flush gate** (ADR-0006), framework-free here in `@wardic/dom`
|
|
3
|
+
* so every binding shares one (ADR-0031, decision 3). The binding hands in its `batch` and its
|
|
4
|
+
* sinks; the gate imports nothing from a framework.
|
|
5
|
+
*
|
|
6
|
+
* Per ADR-0006, per-frame writes never reach their element directly. Each source
|
|
7
|
+
* `write(id, partialValues)`s into a provider-owned gate that:
|
|
8
|
+
*
|
|
9
|
+
* 1. Accumulates *value-maps* (NOT already-projected Patches) per element,
|
|
10
|
+
* merging partials by key — so multiple sources can feed one element
|
|
11
|
+
* (e.g. a drag setting `x`/`y` while a spring drives `scale`, all
|
|
12
|
+
* collapsing into one grouped `transform`). Projecting per source would
|
|
13
|
+
* clobber the grouped transform.
|
|
14
|
+
* 2. Resolves the Renderer's PURE `project` ONCE at creation and uses it to
|
|
15
|
+
* turn each dirty element's merged value-map into a `Patch` exactly once
|
|
16
|
+
* per element per frame.
|
|
17
|
+
* 3. Commits each resulting Patch onto its element with the Renderer's `commit`, a plain
|
|
18
|
+
* call (ADR-0034) — one DOM pass per frame, shared by every element: at the end of the
|
|
19
|
+
* Frame loop's tick, in the Refresh frame that computed the values (ADR-0033). No
|
|
20
|
+
* framework runs per frame: a binding's JSX carries an element's style only until its
|
|
21
|
+
* first commit (ADR-0021, decision 6), and after it only the keys the gate doesn't hold.
|
|
22
|
+
*
|
|
23
|
+
* Three locked design decisions (this session's grills):
|
|
24
|
+
* - FLUSHED at the end of the Frame loop's tick (ADR-0033): the gate registers a hook on
|
|
25
|
+
* the Environment's loop (`afterTick`), so everything a tick writes is applied at the end
|
|
26
|
+
* of that tick, inside the Clock's callback, and paints in that Refresh frame. A write
|
|
27
|
+
* made outside a tick (a drag's move, a `release` from a task, an effect a sink's hook ran,
|
|
28
|
+
* a Tier 2 `Stream` on `Clock.ticks` subscribed after the loop) still requests a
|
|
29
|
+
* Refresh frame, only if one is not already pending, and the hook withdraws that request
|
|
30
|
+
* when it flushes first. `flush` does NOT auto-reschedule, so an idle accumulator
|
|
31
|
+
* requests no frames — the next `write` does. The frames come from the Environment's
|
|
32
|
+
* `RefreshFrameSource` (ADR-0031): on the web, `requestAnimationFrame` itself. No binding
|
|
33
|
+
* calls the browser's frame functions itself. A Tier 2 `Stream` that writes here paints in
|
|
34
|
+
* the loop's frame or the next one, by its subscription order (ADR-0033): run it on the
|
|
35
|
+
* loop (`Machine.run`) to paint with it.
|
|
36
|
+
* - ONE flush per frame: all dirty elements flush together. The one exception
|
|
37
|
+
* is `flushPass` (ADR-0018): a projection Measure pass's own writes are applied
|
|
38
|
+
* at the end of its task, so a new layout never paints without its projection.
|
|
39
|
+
* - ONE sink shape (ADR-0034): a sink is the element its patch is committed onto. The gate
|
|
40
|
+
* also removes a key its last patch had and this one doesn't (a dragged node's `z-index`
|
|
41
|
+
* once its raise is dropped, ADR-0016 *Amendment (Reorder)*), restoring the element's own
|
|
42
|
+
* inline value, saved before the gate first wrote the key. Two hooks reach the binding,
|
|
43
|
+
* outside the commits, each in the binding's `batch` (ADR-0034, *Amendment (#209)*): the
|
|
44
|
+
* Starting-style switch before an element's first commit (`beforeFirstCommit`), and the keys
|
|
45
|
+
* the gate holds on the element whenever they change (`onHeld`), so the binding's `style`
|
|
46
|
+
* leaves them to Wardic.
|
|
47
|
+
*
|
|
48
|
+
* Observability (CONTEXT.md convention): the hot path (`write`/`flush`) is the
|
|
49
|
+
* per-frame work, so — exactly like core's per-frame writes and the Clock's
|
|
50
|
+
* `tick` — it stays quiet (no span, no per-call log, no metric). A flush that throws (a
|
|
51
|
+
* binding's hook, a commit) is reported (`reportFailure`) and the gate
|
|
52
|
+
* goes on, so it can't fail the Frame loop's tick it runs in (ADR-0033).
|
|
53
|
+
*/
|
|
54
|
+
import * as FrameLoop from "@wardic/core/FrameLoop";
|
|
55
|
+
import * as RefreshFrameSource from "@wardic/core/RefreshFrameSource";
|
|
56
|
+
import * as Renderer from "@wardic/core/Renderer";
|
|
57
|
+
import * as Cause from "effect/Cause";
|
|
58
|
+
import { Atom, AtomRegistry } from "effect/reactivity";
|
|
59
|
+
import * as Effect from "effect/Effect";
|
|
60
|
+
import * as Exit from "effect/Exit";
|
|
61
|
+
import * as Predicate from "effect/Predicate";
|
|
62
|
+
import * as UndefinedOr from "effect/UndefinedOr";
|
|
63
|
+
import * as Scope from "effect/Scope";
|
|
64
|
+
import { reportFailure } from "./report.js";
|
|
65
|
+
import { TEMPLATE_KEY } from "./renderer.js";
|
|
66
|
+
import { dashCase } from "./svg.js";
|
|
67
|
+
/** The element's own inline value for a patch key (`""` for none, or a target with no style). */
|
|
68
|
+
const inlineValueOf = (target, key) => {
|
|
69
|
+
if (Predicate.isNullish(target))
|
|
70
|
+
return "";
|
|
71
|
+
const style = target.style;
|
|
72
|
+
if (Predicate.isUndefined(style))
|
|
73
|
+
return "";
|
|
74
|
+
return style.getPropertyValue(dashCase(key));
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Build a flush gate against the provider's `runtime`, running each frame flush's Starting-style
|
|
78
|
+
* switches through the binding's `batch`.
|
|
79
|
+
*
|
|
80
|
+
* Resolves both ONCE here: `project` is pure and `commit` a plain call (both called directly at
|
|
81
|
+
* flush, ADR-0034), `requestFrame` /
|
|
82
|
+
* `cancelFrame` schedule and cancel the flush of a write made outside a tick, and the Frame
|
|
83
|
+
* loop's `afterTick` takes the gate's hook for its lifetime. All come from whichever env the
|
|
84
|
+
* provider was given (`DomLive` / `TestLive`), so the gate inherits that environment's
|
|
85
|
+
* grouping/unit logic, its Refresh frames and its loop with zero duplication.
|
|
86
|
+
*/
|
|
87
|
+
export const makeFlushGate = (runtime, options) => {
|
|
88
|
+
const { batch } = options;
|
|
89
|
+
// Resolve the Renderer's two halves and the Refresh frame source exactly once at creation.
|
|
90
|
+
// `requestFrame` and `cancelFrame` are called detached, never as `frames.requestFrame(cb)`: a
|
|
91
|
+
// browser throws "Illegal invocation" when `requestAnimationFrame` runs with `this` bound to
|
|
92
|
+
// anything but the window (ADR-0031, decision 7).
|
|
93
|
+
const { commit, project, requestFrame, cancelFrame, afterTick } = runtime.runSync(Effect.gen(function* () {
|
|
94
|
+
const { commit, project } = yield* Renderer.Renderer;
|
|
95
|
+
const { requestFrame, cancelFrame } = yield* RefreshFrameSource.RefreshFrameSource;
|
|
96
|
+
const { afterTick } = yield* FrameLoop.FrameLoop;
|
|
97
|
+
return { commit, project, requestFrame, cancelFrame, afterTick };
|
|
98
|
+
}));
|
|
99
|
+
const accumulator = new Map();
|
|
100
|
+
// Every live output asked for (`valueOf`), by id: an entry registered later picks its map up.
|
|
101
|
+
const outputsById = new Map();
|
|
102
|
+
const registry = runtime.runSync(AtomRegistry.AtomRegistry);
|
|
103
|
+
// Sinks waiting for their first commit's `beforeFirstCommit` (usually empty).
|
|
104
|
+
const firstCommits = new Set();
|
|
105
|
+
let scheduled = false;
|
|
106
|
+
// What `afterFlush` queued since the last flush, called at its end (#257).
|
|
107
|
+
let afterFlushes = [];
|
|
108
|
+
// The pending Refresh frame's handle, while `scheduled`.
|
|
109
|
+
let frame;
|
|
110
|
+
// The ids written while a `flushPass` pass runs; `undefined` otherwise.
|
|
111
|
+
let recording;
|
|
112
|
+
// The entries committed since the last frame flush whose sink has an `onCommit` (#233).
|
|
113
|
+
const committedSince = new Set();
|
|
114
|
+
// A frame flush's entries, in order, prepared and waiting for their commit; and those whose
|
|
115
|
+
// keys held changed, which the binding hears first. Reused each flush: the per-frame path.
|
|
116
|
+
const prepared = [];
|
|
117
|
+
const heldChanged = [];
|
|
118
|
+
/**
|
|
119
|
+
* Project one dirty entry's patch and restore the keys it dropped (once per element per flush),
|
|
120
|
+
* marking it clean: into `into`, and into `held` when the keys it holds change and its sink
|
|
121
|
+
* hears them. Its commit waits for the binding's `batch` of those (ADR-0034, *Amendment
|
|
122
|
+
* (#209)*). Plain calls only: this is the per-frame path.
|
|
123
|
+
*/
|
|
124
|
+
const prepare = (entry, into, held) => {
|
|
125
|
+
const patch = project(entry.values);
|
|
126
|
+
entry.dirty = false;
|
|
127
|
+
entry.patch = patch;
|
|
128
|
+
into.push(entry);
|
|
129
|
+
const sink = entry.sink;
|
|
130
|
+
const target = sink.target;
|
|
131
|
+
const committed = entry.committed;
|
|
132
|
+
const before = committed.size;
|
|
133
|
+
let kept = 0;
|
|
134
|
+
let added = false;
|
|
135
|
+
for (const key in patch) {
|
|
136
|
+
if (committed.has(key)) {
|
|
137
|
+
kept++;
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
committed.set(key, inlineValueOf(target, key));
|
|
141
|
+
added = true;
|
|
142
|
+
}
|
|
143
|
+
// A key the last patch wrote and this one doesn't: the element gets its own value
|
|
144
|
+
// back. Only looked for when one dropped out (the usual frame keeps every key).
|
|
145
|
+
let restore;
|
|
146
|
+
if (kept < before) {
|
|
147
|
+
for (const [key, own] of committed) {
|
|
148
|
+
if (key in patch)
|
|
149
|
+
continue;
|
|
150
|
+
if (Predicate.isUndefined(restore))
|
|
151
|
+
restore = {};
|
|
152
|
+
restore[key] = own;
|
|
153
|
+
committed.delete(key);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (Predicate.isNotUndefined(restore))
|
|
157
|
+
commit(target, restore);
|
|
158
|
+
// The keys held changed (the usual frame changes none): the binding hears before the commit.
|
|
159
|
+
if ((added || Predicate.isNotUndefined(restore)) && Predicate.isNotUndefined(sink.onHeld))
|
|
160
|
+
held.push(entry);
|
|
161
|
+
};
|
|
162
|
+
/** Commit a prepared entry's patch onto its element. */
|
|
163
|
+
const commitPrepared = (entry) => {
|
|
164
|
+
const patch = entry.patch;
|
|
165
|
+
if (Predicate.isUndefined(patch))
|
|
166
|
+
return;
|
|
167
|
+
entry.patch = undefined;
|
|
168
|
+
commit(entry.sink.target, patch);
|
|
169
|
+
if (Predicate.isNotUndefined(entry.sink.onCommit))
|
|
170
|
+
committedSince.add(entry);
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* The prepared entries, committed, after the binding has heard the keys held change, together, in
|
|
174
|
+
* its `batch` (#209); both lists emptied for the next flush.
|
|
175
|
+
*/
|
|
176
|
+
const commitAll = (entries, held) => {
|
|
177
|
+
if (held.length > 0)
|
|
178
|
+
batch(() => tellHeld(held));
|
|
179
|
+
for (let i = 0; i < entries.length; i++)
|
|
180
|
+
commitPrepared(entries[i]);
|
|
181
|
+
entries.length = 0;
|
|
182
|
+
held.length = 0;
|
|
183
|
+
};
|
|
184
|
+
/** Each entry's `onHeld`, with every key the gate holds on its element now. */
|
|
185
|
+
const tellHeld = (held) => {
|
|
186
|
+
for (let i = 0; i < held.length; i++) {
|
|
187
|
+
const entry = held[i];
|
|
188
|
+
const onHeld = entry.sink.onHeld;
|
|
189
|
+
if (Predicate.isNotUndefined(onHeld))
|
|
190
|
+
onHeld(Array.from(entry.committed.keys()));
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Tell each entry committed since the last frame flush, once, after every commit of this one
|
|
195
|
+
* (#233). Its values are copied into its own reused object, so its sink never holds the gate's.
|
|
196
|
+
*/
|
|
197
|
+
const tellCommitted = () => {
|
|
198
|
+
for (const entry of committedSince) {
|
|
199
|
+
const onCommit = entry.sink.onCommit;
|
|
200
|
+
if (Predicate.isUndefined(onCommit))
|
|
201
|
+
continue;
|
|
202
|
+
let latest = entry.latest;
|
|
203
|
+
if (Predicate.isUndefined(latest)) {
|
|
204
|
+
latest = {};
|
|
205
|
+
entry.latest = latest;
|
|
206
|
+
}
|
|
207
|
+
for (const key in latest)
|
|
208
|
+
if (!Object.hasOwn(entry.values, key))
|
|
209
|
+
delete latest[key];
|
|
210
|
+
Object.assign(latest, entry.values);
|
|
211
|
+
// Its Transform template rides in its values (#443), and isn't one: Motion's `onUpdate` never sees it.
|
|
212
|
+
delete latest[TEMPLATE_KEY];
|
|
213
|
+
try {
|
|
214
|
+
onCommit(latest);
|
|
215
|
+
entry.failing = false;
|
|
216
|
+
}
|
|
217
|
+
catch (defect) {
|
|
218
|
+
if (entry.failing)
|
|
219
|
+
continue;
|
|
220
|
+
entry.failing = true;
|
|
221
|
+
runtime.runFork(reportFailure("wardic.gate: an onCommit failed", Cause.die(defect)));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
committedSince.clear();
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* The live outputs asked for of `entry`, each set where its value changed, as a write or a
|
|
228
|
+
* release lands: a value derived from one (a Live value of another key, through a binding) is
|
|
229
|
+
* written in the same frame, and commits with it. An unchanged one skips the registry. Plain
|
|
230
|
+
* calls: a write is the per-frame path.
|
|
231
|
+
*/
|
|
232
|
+
const setOutputs = (entry) => {
|
|
233
|
+
const outputs = entry.outputs;
|
|
234
|
+
if (Predicate.isUndefined(outputs))
|
|
235
|
+
return;
|
|
236
|
+
for (const [key, output] of outputs) {
|
|
237
|
+
const value = entry.values[key];
|
|
238
|
+
if (value === output.last)
|
|
239
|
+
continue;
|
|
240
|
+
output.last = value;
|
|
241
|
+
registry.set(output.atom, value);
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* Run `beforeFirstCommit` for each waiting entry about to commit (dirty), in the binding's
|
|
246
|
+
* `batch` before any commit, so the binding applies what it changes first. A wrap that never
|
|
247
|
+
* commits stays waiting, so this loops over the wraps still waiting, once per frame flush.
|
|
248
|
+
*/
|
|
249
|
+
const runFirstCommits = () => {
|
|
250
|
+
for (const id of firstCommits) {
|
|
251
|
+
const entry = accumulator.get(id);
|
|
252
|
+
if (Predicate.isUndefined(entry) || !entry.dirty)
|
|
253
|
+
continue;
|
|
254
|
+
firstCommits.delete(id);
|
|
255
|
+
const hook = entry.sink.beforeFirstCommit;
|
|
256
|
+
if (Predicate.isNotUndefined(hook))
|
|
257
|
+
hook();
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
const flush = () => {
|
|
261
|
+
scheduled = false;
|
|
262
|
+
try {
|
|
263
|
+
// The switches first: an element's own inline values are read once its Starting style is gone.
|
|
264
|
+
if (firstCommits.size > 0)
|
|
265
|
+
batch(runFirstCommits);
|
|
266
|
+
// Every dirty element, once. No auto-reschedule — the next write() does. A write()
|
|
267
|
+
// from an effect a sink's hook runs requests the next frame (it isn't stranded).
|
|
268
|
+
for (const entry of accumulator.values())
|
|
269
|
+
if (entry.dirty)
|
|
270
|
+
prepare(entry, prepared, heldChanged);
|
|
271
|
+
commitAll(prepared, heldChanged);
|
|
272
|
+
if (committedSince.size > 0)
|
|
273
|
+
tellCommitted();
|
|
274
|
+
}
|
|
275
|
+
catch (defect) {
|
|
276
|
+
prepared.length = 0;
|
|
277
|
+
heldChanged.length = 0;
|
|
278
|
+
runtime.runFork(reportFailure("wardic.gate: a flush failed", Cause.die(defect)));
|
|
279
|
+
}
|
|
280
|
+
if (afterFlushes.length > 0)
|
|
281
|
+
runAfterFlushes();
|
|
282
|
+
};
|
|
283
|
+
/** The calls `afterFlush` queued, each once, a new queue for any they make. */
|
|
284
|
+
const runAfterFlushes = () => {
|
|
285
|
+
const due = afterFlushes;
|
|
286
|
+
afterFlushes = [];
|
|
287
|
+
for (const fn of due) {
|
|
288
|
+
try {
|
|
289
|
+
fn();
|
|
290
|
+
}
|
|
291
|
+
catch (defect) {
|
|
292
|
+
runtime.runFork(reportFailure("wardic.gate: an afterFlush call failed", Cause.die(defect)));
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
const afterFlush = (fn) => {
|
|
297
|
+
afterFlushes.push(fn);
|
|
298
|
+
scheduleFlush();
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* The end of the Frame loop's tick (ADR-0033): flush now, in the Refresh frame that computed
|
|
302
|
+
* the values, and withdraw the frame the first write since the last flush requested.
|
|
303
|
+
*/
|
|
304
|
+
const flushTicked = () => {
|
|
305
|
+
if (!scheduled)
|
|
306
|
+
return undefined;
|
|
307
|
+
cancelFrame(frame);
|
|
308
|
+
flush();
|
|
309
|
+
return undefined;
|
|
310
|
+
};
|
|
311
|
+
const scheduleFlush = () => {
|
|
312
|
+
if (scheduled)
|
|
313
|
+
return;
|
|
314
|
+
scheduled = true;
|
|
315
|
+
frame = requestFrame(flush);
|
|
316
|
+
};
|
|
317
|
+
const register = (id, sink, values) => {
|
|
318
|
+
const entry = { values: UndefinedOr.match(values, { onUndefined: () => ({}), onDefined: (start) => ({ ...start }) }), sink, dirty: false, committed: new Map(), outputs: outputsById.get(id), latest: undefined, failing: false, patch: undefined };
|
|
319
|
+
accumulator.set(id, entry);
|
|
320
|
+
if (Predicate.isNotUndefined(sink.beforeFirstCommit))
|
|
321
|
+
firstCommits.add(id);
|
|
322
|
+
return () => {
|
|
323
|
+
accumulator.delete(id);
|
|
324
|
+
firstCommits.delete(id);
|
|
325
|
+
committedSince.delete(entry);
|
|
326
|
+
endOutputs(id);
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
/** `id`'s live outputs, each set to `undefined` and forgotten: its element is gone. */
|
|
330
|
+
const endOutputs = (id) => {
|
|
331
|
+
const outputs = outputsById.get(id);
|
|
332
|
+
if (Predicate.isUndefined(outputs))
|
|
333
|
+
return;
|
|
334
|
+
outputsById.delete(id);
|
|
335
|
+
for (const output of outputs.values()) {
|
|
336
|
+
registry.set(output.atom, undefined);
|
|
337
|
+
output.unmount();
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
/** `id`'s current value for `key`, or `undefined` for an unregistered id or a key it hasn't written. */
|
|
341
|
+
const committedValueOf = (id, key) => {
|
|
342
|
+
const entry = accumulator.get(id);
|
|
343
|
+
if (Predicate.isUndefined(entry))
|
|
344
|
+
return undefined;
|
|
345
|
+
return entry.values[key];
|
|
346
|
+
};
|
|
347
|
+
const valueOf = (id, key) => {
|
|
348
|
+
let outputs = outputsById.get(id);
|
|
349
|
+
if (Predicate.isUndefined(outputs)) {
|
|
350
|
+
outputs = new Map();
|
|
351
|
+
outputsById.set(id, outputs);
|
|
352
|
+
const entry = accumulator.get(id);
|
|
353
|
+
if (Predicate.isNotUndefined(entry))
|
|
354
|
+
entry.outputs = outputs;
|
|
355
|
+
}
|
|
356
|
+
const known = outputs.get(key);
|
|
357
|
+
if (Predicate.isNotUndefined(known))
|
|
358
|
+
return known.atom;
|
|
359
|
+
// Made `undefined` and mounted until its element unregisters, not kept alive: a kept-alive
|
|
360
|
+
// Atom's node never leaves the registry, and one left behind reads `undefined` afresh.
|
|
361
|
+
const atom = Atom.make(undefined);
|
|
362
|
+
const output = { atom, last: undefined, unmount: registry.mount(atom) };
|
|
363
|
+
outputs.set(key, output);
|
|
364
|
+
const value = committedValueOf(id, key);
|
|
365
|
+
if (Predicate.isNotUndefined(value)) {
|
|
366
|
+
output.last = value;
|
|
367
|
+
registry.set(atom, value);
|
|
368
|
+
}
|
|
369
|
+
return atom;
|
|
370
|
+
};
|
|
371
|
+
const write = (id, partial) => {
|
|
372
|
+
const entry = accumulator.get(id);
|
|
373
|
+
if (Predicate.isUndefined(entry))
|
|
374
|
+
return;
|
|
375
|
+
Object.assign(entry.values, partial);
|
|
376
|
+
entry.dirty = true;
|
|
377
|
+
if (Predicate.isNotUndefined(recording))
|
|
378
|
+
recording.add(id);
|
|
379
|
+
scheduleFlush();
|
|
380
|
+
setOutputs(entry);
|
|
381
|
+
};
|
|
382
|
+
const flushPass = (pass) => {
|
|
383
|
+
const written = new Set();
|
|
384
|
+
recording = written;
|
|
385
|
+
try {
|
|
386
|
+
pass();
|
|
387
|
+
}
|
|
388
|
+
finally {
|
|
389
|
+
recording = undefined;
|
|
390
|
+
}
|
|
391
|
+
if (written.size === 0)
|
|
392
|
+
return;
|
|
393
|
+
// No `beforeFirstCommit` here: a Measure pass may write only a node's projection, and
|
|
394
|
+
// dropping the Starting style then would leave its animated keys unset until the frame
|
|
395
|
+
// flush (a frame later for an element mounted inside a frame). The frame flush switches.
|
|
396
|
+
// A commit here is told at the frame flush (#233): the write that made it scheduled that flush.
|
|
397
|
+
// Its own lists: a pass may run from a hook the frame flush's `batch` runs.
|
|
398
|
+
const entries = [];
|
|
399
|
+
const held = [];
|
|
400
|
+
for (const id of written) {
|
|
401
|
+
const entry = accumulator.get(id);
|
|
402
|
+
if (Predicate.isNotUndefined(entry) && entry.dirty)
|
|
403
|
+
prepare(entry, entries, held);
|
|
404
|
+
}
|
|
405
|
+
commitAll(entries, held);
|
|
406
|
+
};
|
|
407
|
+
const release = (id, keys, restore) => {
|
|
408
|
+
const entry = accumulator.get(id);
|
|
409
|
+
if (Predicate.isUndefined(entry))
|
|
410
|
+
return;
|
|
411
|
+
let released = false;
|
|
412
|
+
for (const key of keys) {
|
|
413
|
+
if (!Object.hasOwn(entry.values, key))
|
|
414
|
+
continue;
|
|
415
|
+
delete entry.values[key];
|
|
416
|
+
released = true;
|
|
417
|
+
// The drop-out path in `apply` writes the saved value back: make it the one handed in.
|
|
418
|
+
if (Predicate.isUndefined(restore))
|
|
419
|
+
continue;
|
|
420
|
+
const value = restore[key];
|
|
421
|
+
if (Predicate.isNotUndefined(value) && entry.committed.has(key))
|
|
422
|
+
entry.committed.set(key, value);
|
|
423
|
+
}
|
|
424
|
+
if (!released)
|
|
425
|
+
return;
|
|
426
|
+
entry.dirty = true;
|
|
427
|
+
scheduleFlush();
|
|
428
|
+
setOutputs(entry);
|
|
429
|
+
};
|
|
430
|
+
const dispose = () => {
|
|
431
|
+
// Off the loop first, so no tick flushes what follows; a failure reported, never thrown (#618).
|
|
432
|
+
const unhooked = Effect.runSyncExit(Scope.close(ticks, Exit.void));
|
|
433
|
+
if (Exit.isFailure(unhooked))
|
|
434
|
+
runtime.runFork(reportFailure("wardic.gate: its tick hook failed to close", unhooked.cause));
|
|
435
|
+
if (scheduled) {
|
|
436
|
+
cancelFrame(frame);
|
|
437
|
+
scheduled = false;
|
|
438
|
+
}
|
|
439
|
+
accumulator.clear();
|
|
440
|
+
firstCommits.clear();
|
|
441
|
+
committedSince.clear();
|
|
442
|
+
// The calls waiting on a flush that won't come: their provider is gone (#257).
|
|
443
|
+
afterFlushes = [];
|
|
444
|
+
for (const id of [...outputsById.keys()])
|
|
445
|
+
endOutputs(id);
|
|
446
|
+
};
|
|
447
|
+
// The gate's hook on the loop, for the gate's lifetime: a child of the Scope it's built in, so a gate
|
|
448
|
+
// its `dispose` never reached is unhooked as that Scope closes.
|
|
449
|
+
const ticks = Scope.forkUnsafe(runtime.scope, "sequential");
|
|
450
|
+
runtime.runSync(afterTick(flushTicked).pipe(Scope.provide(ticks)));
|
|
451
|
+
return { register, write, flushPass, release, valueOf, afterFlush, dispose };
|
|
452
|
+
};
|
|
453
|
+
//# sourceMappingURL=gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.js","sourceRoot":"","sources":["../../src/internal/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,kBAAkB,MAAM,iCAAiC,CAAA;AACrE,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAA;AACjD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AAEnC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AACjD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OA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ACnB,CAAC,CAAA;IAED,MAAM,OAAO,GAAyB,GAAG,EAAE;QACzC,gGAAgG;QAChG,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QAClE,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;YAAE,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,4CAA4C,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA;QAC1H,IAAI,SAAS,EAAE,CAAC;YACd,WAAW,CAAC,KAAK,CAAC,CAAA;YAClB,SAAS,GAAG,KAAK,CAAA;QACnB,CAAC;QACD,WAAW,CAAC,KAAK,EAAE,CAAA;QACnB,YAAY,CAAC,KAAK,EAAE,CAAA;QACpB,cAAc,CAAC,KAAK,EAAE,CAAA;QACtB,+EAA+E;QAC/E,YAAY,GAAG,EAAE,CAAA;QACjB,KAAK,MAAM,EAAE,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;YAAE,UAAU,CAAC,EAAE,CAAC,CAAA;IAC1D,CAAC,CAAA;IAED,sGAAsG;IACtG,gEAAgE;IAChE,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;IAC3D,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAElE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAA;AAC9E,CAAC,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as InputSource from "@wardic/core/InputSource";
|
|
2
|
+
import type * as Point from "@wardic/core/Point";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
/** A `PointerEvent.pointerType` as core's pointer kind: the DOM's three, else `"other"`. */
|
|
5
|
+
export declare const kindOf: (pointerType: string) => InputSource.PointerKind;
|
|
6
|
+
/**
|
|
7
|
+
* A `PointerEvent.button` in core's names: 0 the main button, 1 the middle, 2 the secondary, -1 none, as
|
|
8
|
+
* on a move, and the rest, back, forward, a pen's eraser, other.
|
|
9
|
+
*/
|
|
10
|
+
export declare const buttonOf: (button: number) => InputSource.PointerButton;
|
|
11
|
+
/** Where a pointer event landed, as its feed says: on the feed's target, or elsewhere. */
|
|
12
|
+
export type Where = "target" | "elsewhere";
|
|
13
|
+
/**
|
|
14
|
+
* A DOM `PointerEvent` as core's pointer event: at its point in the viewport, with no scroll counted
|
|
15
|
+
* (`InputSource.heldPointer` counts it), and where it landed as its feed says: on the feed's target, or
|
|
16
|
+
* elsewhere.
|
|
17
|
+
*/
|
|
18
|
+
export declare const toPointer: (type: InputSource.PointerLikeEvent["type"], ev: PointerEvent, where?: Where) => InputSource.PointerLikeEvent;
|
|
19
|
+
/**
|
|
20
|
+
* The scroll since `target`'s current hold began, summed over its window and its
|
|
21
|
+
* scrollable ancestors: a held drag's point minus this is the pointer's viewport
|
|
22
|
+
* position. `{ x: 0, y: 0 }` when nothing is held on it.
|
|
23
|
+
*
|
|
24
|
+
* @internal for the auto-scroller.
|
|
25
|
+
*/
|
|
26
|
+
export declare const heldScrollShift: (target: unknown) => Point.Point;
|
|
27
|
+
/** A `KeyboardEvent.key` in core's names: the keys core acts on, else `"other"`. */
|
|
28
|
+
export declare const keyOf: (key: string) => InputSource.Key;
|
|
29
|
+
/**
|
|
30
|
+
* Makes a pressable element focusable, as Motion's press does: an HTML element that doesn't take focus
|
|
31
|
+
* of itself, with no `tabindex`, gets `tabindex="0"`, so a key can press it. An SVG element, or one
|
|
32
|
+
* already focusable, is left as it is. Called at mount, on the client.
|
|
33
|
+
*/
|
|
34
|
+
export declare const makeFocusable: (target: unknown) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Core's `InputSource` on the DOM's events: each target's pointer, keys and focus, shared by everyone
|
|
37
|
+
* who listens to it, for as long as the Layer lives. Building it on a server fails, with an error that
|
|
38
|
+
* says it's client-only.
|
|
39
|
+
*/
|
|
40
|
+
export declare const InputDomLive: Layer.Layer<InputSource.InputSource>;
|
|
41
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/internal/input.ts"],"names":[],"mappings":"AA+CA,OAAO,KAAK,WAAW,MAAM,0BAA0B,CAAA;AACvD,OAAO,KAAK,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAKhD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AA0BrC,4FAA4F;AAG5F,eAAO,MAAM,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,WAAW,CAAC,WAKzD,CAAA;AAED;;;GAGG;AAEH,eAAO,MAAM,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,WAAW,CAAC,aAMtD,CAAA;AAED,0FAA0F;AAC1F,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,WAAW,CAAA;AAQ1C;;;;GAIG;AAEH,eAAO,MAAM,SAAS,SAAU,WAAW,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,YAAY,UAAS,KAAK,KAAc,WAAW,CAAC,gBAc5H,CAAA;AA4FF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,WAAY,OAAO,KAAG,KAAK,CAAC,KAC2D,CAAA;AAyEnH,oFAAoF;AAEpF,eAAO,MAAM,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,WAAW,CAAC,GAWhD,CAAA;AAyDD;;;;GAIG;AAEH,eAAO,MAAM,aAAa,WAAY,OAAO,KAAG,IAK/C,CAAA;AA0LD;;;;GAIG;AAGH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,CAA+C,CAAA"}
|