@octane-xplat/motion 0.0.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.motion +21 -0
- package/README.md +15 -0
- package/UPSTREAM.md +61 -0
- package/dist/native/index.js +1747 -0
- package/dist/native/octane-client-build.json +8 -0
- package/dist/web/index.js +1826 -0
- package/dist/web/octane-client-build.json +8 -0
- package/package.json +75 -5
- package/src/clock-types.ts +6 -0
- package/src/clock.ts +7 -0
- package/src/clock.web.ts +6 -0
- package/src/components.mobile.test.tsrx +84 -0
- package/src/components.tsrx +142 -0
- package/src/components.web.test.tsrx +134 -0
- package/src/config.tsrx +29 -0
- package/src/controller.ts +98 -0
- package/src/engine.test.ts +126 -0
- package/src/engine.ts +159 -0
- package/src/hooks.tsrx +56 -0
- package/src/host-types.ts +6 -0
- package/src/host.ts +50 -0
- package/src/host.web.ts +34 -0
- package/src/index.ts +9 -0
- package/src/index.web.ts +9 -0
- package/src/presence-input.ts +26 -0
- package/src/presence-input.web.ts +17 -0
- package/src/presence-state.test.ts +64 -0
- package/src/presence-state.ts +76 -0
- package/src/presence.tsrx +52 -0
- package/src/presence.web.test.tsrx +122 -0
- package/src/reduced-motion.ts +37 -0
- package/src/reduced-motion.web.ts +13 -0
- package/src/types.ts +55 -0
- package/src/value.ts +167 -0
- package/types/clock-types.d.ts +6 -0
- package/types/engine.d.ts +11 -0
- package/types/index.d.ts +53 -0
- package/types/types.d.ts +51 -0
- package/types/value.d.ts +48 -0
package/LICENSE.motion
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 [Motion](https://motion.dev) B.V.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @octane-xplat/motion
|
|
2
|
+
|
|
3
|
+
Declarative numeric motion for Octane UI on web, iOS, and Android. Use
|
|
4
|
+
`motion.View`, `motion.Row`, or `motion.Pressable` with `initial`, `animate`,
|
|
5
|
+
and `transition`. Bound motion values update hosts without rendering each frame.
|
|
6
|
+
|
|
7
|
+
See the [motion guide](../../docs/animation-gestures.md) and maintained
|
|
8
|
+
[MotionDemo](examples/MotionDemo.tsrx). Use the [PresenceDemo](examples/PresenceDemo.tsrx) for retained exits.
|
|
9
|
+
The [compatibility record](UPSTREAM.md)
|
|
10
|
+
defines the supported subset and differences from `@octanejs/motion`.
|
|
11
|
+
|
|
12
|
+
Build with `pnpm --filter @octane-xplat/motion build`; run DOM/engine tests with
|
|
13
|
+
`pnpm --filter @octane-xplat/motion test` and universal lifecycle tests with
|
|
14
|
+
`pnpm --filter @octane-xplat/motion exec vitest run --config vitest.native.config.mts`.
|
|
15
|
+
Native compilation and object-driver tests are not physical-device evidence.
|
package/UPSTREAM.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Motion compatibility
|
|
2
|
+
|
|
3
|
+
The behavioral reference is `@octanejs/motion` source package version 0.1.56,
|
|
4
|
+
inspected from Octane main on 2026-09-29. Its UPSTREAM.md pins Motion 12.42.2
|
|
5
|
+
(commit `40e8756c63b258c9dd07de9501cb788410eefb02`). This package pins
|
|
6
|
+
`motion-dom@12.42.2` and bundles its pure numeric generators and interpolation.
|
|
7
|
+
The adapter is original code; it does not copy upstream's DOM host factory.
|
|
8
|
+
|
|
9
|
+
| Contract | Upstream reference under packages/motion | Xplat implementation / evidence |
|
|
10
|
+
| ------------------------------------------------ | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| Initial and changing targets, equal destinations | src/index.ts; tests/conformance/rerender.test.ts, effects.test.ts | Compiled wrappers over UI; components.web.test.tsrx |
|
|
12
|
+
| Numeric spring/tween samples | Motion's motion-dom animation/generators | Reused generators; engine.test.ts compares irregular-time samples |
|
|
13
|
+
| Stable value, subscriptions, style replacement | src/useMotionValue.ts; tests/conformance/motionValue.test.ts | Numeric adapter with native clock; components.web.test.tsrx |
|
|
14
|
+
| Spring set versus jump; follow source | src/useSpring.ts; tests/conformance/useSpring.test.ts | Owned spring interception and cleanup; hook tests |
|
|
15
|
+
| Derived numeric values | src/useTransform.ts; tests/conformance/useTransform.test.ts | Upstream interpolation, direct subscriptions; hook tests |
|
|
16
|
+
| Config and reduced motion | src/context.ts; tests/conformance/reducedMotionConfig.test.ts | Context inheritance; transforms settle immediately, opacity may animate |
|
|
17
|
+
| Exit lifecycle | src/index.ts; tests/conformance/exit.test.ts | Deliberate live-subtree retention on both leaves; presence.web.test.tsrx and native presence test |
|
|
18
|
+
| Retained hosts on native | Not a DOM binding concern | components.mobile.test.tsrx uses the universal object driver |
|
|
19
|
+
|
|
20
|
+
Source links: [Octane motion](https://github.com/octanejs/octane/tree/main/packages/motion),
|
|
21
|
+
[upstream ledger](https://github.com/octanejs/octane/blob/main/packages/motion/UPSTREAM.md),
|
|
22
|
+
[Motion pin](https://github.com/motiondivision/motion/tree/40e8756c63b258c9dd07de9501cb788410eefb02).
|
|
23
|
+
|
|
24
|
+
## Deliberate boundaries
|
|
25
|
+
|
|
26
|
+
- Numeric values only. No CSS strings, keyframe arrays, variants, layout,
|
|
27
|
+
gesture presets, declarative drag, or broad framework-neutral re-export.
|
|
28
|
+
- Host APIs use shared UI names rather than DOM tags. Existing UI props remain
|
|
29
|
+
available; motion owns transform channels and opacity. Put pre-existing CSS
|
|
30
|
+
transforms on an outer container. Conflicting writers are errors.
|
|
31
|
+
- `set` on a plain value stops its current animation, making gesture takeover
|
|
32
|
+
explicit and immediate. A spring value intercepts `set`; `jump` stops and snaps.
|
|
33
|
+
- MotionConfig defaults to `reducedMotion="never"`, matching the reference;
|
|
34
|
+
choose `user` for system preferences. Config does not cross separate roots and
|
|
35
|
+
does not alter imperative value.animate calls: consult useReducedMotion there.
|
|
36
|
+
- Timing uses a platform clock. NativeScript exposes frame scheduling through a
|
|
37
|
+
module; Motion's scheduler captures a global rAF and its values use browser
|
|
38
|
+
timing globals. The numeric adapter avoids changing application globals.
|
|
39
|
+
- The same generator runs on web/native. WAAPI and native Animation acceleration
|
|
40
|
+
are deferred until interruption and transform composition preserve this contract.
|
|
41
|
+
- Springs are physical (not duration/bounce based); duration belongs to tweens.
|
|
42
|
+
Default declarative transition is a 0.3-second easeInOut tween. Targets are
|
|
43
|
+
absolute; scale multiplies scaleX/scaleY. Opacity is clamped to 0–1 at the host. Reduced transforms have no delay.
|
|
44
|
+
|
|
45
|
+
## Presence divergence
|
|
46
|
+
|
|
47
|
+
`Presence present={...}` retains actual components and their state/subscriptions
|
|
48
|
+
until all registered exits finish. Upstream's `AnimatePresence` is a passthrough
|
|
49
|
+
and exiting DOM hosts clone themselves during cleanup. We deliberately do not
|
|
50
|
+
reuse that path or claim its cleanup timing. Presence renders an explicit View
|
|
51
|
+
wrapper, blocks interaction during exit, and restores interaction on reversal.
|
|
52
|
+
An ancestor unmount always disposes immediately. Nested boundaries are independent.
|
|
53
|
+
|
|
54
|
+
## Verification limits
|
|
55
|
+
|
|
56
|
+
Unit and DOM tests establish bounded behavior, not full Framer Motion parity.
|
|
57
|
+
Universal object-driver tests establish retention and lifecycle without an OS.
|
|
58
|
+
Physical iOS/Android interruption, cancellation, gesture velocity/arbitration,
|
|
59
|
+
background/resume, and frame pacing are pending. Native system preference
|
|
60
|
+
observation polls at 500 ms while subscribed and refreshes on resume; Android
|
|
61
|
+
uses animator_duration_scale. Real-device accessibility behavior remains pending.
|