@wardic/dom 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/Appear.d.ts +3 -2
- package/dist/Appear.d.ts.map +1 -1
- package/dist/Appear.js +4 -3
- package/dist/Appear.js.map +1 -1
- package/dist/DomProjectionSystem.js +3 -3
- package/dist/DomProjectionSystem.js.map +1 -1
- package/dist/FlushGate.d.ts +6 -6
- package/dist/FlushGate.d.ts.map +1 -1
- package/dist/FlushGate.js +11 -8
- package/dist/FlushGate.js.map +1 -1
- package/dist/ReorderController.js +3 -3
- package/dist/ReorderController.js.map +1 -1
- package/dist/Report.d.ts +1 -1
- package/dist/Report.d.ts.map +1 -1
- package/dist/Report.js +3 -2
- package/dist/Report.js.map +1 -1
- package/dist/Style.d.ts +2 -1
- package/dist/Style.d.ts.map +1 -1
- package/dist/Style.js +3 -1
- package/dist/Style.js.map +1 -1
- package/dist/TimelineValue.d.ts +18 -0
- package/dist/TimelineValue.d.ts.map +1 -0
- package/dist/TimelineValue.js +20 -0
- package/dist/TimelineValue.js.map +1 -0
- package/dist/index.d.ts +13 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/appear.d.ts +10 -4
- package/dist/internal/appear.d.ts.map +1 -1
- package/dist/internal/appear.js +18 -8
- package/dist/internal/appear.js.map +1 -1
- package/dist/internal/batch-handoff.d.ts +25 -0
- package/dist/internal/batch-handoff.d.ts.map +1 -0
- package/dist/internal/batch-handoff.js +64 -0
- package/dist/internal/batch-handoff.js.map +1 -0
- package/dist/internal/drag-defaults.js +4 -1
- package/dist/internal/drag-defaults.js.map +1 -1
- package/dist/internal/gate-environment.d.ts +4 -0
- package/dist/internal/gate-environment.d.ts.map +1 -0
- package/dist/internal/gate-environment.js +21 -0
- package/dist/internal/gate-environment.js.map +1 -0
- package/dist/internal/projection.d.ts.map +1 -1
- package/dist/internal/projection.js +22 -21
- package/dist/internal/projection.js.map +1 -1
- package/dist/internal/renderer.d.ts +13 -0
- package/dist/internal/renderer.d.ts.map +1 -1
- package/dist/internal/renderer.js +21 -0
- package/dist/internal/renderer.js.map +1 -1
- package/dist/internal/reorder.d.ts +2 -2
- package/dist/internal/reorder.d.ts.map +1 -1
- package/dist/internal/reorder.js +2 -2
- package/dist/internal/reorder.js.map +1 -1
- package/dist/internal/scroll.d.ts +17 -0
- package/dist/internal/scroll.d.ts.map +1 -1
- package/dist/internal/scroll.js +23 -15
- package/dist/internal/scroll.js.map +1 -1
- package/dist/internal/starting-style.d.ts +0 -83
- package/dist/internal/starting-style.d.ts.map +1 -1
- package/dist/internal/starting-style.js +16 -143
- package/dist/internal/starting-style.js.map +1 -1
- package/dist/internal/timeline.d.ts +56 -0
- package/dist/internal/timeline.d.ts.map +1 -0
- package/dist/internal/timeline.js +389 -0
- package/dist/internal/timeline.js.map +1 -0
- package/dist/unstable/AppearAnimations.d.ts +191 -0
- package/dist/unstable/AppearAnimations.d.ts.map +1 -0
- package/dist/unstable/AppearAnimations.js +561 -0
- package/dist/unstable/AppearAnimations.js.map +1 -0
- package/dist/unstable/BatchMembers.d.ts +513 -0
- package/dist/unstable/BatchMembers.d.ts.map +1 -0
- package/dist/unstable/BatchMembers.js +2490 -0
- package/dist/unstable/BatchMembers.js.map +1 -0
- package/dist/unstable/DomValues.d.ts +25 -0
- package/dist/unstable/DomValues.d.ts.map +1 -0
- package/dist/unstable/DomValues.js +45 -0
- package/dist/unstable/DomValues.js.map +1 -0
- package/dist/unstable/DragConstraints.d.ts +48 -0
- package/dist/unstable/DragConstraints.d.ts.map +1 -0
- package/dist/unstable/DragConstraints.js +49 -0
- package/dist/unstable/DragConstraints.js.map +1 -0
- package/dist/unstable/DragControls.d.ts +50 -0
- package/dist/unstable/DragControls.d.ts.map +1 -0
- package/dist/unstable/DragControls.js +55 -0
- package/dist/unstable/DragControls.js.map +1 -0
- package/dist/unstable/DragDefaults.d.ts +34 -0
- package/dist/unstable/DragDefaults.d.ts.map +1 -0
- package/dist/unstable/DragDefaults.js +47 -0
- package/dist/unstable/DragDefaults.js.map +1 -0
- package/dist/unstable/DragTrack.d.ts +236 -0
- package/dist/unstable/DragTrack.d.ts.map +1 -0
- package/dist/unstable/DragTrack.js +646 -0
- package/dist/unstable/DragTrack.js.map +1 -0
- package/dist/unstable/DragTransition.d.ts +22 -0
- package/dist/unstable/DragTransition.d.ts.map +1 -0
- package/dist/unstable/DragTransition.js +31 -0
- package/dist/unstable/DragTransition.js.map +1 -0
- package/dist/unstable/ElementSetup.d.ts +144 -0
- package/dist/unstable/ElementSetup.d.ts.map +1 -0
- package/dist/unstable/ElementSetup.js +297 -0
- package/dist/unstable/ElementSetup.js.map +1 -0
- package/dist/unstable/Feature.d.ts +221 -0
- package/dist/unstable/Feature.d.ts.map +1 -0
- package/dist/unstable/Feature.js +281 -0
- package/dist/unstable/Feature.js.map +1 -0
- package/dist/unstable/GestureFeatures.d.ts +30 -0
- package/dist/unstable/GestureFeatures.d.ts.map +1 -0
- package/dist/unstable/GestureFeatures.js +32 -0
- package/dist/unstable/GestureFeatures.js.map +1 -0
- package/dist/unstable/GestureInfo.d.ts +61 -0
- package/dist/unstable/GestureInfo.d.ts.map +1 -0
- package/dist/unstable/GestureInfo.js +23 -0
- package/dist/unstable/GestureInfo.js.map +1 -0
- package/dist/unstable/Imperative.d.ts +214 -0
- package/dist/unstable/Imperative.d.ts.map +1 -0
- package/dist/unstable/Imperative.js +768 -0
- package/dist/unstable/Imperative.js.map +1 -0
- package/dist/unstable/Instant.d.ts +46 -0
- package/dist/unstable/Instant.d.ts.map +1 -0
- package/dist/unstable/Instant.js +49 -0
- package/dist/unstable/Instant.js.map +1 -0
- package/dist/unstable/LayoutGroup.d.ts +14 -0
- package/dist/unstable/LayoutGroup.d.ts.map +1 -0
- package/dist/unstable/LayoutGroup.js +31 -0
- package/dist/unstable/LayoutGroup.js.map +1 -0
- package/dist/unstable/LayoutMember.d.ts +127 -0
- package/dist/unstable/LayoutMember.d.ts.map +1 -0
- package/dist/unstable/LayoutMember.js +176 -0
- package/dist/unstable/LayoutMember.js.map +1 -0
- package/dist/unstable/LiveStyle.d.ts +171 -0
- package/dist/unstable/LiveStyle.d.ts.map +1 -0
- package/dist/unstable/LiveStyle.js +329 -0
- package/dist/unstable/LiveStyle.js.map +1 -0
- package/dist/unstable/MemberHold.d.ts +3 -0
- package/dist/unstable/MemberHold.d.ts.map +1 -0
- package/dist/unstable/MemberHold.js +223 -0
- package/dist/unstable/MemberHold.js.map +1 -0
- package/dist/unstable/OwnerScope.d.ts +16 -0
- package/dist/unstable/OwnerScope.d.ts.map +1 -0
- package/dist/unstable/OwnerScope.js +35 -0
- package/dist/unstable/OwnerScope.js.map +1 -0
- package/dist/unstable/PresenceController.d.ts +128 -0
- package/dist/unstable/PresenceController.d.ts.map +1 -0
- package/dist/unstable/PresenceController.js +1427 -0
- package/dist/unstable/PresenceController.js.map +1 -0
- package/dist/unstable/Press.d.ts +26 -0
- package/dist/unstable/Press.d.ts.map +1 -0
- package/dist/unstable/Press.js +19 -0
- package/dist/unstable/Press.js.map +1 -0
- package/dist/unstable/ServerInterpolators.d.ts +17 -0
- package/dist/unstable/ServerInterpolators.d.ts.map +1 -0
- package/dist/unstable/ServerInterpolators.js +20 -0
- package/dist/unstable/ServerInterpolators.js.map +1 -0
- package/dist/unstable/WardConfig.d.ts +567 -0
- package/dist/unstable/WardConfig.d.ts.map +1 -0
- package/dist/unstable/WardConfig.js +2 -0
- package/dist/unstable/WardConfig.js.map +1 -0
- package/dist/unstable/features/All.d.ts +24 -0
- package/dist/unstable/features/All.d.ts.map +1 -0
- package/dist/unstable/features/All.js +20 -0
- package/dist/unstable/features/All.js.map +1 -0
- package/dist/unstable/features/Colors.d.ts +12 -0
- package/dist/unstable/features/Colors.d.ts.map +1 -0
- package/dist/unstable/features/Colors.js +38 -0
- package/dist/unstable/features/Colors.js.map +1 -0
- package/dist/unstable/features/DomAnimation.d.ts +16 -0
- package/dist/unstable/features/DomAnimation.d.ts.map +1 -0
- package/dist/unstable/features/DomAnimation.js +19 -0
- package/dist/unstable/features/DomAnimation.js.map +1 -0
- package/dist/unstable/features/DomMax.d.ts +12 -0
- package/dist/unstable/features/DomMax.d.ts.map +1 -0
- package/dist/unstable/features/DomMax.js +14 -0
- package/dist/unstable/features/DomMax.js.map +1 -0
- package/dist/unstable/features/Drag.d.ts +5 -0
- package/dist/unstable/features/Drag.d.ts.map +1 -0
- package/dist/unstable/features/Drag.js +32 -0
- package/dist/unstable/features/Drag.js.map +1 -0
- package/dist/unstable/features/Focus.d.ts +5 -0
- package/dist/unstable/features/Focus.d.ts.map +1 -0
- package/dist/unstable/features/Focus.js +20 -0
- package/dist/unstable/features/Focus.js.map +1 -0
- package/dist/unstable/features/Hover.d.ts +5 -0
- package/dist/unstable/features/Hover.d.ts.map +1 -0
- package/dist/unstable/features/Hover.js +20 -0
- package/dist/unstable/features/Hover.js.map +1 -0
- package/dist/unstable/features/InView.d.ts +5 -0
- package/dist/unstable/features/InView.d.ts.map +1 -0
- package/dist/unstable/features/InView.js +20 -0
- package/dist/unstable/features/InView.js.map +1 -0
- package/dist/unstable/features/Input.d.ts +28 -0
- package/dist/unstable/features/Input.d.ts.map +1 -0
- package/dist/unstable/features/Input.js +31 -0
- package/dist/unstable/features/Input.js.map +1 -0
- package/dist/unstable/features/Keys.d.ts +95 -0
- package/dist/unstable/features/Keys.d.ts.map +1 -0
- package/dist/unstable/features/Keys.js +44 -0
- package/dist/unstable/features/Keys.js.map +1 -0
- package/dist/unstable/features/Layout.d.ts +43 -0
- package/dist/unstable/features/Layout.d.ts.map +1 -0
- package/dist/unstable/features/Layout.js +44 -0
- package/dist/unstable/features/Layout.js.map +1 -0
- package/dist/unstable/features/Pan.d.ts +5 -0
- package/dist/unstable/features/Pan.d.ts.map +1 -0
- package/dist/unstable/features/Pan.js +20 -0
- package/dist/unstable/features/Pan.js.map +1 -0
- package/dist/unstable/features/Press.d.ts +13 -0
- package/dist/unstable/features/Press.d.ts.map +1 -0
- package/dist/unstable/features/Press.js +10 -0
- package/dist/unstable/features/Press.js.map +1 -0
- package/dist/unstable/features/Scroll.d.ts +20 -0
- package/dist/unstable/features/Scroll.d.ts.map +1 -0
- package/dist/unstable/features/Scroll.js +34 -0
- package/dist/unstable/features/Scroll.js.map +1 -0
- package/dist/unstable/features/TimelineKeys.d.ts +7 -0
- package/dist/unstable/features/TimelineKeys.d.ts.map +1 -0
- package/dist/unstable/features/TimelineKeys.js +103 -0
- package/dist/unstable/features/TimelineKeys.js.map +1 -0
- package/package.json +4 -3
- package/src/Appear.ts +4 -2
- package/src/DomProjectionSystem.ts +3 -3
- package/src/FlushGate.ts +15 -12
- package/src/ReorderController.ts +3 -3
- package/src/Report.ts +3 -7
- package/src/Style.ts +4 -1
- package/src/TimelineValue.ts +19 -0
- package/src/index.ts +15 -5
- package/src/internal/appear.ts +20 -8
- package/src/internal/batch-handoff.ts +75 -0
- package/src/internal/drag-defaults.ts +4 -4
- package/src/internal/gate-environment.ts +21 -0
- package/src/internal/projection.ts +22 -21
- package/src/internal/renderer.ts +22 -0
- package/src/internal/reorder.ts +4 -4
- package/src/internal/scroll.ts +32 -15
- package/src/internal/starting-style.ts +5 -204
- package/src/internal/timeline.ts +480 -0
- package/src/unstable/AppearAnimations.ts +837 -0
- package/src/unstable/BatchMembers.ts +3085 -0
- package/src/unstable/DomValues.ts +53 -0
- package/src/unstable/DragConstraints.ts +107 -0
- package/src/unstable/DragControls.ts +98 -0
- package/src/unstable/DragDefaults.ts +57 -0
- package/src/unstable/DragTrack.ts +959 -0
- package/src/unstable/DragTransition.ts +46 -0
- package/src/unstable/ElementSetup.ts +411 -0
- package/src/unstable/Feature.ts +494 -0
- package/src/unstable/GestureFeatures.ts +38 -0
- package/src/unstable/GestureInfo.ts +85 -0
- package/src/unstable/Imperative.ts +1037 -0
- package/src/unstable/Instant.ts +93 -0
- package/src/unstable/LayoutGroup.ts +36 -0
- package/src/unstable/LayoutMember.ts +319 -0
- package/src/unstable/LiveStyle.ts +497 -0
- package/src/unstable/MemberHold.ts +211 -0
- package/src/unstable/OwnerScope.ts +35 -0
- package/src/unstable/PresenceController.ts +1747 -0
- package/src/unstable/Press.ts +43 -0
- package/src/unstable/ServerInterpolators.ts +39 -0
- package/src/unstable/WardConfig.ts +704 -0
- package/src/unstable/features/All.ts +39 -0
- package/src/unstable/features/Colors.ts +40 -0
- package/src/unstable/features/DomAnimation.ts +19 -0
- package/src/unstable/features/DomMax.ts +14 -0
- package/src/unstable/features/Drag.ts +34 -0
- package/src/unstable/features/Focus.ts +21 -0
- package/src/unstable/features/Hover.ts +21 -0
- package/src/unstable/features/InView.ts +21 -0
- package/src/unstable/features/Input.ts +37 -0
- package/src/unstable/features/Keys.ts +124 -0
- package/src/unstable/features/Layout.ts +75 -0
- package/src/unstable/features/Pan.ts +21 -0
- package/src/unstable/features/Press.ts +21 -0
- package/src/unstable/features/Scroll.ts +35 -0
- package/src/unstable/features/TimelineKeys.ts +115 -0
- package/dist/internal/gate.d.ts +0 -188
- package/dist/internal/gate.d.ts.map +0 -1
- package/dist/internal/gate.js +0 -458
- package/dist/internal/gate.js.map +0 -1
- package/dist/internal/report.d.ts +0 -30
- package/dist/internal/report.d.ts.map +0 -1
- package/dist/internal/report.js +0 -60
- package/dist/internal/report.js.map +0 -1
- package/dist/internal/runner.d.ts +0 -21
- package/dist/internal/runner.d.ts.map +0 -1
- package/dist/internal/runner.js +0 -48
- package/dist/internal/runner.js.map +0 -1
- package/src/internal/gate.ts +0 -598
- package/src/internal/report.ts +0 -69
- package/src/internal/runner.ts +0 -64
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An element's drag transition (ADR-0016, *Amendment (#140)*), for every binding: what every release
|
|
3
|
+
* runs on, a Fling, a snap back to the origin, and a layout node's Release offset.
|
|
4
|
+
*
|
|
5
|
+
* Unstable, for Wardic's own packages: public, with no semver promise.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
// Unstable: ADR-0071, decision 5. #672: solid's `drag-transition.ts`, moved to dom with the drag track.
|
|
10
|
+
import type * as ProjectionSystem from "../ProjectionSystem.ts"
|
|
11
|
+
import * as Bool from "effect/Boolean"
|
|
12
|
+
import { identity } from "effect/Function"
|
|
13
|
+
import * as UndefinedOr from "effect/UndefinedOr"
|
|
14
|
+
import type * as WardConfig from "./WardConfig.ts"
|
|
15
|
+
|
|
16
|
+
/** Motion's `dragElastic` default (`defaultElastic`, ADR-0016 *Amendment (#140)*). */
|
|
17
|
+
export const DEFAULT_DRAG_ELASTIC = 0.35
|
|
18
|
+
|
|
19
|
+
/** A drag's `dragElastic`, or Motion's default. */
|
|
20
|
+
export const elasticOf = (elastic: number | undefined): number =>
|
|
21
|
+
UndefinedOr.match(elastic, { onUndefined: () => DEFAULT_DRAG_ELASTIC, onDefined: identity })
|
|
22
|
+
|
|
23
|
+
/** Motion's release (`startAnimation`), in seconds: a 0.75 s time constant, power 0.8, at rest within 1 px and 10 px/s. */
|
|
24
|
+
const MOTION_RELEASE = { power: 0.8, timeConstant: 0.75, restDelta: 1, restSpeed: 10 } as const
|
|
25
|
+
/** The bounce with an elastic drag, Motion's `dragElastic ? 200 : …`. */
|
|
26
|
+
const ELASTIC_BOUNCE = { bounceStiffness: 200, bounceDamping: 40 } as const
|
|
27
|
+
/** The bounce with none, a wall: Motion's `… : 1000000` and `10000000`. */
|
|
28
|
+
const RIGID_BOUNCE = { bounceStiffness: 1e6, bounceDamping: 1e7 } as const
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* An element's drag transition, resolved (ADR-0016, *Amendment (#140)*): Motion's release, its bounce
|
|
32
|
+
* from `dragElastic` (a wall with none), then the element's own `dragTransition` over it, its
|
|
33
|
+
* `timeConstant` from milliseconds to seconds. What every release runs on: a Fling, a snap back to the
|
|
34
|
+
* origin, and a projection node's Release offset.
|
|
35
|
+
*/
|
|
36
|
+
export const dragTransitionOf = (elastic: number | undefined, own: WardConfig.WardicDragTransition | undefined): ProjectionSystem.DragTransition => ({
|
|
37
|
+
...MOTION_RELEASE,
|
|
38
|
+
...Bool.match(elasticOf(elastic) !== 0, { onTrue: () => ELASTIC_BOUNCE, onFalse: () => RIGID_BOUNCE }),
|
|
39
|
+
...UndefinedOr.match(own, {
|
|
40
|
+
onUndefined: () => ({}),
|
|
41
|
+
onDefined: ({ timeConstant, ...rest }) => ({
|
|
42
|
+
...rest,
|
|
43
|
+
...UndefinedOr.match(timeConstant, { onUndefined: () => ({}), onDefined: (ms) => ({ timeConstant: ms / 1000 }) }),
|
|
44
|
+
}),
|
|
45
|
+
}),
|
|
46
|
+
})
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What each DOM binding's element setup does around the spine (#672): the Base-value links an element
|
|
3
|
+
* starts from, its Transform template drawn, its Appear animation released at its first commit, a
|
|
4
|
+
* server's starting values and its Appear entry, a drag's will-change and its claim, and the logs of a
|
|
5
|
+
* dropped `transform` string and of a hydration's Starting style; and an Environment's value reads,
|
|
6
|
+
* the DOM's where it gives none. Every DOM binding's elements run them; they read the DOM, so the
|
|
7
|
+
* spine doesn't.
|
|
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-Q3, PR4-Q2): solid's `element-setup.ts`, out of `spine.ts`
|
|
14
|
+
// since PR 2, moved to dom for every DOM binding's elements, with the value reads its provider holds.
|
|
15
|
+
import * as BaseValue from "@wardic/core/BaseValue"
|
|
16
|
+
import * as Projection from "@wardic/core/Projection"
|
|
17
|
+
import type * as ReducedMotion from "@wardic/core/ReducedMotion"
|
|
18
|
+
import type * as Renderer from "@wardic/core/Renderer"
|
|
19
|
+
import type * as Values from "@wardic/core/Values"
|
|
20
|
+
import type * as MeasuredPairs from "@wardic/core/unstable/MeasuredPairs"
|
|
21
|
+
import type * as CoreOwnValues from "@wardic/core/unstable/OwnValues"
|
|
22
|
+
import type * as VariableValues from "@wardic/core/unstable/VariableValues"
|
|
23
|
+
import type * as WardicServices from "@wardic/core/unstable/WardicServices"
|
|
24
|
+
import type * as Reactivity from "@wardic/core/unstable/Reactivity"
|
|
25
|
+
import * as Appear from "../Appear.ts"
|
|
26
|
+
import * as DomRenderer from "../DomRenderer.ts"
|
|
27
|
+
import type * as FlushGate from "../FlushGate.ts"
|
|
28
|
+
import * as OwnValues from "../OwnValues.ts"
|
|
29
|
+
import * as Style from "../Style.ts"
|
|
30
|
+
import * as DomValues from "./DomValues.ts"
|
|
31
|
+
import * as Arr from "effect/Array"
|
|
32
|
+
import * as Bool from "effect/Boolean"
|
|
33
|
+
import * as Effect from "effect/Effect"
|
|
34
|
+
import { constUndefined, constVoid } from "effect/Function"
|
|
35
|
+
import * as Option from "effect/Option"
|
|
36
|
+
import * as Predicate from "effect/Predicate"
|
|
37
|
+
import * as Rec from "effect/Record"
|
|
38
|
+
import * as UndefinedOr from "effect/UndefinedOr"
|
|
39
|
+
import * as AppearAnimations from "./AppearAnimations.ts"
|
|
40
|
+
import * as AppearHandoff from "@wardic/core/unstable/AppearHandoff"
|
|
41
|
+
import type * as WardConfig from "./WardConfig.ts"
|
|
42
|
+
import * as LiveStyle from "./LiveStyle.ts"
|
|
43
|
+
import * as Spine from "@wardic/core/unstable/Spine"
|
|
44
|
+
import * as VariantTree from "@wardic/core/unstable/VariantTree"
|
|
45
|
+
import * as VariantTarget from "@wardic/core/unstable/VariantTarget"
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A mounted element's Base-value links (ADR-0022): a key with no value starts from its `style`
|
|
49
|
+
* value, else its Own value. The Own value is read from the element once per key, at first need
|
|
50
|
+
* (D3): after mount, so never on a server (ADR-0021). Each link is coerced to the shape of the
|
|
51
|
+
* key's target (`like`). `styleNow` reads the user's style untracked; a Live value in it is read now.
|
|
52
|
+
*/
|
|
53
|
+
export const startLinksOf = (element: HTMLElement, styleNow: (() => object | string | undefined) | undefined, live: LiveStyle.LiveStyle | undefined): Spine.StartLinks => {
|
|
54
|
+
const ownValue = OwnValues.of(element)
|
|
55
|
+
// A `style` value read now: a Live value's current value (#130), anything else as it is.
|
|
56
|
+
const readStyle = (raw: unknown): unknown => {
|
|
57
|
+
if (Predicate.isUndefined(live)) return raw
|
|
58
|
+
return live.read(raw)
|
|
59
|
+
}
|
|
60
|
+
const linksFor = (like: number | string) => ({
|
|
61
|
+
style: (key: string) =>
|
|
62
|
+
Option.flatMap(Option.fromUndefinedOr(styleNow), (now) =>
|
|
63
|
+
Option.flatMap(OwnValues.styleValueOf(now(), key), (raw) => OwnValues.valueLike(readStyle(raw), like)),
|
|
64
|
+
),
|
|
65
|
+
own: (key: string) => Option.flatMap(ownValue(key), (raw) => OwnValues.valueLike(raw, like)),
|
|
66
|
+
})
|
|
67
|
+
const startLinkOf = (key: string, like: number | string) => BaseValue.start(key, linksFor(like))
|
|
68
|
+
return { ownValue, linksFor, startLinkOf }
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* `sink`, removing the element's Appear animation in its first commit (#48, ADR-0044 decision 6):
|
|
73
|
+
* in the task that writes the engine's first frame, so no paint falls between. Without one, `sink`.
|
|
74
|
+
*/
|
|
75
|
+
export const releasingAppear = (sink: FlushGate.Sink, handoff: AppearHandoff.Handoff | undefined, element: HTMLElement): FlushGate.Sink => {
|
|
76
|
+
if (Predicate.isUndefined(handoff)) return sink
|
|
77
|
+
const before = sink.beforeFirstCommit
|
|
78
|
+
return {
|
|
79
|
+
...sink,
|
|
80
|
+
beforeFirstCommit: () => {
|
|
81
|
+
Appear.release(element)
|
|
82
|
+
if (Predicate.isNotUndefined(before)) before()
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Where `key` rests outside the gate (#130): its `initial`, else its `style` value (a Live value's
|
|
89
|
+
* now), else a transform key's identity, else `undefined`.
|
|
90
|
+
*/
|
|
91
|
+
export const restingOf = (key: string, initial: Values.Values, style: object | string | undefined, read: (value: unknown) => unknown): unknown =>
|
|
92
|
+
Option.getOrUndefined(
|
|
93
|
+
Option.fromUndefinedOr(initial[key]).pipe(
|
|
94
|
+
Option.orElse((): Option.Option<unknown> => Option.flatMap(OwnValues.styleValueOf(style, key), (raw) => Option.fromNullishOr(read(raw)))),
|
|
95
|
+
Option.orElse((): Option.Option<unknown> => BaseValue.transformIdentity(key)),
|
|
96
|
+
),
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* A server's Starting style for an element whose `style` has routed keys (#130): the projected
|
|
101
|
+
* `initial` with their values under it. With none, its Starting style as it was.
|
|
102
|
+
*/
|
|
103
|
+
export const serverStartingStyle = (
|
|
104
|
+
tag: string | undefined,
|
|
105
|
+
starting: Renderer.Patch,
|
|
106
|
+
initialValues: Values.Values,
|
|
107
|
+
routed: Readonly<Record<string, unknown>>,
|
|
108
|
+
layout: boolean,
|
|
109
|
+
untrack: Reactivity.Reactivity["untrack"],
|
|
110
|
+
template: WardConfig.WardConfig["transformTemplate"],
|
|
111
|
+
): Renderer.Patch =>
|
|
112
|
+
Bool.match(Rec.isEmptyRecord(routed), {
|
|
113
|
+
onTrue: () => starting,
|
|
114
|
+
onFalse: () => Style.starting(tag, drawnAtRest({ ...LiveStyle.valuesOf(routed, LiveStyle.serverRegistryOf, untrack), ...initialValues }, layout, template)).style,
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The values a layout node's Starting style is drawn from (#245, ADR-0044 *Amendment (#245)*):
|
|
119
|
+
* through its projection at rest, as its first commit draws it, its own translate on top (#363).
|
|
120
|
+
* Any other element's, as they are. A templated element's, with its Transform template (#443).
|
|
121
|
+
*/
|
|
122
|
+
export const drawnAtRest = (values: Values.Values, layout: boolean, template: WardConfig.WardConfig["transformTemplate"]): Readonly<Record<string, unknown>> => {
|
|
123
|
+
// Per mount (#460): guards, nothing built for an element neither a layout node nor templated.
|
|
124
|
+
if (Bool.not(layout)) return withTemplate(values, template)
|
|
125
|
+
return withTemplate({ ...values, [Projection.KEY]: Projection.AT_REST }, template)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** `values` with `template` under the renderer's reserved key, as its projection rides (#443); as they are with none. */
|
|
129
|
+
export const withTemplate = <V extends Readonly<Record<string, unknown>>>(values: V, template: WardConfig.WardConfig["transformTemplate"]): V => {
|
|
130
|
+
if (Predicate.isUndefined(template)) return values
|
|
131
|
+
return { ...values, [DomRenderer.TEMPLATE_KEY]: template }
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* What an element registers with in the gate (#443): its Transform template at mount, under the
|
|
136
|
+
* renderer's reserved key, drawn with its first write (a write of its own would take its Starting
|
|
137
|
+
* style off early). Nothing with none.
|
|
138
|
+
*/
|
|
139
|
+
export const registeredValuesOf = (template: WardConfig.WardConfig["transformTemplate"]): Readonly<Record<string, unknown>> | undefined => {
|
|
140
|
+
if (Predicate.isUndefined(template)) return undefined
|
|
141
|
+
return { [DomRenderer.TEMPLATE_KEY]: template }
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* What an element's projection node is held at for a Measure pass (#443, Motion's
|
|
146
|
+
* `transformTemplate(values, "")`): its Transform template's, from its values now, when it had one
|
|
147
|
+
* at mount. `undefined` otherwise, so a node without one pays a field read a pass.
|
|
148
|
+
*/
|
|
149
|
+
export const heldTransformFor = (
|
|
150
|
+
snapshot: Spine.Snapshot,
|
|
151
|
+
atMount: WardConfig.WardConfig["transformTemplate"],
|
|
152
|
+
template: () => WardConfig.WardConfig["transformTemplate"],
|
|
153
|
+
): (() => string) | undefined => {
|
|
154
|
+
if (Predicate.isUndefined(atMount)) return undefined
|
|
155
|
+
return () => DomRenderer.heldTransformOf(withTemplate(snapshot.values, template()))
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Follow an element's Transform template after mount (#443): `write` is called with each other one
|
|
160
|
+
* its config gives, and draws it at the next frame. Only for an element with one at mount, as
|
|
161
|
+
* `onUpdate` (#233): its caller asks only then, so another makes nothing (#460). Returns the stop.
|
|
162
|
+
*/
|
|
163
|
+
export const followTemplate = (
|
|
164
|
+
atMount: DomRenderer.TransformTemplate,
|
|
165
|
+
template: () => WardConfig.WardConfig["transformTemplate"],
|
|
166
|
+
watch: Reactivity.Reactivity["watch"],
|
|
167
|
+
write: (template: WardConfig.WardConfig["transformTemplate"]) => void,
|
|
168
|
+
): (() => void) => {
|
|
169
|
+
let last: WardConfig.WardConfig["transformTemplate"] = atMount
|
|
170
|
+
return watch(template, (next) => {
|
|
171
|
+
if (next === last) return
|
|
172
|
+
last = next
|
|
173
|
+
write(next)
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* A Handoff whose Appear animation the server sampled from another mount animation than the
|
|
179
|
+
* client's: the app rendered differently on the server, or a function it gave has no easing name.
|
|
180
|
+
* Noted once (cold path, `wardic.hydration`); the client's own animation goes on from the same time.
|
|
181
|
+
*/
|
|
182
|
+
const checkHandoff = (runtime: WardicServices.Runner<WardicServices.WardicServices>, id: string, handoff: AppearHandoff.Handoff, mount: AppearHandoff.MountAnimation): void => {
|
|
183
|
+
// A templated element's rule is named by its stops (#443), which the client doesn't sample to check.
|
|
184
|
+
if (Predicate.isNotUndefined(mount.template)) return
|
|
185
|
+
const same = Option.exists(AppearAnimations.keyOf(mount), (key) =>
|
|
186
|
+
Appear.matches((handoff as AppearAnimations.DomHandoff).animation, { key, tag: mount.tag, infinite: AppearHandoff.repeatsForever(mount.transition), projected: mount.layout }))
|
|
187
|
+
if (same) return
|
|
188
|
+
runtime.runFork(
|
|
189
|
+
Effect.logDebug("wardic.hydration: the server's Appear animation was sampled from another mount animation than this element's; it goes on from the same time").pipe(
|
|
190
|
+
Effect.annotateLogs({ id }),
|
|
191
|
+
),
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Development's diagnostics (#746): what a binding gives the spine under its development flag alone. Referenced
|
|
197
|
+
* nowhere else, so a production build, whose binding never gives it, drops it and what it calls.
|
|
198
|
+
*/
|
|
199
|
+
// #672: here, where the DOM's Handoff is, so the spine reads no Animation; given under `DEV` alone.
|
|
200
|
+
export const SPINE_DIAGNOSTICS: Spine.SpineDiagnostics = { checkHandoff, baseLog: Spine.baseLog }
|
|
201
|
+
|
|
202
|
+
// The DOM's ports, where an element's Environment gives none (#672, PR2-Q4): `DomLive` doesn't, so
|
|
203
|
+
// only an app that animates an element ships them, through these.
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* An Environment's reads of its Subjects' values (#672): its own values, Measured pairs and Variable
|
|
207
|
+
* values, each `undefined` when it gives none.
|
|
208
|
+
*/
|
|
209
|
+
export interface ValueReads {
|
|
210
|
+
readonly ownValues: CoreOwnValues.Shape | undefined
|
|
211
|
+
readonly measuredPairs: MeasuredPairs.Shape | undefined
|
|
212
|
+
readonly variableValues: VariableValues.Shape | undefined
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** An element's reads of its values: its Environment's, else the DOM's. */
|
|
216
|
+
export interface ElementValueReads {
|
|
217
|
+
readonly ownValues: CoreOwnValues.Shape
|
|
218
|
+
readonly measuredPairs: MeasuredPairs.Shape
|
|
219
|
+
readonly variableValues: VariableValues.Shape
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** The DOM's, for an Environment that gives none: `DomLive`'s. */
|
|
223
|
+
const DOM_VALUE_READS: ElementValueReads = { ownValues: DomValues.ownValues, measuredPairs: DomValues.measuredPairs, variableValues: DomValues.variableValues }
|
|
224
|
+
|
|
225
|
+
/** `given`, else the DOM's `dom`. */
|
|
226
|
+
const orDom = <A>(given: A | undefined, dom: A): A => {
|
|
227
|
+
if (Predicate.isUndefined(given)) return dom
|
|
228
|
+
return given
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** Each other Environment's reads, the DOM's in its gaps, made at its first element. */
|
|
232
|
+
// Module state (#460, Q7): one record per provider's reads, held weakly by them.
|
|
233
|
+
const filled = new WeakMap<ValueReads, ElementValueReads>()
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* An element's reads of its values (PR2-Q6): its Environment's, the DOM's where it gives none. One
|
|
237
|
+
* record a provider, made at its first element: an element reads it with one context read, and makes
|
|
238
|
+
* nothing.
|
|
239
|
+
*/
|
|
240
|
+
export const valueReadsOf = (given: ValueReads): ElementValueReads => {
|
|
241
|
+
// Per element at mount (#540): statements. `DomLive` gives none: the DOM's, with no lookup.
|
|
242
|
+
if (Bool.and(Predicate.isUndefined(given.ownValues), Bool.and(Predicate.isUndefined(given.measuredPairs), Predicate.isUndefined(given.variableValues)))) return DOM_VALUE_READS
|
|
243
|
+
const kept = filled.get(given)
|
|
244
|
+
if (Predicate.isNotUndefined(kept)) return kept
|
|
245
|
+
const reads: ElementValueReads = {
|
|
246
|
+
ownValues: orDom(given.ownValues, DomValues.ownValues),
|
|
247
|
+
measuredPairs: orDom(given.measuredPairs, DomValues.measuredPairs),
|
|
248
|
+
variableValues: orDom(given.variableValues, DomValues.variableValues),
|
|
249
|
+
}
|
|
250
|
+
filled.set(given, reads)
|
|
251
|
+
return reads
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* A binding's `setDragging`, turning the element's will-change value on as a drag starts (#443,
|
|
256
|
+
* Motion's): `"transform"`, as its drag draws `x` and `y`. Its spine hears each start and end too, for
|
|
257
|
+
* a Batch member's `x` and `y` (#665's PR 4).
|
|
258
|
+
*/
|
|
259
|
+
export const draggingWithWillChange = (live: LiveStyle.LiveStyle | undefined, setDragging: (on: boolean) => void, element: Element): ((on: boolean) => void) => {
|
|
260
|
+
const set = UndefinedOr.match(live, {
|
|
261
|
+
onUndefined: () => setDragging,
|
|
262
|
+
onDefined: (style) => (on: boolean) => {
|
|
263
|
+
if (on) UndefinedOr.map(style.willChange(), (turnOn) => turnOn())
|
|
264
|
+
setDragging(on)
|
|
265
|
+
},
|
|
266
|
+
})
|
|
267
|
+
return (on) => {
|
|
268
|
+
set(on)
|
|
269
|
+
Spine.tellDrag(element, on)
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* A drag track's `claim` for `element` (#665's PR 4): told before the drag reads where the element
|
|
275
|
+
* rests or writes `x`/`y`, so a Batch member's element takes its transform from its Batch first.
|
|
276
|
+
*/
|
|
277
|
+
export const claimForDrag = (element: Element): (() => void) => () => Spine.tellDrag(element, true)
|
|
278
|
+
|
|
279
|
+
/** Log, once per element, that a `transform` string gave way to the transform keys in its `style` (#130). */
|
|
280
|
+
export const warnDroppedTransform = (runtime: WardicServices.Runner<WardicServices.WardicServices>, id: string): void => {
|
|
281
|
+
runtime.runFork(
|
|
282
|
+
Effect.logWarning(
|
|
283
|
+
"wardic.style: a `transform` string is dropped while `style` sets a transform key (x, scale, rotate…); " +
|
|
284
|
+
"the keys win, as Motion's do. Give the transform as keys, or drop them",
|
|
285
|
+
).pipe(Effect.annotateLogs({ id })),
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Log, at debug level, the keys whose Starting style the Environment's Renderer projects
|
|
291
|
+
* differently from the DOM's `project`, which rendered the server markup. Hydration keeps
|
|
292
|
+
* the server's values (the Hydration hold); the Renderer's take over at the first frame.
|
|
293
|
+
* Hydration only, once per element. Internal.
|
|
294
|
+
*/
|
|
295
|
+
export const flagStartingStyle = (runtime: WardicServices.Runner<WardicServices.WardicServices>, id: string, server: Renderer.Patch, client: Renderer.Patch): void => {
|
|
296
|
+
const keys = Arr.appendAll(
|
|
297
|
+
Arr.filter(Rec.keys(server), (key) => String(server[key]) !== String(client[key])),
|
|
298
|
+
Arr.filter(Rec.keys(client), (key) => Bool.not(key in server)),
|
|
299
|
+
)
|
|
300
|
+
if (Arr.isReadonlyArrayEmpty(keys)) return
|
|
301
|
+
const pick = (patch: Renderer.Patch) => Object.fromEntries(keys.map((key) => [key, patch[key]]))
|
|
302
|
+
runtime.runFork(
|
|
303
|
+
Effect.logDebug(
|
|
304
|
+
"wardic.hydration: the Environment's Renderer projects the Starting style differently from the DOM's; " +
|
|
305
|
+
"hydration keeps the server's until the first frame, and an element that never animates keeps it",
|
|
306
|
+
).pipe(
|
|
307
|
+
Effect.annotateLogs({ id, keys, server: pick(server), client: pick(client) }),
|
|
308
|
+
),
|
|
309
|
+
)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/** An element's Appear animation on a server (#48, ADR-0044), as both bindings' server wards and component wraps use it. */
|
|
313
|
+
export interface ServerAppearOf {
|
|
314
|
+
/** Its inline `animation`, under the user's style: none when it plays none. */
|
|
315
|
+
readonly style: { readonly animation: string } | undefined
|
|
316
|
+
/** The context its children read: its variant node's, with its Appear group when it leads one. */
|
|
317
|
+
readonly provided: VariantTree.WardicVariantContextValue | undefined
|
|
318
|
+
/** Rules it out once it has rendered: its user style is read when `ward()` is called. */
|
|
319
|
+
readonly veto: (reason: string) => void
|
|
320
|
+
/**
|
|
321
|
+
* Rendered after the shell (#245): in a late chunk, and its root when no late element is around
|
|
322
|
+
* it, which puts the chunk's `<style>` after itself. `state` is the render's.
|
|
323
|
+
*/
|
|
324
|
+
readonly late: boolean
|
|
325
|
+
readonly chunkRoot: boolean
|
|
326
|
+
readonly state: AppearAnimations.ServerAppear | undefined
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** No Appear animation: a provider with `appear={false}`. */
|
|
330
|
+
const NO_APPEAR_ENTRY = (provided: VariantTree.WardicVariantContextValue | undefined): ServerAppearOf => ({
|
|
331
|
+
style: undefined,
|
|
332
|
+
provided,
|
|
333
|
+
veto: constVoid,
|
|
334
|
+
late: false,
|
|
335
|
+
chunkRoot: false,
|
|
336
|
+
state: undefined,
|
|
337
|
+
})
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* An element's entry in the server render's Appear animations (#48, ADR-0044): its starting
|
|
341
|
+
* values, its targets at mount (`animate`, or an inherited variant name against its `variants`),
|
|
342
|
+
* its transition, its place in its parent's group, and its nearest `WardicConfig`'s reduced motion
|
|
343
|
+
* (#434). `state` is the provider's, `undefined` with `appear={false}`: each binding reads it from its
|
|
344
|
+
* own context.
|
|
345
|
+
*/
|
|
346
|
+
export const appearEntryOf = (
|
|
347
|
+
state: AppearAnimations.ServerAppear | undefined,
|
|
348
|
+
c: WardConfig.SpineConfig,
|
|
349
|
+
tag: string | undefined,
|
|
350
|
+
initialValues: Values.Values,
|
|
351
|
+
node: VariantTree.ServerVariantNode,
|
|
352
|
+
quiet: boolean,
|
|
353
|
+
reducedMotion: ReducedMotion.Config | undefined,
|
|
354
|
+
skipAnimations = false,
|
|
355
|
+
): ServerAppearOf =>
|
|
356
|
+
UndefinedOr.match(state, {
|
|
357
|
+
onUndefined: () => NO_APPEAR_ENTRY(node.provided),
|
|
358
|
+
onDefined: (state) => {
|
|
359
|
+
// The target's own transition (#277) drives its mount animation, and its orchestration.
|
|
360
|
+
const target = serverTargetOf(c, node.inherited)
|
|
361
|
+
const own = Option.getOrUndefined(Option.flatMap(target, (t) => Option.fromUndefinedOr(t.transition)))
|
|
362
|
+
const entered = AppearAnimations.enterServer(state, {
|
|
363
|
+
appear: c.appear,
|
|
364
|
+
tag,
|
|
365
|
+
initial: initialValues,
|
|
366
|
+
to: Option.map(target, (t) => t.values),
|
|
367
|
+
keyframes: Option.getOrUndefined(Option.flatMap(target, (t) => Option.fromUndefinedOr(t.keyframes))),
|
|
368
|
+
quiet,
|
|
369
|
+
transition: VariantTarget.transitionOfTarget(own, VariantTree.ownOrInherited(c.transition, node.inherited)),
|
|
370
|
+
layout: Spine.isLayoutNode(c),
|
|
371
|
+
template: c.transformTemplate,
|
|
372
|
+
group: Option.flatMap(Option.fromUndefinedOr(node.inherited), (inherited) => Option.fromUndefinedOr(appearGroupOf(inherited))),
|
|
373
|
+
leads: VariantTree.hasOwnVariants(c),
|
|
374
|
+
ownTransition: VariantTarget.transitionOfTarget(own, c.transition),
|
|
375
|
+
reducedMotion,
|
|
376
|
+
skipAnimations,
|
|
377
|
+
})
|
|
378
|
+
return {
|
|
379
|
+
style: Option.match(entered.animation, { onNone: constUndefined, onSome: (animation) => ({ animation }) }),
|
|
380
|
+
provided: Option.match(entered.group, {
|
|
381
|
+
onNone: () => node.provided,
|
|
382
|
+
onSome: (appearGroup) => UndefinedOr.map(node.provided, (provided): VariantTree.WardicVariantContextValue => ({ ...provided, appearGroup })),
|
|
383
|
+
}),
|
|
384
|
+
veto: entered.veto,
|
|
385
|
+
late: entered.late,
|
|
386
|
+
chunkRoot: entered.chunkRoot,
|
|
387
|
+
state,
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
})
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* The Appear group a Variant child joins, its parent's: the variant context carries it opaque, and
|
|
394
|
+
* only {@link appearEntryOf} writes it, so it's always one.
|
|
395
|
+
*/
|
|
396
|
+
// #672 (PR4-Q4): the one read of the variant context's `appearGroup` as the sampler's type.
|
|
397
|
+
const appearGroupOf = (context: VariantTree.WardicVariantContextValue): AppearAnimations.AppearGroup | undefined => context.appearGroup as AppearAnimations.AppearGroup | undefined
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* An element's target at mount on a server: its `animate`, else an inherited variant name resolved
|
|
401
|
+
* against its own `variants`, a dynamic one with its `custom` and no values yet (#277).
|
|
402
|
+
*/
|
|
403
|
+
export const serverTargetOf = (c: WardConfig.SpineConfig, inherited: VariantTree.WardicVariantContextValue | undefined): Option.Option<VariantTarget.Target> =>
|
|
404
|
+
UndefinedOr.match(c.animate as VariantTarget.Entry, {
|
|
405
|
+
onDefined: (own) => Option.some(VariantTarget.resolveTarget(own, c.variants, c.custom, VariantTarget.NO_VARIANT_STATE)),
|
|
406
|
+
onUndefined: () =>
|
|
407
|
+
Option.map(
|
|
408
|
+
Option.flatMap(Option.fromUndefinedOr(inherited), (context) => Option.fromUndefinedOr(context.variant())),
|
|
409
|
+
(name) => VariantTarget.resolveTarget(name, c.variants, c.custom, VariantTarget.NO_VARIANT_STATE),
|
|
410
|
+
),
|
|
411
|
+
})
|