@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 @@
|
|
|
1
|
+
{"version":3,"file":"content-watch.js","sourceRoot":"","sources":["../../src/internal/content-watch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAQvC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAAwB,EAAE,OAA+B,EAAW,EAAE;IAC5F,MAAM,MAAM,GAAG,IAAI,GAAG,EAAmB,CAAA;IACzC,MAAM,OAAO,GAAG,CAAC,GAAY,EAAU,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;IAC5G,OAAO;QACL,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACf,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;YAC1B,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;YAC1B,IAAI,KAAK,KAAK,CAAC;gBAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QACjD,CAAC;QACD,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE;YACjB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;YAC1B,IAAI,KAAK,KAAK,CAAC;gBAAE,OAAM;YACvB,IAAI,KAAK,GAA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AAU,EAAE,CAAA;AACpC,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAE,UAAsB,EAAgB,EAAE,CAClF,MAAM,CAAC,KAAK,CACV,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAE,UAA+C,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EACzI;IACE,MAAM,EAAE,GAAG,EAAE,CAAC,SAAS;IACvB,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QACf,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACrB,OAAO,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;IACjD,CAAC;CACF,CACF,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DOM Environment's Default transition (CONTEXT.md; ADR-0051, #357): Motion's, by value
|
|
3
|
+
* (`.reference/motion` at 16c6122, `motion-dom/src/animation/utils/default-transitions.ts`,
|
|
4
|
+
* `getDefaultTransition`):
|
|
5
|
+
* - a transform but a scale: a spring, 500 / 25, at rest under 10 px/s;
|
|
6
|
+
* - `scale`, `scaleX`, `scaleY`: a spring, 550, critically damped toward 0 (2·√550), else 30;
|
|
7
|
+
* - anything else (opacity, colours, a box's size, a filter): a 0.3 s tween on
|
|
8
|
+
* `cubic-bezier(0.25, 0.1, 0.35, 1)`, "a slightly shallower version of the browser's default ease".
|
|
9
|
+
*
|
|
10
|
+
* - more than two keyframes (#429): Motion's `keyframesTransition`, a 0.8 s tween, each Interval on
|
|
11
|
+
* `easeOut`, the `ease` Motion's `animateMotionValue` gives every value before its default.
|
|
12
|
+
*
|
|
13
|
+
* `DomLive` provides the Layer.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import * as DefaultTransition from "@wardic/core/DefaultTransition";
|
|
18
|
+
import * as Layer from "effect/Layer";
|
|
19
|
+
/** The transition through more than two keyframes, as Motion's `keyframesTransition`: a 0.8 s tween, eased out. */
|
|
20
|
+
export declare const keyframes: DefaultTransition.KeyframesTransition;
|
|
21
|
+
/** The transition `key` runs on toward `target` when its own isn't defined, in the DOM: Motion's. */
|
|
22
|
+
export declare const transitionFor: (key: string, target: number | string) => DefaultTransition.Transition;
|
|
23
|
+
/** The DOM Environment's `DefaultTransition.DefaultTransition`. */
|
|
24
|
+
export declare const DefaultTransitionDomLive: Layer.Layer<DefaultTransition.DefaultTransition>;
|
|
25
|
+
//# sourceMappingURL=default-transition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-transition.d.ts","sourceRoot":"","sources":["../../src/internal/default-transition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,iBAAiB,MAAM,gCAAgC,CAAA;AAGnE,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAcrC,mHAAmH;AAEnH,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,mBAAuE,CAAA;AASjH,qGAAqG;AACrG,eAAO,MAAM,aAAa,QAAS,MAAM,UAAU,MAAM,GAAG,MAAM,KAAG,iBAAiB,CAAC,UACuB,CAAA;AAE9G,mEAAmE;AACnE,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAoF,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DOM Environment's Default transition (CONTEXT.md; ADR-0051, #357): Motion's, by value
|
|
3
|
+
* (`.reference/motion` at 16c6122, `motion-dom/src/animation/utils/default-transitions.ts`,
|
|
4
|
+
* `getDefaultTransition`):
|
|
5
|
+
* - a transform but a scale: a spring, 500 / 25, at rest under 10 px/s;
|
|
6
|
+
* - `scale`, `scaleX`, `scaleY`: a spring, 550, critically damped toward 0 (2·√550), else 30;
|
|
7
|
+
* - anything else (opacity, colours, a box's size, a filter): a 0.3 s tween on
|
|
8
|
+
* `cubic-bezier(0.25, 0.1, 0.35, 1)`, "a slightly shallower version of the browser's default ease".
|
|
9
|
+
*
|
|
10
|
+
* - more than two keyframes (#429): Motion's `keyframesTransition`, a 0.8 s tween, each Interval on
|
|
11
|
+
* `easeOut`, the `ease` Motion's `animateMotionValue` gives every value before its default.
|
|
12
|
+
*
|
|
13
|
+
* `DomLive` provides the Layer.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import * as DefaultTransition from "@wardic/core/DefaultTransition";
|
|
18
|
+
import * as ReducedMotion from "@wardic/core/ReducedMotion";
|
|
19
|
+
import * as Bool from "effect/Boolean";
|
|
20
|
+
import * as Layer from "effect/Layer";
|
|
21
|
+
/** A transform's but a scale's: Motion's `underDampedSpring`. */
|
|
22
|
+
const TRANSFORM = { type: "spring", stiffness: 500, damping: 25, restSpeed: 10 };
|
|
23
|
+
/** A scale's toward 0: Motion's `criticallyDampedSpring`, critically damped, so it doesn't overshoot past 0. */
|
|
24
|
+
const SCALE_TO_ZERO = { type: "spring", stiffness: 550, damping: 2 * Math.sqrt(550), restSpeed: 10 };
|
|
25
|
+
/** A scale's toward anything else: Motion's `criticallyDampedSpring`, with its damping of 30. */
|
|
26
|
+
const SCALE = { type: "spring", stiffness: 550, damping: 30, restSpeed: 10 };
|
|
27
|
+
/** Every other key's: Motion's `ease`. */
|
|
28
|
+
const EASE = { type: "tween", duration: 0.3, ease: [0.25, 0.1, 0.35, 1] };
|
|
29
|
+
/** The transition through more than two keyframes, as Motion's `keyframesTransition`: a 0.8 s tween, eased out. */
|
|
30
|
+
// #429: on its `animateMotionValue`'s `easeOut`.
|
|
31
|
+
export const keyframes = { type: "tween", duration: 0.8, ease: "easeOut" };
|
|
32
|
+
/** A transform's: a scale's, by its target, or the rest's. */
|
|
33
|
+
const transformFor = (key, target) => Bool.match(key.startsWith("scale"), {
|
|
34
|
+
onTrue: () => Bool.match(target === 0, { onTrue: () => SCALE_TO_ZERO, onFalse: () => SCALE }),
|
|
35
|
+
onFalse: () => TRANSFORM,
|
|
36
|
+
});
|
|
37
|
+
/** The transition `key` runs on toward `target` when its own isn't defined, in the DOM: Motion's. */
|
|
38
|
+
export const transitionFor = (key, target) => Bool.match(ReducedMotion.isTransform(key), { onTrue: () => transformFor(key, target), onFalse: () => EASE });
|
|
39
|
+
/** The DOM Environment's `DefaultTransition.DefaultTransition`. */
|
|
40
|
+
export const DefaultTransitionDomLive = Layer.succeed(DefaultTransition.DefaultTransition, { transitionFor, keyframes });
|
|
41
|
+
//# sourceMappingURL=default-transition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-transition.js","sourceRoot":"","sources":["../../src/internal/default-transition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,iBAAiB,MAAM,gCAAgC,CAAA;AACnE,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,iEAAiE;AACjE,MAAM,SAAS,GAAiC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAA;AAE9G,gHAAgH;AAChH,MAAM,aAAa,GAAiC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAA;AAElI,iGAAiG;AACjG,MAAM,KAAK,GAAiC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS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+
/** A drag element's default style for its axis. */
|
|
2
|
+
export type DragDefaultStyle = Readonly<Record<string, string>>;
|
|
3
|
+
/**
|
|
4
|
+
* The default style of a drag element: `touch-action` `none` for a free drag, `pan-y`
|
|
5
|
+
* for an `x` drag and `pan-x` for a `y` drag, with no text selection or iOS callout.
|
|
6
|
+
* One frozen object per axis.
|
|
7
|
+
*/
|
|
8
|
+
export declare const dragDefaultStyle: (axis: boolean | "x" | "y") => DragDefaultStyle;
|
|
9
|
+
/**
|
|
10
|
+
* A Reorder group item's `touch-action` for the group's axis: a `y` list keeps sideways panning, an `x`
|
|
11
|
+
* row vertical panning, and a grid none.
|
|
12
|
+
*/
|
|
13
|
+
export declare const reorderTouchAction: (axis: "x" | "y" | "xy") => string;
|
|
14
|
+
/** The attribute every drag element gets: no native drag of the element or its content. */
|
|
15
|
+
export declare const DRAG_DEFAULT_ATTRIBUTES: Readonly<{
|
|
16
|
+
readonly draggable: "false";
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=drag-defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drag-defaults.d.ts","sourceRoot":"","sources":["../../src/internal/drag-defaults.ts"],"names":[],"mappings":"AAcA,mDAAmD;AACnD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAe/D;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,GAAG,GAAG,GAAG,KAAK,gBAI7D,CAAA;AAED;;;GAGG;AAEH,eAAO,MAAM,kBAAkB,EAAE,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,IAAI,KAAK,MAI5D,CAAA;AAED,2FAA2F;AAC3F,eAAO,MAAM,uBAAuB;wBAA8B,OAAO;EAAY,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The defaults every drag element gets (ADR-0019, *Amendment (Reorder)*, #36), as
|
|
3
|
+
* Motion's draggables do (render/html/use-props.ts:57-73 at
|
|
4
|
+
* 16c61222c4166bbef5ff6ab0051192faa79fa8c8,
|
|
5
|
+
* https://github.com/motiondivision/motion/blob/16c61222c4166bbef5ff6ab0051192faa79fa8c8/packages/framer-motion/src/render/html/use-props.ts#L57-L73):
|
|
6
|
+
* no browser panning on the drag's axes (`touch-action`), so a touch drag isn't taken
|
|
7
|
+
* for a scroll and cancelled; no text selection or iOS callout, so a second drag
|
|
8
|
+
* starting on text the first one selected isn't a native drag; and `draggable="false"`,
|
|
9
|
+
* so an image or link inside doesn't start one. The style maps are kebab-case, for
|
|
10
|
+
* Solid's style objects and the Renderer's `setProperty`. Motion writes them over the
|
|
11
|
+
* user's style; a binding layers them under it, so an app can override one.
|
|
12
|
+
*/
|
|
13
|
+
import * as Match from "effect/Match";
|
|
14
|
+
const styleFor = (touchAction) => Object.freeze({
|
|
15
|
+
"touch-action": touchAction,
|
|
16
|
+
"user-select": "none",
|
|
17
|
+
"-webkit-user-select": "none",
|
|
18
|
+
"-webkit-touch-callout": "none",
|
|
19
|
+
});
|
|
20
|
+
const FREE = styleFor("none");
|
|
21
|
+
// An axis-locked drag keeps the browser's panning on the other axis.
|
|
22
|
+
const X = styleFor("pan-y");
|
|
23
|
+
const Y = styleFor("pan-x");
|
|
24
|
+
/**
|
|
25
|
+
* The default style of a drag element: `touch-action` `none` for a free drag, `pan-y`
|
|
26
|
+
* for an `x` drag and `pan-x` for a `y` drag, with no text selection or iOS callout.
|
|
27
|
+
* One frozen object per axis.
|
|
28
|
+
*/
|
|
29
|
+
export const dragDefaultStyle = Match.type().pipe(Match.when("x", () => X), Match.when("y", () => Y), Match.orElse(() => FREE));
|
|
30
|
+
/**
|
|
31
|
+
* A Reorder group item's `touch-action` for the group's axis: a `y` list keeps sideways panning, an `x`
|
|
32
|
+
* row vertical panning, and a grid none.
|
|
33
|
+
*/
|
|
34
|
+
// A **Reorder group**.
|
|
35
|
+
export const reorderTouchAction = Match.type().pipe(Match.when("y", () => "pan-x"), Match.when("x", () => "pan-y"), Match.orElse(() => "none"));
|
|
36
|
+
/** The attribute every drag element gets: no native drag of the element or its content. */
|
|
37
|
+
export const DRAG_DEFAULT_ATTRIBUTES = Object.freeze({ draggable: "false" });
|
|
38
|
+
//# sourceMappingURL=drag-defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drag-defaults.js","sourceRoot":"","sources":["../../src/internal/drag-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAKrC,MAAM,QAAQ,GAAG,CAAC,WAAmB,EAAoB,EAAE,CACzD,MAAM,CAAC,MAAM,CAAC;IACZ,cAAc,EAAE,WAAW;IAC3B,aAAa,EAAE,MAAM;IACrB,qBAAqB,EAAE,MAAM;IAC7B,uBAAuB,EAAE,MAAM;CAChC,CAAC,CAAA;AAEJ,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAA;AAC7B,qEAAqE;AACrE,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;AAC3B,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;AAE3B;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAoD,KAAK,CAAC,IAAI,EAAuB,CAAC,IAAI,CACrH,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EACxB,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EACxB,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CACzB,CAAA;AAED;;;GAGG;AACH,uBAAuB;AACvB,MAAM,CAAC,MAAM,kBAAkB,GAAuC,KAAK,CAAC,IAAI,EAAoB,CAAC,IAAI,CACvG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAC9B,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAC9B,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAC3B,CAAA;AAED,2FAA2F;AAC3F,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,OAAO,EAAW,CAAC,CAAA"}
|
|
@@ -0,0 +1,186 @@
|
|
|
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 { Atom, AtomRegistry } from "effect/reactivity";
|
|
58
|
+
import * as Effect from "effect/Effect";
|
|
59
|
+
import type * as Fiber from "effect/Fiber";
|
|
60
|
+
import * as Scope from "effect/Scope";
|
|
61
|
+
/**
|
|
62
|
+
* Where a flushed `Patch` is delivered: committed onto `target` with the Renderer's `commit`,
|
|
63
|
+
* at flush time.
|
|
64
|
+
*/
|
|
65
|
+
export interface FlushSink {
|
|
66
|
+
/** The element the patch is committed onto. */
|
|
67
|
+
readonly target: unknown;
|
|
68
|
+
/**
|
|
69
|
+
* Called once, just before the element's first commit in a frame flush (not a Measure
|
|
70
|
+
* pass's `flushPass`), inside the binding's `batch` with every other element's switch that
|
|
71
|
+
* flush: a binding drops its Starting style from its `style` prop here,
|
|
72
|
+
* so its framework removes those keys and the commit writes the first frame in the same
|
|
73
|
+
* Refresh frame, with no paint in between.
|
|
74
|
+
*/
|
|
75
|
+
readonly beforeFirstCommit?: (() => void) | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Called with every key the gate now holds on the element, each time that set changes: after the
|
|
78
|
+
* gate restores a key it dropped, and before the commit that first
|
|
79
|
+
* writes a key. A binding whose `style` prop reaches the element leaves these keys out of it,
|
|
80
|
+
* so its framework never writes over Wardic's value (`style` is a key's fallback). Called in
|
|
81
|
+
* the binding's `batch`, with every other element's whose keys changed that flush, so what the
|
|
82
|
+
* binding changes reaches the element before the commit, a framework that applies an update later
|
|
83
|
+
* (Solid 2) included.
|
|
84
|
+
*/
|
|
85
|
+
readonly onHeld?: ((keys: ReadonlyArray<string>) => void) | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Called once per frame in which the element's values were committed, after every commit of that
|
|
88
|
+
* frame (Motion's `onUpdate`), with its values before
|
|
89
|
+
* projection (`x` as a number). The object is the element's own, reused each call: valid during
|
|
90
|
+
* the call, copied to keep. A Measure pass's commits are told at the frame flush after them, so
|
|
91
|
+
* a frame tells each element once. A write it makes is the next frame's. A throw is reported,
|
|
92
|
+
* and the others are still told.
|
|
93
|
+
*/
|
|
94
|
+
readonly onCommit?: ((values: Readonly<Record<string, unknown>>) => void) | undefined;
|
|
95
|
+
}
|
|
96
|
+
/** A Flush gate: what a binding registers its elements with and writes their values into, one per provider. */
|
|
97
|
+
export interface FlushGate {
|
|
98
|
+
/**
|
|
99
|
+
* Register an element under `id` with its `sink`. Returns an unregister fn
|
|
100
|
+
* that removes the element from the accumulator (a subsequent `write` is a
|
|
101
|
+
* no-op). `values` start its value-map, unflushed: drawn with its first `write`, so they never
|
|
102
|
+
* commit alone.
|
|
103
|
+
*/
|
|
104
|
+
readonly register: (id: string, sink: FlushSink, values?: Readonly<Record<string, unknown>>) => () => void;
|
|
105
|
+
/**
|
|
106
|
+
* Merge `partial` into the element's value-map by key, mark it dirty, and
|
|
107
|
+
* schedule a flush: the end of the Frame loop's tick, for a write made in one, or else the
|
|
108
|
+
* next Refresh frame. A `write` for an unregistered (or unregistered-since) id
|
|
109
|
+
* is a no-op.
|
|
110
|
+
*/
|
|
111
|
+
readonly write: (id: string, partial: Record<string, unknown>) => void;
|
|
112
|
+
/**
|
|
113
|
+
* Run a projection **Measure pass** now and apply exactly what it wrote before
|
|
114
|
+
* returning. Only `write()`s made while
|
|
115
|
+
* `pass()` runs are recorded; each recorded entry is `project`ed and committed once, and
|
|
116
|
+
* marked clean. Everything else stays dirty for its flush. A write made by an effect a sink's
|
|
117
|
+
* hook runs (a Solid effect) takes the ordinary path. The Projection system calls it at the
|
|
118
|
+
* end of a task, so a new layout never paints without its projection.
|
|
119
|
+
*/
|
|
120
|
+
readonly flushPass: (pass: () => void) => void;
|
|
121
|
+
/**
|
|
122
|
+
* Hand `keys` back to the element's own style: drop each from the element's
|
|
123
|
+
* value-map and schedule a flush, which writes `restore[key]` (CSS text) for a key it had
|
|
124
|
+
* written, or else the inline value it overwrote, and tells the sink (`onHeld`). A key the
|
|
125
|
+
* entry doesn't hold, or an unknown id, is a no-op. A binding releases a key back at its `style`
|
|
126
|
+
* value, so a later `style` change shows at rest. A later `write` brings the key back.
|
|
127
|
+
*/
|
|
128
|
+
readonly release: (id: string, keys: ReadonlyArray<string>, restore?: Readonly<Record<string, string>>) => void;
|
|
129
|
+
/**
|
|
130
|
+
* The element's value for `id`'s `key`, live: an `Atom` set as each write that
|
|
131
|
+
* changes it lands, so it's the value the next commit draws, before the Renderer projects it
|
|
132
|
+
* (`x` as a number, not a `transform`). Set at the write, not the commit, so a value derived
|
|
133
|
+
* from it (another key following it through a binding) is written in the same frame and
|
|
134
|
+
* commits with it. `undefined` before the key's first write, and once it's released or the
|
|
135
|
+
* element unregisters. One Atom for an id and a key, made on first ask, so per frame only the
|
|
136
|
+
* keys asked for cost anything.
|
|
137
|
+
*/
|
|
138
|
+
readonly valueOf: (id: string, key: string) => Atom.Atom<unknown>;
|
|
139
|
+
/**
|
|
140
|
+
* Call `fn` once, after the gate's next flush: the end of the Frame loop's tick, for a call
|
|
141
|
+
* made in one, else the next Refresh frame's, so what was written before it is on the elements.
|
|
142
|
+
* It schedules that flush if none is pending. A binding tells an animation's end here, as Motion's
|
|
143
|
+
* `onAnimationComplete` comes with the final value set. One that throws is reported, and the rest
|
|
144
|
+
* still run.
|
|
145
|
+
*/
|
|
146
|
+
readonly afterFlush: (fn: () => void) => void;
|
|
147
|
+
/** Takes the gate off the Frame loop, cancels a pending frame and clears what it held. The Layer's Scope calls it. */
|
|
148
|
+
readonly dispose: () => void;
|
|
149
|
+
}
|
|
150
|
+
/** What a flush gate needs from its Environment: the `Renderer`, the Frame loop it flushes at the end of each tick of, and the `RefreshFrameSource`. */
|
|
151
|
+
export type FlushGateServices = Renderer.Renderer | RefreshFrameSource.RefreshFrameSource | FrameLoop.FrameLoop | AtomRegistry.AtomRegistry;
|
|
152
|
+
/**
|
|
153
|
+
* How the gate runs its Effects: synchronously, and forked. `FlushGate.make` builds one from its
|
|
154
|
+
* Layer's context, forking into its Scope (#132, ADR-0041); a test's `ManagedRuntime` is one too.
|
|
155
|
+
*/
|
|
156
|
+
export interface FlushGateRuntime {
|
|
157
|
+
readonly runSync: <A, E>(effect: Effect.Effect<A, E, FlushGateServices>) => A;
|
|
158
|
+
readonly runFork: <A, E>(effect: Effect.Effect<A, E, FlushGateServices>) => Fiber.Fiber<A, E>;
|
|
159
|
+
/** The Scope it was built in: its own fibers live there, ended as it closes (#618). */
|
|
160
|
+
readonly scope: Scope.Scope;
|
|
161
|
+
}
|
|
162
|
+
/** What a binding hands its flush gate. */
|
|
163
|
+
export interface FlushGateOptions {
|
|
164
|
+
/**
|
|
165
|
+
* Runs a flush's hooks together: calls `apply`, and returns once every update inside it has reached
|
|
166
|
+
* the elements, before the gate commits. Solid 1 passes its `batch`, Solid 2 runs `apply` then
|
|
167
|
+
* `flush()`, and React would pass `flushSync`, untried; a binding with nothing to batch passes
|
|
168
|
+
* `(apply) => apply()`. Called at most twice a flush: once for the starting-style switches
|
|
169
|
+
* (`beforeFirstCommit`) of the elements committing for the first time, before anything is read off the
|
|
170
|
+
* elements; and once for the held keys (`onHeld`) of the elements whose held keys changed.
|
|
171
|
+
*/
|
|
172
|
+
readonly batch: (apply: () => void) => void;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Build a flush gate against the provider's `runtime`, running each frame flush's Starting-style
|
|
176
|
+
* switches through the binding's `batch`.
|
|
177
|
+
*
|
|
178
|
+
* Resolves both ONCE here: `project` is pure and `commit` a plain call (both called directly at
|
|
179
|
+
* flush, ADR-0034), `requestFrame` /
|
|
180
|
+
* `cancelFrame` schedule and cancel the flush of a write made outside a tick, and the Frame
|
|
181
|
+
* loop's `afterTick` takes the gate's hook for its lifetime. All come from whichever env the
|
|
182
|
+
* provider was given (`DomLive` / `TestLive`), so the gate inherits that environment's
|
|
183
|
+
* grouping/unit logic, its Refresh frames and its loop with zero duplication.
|
|
184
|
+
*/
|
|
185
|
+
export declare const makeFlushGate: (runtime: FlushGateRuntime, options: FlushGateOptions) => FlushGate;
|
|
186
|
+
//# sourceMappingURL=gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.d.ts","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;AAEjD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAG1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAKrC;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAA;IACrD;;;;;;;;OAQG;IAEH,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,CAAA;IACrE;;;;;;;OAOG;IACH,QAAQ,CAAC,Q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