@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,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DOM's Projection system: `layer` builds it, writing through the Environment's
|
|
3
|
+
* `FlushGate`, and `make` builds it over any sink, for a binding that wires it itself. Only a binding's
|
|
4
|
+
* layout feature imports it, so a page that never lays out ships none of it. Closing its Scope stops the
|
|
5
|
+
* engine: its run, its observers and listeners, and what it forked. Built after the gate, it ends before
|
|
6
|
+
* it.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import * as DomProjectionSystem from "@wardic/dom/DomProjectionSystem"
|
|
10
|
+
*
|
|
11
|
+
* const layout = DomProjectionSystem.layer().pipe(Layer.provide(FlushGate.layer({ batch: (apply) => apply() })))
|
|
12
|
+
*/
|
|
13
|
+
// The DOM's **Projection system** engine (#548, ADR-0041's `Dom` implementations), apart from
|
|
14
|
+
// `ProjectionSystem`'s key and types (ADR-0067, *Amendment (#548)*). Its members are plain functions.
|
|
15
|
+
import * as Context from "effect/Context";
|
|
16
|
+
import * as Effect from "effect/Effect";
|
|
17
|
+
import * as Layer from "effect/Layer";
|
|
18
|
+
import * as FlushGate from "./FlushGate.js";
|
|
19
|
+
import { PassEnds } from "./internal/pass-ends.js";
|
|
20
|
+
import * as internal from "./internal/projection.js";
|
|
21
|
+
import { makeRunner } from "./internal/runner.js";
|
|
22
|
+
import { ProjectionSystem } from "./ProjectionSystem.js";
|
|
23
|
+
/**
|
|
24
|
+
* Build the engine over `sink`, the context's Frame loop and Renderer, in the current Scope: what
|
|
25
|
+
* it forks runs in that Scope, and closing it ends the engine. It's the `ProjectionSystem` in the
|
|
26
|
+
* context it gives, beside what a Reorder controller over it needs.
|
|
27
|
+
*/
|
|
28
|
+
// The context holds the internal `PassEnds` too (internal/pass-ends.ts, #618), the engine's own, so a
|
|
29
|
+
// ProjectionSystem a binding wraps or replaces in its context still has its Reorder controller hear
|
|
30
|
+
// each Measure pass. Its runner forks on Effect's default scheduler, whatever call built the Layer
|
|
31
|
+
// (`internal/runner.ts`).
|
|
32
|
+
export const make =
|
|
33
|
+
/*#__PURE__*/ Effect.fnUntraced(function* (sink, options = {}) {
|
|
34
|
+
// Typed without `dispose` and `onPassEnd`: the Scope ends it, and `PassEnds` hands the other out.
|
|
35
|
+
const system = internal.makeProjectionSystem(yield* makeRunner(), sink, options);
|
|
36
|
+
yield* Effect.addFinalizer(() => Effect.sync(system.dispose));
|
|
37
|
+
return Context.make(ProjectionSystem, system).pipe(Context.add(PassEnds, { onPassEnd: system.onPassEnd }));
|
|
38
|
+
});
|
|
39
|
+
/** The engine as a Layer, writing through the Environment's `FlushGate`: built by `make`, ended by the Layer's Scope. */
|
|
40
|
+
export const layer = (options = {}) => Layer.effectContext(Effect.flatMap(Effect.service(FlushGate.FlushGate), (gate) => make(gate, options)));
|
|
41
|
+
//# sourceMappingURL=DomProjectionSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DomProjectionSystem.js","sourceRoot":"","sources":["../src/DomProjectionSystem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,8FAA8F;AAC9F,sGAAsG;AACtG,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAsD,MAAM,uBAAuB,CAAA;AAE5G;;;;GAIG;AACH,sGAAsG;AACtG,oGAAoG;AACpG,mGAAmG;AACnG,0BAA0B;AAC1B,MAAM,CAAC,MAAM,IAAI;AACf,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,IAAU,EAAE,OAAO,GAAY,EAAE;IAC1E,kGAAkG;IAClG,MAAM,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,UAAU,EAAY,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IAC1F,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;IAC7D,OAAO,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,MAAe,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;AACrH,CAAC,CAAC,CAAA;AAEJ,yHAAyH;AACzH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAO,GAAY,EAAE,EAAmF,EAAE,CAC9H,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DOM's Renderer: `project` turns a Frame's values into a style patch, grouping the transform keys
|
|
3
|
+
* into one `transform` and drawing a bare number on a length in `px`, and its `commit` writes the patch
|
|
4
|
+
* onto an element. The rest is for a binding's layout projection: an element's own move, scale, rotation
|
|
5
|
+
* and opacity, read from its values, and its transform template.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import * as DomRenderer from "@wardic/dom/DomRenderer"
|
|
9
|
+
*
|
|
10
|
+
* DomRenderer.project({ x: 100, opacity: 0.5 }) // { transform: "translateX(100px)", opacity: 0.5 }
|
|
11
|
+
*/
|
|
12
|
+
export { RendererDomLive as layer, project, ownScaleOf, ownTranslateOf, ownRotateOf, ownOpacityOf, TEMPLATE_KEY, type TransformTemplate, heldTransformOf, LENGTH_KEYS, type LengthKey, } from "./internal/renderer.ts";
|
|
13
|
+
//# sourceMappingURL=DomRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DomRenderer.d.ts","sourceRoot":"","sources":["../src/DomRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EACL,eAAe,IAAI,KAAK,EACxB,OAAO,EACP,UAAU,EACV,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,KAAK,iBAAiB,EACtB,eAAe,EACf,WAAW,EACX,KAAK,SAAS,GACf,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DOM's Renderer: `project` turns a Frame's values into a style patch, grouping the transform keys
|
|
3
|
+
* into one `transform` and drawing a bare number on a length in `px`, and its `commit` writes the patch
|
|
4
|
+
* onto an element. The rest is for a binding's layout projection: an element's own move, scale, rotation
|
|
5
|
+
* and opacity, read from its values, and its transform template.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import * as DomRenderer from "@wardic/dom/DomRenderer"
|
|
9
|
+
*
|
|
10
|
+
* DomRenderer.project({ x: 100, opacity: 0.5 }) // { transform: "translateX(100px)", opacity: 0.5 }
|
|
11
|
+
*/
|
|
12
|
+
// `@wardic/dom/DomRenderer` (#132, ADR-0041): ADR-0006, ADR-0034; the **Transform template** (#443);
|
|
13
|
+
// `LENGTH_KEYS` (#522).
|
|
14
|
+
export { RendererDomLive as layer, project, ownScaleOf, ownTranslateOf, ownRotateOf, ownOpacityOf, TEMPLATE_KEY, heldTransformOf, LENGTH_KEYS, } from "./internal/renderer.js";
|
|
15
|
+
//# sourceMappingURL=DomRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DomRenderer.js","sourceRoot":"","sources":["../src/DomRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,qGAAqG;AACrG,wBAAwB;AACxB,OAAO,EACL,eAAe,IAAI,KAAK,EACxB,OAAO,EACP,UAAU,EACV,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EAEZ,eAAe,EACf,WAAW,GAEZ,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Flush gate: where a binding writes each element's animated values, drawn onto the elements once a
|
|
3
|
+
* frame. A binding registers each element with its target, writes values as its animations step, and the
|
|
4
|
+
* gate draws them together, at the end of the frame's animation tick, through the Environment's renderer;
|
|
5
|
+
* a write made outside a tick, as a drag's move is, asks for a frame of its own. A server render gets
|
|
6
|
+
* `inert`, which does nothing.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import * as FlushGate from "@wardic/dom/FlushGate"
|
|
10
|
+
*
|
|
11
|
+
* const gate = yield* FlushGate.FlushGate
|
|
12
|
+
* const unregister = gate.register("card", { target: card })
|
|
13
|
+
* gate.write("card", { opacity: 0.5 }) // drawn at the next frame
|
|
14
|
+
*/
|
|
15
|
+
import * as Context from "effect/Context";
|
|
16
|
+
import * as Effect from "effect/Effect";
|
|
17
|
+
import * as Layer from "effect/Layer";
|
|
18
|
+
import type * as Scope from "effect/Scope";
|
|
19
|
+
import * as internal from "./internal/gate.ts";
|
|
20
|
+
/** The gate: what a binding registers its elements with and writes their values into. */
|
|
21
|
+
export type Shape = Omit<internal.FlushGate, "dispose">;
|
|
22
|
+
/** An element's commit target and hooks, given to `register`. */
|
|
23
|
+
export type Sink = internal.FlushSink;
|
|
24
|
+
/** What a binding hands its gate: the `batch` a frame's Starting-style switches run in. */
|
|
25
|
+
export type Options = internal.FlushGateOptions;
|
|
26
|
+
/** The services a gate needs from its Environment. */
|
|
27
|
+
export type Services = internal.FlushGateServices;
|
|
28
|
+
declare const FlushGate_base: Context.ServiceClass<FlushGate, "@wardic/dom/FlushGate", Shape>;
|
|
29
|
+
/** The Environment's Flush gate. */
|
|
30
|
+
export declare class FlushGate extends FlushGate_base {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Build a gate over the context's Renderer, Frame loop and Refresh frame source, in the current
|
|
34
|
+
* Scope: what it forks runs in that Scope, and closing it ends the gate.
|
|
35
|
+
*/
|
|
36
|
+
export declare const make: (options: Options) => Effect.Effect<Shape, never, Services | Scope.Scope>;
|
|
37
|
+
/** The gate as a Layer: built by `make`, ended by the Layer's Scope. */
|
|
38
|
+
export declare const layer: (options: Options) => Layer.Layer<FlushGate, never, Services>;
|
|
39
|
+
/**
|
|
40
|
+
* The gate a server render gets: it flushes nothing, so `register` returns an unregister that does
|
|
41
|
+
* nothing, and the rest do nothing, `afterFlush` included, since no flush comes. Code that takes the gate
|
|
42
|
+
* at setup and uses it after mount keeps working on a server.
|
|
43
|
+
*/
|
|
44
|
+
export declare const inert: Shape;
|
|
45
|
+
/** `inert` as a Layer, for a binding whose server render runs an Effect program. */
|
|
46
|
+
export declare const layerInert: Layer.Layer<FlushGate>;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=FlushGate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlushGate.d.ts","sourceRoot":"","sources":["../src/FlushGate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAA;AAG9C,yFAAyF;AACzF,MAAM,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAEvD,iEAAiE;AACjE,MAAM,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAA;AAErC,2FAA2F;AAC3F,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,gBAAgB,CAAA;AAE/C,sDAAsD;AACtD,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC,iBAAiB,CAAA;;AAEjD,oCAAoC;AACpC,qBAAa,SAAU,SAAQ,cAA4D;CAAG;AAE9F;;;GAGG;AACH,eAAO,MAAM,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,GAAG,KAAK,CAAC,KAAK,CAOvF,CAAA;AAEJ,wEAAwE;AACxE,eAAO,MAAM,KAAK,YAAa,OAAO,KAAG,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,CAA2C,CAAA;AAO1H;;;;GAIG;AAEH,eAAO,MAAM,KAAK,EAAE,KAOlB,CAAA;AAEF,oFAAoF;AACpF,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAmC,CAAA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Flush gate: where a binding writes each element's animated values, drawn onto the elements once a
|
|
3
|
+
* frame. A binding registers each element with its target, writes values as its animations step, and the
|
|
4
|
+
* gate draws them together, at the end of the frame's animation tick, through the Environment's renderer;
|
|
5
|
+
* a write made outside a tick, as a drag's move is, asks for a frame of its own. A server render gets
|
|
6
|
+
* `inert`, which does nothing.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import * as FlushGate from "@wardic/dom/FlushGate"
|
|
10
|
+
*
|
|
11
|
+
* const gate = yield* FlushGate.FlushGate
|
|
12
|
+
* const unregister = gate.register("card", { target: card })
|
|
13
|
+
* gate.write("card", { opacity: 0.5 }) // drawn at the next frame
|
|
14
|
+
*/
|
|
15
|
+
// The **Flush gate** (ADR-0006, ADR-0031, ADR-0033, ADR-0034). `@wardic/dom/FlushGate` (#132, ADR-0041). A
|
|
16
|
+
// service built by a Layer (`layer`) and ended by that Layer's Scope: closing it takes the gate's hook off
|
|
17
|
+
// the Frame loop, cancels a pending frame and clears what it held. Its members are plain functions, called
|
|
18
|
+
// per element and per frame. `make` is the scoped constructor, for a binding that wires it itself. `inert`
|
|
19
|
+
// (ADR-0021, decision 9): a value for a binding whose server builds no runtime, or `layerInert` for one
|
|
20
|
+
// whose server runs an Effect program.
|
|
21
|
+
import * as Context from "effect/Context";
|
|
22
|
+
import * as Effect from "effect/Effect";
|
|
23
|
+
import * as Layer from "effect/Layer";
|
|
24
|
+
import { Atom } from "effect/reactivity";
|
|
25
|
+
import * as internal from "./internal/gate.js";
|
|
26
|
+
import { makeRunner } from "./internal/runner.js";
|
|
27
|
+
/** The Environment's Flush gate. */
|
|
28
|
+
export class FlushGate extends Context.Service()("@wardic/dom/FlushGate") {
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Build a gate over the context's Renderer, Frame loop and Refresh frame source, in the current
|
|
32
|
+
* Scope: what it forks runs in that Scope, and closing it ends the gate.
|
|
33
|
+
*/
|
|
34
|
+
export const make = Effect.fnUntraced(function* (options) {
|
|
35
|
+
// The gate itself, typed without `dispose`: the Scope ends it. Its runner forks on Effect's
|
|
36
|
+
// default scheduler, whatever call built the Layer (`internal/runner.ts`).
|
|
37
|
+
const gate = internal.makeFlushGate(yield* makeRunner(), options);
|
|
38
|
+
yield* Effect.addFinalizer(() => Effect.sync(gate.dispose));
|
|
39
|
+
return gate;
|
|
40
|
+
});
|
|
41
|
+
/** The gate as a Layer: built by `make`, ended by the Layer's Scope. */
|
|
42
|
+
export const layer = (options) => Layer.effect(FlushGate)(make(options));
|
|
43
|
+
const noop = () => { };
|
|
44
|
+
/** What `inert`'s `valueOf` gives: an Atom that stays `undefined`, since nothing is committed on a server. */
|
|
45
|
+
const NO_VALUE = Atom.make(undefined);
|
|
46
|
+
/**
|
|
47
|
+
* The gate a server render gets: it flushes nothing, so `register` returns an unregister that does
|
|
48
|
+
* nothing, and the rest do nothing, `afterFlush` included, since no flush comes. Code that takes the gate
|
|
49
|
+
* at setup and uses it after mount keeps working on a server.
|
|
50
|
+
*/
|
|
51
|
+
// ADR-0021, decision 9.
|
|
52
|
+
export const inert = Object.freeze({
|
|
53
|
+
register: () => noop,
|
|
54
|
+
write: noop,
|
|
55
|
+
flushPass: noop,
|
|
56
|
+
release: noop,
|
|
57
|
+
valueOf: () => NO_VALUE,
|
|
58
|
+
afterFlush: noop,
|
|
59
|
+
});
|
|
60
|
+
/** `inert` as a Layer, for a binding whose server render runs an Effect program. */
|
|
61
|
+
export const layerInert = Layer.succeed(FlushGate, inert);
|
|
62
|
+
//# sourceMappingURL=FlushGate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlushGate.js","sourceRoot":"","sources":["../src/FlushGate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,2GAA2G;AAC3G,2GAA2G;AAC3G,2GAA2G;AAC3G,2GAA2G;AAC3G,wGAAwG;AACxG,uCAAuC;AACvC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAExC,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAcjD,oCAAoC;AACpC,MAAM,OAAO,SAAU,SAAQ,OAAO,CAAC,OAAO,EAAoB,CAAC,uBAAuB,CAAC;CAAG;AAE9F;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAA8E,MAAM,CAAC,UAAU,CAC9G,QAAQ,CAAC,EAAE,OAAgB;IACzB,4FAA4F;IAC5F,2EAA2E;IAC3E,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,UAAU,EAAY,EAAE,OAAO,CAAC,CAAA;IAC3E,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;IAC3D,OAAO,IAAI,CAAA;AACb,CAAC,CAAC,CAAA;AAEJ,wEAAwE;AACxE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAgB,EAA2C,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;AAE1H,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAA;AAE3B,8GAA8G;AAC9G,MAAM,QAAQ,GAAuB,IAAI,CAAC,IAAI,CAAU,SAAS,CAAC,CAAA;AAElE;;;;GAIG;AACH,wBAAwB;AACxB,MAAM,CAAC,MAAM,KAAK,GAAU,MAAM,CAAC,MAAM,CAAC;IACxC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI;IACpB,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ;IACvB,UAAU,EAAE,IAAI;CACjB,CAAC,CAAA;AAEF,oFAAoF;AACpF,MAAM,CAAC,MAAM,UAAU,GAA2B,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Measured pairs: a key that places or sizes the box, whose two ends are lengths of different types,
|
|
3
|
+
* `"auto"` against px, `"50%"` against a number, a `calc()`, can't blend as written. Both ends are
|
|
4
|
+
* measured in px at the end of the task that asks, as Motion's are, so the animation runs between them
|
|
5
|
+
* and lands on its target as given.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import * as MeasuredPair from "@wardic/dom/MeasuredPair"
|
|
9
|
+
*
|
|
10
|
+
* MeasuredPair.needs("width", "auto", 200) // true
|
|
11
|
+
* MeasuredPair.needs("opacity", 0, 1) // false
|
|
12
|
+
*/
|
|
13
|
+
export { measure, measured, type Measured, needs, type Requested } from "./internal/measured-pairs.ts";
|
|
14
|
+
//# sourceMappingURL=MeasuredPair.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeasuredPair.d.ts","sourceRoot":"","sources":["../src/MeasuredPair.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Measured pairs: a key that places or sizes the box, whose two ends are lengths of different types,
|
|
3
|
+
* `"auto"` against px, `"50%"` against a number, a `calc()`, can't blend as written. Both ends are
|
|
4
|
+
* measured in px at the end of the task that asks, as Motion's are, so the animation runs between them
|
|
5
|
+
* and lands on its target as given.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import * as MeasuredPair from "@wardic/dom/MeasuredPair"
|
|
9
|
+
*
|
|
10
|
+
* MeasuredPair.needs("width", "auto", 200) // true
|
|
11
|
+
* MeasuredPair.needs("opacity", 0, 1) // false
|
|
12
|
+
*/
|
|
13
|
+
// **Measured pairs** (#430, CONTEXT.md, Motion's `DOMKeyframesResolver`). `@wardic/dom/MeasuredPair`: for
|
|
14
|
+
// binding authors.
|
|
15
|
+
export { measure, measured, needs } from "./internal/measured-pairs.js";
|
|
16
|
+
//# sourceMappingURL=MeasuredPair.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeasuredPair.js","sourceRoot":"","sources":["../src/MeasuredPair.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,0GAA0G;AAC1G,mBAAmB;AACnB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAiB,KAAK,EAAkB,MAAM,8BAA8B,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An element's own values: what its style or its computed style says for a key, read once, the value an
|
|
3
|
+
* animation starts from, and returns to when nothing else sets it. `valueLike` reads a raw value in the
|
|
4
|
+
* shape of the key's target.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import * as OwnValues from "@wardic/dom/OwnValues"
|
|
8
|
+
*
|
|
9
|
+
* const own = OwnValues.of(element)
|
|
10
|
+
* own("opacity") // Some("1"), from its computed style
|
|
11
|
+
* OwnValues.valueLike("10px", 0) // Some(10)
|
|
12
|
+
*/
|
|
13
|
+
export { ownValues as of, styleValueOf, valueLike, type OwnValue, } from "./internal/own-values.ts";
|
|
14
|
+
//# sourceMappingURL=OwnValues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OwnValues.d.ts","sourceRoot":"","sources":["../src/OwnValues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,SAAS,IAAI,EAAE,EACf,YAAY,EACZ,SAAS,EACT,KAAK,QAAQ,GACd,MAAM,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An element's own values: what its style or its computed style says for a key, read once, the value an
|
|
3
|
+
* animation starts from, and returns to when nothing else sets it. `valueLike` reads a raw value in the
|
|
4
|
+
* shape of the key's target.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import * as OwnValues from "@wardic/dom/OwnValues"
|
|
8
|
+
*
|
|
9
|
+
* const own = OwnValues.of(element)
|
|
10
|
+
* own("opacity") // Some("1"), from its computed style
|
|
11
|
+
* OwnValues.valueLike("10px", 0) // Some(10)
|
|
12
|
+
*/
|
|
13
|
+
// `@wardic/dom/OwnValues` (#132, ADR-0041): its Base values (ADR-0022).
|
|
14
|
+
export { ownValues as of, styleValueOf, valueLike, } from "./internal/own-values.js";
|
|
15
|
+
//# sourceMappingURL=OwnValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OwnValues.js","sourceRoot":"","sources":["../src/OwnValues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wEAAwE;AACxE,OAAO,EACL,SAAS,IAAI,EAAE,EACf,YAAY,EACZ,SAAS,GAEV,MAAM,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Projection system: what runs the DOM's layout animations, one per Environment a binding builds. A binding registers
|
|
3
|
+
* each layout element with it, and when a layout changes it measures their boxes, draws each where it was
|
|
4
|
+
* with a transform, and animates it to where it is now; elements that share a `layoutId` fly one into the
|
|
5
|
+
* other. This module is its key and its types, which every element's code reads: the engine itself is
|
|
6
|
+
* `DomProjectionSystem`'s, so a page that never lays out ships none of it. `toJSON()` gives its tree as
|
|
7
|
+
* plain data, for a diagnostic view. A server render builds none.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import * as ProjectionSystem from "@wardic/dom/ProjectionSystem"
|
|
11
|
+
*
|
|
12
|
+
* const system = yield* ProjectionSystem.ProjectionSystem
|
|
13
|
+
* const node = system.register({ id: "card", element: card, transition: () => Option.none() })
|
|
14
|
+
* system.animateLayout(() => expand(card)) // measured before and after, and animated between
|
|
15
|
+
*/
|
|
16
|
+
import * as Context from "effect/Context";
|
|
17
|
+
import type * as internal from "./internal/projection.ts";
|
|
18
|
+
export { type RegisterNodeOptions, type ProjectionNodeHandle as NodeHandle, type DragProjectionHandle as DragHandle, type AnimateLayoutOptions, type Tree, type TreeNode, } from "./internal/projection.ts";
|
|
19
|
+
export { DEFAULT_DRAG_TRANSITION, DEFAULT_LAYOUT_TRANSITION, type DragTransition, type LayoutTransition } from "./internal/projection-defaults.ts";
|
|
20
|
+
export type { ScaleCorrectorEntry as ScaleCorrector, CorrectorInfo } from "./internal/scale-correction.ts";
|
|
21
|
+
export { dragBoundsWithin, measureLayoutBox } from "./internal/measure.ts";
|
|
22
|
+
/** The engine: what a binding registers its layout elements with. */
|
|
23
|
+
export type Shape = Omit<internal.ProjectionSystem, "dispose" | "onPassEnd">;
|
|
24
|
+
/** What the engine writes each node's projection through: a `FlushGate`'s `write` and `flushPass`. */
|
|
25
|
+
export type Sink = internal.ProjectionSink;
|
|
26
|
+
/** What a binding hands its engine: whether reduced motion applies now, and the app's scale correctors. */
|
|
27
|
+
export type Options = internal.ProjectionSystemOptions;
|
|
28
|
+
/** The services the engine needs from its Environment. */
|
|
29
|
+
export type Services = internal.ProjectionServices;
|
|
30
|
+
declare const ProjectionSystem_base: Context.ServiceClass<ProjectionSystem, "@wardic/dom/ProjectionSystem", Shape>;
|
|
31
|
+
/** The Environment's Projection system. */
|
|
32
|
+
export declare class ProjectionSystem extends /*#__PURE__*/ ProjectionSystem_base {
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=ProjectionSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionSystem.d.ts","sourceRoot":"","sources":["../src/ProjectionSystem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAA;AAEzD,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,IAAI,UAAU,EACvC,KAAK,oBAAoB,IAAI,UAAU,EACvC,KAAK,oBAAoB,EACzB,KAAK,IAAI,EACT,KAAK,QAAQ,GACd,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,KAAK,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAClJ,YAAY,EAAE,mBAAmB,IAAI,cAAc,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC1G,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE1E,qEAAqE;AACrE,MAAM,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,GAAG,WAAW,CAAC,CAAA;AAE5E,sGAAsG;AACtG,MAAM,MAAM,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAA;AAE1C,2GAA2G;AAE3G,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,uBAAuB,CAAA;AAEtD,0DAA0D;AAC1D,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC,kBAAkB,CAAA;;AAElD,2CAA2C;AAC3C,qBAAa,gBAAiB,SAAQ,aAAa,CAAC,qBAA0E;CAAG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Projection system: what runs the DOM's layout animations, one per Environment a binding builds. A binding registers
|
|
3
|
+
* each layout element with it, and when a layout changes it measures their boxes, draws each where it was
|
|
4
|
+
* with a transform, and animates it to where it is now; elements that share a `layoutId` fly one into the
|
|
5
|
+
* other. This module is its key and its types, which every element's code reads: the engine itself is
|
|
6
|
+
* `DomProjectionSystem`'s, so a page that never lays out ships none of it. `toJSON()` gives its tree as
|
|
7
|
+
* plain data, for a diagnostic view. A server render builds none.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import * as ProjectionSystem from "@wardic/dom/ProjectionSystem"
|
|
11
|
+
*
|
|
12
|
+
* const system = yield* ProjectionSystem.ProjectionSystem
|
|
13
|
+
* const node = system.register({ id: "card", element: card, transition: () => Option.none() })
|
|
14
|
+
* system.animateLayout(() => expand(card)) // measured before and after, and animated between
|
|
15
|
+
*/
|
|
16
|
+
// The **Projection system**, the DOM's engine for the **Projection** (ADR-0009, ADR-0010, ADR-0018): it
|
|
17
|
+
// holds every Projection node, runs the Measure pass and the per-frame projection pass, and owns `layoutId`
|
|
18
|
+
// matching. `@wardic/dom/ProjectionSystem` (#132, ADR-0041). The key apart from the engine: #548, ADR-0067
|
|
19
|
+
// *Amendment (#548)*. An Effect `Inspectable` (#384): `console.log(system)` shows the tree, as `Tree`,
|
|
20
|
+
// each node with its parent, its `layoutId` twin's part and what it's doing; the layout lab draws it. A
|
|
21
|
+
// server render builds none (ADR-0021).
|
|
22
|
+
import * as Context from "effect/Context";
|
|
23
|
+
export {} from "./internal/projection.js";
|
|
24
|
+
export { DEFAULT_DRAG_TRANSITION, DEFAULT_LAYOUT_TRANSITION } from "./internal/projection-defaults.js";
|
|
25
|
+
export { dragBoundsWithin, measureLayoutBox } from "./internal/measure.js";
|
|
26
|
+
/** The Environment's Projection system. */
|
|
27
|
+
export class ProjectionSystem extends /*#__PURE__*/ /*#__PURE__*/ Context.Service()("@wardic/dom/ProjectionSystem") {
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=ProjectionSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionSystem.js","sourceRoot":"","sources":["../src/ProjectionSystem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wGAAwG;AACxG,4GAA4G;AAC5G,2GAA2G;AAC3G,uGAAuG;AACvG,wGAAwG;AACxG,wCAAwC;AACxC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAGzC,OAAO,EAON,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAA8C,MAAM,mCAAmC,CAAA;AAElJ,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAe1E,2CAA2C;AAC3C,MAAM,OAAO,gBAAiB,SAAQ,aAAa,CAAb,aAAa,CAAC,OAAO,CAAC,OAAO,EAA2B,CAAC,8BAA8B,CAAC;CAAG"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Reorder group on the DOM: the group, its items' drags, its keyboard and its announcements, one
|
|
3
|
+
* controller a group. `make` builds one over the context's Projection system and `Announcer`; a binding
|
|
4
|
+
* attaches its group element, gets a driver for each item, and closing the Scope ends the controller. A
|
|
5
|
+
* server render gets `inert`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import * as ReorderController from "@wardic/dom/ReorderController"
|
|
9
|
+
*
|
|
10
|
+
* const controller = yield* ReorderController.make({ values: () => items, onReorder: (next) => (items = next) })
|
|
11
|
+
* controller.attach(list)
|
|
12
|
+
* const driver = controller.item(item, () => Option.some(element))
|
|
13
|
+
*/
|
|
14
|
+
import * as Announcer from "@wardic/core/Announcer";
|
|
15
|
+
import * as Effect from "effect/Effect";
|
|
16
|
+
import type * as Scope from "effect/Scope";
|
|
17
|
+
import { PassEnds } from "./internal/pass-ends.ts";
|
|
18
|
+
import * as internal from "./internal/reorder.ts";
|
|
19
|
+
import * as ProjectionSystem from "./ProjectionSystem.ts";
|
|
20
|
+
export { type ReorderEnd as End, type ReorderHoldEnd as HoldEnd, type ReorderHoldHow as HoldHow, type ReorderHoldStart as HoldStart, type ReorderItemDriver as ItemDriver, DEFAULT_REORDER_INSTRUCTIONS as DEFAULT_INSTRUCTIONS, REORDER_GROUP_STYLE as GROUP_STYLE, } from "./internal/reorder.ts";
|
|
21
|
+
/** A **Reorder group** on the DOM: what a binding attaches its group element and items to. */
|
|
22
|
+
export type ReorderController<V> = Omit<internal.ReorderController<V>, "dispose">;
|
|
23
|
+
/** What a binding hands its group: the app's values, its axis, its keyboard and its announcements. */
|
|
24
|
+
export type Options<V> = internal.ReorderControllerOptions<V>;
|
|
25
|
+
/**
|
|
26
|
+
* The services a controller takes from its context: the projection system its items are nodes of,
|
|
27
|
+
* with what tells it each Measure pass's end (`DomProjectionSystem`'s Layer provides both), and the
|
|
28
|
+
* Environment's `Announcer`.
|
|
29
|
+
*/
|
|
30
|
+
export type Services = ProjectionSystem.ProjectionSystem | PassEnds | Announcer.Announcer;
|
|
31
|
+
/**
|
|
32
|
+
* Build a group's controller over the context's projection system, announcing through its
|
|
33
|
+
* `Announcer`, in the current Scope: closing it ends the controller.
|
|
34
|
+
*/
|
|
35
|
+
export declare const make: <V>(options: Options<V>) => Effect.Effect<ReorderController<V>, never, Services | Scope.Scope>;
|
|
36
|
+
/**
|
|
37
|
+
* The controller a server render gets: its group has no values, so every operation on it does nothing,
|
|
38
|
+
* its axis is `"y"`, and an item's driver does nothing too.
|
|
39
|
+
*/
|
|
40
|
+
export declare const inert: ReorderController<never>;
|
|
41
|
+
//# sourceMappingURL=ReorderController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReorderController.d.ts","sourceRoot":"","sources":["../src/ReorderController.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAA;AAEjD,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AAEzD,OAAO,EACL,KAAK,UAAU,IAAI,GAAG,EACtB,KAAK,cAAc,IAAI,OAAO,EAC9B,KAAK,cAAc,IAAI,OAAO,EAC9B,KAAK,gBAAgB,IAAI,SAAS,EAClC,KAAK,iBAAiB,IAAI,UAAU,EACpC,4BAA4B,IAAI,oBAAoB,EACpD,mBAAmB,IAAI,WAAW,GACnC,MAAM,uBAAuB,CAAA;AAE9B,8FAA8F;AAC9F,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;AAEjF,sGAAsG;AACtG,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,QAAQ,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAA;AAE7D;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,gBAAgB,CAAC,gBAAgB,GAAG,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAA;AAEzF;;;GAGG;AACH,eAAO,MAAM,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,GAAG,KAAK,CAAC,KAAK,CAW5G,CAAA;AAEJ;;;GAGG;AAEH,eAAO,MAAM,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAqC,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Reorder group on the DOM: the group, its items' drags, its keyboard and its announcements, one
|
|
3
|
+
* controller a group. `make` builds one over the context's Projection system and `Announcer`; a binding
|
|
4
|
+
* attaches its group element, gets a driver for each item, and closing the Scope ends the controller. A
|
|
5
|
+
* server render gets `inert`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import * as ReorderController from "@wardic/dom/ReorderController"
|
|
9
|
+
*
|
|
10
|
+
* const controller = yield* ReorderController.make({ values: () => items, onReorder: (next) => (items = next) })
|
|
11
|
+
* controller.attach(list)
|
|
12
|
+
* const driver = controller.item(item, () => Option.some(element))
|
|
13
|
+
*/
|
|
14
|
+
// A **Reorder group**'s controller (ADR-0019 *Amendment (Reorder)*, ADR-0037); a server render's `inert`
|
|
15
|
+
// (ADR-0021). `@wardic/dom/ReorderController` (#132, ADR-0041). A scoped constructor, one per group (#132's
|
|
16
|
+
// PR 3): `make` logs its `wardic.reorder:` events through the context's Logger, and ends with its Scope,
|
|
17
|
+
// which stops its listening to Measure passes, resets its Auto-scroll and clears a pending announcement.
|
|
18
|
+
// Its items' drivers stay plain, each with its own `dispose`, since one is made per element.
|
|
19
|
+
import * as Announcer from "@wardic/core/Announcer";
|
|
20
|
+
import * as Effect from "effect/Effect";
|
|
21
|
+
import { PassEnds } from "./internal/pass-ends.js";
|
|
22
|
+
import * as internal from "./internal/reorder.js";
|
|
23
|
+
import { makeRunner } from "./internal/runner.js";
|
|
24
|
+
import * as ProjectionSystem from "./ProjectionSystem.js";
|
|
25
|
+
export { DEFAULT_REORDER_INSTRUCTIONS as DEFAULT_INSTRUCTIONS, REORDER_GROUP_STYLE as GROUP_STYLE, } from "./internal/reorder.js";
|
|
26
|
+
/**
|
|
27
|
+
* Build a group's controller over the context's projection system, announcing through its
|
|
28
|
+
* `Announcer`, in the current Scope: closing it ends the controller.
|
|
29
|
+
*/
|
|
30
|
+
export const make = Effect.fnUntraced(function* (options) {
|
|
31
|
+
const projection = yield* ProjectionSystem.ProjectionSystem;
|
|
32
|
+
const passEnds = yield* PassEnds;
|
|
33
|
+
const announcer = yield* Announcer.Announcer;
|
|
34
|
+
const controller = internal.makeReorderController({ runtime: yield* makeRunner(), projection, announce: announcer.announce, onPassEnd: passEnds.onPassEnd }, options);
|
|
35
|
+
yield* Effect.addFinalizer(() => Effect.sync(controller.dispose));
|
|
36
|
+
return controller;
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* The controller a server render gets: its group has no values, so every operation on it does nothing,
|
|
40
|
+
* its axis is `"y"`, and an item's driver does nothing too.
|
|
41
|
+
*/
|
|
42
|
+
// ADR-0021.
|
|
43
|
+
export const inert = internal.INERT_REORDER_CONTROLLER;
|
|
44
|
+
//# sourceMappingURL=ReorderController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReorderController.js","sourceRoot":"","sources":["../src/ReorderController.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,yGAAyG;AACzG,4GAA4G;AAC5G,yGAAyG;AACzG,yGAAyG;AACzG,6FAA6F;AAC7F,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AAEzD,OAAO,EAML,4BAA4B,IAAI,oBAAoB,EACpD,mBAAmB,IAAI,WAAW,GACnC,MAAM,uBAAuB,CAAA;AAe9B;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAmG,MAAM,CAAC,UAAU,CACnI,QAAQ,CAAC,EAAK,OAAmB;IAC/B,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC,gBAAgB,CAAA;IAC3D,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAA;IAChC,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,SAAS,CAAA;IAC5C,MAAM,UAAU,GAAG,QAAQ,CAAC,qBAAqB,CAC/C,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,UAAU,EAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,EAChH,OAAO,CACR,CAAA;IACD,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;IACjE,OAAO,UAAU,CAAA;AACnB,CAAC,CAAC,CAAA;AAEJ;;;GAGG;AACH,YAAY;AACZ,MAAM,CAAC,MAAM,KAAK,GAA6B,QAAQ,CAAC,wBAAwB,CAAA"}
|
package/dist/Report.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reporting a failure where a fiber stops: logged at Error and handed to the Environment's
|
|
3
|
+
* `ErrorReporter`s, so an app's error tracking sees it. An interruption is neither: it's how a run is
|
|
4
|
+
* removed.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import * as Report from "@wardic/dom/Report"
|
|
8
|
+
*
|
|
9
|
+
* yield* Report.failure("wardic: an animation failed", cause)
|
|
10
|
+
*/
|
|
11
|
+
export { reportFailure as failure, debugKept, debugOf, type DebugLog, } from "./internal/report.ts";
|
|
12
|
+
//# sourceMappingURL=Report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Report.d.ts","sourceRoot":"","sources":["../src/Report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,aAAa,IAAI,OAAO,EACxB,SAAS,EACT,OAAO,EACP,KAAK,QAAQ,GACd,MAAM,sBAAsB,CAAA"}
|
package/dist/Report.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reporting a failure where a fiber stops: logged at Error and handed to the Environment's
|
|
3
|
+
* `ErrorReporter`s, so an app's error tracking sees it. An interruption is neither: it's how a run is
|
|
4
|
+
* removed.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import * as Report from "@wardic/dom/Report"
|
|
8
|
+
*
|
|
9
|
+
* yield* Report.failure("wardic: an animation failed", cause)
|
|
10
|
+
*/
|
|
11
|
+
// `@wardic/dom/Report` (#132, ADR-0041): ADR-0030, decision 4.
|
|
12
|
+
export { reportFailure as failure, debugKept, debugOf, } from "./internal/report.js";
|
|
13
|
+
//# sourceMappingURL=Report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Report.js","sourceRoot":"","sources":["../src/Report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,+DAA+D;AAC/D,OAAO,EACL,aAAa,IAAI,OAAO,EACxB,SAAS,EACT,OAAO,GAER,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scroll offsets, the DOM's: Motion's syntax for where a target's progress through its scroll container
|
|
3
|
+
* runs, from 0 to 1, which the DOM's `Probe.scroll` resolves. Core takes an offset as its Environment's
|
|
4
|
+
* own and passes it through, so its syntax, its names and its units are the DOM's.
|
|
5
|
+
*
|
|
6
|
+
* - **An edge** is a name (`start`, `center`, `end`), a fraction of a length (`0.5`), or a CSS length:
|
|
7
|
+
* `"100px"` a distance, `"50%"` a fraction, `"10vw"` or `"10vh"` a share of the viewport.
|
|
8
|
+
* - **A stop** is a pair of edges, `[target, container]`: the scroll position where the target's edge
|
|
9
|
+
* meets the container's. A string holds both (`"start end"`); one edge alone is both for a name or a
|
|
10
|
+
* number (`"end"`, `0.5`), else the target's against the container's start (`"100px"`).
|
|
11
|
+
* - **An offset** is two stops or more: progress runs from 0 at the first to 1 at the last, evenly
|
|
12
|
+
* between them, and holds past them.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* import * as ScrollOffset from "@wardic/dom/ScrollOffset"
|
|
16
|
+
*
|
|
17
|
+
* // From the target's top meeting the container's bottom, to its bottom meeting the container's top:
|
|
18
|
+
* const across: ScrollOffset.ScrollOffset = ["start end", "end start"]
|
|
19
|
+
*/
|
|
20
|
+
/** One edge of a stop: a name, a fraction, or a CSS length (see the module's doc). */
|
|
21
|
+
export type Edge = string | number;
|
|
22
|
+
/** One stop: `[target edge, container edge]`, a string of both, or one edge. */
|
|
23
|
+
export type Stop = Edge | readonly [Edge, Edge];
|
|
24
|
+
/** Where a target's progress runs: two stops or more. */
|
|
25
|
+
export type ScrollOffset = ReadonlyArray<Stop>;
|
|
26
|
+
/** Motion's presets: while the target comes into the container. */
|
|
27
|
+
export declare const Enter: ScrollOffset;
|
|
28
|
+
/** While the target leaves the container. */
|
|
29
|
+
export declare const Exit: ScrollOffset;
|
|
30
|
+
/** While any of the target is in the container. */
|
|
31
|
+
export declare const Any: ScrollOffset;
|
|
32
|
+
/** While all of the target is in the container: the offset with a target and none given. */
|
|
33
|
+
export declare const All: ScrollOffset;
|
|
34
|
+
//# sourceMappingURL=ScrollOffset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollOffset.d.ts","sourceRoot":"","sources":["../src/ScrollOffset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,sFAAsF;AACtF,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;AAElC,gFAAgF;AAChF,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;AAE/C,yDAAyD;AACzD,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;AAE9C,mEAAmE;AACnE,eAAO,MAAM,KAAK,EAAE,YAGnB,CAAA;AAED,6CAA6C;AAC7C,eAAO,MAAM,IAAI,EAAE,YAGlB,CAAA;AAED,mDAAmD;AACnD,eAAO,MAAM,GAAG,EAAE,YAGjB,CAAA;AAED,4FAA4F;AAC5F,eAAO,MAAM,GAAG,EAAE,YAGjB,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scroll offsets, the DOM's: Motion's syntax for where a target's progress through its scroll container
|
|
3
|
+
* runs, from 0 to 1, which the DOM's `Probe.scroll` resolves. Core takes an offset as its Environment's
|
|
4
|
+
* own and passes it through, so its syntax, its names and its units are the DOM's.
|
|
5
|
+
*
|
|
6
|
+
* - **An edge** is a name (`start`, `center`, `end`), a fraction of a length (`0.5`), or a CSS length:
|
|
7
|
+
* `"100px"` a distance, `"50%"` a fraction, `"10vw"` or `"10vh"` a share of the viewport.
|
|
8
|
+
* - **A stop** is a pair of edges, `[target, container]`: the scroll position where the target's edge
|
|
9
|
+
* meets the container's. A string holds both (`"start end"`); one edge alone is both for a name or a
|
|
10
|
+
* number (`"end"`, `0.5`), else the target's against the container's start (`"100px"`).
|
|
11
|
+
* - **An offset** is two stops or more: progress runs from 0 at the first to 1 at the last, evenly
|
|
12
|
+
* between them, and holds past them.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* import * as ScrollOffset from "@wardic/dom/ScrollOffset"
|
|
16
|
+
*
|
|
17
|
+
* // From the target's top meeting the container's bottom, to its bottom meeting the container's top:
|
|
18
|
+
* const across: ScrollOffset.ScrollOffset = ["start end", "end start"]
|
|
19
|
+
*/
|
|
20
|
+
// #234, ADR-0043 *Amendment (#233, #234)*; resolved in `internal/scroll.ts`. `@wardic/dom/ScrollOffset`
|
|
21
|
+
// (ADR-0041): the type a binding gives its `scroll` helper's `offset`.
|
|
22
|
+
/** Motion's presets: while the target comes into the container. */
|
|
23
|
+
export const Enter = [
|
|
24
|
+
[0, 1],
|
|
25
|
+
[1, 1],
|
|
26
|
+
];
|
|
27
|
+
/** While the target leaves the container. */
|
|
28
|
+
export const Exit = [
|
|
29
|
+
[0, 0],
|
|
30
|
+
[1, 0],
|
|
31
|
+
];
|
|
32
|
+
/** While any of the target is in the container. */
|
|
33
|
+
export const Any = [
|
|
34
|
+
[1, 0],
|
|
35
|
+
[0, 1],
|
|
36
|
+
];
|
|
37
|
+
/** While all of the target is in the container: the offset with a target and none given. */
|
|
38
|
+
export const All = [
|
|
39
|
+
[0, 0],
|
|
40
|
+
[1, 1],
|
|
41
|
+
];
|
|
42
|
+
//# sourceMappingURL=ScrollOffset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollOffset.js","sourceRoot":"","sources":["../src/ScrollOffset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wGAAwG;AACxG,uEAAuE;AAWvE,mEAAmE;AACnE,MAAM,CAAC,MAAM,KAAK,GAAiB;IACjC,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,CAAC,CAAC,EAAE,CAAC,CAAC;CACP,CAAA;AAED,6CAA6C;AAC7C,MAAM,CAAC,MAAM,IAAI,GAAiB;IAChC,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,CAAC,CAAC,EAAE,CAAC,CAAC;CACP,CAAA;AAED,mDAAmD;AACnD,MAAM,CAAC,MAAM,GAAG,GAAiB;IAC/B,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,CAAC,CAAC,EAAE,CAAC,CAAC;CACP,CAAA;AAED,4FAA4F;AAC5F,MAAM,CAAC,MAAM,GAAG,GAAiB;IAC/B,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,CAAC,CAAC,EAAE,CAAC,CAAC;CACP,CAAA"}
|
package/dist/Style.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An element's style as a binding builds it: its starting style, what it's drawn with before any
|
|
3
|
+
* animation runs, from its `initial` (or its `animate`, with `initial: false`); how an app's own style and
|
|
4
|
+
* Wardic's are layered (`over`, `without`); and a drag element's default style. A server render draws the
|
|
5
|
+
* starting style, so an element is drawn where it starts before any code runs.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import * as Style from "@wardic/dom/Style"
|
|
9
|
+
*
|
|
10
|
+
* const start = Style.resolveInitial({ initial: { opacity: 0, y: 8 }, animate: { opacity: 1, y: 0 } })
|
|
11
|
+
* Style.starting(undefined, start) // { style: { transform: "translateY(8px)", opacity: 0 }, attrs: {} }
|
|
12
|
+
*/
|
|
13
|
+
export { startingStyle as starting, resolveInitial, type InitialConfig, keyframesOf, splitValues, type SplitValues, type StopAt, type Stops, toValues, valuesAt, type StyleInput as Input, type StyleRecord as Style, over, without, heldTouches, } from "./internal/starting-style.ts";
|
|
14
|
+
export { dragDefaultStyle as dragDefaults, type DragDefaultStyle as DragDefaults, DRAG_DEFAULT_ATTRIBUTES, reorderTouchAction, } from "./internal/drag-defaults.ts";
|
|
15
|
+
//# sourceMappingURL=Style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Style.d.ts","sourceRoot":"","sources":["../src/Style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EACL,aAAa,IAAI,QAAQ,EACzB,cAAc,EACd,KAAK,aAAa,EAClB,WAAW,EACX,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,KAAK,UAAU,IAAI,KAAK,EACxB,KAAK,WAAW,IAAI,KAAK,EACzB,IAAI,EACJ,OAAO,EACP,WAAW,GACZ,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,gBAAgB,IAAI,YAAY,EAChC,KAAK,gBAAgB,IAAI,YAAY,EACrC,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,6BAA6B,CAAA"}
|