@wardic/core 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Batch.d.ts +4 -2
- package/dist/Batch.d.ts.map +1 -1
- package/dist/Batch.js +80 -13
- package/dist/Batch.js.map +1 -1
- package/dist/DefaultTransition.d.ts.map +1 -1
- package/dist/DefaultTransition.js +1 -1
- package/dist/DefaultTransition.js.map +1 -1
- package/dist/LiveValue.d.ts +61 -0
- package/dist/LiveValue.d.ts.map +1 -1
- package/dist/LiveValue.js +79 -5
- package/dist/LiveValue.js.map +1 -1
- package/dist/Machine.d.ts +10 -1
- package/dist/Machine.d.ts.map +1 -1
- package/dist/Machine.js +18 -1
- package/dist/Machine.js.map +1 -1
- package/dist/Renderer.js +2 -2
- package/dist/Renderer.js.map +1 -1
- package/dist/Spans.d.ts +41 -0
- package/dist/Spans.d.ts.map +1 -0
- package/dist/Spans.js +39 -0
- package/dist/Spans.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/frameLoop.d.ts +1 -1
- package/dist/internal/frameLoop.d.ts.map +1 -1
- package/dist/internal/frameLoop.js +42 -19
- package/dist/internal/frameLoop.js.map +1 -1
- package/dist/internal/options.d.ts.map +1 -1
- package/dist/internal/options.js +2 -2
- package/dist/internal/options.js.map +1 -1
- package/dist/internal/tracing.d.ts +34 -14
- package/dist/internal/tracing.d.ts.map +1 -1
- package/dist/internal/tracing.js +56 -24
- package/dist/internal/tracing.js.map +1 -1
- package/dist/unstable/AnimationControls.d.ts +110 -0
- package/dist/unstable/AnimationControls.d.ts.map +1 -0
- package/dist/unstable/AnimationControls.js +107 -0
- package/dist/unstable/AnimationControls.js.map +1 -0
- package/dist/unstable/AppearHandoff.d.ts +53 -0
- package/dist/unstable/AppearHandoff.d.ts.map +1 -0
- package/dist/unstable/AppearHandoff.js +23 -0
- package/dist/unstable/AppearHandoff.js.map +1 -0
- package/dist/unstable/Config.d.ts +285 -0
- package/dist/unstable/Config.d.ts.map +1 -0
- package/dist/unstable/Config.js +3 -0
- package/dist/unstable/Config.js.map +1 -0
- package/dist/unstable/FlushGate.d.ts +222 -0
- package/dist/unstable/FlushGate.d.ts.map +1 -0
- package/dist/unstable/FlushGate.js +567 -0
- package/dist/unstable/FlushGate.js.map +1 -0
- package/dist/unstable/FrameTime.d.ts +21 -0
- package/dist/unstable/FrameTime.d.ts.map +1 -0
- package/dist/unstable/FrameTime.js +45 -0
- package/dist/unstable/FrameTime.js.map +1 -0
- package/dist/unstable/MeasuredPairs.d.ts +51 -0
- package/dist/unstable/MeasuredPairs.d.ts.map +1 -0
- package/dist/unstable/MeasuredPairs.js +20 -0
- package/dist/unstable/MeasuredPairs.js.map +1 -0
- package/dist/unstable/OwnValues.d.ts +29 -0
- package/dist/unstable/OwnValues.d.ts.map +1 -0
- package/dist/unstable/OwnValues.js +22 -0
- package/dist/unstable/OwnValues.js.map +1 -0
- package/dist/unstable/PresenceRecord.d.ts +176 -0
- package/dist/unstable/PresenceRecord.d.ts.map +1 -0
- package/dist/unstable/PresenceRecord.js +26 -0
- package/dist/unstable/PresenceRecord.js.map +1 -0
- package/dist/unstable/Reactivity.d.ts +29 -0
- package/dist/unstable/Reactivity.d.ts.map +1 -0
- package/dist/unstable/Reactivity.js +15 -0
- package/dist/unstable/Reactivity.js.map +1 -0
- package/dist/unstable/Report.d.ts +30 -0
- package/dist/unstable/Report.d.ts.map +1 -0
- package/dist/unstable/Report.js +66 -0
- package/dist/unstable/Report.js.map +1 -0
- package/dist/unstable/RetargetLegs.d.ts +189 -0
- package/dist/unstable/RetargetLegs.d.ts.map +1 -0
- package/dist/unstable/RetargetLegs.js +834 -0
- package/dist/unstable/RetargetLegs.js.map +1 -0
- package/dist/unstable/Spine.d.ts +696 -0
- package/dist/unstable/Spine.d.ts.map +1 -0
- package/dist/unstable/Spine.js +2617 -0
- package/dist/unstable/Spine.js.map +1 -0
- package/dist/unstable/Stops.d.ts +82 -0
- package/dist/unstable/Stops.d.ts.map +1 -0
- package/dist/unstable/Stops.js +149 -0
- package/dist/unstable/Stops.js.map +1 -0
- package/dist/unstable/Subject.d.ts +11 -0
- package/dist/unstable/Subject.d.ts.map +1 -0
- package/dist/unstable/Subject.js +12 -0
- package/dist/unstable/Subject.js.map +1 -0
- package/dist/unstable/Timelines.d.ts +51 -0
- package/dist/unstable/Timelines.d.ts.map +1 -0
- package/dist/unstable/Timelines.js +10 -0
- package/dist/unstable/Timelines.js.map +1 -0
- package/dist/unstable/VariableValues.d.ts +27 -0
- package/dist/unstable/VariableValues.d.ts.map +1 -0
- package/dist/unstable/VariableValues.js +19 -0
- package/dist/unstable/VariableValues.js.map +1 -0
- package/dist/unstable/VariantTarget.d.ts +106 -0
- package/dist/unstable/VariantTarget.d.ts.map +1 -0
- package/dist/unstable/VariantTarget.js +185 -0
- package/dist/unstable/VariantTarget.js.map +1 -0
- package/dist/unstable/VariantTree.d.ts +351 -0
- package/dist/unstable/VariantTree.d.ts.map +1 -0
- package/dist/unstable/VariantTree.js +362 -0
- package/dist/unstable/VariantTree.js.map +1 -0
- package/dist/unstable/WardicConfigValue.d.ts +89 -0
- package/dist/unstable/WardicConfigValue.d.ts.map +1 -0
- package/dist/unstable/WardicConfigValue.js +106 -0
- package/dist/unstable/WardicConfigValue.js.map +1 -0
- package/dist/unstable/WardicServices.d.ts +46 -0
- package/dist/unstable/WardicServices.d.ts.map +1 -0
- package/dist/unstable/WardicServices.js +72 -0
- package/dist/unstable/WardicServices.js.map +1 -0
- package/package.json +1 -1
- package/src/Batch.ts +68 -12
- package/src/DefaultTransition.ts +1 -1
- package/src/LiveValue.ts +129 -5
- package/src/Machine.ts +22 -1
- package/src/Renderer.ts +2 -2
- package/src/Spans.ts +50 -0
- package/src/index.ts +1 -0
- package/src/internal/frameLoop.ts +44 -20
- package/src/internal/options.ts +2 -2
- package/src/internal/tracing.ts +82 -28
- package/src/unstable/AnimationControls.ts +199 -0
- package/src/unstable/AppearHandoff.ts +81 -0
- package/src/unstable/Config.ts +326 -0
- package/src/unstable/FlushGate.ts +730 -0
- package/src/unstable/FrameTime.ts +52 -0
- package/src/unstable/MeasuredPairs.ts +56 -0
- package/src/unstable/OwnValues.ts +32 -0
- package/src/unstable/PresenceRecord.ts +201 -0
- package/src/unstable/Reactivity.ts +35 -0
- package/src/unstable/Report.ts +75 -0
- package/src/unstable/RetargetLegs.ts +1062 -0
- package/src/unstable/Spine.ts +3275 -0
- package/src/unstable/Stops.ts +221 -0
- package/src/unstable/Subject.ts +13 -0
- package/src/unstable/Timelines.ts +58 -0
- package/src/unstable/VariableValues.ts +27 -0
- package/src/unstable/VariantTarget.ts +246 -0
- package/src/unstable/VariantTree.ts +643 -0
- package/src/unstable/WardicConfigValue.ts +154 -0
- package/src/unstable/WardicServices.ts +125 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FrameTime.js","sourceRoot":"","sources":["../../src/unstable/FrameTime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,iGAAiG;AACjG,sGAAsG;AACtG,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAG7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAA;AAEpC,8HAA8H;AAC9H,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAE,CAAA;AAKtC;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAiB,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAA;AAE5E,+CAA+C;AAC/C,6EAA6E;AAC7E,MAAM,SAAS,GAAG,IAAI,OAAO,EAAsE,CAAA;AAEnG;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAA6D,EAAkB,EAAE;IAC1G,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACnC,IAAI,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IACnF,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC5B,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How an Environment measures a key whose two ends are in units its interpolators can't blend
|
|
3
|
+
* (**Measured pair**): whether a pair needs it, and its measure, whose result each pair reads once
|
|
4
|
+
* it's done. One of the Environment's optional members. An Environment other than `@wardic/dom`'s gives
|
|
5
|
+
* one (`@wardic/test`'s `TestLive` a headless one); a binding on `@wardic/dom` falls back to
|
|
6
|
+
* `@wardic/dom/unstable/DomValues`' when its Environment gives none, so an app that never reads it
|
|
7
|
+
* ships none of that code.
|
|
8
|
+
*
|
|
9
|
+
* Unstable, for Wardic's own packages: public, with no semver promise.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import * as Context from "effect/Context";
|
|
14
|
+
import type * as Option from "effect/Option";
|
|
15
|
+
import type * as Values from "../Values.ts";
|
|
16
|
+
/** A key's pair: its two ends, as given. */
|
|
17
|
+
export interface Pair {
|
|
18
|
+
readonly key: string;
|
|
19
|
+
/** Its start, as given. */
|
|
20
|
+
readonly from: number | string;
|
|
21
|
+
/** Its target, as given. */
|
|
22
|
+
readonly to: number | string;
|
|
23
|
+
}
|
|
24
|
+
/** A pair asked to be measured, which reads its result once it's done. */
|
|
25
|
+
export interface Requested extends Pair {
|
|
26
|
+
/** Its ends in px, once measured; none before, or when they couldn't be read. */
|
|
27
|
+
readonly measured: () => Option.Option<Measured>;
|
|
28
|
+
}
|
|
29
|
+
/** A pair, measured. */
|
|
30
|
+
export interface Measured extends Pair {
|
|
31
|
+
/** Its start in px. */
|
|
32
|
+
readonly fromPx: number;
|
|
33
|
+
/** Its target in px. */
|
|
34
|
+
readonly toPx: number;
|
|
35
|
+
}
|
|
36
|
+
/** An Environment's measures of its Subjects' pairs. */
|
|
37
|
+
export interface Shape {
|
|
38
|
+
/** Whether `key` from `from` to `to` needs its pair measured: its ends in units that don't blend. */
|
|
39
|
+
readonly needs: (key: string, from: number | string, to: number | string) => boolean;
|
|
40
|
+
/** Asks `pairs` measured on `subject`, at `values`: each key's pair, whose result it reads once it's done. */
|
|
41
|
+
readonly measure: (subject: object, pairs: Readonly<Record<string, {
|
|
42
|
+
readonly from: number | string;
|
|
43
|
+
readonly to: number | string;
|
|
44
|
+
}>>, values: Values.Values) => Readonly<Record<string, Requested>>;
|
|
45
|
+
}
|
|
46
|
+
declare const MeasuredPairs_base: Context.ServiceClass<MeasuredPairs, "@wardic/core/unstable/MeasuredPairs", Shape>;
|
|
47
|
+
/** The Environment's member that measures its Subjects' pairs. */
|
|
48
|
+
export declare class MeasuredPairs extends /*#__PURE__*/ MeasuredPairs_base {
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=MeasuredPairs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeasuredPairs.d.ts","sourceRoot":"","sources":["../../src/unstable/MeasuredPairs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,KAAK,MAAM,MAAM,cAAc,CAAA;AAE3C,4CA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+
* How an Environment measures a key whose two ends are in units its interpolators can't blend
|
|
3
|
+
* (**Measured pair**): whether a pair needs it, and its measure, whose result each pair reads once
|
|
4
|
+
* it's done. One of the Environment's optional members. An Environment other than `@wardic/dom`'s gives
|
|
5
|
+
* one (`@wardic/test`'s `TestLive` a headless one); a binding on `@wardic/dom` falls back to
|
|
6
|
+
* `@wardic/dom/unstable/DomValues`' when its Environment gives none, so an app that never reads it
|
|
7
|
+
* ships none of that code.
|
|
8
|
+
*
|
|
9
|
+
* Unstable, for Wardic's own packages: public, with no semver promise.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
// Unstable: ADR-0071, decision 5. #672 (PR2-Q1, PR2-Q2; ADR-0071's *Amendment (#672)*): a port, so the
|
|
14
|
+
// spine reads its Environment's measures through it, not through dom. A pair carries the read of its
|
|
15
|
+
// result, so the legs that run it need no port of their own.
|
|
16
|
+
import * as Context from "effect/Context";
|
|
17
|
+
/** The Environment's member that measures its Subjects' pairs. */
|
|
18
|
+
export class MeasuredPairs extends /*#__PURE__*/ /*#__PURE__*/ Context.Service()("@wardic/core/unstable/MeasuredPairs") {
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=MeasuredPairs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeasuredPairs.js","sourceRoot":"","sources":["../../src/unstable/MeasuredPairs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,uGAAuG;AACvG,qGAAqG;AACrG,6DAA6D;AAC7D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAuCzC,kEAAkE;AAClE,MAAM,OAAO,aAAc,SAAQ,aAAa,CAAb,aAAa,CAAC,OAAO,CAAC,OAAO,EAAwB,CAAC,qCAAqC,CAAC;CAAG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How an Environment reads a Subject's own values (**Own value**): a raw value in the shape of a
|
|
3
|
+
* target, a key's value in the style a binding was given for its Subject, and that style as a record.
|
|
4
|
+
* One of the Environment's optional members. An Environment other than `@wardic/dom`'s gives
|
|
5
|
+
* one (`@wardic/test`'s `TestLive` a headless one); a binding on `@wardic/dom` falls back to
|
|
6
|
+
* `@wardic/dom/unstable/DomValues`' when its Environment gives none, so an app that never reads it
|
|
7
|
+
* ships none of that code.
|
|
8
|
+
*
|
|
9
|
+
* Unstable, for Wardic's own packages: public, with no semver promise.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import * as Context from "effect/Context";
|
|
14
|
+
import type * as Option from "effect/Option";
|
|
15
|
+
/** An Environment's reads of its Subjects' own values. */
|
|
16
|
+
export interface Shape {
|
|
17
|
+
/** `raw` in the shape of `like`: a number for a number, a string with `like`'s unit for a string; none when it can't be read so. */
|
|
18
|
+
readonly valueLike: (raw: unknown, like: number | string) => Option.Option<number | string>;
|
|
19
|
+
/** `key`'s value in `style`, the style a binding was given for its Subject: an object, or the Environment's text form. */
|
|
20
|
+
readonly styleValueOf: (style: object | string | undefined, key: string) => Option.Option<unknown>;
|
|
21
|
+
/** `style` as a record: an object as it is, the Environment's text form read into one, none as an empty one. */
|
|
22
|
+
readonly recordOf: (style: object | string | undefined) => Readonly<Record<string, unknown>>;
|
|
23
|
+
}
|
|
24
|
+
declare const OwnValues_base: Context.ServiceClass<OwnValues, "@wardic/core/unstable/OwnValues", Shape>;
|
|
25
|
+
/** The Environment's member that reads its Subjects' own values. */
|
|
26
|
+
export declare class OwnValues extends /*#__PURE__*/ OwnValues_base {
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=OwnValues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OwnValues.d.ts","sourceRoot":"","sources":["../../src/unstable/OwnValues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAE5C,0DAA0D;AAC1D,MAAM,WAAW,KAAK;IACpB,oIAAoI;IACpI,QAAQ,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;IAC3F,0HAA0H;IAC1H,QAAQ,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAClG,gHAAgH;IAChH,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,KAAK,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAC7F;;AAED,oEAAoE;AACpE,qBAAa,SAAU,SAAQ,aAAa,CAAC,cAAsE;CAAG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How an Environment reads a Subject's own values (**Own value**): a raw value in the shape of a
|
|
3
|
+
* target, a key's value in the style a binding was given for its Subject, and that style as a record.
|
|
4
|
+
* One of the Environment's optional members. An Environment other than `@wardic/dom`'s gives
|
|
5
|
+
* one (`@wardic/test`'s `TestLive` a headless one); a binding on `@wardic/dom` falls back to
|
|
6
|
+
* `@wardic/dom/unstable/DomValues`' when its Environment gives none, so an app that never reads it
|
|
7
|
+
* ships none of that code.
|
|
8
|
+
*
|
|
9
|
+
* Unstable, for Wardic's own packages: public, with no semver promise.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
// Unstable: ADR-0071, decision 5. #672 (PR2-Q1, PR2-Q2; ADR-0071's *Amendment (#672)*): a port, so the
|
|
14
|
+
// spine and `live-style` read their Environment's values through it, not through dom. A provider
|
|
15
|
+
// resolves it once into its record when its Environment gives one, else its DOM binding gives the
|
|
16
|
+
// DOM's (PR2-Q4: so `DomLive` ships none of it to an app that never reads it); each element's spine gets it in its options. Each member is a plain
|
|
17
|
+
// function: `valueLike` runs on a Follow leg's every step.
|
|
18
|
+
import * as Context from "effect/Context";
|
|
19
|
+
/** The Environment's member that reads its Subjects' own values. */
|
|
20
|
+
export class OwnValues extends /*#__PURE__*/ /*#__PURE__*/ Context.Service()("@wardic/core/unstable/OwnValues") {
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=OwnValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OwnValues.js","sourceRoot":"","sources":["../../src/unstable/OwnValues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,uGAAuG;AACvG,iGAAiG;AACjG,kGAAkG;AAClG,mJAAmJ;AACnJ,2DAA2D;AAC3D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAazC,oEAAoE;AACpE,MAAM,OAAO,SAAU,SAAQ,aAAa,CAAb,aAAa,CAAC,OAAO,CAAC,OAAO,EAAoB,CAAC,iCAAiC,CAAC;CAAG"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a Ward and its presence share (ADR-0007): the record a child registers, and the presence's
|
|
3
|
+
* context value, over the Subjects its Environment draws. Every binding's spine writes the same record.
|
|
4
|
+
*
|
|
5
|
+
* Unstable, for Wardic's own packages: public, with no semver promise.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type * as Box from "../Box.ts";
|
|
10
|
+
import type * as Values from "../Values.ts";
|
|
11
|
+
import type * as Subject from "./Subject.ts";
|
|
12
|
+
import type * as Stops from "./Stops.ts";
|
|
13
|
+
import type * as Config from "./Config.ts";
|
|
14
|
+
/**
|
|
15
|
+
* A child's live presence registration. `snapshot` / `exit` are MUTABLE ref
|
|
16
|
+
* cells (`{ current }`) the child's spine writes to while alive; they outlive
|
|
17
|
+
* the child's owner so the parent-driven exit reads them after the child leaves.
|
|
18
|
+
*/
|
|
19
|
+
export interface PresenceRecord<E extends Subject.Subject = Subject.Subject> {
|
|
20
|
+
/** The child's root Subject (the same `el` the spine wires). */
|
|
21
|
+
readonly element: E;
|
|
22
|
+
/** The latest emitted value-map, updated by the spine each frame. */
|
|
23
|
+
readonly snapshot: {
|
|
24
|
+
current: Values.Values;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The exit, resolved as the child leaves: its target, a variant name or a dynamic variant
|
|
28
|
+
* resolved with `custom` (the presence's, when it has one, else the child's last), and the
|
|
29
|
+
* transition it runs on. The child keeps what it's resolved from current while alive.
|
|
30
|
+
*/
|
|
31
|
+
readonly exitOf: (custom: unknown, inherited: Config.WardicVariantLabels | undefined) => PresenceExit;
|
|
32
|
+
/**
|
|
33
|
+
* Where it sits in the variant tree, decided at setup as the tree is: whether it joins the
|
|
34
|
+
* nearest element that provides a context (a **Variant child**, which then exits on that one's
|
|
35
|
+
* exit name, in its stagger), whether its own Variant children join it, and whether it's a twin
|
|
36
|
+
* (a `layoutId`, whose crossfade replaces its exit). Left out: none of them.
|
|
37
|
+
*/
|
|
38
|
+
readonly tree?: PresenceTree;
|
|
39
|
+
/**
|
|
40
|
+
* Where an exit key with no value in `snapshot` starts: its value as the element was given it (in
|
|
41
|
+
* `@wardic/dom`, its `style`), else its Own value, read from the Subject kept at the exit, in the
|
|
42
|
+
* shape of `like` (the key's exit target). `undefined` starts it at its target. Optional: a record
|
|
43
|
+
* without it starts such a key at its target.
|
|
44
|
+
*/
|
|
45
|
+
readonly startOf?: ((key: string, like: number | string) => number | string | undefined) | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Its velocities now, each numeric key's: what a child back under its key starts with, when
|
|
48
|
+
* this one is taken over without an exit running. Optional: left out, 0.
|
|
49
|
+
*/
|
|
50
|
+
readonly velocities?: (() => Readonly<Record<string, number>>) | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Whether reduced motion applies to it now: its nearest `WardicConfig`'s, else the
|
|
53
|
+
* provider's, read as its exit starts. Optional: left out, the presence's.
|
|
54
|
+
*/
|
|
55
|
+
readonly reducedMotion?: (() => boolean) | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Whether its animations are skipped now: its nearest `WardicConfig`'s, read as its exit
|
|
58
|
+
* starts. Optional: left out, never.
|
|
59
|
+
*/
|
|
60
|
+
readonly skipAnimations?: (() => boolean) | undefined;
|
|
61
|
+
}
|
|
62
|
+
/** Where a Wardic element starts when its child takes over from a leaver (#286, ADR-0048): the values and velocities it's drawn at. */
|
|
63
|
+
export interface PresenceSeed {
|
|
64
|
+
readonly values: Values.Values;
|
|
65
|
+
readonly velocities: Readonly<Record<string, number>>;
|
|
66
|
+
/** Where the element it takes over from painted, in the Root frame: a layout node moves from there. */
|
|
67
|
+
readonly box?: Box.Box | undefined;
|
|
68
|
+
/** The crossfade factor a twin it takes over from had faded out to: its handover's fade goes on from there. */
|
|
69
|
+
readonly fade?: number | undefined;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A child's exit, resolved as it leaves (#277): its values, and the transition it runs on, whose
|
|
73
|
+
* orchestration its Variant children's exits take.
|
|
74
|
+
*/
|
|
75
|
+
export interface PresenceExit {
|
|
76
|
+
readonly values: Values.Values;
|
|
77
|
+
readonly transition: Config.WardicTransition | undefined;
|
|
78
|
+
/** The exit name it hands its Variant children (#290): its own `exit`, if a name or a list (#297), else the one it took. */
|
|
79
|
+
readonly name: Config.WardicVariantLabels | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* A list's exit by name (#297): each name's keys (those it's the last to set) on its own transition,
|
|
82
|
+
* else the element's, and its orchestration for its Variant children's keys of that name. Every
|
|
83
|
+
* name has one, keys or none. Left out for a single name or a values map: the whole exit is one.
|
|
84
|
+
*/
|
|
85
|
+
readonly groups?: ReadonlyArray<ExitGroup> | undefined;
|
|
86
|
+
/** Its Keyframes (#429): each such key's stops, its value in `values` their last. Left out with none. */
|
|
87
|
+
readonly keyframes?: Readonly<Record<string, Stops.Stops>> | undefined;
|
|
88
|
+
}
|
|
89
|
+
/** One name of a list's exit (#297): its keys, and the transition they and its orchestration run on. */
|
|
90
|
+
export interface ExitGroup {
|
|
91
|
+
readonly name: string;
|
|
92
|
+
readonly values: Values.Values;
|
|
93
|
+
readonly transition: Config.WardicTransition | undefined;
|
|
94
|
+
}
|
|
95
|
+
/** A record's place in the variant tree (#290, {@link PresenceRecord.tree}). */
|
|
96
|
+
export interface PresenceTree {
|
|
97
|
+
readonly joins: boolean;
|
|
98
|
+
readonly provides: boolean;
|
|
99
|
+
readonly twin: boolean;
|
|
100
|
+
}
|
|
101
|
+
/** The value a presence publishes to the spines below it. */
|
|
102
|
+
export interface PresenceContextValue<E extends Subject.Subject = Subject.Subject> {
|
|
103
|
+
/**
|
|
104
|
+
* Register a child's live record. Returns a disposer the registrant MAY call,
|
|
105
|
+
* but the child does NOT call it on its own cleanup — the presence
|
|
106
|
+
* removes the registration after the exit completes.
|
|
107
|
+
*/
|
|
108
|
+
readonly register: (rec: PresenceRecord<E>) => () => void;
|
|
109
|
+
/**
|
|
110
|
+
* Whether an element setting up now starts at its `animate`, with nothing animating at mount:
|
|
111
|
+
* `<AnimatePresence initial={false}>`, during its first render (Motion's
|
|
112
|
+
* `presenceContext.initial`). A child that enters later animates in. Optional: left out, never.
|
|
113
|
+
*/
|
|
114
|
+
readonly blocksInitial?: () => boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Whether an element setting up now is inside a child `mode="wait"` holds back: `undefined`
|
|
117
|
+
* when it isn't, and it starts now. Else `start` is called once the child is shown, and the
|
|
118
|
+
* call returned cancels that (the element gone first). Optional: left out, never.
|
|
119
|
+
*/
|
|
120
|
+
readonly hold?: (el: E, start: () => void) => (() => void) | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* A presence hook's registration: `usePresence`'s and `useIsPresent`'s.
|
|
123
|
+
* Optional: left out, nothing is watched.
|
|
124
|
+
*/
|
|
125
|
+
readonly watch?: (watch: PresenceWatch<E>) => void;
|
|
126
|
+
/** The presence's `custom`, reactive: `usePresenceData`'s. Left out, `undefined`. */
|
|
127
|
+
readonly data?: () => unknown;
|
|
128
|
+
/**
|
|
129
|
+
* A Wardic element made: its `key` and whether it's a twin, told as its element is
|
|
130
|
+
* made, before the presence decides what it shows (so `mode="wait"` doesn't hold a child
|
|
131
|
+
* back under its key), and before any of its child's wards mount (so the elements inside pair).
|
|
132
|
+
* Optional: left out, no child is keyed.
|
|
133
|
+
*/
|
|
134
|
+
readonly made?: (el: E, key: string | number | undefined, twin: boolean) => void;
|
|
135
|
+
/**
|
|
136
|
+
* Where an element mounting now starts, when its child takes over from a leaver: asked once,
|
|
137
|
+
* before its first Retarget. `undefined`: as it would. Optional: left out, never.
|
|
138
|
+
*/
|
|
139
|
+
readonly takeOverOf?: (el: E) => PresenceSeed | undefined;
|
|
140
|
+
}
|
|
141
|
+
/** Tell `presence` a Wardic element was made ({@link PresenceContextValue.made}): nothing without one. */
|
|
142
|
+
export declare const presenceMade: <E extends Subject.Subject>(presence: PresenceContextValue<E> | undefined, el: E, key: string | number | undefined, twin: boolean) => void;
|
|
143
|
+
/** Where `el` starts as it mounts, taking over from a leaver ({@link PresenceContextValue.takeOverOf}): `undefined` as it would. */
|
|
144
|
+
export declare const presenceSeedOf: <E extends Subject.Subject>(presence: PresenceContextValue<E> | undefined, el: E) => PresenceSeed | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* What a presence hook registers (#277's PR 5b, ADR-0048): its element, whose leaving child it
|
|
147
|
+
* belongs to, and what it's told. Kept until that child goes, the presence goes, or its element
|
|
148
|
+
* goes some other way.
|
|
149
|
+
*/
|
|
150
|
+
export interface PresenceWatch<E extends Subject.Subject = Subject.Subject> {
|
|
151
|
+
/** Its element, once it has one: the child that holds it is the one it belongs to. */
|
|
152
|
+
readonly element: () => E | undefined;
|
|
153
|
+
/** Whether it holds its child as it leaves, until `release` is called (`usePresence`). */
|
|
154
|
+
readonly holds: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Its child left: called once, with the node back in place (or popped, `mode="popLayout"`), with
|
|
157
|
+
* the presence's `custom`, and `release`, which lets the child go once it holds it. `release(false)`
|
|
158
|
+
* cuts the child's exit short: it goes at once, uncompleted, as a child taken over does (#286).
|
|
159
|
+
*/
|
|
160
|
+
readonly leave: (custom: unknown, release: (completed?: boolean) => void) => void;
|
|
161
|
+
/** Its child went some other way, or the presence did: it's dropped, with no leave. */
|
|
162
|
+
readonly gone: () => void;
|
|
163
|
+
/**
|
|
164
|
+
* Its child's exit, once it was told it left, was cut short: the child is gone, uncompleted (a
|
|
165
|
+
* take-over, the presence going). Optional: left out, it isn't told.
|
|
166
|
+
*/
|
|
167
|
+
readonly interrupted?: () => void;
|
|
168
|
+
}
|
|
169
|
+
/** Whether `presence` holds an element setting up now at its `animate` ({@link PresenceContextValue.blocksInitial}). */
|
|
170
|
+
export declare const presenceBlocksInitial: <E extends Subject.Subject>(presence: PresenceContextValue<E> | undefined) => boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Whether `el` waits for its child to be shown ({@link PresenceContextValue.hold}): the call
|
|
173
|
+
* that cancels `start`, or `undefined` when it starts now.
|
|
174
|
+
*/
|
|
175
|
+
export declare const presenceHold: <E extends Subject.Subject>(presence: PresenceContextValue<E> | undefined, el: E, start: () => void) => (() => void) | undefined;
|
|
176
|
+
//# sourceMappingURL=PresenceRecord.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PresenceRecord.d.ts","sourceRoot":"","sources":["../../src/unstable/PresenceRecord.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,KAAK,GAAG,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,KAAK,OAAO,MAAM,cAAc,CAAA;AAC5C,OAAO,K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AE,MAAM,CAAC,GAAG,SAAS,CAAA;IACrC,0FAA0F;IAC1F,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAA;IACjF,uFAAuF;IACvF,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAA;IACzB;;;OAGG;IAEH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;CAClC;AAED,wHAAwH;AACxH,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,OAAO,CAAC,OAAO,YAAY,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,KAAG,OAI7G,CAAA;AAEJ;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,OAAO,CAAC,OAAO,YAAY,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,MAAM,CAAC,SAAS,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAC3D,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { constFalse } from "effect/Function";
|
|
2
|
+
import * as Predicate from "effect/Predicate";
|
|
3
|
+
import * as UndefinedOr from "effect/UndefinedOr";
|
|
4
|
+
/** Tell `presence` a Wardic element was made ({@link PresenceContextValue.made}): nothing without one. */
|
|
5
|
+
export const presenceMade = (presence, el, key, twin) => {
|
|
6
|
+
if (Predicate.isUndefined(presence))
|
|
7
|
+
return;
|
|
8
|
+
UndefinedOr.map(presence.made, (tell) => tell(el, key, twin));
|
|
9
|
+
};
|
|
10
|
+
/** Where `el` starts as it mounts, taking over from a leaver ({@link PresenceContextValue.takeOverOf}): `undefined` as it would. */
|
|
11
|
+
export const presenceSeedOf = (presence, el) => {
|
|
12
|
+
if (Predicate.isUndefined(presence))
|
|
13
|
+
return undefined;
|
|
14
|
+
return UndefinedOr.map(presence.takeOverOf, (of) => of(el));
|
|
15
|
+
};
|
|
16
|
+
/** Whether `presence` holds an element setting up now at its `animate` ({@link PresenceContextValue.blocksInitial}). */
|
|
17
|
+
export const presenceBlocksInitial = (presence) => UndefinedOr.match(presence, {
|
|
18
|
+
onUndefined: constFalse,
|
|
19
|
+
onDefined: (p) => UndefinedOr.match(p.blocksInitial, { onUndefined: constFalse, onDefined: (blocks) => blocks() }),
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Whether `el` waits for its child to be shown ({@link PresenceContextValue.hold}): the call
|
|
23
|
+
* that cancels `start`, or `undefined` when it starts now.
|
|
24
|
+
*/
|
|
25
|
+
export const presenceHold = (presence, el, start) => UndefinedOr.map(presence, (p) => UndefinedOr.map(p.hold, (hold) => hold(el, start)));
|
|
26
|
+
//# sourceMappingURL=PresenceRecord.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PresenceRecord.js","sourceRoot":"","sources":["../../src/unstable/PresenceRecord.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AAqIjD,0GAA0G;AAC1G,MAAM,CAAC,MAAM,YAAY,GAAG,CAA4B,QAA6C,EAAE,EAAK,EAAE,GAAgC,EAAE,IAAa,EAAQ,EAAE;IACrK,IAAI,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC;QAAE,OAAM;IAC3C,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;AAC/D,CAAC,CAAA;AAED,oIAAoI;AACpI,MAAM,CAAC,MAAM,cAAc,GAAG,CAA4B,QAA6C,EAAE,EAAK,EAA4B,EAAE;IAC1I,IAAI,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC;QAAE,OAAO,SAAS,CAAA;IACrD,OAAO,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;AAC7D,CAAC,CAAA;AA4BD,wHAAwH;AACxH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAA4B,QAA6C,EAAW,EAAE,CACzH,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE;IAC1B,WAAW,EAAE,UAAU;IACvB,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC;CACnH,CAAC,CAAA;AAEJ;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAA4B,QAA6C,EAAE,EAAK,EAAE,KAAiB,EAA4B,EAAE,CAC3J,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The few reactive primitives the binding-free modules take from a binding (#209): each binding gives
|
|
3
|
+
* its own, over its framework's graph or, with none, over the latest config it received. A module that
|
|
4
|
+
* takes one never imports a framework, so every binding runs the same code.
|
|
5
|
+
*
|
|
6
|
+
* Unstable, for Wardic's own packages: public, with no semver promise.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
/** A value read through a function: a signal, a memo, a getter. */
|
|
11
|
+
export type Accessor<A> = () => A;
|
|
12
|
+
/** A change notice: the computation that calls `track` re-runs on each `notify`. */
|
|
13
|
+
export interface Trigger {
|
|
14
|
+
readonly track: () => void;
|
|
15
|
+
readonly notify: () => void;
|
|
16
|
+
}
|
|
17
|
+
/** A binding's reactive primitives, as the binding-free modules use them. */
|
|
18
|
+
export interface Reactivity {
|
|
19
|
+
/** Runs `fn` without tracking what it reads. */
|
|
20
|
+
readonly untrack: <A>(fn: () => A) => A;
|
|
21
|
+
/** A {@link Trigger}, made under the current owner. Its `notify` may be called from anywhere. */
|
|
22
|
+
readonly trigger: () => Trigger;
|
|
23
|
+
/**
|
|
24
|
+
* Calls `onChange` with each later value of `accessor`, not its first, until the returned stop.
|
|
25
|
+
* In a root of its own, which no owner disposes.
|
|
26
|
+
*/
|
|
27
|
+
readonly watch: <A>(accessor: Accessor<A>, onChange: (value: A) => void) => () => void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=Reactivity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Reactivity.d.ts","sourceRoot":"","sources":["../../src/unstable/Reactivity.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,mEAAmE;AACnE,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,CAAA;AAEjC,oFAAoF;AACpF,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAA;CAC5B;AAED,6EAA6E;AAC7E,MAAM,WAAW,UAAU;IACzB,gDAAgD;IAChD,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;IACvC,iGAAiG;IACjG,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAA;IAC/B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,KAAK,MAAM,IAAI,CAAA;CACvF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The few reactive primitives the binding-free modules take from a binding (#209): each binding gives
|
|
3
|
+
* its own, over its framework's graph or, with none, over the latest config it received. A module that
|
|
4
|
+
* takes one never imports a framework, so every binding runs the same code.
|
|
5
|
+
*
|
|
6
|
+
* Unstable, for Wardic's own packages: public, with no semver promise.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
// Unstable: ADR-0071, decision 5. #672: solid's `reactivity.ts`, moved for the spine and its
|
|
11
|
+
// neighbours to take from core. Solid 1's and Solid 2's implementations stay in solid
|
|
12
|
+
// (`solid-reactivity.ts`, `unstable/v2/solid-reactivity.ts`); Foldkit's is getters over the latest
|
|
13
|
+
// delivery, with watches re-checked once a patch (ADR-0071, decision 17).
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=Reactivity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Reactivity.js","sourceRoot":"","sources":["../../src/unstable/Reactivity.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,6FAA6F;AAC7F,sFAAsF;AACtF,mGAAmG;AACnG,0EAA0E"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as Cause from "effect/Cause";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
/**
|
|
4
|
+
* `cause` logged at Error as `message`, with the cause, and handed to the Environment's
|
|
5
|
+
* `ErrorReporter`s. An interruption is neither: it's how a run is removed, by a retarget, an unmount or a
|
|
6
|
+
* dispose. Annotate the log by piping `Effect.annotateLogs` onto it.
|
|
7
|
+
*/
|
|
8
|
+
export declare const failure: (message: string, cause: Cause.Cause<unknown>) => Effect.Effect<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Whether a Debug log would be kept, as Effect's `MinimumLogLevel` says. Run it once (a runtime, a
|
|
11
|
+
* build) and keep the answer, not once a log.
|
|
12
|
+
*/
|
|
13
|
+
export declare const debugKept: Effect.Effect<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* A lifecycle debug log for `scope` (`wardic.projection`, say): `log(event, annotations?)` logs
|
|
16
|
+
* `scope: event` at Debug, forked on `runner`, with the annotations. Whether a Debug log would be kept
|
|
17
|
+
* is read once, here ({@link debugKept}): when it wouldn't, `on` is `false` and `log` returns at once,
|
|
18
|
+
* forking nothing. A site that builds its annotations per element checks `on` first.
|
|
19
|
+
*/
|
|
20
|
+
export declare const debugOf: (runner: {
|
|
21
|
+
readonly runSync: <A>(effect: Effect.Effect<A>) => A;
|
|
22
|
+
readonly runFork: <A>(effect: Effect.Effect<A>) => unknown;
|
|
23
|
+
}, scope: string) => DebugLog;
|
|
24
|
+
/** {@link debugOf}'s log: called with an event and its annotations, and `on` when a Debug log is kept. */
|
|
25
|
+
export interface DebugLog {
|
|
26
|
+
(event: string, annotations?: Record<string, unknown>): void;
|
|
27
|
+
/** Whether a Debug log would be kept: when it's `false`, a call logs nothing. */
|
|
28
|
+
readonly on: boolean;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=Report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Report.d.ts","sourceRoot":"","sources":["../../src/unstable/Report.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAMvC;;;;GAIG;AACH,eAAO,MAAM,OAAO,YAAa,MAAM,SAAS,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAIrF,CAAA;AAEJ;;;GAGG;AAEH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAqH,CAAA;AAElK;;;;;GAKG;AAGH,eAAO,MAAM,OAAO,WAAY;IAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,CAAA;CAAE,SAAS,MAAM,KAAG,QAYrK,CAAA;AAED,0GAA0G;AAC1G,MAAM,WAAW,QAAQ;IACvB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAC5D,iFAAiF;IACjF,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAA;CACrB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a binding's failure stops: `failure` logs it at Error and reports it to the Environment's
|
|
3
|
+
* `ErrorReporter`s. Core's engine doesn't report: the Frame loop hands each run's failure to its
|
|
4
|
+
* caller, and a Tier 2 caller may recover. A binding boundary that ends a fiber nobody observes calls
|
|
5
|
+
* this, so a failure there reaches the console and an app's reporters instead of stopping its feature
|
|
6
|
+
* with nothing said.
|
|
7
|
+
*
|
|
8
|
+
* An app installs its reporters on the Environment it hands the provider,
|
|
9
|
+
* `ErrorReporter.layer([…])` merged into `env`; Wardic ships none. With none installed, a report
|
|
10
|
+
* is one `getRef` and a size check, on the failure path only. A reporter built with
|
|
11
|
+
* `ErrorReporter.make` dedupes a cause and its original error, so a failure that crosses two
|
|
12
|
+
* boundaries reports once: pass the cause on as it came, never wrapped.
|
|
13
|
+
*
|
|
14
|
+
* Unstable, for Wardic's own packages: public, with no semver promise. Binding authors import
|
|
15
|
+
* `@wardic/dom/Report`, which re-exports it.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
// ADR-0030, decision 4 (the Frame loop's hand-off: ADR-0027, decision 7). Unstable: ADR-0071,
|
|
20
|
+
// decision 5. #672 (ADR-0030, *Amendment (#672)*): moved from dom's `internal/report.ts`, so the spine
|
|
21
|
+
// reports from core once it's lifted there.
|
|
22
|
+
import * as Bool from "effect/Boolean";
|
|
23
|
+
import * as Cause from "effect/Cause";
|
|
24
|
+
import * as Effect from "effect/Effect";
|
|
25
|
+
import * as ErrorReporter from "effect/ErrorReporter";
|
|
26
|
+
import * as LogLevel from "effect/LogLevel";
|
|
27
|
+
import * as Predicate from "effect/Predicate";
|
|
28
|
+
import * as References from "effect/References";
|
|
29
|
+
/**
|
|
30
|
+
* `cause` logged at Error as `message`, with the cause, and handed to the Environment's
|
|
31
|
+
* `ErrorReporter`s. An interruption is neither: it's how a run is removed, by a retarget, an unmount or a
|
|
32
|
+
* dispose. Annotate the log by piping `Effect.annotateLogs` onto it.
|
|
33
|
+
*/
|
|
34
|
+
export const failure = (message, cause) => Bool.match(Cause.hasInterruptsOnly(cause), {
|
|
35
|
+
onTrue: () => Effect.void,
|
|
36
|
+
onFalse: () => Effect.logError(message, cause).pipe(Effect.andThen(ErrorReporter.report(cause))),
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Whether a Debug log would be kept, as Effect's `MinimumLogLevel` says. Run it once (a runtime, a
|
|
40
|
+
* build) and keep the answer, not once a log.
|
|
41
|
+
*/
|
|
42
|
+
// #618: the spine reads it alone, so an app that logs nothing else doesn't ship debugOf's log.
|
|
43
|
+
export const debugKept = /*#__PURE__*/ Effect.map(References.MinimumLogLevel, (level) => Bool.not(LogLevel.isGreaterThan(level, "Debug")));
|
|
44
|
+
/**
|
|
45
|
+
* A lifecycle debug log for `scope` (`wardic.projection`, say): `log(event, annotations?)` logs
|
|
46
|
+
* `scope: event` at Debug, forked on `runner`, with the annotations. Whether a Debug log would be kept
|
|
47
|
+
* is read once, here ({@link debugKept}): when it wouldn't, `on` is `false` and `log` returns at once,
|
|
48
|
+
* forking nothing. A site that builds its annotations per element checks `on` first.
|
|
49
|
+
*/
|
|
50
|
+
// #618 (M4): each call forked a fiber whatever the level, 0.3-0.5 µs to log nothing (one per layout
|
|
51
|
+
// node's mount and unmount); core's Frame loop reads the level once as this does (frameLoop.ts).
|
|
52
|
+
export const debugOf = (runner, scope) => {
|
|
53
|
+
const on = runner.runSync(debugKept);
|
|
54
|
+
const log = (event, annotations) => {
|
|
55
|
+
if (!on)
|
|
56
|
+
return;
|
|
57
|
+
const logged = Effect.logDebug(`${scope}: ${event}`);
|
|
58
|
+
if (Predicate.isUndefined(annotations)) {
|
|
59
|
+
runner.runFork(logged);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
runner.runFork(Effect.annotateLogs(logged, annotations));
|
|
63
|
+
};
|
|
64
|
+
return Object.assign(log, { on });
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=Report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Report.js","sourceRoot":"","sources":["../../src/unstable/Report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,8FAA8F;AAC9F,uGAAuG;AACvG,4CAA4C;AAC5C,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAe,EAAE,KAA2B,EAAuB,EAAE,CAC3F,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAA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