@unrulysystems/native-motion-core 0.1.0-alpha.0
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/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +48 -0
- package/dist/clock.cjs +71 -0
- package/dist/clock.d.cts +23 -0
- package/dist/clock.d.ts +23 -0
- package/dist/clock.js +66 -0
- package/dist/collect-reads.cjs +68 -0
- package/dist/collect-reads.d.cts +23 -0
- package/dist/collect-reads.d.ts +23 -0
- package/dist/collect-reads.js +62 -0
- package/dist/component/boundedArray.cjs +74 -0
- package/dist/component/boundedArray.d.cts +25 -0
- package/dist/component/boundedArray.d.ts +25 -0
- package/dist/component/boundedArray.js +68 -0
- package/dist/component/index.cjs +57 -0
- package/dist/component/index.d.cts +12 -0
- package/dist/component/index.d.ts +12 -0
- package/dist/component/index.js +22 -0
- package/dist/component/orchestration.cjs +129 -0
- package/dist/component/orchestration.d.cts +66 -0
- package/dist/component/orchestration.d.ts +66 -0
- package/dist/component/orchestration.js +124 -0
- package/dist/component/resolve.cjs +104 -0
- package/dist/component/resolve.d.cts +11 -0
- package/dist/component/resolve.d.ts +11 -0
- package/dist/component/resolve.js +97 -0
- package/dist/component/transition.cjs +352 -0
- package/dist/component/transition.d.cts +33 -0
- package/dist/component/transition.d.ts +33 -0
- package/dist/component/transition.js +339 -0
- package/dist/component/types.cjs +114 -0
- package/dist/component/types.d.cts +60 -0
- package/dist/component/types.d.ts +60 -0
- package/dist/component/types.js +111 -0
- package/dist/component/validate.cjs +1015 -0
- package/dist/component/validate.d.cts +37 -0
- package/dist/component/validate.d.ts +37 -0
- package/dist/component/validate.js +1002 -0
- package/dist/component/variants.cjs +333 -0
- package/dist/component/variants.d.cts +106 -0
- package/dist/component/variants.d.ts +106 -0
- package/dist/component/variants.js +321 -0
- package/dist/config/constants.cjs +41 -0
- package/dist/config/constants.d.cts +29 -0
- package/dist/config/constants.d.ts +29 -0
- package/dist/config/constants.js +38 -0
- package/dist/delay.cjs +72 -0
- package/dist/delay.d.cts +26 -0
- package/dist/delay.d.ts +26 -0
- package/dist/delay.js +70 -0
- package/dist/derived.cjs +143 -0
- package/dist/derived.d.cts +41 -0
- package/dist/derived.d.ts +41 -0
- package/dist/derived.js +139 -0
- package/dist/driver/index.cjs +22 -0
- package/dist/driver/index.d.cts +7 -0
- package/dist/driver/index.d.ts +7 -0
- package/dist/driver/index.js +14 -0
- package/dist/driver/keyframeTiming.cjs +130 -0
- package/dist/driver/keyframeTiming.d.cts +18 -0
- package/dist/driver/keyframeTiming.d.ts +18 -0
- package/dist/driver/keyframeTiming.js +124 -0
- package/dist/driver/keyframeTimingConfig.cjs +24 -0
- package/dist/driver/keyframeTimingConfig.d.cts +5 -0
- package/dist/driver/keyframeTimingConfig.d.ts +5 -0
- package/dist/driver/keyframeTimingConfig.js +22 -0
- package/dist/driver/prepare.cjs +459 -0
- package/dist/driver/prepare.d.cts +4 -0
- package/dist/driver/prepare.d.ts +4 -0
- package/dist/driver/prepare.js +454 -0
- package/dist/driver/reference.cjs +762 -0
- package/dist/driver/reference.d.cts +53 -0
- package/dist/driver/reference.d.ts +53 -0
- package/dist/driver/reference.js +757 -0
- package/dist/driver/step.cjs +55 -0
- package/dist/driver/step.d.cts +9 -0
- package/dist/driver/step.d.ts +9 -0
- package/dist/driver/step.js +52 -0
- package/dist/driver/tiers.cjs +40 -0
- package/dist/driver/tiers.d.cts +2 -0
- package/dist/driver/tiers.d.ts +2 -0
- package/dist/driver/tiers.js +37 -0
- package/dist/driver/types.cjs +9 -0
- package/dist/driver/types.d.cts +68 -0
- package/dist/driver/types.d.ts +68 -0
- package/dist/driver/types.js +8 -0
- package/dist/external-animation-ledger.cjs +1250 -0
- package/dist/external-animation-ledger.d.cts +416 -0
- package/dist/external-animation-ledger.d.ts +416 -0
- package/dist/external-animation-ledger.js +1243 -0
- package/dist/gesture/directionLock.cjs +25 -0
- package/dist/gesture/directionLock.d.cts +8 -0
- package/dist/gesture/directionLock.d.ts +8 -0
- package/dist/gesture/directionLock.js +21 -0
- package/dist/gesture/dragConfig.cjs +634 -0
- package/dist/gesture/dragConfig.d.cts +298 -0
- package/dist/gesture/dragConfig.d.ts +298 -0
- package/dist/gesture/dragConfig.js +624 -0
- package/dist/gesture/elastic.cjs +44 -0
- package/dist/gesture/elastic.d.cts +4 -0
- package/dist/gesture/elastic.d.ts +4 -0
- package/dist/gesture/elastic.js +39 -0
- package/dist/gesture/handoffSession.cjs +161 -0
- package/dist/gesture/handoffSession.d.cts +35 -0
- package/dist/gesture/handoffSession.d.ts +35 -0
- package/dist/gesture/handoffSession.js +158 -0
- package/dist/gesture/index.cjs +37 -0
- package/dist/gesture/index.d.cts +12 -0
- package/dist/gesture/index.d.ts +12 -0
- package/dist/gesture/index.js +11 -0
- package/dist/gesture/projection.cjs +95 -0
- package/dist/gesture/projection.d.cts +7 -0
- package/dist/gesture/projection.d.ts +7 -0
- package/dist/gesture/projection.js +87 -0
- package/dist/gesture/session.cjs +162 -0
- package/dist/gesture/session.d.cts +29 -0
- package/dist/gesture/session.d.ts +29 -0
- package/dist/gesture/session.js +158 -0
- package/dist/gesture/types.cjs +5 -0
- package/dist/gesture/types.d.cts +13 -0
- package/dist/gesture/types.d.ts +13 -0
- package/dist/gesture/types.js +4 -0
- package/dist/gesture/viewportConstraints.cjs +38 -0
- package/dist/gesture/viewportConstraints.d.cts +6 -0
- package/dist/gesture/viewportConstraints.d.ts +6 -0
- package/dist/gesture/viewportConstraints.js +34 -0
- package/dist/graph.cjs +226 -0
- package/dist/graph.d.cts +2 -0
- package/dist/graph.d.ts +2 -0
- package/dist/graph.js +223 -0
- package/dist/index.cjs +140 -0
- package/dist/index.d.cts +33 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +70 -0
- package/dist/inertia.cjs +214 -0
- package/dist/inertia.d.cts +53 -0
- package/dist/inertia.d.ts +53 -0
- package/dist/inertia.js +212 -0
- package/dist/instant.cjs +66 -0
- package/dist/instant.d.cts +16 -0
- package/dist/instant.d.ts +16 -0
- package/dist/instant.js +63 -0
- package/dist/internal-driver.cjs +81 -0
- package/dist/internal-driver.d.cts +19 -0
- package/dist/internal-driver.d.ts +19 -0
- package/dist/internal-driver.js +35 -0
- package/dist/keyframes.cjs +191 -0
- package/dist/keyframes.d.cts +13 -0
- package/dist/keyframes.d.ts +13 -0
- package/dist/keyframes.js +188 -0
- package/dist/layout/commitDetector.cjs +67 -0
- package/dist/layout/commitDetector.d.cts +21 -0
- package/dist/layout/commitDetector.d.ts +21 -0
- package/dist/layout/commitDetector.js +64 -0
- package/dist/layout/compose.cjs +67 -0
- package/dist/layout/compose.d.cts +30 -0
- package/dist/layout/compose.d.ts +30 -0
- package/dist/layout/compose.js +65 -0
- package/dist/layout/constants.cjs +13 -0
- package/dist/layout/constants.d.cts +6 -0
- package/dist/layout/constants.d.ts +6 -0
- package/dist/layout/constants.js +10 -0
- package/dist/layout/identity.cjs +700 -0
- package/dist/layout/identity.d.cts +67 -0
- package/dist/layout/identity.d.ts +67 -0
- package/dist/layout/identity.js +698 -0
- package/dist/layout/index.cjs +36 -0
- package/dist/layout/index.d.cts +18 -0
- package/dist/layout/index.d.ts +18 -0
- package/dist/layout/index.js +13 -0
- package/dist/layout/measure.cjs +81 -0
- package/dist/layout/measure.d.cts +43 -0
- package/dist/layout/measure.d.ts +43 -0
- package/dist/layout/measure.js +78 -0
- package/dist/layout/projection.cjs +99 -0
- package/dist/layout/projection.d.cts +23 -0
- package/dist/layout/projection.d.ts +23 -0
- package/dist/layout/projection.js +97 -0
- package/dist/layout/scroll.cjs +27 -0
- package/dist/layout/scroll.d.cts +13 -0
- package/dist/layout/scroll.d.ts +13 -0
- package/dist/layout/scroll.js +24 -0
- package/dist/layout/session.cjs +207 -0
- package/dist/layout/session.d.cts +73 -0
- package/dist/layout/session.d.ts +73 -0
- package/dist/layout/session.js +205 -0
- package/dist/layout/tree.cjs +826 -0
- package/dist/layout/tree.d.cts +70 -0
- package/dist/layout/tree.d.ts +70 -0
- package/dist/layout/tree.js +823 -0
- package/dist/layout/types.cjs +36 -0
- package/dist/layout/types.d.cts +31 -0
- package/dist/layout/types.d.ts +31 -0
- package/dist/layout/types.js +35 -0
- package/dist/motion-arc.cjs +184 -0
- package/dist/motion-arc.d.cts +78 -0
- package/dist/motion-arc.d.ts +78 -0
- package/dist/motion-arc.js +183 -0
- package/dist/motion-mix.cjs +205 -0
- package/dist/motion-mix.d.cts +3 -0
- package/dist/motion-mix.d.ts +3 -0
- package/dist/motion-mix.js +202 -0
- package/dist/motion-value-driver-port.cjs +636 -0
- package/dist/motion-value-driver-port.d.cts +406 -0
- package/dist/motion-value-driver-port.d.ts +406 -0
- package/dist/motion-value-driver-port.js +627 -0
- package/dist/motion-value.cjs +189 -0
- package/dist/motion-value.d.cts +51 -0
- package/dist/motion-value.d.ts +51 -0
- package/dist/motion-value.js +185 -0
- package/dist/presence/controller.cjs +657 -0
- package/dist/presence/controller.d.cts +6 -0
- package/dist/presence/controller.d.ts +6 -0
- package/dist/presence/controller.js +652 -0
- package/dist/presence/index.cjs +19 -0
- package/dist/presence/index.d.cts +4 -0
- package/dist/presence/index.d.ts +4 -0
- package/dist/presence/index.js +12 -0
- package/dist/presence/machine.cjs +50 -0
- package/dist/presence/machine.d.cts +10 -0
- package/dist/presence/machine.d.ts +10 -0
- package/dist/presence/machine.js +46 -0
- package/dist/presence/types.cjs +6 -0
- package/dist/presence/types.d.cts +32 -0
- package/dist/presence/types.d.ts +32 -0
- package/dist/presence/types.js +5 -0
- package/dist/repeat.cjs +311 -0
- package/dist/repeat.d.cts +174 -0
- package/dist/repeat.d.ts +174 -0
- package/dist/repeat.js +300 -0
- package/dist/spring.cjs +128 -0
- package/dist/spring.d.cts +18 -0
- package/dist/spring.d.ts +18 -0
- package/dist/spring.js +125 -0
- package/dist/subscriptions.cjs +74 -0
- package/dist/subscriptions.d.cts +19 -0
- package/dist/subscriptions.d.ts +19 -0
- package/dist/subscriptions.js +69 -0
- package/dist/subset/index.cjs +23 -0
- package/dist/subset/index.d.cts +6 -0
- package/dist/subset/index.d.ts +6 -0
- package/dist/subset/index.js +13 -0
- package/dist/subset/normalize.cjs +90 -0
- package/dist/subset/normalize.d.cts +10 -0
- package/dist/subset/normalize.d.ts +10 -0
- package/dist/subset/normalize.js +85 -0
- package/dist/subset/registry.cjs +259 -0
- package/dist/subset/registry.d.cts +25 -0
- package/dist/subset/registry.d.ts +25 -0
- package/dist/subset/registry.js +256 -0
- package/dist/subset/resolve.cjs +98 -0
- package/dist/subset/resolve.d.cts +24 -0
- package/dist/subset/resolve.d.ts +24 -0
- package/dist/subset/resolve.js +90 -0
- package/dist/timing.cjs +206 -0
- package/dist/timing.d.cts +17 -0
- package/dist/timing.d.ts +17 -0
- package/dist/timing.js +201 -0
- package/dist/transformTemplate.cjs +219 -0
- package/dist/transformTemplate.d.cts +29 -0
- package/dist/transformTemplate.d.ts +29 -0
- package/dist/transformTemplate.js +215 -0
- package/dist/transition.cjs +231 -0
- package/dist/transition.d.cts +89 -0
- package/dist/transition.d.ts +89 -0
- package/dist/transition.js +223 -0
- package/dist/types.cjs +4 -0
- package/dist/types.d.cts +175 -0
- package/dist/types.d.ts +175 -0
- package/dist/types.js +3 -0
- package/dist/value-types/color.cjs +220 -0
- package/dist/value-types/color.d.cts +19 -0
- package/dist/value-types/color.d.ts +19 -0
- package/dist/value-types/color.js +218 -0
- package/dist/value-types/complex.cjs +160 -0
- package/dist/value-types/complex.d.cts +19 -0
- package/dist/value-types/complex.d.ts +19 -0
- package/dist/value-types/complex.js +155 -0
- package/dist/value-types/constants.cjs +15 -0
- package/dist/value-types/constants.d.cts +6 -0
- package/dist/value-types/constants.d.ts +6 -0
- package/dist/value-types/constants.js +12 -0
- package/dist/value-types/discrete.cjs +62 -0
- package/dist/value-types/discrete.d.cts +4 -0
- package/dist/value-types/discrete.d.ts +4 -0
- package/dist/value-types/discrete.js +56 -0
- package/dist/value-types/index.cjs +59 -0
- package/dist/value-types/index.d.cts +14 -0
- package/dist/value-types/index.d.ts +14 -0
- package/dist/value-types/index.js +24 -0
- package/dist/value-types/measure-resolve.cjs +325 -0
- package/dist/value-types/measure-resolve.d.cts +91 -0
- package/dist/value-types/measure-resolve.d.ts +91 -0
- package/dist/value-types/measure-resolve.js +313 -0
- package/dist/value-types/mix.cjs +90 -0
- package/dist/value-types/mix.d.cts +27 -0
- package/dist/value-types/mix.d.ts +27 -0
- package/dist/value-types/mix.js +85 -0
- package/dist/value-types/named-colors.cjs +61 -0
- package/dist/value-types/named-colors.d.cts +2 -0
- package/dist/value-types/named-colors.d.ts +2 -0
- package/dist/value-types/named-colors.js +58 -0
- package/dist/value-types/numeric.cjs +86 -0
- package/dist/value-types/numeric.d.cts +16 -0
- package/dist/value-types/numeric.d.ts +16 -0
- package/dist/value-types/numeric.js +79 -0
- package/dist/worklet-layout/config/constants.js +39 -0
- package/dist/worklet-layout/layout/constants.js +11 -0
- package/dist/worklet-layout/layout/identity.js +699 -0
- package/dist/worklet-layout/layout/projection.js +98 -0
- package/dist/worklet-layout/layout/session.js +206 -0
- package/dist/worklet-layout/layout/tree.js +824 -0
- package/dist/worklet-layout/layout/types.js +36 -0
- package/dist/worklet-layout/spring.js +125 -0
- package/dist/worklet-layout/timing.js +201 -0
- package/dist/worklet-layout/transition.js +223 -0
- package/dist/worklet-layout.cjs +47 -0
- package/dist/worklet-layout.d.cts +15 -0
- package/dist/worklet-layout.d.ts +15 -0
- package/dist/worklet-layout.js +28 -0
- package/dist/wrap.cjs +7 -0
- package/dist/wrap.d.cts +1 -0
- package/dist/wrap.d.ts +1 -0
- package/dist/wrap.js +4 -0
- package/package.json +45 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
// SPEC-COMPONENT §2 — the transition unit boundary (REQ-API-001). The public `Transition` (in ./types)
|
|
2
|
+
// speaks Motion's SECONDS convention; the internal SPRING (`SpringConfig`) and TIMING (`TimingConfig`)
|
|
3
|
+
// resolvers consume MILLISECONDS. These pure converters are the SINGLE crossing point, so the internal
|
|
4
|
+
// millisecond unit never leaks into the authored public surface and a Motion-idiomatic transition config
|
|
5
|
+
// resolves identically here. Host-agnostic (REQ-CORE-003) — relative imports only.
|
|
6
|
+
import { isEasingList } from "../timing.js";
|
|
7
|
+
import { TARGET_PROPERTY_KEYS } from "./types.js";
|
|
8
|
+
// Motion authors durations in seconds; the SPRING/TIMING generators are seeded in milliseconds. This is the
|
|
9
|
+
// only conversion factor, named rather than inlined so the seconds↔ms boundary is explicit.
|
|
10
|
+
const MS_PER_SECOND = 1000;
|
|
11
|
+
const TRANSITION_MAP_KEYS = new Set(['default', 'layout', ...TARGET_PROPERTY_KEYS]);
|
|
12
|
+
function isTransitionMapKey(key) {
|
|
13
|
+
return TRANSITION_MAP_KEYS.has(key);
|
|
14
|
+
}
|
|
15
|
+
function flatTransitionSnapshot(source) {
|
|
16
|
+
const out = Object.create(null);
|
|
17
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
18
|
+
if (typeof key !== 'string' || key === 'inherit' || isTransitionMapKey(key))
|
|
19
|
+
continue;
|
|
20
|
+
const descriptor = Object.getOwnPropertyDescriptor(source, key);
|
|
21
|
+
if (descriptor === undefined)
|
|
22
|
+
continue;
|
|
23
|
+
Object.defineProperty(out, key, {
|
|
24
|
+
value: source[key],
|
|
25
|
+
enumerable: descriptor.enumerable === true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return Object.freeze(out);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolve one Motion consumer against an authored transition map. The result is a detached flat
|
|
34
|
+
* bag: map entries never cross into a generator, and nested maps never recurse. Validation/capture
|
|
35
|
+
* owns malformed-shape refusal; this selector assumes that boundary has passed and preserves the
|
|
36
|
+
* pin's key → default → root precedence.
|
|
37
|
+
*/
|
|
38
|
+
export function resolveTransitionForKey(transition, key) {
|
|
39
|
+
const source = transition;
|
|
40
|
+
const named = isTransitionMapKey(key) ? source[key] : undefined;
|
|
41
|
+
const fallback = source['default'];
|
|
42
|
+
const selected = named !== undefined && named !== null
|
|
43
|
+
? named
|
|
44
|
+
: fallback !== undefined && fallback !== null
|
|
45
|
+
? fallback
|
|
46
|
+
: transition;
|
|
47
|
+
if (selected === transition)
|
|
48
|
+
return flatTransitionSnapshot(source);
|
|
49
|
+
const root = flatTransitionSnapshot(source);
|
|
50
|
+
const nested = selected;
|
|
51
|
+
if (nested['inherit'] !== true) {
|
|
52
|
+
// Motion's getValueTransition returns a replacing child bag unchanged. The separate delay
|
|
53
|
+
// rebase in animateTarget supplies only its orchestration delay before spreading this bag, so
|
|
54
|
+
// an ordinary selected bag does not inherit the root transition's delay (motion-dom@12.42.2).
|
|
55
|
+
return flatTransitionSnapshot(nested);
|
|
56
|
+
}
|
|
57
|
+
const merged = Object.create(null);
|
|
58
|
+
for (const key of Reflect.ownKeys(root)) {
|
|
59
|
+
const descriptor = Object.getOwnPropertyDescriptor(root, key);
|
|
60
|
+
if (descriptor !== undefined)
|
|
61
|
+
Object.defineProperty(merged, key, { ...descriptor, configurable: true, writable: true });
|
|
62
|
+
}
|
|
63
|
+
const child = flatTransitionSnapshot(nested);
|
|
64
|
+
for (const key of Reflect.ownKeys(child)) {
|
|
65
|
+
const descriptor = Object.getOwnPropertyDescriptor(child, key);
|
|
66
|
+
if (descriptor !== undefined)
|
|
67
|
+
Object.defineProperty(merged, key, { ...descriptor, configurable: true, writable: true });
|
|
68
|
+
}
|
|
69
|
+
return Object.freeze(merged);
|
|
70
|
+
}
|
|
71
|
+
// Bridge the public `Transition` to the internal spring `SpringConfig`. `duration` crosses seconds→ms;
|
|
72
|
+
// `visualDuration` is already seconds in both surfaces (passthrough); the physics options are unit-
|
|
73
|
+
// consistent with Motion. Absent fields are omitted entirely (not written as `undefined`) so the result
|
|
74
|
+
// satisfies `exactOptionalPropertyTypes`.
|
|
75
|
+
export function toSpringConfig(transition) {
|
|
76
|
+
const config = {};
|
|
77
|
+
if (transition.stiffness !== undefined)
|
|
78
|
+
config.stiffness = transition.stiffness;
|
|
79
|
+
if (transition.damping !== undefined)
|
|
80
|
+
config.damping = transition.damping;
|
|
81
|
+
if (transition.mass !== undefined)
|
|
82
|
+
config.mass = transition.mass;
|
|
83
|
+
if (transition.bounce !== undefined)
|
|
84
|
+
config.bounce = transition.bounce;
|
|
85
|
+
if (transition.velocity !== undefined)
|
|
86
|
+
config.velocity = transition.velocity;
|
|
87
|
+
// U7c (REQ-SPRING-014): the authored settle thresholds cross verbatim — unit-free passthroughs
|
|
88
|
+
// (the velocity precedent). An explicit 0 is forwarded as PRESENT; the `||=` quirk (0 ≡ absent,
|
|
89
|
+
// motion-dom@12.42.2 spring.ts:275-280) resolves in the solver's `||` read, never here.
|
|
90
|
+
if (transition.restDelta !== undefined)
|
|
91
|
+
config.restDelta = transition.restDelta;
|
|
92
|
+
if (transition.restSpeed !== undefined)
|
|
93
|
+
config.restSpeed = transition.restSpeed;
|
|
94
|
+
if (transition.visualDuration !== undefined)
|
|
95
|
+
config.visualDuration = transition.visualDuration;
|
|
96
|
+
if (transition.duration !== undefined)
|
|
97
|
+
config.duration = transition.duration * MS_PER_SECOND;
|
|
98
|
+
return config;
|
|
99
|
+
}
|
|
100
|
+
// Bridge the public `Transition` to the internal `TimingConfig` (tween path). `duration` crosses
|
|
101
|
+
// seconds→ms; `ease` passes through. Absent fields omitted (exactOptionalPropertyTypes).
|
|
102
|
+
// Family-2 / T20: `easings` and `easing` are Motion catalog aliases of `ease`.
|
|
103
|
+
// Dual authorship is refused at validate.
|
|
104
|
+
export function effectiveTransitionEase(transition) {
|
|
105
|
+
if (transition.ease !== undefined)
|
|
106
|
+
return transition.ease;
|
|
107
|
+
if (transition.easings !== undefined)
|
|
108
|
+
return transition.easings;
|
|
109
|
+
return transition.easing;
|
|
110
|
+
}
|
|
111
|
+
// Rewrite `easings` → `ease` for host pass-through (web motion.div speaks `ease`). Identity when
|
|
112
|
+
// only `ease` is authored. Dual authorship never reaches here (validate refuses first).
|
|
113
|
+
// Preserve null-prototype + freeze + own descriptors from captureTransition (G-INV-8): object
|
|
114
|
+
// spread would re-open prototype pollution and drop non-enumerable own keys.
|
|
115
|
+
// Explicit `ease: undefined` / `easings: undefined` are ABSENT (same law, 00i0nt) — strip those
|
|
116
|
+
// own keys so nested config merge cannot treat them as present values that clobber a parent.
|
|
117
|
+
const EASE_ALIAS_KEYS = ['easings', 'easing'];
|
|
118
|
+
function normalizeFlatTransitionEaseAlias(transition) {
|
|
119
|
+
const source = transition;
|
|
120
|
+
const hasOwnEase = Object.hasOwn(transition, 'ease');
|
|
121
|
+
const easeIsExplicitUndefined = hasOwnEase && source['ease'] === undefined;
|
|
122
|
+
let aliasKey;
|
|
123
|
+
let aliasValue;
|
|
124
|
+
let aliasExplicitUndefined = false;
|
|
125
|
+
for (const key of EASE_ALIAS_KEYS) {
|
|
126
|
+
if (!Object.hasOwn(transition, key))
|
|
127
|
+
continue;
|
|
128
|
+
const value = source[key];
|
|
129
|
+
if (value === undefined) {
|
|
130
|
+
aliasExplicitUndefined = true;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
if (aliasKey === undefined) {
|
|
134
|
+
aliasKey = key;
|
|
135
|
+
aliasValue = value;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (aliasKey === undefined) {
|
|
139
|
+
if (!easeIsExplicitUndefined && !aliasExplicitUndefined)
|
|
140
|
+
return transition;
|
|
141
|
+
const stripped = Object.create(null);
|
|
142
|
+
let changed = false;
|
|
143
|
+
for (const key of Reflect.ownKeys(transition)) {
|
|
144
|
+
if (key === 'ease' && source[key] === undefined) {
|
|
145
|
+
changed = true;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if ((key === 'easings' || key === 'easing') && source[key] === undefined) {
|
|
149
|
+
changed = true;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
const descriptor = Object.getOwnPropertyDescriptor(transition, key);
|
|
153
|
+
if (descriptor === undefined)
|
|
154
|
+
continue;
|
|
155
|
+
Object.defineProperty(stripped, key, {
|
|
156
|
+
value: descriptor.value,
|
|
157
|
+
enumerable: descriptor.enumerable === true,
|
|
158
|
+
configurable: true,
|
|
159
|
+
writable: true,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return changed ? Object.freeze(stripped) : transition;
|
|
163
|
+
}
|
|
164
|
+
const captured = Object.create(null);
|
|
165
|
+
for (const key of Reflect.ownKeys(transition)) {
|
|
166
|
+
if (key === 'easings' || key === 'easing')
|
|
167
|
+
continue;
|
|
168
|
+
if (key === 'ease' && source[key] === undefined)
|
|
169
|
+
continue;
|
|
170
|
+
const descriptor = Object.getOwnPropertyDescriptor(transition, key);
|
|
171
|
+
if (descriptor === undefined)
|
|
172
|
+
continue;
|
|
173
|
+
Object.defineProperty(captured, key, {
|
|
174
|
+
value: descriptor.value,
|
|
175
|
+
enumerable: descriptor.enumerable === true,
|
|
176
|
+
configurable: true,
|
|
177
|
+
writable: true,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
Object.defineProperty(captured, 'ease', {
|
|
181
|
+
value: aliasValue,
|
|
182
|
+
enumerable: true,
|
|
183
|
+
configurable: true,
|
|
184
|
+
writable: true,
|
|
185
|
+
});
|
|
186
|
+
return Object.freeze(captured);
|
|
187
|
+
}
|
|
188
|
+
const TRANSITION_MAP_KEYS_FOR_ALIAS = new Set([
|
|
189
|
+
'default',
|
|
190
|
+
'layout',
|
|
191
|
+
...TARGET_PROPERTY_KEYS,
|
|
192
|
+
]);
|
|
193
|
+
/**
|
|
194
|
+
* Canonicalize the public `easings` alias at both legal transition levels. The pin-facing web/native
|
|
195
|
+
* consumers never receive nested bags directly, but MotionConfig and variant inheritance can carry a
|
|
196
|
+
* captured map through several handoff boundaries before the consumer selector runs. Normalize exactly
|
|
197
|
+
* one nested bag level; recursive maps are a validation error, not an invitation to walk unbounded data.
|
|
198
|
+
*/
|
|
199
|
+
export function normalizeTransitionEaseAlias(transition) {
|
|
200
|
+
const root = normalizeFlatTransitionEaseAlias(transition);
|
|
201
|
+
const source = transition;
|
|
202
|
+
let changed = root !== transition;
|
|
203
|
+
const replacements = new Map();
|
|
204
|
+
for (const key of Reflect.ownKeys(transition)) {
|
|
205
|
+
if (typeof key !== 'string' || !TRANSITION_MAP_KEYS_FOR_ALIAS.has(key))
|
|
206
|
+
continue;
|
|
207
|
+
const nested = source[key];
|
|
208
|
+
if (typeof nested !== 'object' ||
|
|
209
|
+
nested === null ||
|
|
210
|
+
Array.isArray(nested) ||
|
|
211
|
+
(Object.getPrototypeOf(nested) !== Object.prototype && Object.getPrototypeOf(nested) !== null))
|
|
212
|
+
continue;
|
|
213
|
+
const normalized = normalizeFlatTransitionEaseAlias(nested);
|
|
214
|
+
if (normalized !== nested) {
|
|
215
|
+
changed = true;
|
|
216
|
+
replacements.set(key, normalized);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (!changed)
|
|
220
|
+
return root;
|
|
221
|
+
const out = Object.create(null);
|
|
222
|
+
for (const key of Reflect.ownKeys(root)) {
|
|
223
|
+
const descriptor = Object.getOwnPropertyDescriptor(root, key);
|
|
224
|
+
if (descriptor === undefined)
|
|
225
|
+
continue;
|
|
226
|
+
Object.defineProperty(out, key, {
|
|
227
|
+
value: replacements.get(key) ?? descriptor.value,
|
|
228
|
+
enumerable: descriptor.enumerable === true,
|
|
229
|
+
configurable: true,
|
|
230
|
+
writable: true,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
return Object.freeze(out);
|
|
234
|
+
}
|
|
235
|
+
export function toRepeatFoldOptions(transition) {
|
|
236
|
+
const repeat = transition.repeat;
|
|
237
|
+
if (repeat === undefined || repeat <= 0)
|
|
238
|
+
return null;
|
|
239
|
+
return {
|
|
240
|
+
repeat,
|
|
241
|
+
repeatType: transition.repeatType ?? 'loop',
|
|
242
|
+
repeatDelayMs: (transition.repeatDelay ?? 0) * MS_PER_SECOND,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
// T18-b (REQ-TIMING-004 / REQ-API-050): the public `delay` crosses seconds→ms HERE, at the same
|
|
246
|
+
// boundary as every other public time (duration in toTimingConfig/toKeyframesConfig, repeatDelay
|
|
247
|
+
// above) — the rebase consumes milliseconds. Absent reads as 0, the pin's default.
|
|
248
|
+
export function toDelayMs(transition) {
|
|
249
|
+
return (transition.delay ?? 0) * MS_PER_SECOND;
|
|
250
|
+
}
|
|
251
|
+
export function toTimingConfig(transition) {
|
|
252
|
+
const config = {};
|
|
253
|
+
if (transition.duration !== undefined)
|
|
254
|
+
config.duration = transition.duration * MS_PER_SECOND;
|
|
255
|
+
// The scalar TWEEN path takes a SINGLE easing only. A per-segment `ease` LIST (R8 M2-B) is a
|
|
256
|
+
// keyframe-array param carried exclusively by `toKeyframesConfig`; passing a list here would break
|
|
257
|
+
// `resolveEasing` (it expects one easing). A list on a scalar target is a cross-field error caught
|
|
258
|
+
// by `keyframeTimingRefusal`, so dropping it here is safe and keeps the tween path total.
|
|
259
|
+
const ease = effectiveTransitionEase(transition);
|
|
260
|
+
if (ease !== undefined && !isEasingList(ease))
|
|
261
|
+
config.ease = ease;
|
|
262
|
+
return config;
|
|
263
|
+
}
|
|
264
|
+
// transition-default-selection F6: the pin's timing LANE predicate, and the ONE rule both drivers
|
|
265
|
+
// and validation read. `isTransitionDefined` counts an authored duration AND the ease spellings
|
|
266
|
+
// (only the orchestration keys are exempt, is-transition-defined.ts:4-29), and a DEFINED-but-
|
|
267
|
+
// typeless bag resolves through the keyframes/timing generator at the 300ms default
|
|
268
|
+
// (motion-dom@12.42.2 JSAnimation.ts:106-116 `type = keyframesGenerator`,
|
|
269
|
+
// generators/keyframes.ts:25 `duration = 300`) — never the spring backstop. The lane is therefore:
|
|
270
|
+
// type omitted AND (an authored duration OR an authored ease spelling — `ease`/`easings`/`easing`,
|
|
271
|
+
// the 00i0nt alias law). Inertia narrows off by its literal `type`.
|
|
272
|
+
//
|
|
273
|
+
// The duration arm is REQ-TIMING-006's: the pin's `isTransitionDefined({ duration })` is TRUE, so
|
|
274
|
+
// `animateMotionValue` SKIPS the per-key `getDefaultTransition` (the spring, REQ-SPRING-012) and
|
|
275
|
+
// `JSAnimation.initAnimation` falls through `type = keyframesGenerator` (motion-value.ts:68-71,
|
|
276
|
+
// JSAnimation.ts:104,115-116) — an authored scalar transition with `duration` and no `type` runs
|
|
277
|
+
// the keyframes/timing generator, monotone, NEVER a duration-spring. This predicate SUBSUMES that
|
|
278
|
+
// arm; the narrower `isDurationOnlyTransition` it superseded at every call site was removed rather
|
|
279
|
+
// than left as dead exported surface, so do not reintroduce a duration-only predicate here.
|
|
280
|
+
//
|
|
281
|
+
// The ease-only arm is the F6 addition and is why an absent `duration` does NOT imply the spring
|
|
282
|
+
// backstop: `{ ease: 'linear' }` matches. It keeps its authored ease verbatim —
|
|
283
|
+
// `toTimingLaneConfig` injects easeOut ONLY when no spelling is authored, so no injection fires
|
|
284
|
+
// here. An orchestration-only bag matches NEITHER arm and keeps the spring backstop: unreachable
|
|
285
|
+
// on the component path (the controller's flat arm already merged the per-key default under it,
|
|
286
|
+
// REQ-SPRING-012) but held as the defensive default.
|
|
287
|
+
export function isTimingLaneTransition(transition) {
|
|
288
|
+
if (transition.type !== undefined)
|
|
289
|
+
return false;
|
|
290
|
+
if (transition.duration !== undefined)
|
|
291
|
+
return true;
|
|
292
|
+
return effectiveTransitionEase(transition) !== undefined;
|
|
293
|
+
}
|
|
294
|
+
// transition-default-selection F5: the duration-zero half of the pin's `makeAnimationInstant`
|
|
295
|
+
// guard (motion-dom@12.42.2 animation/interfaces/motion-value.ts:89-98 —
|
|
296
|
+
// `(options as any).type === false || (options.duration === 0 && !options.repeatDelay)`; the
|
|
297
|
+
// `type === false` half is the U7a lane, which the drivers check beside this one). The routing is
|
|
298
|
+
// TYPE-INDEPENDENT — a typed spring with `duration: 0` instants too — and honors the pin's
|
|
299
|
+
// truthiness: an authored `repeatDelay: 0` reads as absent. A repeatDelay-bearing bag is EXEMPT:
|
|
300
|
+
// it keeps its normal generator (the pin builds a real animation whose zero-length plays are
|
|
301
|
+
// separated by the repeatDelay gaps).
|
|
302
|
+
export function isDurationZeroInstantTransition(transition) {
|
|
303
|
+
if (transition.type === 'inertia')
|
|
304
|
+
return false;
|
|
305
|
+
return transition.duration === 0 && !transition.repeatDelay;
|
|
306
|
+
}
|
|
307
|
+
// REQ-TIMING-006 + transition-default-selection F1: the timing LANE's config — the ONE builder
|
|
308
|
+
// every timing-lane consumer reads (both drivers' scalar arms, the presence exit lane). The pin's
|
|
309
|
+
// `animateMotionValue` options base is `{ keyframes: [null, target], ease: "easeOut", ...valueTransition }`
|
|
310
|
+
// (motion-dom@12.42.2 motion-value.ts:45-49), so only an AUTHORED ease spelling overrides:
|
|
311
|
+
// whenever the timing lane is selected — a typed tween OR a duration-only untyped bag — and no
|
|
312
|
+
// ease spelling is authored, the ease is [0, 0, 0.58, 1], never the generator default
|
|
313
|
+
// [0.25, 0.1, 0.35, 1] (REQ-TIMING-002, whose default now governs only the pin's per-key default
|
|
314
|
+
// tween, default-transitions.ts:35-48). Any authored spelling (`ease`/`easings`/`easing`, the
|
|
315
|
+
// 00i0nt alias law) suppresses the injection. Mirrors the sealed layout-lane law (REQ-LAYOUT-023
|
|
316
|
+
// a, 7htzcf).
|
|
317
|
+
export function toTimingLaneConfig(transition) {
|
|
318
|
+
const config = toTimingConfig(transition);
|
|
319
|
+
if (effectiveTransitionEase(transition) === undefined)
|
|
320
|
+
config.ease = 'easeOut';
|
|
321
|
+
return config;
|
|
322
|
+
}
|
|
323
|
+
// Bridge the public `Transition` to the internal `KeyframesConfig` (the multi-keyframe timing path,
|
|
324
|
+
// REQ-API-033). `duration` crosses seconds→ms; `ease` passes through — a single easing (applied to
|
|
325
|
+
// every segment) OR a per-SEGMENT list (R8 M2-B, law d); `times` (custom 0–1 offsets) passes through
|
|
326
|
+
// as-is (offsets are unitless, no seconds→ms crossing). Absent fields omitted
|
|
327
|
+
// (exactOptionalPropertyTypes). Shape validation happens before this bridge; target-count fallback is
|
|
328
|
+
// owned by the shared core/UI keyframe normalization seam.
|
|
329
|
+
export function toKeyframesConfig(transition) {
|
|
330
|
+
const config = {};
|
|
331
|
+
if (transition.duration !== undefined)
|
|
332
|
+
config.duration = transition.duration * MS_PER_SECOND;
|
|
333
|
+
const ease = effectiveTransitionEase(transition);
|
|
334
|
+
if (ease !== undefined)
|
|
335
|
+
config.ease = ease;
|
|
336
|
+
if (transition.times !== undefined)
|
|
337
|
+
config.times = transition.times;
|
|
338
|
+
return config;
|
|
339
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// SPEC-COMPONENT §2 — the end-state public API types (REQ-API-006/015). This is the "Motion's API on top"
|
|
3
|
+
// authoring surface: the declarative `Target` an author writes for `initial`/`animate`/`exit`, and the
|
|
4
|
+
// `Transition` config. The types admit ONLY the universal-subset properties (REQ-SUBSET-011) with their
|
|
5
|
+
// value shapes — there is NO permissive index signature and NO `any` escape hatch, so an unknown key or a
|
|
6
|
+
// wrong-shaped value is a compile error where statically possible (REQ-API-015). Runtime `validateTarget`
|
|
7
|
+
// (REQ-API-013) is the fail-closed backstop for what the type cannot catch (units, ranges, untyped
|
|
8
|
+
// callers). Host-agnostic (REQ-CORE-003): the public `Transition` uses Motion's SECONDS unit — the internal
|
|
9
|
+
// millisecond SPRING/TIMING resolver config is a DISTINCT type, bridged at an explicit boundary
|
|
10
|
+
// (`./transition`), never leaked into this public surface. Imports no host package.
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ORCHESTRATION_OPTION_KEYS = exports.TRANSITION_OPTION_KEYS = exports.TARGET_PROPERTY_KEYS = void 0;
|
|
13
|
+
// The universal target-property keys, grouped by the value shape an author may write. They mirror the
|
|
14
|
+
// SUBSET registry's universal, non-gesture properties (REQ-SUBSET-011); `types.test.ts` asserts this list
|
|
15
|
+
// is EXACTLY the registry's, so the compile-time `Target` type and the runtime membership authority can
|
|
16
|
+
// never drift. Written as literal `const` arrays because the registry stores keys widened to `string` and
|
|
17
|
+
// cannot furnish a literal key union — this is the single literal source the `Target` type is built from.
|
|
18
|
+
const LENGTH_KEYS = [
|
|
19
|
+
'x',
|
|
20
|
+
'y',
|
|
21
|
+
'perspective',
|
|
22
|
+
'width',
|
|
23
|
+
'height',
|
|
24
|
+
'top',
|
|
25
|
+
'right',
|
|
26
|
+
'bottom',
|
|
27
|
+
'left',
|
|
28
|
+
'borderRadius',
|
|
29
|
+
'borderTopLeftRadius',
|
|
30
|
+
'borderTopRightRadius',
|
|
31
|
+
'borderBottomLeftRadius',
|
|
32
|
+
'borderBottomRightRadius',
|
|
33
|
+
'borderWidth',
|
|
34
|
+
'borderTopWidth',
|
|
35
|
+
'borderRightWidth',
|
|
36
|
+
'borderBottomWidth',
|
|
37
|
+
'borderLeftWidth',
|
|
38
|
+
'margin',
|
|
39
|
+
'marginTop',
|
|
40
|
+
'marginRight',
|
|
41
|
+
'marginBottom',
|
|
42
|
+
'marginLeft',
|
|
43
|
+
'padding',
|
|
44
|
+
'paddingTop',
|
|
45
|
+
'paddingRight',
|
|
46
|
+
'paddingBottom',
|
|
47
|
+
'paddingLeft',
|
|
48
|
+
];
|
|
49
|
+
const UNITLESS_KEYS = ['scale', 'scaleX', 'scaleY', 'opacity'];
|
|
50
|
+
const ANGLE_KEYS = ['rotate', 'rotateX', 'rotateY', 'skewX', 'skewY'];
|
|
51
|
+
const COLOR_KEYS = ['backgroundColor', 'color', 'borderColor'];
|
|
52
|
+
const DISCRETE_KEYS = ['display', 'visibility'];
|
|
53
|
+
// Runtime enumeration of every universal target-property key — the drift guard's compile-time↔runtime
|
|
54
|
+
// bridge, and the key set `validateTarget`/`resolveTarget` iterate. Deep-immutable (readonly, `as const`).
|
|
55
|
+
exports.TARGET_PROPERTY_KEYS = [
|
|
56
|
+
...LENGTH_KEYS,
|
|
57
|
+
...UNITLESS_KEYS,
|
|
58
|
+
...ANGLE_KEYS,
|
|
59
|
+
...COLOR_KEYS,
|
|
60
|
+
...DISCRETE_KEYS,
|
|
61
|
+
];
|
|
62
|
+
// This data is the runtime-readable counterpart of Transition below. Native's public-surface
|
|
63
|
+
// verifier consumes it directly, so parity tooling cannot invent a second transition vocabulary.
|
|
64
|
+
exports.TRANSITION_OPTION_KEYS = [
|
|
65
|
+
'type',
|
|
66
|
+
'duration',
|
|
67
|
+
'delay',
|
|
68
|
+
'ease',
|
|
69
|
+
// Family-2 shipping slice: Motion authors sometimes spell the per-segment list `easings`
|
|
70
|
+
// (catalog Animation-keyframes). Runtime treats it as an alias of `ease` (same shape law).
|
|
71
|
+
'easings',
|
|
72
|
+
// T20 (REQ-API-052): catalog spelling `easing` (Benchmark-cold-start-motion). Same exclusive
|
|
73
|
+
// alias law as `easings`; converters normalize to `ease`.
|
|
74
|
+
'easing',
|
|
75
|
+
// R8 M2-B (REQ-API-033 law d): custom keyframe OFFSETS for a keyframe-array target. Keyframe-only —
|
|
76
|
+
// the layout lane never interpolates a keyframe array, so `times` is a PROPERTY-lane option, absent
|
|
77
|
+
// from the layout transition domain (shippedSurface.ts).
|
|
78
|
+
'times',
|
|
79
|
+
'stiffness',
|
|
80
|
+
'damping',
|
|
81
|
+
'mass',
|
|
82
|
+
'bounce',
|
|
83
|
+
'visualDuration',
|
|
84
|
+
'velocity',
|
|
85
|
+
// U7c (REQ-SPRING-014): the authored settle thresholds — spring physics options routed into
|
|
86
|
+
// the solver's settle condition, forwarded untransformed (the velocity precedent).
|
|
87
|
+
'restDelta',
|
|
88
|
+
'restSpeed',
|
|
89
|
+
// T18-a (REQ-API-049): the repeat family. PROPERTY-lane options — the layout/layoutId lanes
|
|
90
|
+
// refuse them rather than fold a snapshot delta (packet L4), so they are absent from the layout
|
|
91
|
+
// transition domain (shippedSurface.ts).
|
|
92
|
+
'repeat',
|
|
93
|
+
'repeatType',
|
|
94
|
+
'repeatDelay',
|
|
95
|
+
// T21 (REQ-API-053): the orchestration family — TREE-lane options consumed at the controlling
|
|
96
|
+
// node's start scheduling, never by a driver (the converters strip them, per-value map entries
|
|
97
|
+
// refuse them, and the layout lanes never list them).
|
|
98
|
+
'when',
|
|
99
|
+
'delayChildren',
|
|
100
|
+
'staggerChildren',
|
|
101
|
+
'staggerDirection',
|
|
102
|
+
// U8 (REQ-API-059): parametric path factory (`arc()`). PROPERTY-lane / element bag only;
|
|
103
|
+
// nested map entries and layout bags refuse (F3).
|
|
104
|
+
'path',
|
|
105
|
+
];
|
|
106
|
+
// T21 (REQ-API-053): the tree-lane subset of the vocabulary, single-sourced so the validator's
|
|
107
|
+
// map-entry refusal, the native controller's driver-strip, and the web shim's pass-through all
|
|
108
|
+
// branch on the same set.
|
|
109
|
+
exports.ORCHESTRATION_OPTION_KEYS = [
|
|
110
|
+
'when',
|
|
111
|
+
'delayChildren',
|
|
112
|
+
'staggerChildren',
|
|
113
|
+
'staggerDirection',
|
|
114
|
+
];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { RepeatType } from "../repeat.cjs";
|
|
2
|
+
import type { Easing } from "../timing.cjs";
|
|
3
|
+
declare const LENGTH_KEYS: readonly ["x", "y", "perspective", "width", "height", "top", "right", "bottom", "left", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "borderWidth", "borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth", "margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"];
|
|
4
|
+
declare const UNITLESS_KEYS: readonly ["scale", "scaleX", "scaleY", "opacity"];
|
|
5
|
+
declare const ANGLE_KEYS: readonly ["rotate", "rotateX", "rotateY", "skewX", "skewY"];
|
|
6
|
+
declare const COLOR_KEYS: readonly ["backgroundColor", "color", "borderColor"];
|
|
7
|
+
declare const DISCRETE_KEYS: readonly ["display", "visibility"];
|
|
8
|
+
type LengthValue = number | string;
|
|
9
|
+
type AngleValue = number | string;
|
|
10
|
+
type UnitlessValue = number;
|
|
11
|
+
type ColorValue = string;
|
|
12
|
+
type DiscreteValue = string;
|
|
13
|
+
type Keyframes<V> = V | readonly (V | null)[];
|
|
14
|
+
export type TransitionEndTarget = Partial<Record<(typeof LENGTH_KEYS)[number], LengthValue>> & Partial<Record<(typeof UNITLESS_KEYS)[number], UnitlessValue>> & Partial<Record<(typeof ANGLE_KEYS)[number], AngleValue>> & Partial<Record<(typeof COLOR_KEYS)[number], ColorValue>> & Partial<Record<(typeof DISCRETE_KEYS)[number], DiscreteValue>>;
|
|
15
|
+
export type Target = Partial<Record<(typeof LENGTH_KEYS)[number], Keyframes<LengthValue>>> & Partial<Record<(typeof UNITLESS_KEYS)[number], Keyframes<UnitlessValue>>> & Partial<Record<(typeof ANGLE_KEYS)[number], Keyframes<AngleValue>>> & Partial<Record<(typeof COLOR_KEYS)[number], Keyframes<ColorValue>>> & Partial<Record<(typeof DISCRETE_KEYS)[number], Keyframes<DiscreteValue>>> & {
|
|
16
|
+
readonly transitionEnd?: TransitionEndTarget;
|
|
17
|
+
};
|
|
18
|
+
export declare const TARGET_PROPERTY_KEYS: readonly string[];
|
|
19
|
+
export type TransitionType = 'spring' | 'tween' | false;
|
|
20
|
+
export declare const TRANSITION_OPTION_KEYS: readonly ["type", "duration", "delay", "ease", "easings", "easing", "times", "stiffness", "damping", "mass", "bounce", "visualDuration", "velocity", "restDelta", "restSpeed", "repeat", "repeatType", "repeatDelay", "when", "delayChildren", "staggerChildren", "staggerDirection", "path"];
|
|
21
|
+
export declare const ORCHESTRATION_OPTION_KEYS: readonly ["when", "delayChildren", "staggerChildren", "staggerDirection"];
|
|
22
|
+
export interface TransitionOptionBag {
|
|
23
|
+
readonly type?: TransitionType;
|
|
24
|
+
readonly duration?: number;
|
|
25
|
+
readonly delay?: number;
|
|
26
|
+
readonly ease?: Easing | readonly Easing[];
|
|
27
|
+
readonly easings?: Easing | readonly Easing[];
|
|
28
|
+
readonly easing?: Easing | readonly Easing[];
|
|
29
|
+
readonly times?: readonly number[];
|
|
30
|
+
readonly stiffness?: number;
|
|
31
|
+
readonly damping?: number;
|
|
32
|
+
readonly mass?: number;
|
|
33
|
+
readonly bounce?: number;
|
|
34
|
+
readonly visualDuration?: number;
|
|
35
|
+
readonly velocity?: number;
|
|
36
|
+
readonly restDelta?: number;
|
|
37
|
+
readonly restSpeed?: number;
|
|
38
|
+
readonly repeat?: number;
|
|
39
|
+
readonly repeatType?: RepeatType;
|
|
40
|
+
readonly repeatDelay?: number;
|
|
41
|
+
readonly when?: false | 'beforeChildren' | 'afterChildren';
|
|
42
|
+
readonly delayChildren?: number | import('./orchestration').DynamicDelay;
|
|
43
|
+
readonly staggerChildren?: number;
|
|
44
|
+
readonly staggerDirection?: 1 | -1;
|
|
45
|
+
readonly path?: unknown;
|
|
46
|
+
readonly inherit?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export type TargetPropertyKey = (typeof LENGTH_KEYS)[number] | (typeof UNITLESS_KEYS)[number] | (typeof ANGLE_KEYS)[number] | (typeof COLOR_KEYS)[number];
|
|
49
|
+
export type TransitionMapKey = 'default' | 'layout' | TargetPropertyKey;
|
|
50
|
+
export type Transition = Omit<TransitionOptionBag, 'inherit'> & Partial<Record<TransitionMapKey, TransitionOptionBag>>;
|
|
51
|
+
export type VariantLabels = string | readonly string[];
|
|
52
|
+
export interface MotionTargetProps {
|
|
53
|
+
readonly initial?: Target | VariantLabels | false;
|
|
54
|
+
readonly animate?: Target | VariantLabels | boolean;
|
|
55
|
+
readonly exit?: Target | VariantLabels;
|
|
56
|
+
readonly transition?: Transition;
|
|
57
|
+
readonly variants?: import('./variants').VariantsDictionary;
|
|
58
|
+
readonly inherit?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { RepeatType } from "../repeat.js";
|
|
2
|
+
import type { Easing } from "../timing.js";
|
|
3
|
+
declare const LENGTH_KEYS: readonly ["x", "y", "perspective", "width", "height", "top", "right", "bottom", "left", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "borderWidth", "borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth", "margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"];
|
|
4
|
+
declare const UNITLESS_KEYS: readonly ["scale", "scaleX", "scaleY", "opacity"];
|
|
5
|
+
declare const ANGLE_KEYS: readonly ["rotate", "rotateX", "rotateY", "skewX", "skewY"];
|
|
6
|
+
declare const COLOR_KEYS: readonly ["backgroundColor", "color", "borderColor"];
|
|
7
|
+
declare const DISCRETE_KEYS: readonly ["display", "visibility"];
|
|
8
|
+
type LengthValue = number | string;
|
|
9
|
+
type AngleValue = number | string;
|
|
10
|
+
type UnitlessValue = number;
|
|
11
|
+
type ColorValue = string;
|
|
12
|
+
type DiscreteValue = string;
|
|
13
|
+
type Keyframes<V> = V | readonly (V | null)[];
|
|
14
|
+
export type TransitionEndTarget = Partial<Record<(typeof LENGTH_KEYS)[number], LengthValue>> & Partial<Record<(typeof UNITLESS_KEYS)[number], UnitlessValue>> & Partial<Record<(typeof ANGLE_KEYS)[number], AngleValue>> & Partial<Record<(typeof COLOR_KEYS)[number], ColorValue>> & Partial<Record<(typeof DISCRETE_KEYS)[number], DiscreteValue>>;
|
|
15
|
+
export type Target = Partial<Record<(typeof LENGTH_KEYS)[number], Keyframes<LengthValue>>> & Partial<Record<(typeof UNITLESS_KEYS)[number], Keyframes<UnitlessValue>>> & Partial<Record<(typeof ANGLE_KEYS)[number], Keyframes<AngleValue>>> & Partial<Record<(typeof COLOR_KEYS)[number], Keyframes<ColorValue>>> & Partial<Record<(typeof DISCRETE_KEYS)[number], Keyframes<DiscreteValue>>> & {
|
|
16
|
+
readonly transitionEnd?: TransitionEndTarget;
|
|
17
|
+
};
|
|
18
|
+
export declare const TARGET_PROPERTY_KEYS: readonly string[];
|
|
19
|
+
export type TransitionType = 'spring' | 'tween' | false;
|
|
20
|
+
export declare const TRANSITION_OPTION_KEYS: readonly ["type", "duration", "delay", "ease", "easings", "easing", "times", "stiffness", "damping", "mass", "bounce", "visualDuration", "velocity", "restDelta", "restSpeed", "repeat", "repeatType", "repeatDelay", "when", "delayChildren", "staggerChildren", "staggerDirection", "path"];
|
|
21
|
+
export declare const ORCHESTRATION_OPTION_KEYS: readonly ["when", "delayChildren", "staggerChildren", "staggerDirection"];
|
|
22
|
+
export interface TransitionOptionBag {
|
|
23
|
+
readonly type?: TransitionType;
|
|
24
|
+
readonly duration?: number;
|
|
25
|
+
readonly delay?: number;
|
|
26
|
+
readonly ease?: Easing | readonly Easing[];
|
|
27
|
+
readonly easings?: Easing | readonly Easing[];
|
|
28
|
+
readonly easing?: Easing | readonly Easing[];
|
|
29
|
+
readonly times?: readonly number[];
|
|
30
|
+
readonly stiffness?: number;
|
|
31
|
+
readonly damping?: number;
|
|
32
|
+
readonly mass?: number;
|
|
33
|
+
readonly bounce?: number;
|
|
34
|
+
readonly visualDuration?: number;
|
|
35
|
+
readonly velocity?: number;
|
|
36
|
+
readonly restDelta?: number;
|
|
37
|
+
readonly restSpeed?: number;
|
|
38
|
+
readonly repeat?: number;
|
|
39
|
+
readonly repeatType?: RepeatType;
|
|
40
|
+
readonly repeatDelay?: number;
|
|
41
|
+
readonly when?: false | 'beforeChildren' | 'afterChildren';
|
|
42
|
+
readonly delayChildren?: number | import('./orchestration').DynamicDelay;
|
|
43
|
+
readonly staggerChildren?: number;
|
|
44
|
+
readonly staggerDirection?: 1 | -1;
|
|
45
|
+
readonly path?: unknown;
|
|
46
|
+
readonly inherit?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export type TargetPropertyKey = (typeof LENGTH_KEYS)[number] | (typeof UNITLESS_KEYS)[number] | (typeof ANGLE_KEYS)[number] | (typeof COLOR_KEYS)[number];
|
|
49
|
+
export type TransitionMapKey = 'default' | 'layout' | TargetPropertyKey;
|
|
50
|
+
export type Transition = Omit<TransitionOptionBag, 'inherit'> & Partial<Record<TransitionMapKey, TransitionOptionBag>>;
|
|
51
|
+
export type VariantLabels = string | readonly string[];
|
|
52
|
+
export interface MotionTargetProps {
|
|
53
|
+
readonly initial?: Target | VariantLabels | false;
|
|
54
|
+
readonly animate?: Target | VariantLabels | boolean;
|
|
55
|
+
readonly exit?: Target | VariantLabels;
|
|
56
|
+
readonly transition?: Transition;
|
|
57
|
+
readonly variants?: import('./variants').VariantsDictionary;
|
|
58
|
+
readonly inherit?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export {};
|