@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
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Public surface of @unrulysystems/native-motion-core — the host-agnostic motion graph (SPEC-CORE).
|
|
3
|
+
// Zero host dependencies (REQ-CORE-003): nothing re-exported here reaches react-native / reanimated
|
|
4
|
+
// / gesture-handler / motion / react.
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
39
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.arc = exports.wrap = exports.motionMix = exports.delayGenerator = exports.MAX_ITERATION_DURATION_MS = exports.ITERATION_SCAN_STEP_MS = exports.repeatIterationRefusal = exports.repeatGenerator = exports.repeatFoldGeometry = exports.calcIterationDurationMs = exports.buildRepeatedGenerator = exports.keyframesGenerator = exports.NAMED_EASING_KEYS = exports.timingGenerator = exports.parseTransformTemplateOutput = exports.buildTransformTemplateArgs = exports.buildTransformString = exports.inertiaGenerator = exports.dragInertiaBounce = exports.DRAG_INERTIA_DEFAULTS = exports.springKeyframeCountRefusal = exports.getDefaultTransition = exports.retargetSpring = exports.resolveSpringGenerator = exports.resolveSpring = exports.assertTwoKeyframes = exports.springGenerator = exports.constants = exports.collectMotionValueReads = exports.ManualScheduler = exports.ManualClock = exports.createMotionGraph = exports.VERSION = void 0;
|
|
43
|
+
exports.VERSION = '0.0.0';
|
|
44
|
+
var graph_1 = require("./graph.cjs");
|
|
45
|
+
Object.defineProperty(exports, "createMotionGraph", { enumerable: true, get: function () { return graph_1.createMotionGraph; } });
|
|
46
|
+
var clock_1 = require("./clock.cjs");
|
|
47
|
+
Object.defineProperty(exports, "ManualClock", { enumerable: true, get: function () { return clock_1.ManualClock; } });
|
|
48
|
+
Object.defineProperty(exports, "ManualScheduler", { enumerable: true, get: function () { return clock_1.ManualScheduler; } });
|
|
49
|
+
// Reactive-derived dependency collection (REQ-API-027's `useTransform(() => expr)` form): records
|
|
50
|
+
// the MotionValues actually read by a compute. Additive; reads outside a collection are untouched.
|
|
51
|
+
var collect_reads_1 = require("./collect-reads.cjs");
|
|
52
|
+
Object.defineProperty(exports, "collectMotionValueReads", { enumerable: true, get: function () { return collect_reads_1.collectMotionValueReads; } });
|
|
53
|
+
exports.constants = __importStar(require("./config/constants.cjs"));
|
|
54
|
+
// SPEC-SPRING animation-value engine (analytic solver; resolvers/timing/interruption land here too).
|
|
55
|
+
var spring_1 = require("./spring.cjs");
|
|
56
|
+
Object.defineProperty(exports, "springGenerator", { enumerable: true, get: function () { return spring_1.springGenerator; } });
|
|
57
|
+
Object.defineProperty(exports, "assertTwoKeyframes", { enumerable: true, get: function () { return spring_1.assertTwoKeyframes; } });
|
|
58
|
+
// SPEC-SPRING config resolution (REQ-SPRING-004/005/006/007/012) + interruption seam (REQ-SPRING-009).
|
|
59
|
+
var transition_1 = require("./transition.cjs");
|
|
60
|
+
Object.defineProperty(exports, "resolveSpring", { enumerable: true, get: function () { return transition_1.resolveSpring; } });
|
|
61
|
+
Object.defineProperty(exports, "resolveSpringGenerator", { enumerable: true, get: function () { return transition_1.resolveSpringGenerator; } });
|
|
62
|
+
Object.defineProperty(exports, "retargetSpring", { enumerable: true, get: function () { return transition_1.retargetSpring; } });
|
|
63
|
+
Object.defineProperty(exports, "getDefaultTransition", { enumerable: true, get: function () { return transition_1.getDefaultTransition; } });
|
|
64
|
+
Object.defineProperty(exports, "springKeyframeCountRefusal", { enumerable: true, get: function () { return transition_1.springKeyframeCountRefusal; } });
|
|
65
|
+
Object.defineProperty(exports, "DRAG_INERTIA_DEFAULTS", { enumerable: true, get: function () { return transition_1.DRAG_INERTIA_DEFAULTS; } });
|
|
66
|
+
Object.defineProperty(exports, "dragInertiaBounce", { enumerable: true, get: function () { return transition_1.dragInertiaBounce; } });
|
|
67
|
+
// SPEC-GESTURE two-phase inertia generator (REQ-GESTURE-016/-023/-027, R16 — the gesture
|
|
68
|
+
// free-drag release curve; golden-pinned to motion-dom@12.42.2 `inertia()`).
|
|
69
|
+
var inertia_1 = require("./inertia.cjs");
|
|
70
|
+
Object.defineProperty(exports, "inertiaGenerator", { enumerable: true, get: function () { return inertia_1.inertiaGenerator; } });
|
|
71
|
+
// T17 bounded transform-template support (the canonical generated-string builder + the bounded
|
|
72
|
+
// template-output parser; specs/T17-TRANSFORM-TEMPLATE-BUILD-PACKET.md).
|
|
73
|
+
var transformTemplate_1 = require("./transformTemplate.cjs");
|
|
74
|
+
Object.defineProperty(exports, "buildTransformString", { enumerable: true, get: function () { return transformTemplate_1.buildTransformString; } });
|
|
75
|
+
Object.defineProperty(exports, "buildTransformTemplateArgs", { enumerable: true, get: function () { return transformTemplate_1.buildTransformTemplateArgs; } });
|
|
76
|
+
Object.defineProperty(exports, "parseTransformTemplateOutput", { enumerable: true, get: function () { return transformTemplate_1.parseTransformTemplateOutput; } });
|
|
77
|
+
// SPEC-SPRING duration+ease timing generator (REQ-TIMING-001/002).
|
|
78
|
+
var timing_1 = require("./timing.cjs");
|
|
79
|
+
Object.defineProperty(exports, "timingGenerator", { enumerable: true, get: function () { return timing_1.timingGenerator; } });
|
|
80
|
+
Object.defineProperty(exports, "NAMED_EASING_KEYS", { enumerable: true, get: function () { return timing_1.NAMED_EASING_KEYS; } });
|
|
81
|
+
// SPEC-COMPONENT multi-keyframe timing generator (REQ-API-033, R8 — array targets).
|
|
82
|
+
var keyframes_1 = require("./keyframes.cjs");
|
|
83
|
+
Object.defineProperty(exports, "keyframesGenerator", { enumerable: true, get: function () { return keyframes_1.keyframesGenerator; } });
|
|
84
|
+
// T18-a repeat elapsed-time fold (REQ-TIMING-003): the pure `t → t'` map that wraps ANY generator
|
|
85
|
+
// to implement repeat/repeatType/repeatDelay, so no generator learns about repetition.
|
|
86
|
+
var repeat_1 = require("./repeat.cjs");
|
|
87
|
+
Object.defineProperty(exports, "buildRepeatedGenerator", { enumerable: true, get: function () { return repeat_1.buildRepeatedGenerator; } });
|
|
88
|
+
Object.defineProperty(exports, "calcIterationDurationMs", { enumerable: true, get: function () { return repeat_1.calcIterationDurationMs; } });
|
|
89
|
+
Object.defineProperty(exports, "repeatFoldGeometry", { enumerable: true, get: function () { return repeat_1.repeatFoldGeometry; } });
|
|
90
|
+
Object.defineProperty(exports, "repeatGenerator", { enumerable: true, get: function () { return repeat_1.repeatGenerator; } });
|
|
91
|
+
Object.defineProperty(exports, "repeatIterationRefusal", { enumerable: true, get: function () { return repeat_1.repeatIterationRefusal; } });
|
|
92
|
+
Object.defineProperty(exports, "ITERATION_SCAN_STEP_MS", { enumerable: true, get: function () { return repeat_1.ITERATION_SCAN_STEP_MS; } });
|
|
93
|
+
Object.defineProperty(exports, "MAX_ITERATION_DURATION_MS", { enumerable: true, get: function () { return repeat_1.MAX_ITERATION_DURATION_MS; } });
|
|
94
|
+
// T18-b delay elapsed-time rebase (REQ-TIMING-004): the pure `t → t − delay` shift that wraps ANY
|
|
95
|
+
// generator or fold to implement transition.delay, so no generator learns about delay.
|
|
96
|
+
var delay_1 = require("./delay.cjs");
|
|
97
|
+
Object.defineProperty(exports, "delayGenerator", { enumerable: true, get: function () { return delay_1.delayGenerator; } });
|
|
98
|
+
// U7a: the authored `{ type: false }` instant lane (the pin's makeAnimationInstant) — no
|
|
99
|
+
// trajectory generator; the final keyframe commits on the driver's next update tick, delay
|
|
100
|
+
// honored. Backend machinery: exported through the internal-driver subpath, never the root.
|
|
101
|
+
// SPEC-VALUE-TYPES typed value parsers + gamma-aware mixers (REQ-VALUETYPE-*): the unified mix() seam
|
|
102
|
+
// SPRING's scalar progress feeds, for numbers/units/colors/complex strings. Host-agnostic
|
|
103
|
+
// (REQ-VALUETYPE-011). Additive — no existing core / SPRING / M1a / M1b API changed.
|
|
104
|
+
__exportStar(require("./value-types/index.cjs"), exports);
|
|
105
|
+
// T23 A: the public Motion `mix` utility (pin motion-dom/utils/mix), executing through the value
|
|
106
|
+
// seam above. The product entries alias it to `mix`; the core-root `mix` name stays the typed seam.
|
|
107
|
+
var motion_mix_1 = require("./motion-mix.cjs");
|
|
108
|
+
Object.defineProperty(exports, "motionMix", { enumerable: true, get: function () { return motion_mix_1.motionMix; } });
|
|
109
|
+
// T24 W: the public Motion `wrap` utility (pin motion-utils/wrap, public via the dom barrel).
|
|
110
|
+
var wrap_1 = require("./wrap.cjs");
|
|
111
|
+
Object.defineProperty(exports, "wrap", { enumerable: true, get: function () { return wrap_1.wrap; } });
|
|
112
|
+
// U8 (REQ-API-059): public `arc()` factory. The UI sampler and brand predicate ride
|
|
113
|
+
// internal-driver (worklet + controller), never the consumer root.
|
|
114
|
+
var motion_arc_1 = require("./motion-arc.cjs");
|
|
115
|
+
Object.defineProperty(exports, "arc", { enumerable: true, get: function () { return motion_arc_1.arc; } });
|
|
116
|
+
// SPEC-UNIVERSAL-SUBSET frozen registry (REQ-SUBSET-010): the single source of truth for which
|
|
117
|
+
// properties/gestures are guaranteed identical across engines, their web-engine path, and their native
|
|
118
|
+
// mapping. Host-agnostic; the Motion-seam canary + authoring gate read it from conformance. Additive.
|
|
119
|
+
__exportStar(require("./subset/index.cjs"), exports);
|
|
120
|
+
// SPEC-COMPONENT declarative API contract (REQ-API-006/015): the end-state public Target/Transition/prop
|
|
121
|
+
// types (Milestone 1); validateTarget + resolveTarget join here as they land. Host-agnostic. Additive.
|
|
122
|
+
__exportStar(require("./component/index.cjs"), exports);
|
|
123
|
+
// SPEC-NATIVE-DRIVER host-agnostic Driver seam (REQ-DRIVER-010): the interface `core` defines and the
|
|
124
|
+
// native worklet / web drivers implement (the pure step + reference driver join as they land). Additive.
|
|
125
|
+
__exportStar(require("./driver/index.cjs"), exports);
|
|
126
|
+
// SPEC-PRESENCE host-agnostic exit-lifecycle controller (REQ-PRESENCE-001): the total present→exiting→removed
|
|
127
|
+
// state machine + controller `core` defines; the React usePresence/useIsPresent hooks bind over it (M2).
|
|
128
|
+
// Host-agnostic — no react/driver import. Additive.
|
|
129
|
+
__exportStar(require("./presence/index.cjs"), exports);
|
|
130
|
+
// SPEC-GESTURE host-agnostic gesture session (REQ-GESTURE-001): the pure gesture math + the begin→active→
|
|
131
|
+
// end/cancel session that drives a motion value from a recognizer sample stream and hands off the platform
|
|
132
|
+
// release velocity (§G) into a settling spring. The Gesture-Handler / motion-react bindings bind over it
|
|
133
|
+
// (M2). Host-agnostic — no react/Gesture-Handler/driver import. Additive.
|
|
134
|
+
__exportStar(require("./gesture/index.cjs"), exports);
|
|
135
|
+
// SPEC-LAYOUT host-agnostic projection engine (REQ-LAYOUT-001): the pure FLIP projection math + (as they
|
|
136
|
+
// land) parent-relative compose, measurement lifecycle, and the projection session that drives the visual
|
|
137
|
+
// delta to zero through a progress spring so an element lands on its host-computed layout. The Fabric
|
|
138
|
+
// measure adapter feeds common-space rects to layout identity (M2); this never imports a host
|
|
139
|
+
// measure API. Additive.
|
|
140
|
+
__exportStar(require("./layout/index.cjs"), exports);
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const VERSION = "0.0.0";
|
|
2
|
+
export type { ActivityHandle, Animation, Clock, Generator, GeneratorFactory, GeneratorSample, GeneratorSeed, MotionGraph, MotionGraphOptions, DerivedMotionValue, DerivedSource, DerivedSourceValues, MotionValue, MotionValueEvent, Scheduler, ValueChangeListener, } from "./types.cjs";
|
|
3
|
+
export { createMotionGraph } from "./graph.cjs";
|
|
4
|
+
export { ManualClock, ManualScheduler } from "./clock.cjs";
|
|
5
|
+
export { collectMotionValueReads } from "./collect-reads.cjs";
|
|
6
|
+
export type { CollectedReads } from "./collect-reads.cjs";
|
|
7
|
+
export * as constants from "./config/constants.cjs";
|
|
8
|
+
export { springGenerator, assertTwoKeyframes } from "./spring.cjs";
|
|
9
|
+
export type { SpringPhysics, SpringSettleOptions } from "./spring.cjs";
|
|
10
|
+
export { resolveSpring, resolveSpringGenerator, retargetSpring, getDefaultTransition, springKeyframeCountRefusal, DRAG_INERTIA_DEFAULTS, dragInertiaBounce, } from "./transition.cjs";
|
|
11
|
+
export type { SpringConfig, ResolvedSpring, DefaultTransition, InertiaTransition, } from "./transition.cjs";
|
|
12
|
+
export { inertiaGenerator } from "./inertia.cjs";
|
|
13
|
+
export type { InertiaPhysics } from "./inertia.cjs";
|
|
14
|
+
export { buildTransformString, buildTransformTemplateArgs, parseTransformTemplateOutput, } from "./transformTemplate.cjs";
|
|
15
|
+
export type { TransformEntry, TransformProperties, TransformPropertyKey, TransformTemplate, TransformTemplateArgs, TransformTemplateValues, } from "./transformTemplate.cjs";
|
|
16
|
+
export { timingGenerator, NAMED_EASING_KEYS } from "./timing.cjs";
|
|
17
|
+
export type { TimingConfig, Easing, CubicBezier, NamedEasing } from "./timing.cjs";
|
|
18
|
+
export { keyframesGenerator } from "./keyframes.cjs";
|
|
19
|
+
export type { KeyframesConfig } from "./keyframes.cjs";
|
|
20
|
+
export { buildRepeatedGenerator, calcIterationDurationMs, repeatFoldGeometry, repeatGenerator, repeatIterationRefusal, ITERATION_SCAN_STEP_MS, MAX_ITERATION_DURATION_MS, } from "./repeat.cjs";
|
|
21
|
+
export type { RepeatFoldConfig, RepeatFoldGeometry, RepeatLeg, RepeatType } from "./repeat.cjs";
|
|
22
|
+
export { delayGenerator } from "./delay.cjs";
|
|
23
|
+
export * from "./value-types/index.cjs";
|
|
24
|
+
export { type MotionMixer, motionMix } from "./motion-mix.cjs";
|
|
25
|
+
export { wrap } from "./wrap.cjs";
|
|
26
|
+
export { arc } from "./motion-arc.cjs";
|
|
27
|
+
export type { ArcOptions } from "./motion-arc.cjs";
|
|
28
|
+
export * from "./subset/index.cjs";
|
|
29
|
+
export * from "./component/index.cjs";
|
|
30
|
+
export * from "./driver/index.cjs";
|
|
31
|
+
export * from "./presence/index.cjs";
|
|
32
|
+
export * from "./gesture/index.cjs";
|
|
33
|
+
export * from "./layout/index.cjs";
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const VERSION = "0.0.0";
|
|
2
|
+
export type { ActivityHandle, Animation, Clock, Generator, GeneratorFactory, GeneratorSample, GeneratorSeed, MotionGraph, MotionGraphOptions, DerivedMotionValue, DerivedSource, DerivedSourceValues, MotionValue, MotionValueEvent, Scheduler, ValueChangeListener, } from "./types.js";
|
|
3
|
+
export { createMotionGraph } from "./graph.js";
|
|
4
|
+
export { ManualClock, ManualScheduler } from "./clock.js";
|
|
5
|
+
export { collectMotionValueReads } from "./collect-reads.js";
|
|
6
|
+
export type { CollectedReads } from "./collect-reads.js";
|
|
7
|
+
export * as constants from "./config/constants.js";
|
|
8
|
+
export { springGenerator, assertTwoKeyframes } from "./spring.js";
|
|
9
|
+
export type { SpringPhysics, SpringSettleOptions } from "./spring.js";
|
|
10
|
+
export { resolveSpring, resolveSpringGenerator, retargetSpring, getDefaultTransition, springKeyframeCountRefusal, DRAG_INERTIA_DEFAULTS, dragInertiaBounce, } from "./transition.js";
|
|
11
|
+
export type { SpringConfig, ResolvedSpring, DefaultTransition, InertiaTransition, } from "./transition.js";
|
|
12
|
+
export { inertiaGenerator } from "./inertia.js";
|
|
13
|
+
export type { InertiaPhysics } from "./inertia.js";
|
|
14
|
+
export { buildTransformString, buildTransformTemplateArgs, parseTransformTemplateOutput, } from "./transformTemplate.js";
|
|
15
|
+
export type { TransformEntry, TransformProperties, TransformPropertyKey, TransformTemplate, TransformTemplateArgs, TransformTemplateValues, } from "./transformTemplate.js";
|
|
16
|
+
export { timingGenerator, NAMED_EASING_KEYS } from "./timing.js";
|
|
17
|
+
export type { TimingConfig, Easing, CubicBezier, NamedEasing } from "./timing.js";
|
|
18
|
+
export { keyframesGenerator } from "./keyframes.js";
|
|
19
|
+
export type { KeyframesConfig } from "./keyframes.js";
|
|
20
|
+
export { buildRepeatedGenerator, calcIterationDurationMs, repeatFoldGeometry, repeatGenerator, repeatIterationRefusal, ITERATION_SCAN_STEP_MS, MAX_ITERATION_DURATION_MS, } from "./repeat.js";
|
|
21
|
+
export type { RepeatFoldConfig, RepeatFoldGeometry, RepeatLeg, RepeatType } from "./repeat.js";
|
|
22
|
+
export { delayGenerator } from "./delay.js";
|
|
23
|
+
export * from "./value-types/index.js";
|
|
24
|
+
export { type MotionMixer, motionMix } from "./motion-mix.js";
|
|
25
|
+
export { wrap } from "./wrap.js";
|
|
26
|
+
export { arc } from "./motion-arc.js";
|
|
27
|
+
export type { ArcOptions } from "./motion-arc.js";
|
|
28
|
+
export * from "./subset/index.js";
|
|
29
|
+
export * from "./component/index.js";
|
|
30
|
+
export * from "./driver/index.js";
|
|
31
|
+
export * from "./presence/index.js";
|
|
32
|
+
export * from "./gesture/index.js";
|
|
33
|
+
export * from "./layout/index.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Public surface of @unrulysystems/native-motion-core — the host-agnostic motion graph (SPEC-CORE).
|
|
2
|
+
// Zero host dependencies (REQ-CORE-003): nothing re-exported here reaches react-native / reanimated
|
|
3
|
+
// / gesture-handler / motion / react.
|
|
4
|
+
export const VERSION = '0.0.0';
|
|
5
|
+
export { createMotionGraph } from "./graph.js";
|
|
6
|
+
export { ManualClock, ManualScheduler } from "./clock.js";
|
|
7
|
+
// Reactive-derived dependency collection (REQ-API-027's `useTransform(() => expr)` form): records
|
|
8
|
+
// the MotionValues actually read by a compute. Additive; reads outside a collection are untouched.
|
|
9
|
+
export { collectMotionValueReads } from "./collect-reads.js";
|
|
10
|
+
export * as constants from "./config/constants.js";
|
|
11
|
+
// SPEC-SPRING animation-value engine (analytic solver; resolvers/timing/interruption land here too).
|
|
12
|
+
export { springGenerator, assertTwoKeyframes } from "./spring.js";
|
|
13
|
+
// SPEC-SPRING config resolution (REQ-SPRING-004/005/006/007/012) + interruption seam (REQ-SPRING-009).
|
|
14
|
+
export { resolveSpring, resolveSpringGenerator, retargetSpring, getDefaultTransition, springKeyframeCountRefusal, DRAG_INERTIA_DEFAULTS, dragInertiaBounce, } from "./transition.js";
|
|
15
|
+
// SPEC-GESTURE two-phase inertia generator (REQ-GESTURE-016/-023/-027, R16 — the gesture
|
|
16
|
+
// free-drag release curve; golden-pinned to motion-dom@12.42.2 `inertia()`).
|
|
17
|
+
export { inertiaGenerator } from "./inertia.js";
|
|
18
|
+
// T17 bounded transform-template support (the canonical generated-string builder + the bounded
|
|
19
|
+
// template-output parser; specs/T17-TRANSFORM-TEMPLATE-BUILD-PACKET.md).
|
|
20
|
+
export { buildTransformString, buildTransformTemplateArgs, parseTransformTemplateOutput, } from "./transformTemplate.js";
|
|
21
|
+
// SPEC-SPRING duration+ease timing generator (REQ-TIMING-001/002).
|
|
22
|
+
export { timingGenerator, NAMED_EASING_KEYS } from "./timing.js";
|
|
23
|
+
// SPEC-COMPONENT multi-keyframe timing generator (REQ-API-033, R8 — array targets).
|
|
24
|
+
export { keyframesGenerator } from "./keyframes.js";
|
|
25
|
+
// T18-a repeat elapsed-time fold (REQ-TIMING-003): the pure `t → t'` map that wraps ANY generator
|
|
26
|
+
// to implement repeat/repeatType/repeatDelay, so no generator learns about repetition.
|
|
27
|
+
export { buildRepeatedGenerator, calcIterationDurationMs, repeatFoldGeometry, repeatGenerator, repeatIterationRefusal, ITERATION_SCAN_STEP_MS, MAX_ITERATION_DURATION_MS, } from "./repeat.js";
|
|
28
|
+
// T18-b delay elapsed-time rebase (REQ-TIMING-004): the pure `t → t − delay` shift that wraps ANY
|
|
29
|
+
// generator or fold to implement transition.delay, so no generator learns about delay.
|
|
30
|
+
export { delayGenerator } from "./delay.js";
|
|
31
|
+
// U7a: the authored `{ type: false }` instant lane (the pin's makeAnimationInstant) — no
|
|
32
|
+
// trajectory generator; the final keyframe commits on the driver's next update tick, delay
|
|
33
|
+
// honored. Backend machinery: exported through the internal-driver subpath, never the root.
|
|
34
|
+
// SPEC-VALUE-TYPES typed value parsers + gamma-aware mixers (REQ-VALUETYPE-*): the unified mix() seam
|
|
35
|
+
// SPRING's scalar progress feeds, for numbers/units/colors/complex strings. Host-agnostic
|
|
36
|
+
// (REQ-VALUETYPE-011). Additive — no existing core / SPRING / M1a / M1b API changed.
|
|
37
|
+
export * from "./value-types/index.js";
|
|
38
|
+
// T23 A: the public Motion `mix` utility (pin motion-dom/utils/mix), executing through the value
|
|
39
|
+
// seam above. The product entries alias it to `mix`; the core-root `mix` name stays the typed seam.
|
|
40
|
+
export { motionMix } from "./motion-mix.js";
|
|
41
|
+
// T24 W: the public Motion `wrap` utility (pin motion-utils/wrap, public via the dom barrel).
|
|
42
|
+
export { wrap } from "./wrap.js";
|
|
43
|
+
// U8 (REQ-API-059): public `arc()` factory. The UI sampler and brand predicate ride
|
|
44
|
+
// internal-driver (worklet + controller), never the consumer root.
|
|
45
|
+
export { arc } from "./motion-arc.js";
|
|
46
|
+
// SPEC-UNIVERSAL-SUBSET frozen registry (REQ-SUBSET-010): the single source of truth for which
|
|
47
|
+
// properties/gestures are guaranteed identical across engines, their web-engine path, and their native
|
|
48
|
+
// mapping. Host-agnostic; the Motion-seam canary + authoring gate read it from conformance. Additive.
|
|
49
|
+
export * from "./subset/index.js";
|
|
50
|
+
// SPEC-COMPONENT declarative API contract (REQ-API-006/015): the end-state public Target/Transition/prop
|
|
51
|
+
// types (Milestone 1); validateTarget + resolveTarget join here as they land. Host-agnostic. Additive.
|
|
52
|
+
export * from "./component/index.js";
|
|
53
|
+
// SPEC-NATIVE-DRIVER host-agnostic Driver seam (REQ-DRIVER-010): the interface `core` defines and the
|
|
54
|
+
// native worklet / web drivers implement (the pure step + reference driver join as they land). Additive.
|
|
55
|
+
export * from "./driver/index.js";
|
|
56
|
+
// SPEC-PRESENCE host-agnostic exit-lifecycle controller (REQ-PRESENCE-001): the total present→exiting→removed
|
|
57
|
+
// state machine + controller `core` defines; the React usePresence/useIsPresent hooks bind over it (M2).
|
|
58
|
+
// Host-agnostic — no react/driver import. Additive.
|
|
59
|
+
export * from "./presence/index.js";
|
|
60
|
+
// SPEC-GESTURE host-agnostic gesture session (REQ-GESTURE-001): the pure gesture math + the begin→active→
|
|
61
|
+
// end/cancel session that drives a motion value from a recognizer sample stream and hands off the platform
|
|
62
|
+
// release velocity (§G) into a settling spring. The Gesture-Handler / motion-react bindings bind over it
|
|
63
|
+
// (M2). Host-agnostic — no react/Gesture-Handler/driver import. Additive.
|
|
64
|
+
export * from "./gesture/index.js";
|
|
65
|
+
// SPEC-LAYOUT host-agnostic projection engine (REQ-LAYOUT-001): the pure FLIP projection math + (as they
|
|
66
|
+
// land) parent-relative compose, measurement lifecycle, and the projection session that drives the visual
|
|
67
|
+
// delta to zero through a progress spring so an element lands on its host-computed layout. The Fabric
|
|
68
|
+
// measure adapter feeds common-space rects to layout identity (M2); this never imports a host
|
|
69
|
+
// measure API. Additive.
|
|
70
|
+
export * from "./layout/index.js";
|
package/dist/inertia.cjs
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @frame-path — executes inside the UI-runtime frame step; allocation-gated (REQ-DRIVER-021).
|
|
3
|
+
// Two-phase inertia generator (SPEC-GESTURE REQ-GESTURE-016/-023/-027, R16 packet): a pure
|
|
4
|
+
// closed-form exponential-decay evaluator with a latched boundary spring, pinned verbatim to
|
|
5
|
+
// motion-dom@12.42.2 `inertia()` under the drag-layer invocation
|
|
6
|
+
// (VisualElementDragControls.startAnimation: timeConstant 750, power 0.8, restDelta 1,
|
|
7
|
+
// restSpeed 10, elastic-conditional bounce pairs). Host-agnostic (REQ-CORE-003): imports nothing
|
|
8
|
+
// from motion/react. Parity is proven by golden traces in inertia.test.ts.
|
|
9
|
+
//
|
|
10
|
+
// Pin semantics (motion-dom inertia.ts, replicated exactly):
|
|
11
|
+
// amplitude = power · velocity (px — the time constant absorbs the unit)
|
|
12
|
+
// target = origin + amplitude (free-drag: no modifyTarget)
|
|
13
|
+
// value(t) = target − amplitude·e^(−t/timeConstant)
|
|
14
|
+
// done = |amplitude·e^(−t/timeConstant)| ≤ restDelta (value snaps to target)
|
|
15
|
+
// Every sample, if the value lies outside [min, max] — INCLUDING a snapped out-of-bounds target —
|
|
16
|
+
// the generator permanently switches to a spring from that value toward the violated bound,
|
|
17
|
+
// seeded with the decay velocity at the crossing instant (stiffness/damping = bounce params).
|
|
18
|
+
// An out-of-bounds origin latches the boundary spring at t=0 (the past-bound release,
|
|
19
|
+
// REQ-GESTURE-016). The decay's initial velocity is amplitude/timeConstant, NOT the seeded
|
|
20
|
+
// velocity — this is the pin's curve, and the goldens hold it.
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.inertiaGenerator = inertiaGenerator;
|
|
23
|
+
// spring.ts's rest-threshold constants (REQ-SPRING-003/-011), pinned to the same motion
|
|
24
|
+
// springDefaults source: the under/critical latch used to defer to springGenerator for this
|
|
25
|
+
// resolution, so the repair reproduces it verbatim — scale switch at |Δ| < 5, granular
|
|
26
|
+
// 0.01/0.005, default 2/0.5, zero-as-absent (`||`, never `??`).
|
|
27
|
+
const BOUNDARY_GRANULAR_SCALE = 5;
|
|
28
|
+
const BOUNDARY_REST_SPEED = { default: 2, granular: 0.01 };
|
|
29
|
+
const BOUNDARY_REST_DELTA = { default: 0.5, granular: 0.005 };
|
|
30
|
+
/**
|
|
31
|
+
* Build an inertia `GeneratorFactory` from pinned physics. The seed supplies the origin (`from`)
|
|
32
|
+
* and the release velocity (`velocity`, px/s — dragMomentum=false hands 0, the pin's
|
|
33
|
+
* `velocity: dragMomentum ? v : 0`).
|
|
34
|
+
*/
|
|
35
|
+
// alloc-ok: lifecycle-edge — the factory binds physics once per animate command; per-frame work
|
|
36
|
+
// is sample() below. The boundary spring's coefficients latch into one preallocated
|
|
37
|
+
// BoundarySpringState (packet §6: no closure, sample record, generator object, or
|
|
38
|
+
// springGenerator factory at the crossing); sample() itself allocates nothing.
|
|
39
|
+
function inertiaGenerator(physics) {
|
|
40
|
+
const { power, timeConstant, bounceStiffness, bounceDamping, restDelta, restSpeed } = physics;
|
|
41
|
+
const min = physics.min;
|
|
42
|
+
const max = physics.max;
|
|
43
|
+
return (seed) => {
|
|
44
|
+
const amplitude = power * seed.velocity;
|
|
45
|
+
const target = seed.from + amplitude;
|
|
46
|
+
const decayDelta = (t) => -amplitude * Math.exp(-t / timeConstant);
|
|
47
|
+
const decayValue = (t) => target + decayDelta(t);
|
|
48
|
+
// Analytic decay velocity (px/s): d/dt[target − amplitude·e^(−t/tc)] = amplitude/tc·e^(−t/tc) px/ms.
|
|
49
|
+
const decayVelocity = (t) => (amplitude / timeConstant) * Math.exp(-t / timeConstant) * 1000;
|
|
50
|
+
const outOfBounds = (v) => {
|
|
51
|
+
if (min !== undefined && v < min)
|
|
52
|
+
return min;
|
|
53
|
+
if (max !== undefined && v > max)
|
|
54
|
+
return max;
|
|
55
|
+
return undefined;
|
|
56
|
+
};
|
|
57
|
+
// Boundary-spring latch (the pin's timeReachedBoundary + spring, created on first OOB sample).
|
|
58
|
+
let crossingT;
|
|
59
|
+
// One preallocated state per generator — reset at the latch, sampled in place per frame.
|
|
60
|
+
const boundaryState = {
|
|
61
|
+
bound: 0,
|
|
62
|
+
from: seed.from,
|
|
63
|
+
velocity: 0,
|
|
64
|
+
initialDelta: 0,
|
|
65
|
+
initialVelocity: 0,
|
|
66
|
+
restSpeed,
|
|
67
|
+
restDelta,
|
|
68
|
+
wd: 0,
|
|
69
|
+
a: 0,
|
|
70
|
+
sinCoeff: 0,
|
|
71
|
+
cosCoeff: 0,
|
|
72
|
+
c: 0,
|
|
73
|
+
sinhCoeff: 0,
|
|
74
|
+
coshCoeff: 0,
|
|
75
|
+
};
|
|
76
|
+
// The pin's overdamped branch with its sinh/cosh exponent cap (motion-dom spring.ts:340-374,
|
|
77
|
+
// the #1207 mechanism — `Math.min(dampedAngularFreq*t, 300)`). Cross-engine parity: the pin
|
|
78
|
+
// uses the capped form for EVERY overdamped boundary spring (bounceZ > 1), so this generator
|
|
79
|
+
// does the same — the capped form is the pin's own formula, fp behavior included. Selecting
|
|
80
|
+
// it only when the cap engages within one frame diverges for intermediate overdamped pairs
|
|
81
|
+
// (review r3 major 1: bounceStiffness 10000/damping 30000 caps at ~20ms; core's cap-free
|
|
82
|
+
// solver stays unsettled past 200ms where the pin settles at 70ms). Under/critically-damped
|
|
83
|
+
// pairs (bounceZ ≤ 1) stay on core's solver — the pin's own branches there are the same
|
|
84
|
+
// cap-free math (golden regime continuity).
|
|
85
|
+
const bounceOmega0 = Math.sqrt(bounceStiffness / 1) / 1000; // rad/ms (mass 1)
|
|
86
|
+
const bounceZ = bounceDamping / (2 * Math.sqrt(bounceStiffness * 1));
|
|
87
|
+
const bounceDampedFreq = bounceZ > 1 ? bounceOmega0 * Math.sqrt(bounceZ * bounceZ - 1) : 0;
|
|
88
|
+
// Write target/origin/velocity and the primitive coefficients for the latched regime —
|
|
89
|
+
// spring.ts's exact closed forms for under/critical (including its REQ-SPRING-011 scale
|
|
90
|
+
// thresholds and pinned zero-as-absent || fallback) and the pin's capped overdamped branch
|
|
91
|
+
// (raw physics thresholds, as at HEAD). Runs at the initial or mid-flight latch only.
|
|
92
|
+
function resetBoundarySpringState(bound, from, velocity, state) {
|
|
93
|
+
state.bound = bound;
|
|
94
|
+
state.from = from;
|
|
95
|
+
state.velocity = velocity;
|
|
96
|
+
const delta = bound - from; // px (pin: initialDelta = target − origin)
|
|
97
|
+
const v0 = -velocity / 1000; // px/ms (pin: −millisecondsToSeconds; spring.ts REQ-SPRING-008)
|
|
98
|
+
state.initialDelta = delta;
|
|
99
|
+
state.initialVelocity = v0;
|
|
100
|
+
if (bounceZ > 1) {
|
|
101
|
+
state.restSpeed = restSpeed;
|
|
102
|
+
state.restDelta = restDelta;
|
|
103
|
+
const P = (v0 + bounceZ * bounceOmega0 * delta) / bounceDampedFreq;
|
|
104
|
+
state.sinhCoeff = bounceZ * bounceOmega0 * P - delta * bounceDampedFreq;
|
|
105
|
+
state.coshCoeff = bounceZ * bounceOmega0 * delta - P * bounceDampedFreq;
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
// Under/critical latch — springGenerator's exact threshold resolution (scale defaults,
|
|
109
|
+
// granular switch, zero-as-absent) for the same { restDelta, restSpeed } settle input.
|
|
110
|
+
const granular = Math.abs(delta) < BOUNDARY_GRANULAR_SCALE;
|
|
111
|
+
state.restSpeed =
|
|
112
|
+
restSpeed || (granular ? BOUNDARY_REST_SPEED.granular : BOUNDARY_REST_SPEED.default);
|
|
113
|
+
state.restDelta =
|
|
114
|
+
restDelta || (granular ? BOUNDARY_REST_DELTA.granular : BOUNDARY_REST_DELTA.default);
|
|
115
|
+
if (bounceZ < 1) {
|
|
116
|
+
const wd = bounceOmega0 * Math.sqrt(1 - bounceZ * bounceZ);
|
|
117
|
+
const a = (v0 + bounceZ * bounceOmega0 * delta) / wd;
|
|
118
|
+
state.wd = wd;
|
|
119
|
+
state.a = a;
|
|
120
|
+
state.sinCoeff = bounceZ * bounceOmega0 * a + delta * wd;
|
|
121
|
+
state.cosCoeff = bounceZ * bounceOmega0 * delta - a * wd;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
state.c = v0 + bounceOmega0 * delta;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Sample the latched boundary spring in place: underdamped, critical, and the pin's
|
|
128
|
+
// capped-overdamped branch — the exact spring.ts/capped-form math, no allocation.
|
|
129
|
+
function sampleBoundarySpringInto(elapsedMs, state, out) {
|
|
130
|
+
if (bounceZ > 1) {
|
|
131
|
+
const f = Math.min(bounceDampedFreq * elapsedMs, 300);
|
|
132
|
+
const envelope = Math.exp(-bounceZ * bounceOmega0 * elapsedMs);
|
|
133
|
+
const current = state.bound -
|
|
134
|
+
(envelope *
|
|
135
|
+
((state.initialVelocity + bounceZ * bounceOmega0 * state.initialDelta) * Math.sinh(f) +
|
|
136
|
+
bounceDampedFreq * state.initialDelta * Math.cosh(f))) /
|
|
137
|
+
bounceDampedFreq;
|
|
138
|
+
const velocityNow = envelope * (state.sinhCoeff * Math.sinh(f) + state.coshCoeff * Math.cosh(f)) * 1000;
|
|
139
|
+
const done = Math.abs(velocityNow) <= state.restSpeed &&
|
|
140
|
+
Math.abs(state.bound - current) <= state.restDelta;
|
|
141
|
+
out.value = done ? state.bound : current;
|
|
142
|
+
out.velocity = velocityNow;
|
|
143
|
+
out.done = done;
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
let current;
|
|
147
|
+
let velocityPerMs;
|
|
148
|
+
if (bounceZ < 1) {
|
|
149
|
+
const env = Math.exp(-bounceZ * bounceOmega0 * elapsedMs);
|
|
150
|
+
current =
|
|
151
|
+
state.bound -
|
|
152
|
+
env *
|
|
153
|
+
(state.a * Math.sin(state.wd * elapsedMs) +
|
|
154
|
+
state.initialDelta * Math.cos(state.wd * elapsedMs));
|
|
155
|
+
velocityPerMs =
|
|
156
|
+
env *
|
|
157
|
+
(state.sinCoeff * Math.sin(state.wd * elapsedMs) +
|
|
158
|
+
state.cosCoeff * Math.cos(state.wd * elapsedMs));
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
current =
|
|
162
|
+
state.bound -
|
|
163
|
+
Math.exp(-bounceOmega0 * elapsedMs) * (state.initialDelta + state.c * elapsedMs);
|
|
164
|
+
velocityPerMs =
|
|
165
|
+
Math.exp(-bounceOmega0 * elapsedMs) *
|
|
166
|
+
(bounceOmega0 * state.c * elapsedMs - state.initialVelocity);
|
|
167
|
+
}
|
|
168
|
+
const velocity = velocityPerMs * 1000; // → px/s (REQ-SPRING-008)
|
|
169
|
+
const done = Math.abs(velocity) <= state.restSpeed && Math.abs(state.bound - current) <= state.restDelta;
|
|
170
|
+
out.value = done ? state.bound : current;
|
|
171
|
+
out.velocity = velocity;
|
|
172
|
+
out.done = done;
|
|
173
|
+
}
|
|
174
|
+
function latchBoundaryInto(bound, value, t, state) {
|
|
175
|
+
crossingT = t;
|
|
176
|
+
// The pin's seed (motion-dom getGeneratorVelocity at the latch): the 5ms backward
|
|
177
|
+
// finite-diff of the DECAY curve — which degenerates to 0 at t=0 (empty window), so an
|
|
178
|
+
// out-of-bounds origin springs from rest, never from the analytic decay velocity.
|
|
179
|
+
const prevT = Math.max(t - 5, 0);
|
|
180
|
+
const dt = t - prevT;
|
|
181
|
+
const seedVelocity = dt === 0 ? 0 : ((value - decayValue(prevT)) / dt) * 1000;
|
|
182
|
+
resetBoundarySpringState(bound, value, seedVelocity, state);
|
|
183
|
+
}
|
|
184
|
+
// The pin's checkCatchBoundary(0): an out-of-bounds origin springs from t=0.
|
|
185
|
+
const initialBound = outOfBounds(seed.from);
|
|
186
|
+
if (initialBound !== undefined)
|
|
187
|
+
latchBoundaryInto(initialBound, seed.from, 0, boundaryState);
|
|
188
|
+
const record = { value: seed.from, velocity: seed.velocity, done: false };
|
|
189
|
+
return {
|
|
190
|
+
sample(elapsedMs) {
|
|
191
|
+
if (crossingT !== undefined && elapsedMs >= crossingT) {
|
|
192
|
+
sampleBoundarySpringInto(elapsedMs - crossingT, boundaryState, record);
|
|
193
|
+
return record;
|
|
194
|
+
}
|
|
195
|
+
const delta = decayDelta(elapsedMs);
|
|
196
|
+
const decayDone = Math.abs(delta) <= restDelta;
|
|
197
|
+
const value = decayDone ? target : decayValue(elapsedMs);
|
|
198
|
+
const velocity = decayVelocity(elapsedMs);
|
|
199
|
+
// OOB check on the POST-friction value — the pin checks after applyFriction, so a decay
|
|
200
|
+
// that settles past the wall (out-of-bounds target) still engages the boundary spring.
|
|
201
|
+
const bound = outOfBounds(value);
|
|
202
|
+
if (bound !== undefined) {
|
|
203
|
+
latchBoundaryInto(bound, value, elapsedMs, boundaryState);
|
|
204
|
+
sampleBoundarySpringInto(0, boundaryState, record);
|
|
205
|
+
return record;
|
|
206
|
+
}
|
|
207
|
+
record.value = value;
|
|
208
|
+
record.velocity = decayDone ? 0 : velocity;
|
|
209
|
+
record.done = decayDone;
|
|
210
|
+
return record;
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { GeneratorFactory } from "./types.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Preallocated boundary-spring state (REQ-DRIVER-021, packet §6 inertia-midflight repair): one
|
|
4
|
+
* record per generator, reset at the latch and sampled in place — the mid-flight latch creates
|
|
5
|
+
* no closure, no GeneratorSample record, no generator object, and no springGenerator factory.
|
|
6
|
+
* Coefficients are the exact closed forms of spring.ts (under/critical) and the pin's capped
|
|
7
|
+
* overdamped branch (#1207), resolved once per latch by `resetBoundarySpringState`.
|
|
8
|
+
*/
|
|
9
|
+
export interface BoundarySpringState {
|
|
10
|
+
/** Latched bound (the spring target). */
|
|
11
|
+
bound: number;
|
|
12
|
+
/** Crossing value (the spring origin). */
|
|
13
|
+
from: number;
|
|
14
|
+
/** Seed velocity at the latch (px/s, public unit). */
|
|
15
|
+
velocity: number;
|
|
16
|
+
/** bound − from (px) and −velocity/1000 (px/ms) — spring.ts's delta/v0. */
|
|
17
|
+
initialDelta: number;
|
|
18
|
+
initialVelocity: number;
|
|
19
|
+
/** Rest thresholds resolved at the latch for the latched regime. */
|
|
20
|
+
restSpeed: number;
|
|
21
|
+
restDelta: number;
|
|
22
|
+
/** Underdamped coefficients (spring.ts: ωd, a, sin/cos). */
|
|
23
|
+
wd: number;
|
|
24
|
+
a: number;
|
|
25
|
+
sinCoeff: number;
|
|
26
|
+
cosCoeff: number;
|
|
27
|
+
/** Critically-damped coefficient (spring.ts: c = v0 + ω0·δ). */
|
|
28
|
+
c: number;
|
|
29
|
+
/** Capped-overdamped coefficients (the pin's #1207 sinh/cosh form). */
|
|
30
|
+
sinhCoeff: number;
|
|
31
|
+
coshCoeff: number;
|
|
32
|
+
}
|
|
33
|
+
export interface InertiaPhysics {
|
|
34
|
+
/** Pinned drag-layer default 0.8 (motion-dom inertia `power`). */
|
|
35
|
+
readonly power: number;
|
|
36
|
+
/** Pinned drag-layer default 750 ms (startAnimation spread; motion-dom's own default is 325). */
|
|
37
|
+
readonly timeConstant: number;
|
|
38
|
+
/** Boundary spring parameters — elastic-conditional 200/40 vs 1e6/1e7, `dragTransition` override. */
|
|
39
|
+
readonly bounceStiffness: number;
|
|
40
|
+
readonly bounceDamping: number;
|
|
41
|
+
/** Decay settle threshold (px): done when the remaining delta shrinks below it. Drag layer: 1. */
|
|
42
|
+
readonly restDelta: number;
|
|
43
|
+
/** Boundary spring settle threshold (px/s). Drag layer: 10. */
|
|
44
|
+
readonly restSpeed: number;
|
|
45
|
+
readonly min?: number;
|
|
46
|
+
readonly max?: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Build an inertia `GeneratorFactory` from pinned physics. The seed supplies the origin (`from`)
|
|
50
|
+
* and the release velocity (`velocity`, px/s — dragMomentum=false hands 0, the pin's
|
|
51
|
+
* `velocity: dragMomentum ? v : 0`).
|
|
52
|
+
*/
|
|
53
|
+
export declare function inertiaGenerator(physics: InertiaPhysics): GeneratorFactory;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { GeneratorFactory } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Preallocated boundary-spring state (REQ-DRIVER-021, packet §6 inertia-midflight repair): one
|
|
4
|
+
* record per generator, reset at the latch and sampled in place — the mid-flight latch creates
|
|
5
|
+
* no closure, no GeneratorSample record, no generator object, and no springGenerator factory.
|
|
6
|
+
* Coefficients are the exact closed forms of spring.ts (under/critical) and the pin's capped
|
|
7
|
+
* overdamped branch (#1207), resolved once per latch by `resetBoundarySpringState`.
|
|
8
|
+
*/
|
|
9
|
+
export interface BoundarySpringState {
|
|
10
|
+
/** Latched bound (the spring target). */
|
|
11
|
+
bound: number;
|
|
12
|
+
/** Crossing value (the spring origin). */
|
|
13
|
+
from: number;
|
|
14
|
+
/** Seed velocity at the latch (px/s, public unit). */
|
|
15
|
+
velocity: number;
|
|
16
|
+
/** bound − from (px) and −velocity/1000 (px/ms) — spring.ts's delta/v0. */
|
|
17
|
+
initialDelta: number;
|
|
18
|
+
initialVelocity: number;
|
|
19
|
+
/** Rest thresholds resolved at the latch for the latched regime. */
|
|
20
|
+
restSpeed: number;
|
|
21
|
+
restDelta: number;
|
|
22
|
+
/** Underdamped coefficients (spring.ts: ωd, a, sin/cos). */
|
|
23
|
+
wd: number;
|
|
24
|
+
a: number;
|
|
25
|
+
sinCoeff: number;
|
|
26
|
+
cosCoeff: number;
|
|
27
|
+
/** Critically-damped coefficient (spring.ts: c = v0 + ω0·δ). */
|
|
28
|
+
c: number;
|
|
29
|
+
/** Capped-overdamped coefficients (the pin's #1207 sinh/cosh form). */
|
|
30
|
+
sinhCoeff: number;
|
|
31
|
+
coshCoeff: number;
|
|
32
|
+
}
|
|
33
|
+
export interface InertiaPhysics {
|
|
34
|
+
/** Pinned drag-layer default 0.8 (motion-dom inertia `power`). */
|
|
35
|
+
readonly power: number;
|
|
36
|
+
/** Pinned drag-layer default 750 ms (startAnimation spread; motion-dom's own default is 325). */
|
|
37
|
+
readonly timeConstant: number;
|
|
38
|
+
/** Boundary spring parameters — elastic-conditional 200/40 vs 1e6/1e7, `dragTransition` override. */
|
|
39
|
+
readonly bounceStiffness: number;
|
|
40
|
+
readonly bounceDamping: number;
|
|
41
|
+
/** Decay settle threshold (px): done when the remaining delta shrinks below it. Drag layer: 1. */
|
|
42
|
+
readonly restDelta: number;
|
|
43
|
+
/** Boundary spring settle threshold (px/s). Drag layer: 10. */
|
|
44
|
+
readonly restSpeed: number;
|
|
45
|
+
readonly min?: number;
|
|
46
|
+
readonly max?: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Build an inertia `GeneratorFactory` from pinned physics. The seed supplies the origin (`from`)
|
|
50
|
+
* and the release velocity (`velocity`, px/s — dragMomentum=false hands 0, the pin's
|
|
51
|
+
* `velocity: dragMomentum ? v : 0`).
|
|
52
|
+
*/
|
|
53
|
+
export declare function inertiaGenerator(physics: InertiaPhysics): GeneratorFactory;
|