@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
package/dist/Style.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
// `@wardic/dom/Style` (#132, ADR-0041): the **Starting style**, the merges of an app's style with
|
|
14
|
+
// Wardic's, and a drag element's defaults (ADR-0019, ADR-0021, ADR-0034).
|
|
15
|
+
export { startingStyle as starting, resolveInitial, keyframesOf, splitValues, toValues, valuesAt, over, without, heldTouches, } from "./internal/starting-style.js";
|
|
16
|
+
export { dragDefaultStyle as dragDefaults, DRAG_DEFAULT_ATTRIBUTES, reorderTouchAction, } from "./internal/drag-defaults.js";
|
|
17
|
+
//# sourceMappingURL=Style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Style.js","sourceRoot":"","sources":["../src/Style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,kGAAkG;AAClG,0EAA0E;AAC1E,OAAO,EACL,aAAa,IAAI,QAAQ,EACzB,cAAc,EAEd,WAAW,EACX,WAAW,EAIX,QAAQ,EACR,QAAQ,EAGR,IAAI,EACJ,OAAO,EACP,WAAW,GACZ,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,gBAAgB,IAAI,YAAY,EAEhC,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,6BAA6B,CAAA"}
|
package/dist/Svg.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG: which elements are SVG's, and a style patch split into the CSS an SVG element takes and the
|
|
3
|
+
* attributes it takes instead. An `<svg>` root is styled as HTML is; an element inside it takes most keys
|
|
4
|
+
* as attributes, and a transform about its own centre, as an HTML element's is.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import * as Svg from "@wardic/dom/Svg"
|
|
8
|
+
*
|
|
9
|
+
* Svg.splitPatchForTag("circle", { r: 10, opacity: 0.5, transform: "scale(2)" })
|
|
10
|
+
* // style: transform, transform-box and transform-origin; attrs: { r: "10", opacity: "0.5" }
|
|
11
|
+
*/
|
|
12
|
+
export { isSvgRoot as isRoot, isSvgInner as isInner, isSvgInnerTag as isInnerTag, setSvgAttrs as setAttrs, splitPatch, splitPatchForTag, type SplitPatch, } from "./internal/svg.ts";
|
|
13
|
+
//# sourceMappingURL=Svg.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Svg.d.ts","sourceRoot":"","sources":["../src/Svg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,SAAS,IAAI,MAAM,EACnB,UAAU,IAAI,OAAO,EACrB,aAAa,IAAI,UAAU,EAC3B,WAAW,IAAI,QAAQ,EACvB,UAAU,EACV,gBAAgB,EAChB,KAAK,UAAU,GAChB,MAAM,mBAAmB,CAAA"}
|
package/dist/Svg.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG: which elements are SVG's, and a style patch split into the CSS an SVG element takes and the
|
|
3
|
+
* attributes it takes instead. An `<svg>` root is styled as HTML is; an element inside it takes most keys
|
|
4
|
+
* as attributes, and a transform about its own centre, as an HTML element's is.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import * as Svg from "@wardic/dom/Svg"
|
|
8
|
+
*
|
|
9
|
+
* Svg.splitPatchForTag("circle", { r: 10, opacity: 0.5, transform: "scale(2)" })
|
|
10
|
+
* // style: transform, transform-box and transform-origin; attrs: { r: "10", opacity: "0.5" }
|
|
11
|
+
*/
|
|
12
|
+
// `@wardic/dom/Svg` (#132, ADR-0041): ADR-0014.
|
|
13
|
+
export { isSvgRoot as isRoot, isSvgInner as isInner, isSvgInnerTag as isInnerTag, setSvgAttrs as setAttrs, splitPatch, splitPatchForTag, } from "./internal/svg.js";
|
|
14
|
+
//# sourceMappingURL=Svg.js.map
|
package/dist/Svg.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Svg.js","sourceRoot":"","sources":["../src/Svg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,gDAAgD;AAChD,OAAO,EACL,SAAS,IAAI,MAAM,EACnB,UAAU,IAAI,OAAO,EACrB,aAAa,IAAI,UAAU,EAC3B,WAAW,IAAI,QAAQ,EACvB,UAAU,EACV,gBAAgB,GAEjB,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS variables in animated values: a value that's wholly a `var()` is resolved against an element, so
|
|
3
|
+
* `var(--accent)` animates from or to the colour it stands for. `values` is the Key rule a binding adds
|
|
4
|
+
* for an element's own animations.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import * as Variables from "@wardic/dom/Variables"
|
|
8
|
+
*
|
|
9
|
+
* Variables.isValue("var(--gap)") // true
|
|
10
|
+
* Variables.resolve(element, "var(--gap)") // what `--gap` computes to on `element`
|
|
11
|
+
*/
|
|
12
|
+
export { isVariableValue as isValue, resolveVariable as resolve, variableValues as values, } from "./internal/variables.ts";
|
|
13
|
+
//# sourceMappingURL=Variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Variables.d.ts","sourceRoot":"","sources":["../src/Variables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,eAAe,IAAI,OAAO,EAC1B,eAAe,IAAI,OAAO,EAC1B,cAAc,IAAI,MAAM,GACzB,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS variables in animated values: a value that's wholly a `var()` is resolved against an element, so
|
|
3
|
+
* `var(--accent)` animates from or to the colour it stands for. `values` is the Key rule a binding adds
|
|
4
|
+
* for an element's own animations.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import * as Variables from "@wardic/dom/Variables"
|
|
8
|
+
*
|
|
9
|
+
* Variables.isValue("var(--gap)") // true
|
|
10
|
+
* Variables.resolve(element, "var(--gap)") // what `--gap` computes to on `element`
|
|
11
|
+
*/
|
|
12
|
+
// `@wardic/dom/Variables` (#132, ADR-0041): #55, ADR-0035.
|
|
13
|
+
export { isVariableValue as isValue, resolveVariable as resolve, variableValues as values, } from "./internal/variables.js";
|
|
14
|
+
//# sourceMappingURL=Variables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Variables.js","sourceRoot":"","sources":["../src/Variables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,2DAA2D;AAC3D,OAAO,EACL,eAAe,IAAI,OAAO,EAC1B,eAAe,IAAI,OAAO,EAC1B,cAAc,IAAI,MAAM,GACzB,MAAM,yBAAyB,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@wardic/dom`: the browser Environment, and the framework-free pieces a binding builds on. It's for
|
|
3
|
+
* binding authors, Wardic's own and any other, and it's Effect-typed.
|
|
4
|
+
*
|
|
5
|
+
* - **An app** imports {@link DomLive}, the composed Environment it hands its binding, and
|
|
6
|
+
* {@link CheckFrames}, to check its Frames in development.
|
|
7
|
+
* - **A binding** imports each module by its subpath, as a namespace
|
|
8
|
+
* (`import * as FlushGate from "@wardic/dom/FlushGate"`), and the root re-exports each one:
|
|
9
|
+
* - the DOM's implementations of core's services, each with its `layer` (Effect's platform
|
|
10
|
+
* convention: `DomRenderer`, `DomInput`, `DomProbe`, `DomClock`, `DomAnnouncer`,
|
|
11
|
+
* `DomInterpolators`, `DomPositionalKeys`, `DomDefaultTransition`), and `DomKeyRules`, the Key
|
|
12
|
+
* rules `DomInterpolators.layer` installs, which has none of its own;
|
|
13
|
+
* - dom's own concepts, by the glossary's names: `FlushGate`, `ProjectionSystem`,
|
|
14
|
+
* `ReorderController`, `Style`, `Svg`, `Color`, `Variables`, `ScrollOffset`, `Appear`, `OwnValues`
|
|
15
|
+
* and `Report`.
|
|
16
|
+
*
|
|
17
|
+
* Everything under `internal/` is dom's own and not exported.
|
|
18
|
+
*/
|
|
19
|
+
import type * as Clock from "@wardic/core/Clock";
|
|
20
|
+
import * as FrameLoop from "@wardic/core/FrameLoop";
|
|
21
|
+
import type * as InterpolatorRegistry from "@wardic/core/InterpolatorRegistry";
|
|
22
|
+
import type * as Announcer from "@wardic/core/Announcer";
|
|
23
|
+
import type * as DefaultTransition from "@wardic/core/DefaultTransition";
|
|
24
|
+
import type * as ReducedMotion from "@wardic/core/ReducedMotion";
|
|
25
|
+
import type * as Probe from "@wardic/core/Probe";
|
|
26
|
+
import type * as RefreshFrameSource from "@wardic/core/RefreshFrameSource";
|
|
27
|
+
import type * as Renderer from "@wardic/core/Renderer";
|
|
28
|
+
import * as Layer from "effect/Layer";
|
|
29
|
+
import { AtomRegistry } from "effect/reactivity";
|
|
30
|
+
export declare const VERSION = "1.0.0-rc.2";
|
|
31
|
+
export * as DomClock from "./DomClock.ts";
|
|
32
|
+
export * as DomInput from "./DomInput.ts";
|
|
33
|
+
export * as DomProbe from "./DomProbe.ts";
|
|
34
|
+
export * as DomRenderer from "./DomRenderer.ts";
|
|
35
|
+
export * as DomAnnouncer from "./DomAnnouncer.ts";
|
|
36
|
+
export * as DomInterpolators from "./DomInterpolators.ts";
|
|
37
|
+
export * as DomPositionalKeys from "./DomPositionalKeys.ts";
|
|
38
|
+
export * as DomDefaultTransition from "./DomDefaultTransition.ts";
|
|
39
|
+
export * as DomKeyRules from "./DomKeyRules.ts";
|
|
40
|
+
export * as FlushGate from "./FlushGate.ts";
|
|
41
|
+
export * as ProjectionSystem from "./ProjectionSystem.ts";
|
|
42
|
+
export * as DomProjectionSystem from "./DomProjectionSystem.ts";
|
|
43
|
+
export * as ReorderController from "./ReorderController.ts";
|
|
44
|
+
export * as Style from "./Style.ts";
|
|
45
|
+
export * as Svg from "./Svg.ts";
|
|
46
|
+
export * as Color from "./Color.ts";
|
|
47
|
+
export * as Variables from "./Variables.ts";
|
|
48
|
+
export * as ScrollOffset from "./ScrollOffset.ts";
|
|
49
|
+
export * as Appear from "./Appear.ts";
|
|
50
|
+
export * as OwnValues from "./OwnValues.ts";
|
|
51
|
+
export * as Report from "./Report.ts";
|
|
52
|
+
/**
|
|
53
|
+
* Core's development check for Frames that aren't finite (`FrameLoop.CheckFrames`), here for an app,
|
|
54
|
+
* which installs `@wardic/dom` and not `@wardic/core`. Off by default; merged beside {@link DomLive} as
|
|
55
|
+
* `Layer.succeed(CheckFrames, true)`, it fails an animation whose Frame holds a NaN or an Infinity,
|
|
56
|
+
* naming its key and value, where the page would drop it without a word. It checks every Frame, so
|
|
57
|
+
* it's for development: see https://wardic.dev/guides/observability.
|
|
58
|
+
*/
|
|
59
|
+
export { CheckFrames } from "@wardic/core/FrameLoop";
|
|
60
|
+
/**
|
|
61
|
+
* The browser Environment, composed: the DOM's services, core's interpolators with the DOM's Key
|
|
62
|
+
* rules, and the Frame loop over the DOM's Clock, needing nothing else. Hand it to `WardicProvider`'s
|
|
63
|
+
* `env` to run the engine on the page.
|
|
64
|
+
*
|
|
65
|
+
* It has no input: a binding's gestures build `DomInput.layer` with the first one an app uses, so an
|
|
66
|
+
* app with none ships no input code.
|
|
67
|
+
*
|
|
68
|
+
* Client-only: a server render builds no runtime, and building DomLive on a server fails with an
|
|
69
|
+
* error naming the service and the missing global: see https://wardic.dev/guides/server-rendering.
|
|
70
|
+
*/
|
|
71
|
+
export declare const DomLive: Layer.Layer<Clock.Clock | RefreshFrameSource.RefreshFrameSource | FrameLoop.FrameLoop | Renderer.Renderer | Probe.Probe | InterpolatorRegistry.InterpolatorRegistry | ReducedMotion.PositionalKeys | DefaultTransition.DefaultTransition | Announcer.Announcer | AtomRegistry.AtomRegistry>;
|
|
72
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,KAAK,oBAAoB,MAAM,mCAAmC,CAAA;AAC9E,OAAO,KAAK,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,KAAK,iBAAiB,MAAM,gCAAgC,CAAA;AACxE,OAAO,KAAK,KAAK,aAAa,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,KAAK,kBAAkB,MAAM,iCAAiC,CAAA;AAC1E,OAAO,KAAK,KAAK,QAAQ,MAAM,uBAAuB,CAAA;AACtD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAShD,eAAO,MAAM,OAAO,eAAe,CAAA;AAEnC,OAAO,KAAK,QAAQ,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,cAAc,GAC5B,iBAAiB,CAAC,iBAAiB,GACnC,SAAS,CAAC,SAAS,GACnB,YAAY,CAAC,YAAY,CAM5B,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as FrameLoop from "@wardic/core/FrameLoop";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import { AtomRegistry } from "effect/reactivity";
|
|
4
|
+
import * as DomAnnouncer from "./DomAnnouncer.js";
|
|
5
|
+
import * as DomClock from "./DomClock.js";
|
|
6
|
+
import * as DomDefaultTransition from "./DomDefaultTransition.js";
|
|
7
|
+
import * as DomInterpolators from "./DomInterpolators.js";
|
|
8
|
+
import * as DomPositionalKeys from "./DomPositionalKeys.js";
|
|
9
|
+
import * as DomProbe from "./DomProbe.js";
|
|
10
|
+
import * as DomRenderer from "./DomRenderer.js";
|
|
11
|
+
export const VERSION = "1.0.0-rc.2";
|
|
12
|
+
export * as DomClock from "./DomClock.js";
|
|
13
|
+
export * as DomInput from "./DomInput.js";
|
|
14
|
+
export * as DomProbe from "./DomProbe.js";
|
|
15
|
+
export * as DomRenderer from "./DomRenderer.js";
|
|
16
|
+
export * as DomAnnouncer from "./DomAnnouncer.js";
|
|
17
|
+
export * as DomInterpolators from "./DomInterpolators.js";
|
|
18
|
+
export * as DomPositionalKeys from "./DomPositionalKeys.js";
|
|
19
|
+
export * as DomDefaultTransition from "./DomDefaultTransition.js";
|
|
20
|
+
export * as DomKeyRules from "./DomKeyRules.js";
|
|
21
|
+
export * as FlushGate from "./FlushGate.js";
|
|
22
|
+
export * as ProjectionSystem from "./ProjectionSystem.js";
|
|
23
|
+
export * as DomProjectionSystem from "./DomProjectionSystem.js";
|
|
24
|
+
export * as ReorderController from "./ReorderController.js";
|
|
25
|
+
export * as Style from "./Style.js";
|
|
26
|
+
export * as Svg from "./Svg.js";
|
|
27
|
+
export * as Color from "./Color.js";
|
|
28
|
+
export * as Variables from "./Variables.js";
|
|
29
|
+
export * as ScrollOffset from "./ScrollOffset.js";
|
|
30
|
+
export * as Appear from "./Appear.js";
|
|
31
|
+
export * as OwnValues from "./OwnValues.js";
|
|
32
|
+
export * as Report from "./Report.js";
|
|
33
|
+
/**
|
|
34
|
+
* Core's development check for Frames that aren't finite (`FrameLoop.CheckFrames`), here for an app,
|
|
35
|
+
* which installs `@wardic/dom` and not `@wardic/core`. Off by default; merged beside {@link DomLive} as
|
|
36
|
+
* `Layer.succeed(CheckFrames, true)`, it fails an animation whose Frame holds a NaN or an Infinity,
|
|
37
|
+
* naming its key and value, where the page would drop it without a word. It checks every Frame, so
|
|
38
|
+
* it's for development: see https://wardic.dev/guides/observability.
|
|
39
|
+
*/
|
|
40
|
+
// ADR-0030 decision 7; re-exported here for an app (#586).
|
|
41
|
+
export { CheckFrames } from "@wardic/core/FrameLoop";
|
|
42
|
+
/**
|
|
43
|
+
* The browser Environment, composed: the DOM's services, core's interpolators with the DOM's Key
|
|
44
|
+
* rules, and the Frame loop over the DOM's Clock, needing nothing else. Hand it to `WardicProvider`'s
|
|
45
|
+
* `env` to run the engine on the page.
|
|
46
|
+
*
|
|
47
|
+
* It has no input: a binding's gestures build `DomInput.layer` with the first one an app uses, so an
|
|
48
|
+
* app with none ships no input code.
|
|
49
|
+
*
|
|
50
|
+
* Client-only: a server render builds no runtime, and building DomLive on a server fails with an
|
|
51
|
+
* error naming the service and the missing global: see https://wardic.dev/guides/server-rendering.
|
|
52
|
+
*/
|
|
53
|
+
// Key rules: ADR-0035. Frame loop: ADR-0027. `DomClock.layer` also provides the `RefreshFrameSource`
|
|
54
|
+
// the flush gate requests its flushes from (ADR-0031). `DomProbe.layer` writes the `viewport` and
|
|
55
|
+
// `prefersReducedMotion` Atoms through the Environment's `AtomRegistry`, and consumers read them
|
|
56
|
+
// through the same registry, so `AtomRegistry` is provided to the Layers with `Layer.provideMerge` and
|
|
57
|
+
// kept in the output, as the headless `testLayer` (packages/test) does: R = never. No InputSource:
|
|
58
|
+
// #511, ADR-0067 decision 14. Client-only: ADR-0021, decision 7.
|
|
59
|
+
export const DomLive = FrameLoop.layer.pipe(Layer.provideMerge(Layer.mergeAll(DomClock.layer, DomRenderer.layer, DomProbe.layer, DomInterpolators.layer, DomPositionalKeys.layer, DomDefaultTransition.layer, DomAnnouncer.layer)), Layer.provideMerge(AtomRegistry.layer));
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AAQnD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,oBAAoB,MAAM,2BAA2B,CAAA;AACjE,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAE/C,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAA;AAEnC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,oBAAoB,MAAM,2BAA2B,CAAA;AACjE,OAAO,KAAK,WAAW,MAA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` as
|
|
3
|
+
* one visually hidden live region per document, `aria-live="assertive"` and `aria-atomic`, shared by
|
|
4
|
+
* every Reorder group on the page. Assertive, because each announcement answers a key just pressed;
|
|
5
|
+
* the caller thins a held arrow's repeats to the last. Each announcement replaces the last, and one
|
|
6
|
+
* that repeats the last (an arrow at an end re-announcing the position) gets a trailing no-break
|
|
7
|
+
* space, so a screen reader sees a change and speaks it again.
|
|
8
|
+
*
|
|
9
|
+
* A screen reader watches a live region from when it's in the page, so the region has to be there
|
|
10
|
+
* before the first announcement: {@link prepareAnnouncer} adds it (a Reorder group's controller calls
|
|
11
|
+
* it when its element attaches), and an announcement adds it too if nothing did.
|
|
12
|
+
*
|
|
13
|
+
* {@link instructionsId} gives the id of a hidden element holding a group's instructions, one per
|
|
14
|
+
* distinct text per document, for its items' `aria-describedby`. {@link instructionsIdOf} gives the
|
|
15
|
+
* id alone, and {@link showInstructions} adds its element.
|
|
16
|
+
*
|
|
17
|
+
* Client-only (ADR-0021, decision 7): building the layer on a server fails with the client-only error.
|
|
18
|
+
*
|
|
19
|
+
* Tier 2 (ADR-0008): for DOM binding authors.
|
|
20
|
+
*/
|
|
21
|
+
import * as Announcer from "@wardic/core/Announcer";
|
|
22
|
+
import * as Layer from "effect/Layer";
|
|
23
|
+
/** The attribute that marks the live region, for a test or a stylesheet to find it. */
|
|
24
|
+
export declare const ANNOUNCER_ATTRIBUTE = "data-wardic-announcer";
|
|
25
|
+
/**
|
|
26
|
+
* The live document `node` is in: its own when that has a window, else the page's. A Solid ref
|
|
27
|
+
* runs while a new element still belongs to its template's inert document (no window, no body),
|
|
28
|
+
* before it's inserted.
|
|
29
|
+
*/
|
|
30
|
+
export declare const documentOf: (node: Node) => Document;
|
|
31
|
+
/** Adds `doc`'s live region now, before its first announcement, so a screen reader is already watching it. */
|
|
32
|
+
export declare const prepareAnnouncer: (doc: Document) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Speaks `message` in `doc`'s live region, replacing the last. A repeat of the last gets a trailing
|
|
35
|
+
* no-break space, so it's read out again.
|
|
36
|
+
*/
|
|
37
|
+
export declare const announceIn: (doc: Document, message: string) => void;
|
|
38
|
+
/**
|
|
39
|
+
* The id of `doc`'s hidden element holding `text`, one per distinct text, for the `aria-describedby` of
|
|
40
|
+
* every item that shows it. Given here, with no element added: a binding works it out as it renders, and
|
|
41
|
+
* adds the element with `showInstructions` in an effect.
|
|
42
|
+
*/
|
|
43
|
+
export declare const instructionsIdOf: (doc: Document, text: string) => string;
|
|
44
|
+
/** Adds `doc`'s hidden element holding `text`, under `instructionsIdOf`'s id, unless it's there already. */
|
|
45
|
+
export declare const showInstructions: (doc: Document, text: string) => void;
|
|
46
|
+
/** `instructionsIdOf`, with its element added now: added again if it was removed. */
|
|
47
|
+
export declare const instructionsId: (doc: Document, text: string) => string;
|
|
48
|
+
/** Core's `Announcer`, speaking in the page's `document`'s live region. */
|
|
49
|
+
export declare const AnnouncerDomLive: Layer.Layer<Announcer.Announcer>;
|
|
50
|
+
//# sourceMappingURL=announcer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"announcer.d.ts","sourceRoot":"","sources":["../../src/internal/announcer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AAGnD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAKrC,uFAAuF;AACvF,eAAO,MAAM,mBAAmB,0BAA0B,CAAA;AA6B1D;;;;GAIG;AACH,eAAO,MAAM,UAAU,SAAU,IAAI,KAAG,QAIvC,CAAA;AAED,8GAA8G;AAC9G,eAAO,MAAM,gBAAgB,QAAS,QAAQ,KAAG,IAEhD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,QAAS,QAAQ,WAAW,MAAM,KAAG,IAG3D,CAAA;AAQD;;;;GAIG;AAEH,eAAO,MAAM,gBAAgB,QAAS,QAAQ,QAAQ,MAAM,KAAG,MAW9D,CAAA;AAED,4GAA4G;AAC5G,eAAO,MAAM,gBAAgB,QAAS,QAAQ,QAAQ,MAAM,KAAG,IAQ9D,CAAA;AAED,qFAAqF;AACrF,eAAO,MAAM,cAAc,QAAS,QAAQ,QAAQ,MAAM,KAAG,MAG5D,CAAA;AAED,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAK7D,CAAA"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DOM's **Announcement** channel (ADR-0037): `AnnouncerDomLive`, core's `Announcer.Announcer` as
|
|
3
|
+
* one visually hidden live region per document, `aria-live="assertive"` and `aria-atomic`, shared by
|
|
4
|
+
* every Reorder group on the page. Assertive, because each announcement answers a key just pressed;
|
|
5
|
+
* the caller thins a held arrow's repeats to the last. Each announcement replaces the last, and one
|
|
6
|
+
* that repeats the last (an arrow at an end re-announcing the position) gets a trailing no-break
|
|
7
|
+
* space, so a screen reader sees a change and speaks it again.
|
|
8
|
+
*
|
|
9
|
+
* A screen reader watches a live region from when it's in the page, so the region has to be there
|
|
10
|
+
* before the first announcement: {@link prepareAnnouncer} adds it (a Reorder group's controller calls
|
|
11
|
+
* it when its element attaches), and an announcement adds it too if nothing did.
|
|
12
|
+
*
|
|
13
|
+
* {@link instructionsId} gives the id of a hidden element holding a group's instructions, one per
|
|
14
|
+
* distinct text per document, for its items' `aria-describedby`. {@link instructionsIdOf} gives the
|
|
15
|
+
* id alone, and {@link showInstructions} adds its element.
|
|
16
|
+
*
|
|
17
|
+
* Client-only (ADR-0021, decision 7): building the layer on a server fails with the client-only error.
|
|
18
|
+
*
|
|
19
|
+
* Tier 2 (ADR-0008): for DOM binding authors.
|
|
20
|
+
*/
|
|
21
|
+
import * as Announcer from "@wardic/core/Announcer";
|
|
22
|
+
import * as Bool from "effect/Boolean";
|
|
23
|
+
import * as Effect from "effect/Effect";
|
|
24
|
+
import * as Layer from "effect/Layer";
|
|
25
|
+
import * as Option from "effect/Option";
|
|
26
|
+
import * as Predicate from "effect/Predicate";
|
|
27
|
+
import { requireGlobal } from "./require-global.js";
|
|
28
|
+
/** The attribute that marks the live region, for a test or a stylesheet to find it. */
|
|
29
|
+
export const ANNOUNCER_ATTRIBUTE = "data-wardic-announcer";
|
|
30
|
+
/** Hidden from sight, not from assistive technology: the usual visually hidden rule. */
|
|
31
|
+
const VISUALLY_HIDDEN = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap";
|
|
32
|
+
/** Each document's live region, once added. */
|
|
33
|
+
// Module state (#460, Q7): each document's live region, held weakly by the document.
|
|
34
|
+
const regions = new WeakMap();
|
|
35
|
+
/** `doc`'s live region, added to its body when it has none. */
|
|
36
|
+
const regionOf = (doc) => Option.getOrElse(Option.filter(Option.fromUndefinedOr(regions.get(doc)), (region) => region.isConnected), () => addRegion(doc));
|
|
37
|
+
/** Add `doc`'s live region to its body. */
|
|
38
|
+
const addRegion = (doc) => {
|
|
39
|
+
const region = doc.createElement("div");
|
|
40
|
+
region.setAttribute(ANNOUNCER_ATTRIBUTE, "");
|
|
41
|
+
region.setAttribute("aria-live", "assertive");
|
|
42
|
+
region.setAttribute("aria-atomic", "true");
|
|
43
|
+
region.setAttribute("style", VISUALLY_HIDDEN);
|
|
44
|
+
doc.body.appendChild(region);
|
|
45
|
+
regions.set(doc, region);
|
|
46
|
+
return region;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* The live document `node` is in: its own when that has a window, else the page's. A Solid ref
|
|
50
|
+
* runs while a new element still belongs to its template's inert document (no window, no body),
|
|
51
|
+
* before it's inserted.
|
|
52
|
+
*/
|
|
53
|
+
export const documentOf = (node) => {
|
|
54
|
+
const doc = node.ownerDocument;
|
|
55
|
+
if (doc === null || doc.defaultView === null)
|
|
56
|
+
return document;
|
|
57
|
+
return doc;
|
|
58
|
+
};
|
|
59
|
+
/** Adds `doc`'s live region now, before its first announcement, so a screen reader is already watching it. */
|
|
60
|
+
export const prepareAnnouncer = (doc) => {
|
|
61
|
+
regionOf(doc);
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Speaks `message` in `doc`'s live region, replacing the last. A repeat of the last gets a trailing
|
|
65
|
+
* no-break space, so it's read out again.
|
|
66
|
+
*/
|
|
67
|
+
export const announceIn = (doc, message) => {
|
|
68
|
+
const region = regionOf(doc);
|
|
69
|
+
region.textContent = Bool.match(region.textContent === message, { onTrue: () => `${message}\u00A0`, onFalse: () => message });
|
|
70
|
+
};
|
|
71
|
+
/** Each document's instructions ids, by text. */
|
|
72
|
+
// Module state (#460, Q7): each document's instructions, held weakly by the document.
|
|
73
|
+
const instructions = new WeakMap();
|
|
74
|
+
// Module state (#460, Q7): an id counter; an id need only be unique in its document.
|
|
75
|
+
let nextInstructions = 1;
|
|
76
|
+
/**
|
|
77
|
+
* The id of `doc`'s hidden element holding `text`, one per distinct text, for the `aria-describedby` of
|
|
78
|
+
* every item that shows it. Given here, with no element added: a binding works it out as it renders, and
|
|
79
|
+
* adds the element with `showInstructions` in an effect.
|
|
80
|
+
*/
|
|
81
|
+
// #320.
|
|
82
|
+
export const instructionsIdOf = (doc, text) => {
|
|
83
|
+
const byText = Option.getOrElse(Option.fromUndefinedOr(instructions.get(doc)), () => {
|
|
84
|
+
const added = new Map();
|
|
85
|
+
instructions.set(doc, added);
|
|
86
|
+
return added;
|
|
87
|
+
});
|
|
88
|
+
return Option.getOrElse(Option.fromUndefinedOr(byText.get(text)), () => {
|
|
89
|
+
const id = `wardic-instructions-${nextInstructions++}`;
|
|
90
|
+
byText.set(text, id);
|
|
91
|
+
return id;
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
/** Adds `doc`'s hidden element holding `text`, under `instructionsIdOf`'s id, unless it's there already. */
|
|
95
|
+
export const showInstructions = (doc, text) => {
|
|
96
|
+
const id = instructionsIdOf(doc, text);
|
|
97
|
+
if (Predicate.isNotNull(doc.getElementById(id)))
|
|
98
|
+
return;
|
|
99
|
+
const el = doc.createElement("div");
|
|
100
|
+
el.id = id;
|
|
101
|
+
el.hidden = true;
|
|
102
|
+
el.textContent = text;
|
|
103
|
+
doc.body.appendChild(el);
|
|
104
|
+
};
|
|
105
|
+
/** `instructionsIdOf`, with its element added now: added again if it was removed. */
|
|
106
|
+
export const instructionsId = (doc, text) => {
|
|
107
|
+
showInstructions(doc, text);
|
|
108
|
+
return instructionsIdOf(doc, text);
|
|
109
|
+
};
|
|
110
|
+
/** Core's `Announcer`, speaking in the page's `document`'s live region. */
|
|
111
|
+
export const AnnouncerDomLive = Layer.effect(Announcer.Announcer)(Effect.gen(function* () {
|
|
112
|
+
yield* requireGlobal("DomAnnouncer.layer", "document");
|
|
113
|
+
return Announcer.Announcer.of({ announce: (message) => announceIn(document, message) });
|
|
114
|
+
}));
|
|
115
|
+
//# sourceMappingURL=announcer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"announcer.js","sourceRoot":"","sources":["../../src/internal/announcer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,uFAAuF;AACvF,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAA;AAE1D,wFAAwF;AACxF,MAAM,eAAe,GACnB,kJAAkJ,CAAA;AAEpJ,+CAA+C;AAC/C,qFAAqF;AACrF,MAAM,OAAO,GAAG,IAAI,OAAO,EA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/core/Values";
|
|
4
|
+
import type { LazyArg } from "effect/Function";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
import * as Result from "effect/Result";
|
|
7
|
+
import { type TransformTemplate } from "./renderer.ts";
|
|
8
|
+
/** An element's mount animation, as its binding describes it. */
|
|
9
|
+
export interface Spec {
|
|
10
|
+
/**
|
|
11
|
+
* What built the animation, as one string the binding writes the same on the server and the
|
|
12
|
+
* client: its starting values, its targets, its transition, whether motion is reduced. The rule's
|
|
13
|
+
* name is its hash, so a client tells a Handoff it can continue from one it can't (decision 6).
|
|
14
|
+
*/
|
|
15
|
+
readonly key: string;
|
|
16
|
+
/** The element's tag, so an SVG element's keys go to its attributes; `undefined` for an HTML element. */
|
|
17
|
+
readonly tag: string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The animation's values from its start (for an `infinite` one, one cycle of it), built only when
|
|
20
|
+
* the rule isn't cached: a server render calls it once per spec per process.
|
|
21
|
+
*/
|
|
22
|
+
readonly machine: LazyArg<Machine.Machine<Frame.Frame<Values.Values>>>;
|
|
23
|
+
/** Played over and over: an infinite repeat, `machine` one cycle of it. */
|
|
24
|
+
readonly infinite?: boolean | undefined;
|
|
25
|
+
/** A layout node: drawn through its projection at rest, as the client draws it, its own move on top. */
|
|
26
|
+
readonly projected?: boolean | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The element's transform template: each stop's transform drawn through it, as the client draws it. A
|
|
29
|
+
* function's text can't name a rule, so a templated spec's rule is named by its stops, and sampled for
|
|
30
|
+
* each element that has one, never cached.
|
|
31
|
+
*/
|
|
32
|
+
readonly template?: TransformTemplate | undefined;
|
|
33
|
+
}
|
|
34
|
+
/** A spec's `@keyframes` rule. */
|
|
35
|
+
export interface Keyframes {
|
|
36
|
+
/** The rule's name: `wardic-` and the spec's hash. */
|
|
37
|
+
readonly name: string;
|
|
38
|
+
/**
|
|
39
|
+
* Seconds the rule plays, a multiple of 1/60 s: to the first Frame from which every one is within
|
|
40
|
+
* tolerance of the settled one.
|
|
41
|
+
*/
|
|
42
|
+
readonly duration: number;
|
|
43
|
+
/** Seconds to the Frame the spec settles at, which a client waits for: at or past `duration`. */
|
|
44
|
+
readonly settled: number;
|
|
45
|
+
/** Whether it plays over and over. */
|
|
46
|
+
readonly infinite: boolean;
|
|
47
|
+
/** The time of each stop kept, in seconds from the start. */
|
|
48
|
+
readonly times: ReadonlyArray<number>;
|
|
49
|
+
/** The rule, `@keyframes <name>{…}`. */
|
|
50
|
+
readonly css: string;
|
|
51
|
+
/**
|
|
52
|
+
* The SVG geometry properties its stops write (`cx`, `r`…), which some browsers don't draw from CSS: an
|
|
53
|
+
* element playing it is defined under `@supports` for each, so a browser without them keeps it at its
|
|
54
|
+
* starting style. Empty for most rules.
|
|
55
|
+
*/
|
|
56
|
+
readonly supports: ReadonlyArray<string>;
|
|
57
|
+
}
|
|
58
|
+
/** Where an element's timing is decided: a spec, and the delay it starts after. */
|
|
59
|
+
export interface Play {
|
|
60
|
+
/** The element's mount animation. */
|
|
61
|
+
readonly spec: Spec;
|
|
62
|
+
/** Seconds before it starts: its orchestration's, and any delay on the whole element. */
|
|
63
|
+
readonly delay: number;
|
|
64
|
+
}
|
|
65
|
+
/** The prefix every Appear rule's name starts with. */
|
|
66
|
+
export declare const PREFIX = "wardic-";
|
|
67
|
+
/** The longest mount animation sampled, in seconds; a longer one keeps its Starting style. */
|
|
68
|
+
export declare const MAX_SECONDS = 60;
|
|
69
|
+
/** The rule's name for a spec: its key, tag, repeat and projection, hashed. */
|
|
70
|
+
export declare const nameOf: (spec: Pick<Spec, "key" | "tag" | "infinite" | "projected">) => string;
|
|
71
|
+
/**
|
|
72
|
+
* The stops kept (decision 9), as indices into `frames`, and where the rule ends.
|
|
73
|
+
*
|
|
74
|
+
* - **It ends** at the first Frame from which every one is within tolerance of the settled Frame,
|
|
75
|
+
* drawn as the settled Frame: a tween stepped in 1/60 s settles a frame after it arrives, when
|
|
76
|
+
* its steps' sum crosses its duration.
|
|
77
|
+
* - **The stops kept** are the first, the end, and each one a straight line from the last kept can't
|
|
78
|
+
* reach past, within every key's tolerances.
|
|
79
|
+
* - **A jump** (`jumps`, kept stops): a Frame the one before it can't be drawn into, as `jumpAt`
|
|
80
|
+
* tells. The rule holds the Frame before it to halfway between them, then steps, so a display
|
|
81
|
+
* frame near either draws that Frame, not a value on a line through values the engine never draws.
|
|
82
|
+
*/
|
|
83
|
+
export declare const thin: (frames: ReadonlyArray<Values.Values>, tag?: string | undefined) => {
|
|
84
|
+
readonly kept: ReadonlyArray<number>;
|
|
85
|
+
readonly end: number;
|
|
86
|
+
readonly jumps: ReadonlyArray<number>;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* A spec's rule, or why it has none, for a debug log. Sampled once a spec and cached across requests by
|
|
90
|
+
* its name, since a spec's rule changes only once the page registers every colour space
|
|
91
|
+
* (`Color.registerSpaces`): a wide-gamut colour blends as written before, in sRGB after. Its name stays,
|
|
92
|
+
* so a client matches it whatever it had registered. A templated spec's is sampled each time: its name
|
|
93
|
+
* comes from its stops.
|
|
94
|
+
*/
|
|
95
|
+
export declare const keyframes: (spec: Spec) => Result.Result<Keyframes, string>;
|
|
96
|
+
/**
|
|
97
|
+
* An element's `animation` value for a play of `rule`: its name, length, delay and repeat, filling
|
|
98
|
+
* forwards. Not backwards: through its delay the element shows its inline starting style, which is the
|
|
99
|
+
* rule's first stop for a rule that moves from it.
|
|
100
|
+
*/
|
|
101
|
+
export declare const animationOf: (rule: Keyframes, delay: number) => string;
|
|
102
|
+
/** One element's place in a sheet. */
|
|
103
|
+
export interface Slot {
|
|
104
|
+
/** The element's inline `animation`: `var(--wardic-aN)`, which the sheet defines once `define` is called. */
|
|
105
|
+
readonly animation: string;
|
|
106
|
+
/**
|
|
107
|
+
* The element's timing: `play`, and under `prefers-reduced-motion: reduce` `reduced` when given
|
|
108
|
+
* (a provider's `"user"`). Undefined until called, and left so when either spec has no rule: the
|
|
109
|
+
* element keeps its Starting style. The reason comes back for the debug log.
|
|
110
|
+
*
|
|
111
|
+
* Defined under `@supports` for the geometry properties its rules write and `supports`: a binding
|
|
112
|
+
* passes the ones every element it orchestrates with writes, so a browser without them keeps the whole
|
|
113
|
+
* group at its starting style, not half of it.
|
|
114
|
+
*/
|
|
115
|
+
readonly define: (play: Play, reduced?: Play | undefined, supports?: ReadonlyArray<string>) => Result.Result<void, string>;
|
|
116
|
+
}
|
|
117
|
+
/** One render's Appear rules: a slot per element, and the `<style>` text for the head and each late chunk. */
|
|
118
|
+
export interface Sheet {
|
|
119
|
+
/** A slot for the next element. */
|
|
120
|
+
readonly slot: () => Slot;
|
|
121
|
+
/**
|
|
122
|
+
* The CSS since the last call: each rule this render hasn't written yet, and the custom property of
|
|
123
|
+
* each slot defined since, the reduced ones under the media query. Called once for the head, and again
|
|
124
|
+
* for each chunk a stream sends after its shell, with only what that chunk adds.
|
|
125
|
+
*/
|
|
126
|
+
readonly css: () => string;
|
|
127
|
+
}
|
|
128
|
+
/** A sheet for one render: a slot per element, and the CSS for the head. */
|
|
129
|
+
export declare const sheet: () => Sheet;
|
|
130
|
+
/**
|
|
131
|
+
* The attribute a late chunk's `<style>` carries: a chunk a stream sends after its shell brings its own
|
|
132
|
+
* rules, in a node its client doesn't render.
|
|
133
|
+
*/
|
|
134
|
+
export declare const CHUNK_ATTRIBUTE = "data-wardic-appear-chunk";
|
|
135
|
+
/**
|
|
136
|
+
* A late chunk's `<style>` for `css`, as server text; "" for none. With a `nonce`, the one the page's
|
|
137
|
+
* Content Security Policy gives inline styles, it carries it.
|
|
138
|
+
*/
|
|
139
|
+
export declare const chunkStyle: (css: string, nonce?: string) => string;
|
|
140
|
+
/**
|
|
141
|
+
* Moves each late chunk's Appear rules into the head: its `<style data-wardic-appear-chunk>`'s text into a
|
|
142
|
+
* head `<style>`, then the node out, before the chunk hydrates, since a hydrating client expects no node it
|
|
143
|
+
* doesn't render. The text goes first, so the rule a running animation plays is never missing. Chunks
|
|
144
|
+
* already in the document move at once; while it's still loading, a stream still coming, a
|
|
145
|
+
* `MutationObserver` moves each as it lands, until `DOMContentLoaded`. Every call moves what's there; one
|
|
146
|
+
* observer a document.
|
|
147
|
+
*/
|
|
148
|
+
export declare const adoptChunks: (doc: Document) => void;
|
|
149
|
+
/** The element's Appear animation: its `wardic-…` CSS animation, running, or finished and filling. */
|
|
150
|
+
export declare const find: (element: Element) => Option.Option<Animation>;
|
|
151
|
+
/** Whether `animation` is `spec`'s: the rule the server sampled from the same spec. */
|
|
152
|
+
export declare const matches: (animation: Animation, spec: Pick<Spec, "key" | "tag" | "infinite" | "projected">) => boolean;
|
|
153
|
+
/** How far `animation` has got, in seconds since it started (its delay included): 0 before it has. */
|
|
154
|
+
export declare const elapsedOf: (animation: Animation) => number;
|
|
155
|
+
/** The delay `animation` started after, in seconds: what its element's `animation-delay` holds. */
|
|
156
|
+
export declare const delayOf: (animation: Animation) => number;
|
|
157
|
+
/**
|
|
158
|
+
* Whether `element`'s Appear animation is running, not yet handed over: its inline style still names its
|
|
159
|
+
* slot, which `release` removes. A layout measure asks it of each node, so a running animation's
|
|
160
|
+
* transform, which beats the inline one, stays out of the box it reads.
|
|
161
|
+
*/
|
|
162
|
+
export declare const pending: (element: ElementCSSInlineStyle) => boolean;
|
|
163
|
+
/**
|
|
164
|
+
* The handover's last step: the element's inline `animation` removed, in the task that writes the
|
|
165
|
+
* engine's first frame, so no paint falls between. While it ran, its value beat the inline style the
|
|
166
|
+
* engine writes; removing it ends the CSS animation at that task's style update.
|
|
167
|
+
*/
|
|
168
|
+
export declare const release: (element: ElementCSSInlineStyle) => void;
|
|
169
|
+
//# sourceMappingURL=appear.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appear.d.ts","sourceRoot":"","sources":["../../src/internal/appear.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAE/C,OAAO,KAAK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