From 4d039718d1b4a2bee020d224d19658abba898d32 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Thu, 13 Nov 2025 18:30:51 +0800 Subject: [PATCH 01/37] feat: add initial motion support for lynx --- .changeset/tame-cougars-cry.md | 3 + examples/motion/lynx.config.js | 20 +++ examples/motion/package.json | 23 +++ examples/motion/src/App.css | 30 ++++ examples/motion/src/App.tsx | 66 ++++++++ examples/motion/src/Basic/index.tsx | 60 +++++++ examples/motion/src/Basic/styles.css | 6 + examples/motion/src/BasicPercent/index.tsx | 57 +++++++ examples/motion/src/BasicPercent/styles.css | 6 + .../motion/src/ColorInterception/index.tsx | 58 +++++++ .../motion/src/ColorInterception/styles.css | 6 + examples/motion/src/Spring/index.tsx | 52 ++++++ examples/motion/src/Spring/styles.css | 6 + examples/motion/src/Stagger/index.tsx | 44 +++++ examples/motion/src/Stagger/styles.css | 26 +++ examples/motion/src/Text/index.tsx | 47 ++++++ examples/motion/src/Text/styles.css | 11 ++ examples/motion/src/assets/arrow.png | Bin 0 -> 80333 bytes examples/motion/src/assets/lynx-logo.png | Bin 0 -> 35354 bytes examples/motion/src/assets/react-logo.png | Bin 0 -> 33569 bytes examples/motion/src/index.tsx | 13 ++ examples/motion/src/rspeedy-env.d.ts | 1 + examples/motion/tsconfig.json | 19 +++ packages/third-party/motion/README.md | 3 + packages/third-party/motion/package.json | 44 +++++ .../third-party/motion/src/animation/index.ts | 58 +++++++ .../motion/src/env_types/papi.d.ts | 108 ++++++++++++ packages/third-party/motion/src/index.ts | 4 + .../motion/src/polyfill/element.ts | 156 ++++++++++++++++++ .../third-party/motion/src/polyfill/shim.ts | 67 ++++++++ .../third-party/motion/src/types/index.ts | 7 + packages/third-party/motion/src/utils/noop.ts | 5 + .../motion/src/utils/registeredFunction.ts | 29 ++++ .../third-party/motion/tsconfig.build.json | 3 + packages/third-party/motion/tsconfig.json | 11 ++ packages/third-party/tsconfig.json | 1 + pnpm-lock.yaml | 60 ++++++- 37 files changed, 1102 insertions(+), 8 deletions(-) create mode 100644 .changeset/tame-cougars-cry.md create mode 100644 examples/motion/lynx.config.js create mode 100644 examples/motion/package.json create mode 100644 examples/motion/src/App.css create mode 100644 examples/motion/src/App.tsx create mode 100644 examples/motion/src/Basic/index.tsx create mode 100644 examples/motion/src/Basic/styles.css create mode 100644 examples/motion/src/BasicPercent/index.tsx create mode 100644 examples/motion/src/BasicPercent/styles.css create mode 100644 examples/motion/src/ColorInterception/index.tsx create mode 100644 examples/motion/src/ColorInterception/styles.css create mode 100644 examples/motion/src/Spring/index.tsx create mode 100644 examples/motion/src/Spring/styles.css create mode 100644 examples/motion/src/Stagger/index.tsx create mode 100644 examples/motion/src/Stagger/styles.css create mode 100644 examples/motion/src/Text/index.tsx create mode 100644 examples/motion/src/Text/styles.css create mode 100644 examples/motion/src/assets/arrow.png create mode 100644 examples/motion/src/assets/lynx-logo.png create mode 100644 examples/motion/src/assets/react-logo.png create mode 100644 examples/motion/src/index.tsx create mode 100644 examples/motion/src/rspeedy-env.d.ts create mode 100644 examples/motion/tsconfig.json create mode 100644 packages/third-party/motion/README.md create mode 100644 packages/third-party/motion/package.json create mode 100644 packages/third-party/motion/src/animation/index.ts create mode 100644 packages/third-party/motion/src/env_types/papi.d.ts create mode 100644 packages/third-party/motion/src/index.ts create mode 100644 packages/third-party/motion/src/polyfill/element.ts create mode 100644 packages/third-party/motion/src/polyfill/shim.ts create mode 100644 packages/third-party/motion/src/types/index.ts create mode 100644 packages/third-party/motion/src/utils/noop.ts create mode 100644 packages/third-party/motion/src/utils/registeredFunction.ts create mode 100644 packages/third-party/motion/tsconfig.build.json create mode 100644 packages/third-party/motion/tsconfig.json diff --git a/.changeset/tame-cougars-cry.md b/.changeset/tame-cougars-cry.md new file mode 100644 index 0000000000..853d812bb3 --- /dev/null +++ b/.changeset/tame-cougars-cry.md @@ -0,0 +1,3 @@ +--- + +--- diff --git a/examples/motion/lynx.config.js b/examples/motion/lynx.config.js new file mode 100644 index 0000000000..6ac4384277 --- /dev/null +++ b/examples/motion/lynx.config.js @@ -0,0 +1,20 @@ +import { pluginQRCode } from '@lynx-js/qrcode-rsbuild-plugin'; +import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'; +import { defineConfig } from '@lynx-js/rspeedy'; + +const enableBundleAnalysis = !!process.env['RSPEEDY_BUNDLE_ANALYSIS']; + +export default defineConfig({ + plugins: [ + pluginReactLynx(), + pluginQRCode({ + schema(url) { + // We use `?fullscreen=true` to open the page in LynxExplorer in full screen mode + return `${url}?fullscreen=true`; + }, + }), + ], + performance: { + profile: enableBundleAnalysis, + }, +}); diff --git a/examples/motion/package.json b/examples/motion/package.json new file mode 100644 index 0000000000..6b8324bf19 --- /dev/null +++ b/examples/motion/package.json @@ -0,0 +1,23 @@ +{ + "name": "@lynx-js/motion-examples", + "version": "0.0.0", + "private": true, + "type": "module", + "scripts": { + "build": "rspeedy build", + "dev": "rspeedy dev", + "test:type": "vitest --typecheck.only" + }, + "dependencies": { + "@lynx-js/motion-lynx": "workspace:*", + "@lynx-js/react": "workspace:*" + }, + "devDependencies": { + "@lynx-js/preact-devtools": "^5.0.1-cf9aef5", + "@lynx-js/qrcode-rsbuild-plugin": "workspace:*", + "@lynx-js/react-rsbuild-plugin": "workspace:*", + "@lynx-js/rspeedy": "workspace:*", + "@lynx-js/types": "3.4.11", + "@types/react": "^18.3.25" + } +} diff --git a/examples/motion/src/App.css b/examples/motion/src/App.css new file mode 100644 index 0000000000..a4acd3b9f9 --- /dev/null +++ b/examples/motion/src/App.css @@ -0,0 +1,30 @@ +.case-area { + flex: 1; +} + +.container { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + padding-top: 60px; +} + +.button-area { + display: flex; + flex-direction: row; + gap: 20px; + padding: 0 16px; + flex-wrap: wrap; +} + +.text-area { + padding: 16px 16px; +} + +.button { + border-radius: 16px; + padding: 8px; + border: 1px solid #333; + flex-shrink: 0; +} diff --git a/examples/motion/src/App.tsx b/examples/motion/src/App.tsx new file mode 100644 index 0000000000..4bb6b755db --- /dev/null +++ b/examples/motion/src/App.tsx @@ -0,0 +1,66 @@ +import { useState } from '@lynx-js/react'; + +import Basic from './Basic/index.js'; +import BasicPercent from './BasicPercent/index.js'; +import ColorInterception from './ColorInterception/index.js'; +import Spring from './Spring/index.js'; +import Stagger from './Stagger/index.js'; +import Text from './Text/index.js'; + +import './App.css'; + +const CASES = [ + { + name: 'Basic', + comp: Basic, + }, + { + name: 'BasicPercent', + comp: BasicPercent, + }, + { + name: 'Stagger', + comp: Stagger, + }, + { + name: 'ColorInterception', + comp: ColorInterception, + }, + { + name: 'Spring', + comp: Spring, + }, + { + name: 'Text', + comp: Text, + }, +]; + +export function App() { + const [current, setCurrent] = useState(0); + + // @ts-expect-error error + const CurrentComp = CASES[current].comp; + + return ( + + + {CASES.map((item, index) => { + return ( + setCurrent(index)} + > + {item.name} + + ); + })} + + Current case is: {CASES[current]?.name} + + {} + + + ); +} diff --git a/examples/motion/src/Basic/index.tsx b/examples/motion/src/Basic/index.tsx new file mode 100644 index 0000000000..4276c3bc4d --- /dev/null +++ b/examples/motion/src/Basic/index.tsx @@ -0,0 +1,60 @@ +import { animate } from '@lynx-js/motion-lynx'; +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; +import type { MainThread } from '@lynx-js/types'; + +import './styles.css'; + +export default function BasicPercent() { + const animateMTRef = useMainThreadRef | null>( + null, + ); + const boxMTRef = useMainThreadRef(null); + + function startAnimation() { + 'main thread'; + + if (boxMTRef.current) { + animateMTRef.current = animate( + boxMTRef.current, + { scale: 0.4, rotate: '45deg' }, + { + ease: 'circInOut', + duration: 1, + repeat: Number.POSITIVE_INFINITY, + repeatType: 'reverse', + }, + ); + } + } + + function endAnimation() { + 'main thread'; + + animateMTRef.current?.stop(); + } + + useEffect(() => { + setTimeout(() => { + void runOnMainThread(startAnimation)(); + }, 1000); + return () => { + runOnMainThread(endAnimation); + }; + }, []); + + return ( + + + + + ); +} diff --git a/examples/motion/src/Basic/styles.css b/examples/motion/src/Basic/styles.css new file mode 100644 index 0000000000..feb286bddb --- /dev/null +++ b/examples/motion/src/Basic/styles.css @@ -0,0 +1,6 @@ +.case-container { + height: 100%; + display: flex; + justify-content: center; + align-items: center; +} diff --git a/examples/motion/src/BasicPercent/index.tsx b/examples/motion/src/BasicPercent/index.tsx new file mode 100644 index 0000000000..313e204bbe --- /dev/null +++ b/examples/motion/src/BasicPercent/index.tsx @@ -0,0 +1,57 @@ +import { animate } from '@lynx-js/motion-lynx'; +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; +import type { MainThread } from '@lynx-js/types'; + +import './styles.css'; + +export default function BasicPercent() { + const animateMTRef = useMainThreadRef | null>( + null, + ); + const boxMTRef = useMainThreadRef(null); + + function startAnimation() { + 'main thread'; + + if (boxMTRef.current) { + animateMTRef.current = animate( + boxMTRef.current, + { width: ['10px', '50%'] }, + { + ease: 'circInOut', + duration: 1, + repeat: Number.POSITIVE_INFINITY, + repeatType: 'reverse', + }, + ); + } + } + + function endAnimation() { + 'main thread'; + + animateMTRef.current?.stop(); + } + + useEffect(() => { + void runOnMainThread(startAnimation)(); + return () => { + void runOnMainThread(endAnimation); + }; + }, []); + + return ( + + + + + ); +} diff --git a/examples/motion/src/BasicPercent/styles.css b/examples/motion/src/BasicPercent/styles.css new file mode 100644 index 0000000000..feb286bddb --- /dev/null +++ b/examples/motion/src/BasicPercent/styles.css @@ -0,0 +1,6 @@ +.case-container { + height: 100%; + display: flex; + justify-content: center; + align-items: center; +} diff --git a/examples/motion/src/ColorInterception/index.tsx b/examples/motion/src/ColorInterception/index.tsx new file mode 100644 index 0000000000..0d2540aaaf --- /dev/null +++ b/examples/motion/src/ColorInterception/index.tsx @@ -0,0 +1,58 @@ +import { animate } from '@lynx-js/motion-lynx'; +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; +import type { MainThread } from '@lynx-js/types'; + +import './styles.css'; + +export default function ColorInterception() { + const animateMTRef = useMainThreadRef | null>( + null, + ); + const boxMTRef = useMainThreadRef(null); + + function startAnimation() { + 'main thread'; + + if (boxMTRef.current) { + animateMTRef.current = animate( + boxMTRef.current, + { + backgroundColor: '#0d63f8', + }, + { + duration: 2, + repeat: Number.POSITIVE_INFINITY, + repeatType: 'reverse', + }, + ); + } + } + + function endAnimation() { + 'main thread'; + + animateMTRef.current?.stop(); + } + + useEffect(() => { + void runOnMainThread(startAnimation)(); + return () => { + void runOnMainThread(endAnimation); + }; + }, []); + + return ( + + + + + ); +} diff --git a/examples/motion/src/ColorInterception/styles.css b/examples/motion/src/ColorInterception/styles.css new file mode 100644 index 0000000000..feb286bddb --- /dev/null +++ b/examples/motion/src/ColorInterception/styles.css @@ -0,0 +1,6 @@ +.case-container { + height: 100%; + display: flex; + justify-content: center; + align-items: center; +} diff --git a/examples/motion/src/Spring/index.tsx b/examples/motion/src/Spring/index.tsx new file mode 100644 index 0000000000..9f16671922 --- /dev/null +++ b/examples/motion/src/Spring/index.tsx @@ -0,0 +1,52 @@ +import { animate } from '@lynx-js/motion-lynx'; +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; +import type { MainThread } from '@lynx-js/types'; + +import './styles.css'; + +export default function Spring() { + const animateMTRef = useMainThreadRef | null>( + null, + ); + const boxMTRef = useMainThreadRef(null); + + function startAnimation() { + 'main thread'; + + if (boxMTRef.current) { + animateMTRef.current = animate( + boxMTRef.current, + { rotate: 90 }, + { type: 'spring', repeat: Number.POSITIVE_INFINITY, repeatDelay: 0.2 }, + ); + } + } + + function endAnimation() { + 'main thread'; + + animateMTRef.current?.stop(); + } + + useEffect(() => { + void runOnMainThread(startAnimation)(); + return () => { + void runOnMainThread(endAnimation); + }; + }, []); + + return ( + + + + + ); +} diff --git a/examples/motion/src/Spring/styles.css b/examples/motion/src/Spring/styles.css new file mode 100644 index 0000000000..feb286bddb --- /dev/null +++ b/examples/motion/src/Spring/styles.css @@ -0,0 +1,6 @@ +.case-container { + height: 100%; + display: flex; + justify-content: center; + align-items: center; +} diff --git a/examples/motion/src/Stagger/index.tsx b/examples/motion/src/Stagger/index.tsx new file mode 100644 index 0000000000..df0bcabcaf --- /dev/null +++ b/examples/motion/src/Stagger/index.tsx @@ -0,0 +1,44 @@ +import { animate, stagger } from '@lynx-js/motion-lynx'; +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; +import './styles.css'; + +export default function Stagger() { + const animateMTRef = useMainThreadRef | null>( + null, + ); + + function startAnimation() { + 'main thread'; + const els = lynx.querySelectorAll('.stagger-box'); + + animateMTRef.current = animate(els, { y: [50, 0] }, { + delay: stagger(0.05), + repeat: Number.POSITIVE_INFINITY, + repeatType: 'reverse', + }); + } + + function endAnimation() { + 'main thread'; + + animateMTRef.current?.stop(); + } + + useEffect(() => { + void runOnMainThread(startAnimation)(); + return () => { + void runOnMainThread(endAnimation); + }; + }, []); + + return ( + + + + + + + + + ); +} diff --git a/examples/motion/src/Stagger/styles.css b/examples/motion/src/Stagger/styles.css new file mode 100644 index 0000000000..e569cb6508 --- /dev/null +++ b/examples/motion/src/Stagger/styles.css @@ -0,0 +1,26 @@ +.case-container { + height: 100%; + display: flex; + justify-content: center; + align-items: center; +} + +.stagger-box-container { + display: flex; + justify-content: center; + gap: 20px; + flex: 1; + margin: 0; + padding: 0; + flex-shrink: 0; + flex-direction: row; +} + +.stagger-box { + width: 50px; + height: 50px; + border-radius: 10px; + display: block; + background-color: #0cdcf7; + flex: 0 0 50px; +} diff --git a/examples/motion/src/Text/index.tsx b/examples/motion/src/Text/index.tsx new file mode 100644 index 0000000000..d537f695e0 --- /dev/null +++ b/examples/motion/src/Text/index.tsx @@ -0,0 +1,47 @@ +import { animate } from '@lynx-js/motion-lynx'; +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; +import type { MainThread } from '@lynx-js/types'; + +import './styles.css'; + +export default function Text() { + const animateMTRef = useMainThreadRef | null>( + null, + ); + const textMTRef = useMainThreadRef(null); + + function startAnimation() { + 'main thread'; + + if (textMTRef.current) { + animateMTRef.current = animate(0, 100, { + ease: 'circInOut', + duration: 2, + onUpdate: (latest) => { + textMTRef.current?.setAttribute('text', latest); + }, + }); + } + } + + function endAnimation() { + 'main thread'; + + animateMTRef.current?.stop(); + } + + useEffect(() => { + void runOnMainThread(startAnimation)(); + return () => { + void runOnMainThread(endAnimation); + }; + }, []); + + return ( + + + + + + ); +} diff --git a/examples/motion/src/Text/styles.css b/examples/motion/src/Text/styles.css new file mode 100644 index 0000000000..e063528e1d --- /dev/null +++ b/examples/motion/src/Text/styles.css @@ -0,0 +1,11 @@ +.case-container { + height: 100%; + display: flex; + justify-content: center; + align-items: center; +} + +.text-case { + font-size: 64px; + color: #8df0cc; +} diff --git a/examples/motion/src/assets/arrow.png b/examples/motion/src/assets/arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..435c8ad4d1eac4ac17b6133bbcfd0abee2e2ea9a GIT binary patch literal 80333 zcmbrm^ zaDPx<^4dK!bLO0xXP%j3xT>-&HU=36006+2my=cp01$ux0PqS81@@a?YR{UmALtHp zI?ez9CIS2p5Rjfp0{bP!O9e4!! zZ`4*N{!OS%W=fh_#(%D}AOwDngAo)P@tzHkziiffQ0NDBYX%aoi)+xwMQZK&26`SE z5_aPu8?x7#uWf74)lIH@CqRf!Msox`pZ$&TlZ~rr{Hc{bJQC_6EpT9e;+1zH< z5MeYa*M3}jtf~2Pu?y+_<9WaA<$Dv|e%s7QtJ%AAIw=y<0o{M+5|Z&TxsXZP9xw3(j|!v=A|ra8h76L34ij1f?RBz6$=vPJZ9 zPlQ3r$Yy$=#yfMUHMHmyuDCe|TycJFzys2W72s$-pyQ2106*LL5H<;x0Vfs#%!Zvg z9siN-3!Y_&0#cJS5((hRk`cM#co^mB_+<%t_!4I=bQ?nzPo_|}>wE5Z4woW?AdTzO zHjt>{*)U3P6--5zV7M+|5?MC!xv4?>0jOKh8V4#Dbu5Gbn}L`Z;#)&s=Q)3vK_Iw6 zhmlo`UF^~Iz?)#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5*(g&81-)lID5^l2-WblM zAe@Smzhi~v&2sV&I3P%vV9e=CeXfZ$+W4_1&Bz?8gHLUyuvrt!Xf|{V2nCxYIFxR5 zsF3@nx|y%zzt6YH1OFq_EVshe7RkoQTo6Pe+-5y0FV7&9btmaiibWoZ`K+DAE&3n8 CZ&Bj_ literal 0 HcmV?d00001 diff --git a/examples/motion/src/assets/react-logo.png b/examples/motion/src/assets/react-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..4ad12a6b55ca84c90d321bf6bc0cb074ecf12929 GIT binary patch literal 33569 zcmdRV=U-FJ^L9c)=uJR+M*)@IdvA(#M5#eQq&F$j5;{m%5L7xSAX20kAs`*;ARU5& z^xg?1=a>8YdH#v#MRJm}duC>5cCMY7-4k!9uT4S9ObP;lD0Fo+j6om*{7(W9F${k> z4V=Q@FC<<%&wN23GTQ$>V9>{GM*K~%ud%iosB(mL3;ze|r21GD1p1yrc4J2f0!1|F zYN(n9g7@0ozd6hW&0L_(#JvQoJ*eV2ucm^z|DBxj4id$7n936{oro#&B6amJ5{wSi z4lOj$NV+p;p727ImW5m1KF#K#cW*O9{=nvKfQh-HsMY>I{UVPgjdF-H z{`#J(s{i{NhW*m7+l0h(w3r*;4QoN7F=d9T%D|7ZL@2gUw`48c(xz`6n2Sl32+6BT zenWo#H;Dd^TJVQX1TDqS=nL81p3CM%^q4NEs1K!$I>0IcEdOH-q1|7UXhgqF8E(E} zjbdez1FfxS^x_no+hQbSoI0!n^ThA55Rq-HNJ7=~$VNm(`Zh3GlXiDvV<_XYDtVFOPk8{YWAXEy=OaDMN=m;s{;@{w;wd`_$Biq8x2=pA z3f8UKhI*YR)+-tain|C zUio%B}4}X4&>)*_STWu`wygc=$ z8hVl@i0?N2qB{mbPq9hPN+^oaGWdD2?=y1hostZC#(*Dj(%2y?4R-$bnnbw$+D_%; zTe|FUd=muUR6lm;*~2`CcaD#MC2 zZM?1%=k+@ID`-FICMcDCLjR2T2lc@_al`x78WO@k9X=RS#4?jne53V(s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tH2eeqpw*jNg+qABj`u!E&@Mi1ov1IkA;{V`BmCkdg^%i21fv?n$YuR6_G z7pMjCtNl-6pN`s-ykwRIe}I-1&wJg`hIE&DNL+aXMC-Xxa6oDq(i!DDUXw)f2TBS( zwmUj(IF-jEM1 zvq#+Rr}HxKr7gXBuY=g50$KIk6-`aUshnQRZZ=|HHa;mjnj^Yn87%nn8aI?xUw$c2 z7e{ZbD$uAZfR@%jmP&B<3lA}T<+_I;, +); + +if (import.meta.webpackHot) { + import.meta.webpackHot.accept(); +} diff --git a/examples/motion/src/rspeedy-env.d.ts b/examples/motion/src/rspeedy-env.d.ts new file mode 100644 index 0000000000..1c813a68b0 --- /dev/null +++ b/examples/motion/src/rspeedy-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/examples/motion/tsconfig.json b/examples/motion/tsconfig.json new file mode 100644 index 0000000000..cd63e98e01 --- /dev/null +++ b/examples/motion/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "@lynx-js/react", + "noEmit": true, + + "allowJs": true, + "checkJs": true, + "isolatedDeclarations": false, + }, + "include": ["src", "lynx.config.js", "test", "vitest.config.ts"], + "references": [ + { "path": "../../packages/react/tsconfig.json" }, + { "path": "../../packages/rspeedy/core/tsconfig.build.json" }, + { "path": "../../packages/rspeedy/plugin-qrcode/tsconfig.build.json" }, + { "path": "../../packages/rspeedy/plugin-react/tsconfig.build.json" }, + ], +} diff --git a/packages/third-party/motion/README.md b/packages/third-party/motion/README.md new file mode 100644 index 0000000000..93c034e4fe --- /dev/null +++ b/packages/third-party/motion/README.md @@ -0,0 +1,3 @@ +# motion-lynx + +This is a port of motion.dev for Lynx. Currently work in progress diff --git a/packages/third-party/motion/package.json b/packages/third-party/motion/package.json new file mode 100644 index 0000000000..62c636f16b --- /dev/null +++ b/packages/third-party/motion/package.json @@ -0,0 +1,44 @@ +{ + "name": "@lynx-js/motion-lynx", + "version": "0.0.1", + "private": true, + "description": "This is a motion adapter for Lynx.js", + "keywords": [ + "react", + "lynx", + "motion", + "framer-motion" + ], + "repository": { + "type": "git", + "url": "https://github.com/lynx-family/lynx-stack.git", + "directory": "packages/third-party/motion" + }, + "license": "MIT", + "type": "module", + "main": "src/index.ts", + "types": "src/index.ts", + "files": [ + "dist", + "src", + "README.md", + "CHANGELOG.md" + ], + "dependencies": { + "framer-motion": "12.23.12", + "motion-dom": "12.23.12" + }, + "devDependencies": { + "@lynx-js/react": "workspace:*", + "@lynx-js/types": "3.4.11" + }, + "peerDependencies": { + "@lynx-js/react": "*", + "@lynx-js/types": "*" + }, + "peerDependenciesMeta": { + "@lynx-js/types": { + "optional": true + } + } +} diff --git a/packages/third-party/motion/src/animation/index.ts b/packages/third-party/motion/src/animation/index.ts new file mode 100644 index 0000000000..18ac68446f --- /dev/null +++ b/packages/third-party/motion/src/animation/index.ts @@ -0,0 +1,58 @@ +// Copyright 2024 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import '../polyfill/shim.js'; + +import { + animate as animateOriginal, + stagger as staggerOriginal, +} from 'framer-motion/dom'; +import type { + AnimationOptions, + AnimationPlaybackControlsWithThen, + DOMKeyframesDefinition, + ElementOrSelector, +} from 'motion-dom'; + +import type { ElementOrElements } from '../types/index.js'; +import { registerCallable } from '../utils/registeredFunction.js'; + +let animateHandle: string; +let staggerHandle: string; + +if (__MAIN_THREAD__) { + animateHandle = registerCallable(animateOriginal, 'animate'); + staggerHandle = registerCallable(staggerOriginal, 'stagger'); +} else { + animateHandle = 'animate'; + staggerHandle = 'stagger'; +} + +function animate( + element: ElementOrElements, + keyframes: DOMKeyframesDefinition, + options?: AnimationOptions, +): AnimationPlaybackControlsWithThen { + 'main thread'; + + const elementNodes: ElementOrSelector = Array.isArray(element) + ? element.map(el => new globalThis.ElementCompt(el)) + : new globalThis.ElementCompt(element); + + return globalThis.runOnRegistered(animateHandle)( + elementNodes, + keyframes, + options, + ); +} + +function stagger( + ...args: Parameters +): ReturnType { + 'main thread'; + return globalThis.runOnRegistered(staggerHandle)( + ...args, + ); +} + +export { animate, stagger }; diff --git a/packages/third-party/motion/src/env_types/papi.d.ts b/packages/third-party/motion/src/env_types/papi.d.ts new file mode 100644 index 0000000000..95aa959644 --- /dev/null +++ b/packages/third-party/motion/src/env_types/papi.d.ts @@ -0,0 +1,108 @@ +// Copyright 2024 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +declare class ElementNode {} + +declare const __MAIN_THREAD__: boolean; + +declare function __AddInlineStyle( + e: ElementNode, + key: number | string, + value: string, +): void; + +declare function __FlushElementTree(element?: ElementNode): void; + +declare function __GetAttributeByName( + e: ElementNode, + name: string, +): undefined | string; + +declare function __GetAttributeNames(e: ElementNode): string[]; + +declare function __GetPageElement(): ElementNode; + +declare function __InvokeUIMethod( + e: ElementNode, + method: string, + params: Record, + callback: (res: { code: number; data: unknown }) => void, +): ElementNode[]; + +declare function __LoadLepusChunk( + name: string, + cfg: { chunkType: number; dynamicComponentEntry?: string | undefined }, +): boolean; + +declare function __QuerySelector( + e: ElementNode, + cssSelector: string, + params: { + onlyCurrentComponent?: boolean; + }, +): ElementNode | undefined; + +declare function __QuerySelectorAll( + e: ElementNode, + cssSelector: string, + params: { + onlyCurrentComponent?: boolean; + }, +): ElementNode[]; + +declare function __SetAttribute( + e: ElementNode, + key: string, + value: unknown, +): void; + +declare function __GetComputedStyleByKey(e: ElementNode, key: string): string; +/** + * Animation operation types for ElementAnimate function + */ +declare enum AnimationOperation { + START = 0, // Start a new animation + PLAY = 1, // Play/resume a paused animation + PAUSE = 2, // Pause an existing animation + CANCEL = 3, // Cancel an animation +} + +/** + * Animation timing options configuration + */ +interface AnimationTimingOptions { + name?: string; // Animation name (optional, auto-generated if not provided) + duration?: number | string; // Animation duration + delay?: number | string; // Animation delay + iterationCount?: number | string; // Number of iterations (can be 'infinite') + fillMode?: string; // Animation fill mode + timingFunction?: string; // Animation timing function + direction?: string; // Animation direction +} + +/** + * Keyframe definition for animation + */ +type Keyframe = Record; + +/** + * ElementAnimate function - controls animations on DOM elements + * @param element - The DOM element to animate (FiberElement reference) + * @param args - Animation configuration array + * @returns undefined + */ +declare function __ElementAnimate( + element: ElementNode, + args: [ + operation: AnimationOperation, // Animation operation type + name: string, // Animation name + keyframes: Keyframe[], // Array of keyframes + options?: AnimationTimingOptions, // Timing and configuration options + ] | [ + operation: + | AnimationOperation.PAUSE + | AnimationOperation.PLAY + | AnimationOperation.CANCEL, + name: string, // Animation name to pause/play + ], +): void; diff --git a/packages/third-party/motion/src/index.ts b/packages/third-party/motion/src/index.ts new file mode 100644 index 0000000000..c6989cc2b9 --- /dev/null +++ b/packages/third-party/motion/src/index.ts @@ -0,0 +1,4 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +export { animate, stagger } from './animation/index.js'; diff --git a/packages/third-party/motion/src/polyfill/element.ts b/packages/third-party/motion/src/polyfill/element.ts new file mode 100644 index 0000000000..24d5bbe71e --- /dev/null +++ b/packages/third-party/motion/src/polyfill/element.ts @@ -0,0 +1,156 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import type { MainThread } from '@lynx-js/types'; + +interface StyleObject { + [key: string]: string | ((property: string, value: string) => void); + setProperty(property: string, value: string): void; +} + +export class ElementCompt { + private element: MainThread.Element; + + constructor(element: MainThread.Element) { + this.element = element; + } + + public getComputedStyle(): Record { + const styleObject: Record = {}; + + return new Proxy(styleObject, { + get: (_target, prop) => { + // @ts-expect-error Expected + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + return __GetComputedStyleByKey(this.element.element, prop as string); + }, + }); + } + + public get style(): StyleObject { + const styleObject = {} as StyleObject; + + styleObject.setProperty = (property: string, value: string) => { + this.element.setStyleProperty(property, value); + }; + return new Proxy(styleObject, { + set: (target, prop, value) => { + if (typeof prop === 'string' && prop !== 'setProperty') { + this.element.setStyleProperty(prop, String(value)); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + target[prop] = value; + } + return true; + }, + get: (_target, prop) => { + if (typeof prop === 'string' && prop !== 'setProperty') { + return this.getStyleProperty(prop); + } + return undefined; + }, + }); + } + + public set style(styles: Record) { + this.element.setStyleProperties(styles); + } + + // Individual style property getters and setters + private getStyleProperty(name: string): string { + // @ts-expect-error Expected + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + return __GetComputedStyleByKey(this.element.element, name); + } + + // Common style properties + get backgroundColor(): string { + return this.getStyleProperty('backgroundColor'); + } + set backgroundColor(value: string) { + this.element.setStyleProperty('backgroundColor', value); + } + + get color(): string { + return this.getStyleProperty('color'); + } + set color(value: string) { + this.element.setStyleProperty('color', value); + } + + get fontSize(): string { + return this.getStyleProperty('fontSize'); + } + set fontSize(value: string) { + this.element.setStyleProperty('fontSize', value); + } + + get width(): string { + return this.getStyleProperty('width'); + } + set width(value: string) { + this.element.setStyleProperty('width', value); + } + + get height(): string { + return this.getStyleProperty('height'); + } + set height(value: string) { + this.element.setStyleProperty('height', value); + } + + get margin(): string { + return this.getStyleProperty('margin'); + } + set margin(value: string) { + this.element.setStyleProperty('margin', value); + } + + get padding(): string { + return this.getStyleProperty('padding'); + } + set padding(value: string) { + this.element.setStyleProperty('padding', value); + } + + get display(): string { + return this.getStyleProperty('display'); + } + set display(value: string) { + this.element.setStyleProperty('display', value); + } + + get position(): string { + return this.getStyleProperty('position'); + } + set position(value: string) { + this.element.setStyleProperty('position', value); + } + + get top(): string { + return this.getStyleProperty('top'); + } + set top(value: string) { + this.element.setStyleProperty('top', value); + } + + get left(): string { + return this.getStyleProperty('left'); + } + set left(value: string) { + this.element.setStyleProperty('left', value); + } + + get right(): string { + return this.getStyleProperty('right'); + } + set right(value: string) { + this.element.setStyleProperty('right', value); + } + + get bottom(): string { + return this.getStyleProperty('bottom'); + } + set bottom(value: string) { + this.element.setStyleProperty('bottom', value); + } +} diff --git a/packages/third-party/motion/src/polyfill/shim.ts b/packages/third-party/motion/src/polyfill/shim.ts new file mode 100644 index 0000000000..a8c32c8d42 --- /dev/null +++ b/packages/third-party/motion/src/polyfill/shim.ts @@ -0,0 +1,67 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import { document, setupDocument } from '@lynx-js/react/internal/document'; +import type { MainThread } from '@lynx-js/types'; + +import { ElementCompt } from './element.js'; + +const timeOrigin = Date.now(); + +declare global { + var ElementCompt: new(element: MainThread.Element) => ElementCompt; + var Element: new(element: MainThread.Element) => ElementCompt; +} + +if (__MAIN_THREAD__) { + setupDocument(); + + const performance = { + now: () => Date.now() - timeOrigin, + }; + + function queueMicrotask(fn: CallableFunction) { + void Promise.resolve().then(() => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + fn(); + }); + } + + class NodeList {} + + class SVGElement {} + + const window = { + // biome-ignore lint/suspicious/noExplicitAny: + getComputedStyle: (ele: any) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access + return ele.getComputedStyle(); + }, + }; + + class HTMLElement {} + + // @ts-expect-error error + globalThis.document = document; + // @ts-expect-error error + globalThis.performance = performance; + globalThis.queueMicrotask = queueMicrotask; + // @ts-expect-error error + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + document.querySelector = lynx.querySelector; + // @ts-expect-error error + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + document.querySelectorAll = lynx.querySelectorAll; + // @ts-expect-error error + globalThis.NodeList = NodeList; + // @ts-expect-error error + globalThis.SVGElement = SVGElement; + // @ts-expect-error error + globalThis.window = window; + // @ts-expect-error error + globalThis.getComputedStyle = window.getComputedStyle; + // @ts-expect-error error + globalThis.HTMLElement = HTMLElement; + globalThis.ElementCompt = ElementCompt; + globalThis.Element = ElementCompt; +} diff --git a/packages/third-party/motion/src/types/index.ts b/packages/third-party/motion/src/types/index.ts new file mode 100644 index 0000000000..848414bdb3 --- /dev/null +++ b/packages/third-party/motion/src/types/index.ts @@ -0,0 +1,7 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { MainThread } from '@lynx-js/types'; + +export type ElementOrElements = MainThread.Element | MainThread.Element[]; diff --git a/packages/third-party/motion/src/utils/noop.ts b/packages/third-party/motion/src/utils/noop.ts new file mode 100644 index 0000000000..71e7b374b5 --- /dev/null +++ b/packages/third-party/motion/src/utils/noop.ts @@ -0,0 +1,5 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +export const noop = (): void => {}; diff --git a/packages/third-party/motion/src/utils/registeredFunction.ts b/packages/third-party/motion/src/utils/registeredFunction.ts new file mode 100644 index 0000000000..086fea4c04 --- /dev/null +++ b/packages/third-party/motion/src/utils/registeredFunction.ts @@ -0,0 +1,29 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import { noop } from './noop.js'; + +const registeredCallableMap = new Map(); // Regular Map for primitive keys + +export function registerCallable(func: CallableFunction, id: string): string { + registeredCallableMap.set(id, func); + + return id; +} + +export function runOnRegistered( + id: string, +): T { + const func = registeredCallableMap.get(id) ?? noop; + return func as unknown as T; +} + +declare global { + var runOnRegistered: ( + id: string, + ) => T; +} + +// We use globalThis trick to get over with closure capture +// @TODO: Remove this when ReactLynx supports importing MTS for module +globalThis.runOnRegistered = runOnRegistered; diff --git a/packages/third-party/motion/tsconfig.build.json b/packages/third-party/motion/tsconfig.build.json new file mode 100644 index 0000000000..71cce3ca8a --- /dev/null +++ b/packages/third-party/motion/tsconfig.build.json @@ -0,0 +1,3 @@ +{ + "extends": "./tsconfig.json", +} diff --git a/packages/third-party/motion/tsconfig.json b/packages/third-party/motion/tsconfig.json new file mode 100644 index 0000000000..697d0276b9 --- /dev/null +++ b/packages/third-party/motion/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": "./src", + "composite": true, + }, + "include": [ + "src", + ], +} diff --git a/packages/third-party/tsconfig.json b/packages/third-party/tsconfig.json index afea2b2e65..62183958de 100644 --- a/packages/third-party/tsconfig.json +++ b/packages/third-party/tsconfig.json @@ -5,6 +5,7 @@ "references": [ /** packages-start */ { "path": "./tailwind-preset/tsconfig.build.json" }, + { "path": "./motion/tsconfig.json" }, /** packages-end */ ], "include": [], diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aa2426dcef..44919a1b36 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -186,6 +186,34 @@ importers: specifier: ^18.3.25 version: 18.3.25 + examples/motion: + dependencies: + '@lynx-js/motion-lynx': + specifier: workspace:* + version: link:../../packages/third-party/motion + '@lynx-js/react': + specifier: workspace:* + version: link:../../packages/react + devDependencies: + '@lynx-js/preact-devtools': + specifier: ^5.0.1-cf9aef5 + version: 5.0.1 + '@lynx-js/qrcode-rsbuild-plugin': + specifier: workspace:* + version: link:../../packages/rspeedy/plugin-qrcode + '@lynx-js/react-rsbuild-plugin': + specifier: workspace:* + version: link:../../packages/rspeedy/plugin-react + '@lynx-js/rspeedy': + specifier: workspace:* + version: link:../../packages/rspeedy/core + '@lynx-js/types': + specifier: 3.4.11 + version: 3.4.11 + '@types/react': + specifier: ^18.3.25 + version: 18.3.25 + examples/react: dependencies: '@lynx-js/react': @@ -826,6 +854,22 @@ importers: specifier: 0.3.3 version: 0.3.3(@rsbuild/core@1.5.17) + packages/third-party/motion: + dependencies: + framer-motion: + specifier: 12.23.12 + version: 12.23.12(react-dom@19.1.1(react@19.1.1))(react@19.1.1) + motion-dom: + specifier: 12.23.12 + version: 12.23.12 + devDependencies: + '@lynx-js/react': + specifier: workspace:* + version: link:../../react + '@lynx-js/types': + specifier: 3.4.11 + version: 3.4.11 + packages/third-party/tailwind-preset: devDependencies: tailwindcss: @@ -5782,8 +5826,8 @@ packages: resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} engines: {node: '>= 0.6'} - framer-motion@12.23.6: - resolution: {integrity: sha512-dsJ389QImVE3lQvM8Mnk99/j8tiZDM/7706PCqvkQ8sSCnpmWxsgX+g0lj7r5OBVL0U36pIecCTBoIWcM2RuKw==} + framer-motion@12.23.12: + resolution: {integrity: sha512-6e78rdVtnBvlEVgu6eFEAgG9v3wLnYEboM8I5O5EXvfKC8gxGQB8wXJdhkMy10iVcn05jl6CNw7/HTsTCfwcWg==} peerDependencies: '@emotion/is-prop-valid': '*' react: ^18.0.0 || ^19.0.0 @@ -7025,8 +7069,8 @@ packages: resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} engines: {node: '>=16 || 14 >=14.17'} - motion-dom@12.23.6: - resolution: {integrity: sha512-G2w6Nw7ZOVSzcQmsdLc0doMe64O/Sbuc2bVAbgMz6oP/6/pRStKRiVRV4bQfHp5AHYAKEGhEdVHTM+R3FDgi5w==} + motion-dom@12.23.12: + resolution: {integrity: sha512-RcR4fvMCTESQBD/uKQe49D5RUeDOokkGRmz4ceaJKDBgHYtZtntC/s2vLvY38gqGaytinij/yi3hMcWVcEF5Kw==} motion-utils@12.23.6: resolution: {integrity: sha512-eAWoPgr4eFEOFfg2WjIsMoqJTW6Z8MTUCgn/GZ3VRpClWBdnbjryiA3ZSNLyxCTmCQx4RmYX6jX1iWHbenUPNQ==} @@ -11816,7 +11860,7 @@ snapshots: '@rstack-dev/doc-ui@1.11.0(react-dom@19.1.1(react@19.1.1))(react@19.1.1)': dependencies: - framer-motion: 12.23.6(react-dom@19.1.1(react@19.1.1))(react@19.1.1) + framer-motion: 12.23.12(react-dom@19.1.1(react@19.1.1))(react@19.1.1) transitivePeerDependencies: - '@emotion/is-prop-valid' - react @@ -14761,9 +14805,9 @@ snapshots: forwarded@0.2.0: {} - framer-motion@12.23.6(react-dom@19.1.1(react@19.1.1))(react@19.1.1): + framer-motion@12.23.12(react-dom@19.1.1(react@19.1.1))(react@19.1.1): dependencies: - motion-dom: 12.23.6 + motion-dom: 12.23.12 motion-utils: 12.23.6 tslib: 2.8.1 optionalDependencies: @@ -16406,7 +16450,7 @@ snapshots: minipass@7.1.2: {} - motion-dom@12.23.6: + motion-dom@12.23.12: dependencies: motion-utils: 12.23.6 From daf0ccd403f87c207dbe7a6821ae832e12bd7d4f Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Fri, 21 Nov 2025 18:08:12 +0800 Subject: [PATCH 02/37] feat: add more features like motionValue, springValue --- examples/motion/src/App.tsx | 10 ++ examples/motion/src/Basic/index.tsx | 4 +- examples/motion/src/BasicSelector/index.tsx | 55 +++++++++ examples/motion/src/BasicSelector/styles.css | 6 + examples/motion/src/MotionValue/index.tsx | 67 +++++++++++ examples/motion/src/MotionValue/styles.css | 6 + .../motion/__tests__/animation.test.tsx | 104 ++++++++++++++++++ packages/third-party/motion/package.json | 3 + .../third-party/motion/src/animation/index.ts | 101 ++++++++++++++++- packages/third-party/motion/src/index.ts | 11 +- .../third-party/motion/src/polyfill/shim.ts | 6 +- packages/third-party/motion/tsconfig.json | 3 + packages/third-party/motion/vitest.config.ts | 12 ++ 13 files changed, 377 insertions(+), 11 deletions(-) create mode 100644 examples/motion/src/BasicSelector/index.tsx create mode 100644 examples/motion/src/BasicSelector/styles.css create mode 100644 examples/motion/src/MotionValue/index.tsx create mode 100644 examples/motion/src/MotionValue/styles.css create mode 100644 packages/third-party/motion/__tests__/animation.test.tsx create mode 100644 packages/third-party/motion/vitest.config.ts diff --git a/examples/motion/src/App.tsx b/examples/motion/src/App.tsx index 4bb6b755db..29b7e52696 100644 --- a/examples/motion/src/App.tsx +++ b/examples/motion/src/App.tsx @@ -2,7 +2,9 @@ import { useState } from '@lynx-js/react'; import Basic from './Basic/index.js'; import BasicPercent from './BasicPercent/index.js'; +import BasicSelector from './BasicSelector/index.js'; import ColorInterception from './ColorInterception/index.js'; +import MotionValue from './MotionValue/index.js'; import Spring from './Spring/index.js'; import Stagger from './Stagger/index.js'; import Text from './Text/index.js'; @@ -34,6 +36,14 @@ const CASES = [ name: 'Text', comp: Text, }, + { + name: 'BasicSelector', + comp: BasicSelector, + }, + { + name: 'MotionValue', + comp: MotionValue, + }, ]; export function App() { diff --git a/examples/motion/src/Basic/index.tsx b/examples/motion/src/Basic/index.tsx index 4276c3bc4d..9c5d45e98e 100644 --- a/examples/motion/src/Basic/index.tsx +++ b/examples/motion/src/Basic/index.tsx @@ -4,7 +4,7 @@ import type { MainThread } from '@lynx-js/types'; import './styles.css'; -export default function BasicPercent() { +export default function Basic() { const animateMTRef = useMainThreadRef | null>( null, ); @@ -38,7 +38,7 @@ export default function BasicPercent() { void runOnMainThread(startAnimation)(); }, 1000); return () => { - runOnMainThread(endAnimation); + void runOnMainThread(endAnimation); }; }, []); diff --git a/examples/motion/src/BasicSelector/index.tsx b/examples/motion/src/BasicSelector/index.tsx new file mode 100644 index 0000000000..72ba724b0c --- /dev/null +++ b/examples/motion/src/BasicSelector/index.tsx @@ -0,0 +1,55 @@ +import { animate } from '@lynx-js/motion-lynx'; +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; + +import './styles.css'; + +export default function Basic() { + const animateMTRef = useMainThreadRef | null>( + null, + ); + + function startAnimation() { + 'main thread'; + animateMTRef.current = animate( + '.box', + { scale: 0.4, rotate: '45deg' }, + { + ease: 'circInOut', + duration: 1, + repeat: Number.POSITIVE_INFINITY, + repeatType: 'reverse', + }, + ); + } + + function endAnimation() { + 'main thread'; + + animateMTRef.current?.stop(); + } + + useEffect(() => { + setTimeout(() => { + void runOnMainThread(startAnimation)(); + }, 1000); + return () => { + void runOnMainThread(endAnimation); + }; + }, []); + + return ( + + + + + ); +} diff --git a/examples/motion/src/BasicSelector/styles.css b/examples/motion/src/BasicSelector/styles.css new file mode 100644 index 0000000000..feb286bddb --- /dev/null +++ b/examples/motion/src/BasicSelector/styles.css @@ -0,0 +1,6 @@ +.case-container { + height: 100%; + display: flex; + justify-content: center; + align-items: center; +} diff --git a/examples/motion/src/MotionValue/index.tsx b/examples/motion/src/MotionValue/index.tsx new file mode 100644 index 0000000000..cdd3f98825 --- /dev/null +++ b/examples/motion/src/MotionValue/index.tsx @@ -0,0 +1,67 @@ +import { type animate, motionValue } from '@lynx-js/motion-lynx'; +import type { MotionValue } from '@lynx-js/motion-lynx'; +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; +import type { MainThread } from '@lynx-js/types'; + +import './styles.css'; + +export default function Basic() { + const animateMTRef = useMainThreadRef | null>( + null, + ); + const boxMTRef = useMainThreadRef(null); + const valueMTRef = useMainThreadRef>(); + + function bindMotionValueCallback() { + 'main thread'; + + valueMTRef.current ??= motionValue(0.5); + + valueMTRef.current.on('change', (value) => { + boxMTRef.current?.setStyleProperties({ + transform: `scale(${value})`, + }); + }); + } + + function startAnimation() { + 'main thread'; + + bindMotionValueCallback(); + + setInterval(() => { + valueMTRef.current?.set(valueMTRef.current.get() + 0.5); + }, 1000); + } + + function endAnimation() { + 'main thread'; + + animateMTRef.current?.stop(); + } + + useEffect(() => { + setTimeout(() => { + void runOnMainThread(startAnimation)(); + }, 1000); + return () => { + void runOnMainThread(endAnimation); + }; + }, []); + + return ( + + + + + ); +} diff --git a/examples/motion/src/MotionValue/styles.css b/examples/motion/src/MotionValue/styles.css new file mode 100644 index 0000000000..feb286bddb --- /dev/null +++ b/examples/motion/src/MotionValue/styles.css @@ -0,0 +1,6 @@ +.case-container { + height: 100%; + display: flex; + justify-content: center; + align-items: center; +} diff --git a/packages/third-party/motion/__tests__/animation.test.tsx b/packages/third-party/motion/__tests__/animation.test.tsx new file mode 100644 index 0000000000..08bc349cce --- /dev/null +++ b/packages/third-party/motion/__tests__/animation.test.tsx @@ -0,0 +1,104 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; + +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; +import { act, render } from '@lynx-js/react/testing-library'; +import { MainThread } from '@lynx-js/types'; + +import { animate } from '../src/index.js'; +import { noop } from '../src/utils/noop.js'; + +describe('motion wrapping animation functions', () => { + let _mockRegisterCallable; + beforeEach(() => { + const mockRegisteredMap = new Map(); + vi.spyOn(globalThis, 'runOnRegistered', 'get').mockImplementation(function( + id: string, + ) { + const func = mockRegisteredMap.get(id) ?? noop; + return func; + }); + + function mockRegisterCallable( + func: CallableFunction, + id: string, + ): CallableFunction { + mockRegisteredMap.set(id, func); + + return func; + } + + _mockRegisterCallable = mockRegisterCallable; + }); + + afterEach(() => { + vi.restoreAllMocks(); + }); + + test('motion animate should be called', async () => { + let _startAnimation: () => void; + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call + const _mockAnimate = _mockRegisterCallable(vi.fn(), 'animate'); + + const App = () => { + const boxMTRef = useMainThreadRef(null); + + console.log('renderApp'); + + function startAnimation() { + 'main thread'; + + if (boxMTRef.current) { + animate( + boxMTRef.current, + { scale: 0.4, rotate: '45deg' }, + { + ease: 'circInOut', + duration: 1, + repeat: Number.POSITIVE_INFINITY, + repeatType: 'reverse', + }, + ); + } + } + + _startAnimation = startAnimation; + + return ( + + + + ); + }; + + await act(() => { + render(, { + enableMainThread: true, + enableBackgroundThread: true, + }); + }); + + await runOnMainThread(() => { + 'main thread'; + _startAnimation(); + })(); + + // Check that the mock was called + expect(_mockAnimate).toHaveBeenCalled(); + + // You can also check what arguments it received + expect(_mockAnimate).toHaveBeenCalledWith( + expect.anything(), // the element + { scale: 0.4, rotate: '45deg' }, + { + ease: 'circInOut', + duration: 1, + repeat: Number.POSITIVE_INFINITY, + repeatType: 'reverse', + }, + ); + }); +}); diff --git a/packages/third-party/motion/package.json b/packages/third-party/motion/package.json index 62c636f16b..57b223ee6c 100644 --- a/packages/third-party/motion/package.json +++ b/packages/third-party/motion/package.json @@ -24,6 +24,9 @@ "README.md", "CHANGELOG.md" ], + "scripts": { + "test": "vitest run" + }, "dependencies": { "framer-motion": "12.23.12", "motion-dom": "12.23.12" diff --git a/packages/third-party/motion/src/animation/index.ts b/packages/third-party/motion/src/animation/index.ts index 18ac68446f..89dac83f97 100644 --- a/packages/third-party/motion/src/animation/index.ts +++ b/packages/third-party/motion/src/animation/index.ts @@ -7,11 +7,22 @@ import { animate as animateOriginal, stagger as staggerOriginal, } from 'framer-motion/dom'; +import { + mix as mixOrig, + motionValue as motionValueOrig, + spring as springOrig, + springValue as springValueOrig, +} from 'motion-dom'; import type { AnimationOptions, AnimationPlaybackControlsWithThen, + AnyResolvedKeyframe, DOMKeyframesDefinition, ElementOrSelector, + Mixer, + MotionValue, + MotionValueOptions, + SpringOptions, } from 'motion-dom'; import type { ElementOrElements } from '../types/index.js'; @@ -19,26 +30,67 @@ import { registerCallable } from '../utils/registeredFunction.js'; let animateHandle: string; let staggerHandle: string; +let motionValueHandle: string; +let springHandle: string; +let springValueHandle: string; +let mixHandle: string; if (__MAIN_THREAD__) { animateHandle = registerCallable(animateOriginal, 'animate'); staggerHandle = registerCallable(staggerOriginal, 'stagger'); + motionValueHandle = registerCallable(motionValueOrig, 'motionValue'); + springHandle = registerCallable(springOrig, 'spring'); + springValueHandle = registerCallable(springValueOrig, 'springValue'); + mixHandle = registerCallable(mixOrig, 'mix'); } else { animateHandle = 'animate'; staggerHandle = 'stagger'; + motionValueHandle = 'motionValue'; + springHandle = 'spring'; + springValueHandle = 'springValue'; + mixHandle = 'mix'; } +/** + * Animate a string + */ +function animate( + value: string, + keyframes: DOMKeyframesDefinition, + options?: AnimationOptions, +): AnimationPlaybackControlsWithThen; + +/** + * Animate a main thread element + */ +function animate( + value: ElementOrElements, + keyframes: DOMKeyframesDefinition, + options?: AnimationOptions, +): AnimationPlaybackControlsWithThen; + function animate( - element: ElementOrElements, + element: ElementOrElements | string, keyframes: DOMKeyframesDefinition, options?: AnimationOptions, ): AnimationPlaybackControlsWithThen { 'main thread'; - const elementNodes: ElementOrSelector = Array.isArray(element) - ? element.map(el => new globalThis.ElementCompt(el)) - : new globalThis.ElementCompt(element); + let originalElementNodes: ElementOrElements; + + if (typeof element === 'string') { + originalElementNodes = lynx.querySelectorAll(element); + } else { + originalElementNodes = element; + } + const elementNodes = (Array.isArray(originalElementNodes) + ? originalElementNodes.map(el => new globalThis.ElementCompt(el)) + : new globalThis.ElementCompt( + originalElementNodes, + )) as unknown as ElementOrSelector; + + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module return globalThis.runOnRegistered(animateHandle)( elementNodes, keyframes, @@ -50,9 +102,48 @@ function stagger( ...args: Parameters ): ReturnType { 'main thread'; + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module return globalThis.runOnRegistered(staggerHandle)( ...args, ); } -export { animate, stagger }; +function motionValue( + init: V, + options?: MotionValueOptions, +): MotionValue { + 'main thread'; + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module + return globalThis.runOnRegistered(motionValueHandle)( + init, + options, + ); +} + +function spring( + ...args: Parameters +): ReturnType { + 'main thread'; + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module + return globalThis.runOnRegistered(springHandle)(...args); +} + +function springValue( + source: T | MotionValue, + options?: SpringOptions, +): MotionValue { + 'main thread'; + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module + return globalThis.runOnRegistered(springValueHandle)( + source, + options, + ); +} + +function mix(from: T, to: T): Mixer { + 'main thread'; + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module + return globalThis.runOnRegistered('mix')(from, to); +} + +export { animate, stagger, motionValue, spring, springValue, mix }; diff --git a/packages/third-party/motion/src/index.ts b/packages/third-party/motion/src/index.ts index c6989cc2b9..5703fee7b0 100644 --- a/packages/third-party/motion/src/index.ts +++ b/packages/third-party/motion/src/index.ts @@ -1,4 +1,13 @@ // Copyright 2025 The Lynx Authors. All rights reserved. // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. -export { animate, stagger } from './animation/index.js'; +export { + animate, + stagger, + motionValue, + spring, + springValue, + mix, +} from './animation/index.js'; + +export type { MotionValue } from 'motion-dom'; diff --git a/packages/third-party/motion/src/polyfill/shim.ts b/packages/third-party/motion/src/polyfill/shim.ts index a8c32c8d42..efca30f618 100644 --- a/packages/third-party/motion/src/polyfill/shim.ts +++ b/packages/third-party/motion/src/polyfill/shim.ts @@ -47,10 +47,10 @@ if (__MAIN_THREAD__) { globalThis.performance = performance; globalThis.queueMicrotask = queueMicrotask; // @ts-expect-error error - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + document.querySelector = lynx.querySelector; // @ts-expect-error error - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + document.querySelectorAll = lynx.querySelectorAll; // @ts-expect-error error globalThis.NodeList = NodeList; @@ -58,10 +58,10 @@ if (__MAIN_THREAD__) { globalThis.SVGElement = SVGElement; // @ts-expect-error error globalThis.window = window; - // @ts-expect-error error globalThis.getComputedStyle = window.getComputedStyle; // @ts-expect-error error globalThis.HTMLElement = HTMLElement; globalThis.ElementCompt = ElementCompt; + // @ts-expect-error error globalThis.Element = ElementCompt; } diff --git a/packages/third-party/motion/tsconfig.json b/packages/third-party/motion/tsconfig.json index 697d0276b9..4555eb1ab5 100644 --- a/packages/third-party/motion/tsconfig.json +++ b/packages/third-party/motion/tsconfig.json @@ -4,8 +4,11 @@ "outDir": "./dist", "rootDir": "./src", "composite": true, + "jsx": "react-jsx", + "jsxImportSource": "@lynx-js/react", }, "include": [ "src", + "__tests__", ], } diff --git a/packages/third-party/motion/vitest.config.ts b/packages/third-party/motion/vitest.config.ts new file mode 100644 index 0000000000..2cf6f7d9a7 --- /dev/null +++ b/packages/third-party/motion/vitest.config.ts @@ -0,0 +1,12 @@ +import { defineConfig, mergeConfig } from 'vitest/config'; +import { createVitestConfig } from '@lynx-js/react/testing-library/vitest-config'; + +const defaultConfig = await createVitestConfig(); +const config = defineConfig({ + test: { + include: ['__tests__/**/*.test.{js,ts,jsx,tsx}'], + exclude: ['__tests__/utils/**'], + }, +}); + +export default mergeConfig(defaultConfig, config); From 37f15926219a97d5c9c8058b8aeb601c954139a6 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 24 Nov 2025 21:35:07 +0800 Subject: [PATCH 03/37] feat: add useMotionValueRefEvent --- packages/third-party/motion/package.json | 4 +- .../third-party/motion/src/animation/index.ts | 134 +++++++++++++++--- .../motion/src/hooks/useMotionEvent.ts | 31 ++++ .../motion/src/hooks/useMotionValueRef.ts | 39 +++++ packages/third-party/motion/src/index.ts | 4 + .../motion/src/modified/motionValue.ts | 19 +++ .../motion/src/utils/isMainThreadElement.ts | 23 +++ .../third-party/motion/tsconfig.build.json | 3 + packages/third-party/motion/tsconfig.json | 2 + 9 files changed, 237 insertions(+), 22 deletions(-) create mode 100644 packages/third-party/motion/src/hooks/useMotionEvent.ts create mode 100644 packages/third-party/motion/src/hooks/useMotionValueRef.ts create mode 100644 packages/third-party/motion/src/modified/motionValue.ts create mode 100644 packages/third-party/motion/src/utils/isMainThreadElement.ts diff --git a/packages/third-party/motion/package.json b/packages/third-party/motion/package.json index 57b223ee6c..00f7acef54 100644 --- a/packages/third-party/motion/package.json +++ b/packages/third-party/motion/package.json @@ -16,8 +16,8 @@ }, "license": "MIT", "type": "module", - "main": "src/index.ts", - "types": "src/index.ts", + "main": "dist/index.js", + "types": "dist/index.d.ts", "files": [ "dist", "src", diff --git a/packages/third-party/motion/src/animation/index.ts b/packages/third-party/motion/src/animation/index.ts index 89dac83f97..617a5697a8 100644 --- a/packages/third-party/motion/src/animation/index.ts +++ b/packages/third-party/motion/src/animation/index.ts @@ -7,9 +7,13 @@ import { animate as animateOriginal, stagger as staggerOriginal, } from 'framer-motion/dom'; +import type { + AnimationSequence, + ObjectTarget, + SequenceOptions, +} from 'framer-motion/dom'; import { mix as mixOrig, - motionValue as motionValueOrig, spring as springOrig, springValue as springValueOrig, } from 'motion-dom'; @@ -23,9 +27,17 @@ import type { MotionValue, MotionValueOptions, SpringOptions, + UnresolvedValueKeyframe, + ValueAnimationTransition, } from 'motion-dom'; +import { useMotionValueRefEvent } from '../hooks/useMotionEvent.js'; +import { motionValue as motionValueOrig } from '../modified/motionValue.js'; import type { ElementOrElements } from '../types/index.js'; +import { + isMainThreadElement, + isMainThreadElementArray, +} from '../utils/isMainThreadElement.js'; import { registerCallable } from '../utils/registeredFunction.js'; let animateHandle: string; @@ -51,6 +63,14 @@ if (__MAIN_THREAD__) { mixHandle = 'mix'; } +/** + * Animate a sequence + */ +function animate( + sequence: AnimationSequence, + options?: SequenceOptions, +): AnimationPlaybackControlsWithThen; + /** * Animate a string */ @@ -61,40 +81,111 @@ function animate( ): AnimationPlaybackControlsWithThen; /** - * Animate a main thread element + * Animate a string */ function animate( - value: ElementOrElements, - keyframes: DOMKeyframesDefinition, + value: string | MotionValue, + keyframes: string | UnresolvedValueKeyframe[], + options?: ValueAnimationTransition, +): AnimationPlaybackControlsWithThen; +/** + * Animate a number + */ +function animate( + value: number | MotionValue, + keyframes: number | UnresolvedValueKeyframe[], + options?: ValueAnimationTransition, +): AnimationPlaybackControlsWithThen; +/** + * Animate a generic motion value + */ +function animate( + value: V | MotionValue, + keyframes: V | UnresolvedValueKeyframe[], + options?: ValueAnimationTransition, +): AnimationPlaybackControlsWithThen; + +/** + * Animate an object + */ +function animate( + object: O | O[], + keyframes: ObjectTarget, options?: AnimationOptions, ): AnimationPlaybackControlsWithThen; +/** + * Animate a main thread element + */ function animate( - element: ElementOrElements | string, + value: ElementOrElements, keyframes: DOMKeyframesDefinition, options?: AnimationOptions, +): AnimationPlaybackControlsWithThen; + +function animate( + subjectOrSequence: + | MotionValue + | MotionValue + | number + | string + | ElementOrElements + | O + | O[] + | AnimationSequence, + optionsOrKeyframes?: + | number + | string + | UnresolvedValueKeyframe[] + | UnresolvedValueKeyframe[] + | DOMKeyframesDefinition + | ObjectTarget + | SequenceOptions, + options?: + | ValueAnimationTransition + | ValueAnimationTransition + | AnimationOptions, ): AnimationPlaybackControlsWithThen { 'main thread'; - let originalElementNodes: ElementOrElements; - - if (typeof element === 'string') { - originalElementNodes = lynx.querySelectorAll(element); + let realSubjectOrSequence: + | AnimationSequence + | MotionValue + | MotionValue + | number + | string + | ElementOrSelector + | O + | O[]; + + if ( + typeof subjectOrSequence === 'string' + || isMainThreadElement(subjectOrSequence) + || isMainThreadElementArray(subjectOrSequence) + ) { + let elementNodes: ElementOrElements; + if (typeof subjectOrSequence === 'string') { + elementNodes = lynx.querySelectorAll(subjectOrSequence); + } else { + elementNodes = subjectOrSequence; + } + realSubjectOrSequence = (Array.isArray(elementNodes) + ? elementNodes.map(el => new globalThis.ElementCompt(el)) + : new globalThis.ElementCompt( + elementNodes, + )) as unknown as ElementOrSelector; } else { - originalElementNodes = element; + realSubjectOrSequence = subjectOrSequence; } - const elementNodes = (Array.isArray(originalElementNodes) - ? originalElementNodes.map(el => new globalThis.ElementCompt(el)) - : new globalThis.ElementCompt( - originalElementNodes, - )) as unknown as ElementOrSelector; - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module return globalThis.runOnRegistered(animateHandle)( - elementNodes, - keyframes, - options, + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + realSubjectOrSequence as any, + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + optionsOrKeyframes as any, + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + options as any, ); } @@ -143,7 +234,10 @@ function springValue( function mix(from: T, to: T): Mixer { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered('mix')(from, to); + return globalThis.runOnRegistered(mixHandle)(from, to); } +export const noop = (): void => {}; + export { animate, stagger, motionValue, spring, springValue, mix }; +export { useMotionValueRefEvent }; diff --git a/packages/third-party/motion/src/hooks/useMotionEvent.ts b/packages/third-party/motion/src/hooks/useMotionEvent.ts new file mode 100644 index 0000000000..ed21663368 --- /dev/null +++ b/packages/third-party/motion/src/hooks/useMotionEvent.ts @@ -0,0 +1,31 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import type { MotionValue, MotionValueEventCallbacks } from 'motion-dom'; + +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; +import type { MainThreadRef } from '@lynx-js/react'; + +export function useMotionValueRefEvent< + V, + EventName extends keyof MotionValueEventCallbacks, +>( + valueRef: MainThreadRef>, + event: 'change', + callback: MotionValueEventCallbacks[EventName], +): void { + const unListenRef = useMainThreadRef(); + + useEffect(() => { + void runOnMainThread(() => { + 'main thread'; + unListenRef.current = valueRef.current.on(event, callback); + })(); + return () => { + void runOnMainThread(() => { + 'main thread'; + unListenRef.current?.(); + })(); + }; + }, [callback]); +} diff --git a/packages/third-party/motion/src/hooks/useMotionValueRef.ts b/packages/third-party/motion/src/hooks/useMotionValueRef.ts new file mode 100644 index 0000000000..9e1adec8a6 --- /dev/null +++ b/packages/third-party/motion/src/hooks/useMotionValueRef.ts @@ -0,0 +1,39 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import type { MotionValue } from 'motion-dom'; + +import { runOnMainThread, useMainThreadRef, useMemo } from '@lynx-js/react'; +import type { MainThreadRef } from '@lynx-js/react'; +import { runWorkletCtx } from '@lynx-js/react/worklet-runtime/bindings'; +import type { + Worklet, + WorkletRef, +} from '@lynx-js/react/worklet-runtime/bindings'; + +import { motionValue } from '../animation/index.js'; + +export function useMotionValueRef(value: T): MainThreadRef> { + // @ts-expect-error expected + const motionValueRef: MainThreadRef> = useMainThreadRef< + MotionValue + >(); + + useMemo(() => { + function setMotionValue(value: T) { + 'main thread'; + if (!motionValueRef.current) { + motionValueRef.current = motionValue(value); + } + } + if (__BACKGROUND__) { + void runOnMainThread(setMotionValue)(value); + } else { + runWorkletCtx(setMotionValue as unknown as Worklet, [ + value as WorkletRef, + ]); + } + }, []); + + return motionValueRef; +} diff --git a/packages/third-party/motion/src/index.ts b/packages/third-party/motion/src/index.ts index 5703fee7b0..97353c4478 100644 --- a/packages/third-party/motion/src/index.ts +++ b/packages/third-party/motion/src/index.ts @@ -8,6 +8,10 @@ export { spring, springValue, mix, + noop, + useMotionValueRefEvent, } from './animation/index.js'; +export { useMotionValueRef } from './hooks/useMotionValueRef.js'; + export type { MotionValue } from 'motion-dom'; diff --git a/packages/third-party/motion/src/modified/motionValue.ts b/packages/third-party/motion/src/modified/motionValue.ts new file mode 100644 index 0000000000..ac93415b8d --- /dev/null +++ b/packages/third-party/motion/src/modified/motionValue.ts @@ -0,0 +1,19 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { MotionValue } from 'motion-dom'; +import type { MotionValueOptions } from 'motion-dom'; + +class CustomMotionValue extends MotionValue { + toJSON() { + return {}; + } +} + +export function motionValue( + init: V, + options?: MotionValueOptions, +): MotionValue { + return new CustomMotionValue(init, options); +} diff --git a/packages/third-party/motion/src/utils/isMainThreadElement.ts b/packages/third-party/motion/src/utils/isMainThreadElement.ts new file mode 100644 index 0000000000..e3e24a214c --- /dev/null +++ b/packages/third-party/motion/src/utils/isMainThreadElement.ts @@ -0,0 +1,23 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import type { MainThread } from '@lynx-js/types'; + +export function isMainThreadElement(ele: unknown): ele is MainThread.Element { + 'main thread'; + // @ts-expect-error error + // biome-ignore lint/complexity/useOptionalChain: + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + if (ele && ele.element && ele.element.elementRefptr) { + return true; + } else { + return false; + } +} + +export function isMainThreadElementArray( + eleArr: unknown, +): eleArr is MainThread.Element[] { + 'main thread'; + return Array.isArray(eleArr) && eleArr.every(ele => isMainThreadElement(ele)); +} diff --git a/packages/third-party/motion/tsconfig.build.json b/packages/third-party/motion/tsconfig.build.json index 71cce3ca8a..670455b7ee 100644 --- a/packages/third-party/motion/tsconfig.build.json +++ b/packages/third-party/motion/tsconfig.build.json @@ -1,3 +1,6 @@ { "extends": "./tsconfig.json", + "include": [ + "src", + ], } diff --git a/packages/third-party/motion/tsconfig.json b/packages/third-party/motion/tsconfig.json index 4555eb1ab5..200a8cdd4e 100644 --- a/packages/third-party/motion/tsconfig.json +++ b/packages/third-party/motion/tsconfig.json @@ -1,6 +1,8 @@ { "extends": "../../../tsconfig.json", "compilerOptions": { + "module": "ESNEXT", + "moduleResolution": "bundler", "outDir": "./dist", "rootDir": "./src", "composite": true, From 8e5ec1b9edf00f0994d58b569abb739b1a35486c Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 24 Nov 2025 21:55:36 +0800 Subject: [PATCH 04/37] feat: use prototype monkey-patch to do with MotionValue toJSON --- .../third-party/motion/src/animation/index.ts | 2 +- .../motion/src/modified/motionValue.ts | 19 ------------------- .../motion/src/polyfill/MotionValue.ts | 18 ++++++++++++++++++ 3 files changed, 19 insertions(+), 20 deletions(-) delete mode 100644 packages/third-party/motion/src/modified/motionValue.ts create mode 100644 packages/third-party/motion/src/polyfill/MotionValue.ts diff --git a/packages/third-party/motion/src/animation/index.ts b/packages/third-party/motion/src/animation/index.ts index 617a5697a8..fc086ead8c 100644 --- a/packages/third-party/motion/src/animation/index.ts +++ b/packages/third-party/motion/src/animation/index.ts @@ -32,7 +32,7 @@ import type { } from 'motion-dom'; import { useMotionValueRefEvent } from '../hooks/useMotionEvent.js'; -import { motionValue as motionValueOrig } from '../modified/motionValue.js'; +import { motionValue as motionValueOrig } from '../polyfill/MotionValue.js'; import type { ElementOrElements } from '../types/index.js'; import { isMainThreadElement, diff --git a/packages/third-party/motion/src/modified/motionValue.ts b/packages/third-party/motion/src/modified/motionValue.ts deleted file mode 100644 index ac93415b8d..0000000000 --- a/packages/third-party/motion/src/modified/motionValue.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. - -import { MotionValue } from 'motion-dom'; -import type { MotionValueOptions } from 'motion-dom'; - -class CustomMotionValue extends MotionValue { - toJSON() { - return {}; - } -} - -export function motionValue( - init: V, - options?: MotionValueOptions, -): MotionValue { - return new CustomMotionValue(init, options); -} diff --git a/packages/third-party/motion/src/polyfill/MotionValue.ts b/packages/third-party/motion/src/polyfill/MotionValue.ts new file mode 100644 index 0000000000..6b9fa3c986 --- /dev/null +++ b/packages/third-party/motion/src/polyfill/MotionValue.ts @@ -0,0 +1,18 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import { MotionValue } from 'motion-dom'; + +/** + * This hack is needed to prevent large bulk of cross thread communication happened. + * This is because what MainThreadScript working for syncing MainThread and Background Thread + * But actually this is not needed, because we have single source of truth in MainThread + * So we can just ignore the cross thread communication + */ + +// @ts-expect-error expected +MotionValue.prototype.toJSON = function() { + return {}; +}; + +export { motionValue } from 'motion-dom'; From 79e20a94e66f0f44e1a9e985408a0762a92e5040 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Wed, 26 Nov 2025 19:33:08 +0800 Subject: [PATCH 05/37] feat: add styleEffect --- examples/motion/src/App.tsx | 5 + examples/motion/src/iOSSlider/index.tsx | 142 ++++++++++++++++++ examples/motion/src/iOSSlider/styles.css | 43 ++++++ examples/motion/src/iOSSlider/sun.png | Bin 0 -> 2459 bytes packages/third-party/motion/.gitignore | 1 + .../motion/dist/animation/index.d.ts | 49 ++++++ .../motion/dist/animation/index.js | 131 ++++++++++++++++ .../motion/dist/animation/index.js.map | 1 + .../motion/dist/hooks/useMotionEvent.d.ts | 3 + .../motion/dist/hooks/useMotionEvent.js | 17 +++ .../motion/dist/hooks/useMotionEvent.js.map | 1 + .../motion/dist/hooks/useMotionValueRef.d.ts | 3 + .../motion/dist/hooks/useMotionValueRef.js | 25 +++ .../dist/hooks/useMotionValueRef.js.map | 1 + .../motion/dist/hooks/usePreCommit.d.ts | 7 + .../motion/dist/hooks/usePreCommit.js | 29 ++++ .../motion/dist/hooks/usePreCommit.js.map | 1 + packages/third-party/motion/dist/index.d.ts | 3 + packages/third-party/motion/dist/index.js | 6 + packages/third-party/motion/dist/index.js.map | 1 + .../motion/dist/modified/motionValue.d.ts | 3 + .../motion/dist/modified/motionValue.js | 13 ++ .../motion/dist/modified/motionValue.js.map | 1 + .../motion/dist/polyfill/MotionValue.d.ts | 1 + .../motion/dist/polyfill/MotionValue.js | 16 ++ .../motion/dist/polyfill/MotionValue.js.map | 1 + .../motion/dist/polyfill/element.d.ts | 40 +++++ .../motion/dist/polyfill/element.js | 127 ++++++++++++++++ .../motion/dist/polyfill/element.js.map | 1 + .../motion/dist/polyfill/shim.d.ts | 5 + .../third-party/motion/dist/polyfill/shim.js | 55 +++++++ .../motion/dist/polyfill/shim.js.map | 1 + .../third-party/motion/dist/types/index.d.ts | 2 + .../third-party/motion/dist/types/index.js | 5 + .../motion/dist/types/index.js.map | 1 + .../motion/dist/utils/elementHelper.d.ts | 3 + .../motion/dist/utils/elementHelper.js | 21 +++ .../motion/dist/utils/elementHelper.js.map | 1 + .../dist/utils/isMainThreadElement.d.ts | 3 + .../motion/dist/utils/isMainThreadElement.js | 17 +++ .../dist/utils/isMainThreadElement.js.map | 1 + .../third-party/motion/dist/utils/noop.d.ts | 1 + .../third-party/motion/dist/utils/noop.js | 5 + .../third-party/motion/dist/utils/noop.js.map | 1 + .../motion/dist/utils/registeredFunction.d.ts | 5 + .../motion/dist/utils/registeredFunction.js | 17 +++ .../dist/utils/registeredFunction.js.map | 1 + .../third-party/motion/src/animation/index.ts | 99 +++++++++++- packages/third-party/motion/src/index.ts | 5 + .../third-party/motion/src/polyfill/shim.ts | 3 +- .../motion/src/utils/elementHelper.ts | 39 +++++ 51 files changed, 959 insertions(+), 4 deletions(-) create mode 100644 examples/motion/src/iOSSlider/index.tsx create mode 100644 examples/motion/src/iOSSlider/styles.css create mode 100644 examples/motion/src/iOSSlider/sun.png create mode 100644 packages/third-party/motion/.gitignore create mode 100644 packages/third-party/motion/dist/animation/index.d.ts create mode 100644 packages/third-party/motion/dist/animation/index.js create mode 100644 packages/third-party/motion/dist/animation/index.js.map create mode 100644 packages/third-party/motion/dist/hooks/useMotionEvent.d.ts create mode 100644 packages/third-party/motion/dist/hooks/useMotionEvent.js create mode 100644 packages/third-party/motion/dist/hooks/useMotionEvent.js.map create mode 100644 packages/third-party/motion/dist/hooks/useMotionValueRef.d.ts create mode 100644 packages/third-party/motion/dist/hooks/useMotionValueRef.js create mode 100644 packages/third-party/motion/dist/hooks/useMotionValueRef.js.map create mode 100644 packages/third-party/motion/dist/hooks/usePreCommit.d.ts create mode 100644 packages/third-party/motion/dist/hooks/usePreCommit.js create mode 100644 packages/third-party/motion/dist/hooks/usePreCommit.js.map create mode 100644 packages/third-party/motion/dist/index.d.ts create mode 100644 packages/third-party/motion/dist/index.js create mode 100644 packages/third-party/motion/dist/index.js.map create mode 100644 packages/third-party/motion/dist/modified/motionValue.d.ts create mode 100644 packages/third-party/motion/dist/modified/motionValue.js create mode 100644 packages/third-party/motion/dist/modified/motionValue.js.map create mode 100644 packages/third-party/motion/dist/polyfill/MotionValue.d.ts create mode 100644 packages/third-party/motion/dist/polyfill/MotionValue.js create mode 100644 packages/third-party/motion/dist/polyfill/MotionValue.js.map create mode 100644 packages/third-party/motion/dist/polyfill/element.d.ts create mode 100644 packages/third-party/motion/dist/polyfill/element.js create mode 100644 packages/third-party/motion/dist/polyfill/element.js.map create mode 100644 packages/third-party/motion/dist/polyfill/shim.d.ts create mode 100644 packages/third-party/motion/dist/polyfill/shim.js create mode 100644 packages/third-party/motion/dist/polyfill/shim.js.map create mode 100644 packages/third-party/motion/dist/types/index.d.ts create mode 100644 packages/third-party/motion/dist/types/index.js create mode 100644 packages/third-party/motion/dist/types/index.js.map create mode 100644 packages/third-party/motion/dist/utils/elementHelper.d.ts create mode 100644 packages/third-party/motion/dist/utils/elementHelper.js create mode 100644 packages/third-party/motion/dist/utils/elementHelper.js.map create mode 100644 packages/third-party/motion/dist/utils/isMainThreadElement.d.ts create mode 100644 packages/third-party/motion/dist/utils/isMainThreadElement.js create mode 100644 packages/third-party/motion/dist/utils/isMainThreadElement.js.map create mode 100644 packages/third-party/motion/dist/utils/noop.d.ts create mode 100644 packages/third-party/motion/dist/utils/noop.js create mode 100644 packages/third-party/motion/dist/utils/noop.js.map create mode 100644 packages/third-party/motion/dist/utils/registeredFunction.d.ts create mode 100644 packages/third-party/motion/dist/utils/registeredFunction.js create mode 100644 packages/third-party/motion/dist/utils/registeredFunction.js.map create mode 100644 packages/third-party/motion/src/utils/elementHelper.ts diff --git a/examples/motion/src/App.tsx b/examples/motion/src/App.tsx index 29b7e52696..482335035f 100644 --- a/examples/motion/src/App.tsx +++ b/examples/motion/src/App.tsx @@ -4,6 +4,7 @@ import Basic from './Basic/index.js'; import BasicPercent from './BasicPercent/index.js'; import BasicSelector from './BasicSelector/index.js'; import ColorInterception from './ColorInterception/index.js'; +import iOSSlider from './iOSSlider/index.js'; import MotionValue from './MotionValue/index.js'; import Spring from './Spring/index.js'; import Stagger from './Stagger/index.js'; @@ -44,6 +45,10 @@ const CASES = [ name: 'MotionValue', comp: MotionValue, }, + { + name: 'iOSSlider', + comp: iOSSlider, + }, ]; export function App() { diff --git a/examples/motion/src/iOSSlider/index.tsx b/examples/motion/src/iOSSlider/index.tsx new file mode 100644 index 0000000000..5f2889589d --- /dev/null +++ b/examples/motion/src/iOSSlider/index.tsx @@ -0,0 +1,142 @@ +import { + animate, + progress as calcProgress, + clamp, + mapValue, + mix, + styleEffect, + transformValue, + useMotionValueRef, +} from '@lynx-js/motion-lynx'; +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; +import type { MainThread } from '@lynx-js/types'; + +import SunPng from './sun.png'; + +import './styles.css'; + +/** + * ============== Configuration ================ + */ +const maxPull = 20; +const maxSquish = 0.92; +const maxStretch = 1.08; + +export default function Comp() { + /** + * ============== State ================ + */ + const sliderRef = useMainThreadRef(null); + const progressRef = useMotionValueRef(0.5); + const sizeRef = useMainThreadRef({ top: 0, bottom: 0 }); + const initialDragYRef = useMainThreadRef(0); + const initialProgressYRef = useMainThreadRef(0); + + function measureSlider() { + 'main thread'; + void sliderRef.current?.invoke('getBoundingClientRect').then( + (res: { top: number; bottom: number }) => { + sizeRef.current = { top: res.top, bottom: res.bottom }; + }, + ); + } + + function initEffects() { + 'main thread'; + measureSlider(); + + const y = mapValue(progressRef.current, [-1, 0, 1, 2], [ + maxPull, + 0, + 0, + -maxPull, + ]); + const scaleX = mapValue( + y, + [-maxPull, 0, 0, maxPull], + [maxSquish, 1, 1, maxSquish], + ); + const scaleY = mapValue( + y, + [-maxPull, 0, 0, maxPull], + [maxStretch, 1, 1, maxStretch], + ); + + styleEffect(sliderRef.current!, { y, scaleX, scaleY }); + + styleEffect('.indicator', { + scaleY: transformValue(() => clamp(0, 1, progressRef.current.get())), + }); + + const invertScaleX = transformValue(() => 1 / scaleX.get()); + const invertScaleY = transformValue(() => 1 / scaleY.get()); + styleEffect('.icon-container', { + scaleX: invertScaleX, + scaleY: invertScaleY, + }); + } + + useEffect(() => { + setTimeout(() => { + void runOnMainThread(initEffects)(); + }, 1000); + }, []); + + function onTouchStart(e: MainThread.TouchEvent) { + 'main thread'; + progressRef.current.stop(); + + initialDragYRef.current = e.detail.y; + initialProgressYRef.current = mix( + sizeRef.current.bottom, + sizeRef.current.top, + progressRef.current.get(), + ); + } + + function onTouchMove(e: MainThread.TouchEvent) { + 'main thread'; + + const dragOffset = e.detail.y - initialDragYRef.current; + const newProgressY = initialProgressYRef.current + dragOffset; + + progressRef.current.set( + calcProgress(sizeRef.current.bottom, sizeRef.current.top, newProgressY), + ); + } + + function onTouchEnd(_e: MainThread.TouchEvent) { + 'main thread'; + // Animate back to bounds if needed + if (progressRef.current.get() < 0) { + animate(progressRef.current, 0, { + type: 'spring', + stiffness: 200, + damping: 60, + }); + } else if (progressRef.current.get() > 1) { + animate(progressRef.current, 1, { + type: 'spring', + stiffness: 200, + damping: 60, + }); + } + } + + return ( + + + + + + + + + ); +} diff --git a/examples/motion/src/iOSSlider/styles.css b/examples/motion/src/iOSSlider/styles.css new file mode 100644 index 0000000000..5fd02808fa --- /dev/null +++ b/examples/motion/src/iOSSlider/styles.css @@ -0,0 +1,43 @@ +.case-container { + height: 100%; + display: flex; + justify-content: center; + align-items: center; +} + +.slider { + width: 100px; + height: 225px; + background-color: rgba(255, 255, 255, 0.1); + border-radius: 40px; + overflow: hidden; + position: relative; + display: flex; + align-items: flex-end; + justify-content: center; + outline: none; + box-shadow: 0px 0px 0px 4px #0d63f800; + transition: box-shadow 0.15s; +} + +.indicator { + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; + background-color: #f5f5f5; + transform-origin: center bottom; + transform: scaleY(0.5); +} + +.icon-container { + position: relative; + z-index: 1; +} + +.icon { + position: relative; + z-index: 1; + bottom: 20px; +} diff --git a/examples/motion/src/iOSSlider/sun.png b/examples/motion/src/iOSSlider/sun.png new file mode 100644 index 0000000000000000000000000000000000000000..1dde31e1f094e944d8edf8117cfbb809dc74153d GIT binary patch literal 2459 zcmV;M31s$(P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)T@Y9}`YAP^i9_@szuhSK zu*r6`3b1xCXE38bH3IPBi}7mhFQ+Xok`P}z4*fDQIdgGzbZ$~B3#^2z(+zj^T|Q>- z5yE+r1mS_+MM?Ari+c}KTdHpnI)ZgE24i7^b+yVUV*^HDC17Ukhyk%^8Hk~j3ITZK z3z59Qcy_#dK?-?b*S*`ZZp7hEWpl0ZAt&}&%WXW&?HE`8cZo68cMLkvW#2;=U<1a! zfgFRp;KkG@F|cWz000$&@LTA>w~in{?BWKn8#Mt;z!qS%^Qs-h79fw^ZIl4sRriM_ z-$&^P8T4W&UnTQa15<|t#Ap(nQ3Cj|gTu?fPkt}x_6Rk4xAU;BiHT#Ah|w5iV+2fi zZ%FKW$J#)gH!ypCpu}RQ!gNCe!mNr_Lp55(7y)e(d!pUZEh6y><#y>{V~pVdHDe7o zqNK(MAg3Mm>FK=krD@{D7Ye-T2H2z|JWd!+LUgR!(2Nn#T3!8tNCdrzsgwNHdgC(X zd;!LA62x^cRx^PZBLHwDiQ{xP2`k)p7=e+Y1&@gH1=1O=n45sAKR-bOgNIcdW>v<{ zf4fEC?JXQ*wRsp;0|5u>IFEj6PA_#Ux~w%qzBCf_dT+ZMsk=kp~<=l{!)$ptYW z7Q|%Iu5T+90(|2swKz!znGTZ$jj`HaL<0Dz5SX(tS>Pa>f+7-NGhfDimjoD3>2L;1 z0*1?%aqS`!AVabcCJPy6Pc#Gp_CWS|#%~RMUER$vSyw4fD}^IK2G3dJI|$n+@|0X1 zEQKQg(}S3V-Z^VH>}bzX(@9E}I)x(u$pHz?J9E~Co1+E;IjV&uAV>L245cI>aSD?e zC<#cGzr>?U0urY%nSqjkWcf=xx+EZR3X>Tq35dvF+T#BK00960vNqlg00006Nkl, keyframes: string | UnresolvedValueKeyframe[], options?: ValueAnimationTransition): AnimationPlaybackControlsWithThen; +/** + * Animate a number + */ +declare function animate(value: number | MotionValue, keyframes: number | UnresolvedValueKeyframe[], options?: ValueAnimationTransition): AnimationPlaybackControlsWithThen; +/** + * Animate a generic motion value + */ +declare function animate(value: V | MotionValue, keyframes: V | UnresolvedValueKeyframe[], options?: ValueAnimationTransition): AnimationPlaybackControlsWithThen; +/** + * Animate an object + */ +declare function animate(object: O | O[], keyframes: ObjectTarget, options?: AnimationOptions): AnimationPlaybackControlsWithThen; +/** + * Animate a main thread element + */ +declare function animate(value: ElementOrElements, keyframes: DOMKeyframesDefinition, options?: AnimationOptions): AnimationPlaybackControlsWithThen; +declare function stagger(...args: Parameters): ReturnType; +declare function motionValue(init: V, options?: MotionValueOptions): MotionValue; +declare function spring(...args: Parameters): ReturnType; +declare function springValue(source: T | MotionValue, options?: SpringOptions): MotionValue; +declare function mix(from: T, to: T): Mixer; +declare function mix(from: number, to: number, p: number): number; +declare function progress(from: number, to: number, value: number): number; +declare function clamp(min: number, max: number, v: number): number; +declare function mapValue(inputValue: MotionValue, inputRange: MapInputRange, outputRange: O[], options?: TransformOptions): MotionValue; +declare function transformValue(transform: () => O): MotionValue; +declare function styleEffect(subject: string | ElementOrElements, values: Record): () => void; +export declare const noop: () => void; +export { animate, stagger, motionValue, spring, springValue, mix, progress, mapValue, clamp, transformValue, styleEffect, }; +export { useMotionValueRefEvent }; diff --git a/packages/third-party/motion/dist/animation/index.js b/packages/third-party/motion/dist/animation/index.js new file mode 100644 index 0000000000..3abefa1003 --- /dev/null +++ b/packages/third-party/motion/dist/animation/index.js @@ -0,0 +1,131 @@ +// Copyright 2024 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import '../polyfill/shim.js'; +import { animate as animateOriginal, clamp as clampOrig, progress as progressOrig, stagger as staggerOriginal, } from 'framer-motion/dom'; +import { mapValue as mapValueOrig, mix as mixOrig, spring as springOrig, springValue as springValueOrig, styleEffect as styleEffectOrig, transformValue as transformValueOrig, } from 'motion-dom'; +import { useMotionValueRefEvent } from '../hooks/useMotionEvent.js'; +import { motionValue as motionValueOrig } from '../polyfill/MotionValue.js'; +import { elementOrSelector2Dom } from '../utils/elementHelper.js'; +import { isMainThreadElement, isMainThreadElementArray, } from '../utils/isMainThreadElement.js'; +import { registerCallable } from '../utils/registeredFunction.js'; +let animateHandle; +let staggerHandle; +let motionValueHandle; +let springHandle; +let springValueHandle; +let mixHandle; +let progressHandle; +let clampHandle; +let mapValueHandle; +let transformValueHandle; +let styleEffectHandle; +if (__MAIN_THREAD__) { + animateHandle = registerCallable(animateOriginal, 'animate'); + staggerHandle = registerCallable(staggerOriginal, 'stagger'); + motionValueHandle = registerCallable(motionValueOrig, 'motionValue'); + springHandle = registerCallable(springOrig, 'spring'); + springValueHandle = registerCallable(springValueOrig, 'springValue'); + mixHandle = registerCallable(mixOrig, 'mix'); + progressHandle = registerCallable(progressOrig, 'progress'); + clampHandle = registerCallable(clampOrig, 'clamp'); + mapValueHandle = registerCallable(mapValueOrig, 'mapValue'); + transformValueHandle = registerCallable(transformValueOrig, 'transformValue'); + styleEffectHandle = registerCallable(styleEffectOrig, 'styleEffect'); +} +else { + animateHandle = 'animate'; + staggerHandle = 'stagger'; + motionValueHandle = 'motionValue'; + springHandle = 'spring'; + springValueHandle = 'springValue'; + mixHandle = 'mix'; + progressHandle = 'progress'; + clampHandle = 'clamp'; + mapValueHandle = 'mapValue'; + transformValueHandle = 'transformValue'; + styleEffectHandle = 'styleEffect'; +} +function animate(subjectOrSequence, optionsOrKeyframes, options) { + 'main thread'; + let realSubjectOrSequence; + if (typeof subjectOrSequence === 'string' + || isMainThreadElement(subjectOrSequence) + || isMainThreadElementArray(subjectOrSequence)) { + let elementNodes; + if (typeof subjectOrSequence === 'string') { + elementNodes = lynx.querySelectorAll(subjectOrSequence); + } + else { + elementNodes = subjectOrSequence; + } + realSubjectOrSequence = (Array.isArray(elementNodes) + ? elementNodes.map(el => new globalThis.ElementCompt(el)) + : new globalThis.ElementCompt(elementNodes)); + } + else { + realSubjectOrSequence = subjectOrSequence; + } + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module + return globalThis.runOnRegistered(animateHandle)( + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + realSubjectOrSequence, + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + optionsOrKeyframes, + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + options); +} +function stagger(...args) { + 'main thread'; + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module + return globalThis.runOnRegistered(staggerHandle)(...args); +} +function motionValue(init, options) { + 'main thread'; + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module + return globalThis.runOnRegistered(motionValueHandle)(init, options); +} +function spring(...args) { + 'main thread'; + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module + return globalThis.runOnRegistered(springHandle)(...args); +} +function springValue(source, options) { + 'main thread'; + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module + return globalThis.runOnRegistered(springValueHandle)(source, options); +} +function mix(from, to, p) { + 'main thread'; + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + return globalThis.runOnRegistered(mixHandle)(from, to, p); +} +function progress(from, to, value) { + 'main thread'; + return globalThis.runOnRegistered(progressHandle)(from, to, value); +} +function clamp(min, max, v) { + 'main thread'; + return globalThis.runOnRegistered(clampHandle)(min, max, v); +} +function mapValue(inputValue, inputRange, outputRange, options) { + 'main thread'; + return globalThis.runOnRegistered(mapValueHandle)(inputValue, inputRange, outputRange, options); +} +function transformValue(transform) { + 'main thread'; + return globalThis.runOnRegistered(transformValueHandle)(transform); +} +function styleEffect(subject, values) { + 'main thread'; + const elements = elementOrSelector2Dom(subject); + if (!elements) { + return () => { }; + } + return globalThis.runOnRegistered(styleEffectHandle)(elements, values); +} +export const noop = () => { }; +export { animate, stagger, motionValue, spring, springValue, mix, progress, mapValue, clamp, transformValue, styleEffect, }; +export { useMotionValueRefEvent }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/animation/index.js.map b/packages/third-party/motion/dist/animation/index.js.map new file mode 100644 index 0000000000..43b26d1114 --- /dev/null +++ b/packages/third-party/motion/dist/animation/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,KAAK,IAAI,SAAS,EAClB,QAAQ,IAAI,YAAY,EACxB,OAAO,IAAI,eAAe,GAC3B,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,GAAG,IAAI,OAAO,EACd,MAAM,IAAI,UAAU,EACpB,WAAW,IAAI,eAAe,EAC9B,WAAW,IAAI,eAAe,EAC9B,cAAc,IAAI,kBAAkB,GACrC,MAAM,YAAY,CAAC;AAiBpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,IAAI,aAAqB,CAAC;AAC1B,IAAI,aAAqB,CAAC;AAC1B,IAAI,iBAAyB,CAAC;AAC9B,IAAI,YAAoB,CAAC;AACzB,IAAI,iBAAyB,CAAC;AAC9B,IAAI,SAAiB,CAAC;AACtB,IAAI,cAAsB,CAAC;AAC3B,IAAI,WAAmB,CAAC;AACxB,IAAI,cAAsB,CAAC;AAC3B,IAAI,oBAA4B,CAAC;AACjC,IAAI,iBAAyB,CAAC;AAE9B,IAAI,eAAe,EAAE,CAAC;IACpB,aAAa,GAAG,gBAAgB,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAC7D,aAAa,GAAG,g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GAAE,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,UAAU,CAAC,eAAe,CAAyB,iBAAiB,CAAC,CAC1E,QAAQ,EACR,MAAM,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AAEnC,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,GACZ,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/hooks/useMotionEvent.d.ts b/packages/third-party/motion/dist/hooks/useMotionEvent.d.ts new file mode 100644 index 0000000000..291bac4937 --- /dev/null +++ b/packages/third-party/motion/dist/hooks/useMotionEvent.d.ts @@ -0,0 +1,3 @@ +import type { MotionValue, MotionValueEventCallbacks } from 'motion-dom'; +import type { MainThreadRef } from '@lynx-js/react'; +export declare function useMotionValueRefEvent>(valueRef: MainThreadRef>, event: 'change', callback: MotionValueEventCallbacks[EventName]): void; diff --git a/packages/third-party/motion/dist/hooks/useMotionEvent.js b/packages/third-party/motion/dist/hooks/useMotionEvent.js new file mode 100644 index 0000000000..7f7d94afbe --- /dev/null +++ b/packages/third-party/motion/dist/hooks/useMotionEvent.js @@ -0,0 +1,17 @@ +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; +export function useMotionValueRefEvent(valueRef, event, callback) { + const unListenRef = useMainThreadRef(); + useEffect(() => { + void runOnMainThread(() => { + 'main thread'; + unListenRef.current = valueRef.current.on(event, callback); + })(); + return () => { + void runOnMainThread(() => { + 'main thread'; + unListenRef.current?.(); + })(); + }; + }, [callback]); +} +//# sourceMappingURL=useMotionEvent.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/hooks/useMotionEvent.js.map b/packages/third-party/motion/dist/hooks/useMotionEvent.js.map new file mode 100644 index 0000000000..e30b101148 --- /dev/null +++ b/packages/third-party/motion/dist/hooks/useMotionEvent.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useMotionEvent.js","sourceRoot":"","sources":["../../src/hooks/useMotionEvent.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAG9E,MAAM,UAAU,sBAAsB,CAIpC,QAAuC,EACvC,KAAe,EACf,QAAiD;IAEjD,MAAM,WAAW,GAAG,gBAAgB,EAAgB,CAAC;IAErD,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,eAAe,CAAC,GAAG,EAAE;YACxB,aAAa,CAAC;YACd,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,GAAG,EAAE;YACV,KAAK,eAAe,CAAC,GAAG,EAAE;gBACxB,aAAa,CAAC;gBACd,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1B,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/hooks/useMotionValueRef.d.ts b/packages/third-party/motion/dist/hooks/useMotionValueRef.d.ts new file mode 100644 index 0000000000..8adc9a4f9a --- /dev/null +++ b/packages/third-party/motion/dist/hooks/useMotionValueRef.d.ts @@ -0,0 +1,3 @@ +import type { MotionValue } from 'motion-dom'; +import type { MainThreadRef } from '@lynx-js/react'; +export declare function useMotionValueRef(value: T): MainThreadRef>; diff --git a/packages/third-party/motion/dist/hooks/useMotionValueRef.js b/packages/third-party/motion/dist/hooks/useMotionValueRef.js new file mode 100644 index 0000000000..9de7410ebc --- /dev/null +++ b/packages/third-party/motion/dist/hooks/useMotionValueRef.js @@ -0,0 +1,25 @@ +import { runOnMainThread, useMainThreadRef, useMemo } from '@lynx-js/react'; +import { runWorkletCtx } from '@lynx-js/react/worklet-runtime/bindings'; +import { motionValue } from '../animation/index.js'; +export function useMotionValueRef(value) { + // @ts-expect-error expected + const motionValueRef = useMainThreadRef(); + useMemo(() => { + function setMotionValue(value) { + 'main thread'; + if (!motionValueRef.current) { + motionValueRef.current = motionValue(value); + } + } + if (__BACKGROUND__) { + void runOnMainThread(setMotionValue)(value); + } + else { + runWorkletCtx(setMotionValue, [ + value, + ]); + } + }, []); + return motionValueRef; +} +//# sourceMappingURL=useMotionValueRef.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/hooks/useMotionValueRef.js.map b/packages/third-party/motion/dist/hooks/useMotionValueRef.js.map new file mode 100644 index 0000000000..794e3c0925 --- /dev/null +++ b/packages/third-party/motion/dist/hooks/useMotionValueRef.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useMotionValueRef.js","sourceRoot":"","sources":["../../src/hooks/useMotionValueRef.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE5E,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAMxE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,UAAU,iBAAiB,CAAI,KAAQ;IAC3C,4BAA4B;IAC5B,MAAM,cAAc,GAAkC,gBAAgB,EAEnE,CAAC;IAEJ,OAAO,CAAC,GAAG,EAAE;QACX,SAAS,cAAc,CAAC,KAAQ;YAC9B,aAAa,CAAC;YACd,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;gBAC5B,cAAc,CAAC,OAAO,GAAG,WAAW,CAAI,KAAK,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;QACD,IAAI,cAAc,EAAE,CAAC;YACnB,KAAK,eAAe,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,aAAa,CAAC,cAAoC,EAAE;gBAClD,KAA4B;aAC7B,CAAC,CAAC;QACL,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,cAAc,CAAC;AACxB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/hooks/usePreCommit.d.ts b/packages/third-party/motion/dist/hooks/usePreCommit.d.ts new file mode 100644 index 0000000000..e2e61ff12b --- /dev/null +++ b/packages/third-party/motion/dist/hooks/usePreCommit.d.ts @@ -0,0 +1,7 @@ +/** + * An experimental hook dedicated to make MTS run on firstScreenPaint + * Can be used starting from ReactLynx 0.113.0 + * @experimental + * @param cb A main-thread callback to run on firstScreen + */ +export declare function usePreCommit(cb: CallableFunction): void; diff --git a/packages/third-party/motion/dist/hooks/usePreCommit.js b/packages/third-party/motion/dist/hooks/usePreCommit.js new file mode 100644 index 0000000000..264de2e5db --- /dev/null +++ b/packages/third-party/motion/dist/hooks/usePreCommit.js @@ -0,0 +1,29 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import { runWorkletCtx, setEomShouldFlushElementTree, } from '@lynx-js/react/worklet-runtime/bindings'; +/** + * An experimental hook dedicated to make MTS run on firstScreenPaint + * Can be used starting from ReactLynx 0.113.0 + * @experimental + * @param cb A main-thread callback to run on firstScreen + */ +export function usePreCommit(cb) { + if (__MAIN_THREAD__) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + setEomShouldFlushElementTree(false); + void Promise.resolve().then(() => { + try { + runWorkletCtx(cb, []); + } + catch (e) { + console.error('Error occurred in preCommit hook', e); + } + finally { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + setEomShouldFlushElementTree(true); + } + }); + } +} +//# sourceMappingURL=usePreCommit.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/hooks/usePreCommit.js.map b/packages/third-party/motion/dist/hooks/usePreCommit.js.map new file mode 100644 index 0000000000..7bbbc1fc1d --- /dev/null +++ b/packages/third-party/motion/dist/hooks/usePreCommit.js.map @@ -0,0 +1 @@ +{"version":3,"file":"usePreCommit.js","sourceRoot":"","sources":["../../src/hooks/usePreCommit.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EACL,aAAa,EACb,4BAA4B,GAC7B,MAAM,yCAAyC,CAAA;AAGhD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,EAAoB;IAC/C,IAAI,eAAe,EAAE,CAAC;QACpB,6DAA6D;QAC7D,4BAA4B,CAAC,KAAK,CAAC,CAAA;QACnC,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YAC/B,IAAI,CAAC;gBACH,aAAa,CAAC,EAAwB,EAAE,EAAE,CAAC,CAAA;YAC7C,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,CAAC,CAAC,CAAA;YACtD,CAAC;oBAAS,CAAC;gBACT,6DAA6D;gBAC7D,4BAA4B,CAAC,IAAI,CAAC,CAAA;YACpC,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/index.d.ts b/packages/third-party/motion/dist/index.d.ts new file mode 100644 index 0000000000..18ee100860 --- /dev/null +++ b/packages/third-party/motion/dist/index.d.ts @@ -0,0 +1,3 @@ +export { animate, stagger, motionValue, spring, springValue, mix, progress, mapValue, clamp, transformValue, styleEffect, noop, useMotionValueRefEvent, } from './animation/index.js'; +export { useMotionValueRef } from './hooks/useMotionValueRef.js'; +export type { MotionValue } from 'motion-dom'; diff --git a/packages/third-party/motion/dist/index.js b/packages/third-party/motion/dist/index.js new file mode 100644 index 0000000000..154b1db015 --- /dev/null +++ b/packages/third-party/motion/dist/index.js @@ -0,0 +1,6 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +export { animate, stagger, motionValue, spring, springValue, mix, progress, mapValue, clamp, transformValue, styleEffect, noop, useMotionValueRefEvent, } from './animation/index.js'; +export { useMotionValueRef } from './hooks/useMotionValueRef.js'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/index.js.map b/packages/third-party/motion/dist/index.js.map new file mode 100644 index 0000000000..c931ef0963 --- /dev/null +++ b/packages/third-party/motion/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,EACX,IAAI,EACJ,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/modified/motionValue.d.ts b/packages/third-party/motion/dist/modified/motionValue.d.ts new file mode 100644 index 0000000000..88bdf909eb --- /dev/null +++ b/packages/third-party/motion/dist/modified/motionValue.d.ts @@ -0,0 +1,3 @@ +import { MotionValue } from 'motion-dom'; +import type { MotionValueOptions } from 'motion-dom'; +export declare function motionValue(init: V, options?: MotionValueOptions): MotionValue; diff --git a/packages/third-party/motion/dist/modified/motionValue.js b/packages/third-party/motion/dist/modified/motionValue.js new file mode 100644 index 0000000000..b854be72e9 --- /dev/null +++ b/packages/third-party/motion/dist/modified/motionValue.js @@ -0,0 +1,13 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import { MotionValue } from 'motion-dom'; +class CustomMotionValue extends MotionValue { + toJSON() { + return {}; + } +} +export function motionValue(init, options) { + return new CustomMotionValue(init, options); +} +//# sourceMappingURL=motionValue.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/modified/motionValue.js.map b/packages/third-party/motion/dist/modified/motionValue.js.map new file mode 100644 index 0000000000..24db513ff1 --- /dev/null +++ b/packages/third-party/motion/dist/modified/motionValue.js.map @@ -0,0 +1 @@ +{"version":3,"file":"motionValue.js","sourceRoot":"","sources":["../../src/modified/motionValue.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,MAAM,iBAA2B,SAAQ,WAAc;IACrD,MAAM;QACJ,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CACzB,IAAO,EACP,OAA4B;IAE5B,OAAO,IAAI,iBAAiB,CAAI,IAAI,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/MotionValue.d.ts b/packages/third-party/motion/dist/polyfill/MotionValue.d.ts new file mode 100644 index 0000000000..69647f84bd --- /dev/null +++ b/packages/third-party/motion/dist/polyfill/MotionValue.d.ts @@ -0,0 +1 @@ +export { motionValue } from 'motion-dom'; diff --git a/packages/third-party/motion/dist/polyfill/MotionValue.js b/packages/third-party/motion/dist/polyfill/MotionValue.js new file mode 100644 index 0000000000..03f0eb4960 --- /dev/null +++ b/packages/third-party/motion/dist/polyfill/MotionValue.js @@ -0,0 +1,16 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import { MotionValue } from 'motion-dom'; +/** + * This hack is needed to prevent large bulk of cross thread communication happened. + * This is because what MainThreadScript working for syncing MainThread and Background Thread + * But actually this is not needed, because we have single source of truth in MainThread + * So we can just ignore the cross thread communication + */ +// @ts-expect-error expected +MotionValue.prototype.toJSON = function () { + return {}; +}; +export { motionValue } from 'motion-dom'; +//# sourceMappingURL=MotionValue.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/MotionValue.js.map b/packages/third-party/motion/dist/polyfill/MotionValue.js.map new file mode 100644 index 0000000000..08be4d9885 --- /dev/null +++ b/packages/third-party/motion/dist/polyfill/MotionValue.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MotionValue.js","sourceRoot":"","sources":["../../src/polyfill/MotionValue.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;;GAKG;AAEH,4BAA4B;AAC5B,WAAW,CAAC,SAAS,CAAC,MAAM,GAAG;IAC7B,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/element.d.ts b/packages/third-party/motion/dist/polyfill/element.d.ts new file mode 100644 index 0000000000..f34a1344e3 --- /dev/null +++ b/packages/third-party/motion/dist/polyfill/element.d.ts @@ -0,0 +1,40 @@ +import type { MainThread } from '@lynx-js/types'; +interface StyleObject { + [key: string]: string | ((property: string, value: string) => void); + setProperty(property: string, value: string): void; +} +export declare class ElementCompt { + private element; + constructor(element: MainThread.Element); + getComputedStyle(): Record; + get style(): StyleObject; + set style(styles: Record); + private getStyleProperty; + get backgroundColor(): string; + set backgroundColor(value: string); + get color(): string; + set color(value: string); + get fontSize(): string; + set fontSize(value: string); + get width(): string; + set width(value: string); + get height(): string; + set height(value: string); + get margin(): string; + set margin(value: string); + get padding(): string; + set padding(value: string); + get display(): string; + set display(value: string); + get position(): string; + set position(value: string); + get top(): string; + set top(value: string); + get left(): string; + set left(value: string); + get right(): string; + set right(value: string); + get bottom(): string; + set bottom(value: string); +} +export {}; diff --git a/packages/third-party/motion/dist/polyfill/element.js b/packages/third-party/motion/dist/polyfill/element.js new file mode 100644 index 0000000000..a696748ea4 --- /dev/null +++ b/packages/third-party/motion/dist/polyfill/element.js @@ -0,0 +1,127 @@ +export class ElementCompt { + element; + constructor(element) { + this.element = element; + } + getComputedStyle() { + const styleObject = {}; + return new Proxy(styleObject, { + get: (_target, prop) => { + // @ts-expect-error Expected + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + return __GetComputedStyleByKey(this.element.element, prop); + }, + }); + } + get style() { + const styleObject = {}; + styleObject.setProperty = (property, value) => { + this.element.setStyleProperty(property, value); + }; + return new Proxy(styleObject, { + set: (target, prop, value) => { + if (typeof prop === 'string' && prop !== 'setProperty') { + this.element.setStyleProperty(prop, String(value)); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + target[prop] = value; + } + return true; + }, + get: (_target, prop) => { + if (typeof prop === 'string' && prop !== 'setProperty') { + return this.getStyleProperty(prop); + } + return undefined; + }, + }); + } + set style(styles) { + this.element.setStyleProperties(styles); + } + // Individual style property getters and setters + getStyleProperty(name) { + // @ts-expect-error Expected + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + return __GetComputedStyleByKey(this.element.element, name); + } + // Common style properties + get backgroundColor() { + return this.getStyleProperty('backgroundColor'); + } + set backgroundColor(value) { + this.element.setStyleProperty('backgroundColor', value); + } + get color() { + return this.getStyleProperty('color'); + } + set color(value) { + this.element.setStyleProperty('color', value); + } + get fontSize() { + return this.getStyleProperty('fontSize'); + } + set fontSize(value) { + this.element.setStyleProperty('fontSize', value); + } + get width() { + return this.getStyleProperty('width'); + } + set width(value) { + this.element.setStyleProperty('width', value); + } + get height() { + return this.getStyleProperty('height'); + } + set height(value) { + this.element.setStyleProperty('height', value); + } + get margin() { + return this.getStyleProperty('margin'); + } + set margin(value) { + this.element.setStyleProperty('margin', value); + } + get padding() { + return this.getStyleProperty('padding'); + } + set padding(value) { + this.element.setStyleProperty('padding', value); + } + get display() { + return this.getStyleProperty('display'); + } + set display(value) { + this.element.setStyleProperty('display', value); + } + get position() { + return this.getStyleProperty('position'); + } + set position(value) { + this.element.setStyleProperty('position', value); + } + get top() { + return this.getStyleProperty('top'); + } + set top(value) { + this.element.setStyleProperty('top', value); + } + get left() { + return this.getStyleProperty('left'); + } + set left(value) { + this.element.setStyleProperty('left', value); + } + get right() { + return this.getStyleProperty('right'); + } + set right(value) { + this.element.setStyleProperty('right', value); + } + get bottom() { + return this.getStyleProperty('bottom'); + } + set bottom(value) { + this.element.setStyleProperty('bottom', value); + } +} +//# sourceMappingURL=element.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/element.js.map b/packages/third-party/motion/dist/polyfill/element.js.map new file mode 100644 index 0000000000..4bb7291e06 --- /dev/null +++ b/packages/third-party/motion/dist/polyfill/element.js.map @@ -0,0 +1 @@ +{"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/polyfill/element.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,YAAY;IACf,OAAO,CAAqB;IAEpC,YAAY,OAA2B;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,gBAAgB;QACrB,MAAM,WAAW,GAA2B,EAAE,CAAC;QAE/C,OAAO,IAAI,KAAK,CAAC,WAAW,EAAE;YAC5B,GAAG,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;gBACrB,4BAA4B;gBAC5B,iEAAiE;gBACjE,OAAO,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAc,CAAC,CAAC;YACvE,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,IAAW,KAAK;QACd,MAAM,WAAW,GAAG,EAAiB,CAAC;QAEtC,WAAW,CAAC,WAAW,GAAG,CAAC,QAAgB,EAAE,KAAa,EAAE,EAAE;YAC5D,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC,CAAC;QACF,OAAO,IAAI,KAAK,CAAC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O,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,QAAQ,CAAC,KAAa;QACxB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,GAAG,CAAC,KAAa;QACnB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,IAAI,CAAC,KAAa;QACpB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,KAAK,CAAC,KAAa;QACrB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,MAAM,CAAC,KAAa;QACtB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;CACF"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/shim.d.ts b/packages/third-party/motion/dist/polyfill/shim.d.ts new file mode 100644 index 0000000000..757196eeb0 --- /dev/null +++ b/packages/third-party/motion/dist/polyfill/shim.d.ts @@ -0,0 +1,5 @@ +import type { MainThread } from '@lynx-js/types'; +import { ElementCompt } from './element.js'; +declare global { + var ElementCompt: new (element: MainThread.Element) => ElementCompt; +} diff --git a/packages/third-party/motion/dist/polyfill/shim.js b/packages/third-party/motion/dist/polyfill/shim.js new file mode 100644 index 0000000000..07e10ba30f --- /dev/null +++ b/packages/third-party/motion/dist/polyfill/shim.js @@ -0,0 +1,55 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import { document, setupDocument } from '@lynx-js/react/internal/document'; +import { ElementCompt } from './element.js'; +const timeOrigin = Date.now(); +if (__MAIN_THREAD__) { + setupDocument(); + const performance = { + now: () => Date.now() - timeOrigin, + }; + function queueMicrotask(fn) { + void Promise.resolve().then(() => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + fn(); + }); + } + class NodeList { + } + class SVGElement { + } + const window = { + // biome-ignore lint/suspicious/noExplicitAny: + getComputedStyle: (ele) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access + return ele.getComputedStyle(); + }, + }; + class HTMLElement { + } + // @ts-expect-error error + globalThis.document = document; + // @ts-expect-error error + globalThis.performance = performance; + globalThis.queueMicrotask = queueMicrotask; + // @ts-expect-error error + document.querySelector = lynx.querySelector; + // @ts-expect-error error + document.querySelectorAll = lynx.querySelectorAll; + // @ts-expect-error error + globalThis.NodeList = NodeList; + // @ts-expect-error error + globalThis.SVGElement = SVGElement; + // @ts-expect-error error + globalThis.window = window; + globalThis.getComputedStyle = window.getComputedStyle; + // @ts-expect-error error + globalThis.HTMLElement = HTMLElement; + globalThis.ElementCompt = ElementCompt; + // @ts-expect-error error + globalThis.Element = ElementCompt; + // @ts-expect-error error + globalThis.EventTarget = ElementCompt; +} +//# sourceMappingURL=shim.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/shim.js.map b/packages/third-party/motion/dist/polyfill/shim.js.map new file mode 100644 index 0000000000..97c3a388f4 --- /dev/null +++ b/packages/third-party/motion/dist/polyfill/shim.js.map @@ -0,0 +1 @@ +{"version":3,"file":"shim.js","sourceRoot":"","sources":["../../src/polyfill/shim.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAG3E,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AAM9B,IAAI,eAAe,EAAE,CAAC;IACpB,aAAa,EAAE,CAAC;IAEhB,MAAM,WAAW,GAAG;QAClB,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU;KACnC,CAAC;IAEF,SAAS,cAAc,CAAC,EAAoB;QAC1C,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YAC/B,6DAA6D;YAC7D,EAAE,EAAE,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,QAAQ;KAAG;IAEjB,MAAM,UAAU;KAAG;IAEnB,MAAM,MAAM,GAAG;QACb,4DAA4D;QAC5D,gBAAgB,EAAE,CAAC,GAAQ,EAAE,EAAE;YAC7B,8IAA8I;YAC9I,OAAO,GAAG,CAAC,gBAAgB,EAAE,CAAC;QAChC,CAAC;KACF,CAAC;IAEF,MAAM,WAAW;KAAG;IAEpB,yBAAyB;IACzB,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC/B,yBAAyB;IACzB,UAAU,CAAC,WAAW,GAAG,WAAW,CAAC;IACrC,UAAU,CAAC,cAAc,GAAG,cAAc,CAAC;IAC3C,yBAAyB;IAEzB,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;IAC5C,yBAAyB;IAEzB,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;IAClD,yBAAyB;IACzB,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC/B,yBAAyB;IACzB,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC;IACnC,yBAAyB;IACzB,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC;IAC3B,UAAU,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IACtD,yBAAyB;IACzB,UAAU,CAAC,WAAW,GAAG,WAAW,CAAC;IACrC,UAAU,CAAC,YAAY,GAAG,YAAY,CAAC;IACvC,yBAAyB;IACzB,UAAU,CAAC,OAAO,GAAG,YAAY,CAAC;IAClC,yBAAyB;IACzB,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AACxC,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/types/index.d.ts b/packages/third-party/motion/dist/types/index.d.ts new file mode 100644 index 0000000000..4193003f17 --- /dev/null +++ b/packages/third-party/motion/dist/types/index.d.ts @@ -0,0 +1,2 @@ +import { MainThread } from '@lynx-js/types'; +export type ElementOrElements = MainThread.Element | MainThread.Element[]; diff --git a/packages/third-party/motion/dist/types/index.js b/packages/third-party/motion/dist/types/index.js new file mode 100644 index 0000000000..c56f11813d --- /dev/null +++ b/packages/third-party/motion/dist/types/index.js @@ -0,0 +1,5 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import { MainThread } from '@lynx-js/types'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/types/index.js.map b/packages/third-party/motion/dist/types/index.js.map new file mode 100644 index 0000000000..717a8822b2 --- /dev/null +++ b/packages/third-party/motion/dist/types/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/elementHelper.d.ts b/packages/third-party/motion/dist/utils/elementHelper.d.ts new file mode 100644 index 0000000000..cc081bbfe4 --- /dev/null +++ b/packages/third-party/motion/dist/utils/elementHelper.d.ts @@ -0,0 +1,3 @@ +import type { ElementOrSelector } from 'motion-dom'; +import type { MainThread } from '@lynx-js/types'; +export declare function elementOrSelector2Dom(nodesOrSelector: string | MainThread.Element | MainThread.Element[]): ElementOrSelector | undefined; diff --git a/packages/third-party/motion/dist/utils/elementHelper.js b/packages/third-party/motion/dist/utils/elementHelper.js new file mode 100644 index 0000000000..1296c9eb56 --- /dev/null +++ b/packages/third-party/motion/dist/utils/elementHelper.js @@ -0,0 +1,21 @@ +import { isMainThreadElement, isMainThreadElementArray, } from './isMainThreadElement.js'; +export function elementOrSelector2Dom(nodesOrSelector) { + 'main thread'; + let domElements = undefined; + if (typeof nodesOrSelector === 'string' + || isMainThreadElement(nodesOrSelector) + || isMainThreadElementArray(nodesOrSelector)) { + let elementNodes; + if (typeof nodesOrSelector === 'string') { + elementNodes = lynx.querySelectorAll(nodesOrSelector); + } + else { + elementNodes = nodesOrSelector; + } + domElements = (Array.isArray(elementNodes) + ? elementNodes.map(el => new globalThis.ElementCompt(el)) + : new globalThis.ElementCompt(elementNodes)); + } + return domElements; +} +//# sourceMappingURL=elementHelper.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/elementHelper.js.map b/packages/third-party/motion/dist/utils/elementHelper.js.map new file mode 100644 index 0000000000..28bf3c33a1 --- /dev/null +++ b/packages/third-party/motion/dist/utils/elementHelper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"elementHelper.js","sourceRoot":"","sources":["../../src/utils/elementHelper.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,UAAU,qBAAqB,CACnC,eAAmE;IAEnE,aAAa,CAAC;IACd,IAAI,WAAW,GAAkC,SAAS,CAAC;IAE3D,IACE,OAAO,eAAe,KAAK,QAAQ;WAChC,mBAAmB,CAAC,eAAe,CAAC;WACpC,wBAAwB,CAAC,eAAe,CAAC,EAC5C,CAAC;QACD,IAAI,YAA+B,CAAC;QACpC,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,CAAC;YACxC,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,eAAe,CAAC;QACjC,CAAC;QACD,WAAW,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;YACxC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YACzD,CAAC,CAAC,IAAI,UAAU,CAAC,YAAY,CAC3B,YAAY,CACb,CAAiC,CAAC;IACvC,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/isMainThreadElement.d.ts b/packages/third-party/motion/dist/utils/isMainThreadElement.d.ts new file mode 100644 index 0000000000..279a76de5d --- /dev/null +++ b/packages/third-party/motion/dist/utils/isMainThreadElement.d.ts @@ -0,0 +1,3 @@ +import type { MainThread } from '@lynx-js/types'; +export declare function isMainThreadElement(ele: unknown): ele is MainThread.Element; +export declare function isMainThreadElementArray(eleArr: unknown): eleArr is MainThread.Element[]; diff --git a/packages/third-party/motion/dist/utils/isMainThreadElement.js b/packages/third-party/motion/dist/utils/isMainThreadElement.js new file mode 100644 index 0000000000..816d4825ef --- /dev/null +++ b/packages/third-party/motion/dist/utils/isMainThreadElement.js @@ -0,0 +1,17 @@ +export function isMainThreadElement(ele) { + 'main thread'; + // @ts-expect-error error + // biome-ignore lint/complexity/useOptionalChain: + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + if (ele && ele.element && ele.element.elementRefptr) { + return true; + } + else { + return false; + } +} +export function isMainThreadElementArray(eleArr) { + 'main thread'; + return Array.isArray(eleArr) && eleArr.every(ele => isMainThreadElement(ele)); +} +//# sourceMappingURL=isMainThreadElement.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/isMainThreadElement.js.map b/packages/third-party/motion/dist/utils/isMainThreadElement.js.map new file mode 100644 index 0000000000..c41167e17b --- /dev/null +++ b/packages/third-party/motion/dist/utils/isMainThreadElement.js.map @@ -0,0 +1 @@ +{"version":3,"file":"isMainThreadElement.js","sourceRoot":"","sources":["../../src/utils/isMainThreadElement.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,aAAa,CAAC;IACd,yBAAyB;IACzB,+DAA+D;IAC/D,sEAAsE;IACtE,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,MAAe;IAEf,aAAa,CAAC;IACd,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;AAChF,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/noop.d.ts b/packages/third-party/motion/dist/utils/noop.d.ts new file mode 100644 index 0000000000..27abd08d2f --- /dev/null +++ b/packages/third-party/motion/dist/utils/noop.d.ts @@ -0,0 +1 @@ +export declare const noop: () => void; diff --git a/packages/third-party/motion/dist/utils/noop.js b/packages/third-party/motion/dist/utils/noop.js new file mode 100644 index 0000000000..9a6a7d1a13 --- /dev/null +++ b/packages/third-party/motion/dist/utils/noop.js @@ -0,0 +1,5 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +export const noop = () => { }; +//# sourceMappingURL=noop.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/noop.js.map b/packages/third-party/motion/dist/utils/noop.js.map new file mode 100644 index 0000000000..9e7a83a33c --- /dev/null +++ b/packages/third-party/motion/dist/utils/noop.js.map @@ -0,0 +1 @@ +{"version":3,"file":"noop.js","sourceRoot":"","sources":["../../src/utils/noop.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,MAAM,CAAC,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/registeredFunction.d.ts b/packages/third-party/motion/dist/utils/registeredFunction.d.ts new file mode 100644 index 0000000000..8a8375c0f8 --- /dev/null +++ b/packages/third-party/motion/dist/utils/registeredFunction.d.ts @@ -0,0 +1,5 @@ +export declare function registerCallable(func: CallableFunction, id: string): string; +export declare function runOnRegistered(id: string): T; +declare global { + var runOnRegistered: (id: string) => T; +} diff --git a/packages/third-party/motion/dist/utils/registeredFunction.js b/packages/third-party/motion/dist/utils/registeredFunction.js new file mode 100644 index 0000000000..cb3d6abe46 --- /dev/null +++ b/packages/third-party/motion/dist/utils/registeredFunction.js @@ -0,0 +1,17 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import { noop } from './noop.js'; +const registeredCallableMap = new Map(); // Regular Map for primitive keys +export function registerCallable(func, id) { + registeredCallableMap.set(id, func); + return id; +} +export function runOnRegistered(id) { + const func = registeredCallableMap.get(id) ?? noop; + return func; +} +// We use globalThis trick to get over with closure capture +// @TODO: Remove this when ReactLynx supports importing MTS for module +globalThis.runOnRegistered = runOnRegistered; +//# sourceMappingURL=registeredFunction.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/registeredFunction.js.map b/packages/third-party/motion/dist/utils/registeredFunction.js.map new file mode 100644 index 0000000000..f33dc54a0b --- /dev/null +++ b/packages/third-party/motion/dist/utils/registeredFunction.js.map @@ -0,0 +1 @@ +{"version":3,"file":"registeredFunction.js","sourceRoot":"","sources":["../../src/utils/registeredFunction.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAA4B,CAAC,CAAC,iCAAiC;AAEpG,MAAM,UAAU,gBAAgB,CAAC,IAAsB,EAAE,EAAU;IACjE,qBAAqB,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAEpC,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,EAAU;IAEV,MAAM,IAAI,GAAG,qBAAqB,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;IACnD,OAAO,IAAoB,CAAC;AAC9B,CAAC;AAQD,2DAA2D;AAC3D,sEAAsE;AACtE,UAAU,CAAC,eAAe,GAAG,eAAe,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/src/animation/index.ts b/packages/third-party/motion/src/animation/index.ts index fc086ead8c..5ba37a9021 100644 --- a/packages/third-party/motion/src/animation/index.ts +++ b/packages/third-party/motion/src/animation/index.ts @@ -5,6 +5,8 @@ import '../polyfill/shim.js'; import { animate as animateOriginal, + clamp as clampOrig, + progress as progressOrig, stagger as staggerOriginal, } from 'framer-motion/dom'; import type { @@ -13,9 +15,12 @@ import type { SequenceOptions, } from 'framer-motion/dom'; import { + mapValue as mapValueOrig, mix as mixOrig, spring as springOrig, springValue as springValueOrig, + styleEffect as styleEffectOrig, + transformValue as transformValueOrig, } from 'motion-dom'; import type { AnimationOptions, @@ -23,10 +28,12 @@ import type { AnyResolvedKeyframe, DOMKeyframesDefinition, ElementOrSelector, + MapInputRange, Mixer, MotionValue, MotionValueOptions, SpringOptions, + TransformOptions, UnresolvedValueKeyframe, ValueAnimationTransition, } from 'motion-dom'; @@ -34,6 +41,7 @@ import type { import { useMotionValueRefEvent } from '../hooks/useMotionEvent.js'; import { motionValue as motionValueOrig } from '../polyfill/MotionValue.js'; import type { ElementOrElements } from '../types/index.js'; +import { elementOrSelector2Dom } from '../utils/elementHelper.js'; import { isMainThreadElement, isMainThreadElementArray, @@ -46,6 +54,11 @@ let motionValueHandle: string; let springHandle: string; let springValueHandle: string; let mixHandle: string; +let progressHandle: string; +let clampHandle: string; +let mapValueHandle: string; +let transformValueHandle: string; +let styleEffectHandle: string; if (__MAIN_THREAD__) { animateHandle = registerCallable(animateOriginal, 'animate'); @@ -54,6 +67,11 @@ if (__MAIN_THREAD__) { springHandle = registerCallable(springOrig, 'spring'); springValueHandle = registerCallable(springValueOrig, 'springValue'); mixHandle = registerCallable(mixOrig, 'mix'); + progressHandle = registerCallable(progressOrig, 'progress'); + clampHandle = registerCallable(clampOrig, 'clamp'); + mapValueHandle = registerCallable(mapValueOrig, 'mapValue'); + transformValueHandle = registerCallable(transformValueOrig, 'transformValue'); + styleEffectHandle = registerCallable(styleEffectOrig, 'styleEffect'); } else { animateHandle = 'animate'; staggerHandle = 'stagger'; @@ -61,6 +79,11 @@ if (__MAIN_THREAD__) { springHandle = 'spring'; springValueHandle = 'springValue'; mixHandle = 'mix'; + progressHandle = 'progress'; + clampHandle = 'clamp'; + mapValueHandle = 'mapValue'; + transformValueHandle = 'transformValue'; + styleEffectHandle = 'styleEffect'; } /** @@ -231,13 +254,83 @@ function springValue( ); } -function mix(from: T, to: T): Mixer { +function mix(from: T, to: T): Mixer; +function mix(from: number, to: number, p: number): number; +function mix(from: T, to: T, p?: T): Mixer | number { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(mixHandle)(from, to); + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + return globalThis.runOnRegistered(mixHandle)( + from as any, + to as any, + p as any, + ); +} + +function progress(from: number, to: number, value: number): number { + 'main thread'; + return globalThis.runOnRegistered(progressHandle)( + from, + to, + value, + ); +} + +function clamp(min: number, max: number, v: number): number { + 'main thread'; + return globalThis.runOnRegistered(clampHandle)(min, max, v); +} + +function mapValue( + inputValue: MotionValue, + inputRange: MapInputRange, + outputRange: O[], + options?: TransformOptions, +): MotionValue { + 'main thread'; + return globalThis.runOnRegistered(mapValueHandle)( + inputValue, + inputRange, + outputRange, + options, + ); +} + +function transformValue(transform: () => O): MotionValue { + 'main thread'; + return globalThis.runOnRegistered( + transformValueHandle, + )(transform); +} + +function styleEffect( + subject: string | ElementOrElements, + values: Record, +): () => void { + 'main thread'; + const elements = elementOrSelector2Dom(subject); + if (!elements) { + return () => {}; + } + return globalThis.runOnRegistered(styleEffectHandle)( + elements, + values, + ); } export const noop = (): void => {}; -export { animate, stagger, motionValue, spring, springValue, mix }; +export { + animate, + stagger, + motionValue, + spring, + springValue, + mix, + progress, + mapValue, + clamp, + transformValue, + styleEffect, +}; export { useMotionValueRefEvent }; diff --git a/packages/third-party/motion/src/index.ts b/packages/third-party/motion/src/index.ts index 97353c4478..29e92b1b06 100644 --- a/packages/third-party/motion/src/index.ts +++ b/packages/third-party/motion/src/index.ts @@ -8,6 +8,11 @@ export { spring, springValue, mix, + progress, + mapValue, + clamp, + transformValue, + styleEffect, noop, useMotionValueRefEvent, } from './animation/index.js'; diff --git a/packages/third-party/motion/src/polyfill/shim.ts b/packages/third-party/motion/src/polyfill/shim.ts index efca30f618..355c25b11f 100644 --- a/packages/third-party/motion/src/polyfill/shim.ts +++ b/packages/third-party/motion/src/polyfill/shim.ts @@ -10,7 +10,6 @@ const timeOrigin = Date.now(); declare global { var ElementCompt: new(element: MainThread.Element) => ElementCompt; - var Element: new(element: MainThread.Element) => ElementCompt; } if (__MAIN_THREAD__) { @@ -64,4 +63,6 @@ if (__MAIN_THREAD__) { globalThis.ElementCompt = ElementCompt; // @ts-expect-error error globalThis.Element = ElementCompt; + // @ts-expect-error error + globalThis.EventTarget = ElementCompt; } diff --git a/packages/third-party/motion/src/utils/elementHelper.ts b/packages/third-party/motion/src/utils/elementHelper.ts new file mode 100644 index 0000000000..b5662cbb81 --- /dev/null +++ b/packages/third-party/motion/src/utils/elementHelper.ts @@ -0,0 +1,39 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import type { ElementOrSelector } from 'motion-dom'; + +import type { MainThread } from '@lynx-js/types'; + +import { + isMainThreadElement, + isMainThreadElementArray, +} from './isMainThreadElement.js'; +import type { ElementOrElements } from '../types/index.js'; + +export function elementOrSelector2Dom( + nodesOrSelector: string | MainThread.Element | MainThread.Element[], +): ElementOrSelector | undefined { + 'main thread'; + let domElements: ElementOrSelector | undefined = undefined; + + if ( + typeof nodesOrSelector === 'string' + || isMainThreadElement(nodesOrSelector) + || isMainThreadElementArray(nodesOrSelector) + ) { + let elementNodes: ElementOrElements; + if (typeof nodesOrSelector === 'string') { + elementNodes = lynx.querySelectorAll(nodesOrSelector); + } else { + elementNodes = nodesOrSelector; + } + domElements = (Array.isArray(elementNodes) + ? elementNodes.map(el => new globalThis.ElementCompt(el)) + : new globalThis.ElementCompt( + elementNodes, + )) as unknown as ElementOrSelector; + } + + return domElements; +} From d802beac472107366bae656216ee0043a3af81b2 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Fri, 21 Nov 2025 19:50:13 +0800 Subject: [PATCH 06/37] chore: update node version --- package.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/package.json b/package.json index 09a038d13a..05a30d5872 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ "type": "module", "scripts": { "build": "tsc --build", - "prepare": "husky && ts-patch install", "test": "vitest" }, "lint-staged": { @@ -60,8 +59,5 @@ "typescript-eslint": "^8.45.0", "vitest": "^3.2.4" }, - "packageManager": "pnpm@10.17.1+sha512.17c560fca4867ae9473a3899ad84a88334914f379be46d455cbf92e5cf4b39d34985d452d2583baf19967fa76cb5c17bc9e245529d0b98745721aa7200ecaf7a", - "engines": { - "node": "^22 || ^24" - } + "packageManager": "pnpm@10.17.1+sha512.17c560fca4867ae9473a3899ad84a88334914f379be46d455cbf92e5cf4b39d34985d452d2583baf19967fa76cb5c17bc9e245529d0b98745721aa7200ecaf7a" } From 9416f31dee49cab06c56f7b1e1d2612d069bfac3 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 24 Nov 2025 11:34:22 +0800 Subject: [PATCH 07/37] fix: types conflict --- packages/third-party/motion/dist/animation/index.js | 1 - packages/third-party/motion/dist/animation/index.js.map | 2 +- packages/third-party/motion/dist/polyfill/shim.js | 3 +-- packages/third-party/motion/dist/polyfill/shim.js.map | 2 +- packages/third-party/motion/src/animation/index.ts | 5 ++++- packages/third-party/motion/src/polyfill/shim.ts | 7 ++----- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/third-party/motion/dist/animation/index.js b/packages/third-party/motion/dist/animation/index.js index 3abefa1003..5e1db7ce30 100644 --- a/packages/third-party/motion/dist/animation/index.js +++ b/packages/third-party/motion/dist/animation/index.js @@ -98,7 +98,6 @@ function springValue(source, options) { function mix(from, to, p) { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument return globalThis.runOnRegistered(mixHandle)(from, to, p); } function progress(from, to, value) { diff --git a/packages/third-party/motion/dist/animation/index.js.map b/packages/third-party/motion/dist/animation/index.js.map index 43b26d1114..c11ddc7e6e 100644 --- a/packages/third-party/motion/dist/animation/index.js.map +++ b/packages/third-party/motion/dist/animation/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"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;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AAEnC,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,GACZ,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,KAAK,IAAI,SAAS,EAClB,QAAQ,IAAI,YAAY,EACxB,OAAO,IAAI,eAAe,GAC3B,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,GAAG,IAAI,OAAO,EACd,MAAM,IAAI,UAAU,EACpB,WAAW,IAAI,eAAe,EAC9B,WAAW,IAAI,eAAe,EAC9B,cAAc,IAAI,kBAAkB,GACrC,MAAM,YAAY,CAAC;AAkBpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAQ5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,IAAI,aAAqB,CAAC;AAC1B,IAAI,aAAqB,CAAC;AAC1B,IAAI,iBAAyB,CAAC;AAC9B,IAAI,YAAoB,CAAC;AACzB,IAAI,iBAAyB,CAAC;AAC9B,IAAI,SAAiB,CAAC;AACtB,IAAI,cAAsB,CAAC;AAC3B,IAAI,WAAmB,CAAC;AACxB,IAA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S,WAAW,CAClB,OAAmC,EACnC,MAAmC;IAEnC,aAAa,CAAC;IACd,MAAM,QAAQ,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,UAAU,CAAC,eAAe,CAAyB,iBAAiB,CAAC,CAC1E,QAAQ,EACR,MAAM,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AAEnC,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,GACZ,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/shim.js b/packages/third-party/motion/dist/polyfill/shim.js index 07e10ba30f..bcf71a138a 100644 --- a/packages/third-party/motion/dist/polyfill/shim.js +++ b/packages/third-party/motion/dist/polyfill/shim.js @@ -20,9 +20,7 @@ if (__MAIN_THREAD__) { class SVGElement { } const window = { - // biome-ignore lint/suspicious/noExplicitAny: getComputedStyle: (ele) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access return ele.getComputedStyle(); }, }; @@ -43,6 +41,7 @@ if (__MAIN_THREAD__) { globalThis.SVGElement = SVGElement; // @ts-expect-error error globalThis.window = window; + // @ts-expect-error error globalThis.getComputedStyle = window.getComputedStyle; // @ts-expect-error error globalThis.HTMLElement = HTMLElement; diff --git a/packages/third-party/motion/dist/polyfill/shim.js.map b/packages/third-party/motion/dist/polyfill/shim.js.map index 97c3a388f4..e834cdfe51 100644 --- a/packages/third-party/motion/dist/polyfill/shim.js.map +++ b/packages/third-party/motion/dist/polyfill/shim.js.map @@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AM,WAAW;KAAG;IAEpB,yBAAyB;IACzB,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC/B,yBAAyB;IACzB,UAAU,CAAC,WAAW,GAAG,WAAW,CAAC;IACrC,UAAU,CAAC,cAAc,GAAG,cAAc,CAAC;IAC3C,yBAAyB;IACzB,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;IAC5C,yBAAyB;IACzB,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;IAClD,yBAAyB;IACzB,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC/B,yBAAyB;IACzB,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC;IACnC,yBAAyB;IACzB,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC;IAC3B,yBAAyB;IACzB,UAAU,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IACtD,yBAAyB;IACzB,UAAU,CAAC,WAAW,GAAG,WAAW,CAAC;IACrC,UAAU,CAAC,YAAY,GAAG,YAAY,CAAC;IACvC,yBAAyB;IACzB,UAAU,CAAC,OAAO,GAAG,YAAY,CAAC;IAClC,yBAAyB;IACzB,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AACxC,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/src/animation/index.ts b/packages/third-party/motion/src/animation/index.ts index 5ba37a9021..6413080ff7 100644 --- a/packages/third-party/motion/src/animation/index.ts +++ b/packages/third-party/motion/src/animation/index.ts @@ -259,10 +259,13 @@ function mix(from: number, to: number, p: number): number; function mix(from: T, to: T, p?: T): Mixer | number { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + return globalThis.runOnRegistered(mixHandle)( + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument from as any, + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument to as any, + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument p as any, ); } diff --git a/packages/third-party/motion/src/polyfill/shim.ts b/packages/third-party/motion/src/polyfill/shim.ts index 355c25b11f..17ed80495f 100644 --- a/packages/third-party/motion/src/polyfill/shim.ts +++ b/packages/third-party/motion/src/polyfill/shim.ts @@ -31,9 +31,7 @@ if (__MAIN_THREAD__) { class SVGElement {} const window = { - // biome-ignore lint/suspicious/noExplicitAny: - getComputedStyle: (ele: any) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access + getComputedStyle: (ele: ElementCompt) => { return ele.getComputedStyle(); }, }; @@ -46,10 +44,8 @@ if (__MAIN_THREAD__) { globalThis.performance = performance; globalThis.queueMicrotask = queueMicrotask; // @ts-expect-error error - document.querySelector = lynx.querySelector; // @ts-expect-error error - document.querySelectorAll = lynx.querySelectorAll; // @ts-expect-error error globalThis.NodeList = NodeList; @@ -57,6 +53,7 @@ if (__MAIN_THREAD__) { globalThis.SVGElement = SVGElement; // @ts-expect-error error globalThis.window = window; + // @ts-expect-error error globalThis.getComputedStyle = window.getComputedStyle; // @ts-expect-error error globalThis.HTMLElement = HTMLElement; From 993520bd2f7cf1c436d124a6dd20b91f1efb848a Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 24 Nov 2025 21:35:07 +0800 Subject: [PATCH 08/37] feat: add useMotionValueRefEvent --- .../motion/dist/animation/index.js | 8 +++++++- .../motion/dist/animation/index.js.map | 2 +- packages/third-party/motion/dist/index.js.map | 2 +- .../motion/src/modified/motionValue.ts | 19 +++++++++++++++++++ 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 packages/third-party/motion/src/modified/motionValue.ts diff --git a/packages/third-party/motion/dist/animation/index.js b/packages/third-party/motion/dist/animation/index.js index 5e1db7ce30..74ecb746a5 100644 --- a/packages/third-party/motion/dist/animation/index.js +++ b/packages/third-party/motion/dist/animation/index.js @@ -98,7 +98,13 @@ function springValue(source, options) { function mix(from, to, p) { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(mixHandle)(from, to, p); + return globalThis.runOnRegistered(mixHandle)( + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + from, + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + to, + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + p); } function progress(from, to, value) { 'main thread'; diff --git a/packages/third-party/motion/dist/animation/index.js.map b/packages/third-party/motion/dist/animation/index.js.map index c11ddc7e6e..f475529b6c 100644 --- a/packages/third-party/motion/dist/animation/index.js.map +++ b/packages/third-party/motion/dist/animation/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,KAAK,IAAI,SAAS,EAClB,QAAQ,IAAI,YAAY,EACxB,OAAO,IAAI,eAAe,GAC3B,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,GAAG,IAAI,OAAO,EACd,MAAM,IAAI,UAAU,EACpB,WAAW,IAAI,eAAe,EAC9B,WAAW,IAAI,eAAe,EAC9B,cAAc,IAAI,kBAAkB,GACrC,MAAM,YAAY,CAAC;AAkBpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAQ5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,IAAI,aAAqB,CAAC;AAC1B,IAAI,aAAqB,CAAC;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O,CACR,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAI,SAAkB;IAC3C,aAAa,CAAC;IACd,OAAO,UAAU,CAAC,eAAe,CAC/B,oBAAoB,CACrB,CAAC,SAAS,CAAC,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAClB,OAAmC,EACnC,MAAmC;IAEnC,aAAa,CAAC;IACd,MAAM,QAAQ,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,UAAU,CAAC,eAAe,CAAyB,iBAAiB,CAAC,CAC1E,QAAQ,EACR,MAAM,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AAEnC,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,GACZ,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,KAAK,IAAI,SAAS,EAClB,QAAQ,IAAI,YAAY,EACxB,OAAO,IAAI,eAAe,GAC3B,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,GAAG,IAAI,OAAO,EACd,MAAM,IAAI,UAAU,EACpB,WAAW,IAAI,eAAe,EAC9B,WAAW,IAAI,eAAe,EAC9B,cAAc,IAAI,kBAAkB,GACrC,MAAM,YAAY,CAAC;AAiBpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA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AC,GAAW,EAAE,GAAW,EAAE,CAAS;IAChD,aAAa,CAAC;IACd,OAAO,UAAU,CAAC,eAAe,CAAmB,WAAW,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,QAAQ,CACf,UAA+B,EAC/B,UAAyB,EACzB,WAAgB,EAChB,OAA6B;IAE7B,aAAa,CAAC;IACd,OAAO,UAAU,CAAC,eAAe,CAAsB,cAAc,CAAC,CACpE,UAAU,EACV,UAAU,EACV,WAAW,EACX,OAAO,CACR,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAI,SAAkB;IAC3C,aAAa,CAAC;IACd,OAAO,UAAU,CAAC,eAAe,CAC/B,oBAAoB,CACrB,CAAC,SAAS,CAAC,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAClB,OAAmC,EACnC,MAAmC;IAEnC,aAAa,CAAC;IACd,MAAM,QAAQ,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,UAAU,CAAC,eAAe,CAAyB,iBAAiB,CAAC,CAC1E,QAAQ,EACR,MAAM,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AAEnC,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,GACZ,CAAC;AAMF,OAAO,EAAE,sBAAsB,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/index.js.map b/packages/third-party/motion/dist/index.js.map index c931ef0963..204d3d97c7 100644 --- a/packages/third-party/motion/dist/index.js.map +++ b/packages/third-party/motion/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,EACX,IAAI,EACJ,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EAEH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,EAGX,IAAI,EACJ,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/src/modified/motionValue.ts b/packages/third-party/motion/src/modified/motionValue.ts new file mode 100644 index 0000000000..ac93415b8d --- /dev/null +++ b/packages/third-party/motion/src/modified/motionValue.ts @@ -0,0 +1,19 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { MotionValue } from 'motion-dom'; +import type { MotionValueOptions } from 'motion-dom'; + +class CustomMotionValue extends MotionValue { + toJSON() { + return {}; + } +} + +export function motionValue( + init: V, + options?: MotionValueOptions, +): MotionValue { + return new CustomMotionValue(init, options); +} From 6b20026e2b607959c4e99ac0c8ba550473c08a7c Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Wed, 26 Nov 2025 22:29:50 +0800 Subject: [PATCH 09/37] fix: motion reset transform bug --- examples/motion/src/Basic/index.tsx | 2 +- examples/motion/src/BasicPercent/index.tsx | 2 +- examples/motion/src/BasicSelector/index.tsx | 2 +- examples/motion/src/ColorInterception/index.tsx | 2 +- examples/motion/src/MotionValue/index.tsx | 6 +++--- examples/motion/src/Spring/index.tsx | 2 +- examples/motion/src/Stagger/index.tsx | 2 +- examples/motion/src/Text/index.tsx | 2 +- examples/motion/src/iOSSlider/index.tsx | 10 ++++------ examples/motion/src/iOSSlider/styles.css | 3 +++ .../third-party/motion/dist/animation/index.js.map | 2 +- packages/third-party/motion/dist/index.js.map | 2 +- packages/third-party/motion/dist/polyfill/element.js | 7 +++++++ .../third-party/motion/dist/polyfill/element.js.map | 2 +- packages/third-party/motion/src/polyfill/element.ts | 7 +++++++ 15 files changed, 34 insertions(+), 19 deletions(-) diff --git a/examples/motion/src/Basic/index.tsx b/examples/motion/src/Basic/index.tsx index 9c5d45e98e..68ad7a1372 100644 --- a/examples/motion/src/Basic/index.tsx +++ b/examples/motion/src/Basic/index.tsx @@ -38,7 +38,7 @@ export default function Basic() { void runOnMainThread(startAnimation)(); }, 1000); return () => { - void runOnMainThread(endAnimation); + void runOnMainThread(endAnimation)(); }; }, []); diff --git a/examples/motion/src/BasicPercent/index.tsx b/examples/motion/src/BasicPercent/index.tsx index 313e204bbe..59d5ba1af3 100644 --- a/examples/motion/src/BasicPercent/index.tsx +++ b/examples/motion/src/BasicPercent/index.tsx @@ -36,7 +36,7 @@ export default function BasicPercent() { useEffect(() => { void runOnMainThread(startAnimation)(); return () => { - void runOnMainThread(endAnimation); + void runOnMainThread(endAnimation)(); }; }, []); diff --git a/examples/motion/src/BasicSelector/index.tsx b/examples/motion/src/BasicSelector/index.tsx index 72ba724b0c..1af89885e6 100644 --- a/examples/motion/src/BasicSelector/index.tsx +++ b/examples/motion/src/BasicSelector/index.tsx @@ -33,7 +33,7 @@ export default function Basic() { void runOnMainThread(startAnimation)(); }, 1000); return () => { - void runOnMainThread(endAnimation); + void runOnMainThread(endAnimation)(); }; }, []); diff --git a/examples/motion/src/ColorInterception/index.tsx b/examples/motion/src/ColorInterception/index.tsx index 0d2540aaaf..5c42ef7766 100644 --- a/examples/motion/src/ColorInterception/index.tsx +++ b/examples/motion/src/ColorInterception/index.tsx @@ -37,7 +37,7 @@ export default function ColorInterception() { useEffect(() => { void runOnMainThread(startAnimation)(); return () => { - void runOnMainThread(endAnimation); + void runOnMainThread(endAnimation)(); }; }, []); diff --git a/examples/motion/src/MotionValue/index.tsx b/examples/motion/src/MotionValue/index.tsx index cdd3f98825..277651a708 100644 --- a/examples/motion/src/MotionValue/index.tsx +++ b/examples/motion/src/MotionValue/index.tsx @@ -1,5 +1,5 @@ -import { type animate, motionValue } from '@lynx-js/motion-lynx'; -import type { MotionValue } from '@lynx-js/motion-lynx'; +import { motionValue } from '@lynx-js/motion-lynx'; +import type { MotionValue, animate } from '@lynx-js/motion-lynx'; import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; import type { MainThread } from '@lynx-js/types'; @@ -45,7 +45,7 @@ export default function Basic() { void runOnMainThread(startAnimation)(); }, 1000); return () => { - void runOnMainThread(endAnimation); + void runOnMainThread(endAnimation)(); }; }, []); diff --git a/examples/motion/src/Spring/index.tsx b/examples/motion/src/Spring/index.tsx index 9f16671922..937fdb2b24 100644 --- a/examples/motion/src/Spring/index.tsx +++ b/examples/motion/src/Spring/index.tsx @@ -31,7 +31,7 @@ export default function Spring() { useEffect(() => { void runOnMainThread(startAnimation)(); return () => { - void runOnMainThread(endAnimation); + void runOnMainThread(endAnimation)(); }; }, []); diff --git a/examples/motion/src/Stagger/index.tsx b/examples/motion/src/Stagger/index.tsx index df0bcabcaf..5b6b3e889e 100644 --- a/examples/motion/src/Stagger/index.tsx +++ b/examples/motion/src/Stagger/index.tsx @@ -27,7 +27,7 @@ export default function Stagger() { useEffect(() => { void runOnMainThread(startAnimation)(); return () => { - void runOnMainThread(endAnimation); + void runOnMainThread(endAnimation)(); }; }, []); diff --git a/examples/motion/src/Text/index.tsx b/examples/motion/src/Text/index.tsx index d537f695e0..2a56b770e9 100644 --- a/examples/motion/src/Text/index.tsx +++ b/examples/motion/src/Text/index.tsx @@ -33,7 +33,7 @@ export default function Text() { useEffect(() => { void runOnMainThread(startAnimation)(); return () => { - void runOnMainThread(endAnimation); + void runOnMainThread(endAnimation)(); }; }, []); diff --git a/examples/motion/src/iOSSlider/index.tsx b/examples/motion/src/iOSSlider/index.tsx index 5f2889589d..8f98168c27 100644 --- a/examples/motion/src/iOSSlider/index.tsx +++ b/examples/motion/src/iOSSlider/index.tsx @@ -34,7 +34,7 @@ export default function Comp() { function measureSlider() { 'main thread'; - void sliderRef.current?.invoke('getBoundingClientRect').then( + void sliderRef.current?.invoke('boundingClientRect').then( (res: { top: number; bottom: number }) => { sizeRef.current = { top: res.top, bottom: res.bottom }; }, @@ -62,7 +62,7 @@ export default function Comp() { [maxStretch, 1, 1, maxStretch], ); - styleEffect(sliderRef.current!, { y, scaleX, scaleY }); + styleEffect('.slider', { y, scaleX, scaleY }); styleEffect('.indicator', { scaleY: transformValue(() => clamp(0, 1, progressRef.current.get())), @@ -77,9 +77,7 @@ export default function Comp() { } useEffect(() => { - setTimeout(() => { - void runOnMainThread(initEffects)(); - }, 1000); + void runOnMainThread(initEffects)(); }, []); function onTouchStart(e: MainThread.TouchEvent) { @@ -134,7 +132,7 @@ export default function Comp() { > - + diff --git a/examples/motion/src/iOSSlider/styles.css b/examples/motion/src/iOSSlider/styles.css index 5fd02808fa..309921270b 100644 --- a/examples/motion/src/iOSSlider/styles.css +++ b/examples/motion/src/iOSSlider/styles.css @@ -3,6 +3,7 @@ display: flex; justify-content: center; align-items: center; + background-color: #555; } .slider { @@ -40,4 +41,6 @@ position: relative; z-index: 1; bottom: 20px; + width: 48px; + height: 48px; } diff --git a/packages/third-party/motion/dist/animation/index.js.map b/packages/third-party/motion/dist/animation/index.js.map index f475529b6c..3d5ff1b351 100644 --- a/packages/third-party/motion/dist/animation/index.js.map +++ b/packages/third-party/motion/dist/animation/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,KAAK,IAAI,SAAS,EAClB,QAAQ,IAAI,YAAY,EACxB,OAAO,IAAI,eAAe,GAC3B,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,GAAG,IAAI,OAAO,EACd,MAAM,IAAI,UAAU,EACpB,WAAW,IAAI,eAAe,EAC9B,WAAW,IAAI,eAAe,EAC9B,cAAc,IAAI,kBAAkB,GACrC,MAAM,YAAY,CAAC;AAiBpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,IAAI,aAAqB,CAAC;AAC1B,IAAI,aAAqB,CAAC;AAC1B,IAAI,iBAAyB,CAAC;AAC9B,IAAI,YAAoB,CAAC;AACzB,IAAI,iBAAyB,CAAC;AAC9B,IAAI,SAAiB,CAAC;AACtB,IAAI,cAAsB,CAAC;AAC3B,IAAI,WAAmB,CAAC;AACxB,IAAI,cAAsB,CAAC;AAC3B,IAAI,oBAA4B,CAAC;AACjC,IAAI,iBAAyB,CAAC;AAE9B,IAAI,eAAe,EAAE,CAAC;IACpB,aAAa,GAAG,gBAAgB,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAC7D,aAAa,GAAG,gBAAgB,CAAC,eAAe,EAAE,SAAS,CAA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,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,UAAU,CAAC,eAAe,CAAyB,iBAAiB,CAAC,CAC1E,QAAQ,EACR,MAAM,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AAEnC,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,GACZ,CAAC;AAMF,OAAO,EAAE,sBAAsB,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,KAAK,IAAI,SAAS,EAClB,QAAQ,IAAI,YAAY,EACxB,OAAO,IAAI,eAAe,GAC3B,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,GAAG,IAAI,OAAO,EACd,MAAM,IAAI,UAAU,EACpB,WAAW,IAAI,eAAe,EAC9B,WAAW,IAAI,eAAe,EAC9B,cAAc,IAAI,kBAAkB,GACrC,MAAM,YAAY,CAAC;AAiBpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,IAAI,aAAqB,CAAC;AAC1B,IAAI,aAAqB,CAAC;AAC1B,IAAI,iBAAyB,CAAC;AAC9B,IAAI,YAAo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ACR,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAI,SAAkB;IAC3C,aAAa,CAAC;IACd,OAAO,UAAU,CAAC,eAAe,CAC/B,oBAAoB,CACrB,CAAC,SAAS,CAAC,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAClB,OAAmC,EACnC,MAAmC;IAEnC,aAAa,CAAC;IACd,MAAM,QAAQ,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,UAAU,CAAC,eAAe,CAAyB,iBAAiB,CAAC,CAC1E,QAAQ,EACR,MAAM,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AAEnC,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,GACZ,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/index.js.map b/packages/third-party/motion/dist/index.js.map index 204d3d97c7..c931ef0963 100644 --- a/packages/third-party/motion/dist/index.js.map +++ b/packages/third-party/motion/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EAEH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,EAGX,IAAI,EACJ,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,EACX,IAAI,EACJ,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/element.js b/packages/third-party/motion/dist/polyfill/element.js index a696748ea4..0a19f77944 100644 --- a/packages/third-party/motion/dist/polyfill/element.js +++ b/packages/third-party/motion/dist/polyfill/element.js @@ -16,11 +16,18 @@ export class ElementCompt { get style() { const styleObject = {}; styleObject.setProperty = (property, value) => { + if (property === 'transform' && value === 'none') { + return this.element.setStyleProperty('transform', 'scale(1, 1)'); + } this.element.setStyleProperty(property, value); }; return new Proxy(styleObject, { set: (target, prop, value) => { if (typeof prop === 'string' && prop !== 'setProperty') { + if (prop === 'transform' && value === 'none') { + this.element.setStyleProperty('transform', 'scale(1, 1)'); + return true; + } this.element.setStyleProperty(prop, String(value)); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment target[prop] = value; diff --git a/packages/third-party/motion/dist/polyfill/element.js.map b/packages/third-party/motion/dist/polyfill/element.js.map index 4bb7291e06..189b0b6484 100644 --- a/packages/third-party/motion/dist/polyfill/element.js.map +++ b/packages/third-party/motion/dist/polyfill/element.js.map @@ -1 +1 @@ -{"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/polyfill/element.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,YAAY;IACf,OAAO,CAAqB;IAEpC,YAAY,OAA2B;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,gBAAgB;QACrB,MAAM,WAAW,GAA2B,EAAE,CA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AAC,CAAC;IACxC,CAAC;IACD,IAAI,KAAK,CAAC,KAAa;QACrB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,MAAM,CAAC,KAAa;QACtB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;CACF"} \ No newline at end of file +{"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/polyfill/element.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,YAAY;IACf,OAAO,CAAqB;IAEpC,YAAY,OAA2B;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,gBAAgB;QACrB,MAAM,WAAW,GAA2B,EAAE,CAAC;QAE/C,OAAO,IAAI,KAAK,CAAC,WAAW,EAAE;YAC5B,GAAG,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;gBACrB,4BAA4B;gBAC5B,iEAAiE;gBACjE,OAAO,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAc,CAAC,CAAC;YACvE,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,IAAW,KAAK;QACd,MAAM,WAAW,GAAG,EAAiB,CAAC;QAEtC,WAAW,CAAC,WAAW,GAAG,CAAC,QAAgB,EAAE,KAAa,EAAE,EAAE;YAC5D,IAAI,QAAQ,KAAK,WAAW,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;gBACjD,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;YACnE,CAAC;YACD,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC,CAAC;QACF,OAAO,I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,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;CACF"} \ No newline at end of file diff --git a/packages/third-party/motion/src/polyfill/element.ts b/packages/third-party/motion/src/polyfill/element.ts index 24d5bbe71e..11b4d6edb4 100644 --- a/packages/third-party/motion/src/polyfill/element.ts +++ b/packages/third-party/motion/src/polyfill/element.ts @@ -31,11 +31,18 @@ export class ElementCompt { const styleObject = {} as StyleObject; styleObject.setProperty = (property: string, value: string) => { + if (property === 'transform' && value === 'none') { + return this.element.setStyleProperty('transform', 'scale(1, 1)'); + } this.element.setStyleProperty(property, value); }; return new Proxy(styleObject, { set: (target, prop, value) => { if (typeof prop === 'string' && prop !== 'setProperty') { + if (prop === 'transform' && value === 'none') { + this.element.setStyleProperty('transform', 'scale(1, 1)'); + return true; + } this.element.setStyleProperty(prop, String(value)); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment target[prop] = value; From 1d1ad310748c9d0169e5be38f17ce976e9d3dcac Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Thu, 27 Nov 2025 19:01:38 +0800 Subject: [PATCH 10/37] fix: shim conflict on web --- .../third-party/motion/dist/polyfill/shim.js | 83 ++++++++++--------- .../motion/dist/polyfill/shim.js.map | 2 +- .../third-party/motion/src/polyfill/shim.ts | 83 ++++++++++--------- 3 files changed, 87 insertions(+), 81 deletions(-) diff --git a/packages/third-party/motion/dist/polyfill/shim.js b/packages/third-party/motion/dist/polyfill/shim.js index bcf71a138a..bddef9a8da 100644 --- a/packages/third-party/motion/dist/polyfill/shim.js +++ b/packages/third-party/motion/dist/polyfill/shim.js @@ -4,47 +4,52 @@ import { document, setupDocument } from '@lynx-js/react/internal/document'; import { ElementCompt } from './element.js'; const timeOrigin = Date.now(); +function shimGlobals() { + if (!globalThis.performance) { + const performance = { + now: () => Date.now() - timeOrigin, + }; + function queueMicrotask(fn) { + void Promise.resolve().then(() => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + fn(); + }); + } + class NodeList { + } + class SVGElement { + } + const window = { + getComputedStyle: (ele) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access + return ele.getComputedStyle(); + }, + }; + class HTMLElement { + } + // @ts-expect-error error + globalThis.document = document; + // @ts-expect-error error + globalThis.performance = performance; + globalThis.queueMicrotask = queueMicrotask; + // @ts-expect-error error + document.querySelector = lynx.querySelector; + // @ts-expect-error error + document.querySelectorAll = lynx.querySelectorAll; + // @ts-expect-error error + globalThis.NodeList = NodeList; + // @ts-expect-error error + globalThis.SVGElement = SVGElement; + // @ts-expect-error error + globalThis.window = window; + globalThis.getComputedStyle = window.getComputedStyle; + // @ts-expect-error error + globalThis.HTMLElement = HTMLElement; + } +} if (__MAIN_THREAD__) { setupDocument(); - const performance = { - now: () => Date.now() - timeOrigin, - }; - function queueMicrotask(fn) { - void Promise.resolve().then(() => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - fn(); - }); - } - class NodeList { - } - class SVGElement { - } - const window = { - getComputedStyle: (ele) => { - return ele.getComputedStyle(); - }, - }; - class HTMLElement { - } - // @ts-expect-error error - globalThis.document = document; - // @ts-expect-error error - globalThis.performance = performance; - globalThis.queueMicrotask = queueMicrotask; - // @ts-expect-error error - document.querySelector = lynx.querySelector; - // @ts-expect-error error - document.querySelectorAll = lynx.querySelectorAll; - // @ts-expect-error error - globalThis.NodeList = NodeList; - // @ts-expect-error error - globalThis.SVGElement = SVGElement; - // @ts-expect-error error - globalThis.window = window; - // @ts-expect-error error - globalThis.getComputedStyle = window.getComputedStyle; - // @ts-expect-error error - globalThis.HTMLElement = HTMLElement; + shimGlobals(); globalThis.ElementCompt = ElementCompt; // @ts-expect-error error globalThis.Element = ElementCompt; diff --git a/packages/third-party/motion/dist/polyfill/shim.js.map b/packages/third-party/motion/dist/polyfill/shim.js.map index e834cdfe51..126c13905d 100644 --- a/packages/third-party/motion/dist/polyfill/shim.js.map +++ b/packages/third-party/mot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YAChC,CAAC;SACF,CAAC;QACF,MAAM,WAAW;SAAG;QACpB,yBAAyB;QACzB,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC/B,yBAAyB;QACzB,UAAU,CAAC,WAAW,GAAG,WAAW,CAAC;QACrC,UAAU,CAAC,cAAc,GAAG,cAAc,CAAC;QAC3C,yBAAyB;QACzB,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QAC5C,yBAAyB;QACzB,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAClD,yBAAyB;QACzB,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC/B,yBAAyB;QACzB,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC;QACnC,yBAAyB;QACzB,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC;QAC3B,UAAU,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACtD,yBAAyB;QACzB,UAAU,CAAC,WAAW,GAAG,WAAW,CAAC;IACvC,CAAC;AACH,CAAC;AAED,IAAI,eAAe,EAAE,CAAC;IACpB,aAAa,EAAE,CAAC;IAEhB,WAAW,EAAE,CAAC;IAEd,UAAU,CAAC,YAAY,GAAG,YAAY,CAAC;IACvC,yBAAyB;IACzB,UAAU,CAAC,OAAO,GAAG,YAAY,CAAC;IAClC,yBAAyB;IACzB,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AACxC,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/src/polyfill/shim.ts b/packages/third-party/motion/src/polyfill/shim.ts index 17ed80495f..6d4a050bfe 100644 --- a/packages/third-party/motion/src/polyfill/shim.ts +++ b/packages/third-party/motion/src/polyfill/shim.ts @@ -12,51 +12,52 @@ declare global { var ElementCompt: new(element: MainThread.Element) => ElementCompt; } -if (__MAIN_THREAD__) { - setupDocument(); - - const performance = { - now: () => Date.now() - timeOrigin, - }; - - function queueMicrotask(fn: CallableFunction) { - void Promise.resolve().then(() => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - fn(); - }); +function shimGlobals() { + if (!globalThis.performance) { + const performance = { + now: () => Date.now() - timeOrigin, + }; + function queueMicrotask(fn: any) { + void Promise.resolve().then(() => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + fn(); + }); + } + class NodeList {} + class SVGElement {} + const window = { + getComputedStyle: (ele: any) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access + return ele.getComputedStyle(); + }, + }; + class HTMLElement {} + // @ts-expect-error error + globalThis.document = document; + // @ts-expect-error error + globalThis.performance = performance; + globalThis.queueMicrotask = queueMicrotask; + // @ts-expect-error error + document.querySelector = lynx.querySelector; + // @ts-expect-error error + document.querySelectorAll = lynx.querySelectorAll; + // @ts-expect-error error + globalThis.NodeList = NodeList; + // @ts-expect-error error + globalThis.SVGElement = SVGElement; + // @ts-expect-error error + globalThis.window = window; + globalThis.getComputedStyle = window.getComputedStyle; + // @ts-expect-error error + globalThis.HTMLElement = HTMLElement; } +} - class NodeList {} - - class SVGElement {} - - const window = { - getComputedStyle: (ele: ElementCompt) => { - return ele.getComputedStyle(); - }, - }; +if (__MAIN_THREAD__) { + setupDocument(); - class HTMLElement {} + shimGlobals(); - // @ts-expect-error error - globalThis.document = document; - // @ts-expect-error error - globalThis.performance = performance; - globalThis.queueMicrotask = queueMicrotask; - // @ts-expect-error error - document.querySelector = lynx.querySelector; - // @ts-expect-error error - document.querySelectorAll = lynx.querySelectorAll; - // @ts-expect-error error - globalThis.NodeList = NodeList; - // @ts-expect-error error - globalThis.SVGElement = SVGElement; - // @ts-expect-error error - globalThis.window = window; - // @ts-expect-error error - globalThis.getComputedStyle = window.getComputedStyle; - // @ts-expect-error error - globalThis.HTMLElement = HTMLElement; globalThis.ElementCompt = ElementCompt; // @ts-expect-error error globalThis.Element = ElementCompt; From 4d826c0b9d84adde83e21be401268337288d38e8 Mon Sep 17 00:00:00 2001 From: yradex <11014207+Yradex@users.noreply.github.com> Date: Fri, 28 Nov 2025 14:57:24 +0800 Subject: [PATCH 11/37] feat(react): shared runtime imports --- .changeset/shared-runtime-imports.md | 20 ++ .../swc_plugin_worklet/extract_ident.rs | 8 + .../crates/swc_plugin_worklet/lib.rs | 259 ++++++++++++++++++ ...ould_handle_renamed_import_shadowing_js.js | 16 ++ ...ip_shared_identifiers_default_import_js.js | 12 + .../should_skip_shared_identifiers_js.js | 12 + .../should_skip_shared_identifiers_lepus.js | 19 ++ ..._shared_identifiers_namespace_import_js.js | 12 + ...d_skip_shared_identifiers_string_key_js.js | 12 + 9 files changed, 370 insertions(+) create mode 100644 .changeset/shared-runtime-imports.md create mode 100644 packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_handle_renamed_import_shadowing_js.js create mode 100644 packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_default_import_js.js create mode 100644 packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_js.js create mode 100644 packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_lepus.js create mode 100644 packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_namespace_import_js.js create mode 100644 packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_string_key_js.js diff --git a/.changeset/shared-runtime-imports.md b/.changeset/shared-runtime-imports.md new file mode 100644 index 0000000000..6d4b5330c9 --- /dev/null +++ b/.changeset/shared-runtime-imports.md @@ -0,0 +1,20 @@ +--- +"@lynx-js/react": patch +--- + +feat: support declaring cross-thread shared modules via Import Attributes, enabling Main Thread Functions to call standard JS functions directly. + +- Usage: Add `with { runtime: "shared" }` to the `import` statement. For example: + + ```ts + import { func } from './utils.js' with { runtime: 'shared' }; + + function worklet() { + 'main thread'; + func(); // callable inside a main thread function + } + ``` + +- Limitations: + - Only directly imported identifiers are treated as shared; assigning the import to a new variable will result in the loss of this shared capability. + - Functions defined within shared modules do not automatically become Main Thread Functions. Accessing main-thread-only APIs (e.g., `MainThreadRef`) will cause errors. diff --git a/packages/react/transform/crates/swc_plugin_worklet/extract_ident.rs b/packages/react/transform/crates/swc_plugin_worklet/extract_ident.rs index 4c9e6c030d..a77f28f54a 100644 --- a/packages/react/transform/crates/swc_plugin_worklet/extract_ident.rs +++ b/packages/react/transform/crates/swc_plugin_worklet/extract_ident.rs @@ -14,6 +14,7 @@ use swc_core::quote; pub struct ExtractingIdentsCollectorConfig { pub custom_global_ident_names: Option>, + pub shared_identifiers: Option>, } struct ScopeEnv { @@ -252,6 +253,13 @@ impl VisitMut for ExtractingIdentsCollector { } fn visit_mut_ident(&mut self, n: &mut Ident) { + // Skip shared identifiers from shared-runtime imports + if let Some(ref shared_idents) = self.cfg.shared_identifiers { + if shared_idents.contains(&n.to_id()) { + return; + } + } + if !self .scope_env .iter() diff --git a/packages/react/transform/crates/swc_plugin_worklet/lib.rs b/packages/react/transform/crates/swc_plugin_worklet/lib.rs index 846c181298..f062461bf1 100644 --- a/packages/react/transform/crates/swc_plugin_worklet/lib.rs +++ b/packages/react/transform/crates/swc_plugin_worklet/lib.rs @@ -8,6 +8,7 @@ mod worklet_type; use extract_ident::{ExtractingIdentsCollector, ExtractingIdentsCollectorConfig}; use gen_stmt::StmtGen; use hash::WorkletHash; +use rustc_hash::FxHashSet; use serde::Deserialize; use std::collections::HashSet; use std::vec; @@ -58,6 +59,7 @@ pub struct WorkletVisitor { stmts_to_insert_at_top_level: Vec, named_imports: HashSet, hasher: WorkletHash, + shared_identifiers: FxHashSet, } impl Default for WorkletVisitor { @@ -85,6 +87,7 @@ impl VisitMut for WorkletVisitor { let mut collector = ExtractingIdentsCollector::new(ExtractingIdentsCollectorConfig { custom_global_ident_names: self.cfg.custom_global_ident_names.clone(), + shared_identifiers: Some(self.shared_identifiers.clone()), }); n.visit_mut_with(&mut collector); @@ -144,6 +147,7 @@ impl VisitMut for WorkletVisitor { let mut collector = ExtractingIdentsCollector::new(ExtractingIdentsCollectorConfig { custom_global_ident_names: self.cfg.custom_global_ident_names.clone(), + shared_identifiers: Some(self.shared_identifiers.clone()), }); n.visit_mut_with(&mut collector); @@ -190,6 +194,7 @@ impl VisitMut for WorkletVisitor { let mut collector = ExtractingIdentsCollector::new(ExtractingIdentsCollectorConfig { custom_global_ident_names: self.cfg.custom_global_ident_names.clone(), + shared_identifiers: Some(self.shared_identifiers.clone()), }); n.visit_mut_with(&mut collector); @@ -244,6 +249,7 @@ impl VisitMut for WorkletVisitor { let mut collector = ExtractingIdentsCollector::new(ExtractingIdentsCollectorConfig { custom_global_ident_names: self.cfg.custom_global_ident_names.clone(), + shared_identifiers: Some(self.shared_identifiers.clone()), }); n.visit_mut_with(&mut collector); @@ -310,6 +316,7 @@ impl VisitMut for WorkletVisitor { let mut collector = ExtractingIdentsCollector::new(ExtractingIdentsCollectorConfig { custom_global_ident_names: self.cfg.custom_global_ident_names.clone(), + shared_identifiers: Some(self.shared_identifiers.clone()), }); n.as_mut_export_default_decl() .unwrap() @@ -358,6 +365,27 @@ impl VisitMut for WorkletVisitor { } fn visit_mut_module(&mut self, n: &mut Module) { + // First process imports to detect shared-runtime modules + for item in &n.body { + if let ModuleItem::ModuleDecl(ModuleDecl::Import(import_decl)) = item { + if is_shared_runtime_import(import_decl) { + for specifier in &import_decl.specifiers { + match specifier { + ImportSpecifier::Named(named) => { + self.shared_identifiers.insert(named.local.to_id()); + } + ImportSpecifier::Default(default) => { + self.shared_identifiers.insert(default.local.to_id()); + } + ImportSpecifier::Namespace(ns) => { + self.shared_identifiers.insert(ns.local.to_id()); + } + } + } + } + } + } + n.visit_mut_children_with(self); let mut specifiers = self.named_imports.iter().collect::>(); @@ -436,6 +464,32 @@ impl VisitMut for WorkletVisitor { } } +fn is_shared_runtime_import(import_decl: &ImportDecl) -> bool { + if let Some(with_clause) = &import_decl.with { + // Check if the with clause contains runtime: "shared" + for prop in &with_clause.props { + if let PropOrSpread::Prop(prop) = prop { + if let Prop::KeyValue(kv) = &**prop { + match &kv.key { + PropName::Ident(key) if key.sym == "runtime" => { + if let Expr::Lit(Lit::Str(value)) = &*kv.value { + return value.value == "shared"; + } + } + PropName::Str(s) if s.value == "runtime" => { + if let Expr::Lit(Lit::Str(value)) = &*kv.value { + return value.value == "shared"; + } + } + _ => {} + } + } + } + } + } + false +} + impl WorkletVisitor { pub fn with_content_hash(mut self, content_hash: String) -> Self { self.content_hash = content_hash; @@ -450,6 +504,7 @@ impl WorkletVisitor { stmts_to_insert_at_top_level: vec![], hasher: WorkletHash::new(), named_imports: HashSet::default(), + shared_identifiers: FxHashSet::default(), } } @@ -678,6 +733,210 @@ function X(event) { "# ); + test!( + module, + Syntax::Typescript(TsSyntax { + ..Default::default() + }), + |_| ( + resolver(Mark::new(), Mark::new(), true), + visit_mut_pass(WorkletVisitor::new( + TransformMode::Test, + WorkletVisitorConfig { + filename: "index.js".into(), + target: TransformTarget::JS, + custom_global_ident_names: None, + runtime_pkg: "@lynx-js/react".into(), + } + )), + hygiene() + ), + should_skip_shared_identifiers_js, + r#" +import { sharedRuntime } from './utils.js' with { + runtime: "shared" +}; + +function worklet(event: Event) { + "main thread"; + console.log(sharedRuntime); + console.log(this.y1); + let a: object = y1; +} + "# + ); + + // default import should also be treated as shared-runtime and skipped from capture + test!( + module, + Syntax::Typescript(TsSyntax { + ..Default::default() + }), + |_| ( + resolver(Mark::new(), Mark::new(), true), + visit_mut_pass(WorkletVisitor::new( + TransformMode::Test, + WorkletVisitorConfig { + filename: "index.js".into(), + target: TransformTarget::JS, + custom_global_ident_names: None, + runtime_pkg: "@lynx-js/react".into(), + } + )), + hygiene() + ), + should_skip_shared_identifiers_default_import_js, + r#" +import sharedRuntime from './utils.js' with { + runtime: "shared" +}; + +function worklet(event: Event) { + "main thread"; + console.log(sharedRuntime); + console.log(this.y1); + let a: object = y1; +} + "# + ); + + // namespace import should be skipped from capture + test!( + module, + Syntax::Typescript(TsSyntax { + ..Default::default() + }), + |_| ( + resolver(Mark::new(), Mark::new(), true), + visit_mut_pass(WorkletVisitor::new( + TransformMode::Test, + WorkletVisitorConfig { + filename: "index.js".into(), + target: TransformTarget::JS, + custom_global_ident_names: None, + runtime_pkg: "@lynx-js/react".into(), + } + )), + hygiene() + ), + should_skip_shared_identifiers_namespace_import_js, + r#" +import * as SR from './utils.js' with { + runtime: "shared" +}; + +function worklet(event: Event) { + "main thread"; + console.log(SR); + console.log(this.y1); + let a: object = y1; +} + "# + ); + + // with clause key can be string literal + test!( + module, + Syntax::Typescript(TsSyntax { + ..Default::default() + }), + |_| ( + resolver(Mark::new(), Mark::new(), true), + visit_mut_pass(WorkletVisitor::new( + TransformMode::Test, + WorkletVisitorConfig { + filename: "index.js".into(), + target: TransformTarget::JS, + custom_global_ident_names: None, + runtime_pkg: "@lynx-js/react".into(), + } + )), + hygiene() + ), + should_skip_shared_identifiers_string_key_js, + r#" +import { sharedRuntime as sr } from './utils.js' with { + "runtime": "shared" +}; + +function worklet(event: Event) { + "main thread"; + console.log(sr); + console.log(this.y1); + let a: object = y1; +} + "# + ); + + test!( + module, + Syntax::Typescript(TsSyntax { + ..Default::default() + }), + |_| ( + resolver(Mark::new(), Mark::new(), true), + visit_mut_pass(WorkletVisitor::new( + TransformMode::Test, + WorkletVisitorConfig { + filename: "index.js".into(), + target: TransformTarget::JS, + custom_global_ident_names: None, + runtime_pkg: "@lynx-js/react".into(), + } + )), + hygiene() + ), + should_handle_renamed_import_shadowing_js, + r#" +import { sharedRuntime as sr } from './utils.js' with { + runtime: "shared" +}; + +(function() { + let sr = y1; + function worklet(event: Event) { + "main thread"; + console.log(sr); + console.log(this.y1); + let a: object = y1; + } +})(); + "# + ); + + test!( + module, + Syntax::Typescript(TsSyntax { + ..Default::default() + }), + |_| ( + resolver(Mark::new(), Mark::new(), true), + visit_mut_pass(WorkletVisitor::new( + TransformMode::Test, + WorkletVisitorConfig { + filename: "index.js".into(), + target: TransformTarget::LEPUS, + custom_global_ident_names: None, + runtime_pkg: "@lynx-js/react".into(), + } + )), + hygiene() + ), + should_skip_shared_identifiers_lepus, + r#" +import { sharedRuntime } from './utils.js' with { + runtime: "shared" +}; + +function worklet(event: Event) { + "main thread"; + console.log(sharedRuntime); + console.log(this.y1); + let a: object = y1; +} + "# + ); + test!( module, Syntax::Es(EsSyntax { diff --git a/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_handle_renamed_import_shadowing_js.js b/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_handle_renamed_import_shadowing_js.js new file mode 100644 index 0000000000..d6cf64128d --- /dev/null +++ b/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_handle_renamed_import_shadowing_js.js @@ -0,0 +1,16 @@ +import { sharedRuntime as sr } from './utils.js' with { + runtime: "shared" +}; +(function() { + let sr = y1; + let worklet = { + _c: { + sr, + y1 + }, + _wkltId: "a77b:test:1", + ...{ + y1: this.y1 + } + }; +})(); diff --git a/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_default_import_js.js b/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_default_import_js.js new file mode 100644 index 0000000000..60b48493eb --- /dev/null +++ b/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_default_import_js.js @@ -0,0 +1,12 @@ +import sharedRuntime from './utils.js' with { + runtime: "shared" +}; +let worklet = { + _c: { + y1 + }, + _wkltId: "a77b:test:1", + ...{ + y1: this.y1 + } +}; diff --git a/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_js.js b/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_js.js new file mode 100644 index 0000000000..3714c92eea --- /dev/null +++ b/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_js.js @@ -0,0 +1,12 @@ +import { sharedRuntime } from './utils.js' with { + runtime: "shared" +}; +let worklet = { + _c: { + y1 + }, + _wkltId: "a77b:test:1", + ...{ + y1: this.y1 + } +}; diff --git a/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_lepus.js b/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_lepus.js new file mode 100644 index 0000000000..11a5045bbd --- /dev/null +++ b/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_lepus.js @@ -0,0 +1,19 @@ +import { loadWorkletRuntime as __loadWorkletRuntime } from "@lynx-js/react"; +var loadWorkletRuntime = __loadWorkletRuntime; +import { sharedRuntime } from './utils.js' with { + runtime: "shared" +}; +let worklet = { + _c: { + y1 + }, + _wkltId: "a77b:test:1" +}; +loadWorkletRuntime(typeof globDynamicComponentEntry === 'undefined' ? undefined : globDynamicComponentEntry) && registerWorkletInternal("main-thread", "a77b:test:1", function(event: Event) { + const worklet = lynxWorkletImpl._workletMap["a77b:test:1"].bind(this); + let { y1 } = this["_c"]; + "main thread"; + console.log(sharedRuntime); + console.log(this.y1); + let a: object = y1; +}); diff --git a/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_namespace_import_js.js b/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_namespace_import_js.js new file mode 100644 index 0000000000..591d7c37c3 --- /dev/null +++ b/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_namespace_import_js.js @@ -0,0 +1,12 @@ +import * as SR from './utils.js' with { + runtime: "shared" +}; +let worklet = { + _c: { + y1 + }, + _wkltId: "a77b:test:1", + ...{ + y1: this.y1 + } +}; diff --git a/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_string_key_js.js b/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_string_key_js.js new file mode 100644 index 0000000000..7ee4e4c0c2 --- /dev/null +++ b/packages/react/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_string_key_js.js @@ -0,0 +1,12 @@ +import { sharedRuntime as sr } from './utils.js' with { + "runtime": "shared" +}; +let worklet = { + _c: { + y1 + }, + _wkltId: "a77b:test:1", + ...{ + y1: this.y1 + } +}; From 76d6bc85d45880d11c1845f107cb3192bcb2a774 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Tue, 2 Dec 2025 21:54:37 +0800 Subject: [PATCH 12/37] feat: use shared module --- .../motion/__tests__/animation.test.d.ts | 1 + .../motion/__tests__/animation.test.js | 71 ++++++++++++++ .../motion/__tests__/animation.test.js.map | 1 + .../motion/dist/animation/index.d.ts | 4 +- .../motion/dist/animation/index.js | 83 +++++++--------- .../motion/dist/animation/index.js.map | 2 +- .../third-party/motion/src/animation/index.ts | 96 +++++++------------ packages/third-party/tsconfig.json | 2 +- 8 files changed, 146 insertions(+), 114 deletions(-) create mode 100644 packages/third-party/motion/__tests__/animation.test.d.ts create mode 100644 packages/third-party/motion/__tests__/animation.test.js create mode 100644 packages/third-party/motion/__tests__/animation.test.js.map diff --git a/packages/third-party/motion/__tests__/animation.test.d.ts b/packages/third-party/motion/__tests__/animation.test.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/packages/third-party/motion/__tests__/animation.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/third-party/motion/__tests__/animation.test.js b/packages/third-party/motion/__tests__/animation.test.js new file mode 100644 index 0000000000..beda16c823 --- /dev/null +++ b/packages/third-party/motion/__tests__/animation.test.js @@ -0,0 +1,71 @@ +import { jsx as _jsx } from "@lynx-js/react/jsx-runtime"; +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; +import { act, render } from '@lynx-js/react/testing-library'; +import { MainThread } from '@lynx-js/types'; +import { animate } from '../src/index.js'; +import { noop } from '../src/utils/noop.js'; +describe('motion wrapping animation functions', () => { + let _mockRegisterCallable; + beforeEach(() => { + const mockRegisteredMap = new Map(); + vi.spyOn(globalThis, 'runOnRegistered', 'get').mockImplementation(function (id) { + const func = mockRegisteredMap.get(id) ?? noop; + return func; + }); + function mockRegisterCallable(func, id) { + mockRegisteredMap.set(id, func); + return func; + } + _mockRegisterCallable = mockRegisterCallable; + }); + afterEach(() => { + vi.restoreAllMocks(); + }); + test('motion animate should be called', async () => { + let _startAnimation; + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call + const _mockAnimate = _mockRegisterCallable(vi.fn(), 'animate'); + const App = () => { + const boxMTRef = useMainThreadRef(null); + console.log('renderApp'); + function startAnimation() { + 'main thread'; + if (boxMTRef.current) { + animate(boxMTRef.current, { scale: 0.4, rotate: '45deg' }, { + ease: 'circInOut', + duration: 1, + repeat: Number.POSITIVE_INFINITY, + repeatType: 'reverse', + }); + } + } + _startAnimation = startAnimation; + return (_jsx("view", { children: _jsx("view", { "main-thread:ref": boxMTRef }) })); + }; + await act(() => { + render(_jsx(App, {}), { + enableMainThread: true, + enableBackgroundThread: true, + }); + }); + await runOnMainThread(() => { + 'main thread'; + _startAnimation(); + })(); + // Check that the mock was called + expect(_mockAnimate).toHaveBeenCalled(); + // You can also check what arguments it received + expect(_mockAnimate).toHaveBeenCalledWith(expect.anything(), // the element + { scale: 0.4, rotate: '45deg' }, { + ease: 'circInOut', + duration: 1, + repeat: Number.POSITIVE_INFINITY, + repeatType: 'reverse', + }); + }); +}); +//# sourceMappingURL=animation.test.js.map \ No newline at end of file diff --git a/packages/third-party/motion/__tests__/animation.test.js.map b/packages/third-party/motion/__tests__/animation.test.js.map new file mode 100644 index 0000000000..e8086a62ec --- /dev/null +++ b/packages/third-party/motion/__tests__/animation.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"animation.test.js","sourceRoot":"","sources":["animation.test.tsx"],"names":[],"mappings":";AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,IAAI,qBAAqB,CAAC;IAC1B,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAA4B,CAAC;QAC9D,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAC,kBAAkB,CAAC,UAChE,EAAU;YAEV,MAAM,IAAI,GAAG,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;YAC/C,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,SAAS,oBAAoB,CAC3B,IAAsB,EACtB,EAAU;YAEV,iBAAiB,CAAC,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,eAAe,EAAE,CAAC;QACpB,CAAC,CAAC,EAAE,CAAC;QAEL,iCAAiC;QACjC,MAAM,CAAC,YAAY,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAExC,gDAAgD;QAChD,MAAM,CAAC,YAAY,CAAC,CAAC,oBAAoB,CACvC,MAAM,CAAC,QAAQ,EAAE,EAAE,cAAc;QACjC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,EAC/B;YACE,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE,CAAC;YACX,MAAM,EAAE,MAAM,CAAC,iBAAiB;YAChC,UAAU,EAAE,SAAS;SACtB,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/animation/index.d.ts b/packages/third-party/motion/dist/animation/index.d.ts index dcbe56d9e6..befe221615 100644 --- a/packages/third-party/motion/dist/animation/index.d.ts +++ b/packages/third-party/motion/dist/animation/index.d.ts @@ -1,5 +1,5 @@ import '../polyfill/shim.js'; -import { stagger as staggerOriginal } from 'framer-motion/dom'; +import { stagger as staggerOrig } from 'framer-motion/dom'; import type { AnimationSequence, ObjectTarget, SequenceOptions } from 'framer-motion/dom'; import { spring as springOrig } from 'motion-dom'; import type { AnimationOptions, AnimationPlaybackControlsWithThen, AnyResolvedKeyframe, DOMKeyframesDefinition, MapInputRange, Mixer, MotionValue, MotionValueOptions, SpringOptions, TransformOptions, UnresolvedValueKeyframe, ValueAnimationTransition } from 'motion-dom'; @@ -33,7 +33,7 @@ declare function animate(object: O | O[], keyframes: ObjectTarget< * Animate a main thread element */ declare function animate(value: ElementOrElements, keyframes: DOMKeyframesDefinition, options?: AnimationOptions): AnimationPlaybackControlsWithThen; -declare function stagger(...args: Parameters): ReturnType; +declare function stagger(...args: Parameters): ReturnType; declare function motionValue(init: V, options?: MotionValueOptions): MotionValue; declare function spring(...args: Parameters): ReturnType; declare function springValue(source: T | MotionValue, options?: SpringOptions): MotionValue; diff --git a/packages/third-party/motion/dist/animation/index.js b/packages/third-party/motion/dist/animation/index.js index 74ecb746a5..368d6a4ff3 100644 --- a/packages/third-party/motion/dist/animation/index.js +++ b/packages/third-party/motion/dist/animation/index.js @@ -2,50 +2,31 @@ // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. import '../polyfill/shim.js'; -import { animate as animateOriginal, clamp as clampOrig, progress as progressOrig, stagger as staggerOriginal, } from 'framer-motion/dom'; -import { mapValue as mapValueOrig, mix as mixOrig, spring as springOrig, springValue as springValueOrig, styleEffect as styleEffectOrig, transformValue as transformValueOrig, } from 'motion-dom'; +// import { +// animate as animateOrig, +// clamp as clampOrig, +// progress as progressOrig, +// stagger as staggerOrig, +// } from 'framer-motion/dom'; +// import type { +// AnimationSequence, +// ObjectTarget, +// SequenceOptions, +// } from 'framer-motion/dom'; +// import { +// mapValue as mapValueOrig, +// mix as mixOrig, +// spring as springOrig, +// springValue as springValueOrig, +// styleEffect as styleEffectOrig, +// transformValue as transformValueOrig, +// } from 'motion-dom'; +import { animate as animateOrig, clamp as clampOrig, progress as progressOrig, stagger as staggerOrig, } from 'framer-motion/dom' with { runtime: 'shared' }; +import { mapValue as mapValueOrig, mix as mixOrig, spring as springOrig, springValue as springValueOrig, styleEffect as styleEffectOrig, transformValue as transformValueOrig, } from 'motion-dom' with { runtime: 'shared' }; import { useMotionValueRefEvent } from '../hooks/useMotionEvent.js'; import { motionValue as motionValueOrig } from '../polyfill/MotionValue.js'; import { elementOrSelector2Dom } from '../utils/elementHelper.js'; import { isMainThreadElement, isMainThreadElementArray, } from '../utils/isMainThreadElement.js'; -import { registerCallable } from '../utils/registeredFunction.js'; -let animateHandle; -let staggerHandle; -let motionValueHandle; -let springHandle; -let springValueHandle; -let mixHandle; -let progressHandle; -let clampHandle; -let mapValueHandle; -let transformValueHandle; -let styleEffectHandle; -if (__MAIN_THREAD__) { - animateHandle = registerCallable(animateOriginal, 'animate'); - staggerHandle = registerCallable(staggerOriginal, 'stagger'); - motionValueHandle = registerCallable(motionValueOrig, 'motionValue'); - springHandle = registerCallable(springOrig, 'spring'); - springValueHandle = registerCallable(springValueOrig, 'springValue'); - mixHandle = registerCallable(mixOrig, 'mix'); - progressHandle = registerCallable(progressOrig, 'progress'); - clampHandle = registerCallable(clampOrig, 'clamp'); - mapValueHandle = registerCallable(mapValueOrig, 'mapValue'); - transformValueHandle = registerCallable(transformValueOrig, 'transformValue'); - styleEffectHandle = registerCallable(styleEffectOrig, 'styleEffect'); -} -else { - animateHandle = 'animate'; - staggerHandle = 'stagger'; - motionValueHandle = 'motionValue'; - springHandle = 'spring'; - springValueHandle = 'springValue'; - mixHandle = 'mix'; - progressHandle = 'progress'; - clampHandle = 'clamp'; - mapValueHandle = 'mapValue'; - transformValueHandle = 'transformValue'; - styleEffectHandle = 'styleEffect'; -} function animate(subjectOrSequence, optionsOrKeyframes, options) { 'main thread'; let realSubjectOrSequence; @@ -67,7 +48,7 @@ function animate(subjectOrSequence, optionsOrKeyframes, options) { realSubjectOrSequence = subjectOrSequence; } // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(animateHandle)( + return animateOrig( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument realSubjectOrSequence, // eslint-disable-next-line @typescript-eslint/no-unsafe-argument @@ -78,27 +59,27 @@ function animate(subjectOrSequence, optionsOrKeyframes, options) { function stagger(...args) { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(staggerHandle)(...args); + return staggerOrig(...args); } function motionValue(init, options) { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(motionValueHandle)(init, options); + return motionValueOrig(init, options); } function spring(...args) { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(springHandle)(...args); + return springOrig(...args); } function springValue(source, options) { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(springValueHandle)(source, options); + return springValueOrig(source, options); } function mix(from, to, p) { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(mixHandle)( + return mixOrig( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument from, // eslint-disable-next-line @typescript-eslint/no-unsafe-argument @@ -108,19 +89,19 @@ function mix(from, to, p) { } function progress(from, to, value) { 'main thread'; - return globalThis.runOnRegistered(progressHandle)(from, to, value); + return progressOrig(from, to, value); } function clamp(min, max, v) { 'main thread'; - return globalThis.runOnRegistered(clampHandle)(min, max, v); + return clampOrig(min, max, v); } function mapValue(inputValue, inputRange, outputRange, options) { 'main thread'; - return globalThis.runOnRegistered(mapValueHandle)(inputValue, inputRange, outputRange, options); + return mapValueOrig(inputValue, inputRange, outputRange, options); } function transformValue(transform) { 'main thread'; - return globalThis.runOnRegistered(transformValueHandle)(transform); + return transformValueOrig(transform); } function styleEffect(subject, values) { 'main thread'; @@ -128,7 +109,7 @@ function styleEffect(subject, values) { if (!elements) { return () => { }; } - return globalThis.runOnRegistered(styleEffectHandle)(elements, values); + return styleEffectOrig(elements, values); } export const noop = () => { }; export { animate, stagger, motionValue, spring, springValue, mix, progress, mapValue, clamp, transformValue, styleEffect, }; diff --git a/packages/third-party/motion/dist/animation/index.js.map b/packages/third-party/motion/dist/animation/index.js.map index 3d5ff1b351..10c4f508d5 100644 --- a/packages/third-party/motion/dist/animation/index.js.map +++ b/packages/third-party/motion/dist/animation/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,KAAK,IAAI,SAAS,EAClB,QAAQ,IAAI,YAAY,EACxB,OAAO,IAAI,eAAe,GAC3B,MAAM,mBAAmB,C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EACd,WAAW,GACZ,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,qBAAqB,CAAC;AAE7B,WAAW;AACX,4BAA4B;AAC5B,wBAAwB;AACxB,8BAA8B;AAC9B,4BAA4B;AAC5B,8BAA8B;AAC9B,gBAAgB;AAChB,uBAAuB;AACvB,kBAAkB;AAClB,qBAAqB;AACrB,8BAA8B;AAC9B,WAAW;AACX,8BAA8B;AAC9B,oBAAoB;AACpB,0BAA0B;AAC1B,oCAAoC;AACpC,oCAAoC;AACpC,0CAA0C;AAC1C,uBAAuB;AACvB,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,KAAK,IAAI,SAAS,EAClB,QAAQ,IAAI,YAAY,EACxB,OAAO,IAAI,WAAW,GACvB,MAAM,mBAAmB,CAAC,OAAO,OAAO,EAAE,QAAQ,EAAE,CAAC;AAMtD,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,GAAG,IAAI,OAAO,EACd,MAAM,IAAI,UAAU,EACpB,WAAW,IAAI,eAAe,EAC9B,WAAW,IAAI,eAAe,EAC9B,cAAc,IAAI,kBAAkB,GACrC,MAAM,YAAY,CAAC,OAAO,OAAO,EAAE,QAAQ,EAAE,CAAC;AAiB/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AA8DzC,SAAS,OAAO,CACd,iBAQqB,EACrB,kBAOmB,EACnB,OAGoB;IAEpB,aAAa,CAAC;IAEd,IAAI,qBAQG,CAAC;IAER,IACE,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P,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,GACZ,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/src/animation/index.ts b/packages/third-party/motion/src/animation/index.ts index 6413080ff7..2c9834507f 100644 --- a/packages/third-party/motion/src/animation/index.ts +++ b/packages/third-party/motion/src/animation/index.ts @@ -3,12 +3,31 @@ // LICENSE file in the root directory of this source tree. import '../polyfill/shim.js'; +// import { +// animate as animateOrig, +// clamp as clampOrig, +// progress as progressOrig, +// stagger as staggerOrig, +// } from 'framer-motion/dom'; +// import type { +// AnimationSequence, +// ObjectTarget, +// SequenceOptions, +// } from 'framer-motion/dom'; +// import { +// mapValue as mapValueOrig, +// mix as mixOrig, +// spring as springOrig, +// springValue as springValueOrig, +// styleEffect as styleEffectOrig, +// transformValue as transformValueOrig, +// } from 'motion-dom'; import { - animate as animateOriginal, + animate as animateOrig, clamp as clampOrig, progress as progressOrig, - stagger as staggerOriginal, -} from 'framer-motion/dom'; + stagger as staggerOrig, +} from 'framer-motion/dom' with { runtime: 'shared' }; import type { AnimationSequence, ObjectTarget, @@ -21,7 +40,7 @@ import { springValue as springValueOrig, styleEffect as styleEffectOrig, transformValue as transformValueOrig, -} from 'motion-dom'; +} from 'motion-dom' with { runtime: 'shared' }; import type { AnimationOptions, AnimationPlaybackControlsWithThen, @@ -46,45 +65,6 @@ import { isMainThreadElement, isMainThreadElementArray, } from '../utils/isMainThreadElement.js'; -import { registerCallable } from '../utils/registeredFunction.js'; - -let animateHandle: string; -let staggerHandle: string; -let motionValueHandle: string; -let springHandle: string; -let springValueHandle: string; -let mixHandle: string; -let progressHandle: string; -let clampHandle: string; -let mapValueHandle: string; -let transformValueHandle: string; -let styleEffectHandle: string; - -if (__MAIN_THREAD__) { - animateHandle = registerCallable(animateOriginal, 'animate'); - staggerHandle = registerCallable(staggerOriginal, 'stagger'); - motionValueHandle = registerCallable(motionValueOrig, 'motionValue'); - springHandle = registerCallable(springOrig, 'spring'); - springValueHandle = registerCallable(springValueOrig, 'springValue'); - mixHandle = registerCallable(mixOrig, 'mix'); - progressHandle = registerCallable(progressOrig, 'progress'); - clampHandle = registerCallable(clampOrig, 'clamp'); - mapValueHandle = registerCallable(mapValueOrig, 'mapValue'); - transformValueHandle = registerCallable(transformValueOrig, 'transformValue'); - styleEffectHandle = registerCallable(styleEffectOrig, 'styleEffect'); -} else { - animateHandle = 'animate'; - staggerHandle = 'stagger'; - motionValueHandle = 'motionValue'; - springHandle = 'spring'; - springValueHandle = 'springValue'; - mixHandle = 'mix'; - progressHandle = 'progress'; - clampHandle = 'clamp'; - mapValueHandle = 'mapValue'; - transformValueHandle = 'transformValue'; - styleEffectHandle = 'styleEffect'; -} /** * Animate a sequence @@ -202,7 +182,7 @@ function animate( } // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(animateHandle)( + return animateOrig( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument realSubjectOrSequence as any, // eslint-disable-next-line @typescript-eslint/no-unsafe-argument @@ -213,11 +193,11 @@ function animate( } function stagger( - ...args: Parameters -): ReturnType { + ...args: Parameters +): ReturnType { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(staggerHandle)( + return staggerOrig( ...args, ); } @@ -228,7 +208,7 @@ function motionValue( ): MotionValue { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(motionValueHandle)( + return motionValueOrig( init, options, ); @@ -239,7 +219,7 @@ function spring( ): ReturnType { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(springHandle)(...args); + return springOrig(...args); } function springValue( @@ -248,7 +228,7 @@ function springValue( ): MotionValue { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(springValueHandle)( + return springValueOrig( source, options, ); @@ -259,8 +239,8 @@ function mix(from: number, to: number, p: number): number; function mix(from: T, to: T, p?: T): Mixer | number { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - - return globalThis.runOnRegistered(mixHandle)( + + return mixOrig( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument from as any, // eslint-disable-next-line @typescript-eslint/no-unsafe-argument @@ -272,7 +252,7 @@ function mix(from: T, to: T, p?: T): Mixer | number { function progress(from: number, to: number, value: number): number { 'main thread'; - return globalThis.runOnRegistered(progressHandle)( + return progressOrig( from, to, value, @@ -281,7 +261,7 @@ function progress(from: number, to: number, value: number): number { function clamp(min: number, max: number, v: number): number { 'main thread'; - return globalThis.runOnRegistered(clampHandle)(min, max, v); + return clampOrig(min, max, v); } function mapValue( @@ -291,7 +271,7 @@ function mapValue( options?: TransformOptions, ): MotionValue { 'main thread'; - return globalThis.runOnRegistered(mapValueHandle)( + return mapValueOrig( inputValue, inputRange, outputRange, @@ -301,9 +281,7 @@ function mapValue( function transformValue(transform: () => O): MotionValue { 'main thread'; - return globalThis.runOnRegistered( - transformValueHandle, - )(transform); + return transformValueOrig(transform); } function styleEffect( @@ -315,7 +293,7 @@ function styleEffect( if (!elements) { return () => {}; } - return globalThis.runOnRegistered(styleEffectHandle)( + return styleEffectOrig( elements, values, ); diff --git a/packages/third-party/tsconfig.json b/packages/third-party/tsconfig.json index 62183958de..dfa8887312 100644 --- a/packages/third-party/tsconfig.json +++ b/packages/third-party/tsconfig.json @@ -5,7 +5,7 @@ "references": [ /** packages-start */ { "path": "./tailwind-preset/tsconfig.build.json" }, - { "path": "./motion/tsconfig.json" }, + { "path": "./motion/tsconfig.build.json" }, /** packages-end */ ], "include": [], From ca75aaf64b388f78b148a3f28dc98e837adc36e4 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Tue, 16 Dec 2025 17:13:01 +0800 Subject: [PATCH 13/37] fix: motion not query right element --- examples/motion/src/Basic/index.tsx | 2 +- examples/motion/src/BasicPercent/index.tsx | 2 +- .../motion/dist/animation/index.js | 8 +- .../motion/dist/animation/index.js.map | 2 +- .../motion/dist/modified/motionValue.js | 2 +- .../motion/dist/modified/motionValue.js.map | 2 +- .../motion/dist/polyfill/element.d.ts | 1 + .../motion/dist/polyfill/element.js | 32 ++++++ .../motion/dist/polyfill/element.js.map | 2 +- .../motion/dist/polyfill/shim.d.ts | 6 +- .../third-party/motion/dist/polyfill/shim.js | 92 ++++++++++------- .../motion/dist/polyfill/shim.js.map | 2 +- .../motion/dist/utils/elementHelper.js | 5 +- .../motion/dist/utils/elementHelper.js.map | 2 +- .../motion/dist/utils/isMainThreadElement.js | 4 +- .../dist/utils/isMainThreadElement.js.map | 2 +- packages/third-party/motion/package.json | 7 +- .../third-party/motion/src/animation/index.ts | 8 +- .../motion/src/modified/motionValue.ts | 2 +- .../motion/src/polyfill/element.ts | 37 +++++++ .../third-party/motion/src/polyfill/shim.ts | 99 ++++++++++++------- .../motion/src/utils/elementHelper.ts | 5 +- .../motion/src/utils/isMainThreadElement.ts | 4 +- pnpm-lock.yaml | 3 + 24 files changed, 230 insertions(+), 101 deletions(-) diff --git a/examples/motion/src/Basic/index.tsx b/examples/motion/src/Basic/index.tsx index 68ad7a1372..c095a452f0 100644 --- a/examples/motion/src/Basic/index.tsx +++ b/examples/motion/src/Basic/index.tsx @@ -36,7 +36,7 @@ export default function Basic() { useEffect(() => { setTimeout(() => { void runOnMainThread(startAnimation)(); - }, 1000); + }, 1500); return () => { void runOnMainThread(endAnimation)(); }; diff --git a/examples/motion/src/BasicPercent/index.tsx b/examples/motion/src/BasicPercent/index.tsx index 59d5ba1af3..6d0bdba9aa 100644 --- a/examples/motion/src/BasicPercent/index.tsx +++ b/examples/motion/src/BasicPercent/index.tsx @@ -16,7 +16,7 @@ export default function BasicPercent() { if (boxMTRef.current) { animateMTRef.current = animate( boxMTRef.current, - { width: ['10px', '50%'] }, + { width: ['10px', '50px'] }, { ease: 'circInOut', duration: 1, diff --git a/packages/third-party/motion/dist/animation/index.js b/packages/third-party/motion/dist/animation/index.js index 368d6a4ff3..d9e2c2f7f3 100644 --- a/packages/third-party/motion/dist/animation/index.js +++ b/packages/third-party/motion/dist/animation/index.js @@ -24,7 +24,8 @@ import '../polyfill/shim.js'; import { animate as animateOrig, clamp as clampOrig, progress as progressOrig, stagger as staggerOrig, } from 'framer-motion/dom' with { runtime: 'shared' }; import { mapValue as mapValueOrig, mix as mixOrig, spring as springOrig, springValue as springValueOrig, styleEffect as styleEffectOrig, transformValue as transformValueOrig, } from 'motion-dom' with { runtime: 'shared' }; import { useMotionValueRefEvent } from '../hooks/useMotionEvent.js'; -import { motionValue as motionValueOrig } from '../polyfill/MotionValue.js'; +import { ElementCompt } from '../polyfill/element.js' with { runtime: 'shared' }; +import { motionValue as motionValueOrig } from '../polyfill/MotionValue.js' with { runtime: 'shared' }; import { elementOrSelector2Dom } from '../utils/elementHelper.js'; import { isMainThreadElement, isMainThreadElementArray, } from '../utils/isMainThreadElement.js'; function animate(subjectOrSequence, optionsOrKeyframes, options) { @@ -40,9 +41,10 @@ function animate(subjectOrSequence, optionsOrKeyframes, options) { else { elementNodes = subjectOrSequence; } + console.log('elementNodes', elementNodes); realSubjectOrSequence = (Array.isArray(elementNodes) - ? elementNodes.map(el => new globalThis.ElementCompt(el)) - : new globalThis.ElementCompt(elementNodes)); + ? elementNodes.map(el => new ElementCompt(el)) + : new ElementCompt(elementNodes)); } else { realSubjectOrSequence = subjectOrSequence; diff --git a/packages/third-party/motion/dist/animation/index.js.map b/packages/third-party/motion/dist/animation/index.js.map index 10c4f508d5..38cf0610d5 100644 --- a/packages/third-party/motion/dist/animation/index.js.map +++ b/packages/third-party/motion/dist/animation/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;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,CAAC,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AAEnC,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,GACZ,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/modified/motionValue.js b/packages/third-party/motion/dist/modified/motionValue.js index b854be72e9..5324443cf2 100644 --- a/packages/third-party/motion/dist/modified/motionValue.js +++ b/packages/third-party/motion/dist/modified/motionValue.js @@ -1,7 +1,7 @@ // Copyright 2025 The Lynx Authors. All rights reserved. // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. -import { MotionValue } from 'motion-dom'; +import { MotionValue } from 'motion-dom' with { runtime: 'shared' }; class CustomMotionValue extends MotionValue { toJSON() { return {}; diff --git a/packages/third-party/motion/dist/modified/motionValue.js.map b/packages/third-party/motion/dist/modified/motionValue.js.map index 24db513ff1..490f201664 100644 --- a/packages/third-party/motion/dist/modified/motionValue.js.map +++ b/packages/third-party/motion/dist/modified/motionValue.js.map @@ -1 +1 @@ -{"version":3,"file":"motionValue.js","sourceRoot":"","sources":["../../src/modified/motionValue.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,MAAM,iBAA2B,SAAQ,WAAc;IACrD,MAAM;QACJ,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CACzB,IAAO,EACP,OAA4B;IAE5B,OAAO,IAAI,iBAAiB,CAAI,IAAI,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC"} \ No newline at end of file +{"version":3,"file":"motionValue.js","sourceRoot":"","sources":["../../src/modified/motionValue.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC,OAAO,OAAO,EAAE,QAAQ,EAAC,CAAC;AAGnE,MAAM,iBAA2B,SAAQ,WAAc;IACrD,MAAM;QACJ,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CACzB,IAAO,EACP,OAA4B;IAE5B,OAAO,IAAI,iBAAiB,CAAI,IAAI,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/element.d.ts b/packages/third-party/motion/dist/polyfill/element.d.ts index f34a1344e3..23b55756ac 100644 --- a/packages/third-party/motion/dist/polyfill/element.d.ts +++ b/packages/third-party/motion/dist/polyfill/element.d.ts @@ -36,5 +36,6 @@ export declare class ElementCompt { set right(value: string); get bottom(): string; set bottom(value: string); + getBoundingClientRect(): DOMRect; } export {}; diff --git a/packages/third-party/motion/dist/polyfill/element.js b/packages/third-party/motion/dist/polyfill/element.js index 0a19f77944..0db4e93442 100644 --- a/packages/third-party/motion/dist/polyfill/element.js +++ b/packages/third-party/motion/dist/polyfill/element.js @@ -28,6 +28,7 @@ export class ElementCompt { this.element.setStyleProperty('transform', 'scale(1, 1)'); return true; } + console.log('setStyle', prop, value); this.element.setStyleProperty(prop, String(value)); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment target[prop] = value; @@ -130,5 +131,36 @@ export class ElementCompt { set bottom(value) { this.element.setStyleProperty('bottom', value); } + getBoundingClientRect() { + // Parse dimensions from computed style + const width = parseFloat(this.getStyleProperty('width')) || 0; + const height = parseFloat(this.getStyleProperty('height')) || 0; + // Parse position - these may be 'auto' or pixel values + const left = parseFloat(this.getStyleProperty('left')) || 0; + const top = parseFloat(this.getStyleProperty('top')) || 0; + // Calculate bounds + const right = left + width; + const bottom = top + height; + console.log('getBoundingClient', { + left, + top, + right, + bottom, + width, + height, + x: left, + y: top, + }); + return { + left, + top, + right, + bottom, + width, + height, + x: left, + y: top, + }; + } } //# sourceMappingURL=element.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/element.js.map b/packages/third-party/motion/dist/polyfill/element.js.map index 189b0b6484..059ed6eeed 100644 --- a/packages/third-party/motion/dist/polyfill/element.js.map +++ b/packages/third-party/motion/dist/polyfill/element.js.map @@ -1 +1 @@ -{"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/polyfill/element.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,YAAY;IACf,OAAO,CAAqB;IAEpC,YAAY,OAA2B;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,gBAAgB;QACrB,MAAM,WAAW,GAA2B,EAAE,CAAC;QAE/C,OAAO,IAAI,KAAK,CAAC,WAAW,EAAE;YAC5B,GAAG,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;gBACrB,4BAA4B;gBAC5B,iEAAiE;gBACjE,OAAO,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAc,CAAC,CAAC;YACvE,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,IAAW,KAAK;QACd,MAAM,WAAW,GAAG,EAAiB,CAAC;QAEtC,WAAW,CAAC,WAAW,GAAG,CAAC,QAAgB,EAAE,KAAa,EAAE,EAAE;YAC5D,IAAI,QAAQ,KAAK,WAAW,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;gBACjD,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;YACnE,CAAC;YACD,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC,CAAC;QACF,OAAO,IAAI,KAAK,CAAC,WAAW,EAAE;YAC5B,GAAG,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;gBAC3B,IAAI,OAAO,IAAI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CAAC,CAAC;IAC1C,CAAC;IACD,IAAI,OAAO,CAAC,KAAa;QACvB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,QAAQ,CAAC,KAAa;QACxB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,GAAG,CAAC,KAAa;QACnB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,IAAI,CAAC,KAAa;QACpB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,KAAK,CAAC,KAAa;QACrB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,MAAM,CAAC,KAAa;QACtB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;CACF"} \ No newline at end of file +{"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/polyfill/element.ts"],"names":[],"mappings":"AA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CAAC,CAAC,IAAI,CAAC,CAAC;QAC5D,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;QAE1D,mBAAmB;QACnB,MAAM,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;QAC3B,MAAM,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;QAE5B,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE;YAC/B,IAAI;YACJ,GAAG;YACH,KAAK;YACL,MAAM;YACN,KAAK;YACL,MAAM;YACN,CAAC,EAAE,IAAI;YACP,CAAC,EAAE,GAAG;SACP,CAAC,CAAA;QAEF,OAAO;YACL,IAAI;YACJ,GAAG;YACH,KAAK;YACL,MAAM;YACN,KAAK;YACL,MAAM;YACN,CAAC,EAAE,IAAI;YACP,CAAC,EAAE,GAAG;SACP,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/shim.d.ts b/packages/third-party/motion/dist/polyfill/shim.d.ts index 757196eeb0..cb0ff5c3b5 100644 --- a/packages/third-party/motion/dist/polyfill/shim.d.ts +++ b/packages/third-party/motion/dist/polyfill/shim.d.ts @@ -1,5 +1 @@ -import type { MainThread } from '@lynx-js/types'; -import { ElementCompt } from './element.js'; -declare global { - var ElementCompt: new (element: MainThread.Element) => ElementCompt; -} +export {}; diff --git a/packages/third-party/motion/dist/polyfill/shim.js b/packages/third-party/motion/dist/polyfill/shim.js index bddef9a8da..c1b775767d 100644 --- a/packages/third-party/motion/dist/polyfill/shim.js +++ b/packages/third-party/motion/dist/polyfill/shim.js @@ -5,55 +5,81 @@ import { document, setupDocument } from '@lynx-js/react/internal/document'; import { ElementCompt } from './element.js'; const timeOrigin = Date.now(); function shimGlobals() { + // Only shim document if it doesn't exist + if (!globalThis.document) { + // @ts-expect-error error + globalThis.document = document; + } + // Only shim performance if it doesn't exist if (!globalThis.performance) { - const performance = { + // @ts-expect-error error + globalThis.performance = { now: () => Date.now() - timeOrigin, }; - function queueMicrotask(fn) { + } + // Only shim queueMicrotask if it doesn't exist + if (!globalThis.queueMicrotask) { + globalThis.queueMicrotask = (fn) => { void Promise.resolve().then(() => { // eslint-disable-next-line @typescript-eslint/no-unsafe-call fn(); }); - } - class NodeList { - } - class SVGElement { - } - const window = { - getComputedStyle: (ele) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access - return ele.getComputedStyle(); - }, }; - class HTMLElement { - } - // @ts-expect-error error - globalThis.document = document; - // @ts-expect-error error - globalThis.performance = performance; - globalThis.queueMicrotask = queueMicrotask; - // @ts-expect-error error - document.querySelector = lynx.querySelector; - // @ts-expect-error error - document.querySelectorAll = lynx.querySelectorAll; + } + // Only shim document query methods if they don't exist + // @ts-expect-error error + document.querySelector ??= lynx.querySelector; + // @ts-expect-error error + document.querySelectorAll ??= lynx.querySelectorAll; + // Only shim NodeList if it doesn't exist + if (!globalThis.NodeList) { // @ts-expect-error error - globalThis.NodeList = NodeList; + globalThis.NodeList = class NodeList { + }; + } + // Only shim SVGElement if it doesn't exist + if (!globalThis.SVGElement) { // @ts-expect-error error - globalThis.SVGElement = SVGElement; + globalThis.SVGElement = class SVGElement { + }; + } + // Only shim HTMLElement if it doesn't exist + if (!globalThis.HTMLElement) { // @ts-expect-error error - globalThis.window = window; - globalThis.getComputedStyle = window.getComputedStyle; + globalThis.HTMLElement = class HTMLElement { + }; + } + // Only shim window if it doesn't exist + if (!globalThis.window) { // @ts-expect-error error - globalThis.HTMLElement = HTMLElement; + globalThis.window = { + getComputedStyle: (ele) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access + return ele.getComputedStyle(); + }, + }; } + // @ts-expect-error error + globalThis.Element ??= ElementCompt; + // @ts-expect-error error + globalThis.EventTarget ??= ElementCompt; + // Only shim getComputedStyle if it doesn't exist + globalThis.getComputedStyle ??= globalThis.window?.getComputedStyle; } if (__MAIN_THREAD__) { setupDocument(); shimGlobals(); - globalThis.ElementCompt = ElementCompt; - // @ts-expect-error error - globalThis.Element = ElementCompt; - // @ts-expect-error error - globalThis.EventTarget = ElementCompt; +} +else if (__DEV__) { + // Only shim queueMicrotask if it doesn't exist + // eslint-disable-next-line unicorn/no-lonely-if + if (!globalThis.queueMicrotask) { + globalThis.queueMicrotask = (fn) => { + void Promise.resolve().then(() => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + fn(); + }); + }; + } } //# sourceMappingURL=shim.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/shim.js.map b/packages/third-party/motion/dist/polyfill/shim.js.map index 126c13905d..105a169db3 100644 --- a/packages/third-party/motion/dist/polyfill/shim.js.map +++ b/packages/third-party/motion/dist/polyfill/shim.js.map @@ -1 +1 @@ -{"version":3,"file":"shim.js","sourceRoot":"","sources":["../../src/polyfill/shim.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAG3E,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AAM9B,SAAS,WAAW;IAClB,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;QAC5B,MAAM,WAAW,GAAG;YAClB,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU;SACnC,CAAC;QACF,SAAS,cAAc,CAAC,EAAO;YAC7B,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC/B,6DAA6D;gBAC7D,EAAE,EAAE,CAAC;YACP,CAAC,CAAC,CAAC;QACL,CAAC;QACD,MAAM,QAAQ;SAAG;QACjB,MAAM,UAAU;SAAG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,CAAC,WAAW,EAAE,CAAC;QAC5B,yBAAyB;QACzB,UAAU,CAAC,WAAW,GAAG,MAAM,WAAW;SAAG,CAAC;IAChD,CAAC;IAED,uCAAuC;IACvC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;QACvB,yBAAyB;QACzB,UAAU,CAAC,MAAM,GAAG;YAClB,gBAAgB,EAAE,CAAC,GAAQ,EAAE,EAAE;gBAC7B,8IAA8I;gBAC9I,OAAO,GAAG,CAAC,gBAAgB,EAAE,CAAC;YAChC,CAAC;SACF,CAAC;IACJ,CAAC;IACD,yBAAyB;IACzB,UAAU,CAAC,OAAO,KAAK,YAAY,CAAC;IACpC,yBAAyB;IACzB,UAAU,CAAC,WAAW,KAAK,YAAY,CAAC;IAExC,iDAAiD;IACjD,UAAU,CAAC,gBAAgB,KAAK,UAAU,CAAC,MAAM,EAAE,gBAAgB,CAAC;AACtE,CAAC;AAED,IAAI,eAAe,EAAE,CAAC;IACpB,aAAa,EAAE,CAAC;IAEhB,WAAW,EAAE,CAAC;AAChB,CAAC;KAAM,IAAI,OAAO,EAAE,CAAC;IACnB,+CAA+C;IAC/C,gDAAgD;IAChD,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;QAC/B,UAAU,CAAC,cAAc,GAAG,CAAC,EAAO,EAAE,EAAE;YACtC,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC/B,6DAA6D;gBAC7D,EAAE,EAAE,CAAC;YACP,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/elementHelper.js b/packages/third-party/motion/dist/utils/elementHelper.js index 1296c9eb56..25815b4ed2 100644 --- a/packages/third-party/motion/dist/utils/elementHelper.js +++ b/packages/third-party/motion/dist/utils/elementHelper.js @@ -1,4 +1,5 @@ import { isMainThreadElement, isMainThreadElementArray, } from './isMainThreadElement.js'; +import { ElementCompt } from '../polyfill/element.js' with { runtime: 'shared' }; export function elementOrSelector2Dom(nodesOrSelector) { 'main thread'; let domElements = undefined; @@ -13,8 +14,8 @@ export function elementOrSelector2Dom(nodesOrSelector) { elementNodes = nodesOrSelector; } domElements = (Array.isArray(elementNodes) - ? elementNodes.map(el => new globalThis.ElementCompt(el)) - : new globalThis.ElementCompt(elementNodes)); + ? elementNodes.map(el => new ElementCompt(el)) + : new ElementCompt(elementNodes)); } return domElements; } diff --git a/packages/third-party/motion/dist/utils/elementHelper.js.map b/packages/third-party/motion/dist/utils/elementHelper.js.map index 28bf3c33a1..d0f3ffbc21 100644 --- a/packages/third-party/motion/dist/utils/elementHelper.js.map +++ b/packages/third-party/motion/dist/utils/elementHelper.js.map @@ -1 +1 @@ -{"version":3,"file":"elementHelper.js","sourceRoot":"","sources":["../../src/utils/elementHelper.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,UAAU,qBAAqB,CACnC,eAAmE;IAEnE,aAAa,CAAC;IACd,IAAI,WAAW,GAAkC,SAAS,CAAC;IAE3D,IACE,OAAO,eAAe,KAAK,QAAQ;WAChC,mBAAmB,CAAC,eAAe,CAAC;WACpC,wBAAwB,CAAC,eAAe,CAAC,EAC5C,CAAC;QACD,IAAI,YAA+B,CAAC;QACpC,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,CAAC;YACxC,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,eAAe,CAAC;QACjC,CAAC;QACD,WAAW,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;YACxC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YACzD,CAAC,CAAC,IAAI,UAAU,CAAC,YAAY,CAC3B,YAAY,CACb,CAAiC,CAAC;IACvC,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"} \ No newline at end of file +{"version":3,"file":"elementHelper.js","sourceRoot":"","sources":["../../src/utils/elementHelper.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC,OAAO,OAAO,EAAE,QAAQ,EAAC,CAAA;AAG/E,MAAM,UAAU,qBAAqB,CACnC,eAAmE;IAEnE,aAAa,CAAC;IACd,IAAI,WAAW,GAAkC,SAAS,CAAC;IAE3D,IACE,OAAO,eAAe,KAAK,QAAQ;WAChC,mBAAmB,CAAC,eAAe,CAAC;WACpC,wBAAwB,CAAC,eAAe,CAAC,EAC5C,CAAC;QACD,IAAI,YAA+B,CAAC;QACpC,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,CAAC;YACxC,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,eAAe,CAAC;QACjC,CAAC;QACD,WAAW,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;YACxC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC;YAC9C,CAAC,CAAC,IAAI,YAAY,CAChB,YAAY,CACb,CAAiC,CAAC;IACvC,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/isMainThreadElement.js b/packages/third-party/motion/dist/utils/isMainThreadElement.js index 816d4825ef..5b96996373 100644 --- a/packages/third-party/motion/dist/utils/isMainThreadElement.js +++ b/packages/third-party/motion/dist/utils/isMainThreadElement.js @@ -1,9 +1,7 @@ export function isMainThreadElement(ele) { 'main thread'; // @ts-expect-error error - // biome-ignore lint/complexity/useOptionalChain: - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - if (ele && ele.element && ele.element.elementRefptr) { + if (ele && 'element' in ele) { return true; } else { diff --git a/packages/third-party/motion/dist/utils/isMainThreadElement.js.map b/packages/third-party/motion/dist/utils/isMainThreadElement.js.map index c41167e17b..1f0fb00a64 100644 --- a/packages/third-party/motion/dist/utils/isMainThreadElement.js.map +++ b/packages/third-party/motion/dist/utils/isMainThreadElement.js.map @@ -1 +1 @@ -{"version":3,"file":"isMainThreadElement.js","sourceRoot":"","sources":["../../src/utils/isMainThreadElement.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,aAAa,CAAC;IACd,yBAAyB;IACzB,+DAA+D;IAC/D,sEAAsE;IACtE,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,MAAe;IAEf,aAAa,CAAC;IACd,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;AAChF,CAAC"} \ No newline at end of file +{"version":3,"file":"isMainThreadElement.js","sourceRoot":"","sources":["../../src/utils/isMainThreadElement.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,aAAa,CAAC;IACd,yBAAyB;IACzB,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,MAAe;IAEf,aAAa,CAAC;IACd,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;AAChF,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/package.json b/packages/third-party/motion/package.json index 00f7acef54..70294f8022 100644 --- a/packages/third-party/motion/package.json +++ b/packages/third-party/motion/package.json @@ -15,6 +15,10 @@ "directory": "packages/third-party/motion" }, "license": "MIT", + "sideEffects": [ + "./src/polyfill/shim.ts", + "./dist/polyfill/shim.js" + ], "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -29,7 +33,8 @@ }, "dependencies": { "framer-motion": "12.23.12", - "motion-dom": "12.23.12" + "motion-dom": "12.23.12", + "motion-utils": "12.23.6" }, "devDependencies": { "@lynx-js/react": "workspace:*", diff --git a/packages/third-party/motion/src/animation/index.ts b/packages/third-party/motion/src/animation/index.ts index 2c9834507f..a175132fd7 100644 --- a/packages/third-party/motion/src/animation/index.ts +++ b/packages/third-party/motion/src/animation/index.ts @@ -58,7 +58,8 @@ import type { } from 'motion-dom'; import { useMotionValueRefEvent } from '../hooks/useMotionEvent.js'; -import { motionValue as motionValueOrig } from '../polyfill/MotionValue.js'; +import { ElementCompt } from '../polyfill/element.js' with { runtime: 'shared' }; +import { motionValue as motionValueOrig } from '../polyfill/MotionValue.js' with { runtime: 'shared' }; import type { ElementOrElements } from '../types/index.js'; import { elementOrSelector2Dom } from '../utils/elementHelper.js'; import { @@ -172,9 +173,10 @@ function animate( } else { elementNodes = subjectOrSequence; } + console.log('elementNodes', elementNodes); realSubjectOrSequence = (Array.isArray(elementNodes) - ? elementNodes.map(el => new globalThis.ElementCompt(el)) - : new globalThis.ElementCompt( + ? elementNodes.map(el => new ElementCompt(el)) + : new ElementCompt( elementNodes, )) as unknown as ElementOrSelector; } else { diff --git a/packages/third-party/motion/src/modified/motionValue.ts b/packages/third-party/motion/src/modified/motionValue.ts index ac93415b8d..740ff58290 100644 --- a/packages/third-party/motion/src/modified/motionValue.ts +++ b/packages/third-party/motion/src/modified/motionValue.ts @@ -2,7 +2,7 @@ // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. -import { MotionValue } from 'motion-dom'; +import { MotionValue } from 'motion-dom' with { runtime: 'shared' }; import type { MotionValueOptions } from 'motion-dom'; class CustomMotionValue extends MotionValue { diff --git a/packages/third-party/motion/src/polyfill/element.ts b/packages/third-party/motion/src/polyfill/element.ts index 11b4d6edb4..c261e3e3c1 100644 --- a/packages/third-party/motion/src/polyfill/element.ts +++ b/packages/third-party/motion/src/polyfill/element.ts @@ -43,6 +43,7 @@ export class ElementCompt { this.element.setStyleProperty('transform', 'scale(1, 1)'); return true; } + console.log('setStyle', prop, value); this.element.setStyleProperty(prop, String(value)); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment target[prop] = value; @@ -160,4 +161,40 @@ export class ElementCompt { set bottom(value: string) { this.element.setStyleProperty('bottom', value); } + + public getBoundingClientRect() { + // Parse dimensions from computed style + const width = parseFloat(this.getStyleProperty('width')) || 0; + const height = parseFloat(this.getStyleProperty('height')) || 0; + + // Parse position - these may be 'auto' or pixel values + const left = parseFloat(this.getStyleProperty('left')) || 0; + const top = parseFloat(this.getStyleProperty('top')) || 0; + + // Calculate bounds + const right = left + width; + const bottom = top + height; + + console.log('getBoundingClient', { + left, + top, + right, + bottom, + width, + height, + x: left, + y: top, + }); + + return { + left, + top, + right, + bottom, + width, + height, + x: left, + y: top, + }; + } } diff --git a/packages/third-party/motion/src/polyfill/shim.ts b/packages/third-party/motion/src/polyfill/shim.ts index 6d4a050bfe..58b4778443 100644 --- a/packages/third-party/motion/src/polyfill/shim.ts +++ b/packages/third-party/motion/src/polyfill/shim.ts @@ -2,65 +2,92 @@ // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. import { document, setupDocument } from '@lynx-js/react/internal/document'; -import type { MainThread } from '@lynx-js/types'; import { ElementCompt } from './element.js'; const timeOrigin = Date.now(); -declare global { - var ElementCompt: new(element: MainThread.Element) => ElementCompt; -} - function shimGlobals() { + // Only shim document if it doesn't exist + if (!globalThis.document) { + // @ts-expect-error error + globalThis.document = document; + } + + // Only shim performance if it doesn't exist if (!globalThis.performance) { - const performance = { + // @ts-expect-error error + globalThis.performance = { now: () => Date.now() - timeOrigin, }; - function queueMicrotask(fn: any) { + } + + // Only shim queueMicrotask if it doesn't exist + if (!globalThis.queueMicrotask) { + globalThis.queueMicrotask = (fn: any) => { void Promise.resolve().then(() => { // eslint-disable-next-line @typescript-eslint/no-unsafe-call fn(); }); - } - class NodeList {} - class SVGElement {} - const window = { - getComputedStyle: (ele: any) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access - return ele.getComputedStyle(); - }, }; - class HTMLElement {} - // @ts-expect-error error - globalThis.document = document; - // @ts-expect-error error - globalThis.performance = performance; - globalThis.queueMicrotask = queueMicrotask; - // @ts-expect-error error - document.querySelector = lynx.querySelector; - // @ts-expect-error error - document.querySelectorAll = lynx.querySelectorAll; + } + + // Only shim document query methods if they don't exist + // @ts-expect-error error + document.querySelector ??= lynx.querySelector; + // @ts-expect-error error + document.querySelectorAll ??= lynx.querySelectorAll; + + // Only shim NodeList if it doesn't exist + if (!globalThis.NodeList) { // @ts-expect-error error - globalThis.NodeList = NodeList; + globalThis.NodeList = class NodeList {}; + } + + // Only shim SVGElement if it doesn't exist + if (!globalThis.SVGElement) { // @ts-expect-error error - globalThis.SVGElement = SVGElement; + globalThis.SVGElement = class SVGElement {}; + } + + // Only shim HTMLElement if it doesn't exist + if (!globalThis.HTMLElement) { // @ts-expect-error error - globalThis.window = window; - globalThis.getComputedStyle = window.getComputedStyle; + globalThis.HTMLElement = class HTMLElement {}; + } + + // Only shim window if it doesn't exist + if (!globalThis.window) { // @ts-expect-error error - globalThis.HTMLElement = HTMLElement; + globalThis.window = { + getComputedStyle: (ele: any) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access + return ele.getComputedStyle(); + }, + }; } + // @ts-expect-error error + globalThis.Element ??= ElementCompt; + // @ts-expect-error error + globalThis.EventTarget ??= ElementCompt; + + // Only shim getComputedStyle if it doesn't exist + globalThis.getComputedStyle ??= globalThis.window?.getComputedStyle; } if (__MAIN_THREAD__) { setupDocument(); shimGlobals(); - - globalThis.ElementCompt = ElementCompt; - // @ts-expect-error error - globalThis.Element = ElementCompt; - // @ts-expect-error error - globalThis.EventTarget = ElementCompt; +} else if (__DEV__) { + // Only shim queueMicrotask if it doesn't exist + // eslint-disable-next-line unicorn/no-lonely-if + if (!globalThis.queueMicrotask) { + globalThis.queueMicrotask = (fn: any) => { + void Promise.resolve().then(() => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + fn(); + }); + }; + } } diff --git a/packages/third-party/motion/src/utils/elementHelper.ts b/packages/third-party/motion/src/utils/elementHelper.ts index b5662cbb81..5af14c870a 100644 --- a/packages/third-party/motion/src/utils/elementHelper.ts +++ b/packages/third-party/motion/src/utils/elementHelper.ts @@ -9,6 +9,7 @@ import { isMainThreadElement, isMainThreadElementArray, } from './isMainThreadElement.js'; +import { ElementCompt } from '../polyfill/element.js' with { runtime: 'shared' }; import type { ElementOrElements } from '../types/index.js'; export function elementOrSelector2Dom( @@ -29,8 +30,8 @@ export function elementOrSelector2Dom( elementNodes = nodesOrSelector; } domElements = (Array.isArray(elementNodes) - ? elementNodes.map(el => new globalThis.ElementCompt(el)) - : new globalThis.ElementCompt( + ? elementNodes.map(el => new ElementCompt(el)) + : new ElementCompt( elementNodes, )) as unknown as ElementOrSelector; } diff --git a/packages/third-party/motion/src/utils/isMainThreadElement.ts b/packages/third-party/motion/src/utils/isMainThreadElement.ts index e3e24a214c..2fb948c16c 100644 --- a/packages/third-party/motion/src/utils/isMainThreadElement.ts +++ b/packages/third-party/motion/src/utils/isMainThreadElement.ts @@ -6,9 +6,7 @@ import type { MainThread } from '@lynx-js/types'; export function isMainThreadElement(ele: unknown): ele is MainThread.Element { 'main thread'; // @ts-expect-error error - // biome-ignore lint/complexity/useOptionalChain: - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - if (ele && ele.element && ele.element.elementRefptr) { + if (ele && 'element' in ele) { return true; } else { return false; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 44919a1b36..c0d834c4c4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -862,6 +862,9 @@ importers: motion-dom: specifier: 12.23.12 version: 12.23.12 + motion-utils: + specifier: 12.23.6 + version: 12.23.6 devDependencies: '@lynx-js/react': specifier: workspace:* From 8bbc40865dad5308f3ed413c60f0426f68b4c049 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Tue, 16 Dec 2025 17:13:01 +0800 Subject: [PATCH 14/37] fix: motion not query right element --- examples/motion/lynx.config.js | 6 + examples/motion/src/App.tsx | 5 + examples/motion/src/Basic/index.tsx | 2 +- examples/motion/src/BasicPercent/index.tsx | 2 +- examples/motion/src/Mini/index.tsx | 81 +++++ examples/motion/src/Mini/styles.css | 26 ++ .../motion/dist/animation/index.js | 7 +- .../motion/dist/animation/index.js.map | 2 +- packages/third-party/motion/dist/mini.d.ts | 50 +++ packages/third-party/motion/dist/mini.js | 232 ++++++++++++ packages/third-party/motion/dist/mini.js.map | 1 + .../third-party/motion/dist/mini/index.d.ts | 52 +++ .../third-party/motion/dist/mini/index.js | 242 +++++++++++++ .../third-party/motion/dist/mini/index.js.map | 1 + .../third-party/motion/dist/mini/mini.d.ts | 50 +++ packages/third-party/motion/dist/mini/mini.js | 232 ++++++++++++ .../third-party/motion/dist/mini/mini.js.map | 1 + .../motion/dist/modified/motionValue.js | 2 +- .../motion/dist/modified/motionValue.js.map | 2 +- .../motion/dist/polyfill/element.d.ts | 10 + .../motion/dist/polyfill/element.js | 32 ++ .../motion/dist/polyfill/element.js.map | 2 +- .../motion/dist/polyfill/shim.d.ts | 6 +- .../third-party/motion/dist/polyfill/shim.js | 93 +++-- .../motion/dist/polyfill/shim.js.map | 2 +- .../motion/dist/utils/elementHelper.js | 5 +- .../motion/dist/utils/elementHelper.js.map | 2 +- .../motion/dist/utils/isMainThreadElement.js | 4 +- .../dist/utils/isMainThreadElement.js.map | 2 +- packages/third-party/motion/package.json | 20 +- .../third-party/motion/src/animation/index.ts | 7 +- packages/third-party/motion/src/mini/index.ts | 339 ++++++++++++++++++ .../motion/src/modified/motionValue.ts | 2 +- .../motion/src/polyfill/element.ts | 46 +++ .../third-party/motion/src/polyfill/shim.ts | 99 +++-- .../motion/src/utils/elementHelper.ts | 5 +- .../motion/src/utils/isMainThreadElement.ts | 4 +- pnpm-lock.yaml | 3 + 38 files changed, 1577 insertions(+), 102 deletions(-) create mode 100644 examples/motion/src/Mini/index.tsx create mode 100644 examples/motion/src/Mini/styles.css create mode 100644 packages/third-party/motion/dist/mini.d.ts create mode 100644 packages/third-party/motion/dist/mini.js create mode 100644 packages/third-party/motion/dist/mini.js.map create mode 100644 packages/third-party/motion/dist/mini/index.d.ts create mode 100644 packages/third-party/motion/dist/mini/index.js create mode 100644 packages/third-party/motion/dist/mini/index.js.map create mode 100644 packages/third-party/motion/dist/mini/mini.d.ts create mode 100644 packages/third-party/motion/dist/mini/mini.js create mode 100644 packages/third-party/motion/dist/mini/mini.js.map create mode 100644 packages/third-party/motion/src/mini/index.ts diff --git a/examples/motion/lynx.config.js b/examples/motion/lynx.config.js index 6ac4384277..4fea01938b 100644 --- a/examples/motion/lynx.config.js +++ b/examples/motion/lynx.config.js @@ -5,6 +5,12 @@ import { defineConfig } from '@lynx-js/rspeedy'; const enableBundleAnalysis = !!process.env['RSPEEDY_BUNDLE_ANALYSIS']; export default defineConfig({ + source: { + entry: { + main: './src/index.tsx', + mini: './src/Mini/index.tsx', + }, + }, plugins: [ pluginReactLynx(), pluginQRCode({ diff --git a/examples/motion/src/App.tsx b/examples/motion/src/App.tsx index 482335035f..a2381152dc 100644 --- a/examples/motion/src/App.tsx +++ b/examples/motion/src/App.tsx @@ -5,6 +5,7 @@ import BasicPercent from './BasicPercent/index.js'; import BasicSelector from './BasicSelector/index.js'; import ColorInterception from './ColorInterception/index.js'; import iOSSlider from './iOSSlider/index.js'; +import Mini from './Mini/index.js'; import MotionValue from './MotionValue/index.js'; import Spring from './Spring/index.js'; import Stagger from './Stagger/index.js'; @@ -49,6 +50,10 @@ const CASES = [ name: 'iOSSlider', comp: iOSSlider, }, + { + name: 'Mini', + comp: Mini, + }, ]; export function App() { diff --git a/examples/motion/src/Basic/index.tsx b/examples/motion/src/Basic/index.tsx index 68ad7a1372..c095a452f0 100644 --- a/examples/motion/src/Basic/index.tsx +++ b/examples/motion/src/Basic/index.tsx @@ -36,7 +36,7 @@ export default function Basic() { useEffect(() => { setTimeout(() => { void runOnMainThread(startAnimation)(); - }, 1000); + }, 1500); return () => { void runOnMainThread(endAnimation)(); }; diff --git a/examples/motion/src/BasicPercent/index.tsx b/examples/motion/src/BasicPercent/index.tsx index 59d5ba1af3..6d0bdba9aa 100644 --- a/examples/motion/src/BasicPercent/index.tsx +++ b/examples/motion/src/BasicPercent/index.tsx @@ -16,7 +16,7 @@ export default function BasicPercent() { if (boxMTRef.current) { animateMTRef.current = animate( boxMTRef.current, - { width: ['10px', '50%'] }, + { width: ['10px', '50px'] }, { ease: 'circInOut', duration: 1, diff --git a/examples/motion/src/Mini/index.tsx b/examples/motion/src/Mini/index.tsx new file mode 100644 index 0000000000..ad4dacdd4d --- /dev/null +++ b/examples/motion/src/Mini/index.tsx @@ -0,0 +1,81 @@ +import { + animate, + useMotionValueRef, + useMotionValueRefEvent, +} from '@lynx-js/motion-lynx/mini'; +import { root, runOnMainThread, useMainThreadRef } from '@lynx-js/react'; +import type { MainThread } from '@lynx-js/types'; + +import './styles.css'; + +import '@lynx-js/preact-devtools'; +import '@lynx-js/react/debug'; + +export default function MiniExample() { + const boxRef = useMainThreadRef(null); + const x = useMotionValueRef(0); + const scale = useMotionValueRef(1); + + useMotionValueRefEvent(x, 'change', (v) => { + 'main thread'; + boxRef.current?.setStyleProperties({ + transform: `translateX(${v}px) scale(${scale.current.get()})`, + }); + }); + + useMotionValueRefEvent(scale, 'change', (v) => { + 'main thread'; + boxRef.current?.setStyleProperties({ + transform: `translateX(${x.current.get()}px) scale(${v})`, + }); + }); + + const handleTapSpring = () => { + void runOnMainThread(startSpring)(); + }; + + const handleTapScale = () => { + void runOnMainThread(startScale)(); + }; + + function startSpring() { + 'main thread'; + const target = x.current.get() === 0 ? 200 : 0; + animate(x.current, target, { + type: 'spring', + stiffness: 200, + damping: 20, + }); + } + + function startScale() { + 'main thread'; + const target = scale.current.get() === 1 ? 1.5 : 1; + animate(scale.current, target, { + duration: 0.4, + ease: t => t, + }); + } + + return ( + + + + + Spring Move + + + Scale BackOut + + + + ); +} + +root.render( + , +); + +if (import.meta.webpackHot) { + import.meta.webpackHot.accept(); +} diff --git a/examples/motion/src/Mini/styles.css b/examples/motion/src/Mini/styles.css new file mode 100644 index 0000000000..9b88af6f2b --- /dev/null +++ b/examples/motion/src/Mini/styles.css @@ -0,0 +1,26 @@ +.mini-container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; +} +.mini-box { + width: 100px; + height: 100px; + background-color: #ff0080; + border-radius: 20px; +} +.mini-controls { + margin-top: 30px; + display: flex; + gap: 10px; + flex-wrap: wrap; + justify-content: center; +} +.mini-btn { + padding: 10px 15px; + background-color: #eee; + border-radius: 8px; +} diff --git a/packages/third-party/motion/dist/animation/index.js b/packages/third-party/motion/dist/animation/index.js index 368d6a4ff3..3007d8d7ed 100644 --- a/packages/third-party/motion/dist/animation/index.js +++ b/packages/third-party/motion/dist/animation/index.js @@ -24,7 +24,8 @@ import '../polyfill/shim.js'; import { animate as animateOrig, clamp as clampOrig, progress as progressOrig, stagger as staggerOrig, } from 'framer-motion/dom' with { runtime: 'shared' }; import { mapValue as mapValueOrig, mix as mixOrig, spring as springOrig, springValue as springValueOrig, styleEffect as styleEffectOrig, transformValue as transformValueOrig, } from 'motion-dom' with { runtime: 'shared' }; import { useMotionValueRefEvent } from '../hooks/useMotionEvent.js'; -import { motionValue as motionValueOrig } from '../polyfill/MotionValue.js'; +import { ElementCompt } from '../polyfill/element.js' with { runtime: 'shared' }; +import { motionValue as motionValueOrig } from '../polyfill/MotionValue.js' with { runtime: 'shared' }; import { elementOrSelector2Dom } from '../utils/elementHelper.js'; import { isMainThreadElement, isMainThreadElementArray, } from '../utils/isMainThreadElement.js'; function animate(subjectOrSequence, optionsOrKeyframes, options) { @@ -41,8 +42,8 @@ function animate(subjectOrSequence, optionsOrKeyframes, options) { elementNodes = subjectOrSequence; } realSubjectOrSequence = (Array.isArray(elementNodes) - ? elementNodes.map(el => new globalThis.ElementCompt(el)) - : new globalThis.ElementCompt(elementNodes)); + ? elementNodes.map(el => new ElementCompt(el)) + : new ElementCompt(elementNodes)); } else { realSubjectOrSequence = subjectOrSequence; diff --git a/packages/third-party/motion/dist/animation/index.js.map b/packages/third-party/motion/dist/animation/index.js.map index 10c4f508d5..d0788b4ba2 100644 --- a/packages/third-party/motion/dist/animation/index.js.map +++ b/packages/third-party/motion/dist/animation/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,qBAAqB,CAAC;AAE7B,WAAW;AACX,4BAA4B;AAC5B,wBAAwB;AACxB,8BAA8B;AAC9B,4BAA4B;AAC5B,8BAA8B;AAC9B,gBAAgB;AAChB,uBAAuB;AACvB,kBAAkB;AAClB,qBAAqB;AACrB,8BAA8B;AAC9B,WAAW;AACX,8BAA8B;AAC9B,oBAAoB;AACpB,0BAA0B;AAC1B,oCAAoC;AACpC,oCA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S,KAAK,CAAC,GAAW,EAAE,GAAW,EAAE,CAAS;IAChD,aAAa,CAAC;IACd,OAAO,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,QAAQ,CACf,UAA+B,EAC/B,UAAyB,EACzB,WAAgB,EAChB,OAA6B;IAE7B,aAAa,CAAC;IACd,OAAO,YAAY,CACjB,UAAU,EACV,UAAU,EACV,WAAW,EACX,OAAO,CACR,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAI,SAAkB;IAC3C,aAAa,CAAC;IACd,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,WAAW,CAClB,OAAmC,EACnC,MAAmC;IAEnC,aAAa,CAAC;IACd,MAAM,QAAQ,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,eAAe,CACpB,QAAQ,EACR,MAAM,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AAEnC,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,GACZ,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,qBAAqB,CAAC;AAE7B,WAAW;AACX,4BAA4B;AAC5B,wBAAwB;AACxB,8BAA8B;AAC9B,4BAA4B;AAC5B,8BAA8B;AAC9B,gBAAgB;AAChB,uBAAuB;AACvB,kBAAkB;AAClB,qBAAqB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EAAiE;IACjE,CAAQ,CACT,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,EAAU,EAAE,KAAa;IACvD,aAAa,CAAC;IACd,OAAO,YAAY,CACjB,IAAI,EACJ,EAAE,EACF,KAAK,CACN,CAAC;AACJ,CAAC;AAED,SAAS,KAAK,CAAC,GAAW,EAAE,GAAW,EAAE,CAAS;IAChD,aAAa,CAAC;IACd,OAAO,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,QAAQ,CACf,UAA+B,EAC/B,UAAyB,EACzB,WAAgB,EAChB,OAA6B;IAE7B,aAAa,CAAC;IACd,OAAO,YAAY,CACjB,UAAU,EACV,UAAU,EACV,WAAW,EACX,OAAO,CACR,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAI,SAAkB;IAC3C,aAAa,CAAC;IACd,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,WAAW,CAClB,OAAmC,EACnC,MAAmC;IAEnC,aAAa,CAAC;IACd,MAAM,QAAQ,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,eAAe,CACpB,QAAQ,EACR,MAAM,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AAEnC,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,GACZ,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/mini.d.ts b/packages/third-party/motion/dist/mini.d.ts new file mode 100644 index 0000000000..0575b5ccdf --- /dev/null +++ b/packages/third-party/motion/dist/mini.d.ts @@ -0,0 +1,50 @@ +import './polyfill/shim.js'; +import type { MainThreadRef } from '@lynx-js/react'; +export interface MotionValue { + get(): T; + set(v: T): void; + getVelocity(): number; + jump(v: T): void; + onChange(callback: (v: T) => void): () => void; + on(event: 'change', callback: (v: T) => void): () => void; + /** + * Internal method to update velocity, usually called by the animation loop. + */ + updateVelocity(v: number): void; +} +export declare function createMotionValue(initial: T): MotionValue; +export interface MotionValueEventCallbacks { + change: (v: V) => void; +} +export type Easing = (t: number) => number; +export interface AnimationOptions { + type?: 'spring' | 'keyframes' | 'decay'; + stiffness?: number; + damping?: number; + mass?: number; + duration?: number; + ease?: Easing; + from?: number; + to?: number; + velocity?: number; + onUpdate?: (v: number) => void; + onComplete?: () => void; +} +export declare const linear: Easing; +export declare const easeIn: Easing; +export declare const easeOut: Easing; +export declare const easeInOut: Easing; +export declare const circIn: Easing; +export declare const circOut: Easing; +export declare const circInOut: Easing; +export declare const backIn: Easing; +export declare const backOut: Easing; +export declare const backInOut: Easing; +export declare const anticipate: Easing; +export declare function animate(value: MotionValue | number | ((v: number) => void), target: number, options?: AnimationOptions): { + stop: () => void; + then: (cb: () => void) => Promise; + onFinish: () => void; +}; +export declare function useMotionValueRef(value: T): MainThreadRef>; +export declare function useMotionValueRefEvent>(valueRef: MainThreadRef>, event: 'change', callback: MotionValueEventCallbacks[EventName]): void; diff --git a/packages/third-party/motion/dist/mini.js b/packages/third-party/motion/dist/mini.js new file mode 100644 index 0000000000..fd531af86b --- /dev/null +++ b/packages/third-party/motion/dist/mini.js @@ -0,0 +1,232 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import { spring } from 'motion-dom' with { runtime: 'shared' }; +import './polyfill/shim.js'; +import { runOnMainThread, useEffect, useMainThreadRef, useMemo, } from '@lynx-js/react'; +import { runWorkletCtx } from '@lynx-js/react/worklet-runtime/bindings'; +function noopMT() { + 'main thread'; +} +export function createMotionValue(initial) { + 'main thread'; + class MotionValueImpl { + v; + velocity = 0; + listeners = new Set(); + lastUpdated = 0; + constructor(initial) { + this.v = initial; + } + get() { + return this.v; + } + set(v) { + const now = Date.now(); + if (typeof v === 'number' && typeof this.v === 'number') { + const delta = v - this.v; + const timeDelta = (now - this.lastUpdated) / 1000; + if (timeDelta > 0) { + // Simple instantaneous velocity + this.velocity = delta / timeDelta; + } + } + this.lastUpdated = now; + this.v = v; + this.notify(); + } + updateVelocity(v) { + this.velocity = v; + } + getVelocity() { + return this.velocity; + } + jump(v) { + this.v = v; + this.velocity = 0; + this.lastUpdated = Date.now(); + this.notify(); + } + onChange(callback) { + this.listeners.add(callback); + return () => this.listeners.delete(callback); + } + on(event, callback) { + if (event === 'change') { + return this.onChange(callback); + } + return noopMT; + } + notify() { + for (const cb of this.listeners) { + cb(this.v); + } + } + } + return new MotionValueImpl(initial); +} +// --- Easings --- +export const linear = t => t; +export const easeIn = t => t * t; +export const easeOut = t => t * (2 - t); +export const easeInOut = t => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; +export const circIn = t => 1 - Math.sin(Math.acos(t)); +export const circOut = t => Math.sin(Math.acos(t - 1)); +export const circInOut = t => t < 0.5 + ? (1 - Math.sqrt(1 - 4 * t * t)) / 2 + : (Math.sqrt(1 - (-2 * t + 2) ** 2) + 1) / 2; +export const backIn = t => t * t * ((1.70158 + 1) * t - 1.70158); +export const backOut = t => --t * t * ((1.70158 + 1) * t + 1.70158) + 1; +export const backInOut = t => { + const c1 = 1.70158; + const c2 = c1 * 1.525; + return t < 0.5 + ? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2 + : (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (2 * t - 2) + c2) + 2) / 2; +}; +export const anticipate = t => { + const s = 1.70158 * 1.525; + return (t *= 2) < 1 + ? 0.5 * (t * t * ((s + 1) * t - s)) + : 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2); +}; +// --- Animate --- +export function animate(value, target, options = {}) { + 'main thread'; + let currentV = 0; + let startVelocity = options.velocity ?? 0; + // Resolve start value + if (typeof value === 'number') { + currentV = value; + } + else if (typeof value === 'function') { + // If passed a setter, we can't easily read, assume 0 or options.from + currentV = options.from ?? 0; + } + else { + currentV = value.get(); + startVelocity = startVelocity || value.getVelocity(); + } + // If type is spring or no duration provided, default to spring. + // Unless ease is provided, then tween. + const isSpring = options.type === 'spring' + || (!options.ease && !options.duration && options.type !== 'keyframes'); + const { from: _from, to: _to, ...springOptions } = options; + // motion-dom spring() returns an animation generator with .next(t) + const solver = isSpring + ? spring({ + ...springOptions, + keyframes: [currentV, target], + velocity: startVelocity, + }) + : null; + const startTime = Date.now(); + let canceled = false; + const controls = { + stop: () => { + canceled = true; + }, + then: (cb) => { + controls.onFinish = cb; + return Promise.resolve(); // Mock promise return async/await usage + }, + onFinish: () => { }, + }; + const duration = options.duration ?? 0.3; + const ease = options.ease ?? easeOut; + const tick = () => { + if (canceled) + return; + const now = Date.now(); + const elapsed = (now - startTime) / 1000; // seconds + const elapsedMs = now - startTime; // milliseconds + let finished = false; + let current = 0; + if (isSpring && solver) { + // motion-dom spring generator expects time in milliseconds usually + const state = solver.next(elapsedMs); + current = state.value; + finished = state.done; + } + else { + // Tween + if (elapsed >= duration) { + finished = true; + current = target; + } + else { + const p = elapsed / duration; + const eased = ease(p); + current = currentV + (target - currentV) * eased; + } + } + // Determine how to update + if (typeof value === 'function') { + value(current); + } + else if (typeof value === 'object' && value.set) { + value.set(current); + } + if (options.onUpdate) { + options.onUpdate(current); + } + if (finished) { + // Ensure final frame is exact for tween + if (!isSpring) { + if (typeof value === 'function') { + value(target); + } + else if (typeof value === 'object' && value.set) { + value.set(target); + value.updateVelocity(0); + } + } + if (options.onComplete) { + options.onComplete(); + } + controls.onFinish(); + } + else { + requestAnimationFrame(tick); + } + }; + requestAnimationFrame(tick); + return controls; +} +export function useMotionValueRef(value) { + // @ts-expect-error expected + const motionValueRef = useMainThreadRef(); + useMemo(() => { + function setMotionValue(value) { + 'main thread'; + if (!motionValueRef.current) { + motionValueRef.current = createMotionValue(value); + } + } + if (__BACKGROUND__) { + void runOnMainThread(setMotionValue)(value); + } + else { + runWorkletCtx(setMotionValue, [ + value, + ]); + } + }, []); + return motionValueRef; +} +export function useMotionValueRefEvent(valueRef, event, callback) { + const unListenRef = useMainThreadRef(); + useEffect(() => { + void runOnMainThread(() => { + 'main thread'; + unListenRef.current = valueRef.current.on(event, callback); + })(); + return () => { + void runOnMainThread(() => { + 'main thread'; + unListenRef.current?.(); + })(); + }; + }, [callback]); +} +//# sourceMappingURL=mini.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/mini.js.map b/packages/third-party/motion/dist/mini.js.map new file mode 100644 index 0000000000..d9bf27ea92 --- /dev/null +++ b/packages/third-party/motion/dist/mini.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mini.js","sourceRoot":"","sources":["../src/mini.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC,OAAO,OAAO,EAAE,QAAQ,EAAE,CAAC;AAE/D,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EACL,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,OAAO,GACR,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,SAAS,MAAM;IACb,aAAa,CAAC;AAChB,CAAC;AAiBD,MAAM,UAAU,iBAAiB,CAAI,OAAU;IAC7C,aAAa,CAAC;IACd,MAAM,eAAe;QACnB,CAAC,CAAI;QACL,QAAQ,GAAG,CAAC,CAAC;QACb,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;QACtC,WAAW,GAAG,CAAC,CAAC;QAEhB,YAAY,OAAU;YACpB,IAAI,CAAC,CAAC,GAAG,OAAO,CA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E,CAAC;QACL,OAAO,GAAG,EAAE;YACV,KAAK,eAAe,CAAC,GAAG,EAAE;gBACxB,aAAa,CAAC;gBACd,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1B,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/mini/index.d.ts b/packages/third-party/motion/dist/mini/index.d.ts new file mode 100644 index 0000000000..ccca46701a --- /dev/null +++ b/packages/third-party/motion/dist/mini/index.d.ts @@ -0,0 +1,52 @@ +import { spring as spring_ } from 'motion-dom'; +import type { MainThreadRef } from '@lynx-js/react'; +import '../polyfill/shim.js'; +export declare function spring(...args: Parameters): ReturnType; +export interface MotionValue { + get(): T; + set(v: T): void; + getVelocity(): number; + jump(v: T): void; + onChange(callback: (v: T) => void): () => void; + on(event: 'change', callback: (v: T) => void): () => void; + /** + * Internal method to update velocity, usually called by the animation loop. + */ + updateVelocity(v: number): void; +} +export declare function createMotionValue(initial: T): MotionValue; +export interface MotionValueEventCallbacks { + change: (v: V) => void; +} +export type Easing = (t: number) => number; +export interface AnimationOptions { + type?: 'spring' | 'keyframes' | 'decay'; + stiffness?: number; + damping?: number; + mass?: number; + duration?: number; + ease?: Easing; + from?: number; + to?: number; + velocity?: number; + onUpdate?: (v: number) => void; + onComplete?: () => void; +} +export declare const linear: Easing; +export declare const easeIn: Easing; +export declare const easeOut: Easing; +export declare const easeInOut: Easing; +export declare const circIn: Easing; +export declare const circOut: Easing; +export declare const circInOut: Easing; +export declare const backIn: Easing; +export declare const backOut: Easing; +export declare const backInOut: Easing; +export declare const anticipate: Easing; +export declare function animate(value: MotionValue | number | ((v: number) => void), target: number, options?: AnimationOptions): { + stop: () => void; + then: (cb: () => void) => Promise; + onFinish: () => void; +}; +export declare function useMotionValueRef(value: T): MainThreadRef>; +export declare function useMotionValueRefEvent>(valueRef: MainThreadRef>, event: 'change', callback: MotionValueEventCallbacks[EventName]): void; diff --git a/packages/third-party/motion/dist/mini/index.js b/packages/third-party/motion/dist/mini/index.js new file mode 100644 index 0000000000..b1e70397c1 --- /dev/null +++ b/packages/third-party/motion/dist/mini/index.js @@ -0,0 +1,242 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import { spring as spring_ } from 'motion-dom' with { runtime: 'shared' }; +import { runOnMainThread, useEffect, useMainThreadRef, useMemo, } from '@lynx-js/react'; +import { runWorkletCtx } from '@lynx-js/react/worklet-runtime/bindings'; +import { registerCallable } from '../utils/registeredFunction.js'; +import '../polyfill/shim.js'; +function noopMT() { + 'main thread'; +} +let springHandle = 'springHandle'; +if (__MAIN_THREAD__) { + springHandle = registerCallable(spring_, 'springHandle'); +} +export function spring(...args) { + 'main thread'; + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module + return globalThis.runOnRegistered(springHandle)(...args); +} +export function createMotionValue(initial) { + 'main thread'; + class MotionValueImpl { + v; + velocity = 0; + listeners = new Set(); + lastUpdated = 0; + constructor(initial) { + this.v = initial; + } + get() { + return this.v; + } + set(v) { + const now = Date.now(); + if (typeof v === 'number' && typeof this.v === 'number') { + const delta = v - this.v; + const timeDelta = (now - this.lastUpdated) / 1000; + if (timeDelta > 0) { + // Simple instantaneous velocity + this.velocity = delta / timeDelta; + } + } + this.lastUpdated = now; + this.v = v; + this.notify(); + } + updateVelocity(v) { + this.velocity = v; + } + getVelocity() { + return this.velocity; + } + jump(v) { + this.v = v; + this.velocity = 0; + this.lastUpdated = Date.now(); + this.notify(); + } + onChange(callback) { + this.listeners.add(callback); + return () => this.listeners.delete(callback); + } + on(event, callback) { + if (event === 'change') { + return this.onChange(callback); + } + return noopMT; + } + notify() { + for (const cb of this.listeners) { + cb(this.v); + } + } + } + return new MotionValueImpl(initial); +} +// --- Easings --- +export const linear = t => t; +export const easeIn = t => t * t; +export const easeOut = t => t * (2 - t); +export const easeInOut = t => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; +export const circIn = t => 1 - Math.sin(Math.acos(t)); +export const circOut = t => Math.sin(Math.acos(t - 1)); +export const circInOut = t => t < 0.5 + ? (1 - Math.sqrt(1 - 4 * t * t)) / 2 + : (Math.sqrt(1 - (-2 * t + 2) ** 2) + 1) / 2; +export const backIn = t => t * t * ((1.70158 + 1) * t - 1.70158); +export const backOut = t => --t * t * ((1.70158 + 1) * t + 1.70158) + 1; +export const backInOut = t => { + const c1 = 1.70158; + const c2 = c1 * 1.525; + return t < 0.5 + ? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2 + : (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (2 * t - 2) + c2) + 2) / 2; +}; +export const anticipate = t => { + const s = 1.70158 * 1.525; + return (t *= 2) < 1 + ? 0.5 * (t * t * ((s + 1) * t - s)) + : 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2); +}; +// --- Animate --- +export function animate(value, target, options = {}) { + 'main thread'; + let currentV = 0; + let startVelocity = options.velocity ?? 0; + // Resolve start value + if (typeof value === 'number') { + currentV = value; + } + else if (typeof value === 'function') { + // If passed a setter, we can't easily read, assume 0 or options.from + currentV = options.from ?? 0; + } + else { + currentV = value.get(); + startVelocity = startVelocity || value.getVelocity(); + } + // If type is spring or no duration provided, default to spring. + // Unless ease is provided, then tween. + const isSpring = options.type === 'spring' + || (!options.ease && !options.duration && options.type !== 'keyframes'); + const { from: _from, to: _to, ...springOptions } = options; + // motion-dom spring() returns an animation generator with .next(t) + const solver = isSpring + ? spring({ + ...springOptions, + keyframes: [currentV, target], + velocity: startVelocity, + }) + : null; + const startTime = Date.now(); + let canceled = false; + const controls = { + stop: () => { + canceled = true; + }, + then: (cb) => { + controls.onFinish = cb; + return Promise.resolve(); // Mock promise return async/await usage + }, + onFinish: () => { }, + }; + const duration = options.duration ?? 0.3; + const ease = options.ease ?? easeOut; + const tick = () => { + if (canceled) + return; + const now = Date.now(); + const elapsed = (now - startTime) / 1000; // seconds + const elapsedMs = now - startTime; // milliseconds + let finished = false; + let current = 0; + if (isSpring && solver) { + // motion-dom spring generator expects time in milliseconds usually + const state = solver.next(elapsedMs); + current = state.value; + finished = state.done; + } + else { + // Tween + if (elapsed >= duration) { + finished = true; + current = target; + } + else { + const p = elapsed / duration; + const eased = ease(p); + current = currentV + (target - currentV) * eased; + } + } + // Determine how to update + if (typeof value === 'function') { + value(current); + } + else if (typeof value === 'object' && value.set) { + value.set(current); + } + if (options.onUpdate) { + options.onUpdate(current); + } + if (finished) { + // Ensure final frame is exact for tween + if (!isSpring) { + if (typeof value === 'function') { + value(target); + } + else if (typeof value === 'object' && value.set) { + value.set(target); + value.updateVelocity(0); + } + } + if (options.onComplete) { + options.onComplete(); + } + controls.onFinish(); + } + else { + requestAnimationFrame(tick); + } + }; + requestAnimationFrame(tick); + return controls; +} +export function useMotionValueRef(value) { + // @ts-expect-error expected + const motionValueRef = useMainThreadRef(); + useMemo(() => { + function setMotionValue(value) { + 'main thread'; + if (!motionValueRef.current) { + motionValueRef.current = createMotionValue(value); + } + } + if (__BACKGROUND__) { + void runOnMainThread(setMotionValue)(value); + } + else { + runWorkletCtx(setMotionValue, [ + value, + ]); + } + }, []); + return motionValueRef; +} +export function useMotionValueRefEvent(valueRef, event, callback) { + const unListenRef = useMainThreadRef(); + useEffect(() => { + void runOnMainThread(() => { + 'main thread'; + unListenRef.current = valueRef.current.on(event, callback); + })(); + return () => { + void runOnMainThread(() => { + 'main thread'; + unListenRef.current?.(); + })(); + }; + }, [callback]); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/mini/index.js.map b/packages/third-party/motion/dist/mini/index.js.map new file mode 100644 index 0000000000..90507232df --- /dev/null +++ b/packages/third-party/motion/dist/mini/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mini/index.ts"],"names":[],"mappings":"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party/motion/dist/mini/mini.d.ts b/packages/third-party/motion/dist/mini/mini.d.ts new file mode 100644 index 0000000000..0575b5ccdf --- /dev/null +++ b/packages/third-party/motion/dist/mini/mini.d.ts @@ -0,0 +1,50 @@ +import './polyfill/shim.js'; +import type { MainThreadRef } from '@lynx-js/react'; +export interface MotionValue { + get(): T; + set(v: T): void; + getVelocity(): number; + jump(v: T): void; + onChange(callback: (v: T) => void): () => void; + on(event: 'change', callback: (v: T) => void): () => void; + /** + * Internal method to update velocity, usually called by the animation loop. + */ + updateVelocity(v: number): void; +} +export declare function createMotionValue(initial: T): MotionValue; +export interface MotionValueEventCallbacks { + change: (v: V) => void; +} +export type Easing = (t: number) => number; +export interface AnimationOptions { + type?: 'spring' | 'keyframes' | 'decay'; + stiffness?: number; + damping?: number; + mass?: number; + duration?: number; + ease?: Easing; + from?: number; + to?: number; + velocity?: number; + onUpdate?: (v: number) => void; + onComplete?: () => void; +} +export declare const linear: Easing; +export declare const easeIn: Easing; +export declare const easeOut: Easing; +export declare const easeInOut: Easing; +export declare const circIn: Easing; +export declare const circOut: Easing; +export declare const circInOut: Easing; +export declare const backIn: Easing; +export declare const backOut: Easing; +export declare const backInOut: Easing; +export declare const anticipate: Easing; +export declare function animate(value: MotionValue | number | ((v: number) => void), target: number, options?: AnimationOptions): { + stop: () => void; + then: (cb: () => void) => Promise; + onFinish: () => void; +}; +export declare function useMotionValueRef(value: T): MainThreadRef>; +export declare function useMotionValueRefEvent>(valueRef: MainThreadRef>, event: 'change', callback: MotionValueEventCallbacks[EventName]): void; diff --git a/packages/third-party/motion/dist/mini/mini.js b/packages/third-party/motion/dist/mini/mini.js new file mode 100644 index 0000000000..fd531af86b --- /dev/null +++ b/packages/third-party/motion/dist/mini/mini.js @@ -0,0 +1,232 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import { spring } from 'motion-dom' with { runtime: 'shared' }; +import './polyfill/shim.js'; +import { runOnMainThread, useEffect, useMainThreadRef, useMemo, } from '@lynx-js/react'; +import { runWorkletCtx } from '@lynx-js/react/worklet-runtime/bindings'; +function noopMT() { + 'main thread'; +} +export function createMotionValue(initial) { + 'main thread'; + class MotionValueImpl { + v; + velocity = 0; + listeners = new Set(); + lastUpdated = 0; + constructor(initial) { + this.v = initial; + } + get() { + return this.v; + } + set(v) { + const now = Date.now(); + if (typeof v === 'number' && typeof this.v === 'number') { + const delta = v - this.v; + const timeDelta = (now - this.lastUpdated) / 1000; + if (timeDelta > 0) { + // Simple instantaneous velocity + this.velocity = delta / timeDelta; + } + } + this.lastUpdated = now; + this.v = v; + this.notify(); + } + updateVelocity(v) { + this.velocity = v; + } + getVelocity() { + return this.velocity; + } + jump(v) { + this.v = v; + this.velocity = 0; + this.lastUpdated = Date.now(); + this.notify(); + } + onChange(callback) { + this.listeners.add(callback); + return () => this.listeners.delete(callback); + } + on(event, callback) { + if (event === 'change') { + return this.onChange(callback); + } + return noopMT; + } + notify() { + for (const cb of this.listeners) { + cb(this.v); + } + } + } + return new MotionValueImpl(initial); +} +// --- Easings --- +export const linear = t => t; +export const easeIn = t => t * t; +export const easeOut = t => t * (2 - t); +export const easeInOut = t => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; +export const circIn = t => 1 - Math.sin(Math.acos(t)); +export const circOut = t => Math.sin(Math.acos(t - 1)); +export const circInOut = t => t < 0.5 + ? (1 - Math.sqrt(1 - 4 * t * t)) / 2 + : (Math.sqrt(1 - (-2 * t + 2) ** 2) + 1) / 2; +export const backIn = t => t * t * ((1.70158 + 1) * t - 1.70158); +export const backOut = t => --t * t * ((1.70158 + 1) * t + 1.70158) + 1; +export const backInOut = t => { + const c1 = 1.70158; + const c2 = c1 * 1.525; + return t < 0.5 + ? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2 + : (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (2 * t - 2) + c2) + 2) / 2; +}; +export const anticipate = t => { + const s = 1.70158 * 1.525; + return (t *= 2) < 1 + ? 0.5 * (t * t * ((s + 1) * t - s)) + : 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2); +}; +// --- Animate --- +export function animate(value, target, options = {}) { + 'main thread'; + let currentV = 0; + let startVelocity = options.velocity ?? 0; + // Resolve start value + if (typeof value === 'number') { + currentV = value; + } + else if (typeof value === 'function') { + // If passed a setter, we can't easily read, assume 0 or options.from + currentV = options.from ?? 0; + } + else { + currentV = value.get(); + startVelocity = startVelocity || value.getVelocity(); + } + // If type is spring or no duration provided, default to spring. + // Unless ease is provided, then tween. + const isSpring = options.type === 'spring' + || (!options.ease && !options.duration && options.type !== 'keyframes'); + const { from: _from, to: _to, ...springOptions } = options; + // motion-dom spring() returns an animation generator with .next(t) + const solver = isSpring + ? spring({ + ...springOptions, + keyframes: [currentV, target], + velocity: startVelocity, + }) + : null; + const startTime = Date.now(); + let canceled = false; + const controls = { + stop: () => { + canceled = true; + }, + then: (cb) => { + controls.onFinish = cb; + return Promise.resolve(); // Mock promise return async/await usage + }, + onFinish: () => { }, + }; + const duration = options.duration ?? 0.3; + const ease = options.ease ?? easeOut; + const tick = () => { + if (canceled) + return; + const now = Date.now(); + const elapsed = (now - startTime) / 1000; // seconds + const elapsedMs = now - startTime; // milliseconds + let finished = false; + let current = 0; + if (isSpring && solver) { + // motion-dom spring generator expects time in milliseconds usually + const state = solver.next(elapsedMs); + current = state.value; + finished = state.done; + } + else { + // Tween + if (elapsed >= duration) { + finished = true; + current = target; + } + else { + const p = elapsed / duration; + const eased = ease(p); + current = currentV + (target - currentV) * eased; + } + } + // Determine how to update + if (typeof value === 'function') { + value(current); + } + else if (typeof value === 'object' && value.set) { + value.set(current); + } + if (options.onUpdate) { + options.onUpdate(current); + } + if (finished) { + // Ensure final frame is exact for tween + if (!isSpring) { + if (typeof value === 'function') { + value(target); + } + else if (typeof value === 'object' && value.set) { + value.set(target); + value.updateVelocity(0); + } + } + if (options.onComplete) { + options.onComplete(); + } + controls.onFinish(); + } + else { + requestAnimationFrame(tick); + } + }; + requestAnimationFrame(tick); + return controls; +} +export function useMotionValueRef(value) { + // @ts-expect-error expected + const motionValueRef = useMainThreadRef(); + useMemo(() => { + function setMotionValue(value) { + 'main thread'; + if (!motionValueRef.current) { + motionValueRef.current = createMotionValue(value); + } + } + if (__BACKGROUND__) { + void runOnMainThread(setMotionValue)(value); + } + else { + runWorkletCtx(setMotionValue, [ + value, + ]); + } + }, []); + return motionValueRef; +} +export function useMotionValueRefEvent(valueRef, event, callback) { + const unListenRef = useMainThreadRef(); + useEffect(() => { + void runOnMainThread(() => { + 'main thread'; + unListenRef.current = valueRef.current.on(event, callback); + })(); + return () => { + void runOnMainThread(() => { + 'main thread'; + unListenRef.current?.(); + })(); + }; + }, [callback]); +} +//# sourceMappingURL=mini.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/mini/mini.js.map b/packages/third-party/motion/dist/mini/mini.js.map new file mode 100644 index 0000000000..602bdba321 --- /dev/null +++ b/packages/third-party/motion/dist/mini/mini.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mini.js","sourceRoot":"","sources":["../../src/mini/mini.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC,OAAO,OAAO,EAAE,QAAQ,EAAE,CAAC;AAE/D,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EACL,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,OAAO,GACR,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,SAAS,MAAM;IACb,aAAa,CAAC;AAChB,CAAC;AAiBD,MAAM,UAAU,iBAAiB,CAAI,OAAU;IAC7C,aAAa,CAAC;IACd,MAAM,eAAe;QACnB,CAAC,CAAI;QACL,QAAQ,GAAG,CAAC,CAAC;QACb,SAAS,GAAG,IAAI,GAAG,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AO,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,GAAG,EAAE;YACV,KAAK,eAAe,CAAC,GAAG,EAAE;gBACxB,aAAa,CAAC;gBACd,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1B,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/modified/motionValue.js b/packages/third-party/motion/dist/modified/motionValue.js index b854be72e9..5324443cf2 100644 --- a/packages/third-party/motion/dist/modified/motionValue.js +++ b/packages/third-party/motion/dist/modified/motionValue.js @@ -1,7 +1,7 @@ // Copyright 2025 The Lynx Authors. All rights reserved. // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. -import { MotionValue } from 'motion-dom'; +import { MotionValue } from 'motion-dom' with { runtime: 'shared' }; class CustomMotionValue extends MotionValue { toJSON() { return {}; diff --git a/packages/third-party/motion/dist/modified/motionValue.js.map b/packages/third-party/motion/dist/modified/motionValue.js.map index 24db513ff1..fa6b4144dc 100644 --- a/packages/third-party/motion/dist/modified/motionValue.js.map +++ b/packages/third-party/motion/dist/modified/motionValue.js.map @@ -1 +1 @@ -{"version":3,"file":"motionValue.js","sourceRoot":"","sources":["../../src/modified/motionValue.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,MAAM,iBAA2B,SAAQ,WAAc;IACrD,MAAM;QACJ,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CACzB,IAAO,EACP,OAA4B;IAE5B,OAAO,IAAI,iBAAiB,CAAI,IAAI,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC"} \ No newline at end of file +{"version":3,"file":"motionValue.js","sourceRoot":"","sources":["../../src/modified/motionValue.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC,OAAO,OAAO,EAAE,QAAQ,EAAE,CAAC;AAGpE,MAAM,iBAA2B,SAAQ,WAAc;IACrD,MAAM;QACJ,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CACzB,IAAO,EACP,OAA4B;IAE5B,OAAO,IAAI,iBAAiB,CAAI,IAAI,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/element.d.ts b/packages/third-party/motion/dist/polyfill/element.d.ts index f34a1344e3..8ef9f488e8 100644 --- a/packages/third-party/motion/dist/polyfill/element.d.ts +++ b/packages/third-party/motion/dist/polyfill/element.d.ts @@ -36,5 +36,15 @@ export declare class ElementCompt { set right(value: string); get bottom(): string; set bottom(value: string); + getBoundingClientRect(): { + left: number; + top: number; + right: number; + bottom: number; + width: number; + height: number; + x: number; + y: number; + }; } export {}; diff --git a/packages/third-party/motion/dist/polyfill/element.js b/packages/third-party/motion/dist/polyfill/element.js index 0a19f77944..0db4e93442 100644 --- a/packages/third-party/motion/dist/polyfill/element.js +++ b/packages/third-party/motion/dist/polyfill/element.js @@ -28,6 +28,7 @@ export class ElementCompt { this.element.setStyleProperty('transform', 'scale(1, 1)'); return true; } + console.log('setStyle', prop, value); this.element.setStyleProperty(prop, String(value)); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment target[prop] = value; @@ -130,5 +131,36 @@ export class ElementCompt { set bottom(value) { this.element.setStyleProperty('bottom', value); } + getBoundingClientRect() { + // Parse dimensions from computed style + const width = parseFloat(this.getStyleProperty('width')) || 0; + const height = parseFloat(this.getStyleProperty('height')) || 0; + // Parse position - these may be 'auto' or pixel values + const left = parseFloat(this.getStyleProperty('left')) || 0; + const top = parseFloat(this.getStyleProperty('top')) || 0; + // Calculate bounds + const right = left + width; + const bottom = top + height; + console.log('getBoundingClient', { + left, + top, + right, + bottom, + width, + height, + x: left, + y: top, + }); + return { + left, + top, + right, + bottom, + width, + height, + x: left, + y: top, + }; + } } //# sourceMappingURL=element.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/element.js.map b/packages/third-party/motion/dist/polyfill/element.js.map index 189b0b6484..8b8e8cfa60 100644 --- a/packages/third-party/motion/dist/polyfill/element.js.map +++ b/packages/third-party/motion/dist/polyfill/element.js.map @@ -1 +1 @@ -{"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/polyfill/element.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,YAAY;IACf,OAAO,CAAqB;IAEpC,YAAY,OAA2B;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,gBAAgB;QACrB,MAAM,WAAW,GAA2B,EAAE,CAAC;QAE/C,OAAO,IAAI,KAAK,CAAC,WAAW,EAAE;YAC5B,GAAG,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;gBACrB,4BAA4B;gBAC5B,iEAAiE;gBACjE,OAAO,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAc,CAAC,CAAC;YACvE,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,IAAW,KAAK;QACd,MAAM,WAAW,GAAG,EAAiB,CAAC;QAEtC,WAAW,CAAC,WAAW,GAAG,CAAC,QAAgB,EAAE,KAAa,EAAE,EAAE;YAC5D,IAAI,QAAQ,KAAK,WAAW,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;gBACjD,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;YACnE,CAAC;YACD,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,C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U,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;QAEhE,uDAAuD;QACvD,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;QAC5D,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;QAE1D,mBAAmB;QACnB,MAAM,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;QAC3B,MAAM,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;QAE5B,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE;YAC/B,IAAI;YACJ,GAAG;YACH,KAAK;YACL,MAAM;YACN,KAAK;YACL,MAAM;YACN,CAAC,EAAE,IAAI;YACP,CAAC,EAAE,GAAG;SACP,CAAC,CAAC;QAEH,OAAO;YACL,IAAI;YACJ,GAAG;YACH,KAAK;YACL,MAAM;YACN,KAAK;YACL,MAAM;YACN,CAAC,EAAE,IAAI;YACP,CAAC,EAAE,GAAG;SACP,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/shim.d.ts b/packages/third-party/motion/dist/polyfill/shim.d.ts index 757196eeb0..cb0ff5c3b5 100644 --- a/packages/third-party/motion/dist/polyfill/shim.d.ts +++ b/packages/third-party/motion/dist/polyfill/shim.d.ts @@ -1,5 +1 @@ -import type { MainThread } from '@lynx-js/types'; -import { ElementCompt } from './element.js'; -declare global { - var ElementCompt: new (element: MainThread.Element) => ElementCompt; -} +export {}; diff --git a/packages/third-party/motion/dist/polyfill/shim.js b/packages/third-party/motion/dist/polyfill/shim.js index bddef9a8da..e8eebfefa1 100644 --- a/packages/third-party/motion/dist/polyfill/shim.js +++ b/packages/third-party/motion/dist/polyfill/shim.js @@ -5,55 +5,80 @@ import { document, setupDocument } from '@lynx-js/react/internal/document'; import { ElementCompt } from './element.js'; const timeOrigin = Date.now(); function shimGlobals() { + // Only shim document if it doesn't exist + if (!globalThis.document) { + // @ts-expect-error error + globalThis.document = document; + } + // Only shim performance if it doesn't exist if (!globalThis.performance) { - const performance = { + // @ts-expect-error error + globalThis.performance = { now: () => Date.now() - timeOrigin, }; - function queueMicrotask(fn) { + } + // Only shim queueMicrotask if it doesn't exist + if (!globalThis.queueMicrotask) { + globalThis.queueMicrotask = (fn) => { void Promise.resolve().then(() => { // eslint-disable-next-line @typescript-eslint/no-unsafe-call fn(); }); - } - class NodeList { - } - class SVGElement { - } - const window = { - getComputedStyle: (ele) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access - return ele.getComputedStyle(); - }, }; - class HTMLElement { - } - // @ts-expect-error error - globalThis.document = document; - // @ts-expect-error error - globalThis.performance = performance; - globalThis.queueMicrotask = queueMicrotask; - // @ts-expect-error error - document.querySelector = lynx.querySelector; - // @ts-expect-error error - document.querySelectorAll = lynx.querySelectorAll; + } + // Only shim document query methods if they don't exist + // @ts-expect-error error + document.querySelector ??= lynx.querySelector; + // @ts-expect-error error + document.querySelectorAll ??= lynx.querySelectorAll; + // Only shim NodeList if it doesn't exist + if (!globalThis.NodeList) { // @ts-expect-error error - globalThis.NodeList = NodeList; + globalThis.NodeList = class NodeList { + }; + } + // Only shim SVGElement if it doesn't exist + if (!globalThis.SVGElement) { // @ts-expect-error error - globalThis.SVGElement = SVGElement; + globalThis.SVGElement = class SVGElement { + }; + } + // Only shim HTMLElement if it doesn't exist + if (!globalThis.HTMLElement) { // @ts-expect-error error - globalThis.window = window; - globalThis.getComputedStyle = window.getComputedStyle; + globalThis.HTMLElement = class HTMLElement { + }; + } + // Only shim window if it doesn't exist + if (!globalThis.window) { // @ts-expect-error error - globalThis.HTMLElement = HTMLElement; + globalThis.window = { + getComputedStyle: (ele) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access + return ele.getComputedStyle(); + }, + }; } + // @ts-expect-error error + globalThis.Element ??= ElementCompt; + // @ts-expect-error error + globalThis.EventTarget ??= ElementCompt; + // Only shim getComputedStyle if it doesn't exist + globalThis.getComputedStyle ??= globalThis.window?.getComputedStyle; } if (__MAIN_THREAD__) { setupDocument(); shimGlobals(); - globalThis.ElementCompt = ElementCompt; - // @ts-expect-error error - globalThis.Element = ElementCompt; - // @ts-expect-error error - globalThis.EventTarget = ElementCompt; +} else if (__DEV__) { + // Only shim queueMicrotask if it doesn't exist + // eslint-disable-next-line unicorn/no-lonely-if + if (!globalThis.queueMicrotask) { + globalThis.queueMicrotask = (fn) => { + void Promise.resolve().then(() => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + fn(); + }); + }; + } } -//# sourceMappingURL=shim.js.map \ No newline at end of file +//# sourceMappingURL=shim.js.map diff --git a/packages/third-party/motion/dist/polyfill/shim.js.map b/packages/third-party/motion/dist/polyfill/shim.js.map index 126c13905d..235b5800a4 100644 --- a/packages/third-party/motion/dist/polyfill/shim.js.map +++ b/packages/third-party/motion/dist/polyfill/shim.js.map @@ -1 +1 @@ -{"version":3,"file":"shim.js","sourceRoot":"","sources":["../../src/polyfill/shim.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAG3E,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AAM9B,SAAS,WAAW;IAClB,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;QAC5B,MAAM,WAAW,GAAG;YAClB,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU;SACnC,CAAC;QACF,SAAS,cAAc,CAAC,EAAO;YAC7B,KA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motion/dist/utils/elementHelper.js index 1296c9eb56..25815b4ed2 100644 --- a/packages/third-party/motion/dist/utils/elementHelper.js +++ b/packages/third-party/motion/dist/utils/elementHelper.js @@ -1,4 +1,5 @@ import { isMainThreadElement, isMainThreadElementArray, } from './isMainThreadElement.js'; +import { ElementCompt } from '../polyfill/element.js' with { runtime: 'shared' }; export function elementOrSelector2Dom(nodesOrSelector) { 'main thread'; let domElements = undefined; @@ -13,8 +14,8 @@ export function elementOrSelector2Dom(nodesOrSelector) { elementNodes = nodesOrSelector; } domElements = (Array.isArray(elementNodes) - ? elementNodes.map(el => new globalThis.ElementCompt(el)) - : new globalThis.ElementCompt(elementNodes)); + ? elementNodes.map(el => new ElementCompt(el)) + : new ElementCompt(elementNodes)); } return domElements; } diff --git a/packages/third-party/motion/dist/utils/elementHelper.js.map b/packages/third-party/motion/dist/utils/elementHelper.js.map index 28bf3c33a1..e2f04753c4 100644 --- a/packages/third-party/motion/dist/utils/elementHelper.js.map +++ b/packages/third-party/motion/dist/utils/elementHelper.js.map @@ -1 +1 @@ -{"version":3,"file":"elementHelper.js","sourceRoot":"","sources":["../../src/utils/elementHelper.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,UAAU,qBAAqB,CACnC,eAAmE;IAEnE,aAAa,CAAC;IACd,IAAI,WAAW,GAAkC,SAAS,CAAC;IAE3D,IACE,OAAO,eAAe,KAAK,QAAQ;WAChC,mBAAmB,CAAC,eAAe,CAAC;WACpC,wBAAwB,CAAC,eAAe,CAAC,EAC5C,CAAC;QACD,IAAI,YAA+B,CAAC;QACpC,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,CAAC;YACxC,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,eAAe,CAAC;QACjC,CAAC;QACD,WAAW,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;YACxC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YACzD,CAAC,CAAC,IAAI,UAAU,CAAC,YAAY,CAC3B,YAAY,CACb,CAAiC,CAAC;IACvC,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"} \ No newline at end of file +{"version":3,"file":"elementHelper.js","sourceRoot":"","sources":["../../src/utils/elementHelper.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC,OAAO,OAAO,EAAE,QAAQ,EAAE,CAAC;AAGjF,MAAM,UAAU,qBAAqB,CACnC,eAAmE;IAEnE,aAAa,CAAC;IACd,IAAI,WAAW,GAAkC,SAAS,CAAC;IAE3D,IACE,OAAO,eAAe,KAAK,QAAQ;WAChC,mBAAmB,CAAC,eAAe,CAAC;WACpC,wBAAwB,CAAC,eAAe,CAAC,EAC5C,CAAC;QACD,IAAI,YAA+B,CAAC;QACpC,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,CAAC;YACxC,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,eAAe,CAAC;QACjC,CAAC;QACD,WAAW,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;YACxC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC;YAC9C,CAAC,CAAC,IAAI,YAAY,CAChB,YAAY,CACb,CAAiC,CAAC;IACvC,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/isMainThreadElement.js b/packages/third-party/motion/dist/utils/isMainThreadElement.js index 816d4825ef..5b96996373 100644 --- a/packages/third-party/motion/dist/utils/isMainThreadElement.js +++ b/packages/third-party/motion/dist/utils/isMainThreadElement.js @@ -1,9 +1,7 @@ export function isMainThreadElement(ele) { 'main thread'; // @ts-expect-error error - // biome-ignore lint/complexity/useOptionalChain: - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - if (ele && ele.element && ele.element.elementRefptr) { + if (ele && 'element' in ele) { return true; } else { diff --git a/packages/third-party/motion/dist/utils/isMainThreadElement.js.map b/packages/third-party/motion/dist/utils/isMainThreadElement.js.map index c41167e17b..1f0fb00a64 100644 --- a/packages/third-party/motion/dist/utils/isMainThreadElement.js.map +++ b/packages/third-party/motion/dist/utils/isMainThreadElement.js.map @@ -1 +1 @@ -{"version":3,"file":"isMainThreadElement.js","sourceRoot":"","sources":["../../src/utils/isMainThreadElement.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,aAAa,CAAC;IACd,yBAAyB;IACzB,+DAA+D;IAC/D,sEAAsE;IACtE,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,MAAe;IAEf,aAAa,CAAC;IACd,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;AAChF,CAAC"} \ No newline at end of file +{"version":3,"file":"isMainThreadElement.js","sourceRoot":"","sources":["../../src/utils/isMainThreadElement.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,aAAa,CAAC;IACd,yBAAyB;IACzB,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,MAAe;IAEf,aAAa,CAAC;IACd,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;AAChF,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/package.json b/packages/third-party/motion/package.json index 00f7acef54..93d6e0759a 100644 --- a/packages/third-party/motion/package.json +++ b/packages/third-party/motion/package.json @@ -15,7 +15,24 @@ "directory": "packages/third-party/motion" }, "license": "MIT", + "sideEffects": [ + "./src/polyfill/shim.ts" + ], "type": "module", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "require": "./dist/index.cjs", + "default": "./dist/index.js" + }, + "./mini": { + "types": "./dist/mini/index.d.ts", + "import": "./dist/mini/index.js", + "require": "./dist/mini/index.cjs", + "default": "./dist/mini/index.js" + } + }, "main": "dist/index.js", "types": "dist/index.d.ts", "files": [ @@ -29,7 +46,8 @@ }, "dependencies": { "framer-motion": "12.23.12", - "motion-dom": "12.23.12" + "motion-dom": "12.23.12", + "motion-utils": "12.23.6" }, "devDependencies": { "@lynx-js/react": "workspace:*", diff --git a/packages/third-party/motion/src/animation/index.ts b/packages/third-party/motion/src/animation/index.ts index 2c9834507f..d6a0452ae8 100644 --- a/packages/third-party/motion/src/animation/index.ts +++ b/packages/third-party/motion/src/animation/index.ts @@ -58,7 +58,8 @@ import type { } from 'motion-dom'; import { useMotionValueRefEvent } from '../hooks/useMotionEvent.js'; -import { motionValue as motionValueOrig } from '../polyfill/MotionValue.js'; +import { ElementCompt } from '../polyfill/element.js' with { runtime: 'shared' }; +import { motionValue as motionValueOrig } from '../polyfill/MotionValue.js' with { runtime: 'shared' }; import type { ElementOrElements } from '../types/index.js'; import { elementOrSelector2Dom } from '../utils/elementHelper.js'; import { @@ -173,8 +174,8 @@ function animate( elementNodes = subjectOrSequence; } realSubjectOrSequence = (Array.isArray(elementNodes) - ? elementNodes.map(el => new globalThis.ElementCompt(el)) - : new globalThis.ElementCompt( + ? elementNodes.map(el => new ElementCompt(el)) + : new ElementCompt( elementNodes, )) as unknown as ElementOrSelector; } else { diff --git a/packages/third-party/motion/src/mini/index.ts b/packages/third-party/motion/src/mini/index.ts new file mode 100644 index 0000000000..3de224fdd1 --- /dev/null +++ b/packages/third-party/motion/src/mini/index.ts @@ -0,0 +1,339 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import { spring as spring_ } from 'motion-dom' with { runtime: 'shared' }; + +import { + runOnMainThread, + useEffect, + useMainThreadRef, + useMemo, +} from '@lynx-js/react'; +import type { MainThreadRef } from '@lynx-js/react'; +import type { + Worklet, + WorkletRef, +} from '@lynx-js/react/worklet-runtime/bindings'; +import { runWorkletCtx } from '@lynx-js/react/worklet-runtime/bindings'; + +import { registerCallable } from '../utils/registeredFunction.js'; +import '../polyfill/shim.js'; + +function noopMT() { + 'main thread'; +} + +let springHandle = 'springHandle'; + +if (__MAIN_THREAD__) { + springHandle = registerCallable(spring_, 'springHandle'); +} + +export function spring( + ...args: Parameters +): ReturnType { + 'main thread'; + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module + return globalThis.runOnRegistered(springHandle)(...args); +} + +export interface MotionValue { + get(): T; + set(v: T): void; + getVelocity(): number; + jump(v: T): void; + // Standard Framer Motion API usually has `stop`, `isAnimating` etc. + // For mini version, keeping it simple but compatible with what was requested. + onChange(callback: (v: T) => void): () => void; + on(event: 'change', callback: (v: T) => void): () => void; + /** + * Internal method to update velocity, usually called by the animation loop. + */ + updateVelocity(v: number): void; +} + +export function createMotionValue(initial: T): MotionValue { + 'main thread'; + class MotionValueImpl implements MotionValue { + v: T; + velocity = 0; + listeners = new Set<(v: T) => void>(); + lastUpdated = 0; + + constructor(initial: T) { + this.v = initial; + } + + get() { + return this.v; + } + + set(v: T) { + const now = Date.now(); + if (typeof v === 'number' && typeof this.v === 'number') { + const delta = v - this.v; + const timeDelta = (now - this.lastUpdated) / 1000; + if (timeDelta > 0) { + // Simple instantaneous velocity + this.velocity = delta / timeDelta; + } + } + this.lastUpdated = now; + this.v = v; + this.notify(); + } + + updateVelocity(v: number) { + this.velocity = v; + } + + getVelocity() { + return this.velocity; + } + + jump(v: T) { + this.v = v; + this.velocity = 0; + this.lastUpdated = Date.now(); + this.notify(); + } + + onChange(callback: (v: T) => void) { + this.listeners.add(callback); + return () => this.listeners.delete(callback); + } + + on(event: 'change', callback: (v: T) => void) { + if (event === 'change') { + return this.onChange(callback); + } + return noopMT; + } + + notify() { + for (const cb of this.listeners) { + cb(this.v); + } + } + } + + return new MotionValueImpl(initial); +} + +export interface MotionValueEventCallbacks { + change: (v: V) => void; +} + +export type Easing = (t: number) => number; + +export interface AnimationOptions { + type?: 'spring' | 'keyframes' | 'decay'; + stiffness?: number; + damping?: number; + mass?: number; + duration?: number; + ease?: Easing; + from?: number; + to?: number; + velocity?: number; + onUpdate?: (v: number) => void; + onComplete?: () => void; +} + +// --- Easings --- +export const linear: Easing = t => t; +export const easeIn: Easing = t => t * t; +export const easeOut: Easing = t => t * (2 - t); +export const easeInOut: Easing = t => + t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; +export const circIn: Easing = t => 1 - Math.sin(Math.acos(t)); +export const circOut: Easing = t => Math.sin(Math.acos(t - 1)); +export const circInOut: Easing = t => + t < 0.5 + ? (1 - Math.sqrt(1 - 4 * t * t)) / 2 + : (Math.sqrt(1 - (-2 * t + 2) ** 2) + 1) / 2; +export const backIn: Easing = t => t * t * ((1.70158 + 1) * t - 1.70158); +export const backOut: Easing = t => --t * t * ((1.70158 + 1) * t + 1.70158) + 1; +export const backInOut: Easing = t => { + const c1 = 1.70158; + const c2 = c1 * 1.525; + return t < 0.5 + ? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2 + : (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (2 * t - 2) + c2) + 2) / 2; +}; +export const anticipate: Easing = t => { + const s = 1.70158 * 1.525; + return (t *= 2) < 1 + ? 0.5 * (t * t * ((s + 1) * t - s)) + : 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2); +}; + +// --- Animate --- + +export function animate( + value: MotionValue | number | ((v: number) => void), + target: number, + options: AnimationOptions = {}, +): { + stop: () => void; + then: (cb: () => void) => Promise; + onFinish: () => void; +} { + 'main thread'; + let currentV = 0; + let startVelocity = options.velocity ?? 0; + + // Resolve start value + if (typeof value === 'number') { + currentV = value; + } else if (typeof value === 'function') { + // If passed a setter, we can't easily read, assume 0 or options.from + currentV = options.from ?? 0; + } else { + currentV = value.get(); + startVelocity = startVelocity || value.getVelocity(); + } + + // If type is spring or no duration provided, default to spring. + // Unless ease is provided, then tween. + const isSpring = options.type === 'spring' + || (!options.ease && !options.duration && options.type !== 'keyframes'); + + const { from: _from, to: _to, ...springOptions } = options; + + // motion-dom spring() returns an animation generator with .next(t) + const solver = isSpring + ? spring({ + ...springOptions, + keyframes: [currentV, target], + velocity: startVelocity, + }) + : null; + + const startTime = Date.now(); + let canceled = false; + + const controls = { + stop: () => { + canceled = true; + }, + then: (cb: () => void) => { + controls.onFinish = cb; + return Promise.resolve(); // Mock promise return async/await usage + }, + onFinish: () => {}, + }; + + const duration = options.duration ?? 0.3; + const ease = options.ease ?? easeOut; + + const tick = () => { + if (canceled) return; + + const now = Date.now(); + const elapsed = (now - startTime) / 1000; // seconds + const elapsedMs = now - startTime; // milliseconds + + let finished = false; + let current = 0; + + if (isSpring && solver) { + // motion-dom spring generator expects time in milliseconds usually + const state = solver.next(elapsedMs) as { value: number; done: boolean }; + current = state.value; + finished = state.done; + } else { + // Tween + if (elapsed >= duration) { + finished = true; + current = target; + } else { + const p = elapsed / duration; + const eased = ease(p); + current = currentV + (target - currentV) * eased; + } + } + + // Determine how to update + if (typeof value === 'function') { + value(current); + } else if (typeof value === 'object' && value.set) { + value.set(current); + } + + if (options.onUpdate) { + options.onUpdate(current); + } + + if (finished) { + // Ensure final frame is exact for tween + if (!isSpring) { + if (typeof value === 'function') { + value(target); + } else if (typeof value === 'object' && value.set) { + value.set(target); + value.updateVelocity(0); + } + } + + if (options.onComplete) { + options.onComplete(); + } + controls.onFinish(); + } else { + requestAnimationFrame(tick); + } + }; + + requestAnimationFrame(tick); + return controls; +} + +export function useMotionValueRef(value: T): MainThreadRef> { + // @ts-expect-error expected + const motionValueRef: MainThreadRef> = useMainThreadRef< + MotionValue + >(); + + useMemo(() => { + function setMotionValue(value: T) { + 'main thread'; + if (!motionValueRef.current) { + motionValueRef.current = createMotionValue(value); + } + } + if (__BACKGROUND__) { + void runOnMainThread(setMotionValue)(value); + } else { + runWorkletCtx(setMotionValue as unknown as Worklet, [ + value as WorkletRef, + ]); + } + }, []); + + return motionValueRef; +} + +export function useMotionValueRefEvent< + V, + EventName extends keyof MotionValueEventCallbacks, +>( + valueRef: MainThreadRef>, + event: 'change', + callback: MotionValueEventCallbacks[EventName], +): void { + const unListenRef = useMainThreadRef<() => void>(); + + useEffect(() => { + void runOnMainThread(() => { + 'main thread'; + unListenRef.current = valueRef.current.on(event, callback); + })(); + return () => { + void runOnMainThread(() => { + 'main thread'; + unListenRef.current?.(); + })(); + }; + }, [callback]); +} diff --git a/packages/third-party/motion/src/modified/motionValue.ts b/packages/third-party/motion/src/modified/motionValue.ts index ac93415b8d..740ff58290 100644 --- a/packages/third-party/motion/src/modified/motionValue.ts +++ b/packages/third-party/motion/src/modified/motionValue.ts @@ -2,7 +2,7 @@ // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. -import { MotionValue } from 'motion-dom'; +import { MotionValue } from 'motion-dom' with { runtime: 'shared' }; import type { MotionValueOptions } from 'motion-dom'; class CustomMotionValue extends MotionValue { diff --git a/packages/third-party/motion/src/polyfill/element.ts b/packages/third-party/motion/src/polyfill/element.ts index 11b4d6edb4..a9d2248877 100644 --- a/packages/third-party/motion/src/polyfill/element.ts +++ b/packages/third-party/motion/src/polyfill/element.ts @@ -43,6 +43,7 @@ export class ElementCompt { this.element.setStyleProperty('transform', 'scale(1, 1)'); return true; } + console.log('setStyle', prop, value); this.element.setStyleProperty(prop, String(value)); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment target[prop] = value; @@ -160,4 +161,49 @@ export class ElementCompt { set bottom(value: string) { this.element.setStyleProperty('bottom', value); } + + public getBoundingClientRect(): { + left: number; + top: number; + right: number; + bottom: number; + width: number; + height: number; + x: number; + y: number; + } { + // Parse dimensions from computed style + const width = parseFloat(this.getStyleProperty('width')) || 0; + const height = parseFloat(this.getStyleProperty('height')) || 0; + + // Parse position - these may be 'auto' or pixel values + const left = parseFloat(this.getStyleProperty('left')) || 0; + const top = parseFloat(this.getStyleProperty('top')) || 0; + + // Calculate bounds + const right = left + width; + const bottom = top + height; + + console.log('getBoundingClient', { + left, + top, + right, + bottom, + width, + height, + x: left, + y: top, + }); + + return { + left, + top, + right, + bottom, + width, + height, + x: left, + y: top, + }; + } } diff --git a/packages/third-party/motion/src/polyfill/shim.ts b/packages/third-party/motion/src/polyfill/shim.ts index 6d4a050bfe..58b4778443 100644 --- a/packages/third-party/motion/src/polyfill/shim.ts +++ b/packages/third-party/motion/src/polyfill/shim.ts @@ -2,65 +2,92 @@ // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. import { document, setupDocument } from '@lynx-js/react/internal/document'; -import type { MainThread } from '@lynx-js/types'; import { ElementCompt } from './element.js'; const timeOrigin = Date.now(); -declare global { - var ElementCompt: new(element: MainThread.Element) => ElementCompt; -} - function shimGlobals() { + // Only shim document if it doesn't exist + if (!globalThis.document) { + // @ts-expect-error error + globalThis.document = document; + } + + // Only shim performance if it doesn't exist if (!globalThis.performance) { - const performance = { + // @ts-expect-error error + globalThis.performance = { now: () => Date.now() - timeOrigin, }; - function queueMicrotask(fn: any) { + } + + // Only shim queueMicrotask if it doesn't exist + if (!globalThis.queueMicrotask) { + globalThis.queueMicrotask = (fn: any) => { void Promise.resolve().then(() => { // eslint-disable-next-line @typescript-eslint/no-unsafe-call fn(); }); - } - class NodeList {} - class SVGElement {} - const window = { - getComputedStyle: (ele: any) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access - return ele.getComputedStyle(); - }, }; - class HTMLElement {} - // @ts-expect-error error - globalThis.document = document; - // @ts-expect-error error - globalThis.performance = performance; - globalThis.queueMicrotask = queueMicrotask; - // @ts-expect-error error - document.querySelector = lynx.querySelector; - // @ts-expect-error error - document.querySelectorAll = lynx.querySelectorAll; + } + + // Only shim document query methods if they don't exist + // @ts-expect-error error + document.querySelector ??= lynx.querySelector; + // @ts-expect-error error + document.querySelectorAll ??= lynx.querySelectorAll; + + // Only shim NodeList if it doesn't exist + if (!globalThis.NodeList) { // @ts-expect-error error - globalThis.NodeList = NodeList; + globalThis.NodeList = class NodeList {}; + } + + // Only shim SVGElement if it doesn't exist + if (!globalThis.SVGElement) { // @ts-expect-error error - globalThis.SVGElement = SVGElement; + globalThis.SVGElement = class SVGElement {}; + } + + // Only shim HTMLElement if it doesn't exist + if (!globalThis.HTMLElement) { // @ts-expect-error error - globalThis.window = window; - globalThis.getComputedStyle = window.getComputedStyle; + globalThis.HTMLElement = class HTMLElement {}; + } + + // Only shim window if it doesn't exist + if (!globalThis.window) { // @ts-expect-error error - globalThis.HTMLElement = HTMLElement; + globalThis.window = { + getComputedStyle: (ele: any) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access + return ele.getComputedStyle(); + }, + }; } + // @ts-expect-error error + globalThis.Element ??= ElementCompt; + // @ts-expect-error error + globalThis.EventTarget ??= ElementCompt; + + // Only shim getComputedStyle if it doesn't exist + globalThis.getComputedStyle ??= globalThis.window?.getComputedStyle; } if (__MAIN_THREAD__) { setupDocument(); shimGlobals(); - - globalThis.ElementCompt = ElementCompt; - // @ts-expect-error error - globalThis.Element = ElementCompt; - // @ts-expect-error error - globalThis.EventTarget = ElementCompt; +} else if (__DEV__) { + // Only shim queueMicrotask if it doesn't exist + // eslint-disable-next-line unicorn/no-lonely-if + if (!globalThis.queueMicrotask) { + globalThis.queueMicrotask = (fn: any) => { + void Promise.resolve().then(() => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + fn(); + }); + }; + } } diff --git a/packages/third-party/motion/src/utils/elementHelper.ts b/packages/third-party/motion/src/utils/elementHelper.ts index b5662cbb81..5af14c870a 100644 --- a/packages/third-party/motion/src/utils/elementHelper.ts +++ b/packages/third-party/motion/src/utils/elementHelper.ts @@ -9,6 +9,7 @@ import { isMainThreadElement, isMainThreadElementArray, } from './isMainThreadElement.js'; +import { ElementCompt } from '../polyfill/element.js' with { runtime: 'shared' }; import type { ElementOrElements } from '../types/index.js'; export function elementOrSelector2Dom( @@ -29,8 +30,8 @@ export function elementOrSelector2Dom( elementNodes = nodesOrSelector; } domElements = (Array.isArray(elementNodes) - ? elementNodes.map(el => new globalThis.ElementCompt(el)) - : new globalThis.ElementCompt( + ? elementNodes.map(el => new ElementCompt(el)) + : new ElementCompt( elementNodes, )) as unknown as ElementOrSelector; } diff --git a/packages/third-party/motion/src/utils/isMainThreadElement.ts b/packages/third-party/motion/src/utils/isMainThreadElement.ts index e3e24a214c..2fb948c16c 100644 --- a/packages/third-party/motion/src/utils/isMainThreadElement.ts +++ b/packages/third-party/motion/src/utils/isMainThreadElement.ts @@ -6,9 +6,7 @@ import type { MainThread } from '@lynx-js/types'; export function isMainThreadElement(ele: unknown): ele is MainThread.Element { 'main thread'; // @ts-expect-error error - // biome-ignore lint/complexity/useOptionalChain: - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - if (ele && ele.element && ele.element.elementRefptr) { + if (ele && 'element' in ele) { return true; } else { return false; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 44919a1b36..c0d834c4c4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -862,6 +862,9 @@ importers: motion-dom: specifier: 12.23.12 version: 12.23.12 + motion-utils: + specifier: 12.23.6 + version: 12.23.6 devDependencies: '@lynx-js/react': specifier: workspace:* From fda58771d6b5bb20b4b5ce2c18afc577be151e91 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 29 Dec 2025 19:57:18 +0800 Subject: [PATCH 15/37] feat: motion mini --- .../motion/__tests__/animation.test.js | 122 ++++----- .../motion/dist/hooks/usePreCommit.d.ts | 7 - .../motion/dist/hooks/usePreCommit.js | 29 --- .../motion/dist/hooks/usePreCommit.js.map | 1 - packages/third-party/motion/dist/mini.d.ts | 50 ---- packages/third-party/motion/dist/mini.js | 232 ------------------ packages/third-party/motion/dist/mini.js.map | 1 - .../third-party/motion/dist/mini/index.d.ts | 3 +- .../third-party/motion/dist/mini/index.js | 30 ++- .../third-party/motion/dist/mini/index.js.map | 2 +- .../third-party/motion/dist/mini/mini.d.ts | 50 ---- packages/third-party/motion/dist/mini/mini.js | 232 ------------------ .../third-party/motion/dist/mini/mini.js.map | 1 - .../third-party/motion/dist/polyfill/shim.js | 13 +- packages/third-party/motion/package.json | 9 +- packages/third-party/motion/src/mini/index.ts | 41 +++- 16 files changed, 147 insertions(+), 676 deletions(-) delete mode 100644 packages/third-party/motion/dist/hooks/usePreCommit.d.ts delete mode 100644 packages/third-party/motion/dist/hooks/usePreCommit.js delete mode 100644 packages/third-party/motion/dist/hooks/usePreCommit.js.map delete mode 100644 packages/third-party/motion/dist/mini.d.ts delete mode 100644 packages/third-party/motion/dist/mini.js delete mode 100644 packages/third-party/motion/dist/mini.js.map delete mode 100644 packages/third-party/motion/dist/mini/mini.d.ts delete mode 100644 packages/third-party/motion/dist/mini/mini.js delete mode 100644 packages/third-party/motion/dist/mini/mini.js.map diff --git a/packages/third-party/motion/__tests__/animation.test.js b/packages/third-party/motion/__tests__/animation.test.js index beda16c823..ed384eaa51 100644 --- a/packages/third-party/motion/__tests__/animation.test.js +++ b/packages/third-party/motion/__tests__/animation.test.js @@ -1,71 +1,79 @@ -import { jsx as _jsx } from "@lynx-js/react/jsx-runtime"; // Copyright 2025 The Lynx Authors. All rights reserved. // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; -import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; + +import { runOnMainThread, useMainThreadRef } from '@lynx-js/react'; +import { jsx as _jsx } from '@lynx-js/react/jsx-runtime'; import { act, render } from '@lynx-js/react/testing-library'; -import { MainThread } from '@lynx-js/types'; + import { animate } from '../src/index.js'; import { noop } from '../src/utils/noop.js'; + describe('motion wrapping animation functions', () => { - let _mockRegisterCallable; - beforeEach(() => { - const mockRegisteredMap = new Map(); - vi.spyOn(globalThis, 'runOnRegistered', 'get').mockImplementation(function (id) { - const func = mockRegisteredMap.get(id) ?? noop; - return func; - }); - function mockRegisterCallable(func, id) { - mockRegisteredMap.set(id, func); - return func; - } - _mockRegisterCallable = mockRegisterCallable; - }); - afterEach(() => { - vi.restoreAllMocks(); - }); - test('motion animate should be called', async () => { - let _startAnimation; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call - const _mockAnimate = _mockRegisterCallable(vi.fn(), 'animate'); - const App = () => { - const boxMTRef = useMainThreadRef(null); - console.log('renderApp'); - function startAnimation() { - 'main thread'; - if (boxMTRef.current) { - animate(boxMTRef.current, { scale: 0.4, rotate: '45deg' }, { - ease: 'circInOut', - duration: 1, - repeat: Number.POSITIVE_INFINITY, - repeatType: 'reverse', - }); - } - } - _startAnimation = startAnimation; - return (_jsx("view", { children: _jsx("view", { "main-thread:ref": boxMTRef }) })); - }; - await act(() => { - render(_jsx(App, {}), { - enableMainThread: true, - enableBackgroundThread: true, - }); - }); - await runOnMainThread(() => { - 'main thread'; - _startAnimation(); - })(); - // Check that the mock was called - expect(_mockAnimate).toHaveBeenCalled(); - // You can also check what arguments it received - expect(_mockAnimate).toHaveBeenCalledWith(expect.anything(), // the element - { scale: 0.4, rotate: '45deg' }, { + let _mockRegisterCallable; + beforeEach(() => { + const mockRegisteredMap = new Map(); + vi.spyOn(globalThis, 'runOnRegistered', 'get').mockImplementation( + function(id) { + const func = mockRegisteredMap.get(id) ?? noop; + return func; + }, + ); + function mockRegisterCallable(func, id) { + mockRegisteredMap.set(id, func); + return func; + } + _mockRegisterCallable = mockRegisterCallable; + }); + afterEach(() => { + vi.restoreAllMocks(); + }); + test('motion animate should be called', async () => { + let _startAnimation; + const _mockAnimate = _mockRegisterCallable(vi.fn(), 'animate'); + const App = () => { + const boxMTRef = useMainThreadRef(null); + console.log('renderApp'); + function startAnimation() { + 'main thread'; + if (boxMTRef.current) { + animate(boxMTRef.current, { scale: 0.4, rotate: '45deg' }, { ease: 'circInOut', duration: 1, repeat: Number.POSITIVE_INFINITY, repeatType: 'reverse', - }); + }); + } + } + _startAnimation = startAnimation; + return (_jsx('view', { + children: _jsx('view', { 'main-thread:ref': boxMTRef }), + })); + }; + await act(() => { + render(_jsx(App, {}), { + enableMainThread: true, + enableBackgroundThread: true, + }); }); + await runOnMainThread(() => { + 'main thread'; + _startAnimation(); + })(); + // Check that the mock was called + expect(_mockAnimate).toHaveBeenCalled(); + // You can also check what arguments it received + expect(_mockAnimate).toHaveBeenCalledWith( + expect.anything(), // the element + { scale: 0.4, rotate: '45deg' }, + { + ease: 'circInOut', + duration: 1, + repeat: Number.POSITIVE_INFINITY, + repeatType: 'reverse', + }, + ); + }); }); -//# sourceMappingURL=animation.test.js.map \ No newline at end of file +// # sourceMappingURL=animation.test.js.map diff --git a/packages/third-party/motion/dist/hooks/usePreCommit.d.ts b/packages/third-party/motion/dist/hooks/usePreCommit.d.ts deleted file mode 100644 index e2e61ff12b..0000000000 --- a/packages/third-party/motion/dist/hooks/usePreCommit.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * An experimental hook dedicated to make MTS run on firstScreenPaint - * Can be used starting from ReactLynx 0.113.0 - * @experimental - * @param cb A main-thread callback to run on firstScreen - */ -export declare function usePreCommit(cb: CallableFunction): void; diff --git a/packages/third-party/motion/dist/hooks/usePreCommit.js b/packages/third-party/motion/dist/hooks/usePreCommit.js deleted file mode 100644 index 264de2e5db..0000000000 --- a/packages/third-party/motion/dist/hooks/usePreCommit.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -import { runWorkletCtx, setEomShouldFlushElementTree, } from '@lynx-js/react/worklet-runtime/bindings'; -/** - * An experimental hook dedicated to make MTS run on firstScreenPaint - * Can be used starting from ReactLynx 0.113.0 - * @experimental - * @param cb A main-thread callback to run on firstScreen - */ -export function usePreCommit(cb) { - if (__MAIN_THREAD__) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - setEomShouldFlushElementTree(false); - void Promise.resolve().then(() => { - try { - runWorkletCtx(cb, []); - } - catch (e) { - console.error('Error occurred in preCommit hook', e); - } - finally { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - setEomShouldFlushElementTree(true); - } - }); - } -} -//# sourceMappingURL=usePreCommit.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/hooks/usePreCommit.js.map b/packages/third-party/motion/dist/hooks/usePreCommit.js.map deleted file mode 100644 index 7bbbc1fc1d..0000000000 --- a/packages/third-party/motion/dist/hooks/usePreCommit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"usePreCommit.js","sourceRoot":"","sources":["../../src/hooks/usePreCommit.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EACL,aAAa,EACb,4BAA4B,GAC7B,MAAM,yCAAyC,CAAA;AAGhD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,EAAoB;IAC/C,IAAI,eAAe,EAAE,CAAC;QACpB,6DAA6D;QAC7D,4BAA4B,CAAC,KAAK,CAAC,CAAA;QACnC,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YAC/B,IAAI,CAAC;gBACH,aAAa,CAAC,EAAwB,EAAE,EAAE,CAAC,CAAA;YAC7C,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,CAAC,CAAC,CAAA;YACtD,CAAC;oBAAS,CAAC;gBACT,6DAA6D;gBAC7D,4BAA4B,CAAC,IAAI,CAAC,CAAA;YACpC,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/mini.d.ts b/packages/third-party/motion/dist/mini.d.ts deleted file mode 100644 index 0575b5ccdf..0000000000 --- a/packages/third-party/motion/dist/mini.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import './polyfill/shim.js'; -import type { MainThreadRef } from '@lynx-js/react'; -export interface MotionValue { - get(): T; - set(v: T): void; - getVelocity(): number; - jump(v: T): void; - onChange(callback: (v: T) => void): () => void; - on(event: 'change', callback: (v: T) => void): () => void; - /** - * Internal method to update velocity, usually called by the animation loop. - */ - updateVelocity(v: number): void; -} -export declare function createMotionValue(initial: T): MotionValue; -export interface MotionValueEventCallbacks { - change: (v: V) => void; -} -export type Easing = (t: number) => number; -export interface AnimationOptions { - type?: 'spring' | 'keyframes' | 'decay'; - stiffness?: number; - damping?: number; - mass?: number; - duration?: number; - ease?: Easing; - from?: number; - to?: number; - velocity?: number; - onUpdate?: (v: number) => void; - onComplete?: () => void; -} -export declare const linear: Easing; -export declare const easeIn: Easing; -export declare const easeOut: Easing; -export declare const easeInOut: Easing; -export declare const circIn: Easing; -export declare const circOut: Easing; -export declare const circInOut: Easing; -export declare const backIn: Easing; -export declare const backOut: Easing; -export declare const backInOut: Easing; -export declare const anticipate: Easing; -export declare function animate(value: MotionValue | number | ((v: number) => void), target: number, options?: AnimationOptions): { - stop: () => void; - then: (cb: () => void) => Promise; - onFinish: () => void; -}; -export declare function useMotionValueRef(value: T): MainThreadRef>; -export declare function useMotionValueRefEvent>(valueRef: MainThreadRef>, event: 'change', callback: MotionValueEventCallbacks[EventName]): void; diff --git a/packages/third-party/motion/dist/mini.js b/packages/third-party/motion/dist/mini.js deleted file mode 100644 index fd531af86b..0000000000 --- a/packages/third-party/motion/dist/mini.js +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -import { spring } from 'motion-dom' with { runtime: 'shared' }; -import './polyfill/shim.js'; -import { runOnMainThread, useEffect, useMainThreadRef, useMemo, } from '@lynx-js/react'; -import { runWorkletCtx } from '@lynx-js/react/worklet-runtime/bindings'; -function noopMT() { - 'main thread'; -} -export function createMotionValue(initial) { - 'main thread'; - class MotionValueImpl { - v; - velocity = 0; - listeners = new Set(); - lastUpdated = 0; - constructor(initial) { - this.v = initial; - } - get() { - return this.v; - } - set(v) { - const now = Date.now(); - if (typeof v === 'number' && typeof this.v === 'number') { - const delta = v - this.v; - const timeDelta = (now - this.lastUpdated) / 1000; - if (timeDelta > 0) { - // Simple instantaneous velocity - this.velocity = delta / timeDelta; - } - } - this.lastUpdated = now; - this.v = v; - this.notify(); - } - updateVelocity(v) { - this.velocity = v; - } - getVelocity() { - return this.velocity; - } - jump(v) { - this.v = v; - this.velocity = 0; - this.lastUpdated = Date.now(); - this.notify(); - } - onChange(callback) { - this.listeners.add(callback); - return () => this.listeners.delete(callback); - } - on(event, callback) { - if (event === 'change') { - return this.onChange(callback); - } - return noopMT; - } - notify() { - for (const cb of this.listeners) { - cb(this.v); - } - } - } - return new MotionValueImpl(initial); -} -// --- Easings --- -export const linear = t => t; -export const easeIn = t => t * t; -export const easeOut = t => t * (2 - t); -export const easeInOut = t => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; -export const circIn = t => 1 - Math.sin(Math.acos(t)); -export const circOut = t => Math.sin(Math.acos(t - 1)); -export const circInOut = t => t < 0.5 - ? (1 - Math.sqrt(1 - 4 * t * t)) / 2 - : (Math.sqrt(1 - (-2 * t + 2) ** 2) + 1) / 2; -export const backIn = t => t * t * ((1.70158 + 1) * t - 1.70158); -export const backOut = t => --t * t * ((1.70158 + 1) * t + 1.70158) + 1; -export const backInOut = t => { - const c1 = 1.70158; - const c2 = c1 * 1.525; - return t < 0.5 - ? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2 - : (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (2 * t - 2) + c2) + 2) / 2; -}; -export const anticipate = t => { - const s = 1.70158 * 1.525; - return (t *= 2) < 1 - ? 0.5 * (t * t * ((s + 1) * t - s)) - : 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2); -}; -// --- Animate --- -export function animate(value, target, options = {}) { - 'main thread'; - let currentV = 0; - let startVelocity = options.velocity ?? 0; - // Resolve start value - if (typeof value === 'number') { - currentV = value; - } - else if (typeof value === 'function') { - // If passed a setter, we can't easily read, assume 0 or options.from - currentV = options.from ?? 0; - } - else { - currentV = value.get(); - startVelocity = startVelocity || value.getVelocity(); - } - // If type is spring or no duration provided, default to spring. - // Unless ease is provided, then tween. - const isSpring = options.type === 'spring' - || (!options.ease && !options.duration && options.type !== 'keyframes'); - const { from: _from, to: _to, ...springOptions } = options; - // motion-dom spring() returns an animation generator with .next(t) - const solver = isSpring - ? spring({ - ...springOptions, - keyframes: [currentV, target], - velocity: startVelocity, - }) - : null; - const startTime = Date.now(); - let canceled = false; - const controls = { - stop: () => { - canceled = true; - }, - then: (cb) => { - controls.onFinish = cb; - return Promise.resolve(); // Mock promise return async/await usage - }, - onFinish: () => { }, - }; - const duration = options.duration ?? 0.3; - const ease = options.ease ?? easeOut; - const tick = () => { - if (canceled) - return; - const now = Date.now(); - const elapsed = (now - startTime) / 1000; // seconds - const elapsedMs = now - startTime; // milliseconds - let finished = false; - let current = 0; - if (isSpring && solver) { - // motion-dom spring generator expects time in milliseconds usually - const state = solver.next(elapsedMs); - current = state.value; - finished = state.done; - } - else { - // Tween - if (elapsed >= duration) { - finished = true; - current = target; - } - else { - const p = elapsed / duration; - const eased = ease(p); - current = currentV + (target - currentV) * eased; - } - } - // Determine how to update - if (typeof value === 'function') { - value(current); - } - else if (typeof value === 'object' && value.set) { - value.set(current); - } - if (options.onUpdate) { - options.onUpdate(current); - } - if (finished) { - // Ensure final frame is exact for tween - if (!isSpring) { - if (typeof value === 'function') { - value(target); - } - else if (typeof value === 'object' && value.set) { - value.set(target); - value.updateVelocity(0); - } - } - if (options.onComplete) { - options.onComplete(); - } - controls.onFinish(); - } - else { - requestAnimationFrame(tick); - } - }; - requestAnimationFrame(tick); - return controls; -} -export function useMotionValueRef(value) { - // @ts-expect-error expected - const motionValueRef = useMainThreadRef(); - useMemo(() => { - function setMotionValue(value) { - 'main thread'; - if (!motionValueRef.current) { - motionValueRef.current = createMotionValue(value); - } - } - if (__BACKGROUND__) { - void runOnMainThread(setMotionValue)(value); - } - else { - runWorkletCtx(setMotionValue, [ - value, - ]); - } - }, []); - return motionValueRef; -} -export function useMotionValueRefEvent(valueRef, event, callback) { - const unListenRef = useMainThreadRef(); - useEffect(() => { - void runOnMainThread(() => { - 'main thread'; - unListenRef.current = valueRef.current.on(event, callback); - })(); - return () => { - void runOnMainThread(() => { - 'main thread'; - unListenRef.current?.(); - })(); - }; - }, [callback]); -} -//# sourceMappingURL=mini.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/mini.js.map b/packages/third-party/motion/dist/mini.js.map deleted file mode 100644 index d9bf27ea92..0000000000 --- a/packages/third-party/motion/dist/mini.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mini.js","sourceRoot":"","sources":["../src/mini.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC,OAAO,OAAO,EAAE,QAAQ,EAAE,CAAC;AAE/D,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EACL,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,OAAO,GACR,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,SAAS,MAAM;IACb,aAAa,CAAC;AAChB,CAAC;AAiBD,MAAM,UAAU,iBAAiB,CAAI,OAAU;IAC7C,aAAa,CAAC;IACd,MAAM,eAAe;QACnB,CAAC,CAAI;QACL,QAAQ,GAAG,CAAC,CAAC;QACb,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;QACtC,WAAW,GAAG,CAAC,CAAC;QAEhB,YAAY,OAAU;YACpB,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC;QACnB,CAAC;QAED,GAAG;YACD,OAAO,IAAI,CAAC,CAAC,CAAC;QAChB,CAAC;QAED,GAAG,CAAC,CAAI;YACN,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACvB,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACxD,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;gBACzB,MAAM,SAAS,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;gBAClD,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;oBAClB,gCAAgC;oBAChC,IAAI,CAAC,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;gBACpC,CAAC;YACH,CAA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d,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;gBAC5B,cAAc,CAAC,OAAO,GAAG,iBAAiB,CAAI,KAAK,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;QACD,IAAI,cAAc,EAAE,CAAC;YACnB,KAAK,eAAe,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,aAAa,CAAC,cAAoC,EAAE;gBAClD,KAA4B;aAC7B,CAAC,CAAC;QACL,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAIpC,QAAuC,EACvC,KAAe,EACf,QAAiD;IAEjD,MAAM,WAAW,GAAG,gBAAgB,EAAc,CAAC;IAEnD,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,eAAe,CAAC,GAAG,EAAE;YACxB,aAAa,CAAC;YACd,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,GAAG,EAAE;YACV,KAAK,eAAe,CAAC,GAAG,EAAE;gBACxB,aAAa,CAAC;gBACd,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1B,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/mini/index.d.ts b/packages/third-party/motion/dist/mini/index.d.ts index ccca46701a..2559c4b39d 100644 --- a/packages/third-party/motion/dist/mini/index.d.ts +++ b/packages/third-party/motion/dist/mini/index.d.ts @@ -1,6 +1,6 @@ +import '../polyfill/shim.js'; import { spring as spring_ } from 'motion-dom'; import type { MainThreadRef } from '@lynx-js/react'; -import '../polyfill/shim.js'; export declare function spring(...args: Parameters): ReturnType; export interface MotionValue { get(): T; @@ -13,6 +13,7 @@ export interface MotionValue { * Internal method to update velocity, usually called by the animation loop. */ updateVelocity(v: number): void; + stop(): void; } export declare function createMotionValue(initial: T): MotionValue; export interface MotionValueEventCallbacks { diff --git a/packages/third-party/motion/dist/mini/index.js b/packages/third-party/motion/dist/mini/index.js index b1e70397c1..90384f78ca 100644 --- a/packages/third-party/motion/dist/mini/index.js +++ b/packages/third-party/motion/dist/mini/index.js @@ -1,11 +1,11 @@ // Copyright 2025 The Lynx Authors. All rights reserved. // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. -import { spring as spring_ } from 'motion-dom' with { runtime: 'shared' }; +import '../polyfill/shim.js'; +import { spring as spring_ } from 'motion-dom'; import { runOnMainThread, useEffect, useMainThreadRef, useMemo, } from '@lynx-js/react'; import { runWorkletCtx } from '@lynx-js/react/worklet-runtime/bindings'; import { registerCallable } from '../utils/registeredFunction.js'; -import '../polyfill/shim.js'; function noopMT() { 'main thread'; } @@ -13,6 +13,9 @@ let springHandle = 'springHandle'; if (__MAIN_THREAD__) { springHandle = registerCallable(spring_, 'springHandle'); } +else { + console.log('ohmyoh bts'); +} export function spring(...args) { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module @@ -24,6 +27,7 @@ export function createMotionValue(initial) { v; velocity = 0; listeners = new Set(); + activeAnimations = new Set(); lastUpdated = 0; constructor(initial) { this.v = initial; @@ -72,6 +76,19 @@ export function createMotionValue(initial) { cb(this.v); } } + attach(cancel) { + this.activeAnimations.add(cancel); + return () => this.activeAnimations.delete(cancel); + } + stop() { + for (const cancel of this.activeAnimations) { + cancel(); + } + this.activeAnimations.clear(); + } + toJSON() { + return String(this.v); + } } return new MotionValueImpl(initial); } @@ -116,6 +133,9 @@ export function animate(value, target, options = {}) { else { currentV = value.get(); startVelocity = startVelocity || value.getVelocity(); + if (value.stop) { + value.stop(); + } } // If type is spring or no duration provided, default to spring. // Unless ease is provided, then tween. @@ -144,6 +164,11 @@ export function animate(value, target, options = {}) { }; const duration = options.duration ?? 0.3; const ease = options.ease ?? easeOut; + let detach; + if (typeof value === 'object' && value && 'attach' in value + && typeof value.attach === 'function') { + detach = value.attach(controls.stop); + } const tick = () => { if (canceled) return; @@ -195,6 +220,7 @@ export function animate(value, target, options = {}) { options.onComplete(); } controls.onFinish(); + detach?.(); } else { requestAnimationFrame(tick); diff --git a/packages/third-party/motion/dist/mini/index.js.map b/packages/third-party/motion/dist/mini/index.js.map index 90507232df..e018263bdc 100644 --- a/packages/third-party/motion/dist/mini/index.js.map +++ b/packages/third-party/motion/dist/mini/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mini/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC,OAAO,OAAO,EAAE,QAAQ,EAAE,CAAC;AAE1E,OAAO,EACL,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,OAAO,GACR,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,qBAAqB,CAAC;AAE7B,SAAS,MAAM;IACb,aAAa,CAAC;AAChB,CAAC;AAED,IAAI,YAAY,GAAG,cAAc,CAAC;AAElC,IAAI,eAAe,EAAE,CAAC;IACpB,YAAY,GAAG,gBAAgB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,MAAM,CACpB,GAAG,IAAgC;IAEnC,aAAa,CAAC;IACd,+EAA+E;IAC/E,OAAO,UAAU,CAAC,eAAe,CAAiB,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAC3E,CAAC;AAiBD,MAAM,UAAU,iBAAiB,CAAI,OAAU;IAC7C,aA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,EAAE,CAAC;YAC1B,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/mini/mini.d.ts b/packages/third-party/motion/dist/mini/mini.d.ts deleted file mode 100644 index 0575b5ccdf..0000000000 --- a/packages/third-party/motion/dist/mini/mini.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import './polyfill/shim.js'; -import type { MainThreadRef } from '@lynx-js/react'; -export interface MotionValue { - get(): T; - set(v: T): void; - getVelocity(): number; - jump(v: T): void; - onChange(callback: (v: T) => void): () => void; - on(event: 'change', callback: (v: T) => void): () => void; - /** - * Internal method to update velocity, usually called by the animation loop. - */ - updateVelocity(v: number): void; -} -export declare function createMotionValue(initial: T): MotionValue; -export interface MotionValueEventCallbacks { - change: (v: V) => void; -} -export type Easing = (t: number) => number; -export interface AnimationOptions { - type?: 'spring' | 'keyframes' | 'decay'; - stiffness?: number; - damping?: number; - mass?: number; - duration?: number; - ease?: Easing; - from?: number; - to?: number; - velocity?: number; - onUpdate?: (v: number) => void; - onComplete?: () => void; -} -export declare const linear: Easing; -export declare const easeIn: Easing; -export declare const easeOut: Easing; -export declare const easeInOut: Easing; -export declare const circIn: Easing; -export declare const circOut: Easing; -export declare const circInOut: Easing; -export declare const backIn: Easing; -export declare const backOut: Easing; -export declare const backInOut: Easing; -export declare const anticipate: Easing; -export declare function animate(value: MotionValue | number | ((v: number) => void), target: number, options?: AnimationOptions): { - stop: () => void; - then: (cb: () => void) => Promise; - onFinish: () => void; -}; -export declare function useMotionValueRef(value: T): MainThreadRef>; -export declare function useMotionValueRefEvent>(valueRef: MainThreadRef>, event: 'change', callback: MotionValueEventCallbacks[EventName]): void; diff --git a/packages/third-party/motion/dist/mini/mini.js b/packages/third-party/motion/dist/mini/mini.js deleted file mode 100644 index fd531af86b..0000000000 --- a/packages/third-party/motion/dist/mini/mini.js +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -import { spring } from 'motion-dom' with { runtime: 'shared' }; -import './polyfill/shim.js'; -import { runOnMainThread, useEffect, useMainThreadRef, useMemo, } from '@lynx-js/react'; -import { runWorkletCtx } from '@lynx-js/react/worklet-runtime/bindings'; -function noopMT() { - 'main thread'; -} -export function createMotionValue(initial) { - 'main thread'; - class MotionValueImpl { - v; - velocity = 0; - listeners = new Set(); - lastUpdated = 0; - constructor(initial) { - this.v = initial; - } - get() { - return this.v; - } - set(v) { - const now = Date.now(); - if (typeof v === 'number' && typeof this.v === 'number') { - const delta = v - this.v; - const timeDelta = (now - this.lastUpdated) / 1000; - if (timeDelta > 0) { - // Simple instantaneous velocity - this.velocity = delta / timeDelta; - } - } - this.lastUpdated = now; - this.v = v; - this.notify(); - } - updateVelocity(v) { - this.velocity = v; - } - getVelocity() { - return this.velocity; - } - jump(v) { - this.v = v; - this.velocity = 0; - this.lastUpdated = Date.now(); - this.notify(); - } - onChange(callback) { - this.listeners.add(callback); - return () => this.listeners.delete(callback); - } - on(event, callback) { - if (event === 'change') { - return this.onChange(callback); - } - return noopMT; - } - notify() { - for (const cb of this.listeners) { - cb(this.v); - } - } - } - return new MotionValueImpl(initial); -} -// --- Easings --- -export const linear = t => t; -export const easeIn = t => t * t; -export const easeOut = t => t * (2 - t); -export const easeInOut = t => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; -export const circIn = t => 1 - Math.sin(Math.acos(t)); -export const circOut = t => Math.sin(Math.acos(t - 1)); -export const circInOut = t => t < 0.5 - ? (1 - Math.sqrt(1 - 4 * t * t)) / 2 - : (Math.sqrt(1 - (-2 * t + 2) ** 2) + 1) / 2; -export const backIn = t => t * t * ((1.70158 + 1) * t - 1.70158); -export const backOut = t => --t * t * ((1.70158 + 1) * t + 1.70158) + 1; -export const backInOut = t => { - const c1 = 1.70158; - const c2 = c1 * 1.525; - return t < 0.5 - ? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2 - : (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (2 * t - 2) + c2) + 2) / 2; -}; -export const anticipate = t => { - const s = 1.70158 * 1.525; - return (t *= 2) < 1 - ? 0.5 * (t * t * ((s + 1) * t - s)) - : 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2); -}; -// --- Animate --- -export function animate(value, target, options = {}) { - 'main thread'; - let currentV = 0; - let startVelocity = options.velocity ?? 0; - // Resolve start value - if (typeof value === 'number') { - currentV = value; - } - else if (typeof value === 'function') { - // If passed a setter, we can't easily read, assume 0 or options.from - currentV = options.from ?? 0; - } - else { - currentV = value.get(); - startVelocity = startVelocity || value.getVelocity(); - } - // If type is spring or no duration provided, default to spring. - // Unless ease is provided, then tween. - const isSpring = options.type === 'spring' - || (!options.ease && !options.duration && options.type !== 'keyframes'); - const { from: _from, to: _to, ...springOptions } = options; - // motion-dom spring() returns an animation generator with .next(t) - const solver = isSpring - ? spring({ - ...springOptions, - keyframes: [currentV, target], - velocity: startVelocity, - }) - : null; - const startTime = Date.now(); - let canceled = false; - const controls = { - stop: () => { - canceled = true; - }, - then: (cb) => { - controls.onFinish = cb; - return Promise.resolve(); // Mock promise return async/await usage - }, - onFinish: () => { }, - }; - const duration = options.duration ?? 0.3; - const ease = options.ease ?? easeOut; - const tick = () => { - if (canceled) - return; - const now = Date.now(); - const elapsed = (now - startTime) / 1000; // seconds - const elapsedMs = now - startTime; // milliseconds - let finished = false; - let current = 0; - if (isSpring && solver) { - // motion-dom spring generator expects time in milliseconds usually - const state = solver.next(elapsedMs); - current = state.value; - finished = state.done; - } - else { - // Tween - if (elapsed >= duration) { - finished = true; - current = target; - } - else { - const p = elapsed / duration; - const eased = ease(p); - current = currentV + (target - currentV) * eased; - } - } - // Determine how to update - if (typeof value === 'function') { - value(current); - } - else if (typeof value === 'object' && value.set) { - value.set(current); - } - if (options.onUpdate) { - options.onUpdate(current); - } - if (finished) { - // Ensure final frame is exact for tween - if (!isSpring) { - if (typeof value === 'function') { - value(target); - } - else if (typeof value === 'object' && value.set) { - value.set(target); - value.updateVelocity(0); - } - } - if (options.onComplete) { - options.onComplete(); - } - controls.onFinish(); - } - else { - requestAnimationFrame(tick); - } - }; - requestAnimationFrame(tick); - return controls; -} -export function useMotionValueRef(value) { - // @ts-expect-error expected - const motionValueRef = useMainThreadRef(); - useMemo(() => { - function setMotionValue(value) { - 'main thread'; - if (!motionValueRef.current) { - motionValueRef.current = createMotionValue(value); - } - } - if (__BACKGROUND__) { - void runOnMainThread(setMotionValue)(value); - } - else { - runWorkletCtx(setMotionValue, [ - value, - ]); - } - }, []); - return motionValueRef; -} -export function useMotionValueRefEvent(valueRef, event, callback) { - const unListenRef = useMainThreadRef(); - useEffect(() => { - void runOnMainThread(() => { - 'main thread'; - unListenRef.current = valueRef.current.on(event, callback); - })(); - return () => { - void runOnMainThread(() => { - 'main thread'; - unListenRef.current?.(); - })(); - }; - }, [callback]); -} -//# sourceMappingURL=mini.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/mini/mini.js.map b/packages/third-party/motion/dist/mini/mini.js.map deleted file mode 100644 index 602bdba321..0000000000 --- a/packages/third-party/motion/dist/mini/mini.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mini.js","sourceRoot":"","sources":["../../src/mini/mini.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC,OAAO,OAAO,EAAE,QAAQ,EAAE,CAAC;AAE/D,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EACL,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,OAAO,GACR,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,SAAS,MAAM;IACb,aAAa,CAAC;AAChB,CA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QAAiD;IAEjD,MAAM,WAAW,GAAG,gBAAgB,EAAc,CAAC;IAEnD,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,eAAe,CAAC,GAAG,EAAE;YACxB,aAAa,CAAC;YACd,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,GAAG,EAAE;YACV,KAAK,eAAe,CAAC,GAAG,EAAE;gBACxB,aAAa,CAAC;gBACd,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1B,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/shim.js b/packages/third-party/motion/dist/polyfill/shim.js index e8eebfefa1..c1b775767d 100644 --- a/packages/third-party/motion/dist/polyfill/shim.js +++ b/packages/third-party/motion/dist/polyfill/shim.js @@ -69,16 +69,17 @@ function shimGlobals() { if (__MAIN_THREAD__) { setupDocument(); shimGlobals(); -} else if (__DEV__) { - // Only shim queueMicrotask if it doesn't exist - // eslint-disable-next-line unicorn/no-lonely-if - if (!globalThis.queueMicrotask) { +} +else if (__DEV__) { + // Only shim queueMicrotask if it doesn't exist + // eslint-disable-next-line unicorn/no-lonely-if + if (!globalThis.queueMicrotask) { globalThis.queueMicrotask = (fn) => { void Promise.resolve().then(() => { // eslint-disable-next-line @typescript-eslint/no-unsafe-call fn(); }); }; - } + } } -//# sourceMappingURL=shim.js.map +//# sourceMappingURL=shim.js.map \ No newline at end of file diff --git a/packages/third-party/motion/package.json b/packages/third-party/motion/package.json index 93d6e0759a..4b564d462d 100644 --- a/packages/third-party/motion/package.json +++ b/packages/third-party/motion/package.json @@ -1,7 +1,7 @@ { "name": "@lynx-js/motion-lynx", "version": "0.0.1", - "private": true, + "private": false, "description": "This is a motion adapter for Lynx.js", "keywords": [ "react", @@ -16,20 +16,21 @@ }, "license": "MIT", "sideEffects": [ - "./src/polyfill/shim.ts" + "./src/polyfill/shim.ts", + "./dist/polyfill/shim.js" ], "type": "module", "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js", - "require": "./dist/index.cjs", + "require": "./dist/index.js", "default": "./dist/index.js" }, "./mini": { "types": "./dist/mini/index.d.ts", "import": "./dist/mini/index.js", - "require": "./dist/mini/index.cjs", + "require": "./dist/mini/index.js", "default": "./dist/mini/index.js" } }, diff --git a/packages/third-party/motion/src/mini/index.ts b/packages/third-party/motion/src/mini/index.ts index 3de224fdd1..419424a8cc 100644 --- a/packages/third-party/motion/src/mini/index.ts +++ b/packages/third-party/motion/src/mini/index.ts @@ -1,7 +1,9 @@ // Copyright 2025 The Lynx Authors. All rights reserved. // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. -import { spring as spring_ } from 'motion-dom' with { runtime: 'shared' }; +import '../polyfill/shim.js'; + +import { spring as spring_ } from 'motion-dom'; import { runOnMainThread, @@ -17,7 +19,6 @@ import type { import { runWorkletCtx } from '@lynx-js/react/worklet-runtime/bindings'; import { registerCallable } from '../utils/registeredFunction.js'; -import '../polyfill/shim.js'; function noopMT() { 'main thread'; @@ -27,6 +28,8 @@ let springHandle = 'springHandle'; if (__MAIN_THREAD__) { springHandle = registerCallable(spring_, 'springHandle'); +} else { + console.log('ohmyoh bts'); } export function spring( @@ -50,6 +53,11 @@ export interface MotionValue { * Internal method to update velocity, usually called by the animation loop. */ updateVelocity(v: number): void; + stop(): void; + /** + * @internal + */ + attach(cancel: () => void): () => void; } export function createMotionValue(initial: T): MotionValue { @@ -58,6 +66,7 @@ export function createMotionValue(initial: T): MotionValue { v: T; velocity = 0; listeners = new Set<(v: T) => void>(); + activeAnimations = new Set<() => void>(); lastUpdated = 0; constructor(initial: T) { @@ -115,6 +124,22 @@ export function createMotionValue(initial: T): MotionValue { cb(this.v); } } + + attach(cancel: () => void) { + this.activeAnimations.add(cancel); + return () => this.activeAnimations.delete(cancel); + } + + stop() { + for (const cancel of this.activeAnimations) { + cancel(); + } + this.activeAnimations.clear(); + } + + toJSON() { + return String(this.v); + } } return new MotionValueImpl(initial); @@ -192,6 +217,9 @@ export function animate( } else { currentV = value.get(); startVelocity = startVelocity || value.getVelocity(); + if (value.stop) { + value.stop(); + } } // If type is spring or no duration provided, default to spring. @@ -227,6 +255,14 @@ export function animate( const duration = options.duration ?? 0.3; const ease = options.ease ?? easeOut; + let detach: (() => void) | undefined; + if ( + typeof value === 'object' && value && 'attach' in value + && typeof value.attach === 'function' + ) { + detach = value.attach(controls.stop); + } + const tick = () => { if (canceled) return; @@ -280,6 +316,7 @@ export function animate( options.onComplete(); } controls.onFinish(); + detach?.(); } else { requestAnimationFrame(tick); } From 7c08daa09b2ef5a93e74859f4b50914b09c90c39 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Thu, 8 Jan 2026 21:37:24 +0800 Subject: [PATCH 16/37] chore: update dist artifacts after merge --- packages/third-party/motion/dist/animation/index.js.map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/third-party/motion/dist/animation/index.js.map b/packages/third-party/motion/dist/animation/index.js.map index d0788b4ba2..27e5204b2a 100644 --- a/packages/third-party/motion/dist/animation/index.js.map +++ b/packages/third-party/motion/dist/animation/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,qBAAqB,CAAC;AAE7B,WAAW;AACX,4BAA4B;AAC5B,wBAAwB;AACxB,8BAA8B;AAC9B,4BAA4B;AAC5B,8BAA8B;AAC9B,gBAAgB;AAChB,uBAAuB;AACvB,kBAAkB;AAClB,qBAAqB;AACrB,8BAA8B;AAC9B,WAAW;AACX,8BAA8B;AAC9B,oBAA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QAAQ,CAAC,IAAY,EAAE,EAAU,EAAE,KAAa;IACvD,aAAa,CAAC;IACd,OAAO,YAAY,CACjB,IAAI,EACJ,EAAE,EACF,KAAK,CACN,CAAC;AACJ,CAAC;AAED,SAAS,KAAK,CAAC,GAAW,EAAE,GAAW,EAAE,CAAS;IAChD,aAAa,CAAC;IACd,OAAO,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,QAAQ,CACf,UAA+B,EAC/B,UAAyB,EACzB,WAAgB,EAChB,OAA6B;IAE7B,aAAa,CAAC;IACd,OAAO,YAAY,CACjB,UAAU,EACV,UAAU,EACV,WAAW,EACX,OAAO,CACR,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAI,SAAkB;IAC3C,aAAa,CAAC;IACd,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,WAAW,CAClB,OAAmC,EACnC,MAAmC;IAEnC,aAAa,CAAC;IACd,MAAM,QAAQ,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,eAAe,CACpB,QAAQ,EACR,MAAM,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AAEnC,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,GACZ,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,qBAAqB,CAAC;A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,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,GACZ,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,CAAC"} \ No newline at end of file From 41f9f85c786c942db441bd16aa130665c3cea5bb Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Thu, 8 Jan 2026 21:38:11 +0800 Subject: [PATCH 17/37] feat: remove dist --- packages/third-party/motion/.gitignore | 1 - .../motion/__tests__/animation.test.d.ts | 1 - .../motion/__tests__/animation.test.js | 79 ------ .../motion/__tests__/animation.test.js.map | 1 - .../motion/dist/animation/index.d.ts | 49 ---- .../motion/dist/animation/index.js | 119 -------- .../motion/dist/animation/index.js.map | 1 - .../motion/dist/hooks/useMotionEvent.d.ts | 3 - .../motion/dist/hooks/useMotionEvent.js | 17 -- .../motion/dist/hooks/useMotionEvent.js.map | 1 - .../motion/dist/hooks/useMotionValueRef.d.ts | 3 - .../motion/dist/hooks/useMotionValueRef.js | 25 -- .../dist/hooks/useMotionValueRef.js.map | 1 - packages/third-party/motion/dist/index.d.ts | 3 - packages/third-party/motion/dist/index.js | 6 - packages/third-party/motion/dist/index.js.map | 1 - .../third-party/motion/dist/mini/index.d.ts | 53 ---- .../third-party/motion/dist/mini/index.js | 268 ------------------ .../third-party/motion/dist/mini/index.js.map | 1 - .../motion/dist/modified/motionValue.d.ts | 3 - .../motion/dist/modified/motionValue.js | 13 - .../motion/dist/modified/motionValue.js.map | 1 - .../motion/dist/polyfill/MotionValue.d.ts | 1 - .../motion/dist/polyfill/MotionValue.js | 16 -- .../motion/dist/polyfill/MotionValue.js.map | 1 - .../motion/dist/polyfill/element.d.ts | 50 ---- .../motion/dist/polyfill/element.js | 166 ----------- .../motion/dist/polyfill/element.js.map | 1 - .../motion/dist/polyfill/shim.d.ts | 1 - .../third-party/motion/dist/polyfill/shim.js | 85 ------ .../motion/dist/polyfill/shim.js.map | 1 - .../third-party/motion/dist/types/index.d.ts | 2 - .../third-party/motion/dist/types/index.js | 5 - .../motion/dist/types/index.js.map | 1 - .../motion/dist/utils/elementHelper.d.ts | 3 - .../motion/dist/utils/elementHelper.js | 22 -- .../motion/dist/utils/elementHelper.js.map | 1 - .../dist/utils/isMainThreadElement.d.ts | 3 - .../motion/dist/utils/isMainThreadElement.js | 15 - .../dist/utils/isMainThreadElement.js.map | 1 - .../third-party/motion/dist/utils/noop.d.ts | 1 - .../third-party/motion/dist/utils/noop.js | 5 - .../third-party/motion/dist/utils/noop.js.map | 1 - .../motion/dist/utils/registeredFunction.d.ts | 5 - .../motion/dist/utils/registeredFunction.js | 17 -- .../dist/utils/registeredFunction.js.map | 1 - 46 files changed, 1055 deletions(-) delete mode 100644 packages/third-party/motion/.gitignore delete mode 100644 packages/third-party/motion/__tests__/animation.test.d.ts delete mode 100644 packages/third-party/motion/__tests__/animation.test.js delete mode 100644 packages/third-party/motion/__tests__/animation.test.js.map delete mode 100644 packages/third-party/motion/dist/animation/index.d.ts delete mode 100644 packages/third-party/motion/dist/animation/index.js delete mode 100644 packages/third-party/motion/dist/animation/index.js.map delete mode 100644 packages/third-party/motion/dist/hooks/useMotionEvent.d.ts delete mode 100644 packages/third-party/motion/dist/hooks/useMotionEvent.js delete mode 100644 packages/third-party/motion/dist/hooks/useMotionEvent.js.map delete mode 100644 packages/third-party/motion/dist/hooks/useMotionValueRef.d.ts delete mode 100644 packages/third-party/motion/dist/hooks/useMotionValueRef.js delete mode 100644 packages/third-party/motion/dist/hooks/useMotionValueRef.js.map delete mode 100644 packages/third-party/motion/dist/index.d.ts delete mode 100644 packages/third-party/motion/dist/index.js delete mode 100644 packages/third-party/motion/dist/index.js.map delete mode 100644 packages/third-party/motion/dist/mini/index.d.ts delete mode 100644 packages/third-party/motion/dist/mini/index.js delete mode 100644 packages/third-party/motion/dist/mini/index.js.map delete mode 100644 packages/third-party/motion/dist/modified/motionValue.d.ts delete mode 100644 packages/third-party/motion/dist/modified/motionValue.js delete mode 100644 packages/third-party/motion/dist/modified/motionValue.js.map delete mode 100644 packages/third-party/motion/dist/polyfill/MotionValue.d.ts delete mode 100644 packages/third-party/motion/dist/polyfill/MotionValue.js delete mode 100644 packages/third-party/motion/dist/polyfill/MotionValue.js.map delete mode 100644 packages/third-party/motion/dist/polyfill/element.d.ts delete mode 100644 packages/third-party/motion/dist/polyfill/element.js delete mode 100644 packages/third-party/motion/dist/polyfill/element.js.map delete mode 100644 packages/third-party/motion/dist/polyfill/shim.d.ts delete mode 100644 packages/third-party/motion/dist/polyfill/shim.js delete mode 100644 packages/third-party/motion/dist/polyfill/shim.js.map delete mode 100644 packages/third-party/motion/dist/types/index.d.ts delete mode 100644 packages/third-party/motion/dist/types/index.js delete mode 100644 packages/third-party/motion/dist/types/index.js.map delete mode 100644 packages/third-party/motion/dist/utils/elementHelper.d.ts delete mode 100644 packages/third-party/motion/dist/utils/elementHelper.js delete mode 100644 packages/third-party/motion/dist/utils/elementHelper.js.map delete mode 100644 packages/third-party/motion/dist/utils/isMainThreadElement.d.ts delete mode 100644 packages/third-party/motion/dist/utils/isMainThreadElement.js delete mode 100644 packages/third-party/motion/dist/utils/isMainThreadElement.js.map delete mode 100644 packages/third-party/motion/dist/utils/noop.d.ts delete mode 100644 packages/third-party/motion/dist/utils/noop.js delete mode 100644 packages/third-party/motion/dist/utils/noop.js.map delete mode 100644 packages/third-party/motion/dist/utils/registeredFunction.d.ts delete mode 100644 packages/third-party/motion/dist/utils/registeredFunction.js delete mode 100644 packages/third-party/motion/dist/utils/registeredFunction.js.map diff --git a/packages/third-party/motion/.gitignore b/packages/third-party/motion/.gitignore deleted file mode 100644 index 586e3d7af5..0000000000 --- a/packages/third-party/motion/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!dist \ No newline at end of file diff --git a/packages/third-party/motion/__tests__/animation.test.d.ts b/packages/third-party/motion/__tests__/animation.test.d.ts deleted file mode 100644 index cb0ff5c3b5..0000000000 --- a/packages/third-party/motion/__tests__/animation.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/third-party/motion/__tests__/animation.test.js b/packages/third-party/motion/__tests__/animation.test.js deleted file mode 100644 index ed384eaa51..0000000000 --- a/packages/third-party/motion/__tests__/animation.test.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; - -import { runOnMainThread, useMainThreadRef } from '@lynx-js/react'; -import { jsx as _jsx } from '@lynx-js/react/jsx-runtime'; -import { act, render } from '@lynx-js/react/testing-library'; - -import { animate } from '../src/index.js'; -import { noop } from '../src/utils/noop.js'; - -describe('motion wrapping animation functions', () => { - let _mockRegisterCallable; - beforeEach(() => { - const mockRegisteredMap = new Map(); - vi.spyOn(globalThis, 'runOnRegistered', 'get').mockImplementation( - function(id) { - const func = mockRegisteredMap.get(id) ?? noop; - return func; - }, - ); - function mockRegisterCallable(func, id) { - mockRegisteredMap.set(id, func); - return func; - } - _mockRegisterCallable = mockRegisterCallable; - }); - afterEach(() => { - vi.restoreAllMocks(); - }); - test('motion animate should be called', async () => { - let _startAnimation; - const _mockAnimate = _mockRegisterCallable(vi.fn(), 'animate'); - const App = () => { - const boxMTRef = useMainThreadRef(null); - console.log('renderApp'); - function startAnimation() { - 'main thread'; - if (boxMTRef.current) { - animate(boxMTRef.current, { scale: 0.4, rotate: '45deg' }, { - ease: 'circInOut', - duration: 1, - repeat: Number.POSITIVE_INFINITY, - repeatType: 'reverse', - }); - } - } - _startAnimation = startAnimation; - return (_jsx('view', { - children: _jsx('view', { 'main-thread:ref': boxMTRef }), - })); - }; - await act(() => { - render(_jsx(App, {}), { - enableMainThread: true, - enableBackgroundThread: true, - }); - }); - await runOnMainThread(() => { - 'main thread'; - _startAnimation(); - })(); - // Check that the mock was called - expect(_mockAnimate).toHaveBeenCalled(); - // You can also check what arguments it received - expect(_mockAnimate).toHaveBeenCalledWith( - expect.anything(), // the element - { scale: 0.4, rotate: '45deg' }, - { - ease: 'circInOut', - duration: 1, - repeat: Number.POSITIVE_INFINITY, - repeatType: 'reverse', - }, - ); - }); -}); -// # sourceMappingURL=animation.test.js.map diff --git a/packages/third-party/motion/__tests__/animation.test.js.map b/packages/third-party/motion/__tests__/animation.test.js.map deleted file mode 100644 index e8086a62ec..0000000000 --- a/packages/third-party/motion/__tests__/animation.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"animation.test.js","sourceRoot":"","sources":["animation.test.tsx"],"names":[],"mappings":";AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,IAAI,qBAAqB,CAAC;IAC1B,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAA4B,CAAC;QAC9D,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAC,kBAAkB,CAAC,UAChE,EAAU;YAEV,MAAM,IAAI,GAAG,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;YAC/C,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,SAAS,oBAAoB,CAC3B,IAAsB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GAAG,EAAE;YACzB,aAAa,CAAC;YACd,eAAe,EAAE,CAAC;QACpB,CAAC,CAAC,EAAE,CAAC;QAEL,iCAAiC;QACjC,MAAM,CAAC,YAAY,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAExC,gDAAgD;QAChD,MAAM,CAAC,YAAY,CAAC,CAAC,oBAAoB,CACvC,MAAM,CAAC,QAAQ,EAAE,EAAE,cAAc;QACjC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,EAC/B;YACE,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE,CAAC;YACX,MAAM,EAAE,MAAM,CAAC,iBAAiB;YAChC,UAAU,EAAE,SAAS;SACtB,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/animation/index.d.ts b/packages/third-party/motion/dist/animation/index.d.ts deleted file mode 100644 index befe221615..0000000000 --- a/packages/third-party/motion/dist/animation/index.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -import '../polyfill/shim.js'; -import { stagger as staggerOrig } from 'framer-motion/dom'; -import type { AnimationSequence, ObjectTarget, SequenceOptions } from 'framer-motion/dom'; -import { spring as springOrig } from 'motion-dom'; -import type { AnimationOptions, AnimationPlaybackControlsWithThen, AnyResolvedKeyframe, DOMKeyframesDefinition, MapInputRange, Mixer, MotionValue, MotionValueOptions, SpringOptions, TransformOptions, UnresolvedValueKeyframe, ValueAnimationTransition } from 'motion-dom'; -import { useMotionValueRefEvent } from '../hooks/useMotionEvent.js'; -import type { ElementOrElements } from '../types/index.js'; -/** - * Animate a sequence - */ -declare function animate(sequence: AnimationSequence, options?: SequenceOptions): AnimationPlaybackControlsWithThen; -/** - * Animate a string - */ -declare function animate(value: string, keyframes: DOMKeyframesDefinition, options?: AnimationOptions): AnimationPlaybackControlsWithThen; -/** - * Animate a string - */ -declare function animate(value: string | MotionValue, keyframes: string | UnresolvedValueKeyframe[], options?: ValueAnimationTransition): AnimationPlaybackControlsWithThen; -/** - * Animate a number - */ -declare function animate(value: number | MotionValue, keyframes: number | UnresolvedValueKeyframe[], options?: ValueAnimationTransition): AnimationPlaybackControlsWithThen; -/** - * Animate a generic motion value - */ -declare function animate(value: V | MotionValue, keyframes: V | UnresolvedValueKeyframe[], options?: ValueAnimationTransition): AnimationPlaybackControlsWithThen; -/** - * Animate an object - */ -declare function animate(object: O | O[], keyframes: ObjectTarget, options?: AnimationOptions): AnimationPlaybackControlsWithThen; -/** - * Animate a main thread element - */ -declare function animate(value: ElementOrElements, keyframes: DOMKeyframesDefinition, options?: AnimationOptions): AnimationPlaybackControlsWithThen; -declare function stagger(...args: Parameters): ReturnType; -declare function motionValue(init: V, options?: MotionValueOptions): MotionValue; -declare function spring(...args: Parameters): ReturnType; -declare function springValue(source: T | MotionValue, options?: SpringOptions): MotionValue; -declare function mix(from: T, to: T): Mixer; -declare function mix(from: number, to: number, p: number): number; -declare function progress(from: number, to: number, value: number): number; -declare function clamp(min: number, max: number, v: number): number; -declare function mapValue(inputValue: MotionValue, inputRange: MapInputRange, outputRange: O[], options?: TransformOptions): MotionValue; -declare function transformValue(transform: () => O): MotionValue; -declare function styleEffect(subject: string | ElementOrElements, values: Record): () => void; -export declare const noop: () => void; -export { animate, stagger, motionValue, spring, springValue, mix, progress, mapValue, clamp, transformValue, styleEffect, }; -export { useMotionValueRefEvent }; diff --git a/packages/third-party/motion/dist/animation/index.js b/packages/third-party/motion/dist/animation/index.js deleted file mode 100644 index d9e2c2f7f3..0000000000 --- a/packages/third-party/motion/dist/animation/index.js +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2024 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -import '../polyfill/shim.js'; -// import { -// animate as animateOrig, -// clamp as clampOrig, -// progress as progressOrig, -// stagger as staggerOrig, -// } from 'framer-motion/dom'; -// import type { -// AnimationSequence, -// ObjectTarget, -// SequenceOptions, -// } from 'framer-motion/dom'; -// import { -// mapValue as mapValueOrig, -// mix as mixOrig, -// spring as springOrig, -// springValue as springValueOrig, -// styleEffect as styleEffectOrig, -// transformValue as transformValueOrig, -// } from 'motion-dom'; -import { animate as animateOrig, clamp as clampOrig, progress as progressOrig, stagger as staggerOrig, } from 'framer-motion/dom' with { runtime: 'shared' }; -import { mapValue as mapValueOrig, mix as mixOrig, spring as springOrig, springValue as springValueOrig, styleEffect as styleEffectOrig, transformValue as transformValueOrig, } from 'motion-dom' with { runtime: 'shared' }; -import { useMotionValueRefEvent } from '../hooks/useMotionEvent.js'; -import { ElementCompt } from '../polyfill/element.js' with { runtime: 'shared' }; -import { motionValue as motionValueOrig } from '../polyfill/MotionValue.js' with { runtime: 'shared' }; -import { elementOrSelector2Dom } from '../utils/elementHelper.js'; -import { isMainThreadElement, isMainThreadElementArray, } from '../utils/isMainThreadElement.js'; -function animate(subjectOrSequence, optionsOrKeyframes, options) { - 'main thread'; - let realSubjectOrSequence; - if (typeof subjectOrSequence === 'string' - || isMainThreadElement(subjectOrSequence) - || isMainThreadElementArray(subjectOrSequence)) { - let elementNodes; - if (typeof subjectOrSequence === 'string') { - elementNodes = lynx.querySelectorAll(subjectOrSequence); - } - else { - elementNodes = subjectOrSequence; - } - console.log('elementNodes', elementNodes); - realSubjectOrSequence = (Array.isArray(elementNodes) - ? elementNodes.map(el => new ElementCompt(el)) - : new ElementCompt(elementNodes)); - } - else { - realSubjectOrSequence = subjectOrSequence; - } - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return animateOrig( - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - realSubjectOrSequence, - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - optionsOrKeyframes, - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - options); -} -function stagger(...args) { - 'main thread'; - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return staggerOrig(...args); -} -function motionValue(init, options) { - 'main thread'; - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return motionValueOrig(init, options); -} -function spring(...args) { - 'main thread'; - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return springOrig(...args); -} -function springValue(source, options) { - 'main thread'; - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return springValueOrig(source, options); -} -function mix(from, to, p) { - 'main thread'; - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return mixOrig( - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - from, - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - to, - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - p); -} -function progress(from, to, value) { - 'main thread'; - return progressOrig(from, to, value); -} -function clamp(min, max, v) { - 'main thread'; - return clampOrig(min, max, v); -} -function mapValue(inputValue, inputRange, outputRange, options) { - 'main thread'; - return mapValueOrig(inputValue, inputRange, outputRange, options); -} -function transformValue(transform) { - 'main thread'; - return transformValueOrig(transform); -} -function styleEffect(subject, values) { - 'main thread'; - const elements = elementOrSelector2Dom(subject); - if (!elements) { - return () => { }; - } - return styleEffectOrig(elements, values); -} -export const noop = () => { }; -export { animate, stagger, motionValue, spring, springValue, mix, progress, mapValue, clamp, transformValue, styleEffect, }; -export { useMotionValueRefEvent }; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/animation/index.js.map b/packages/third-party/motion/dist/animation/index.js.map deleted file mode 100644 index 27e5204b2a..0000000000 --- a/packages/third-party/motion/dist/animation/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,qBAAqB,CAAC;AAE7B,WAAW;AACX,4BAA4B;AAC5B,wBAAwB;AACxB,8BAA8B;AAC9B,4BAA4B;AAC5B,8BAA8B;AAC9B,gBAAgB;AAChB,uBAAuB;AACvB,kBAAkB;AAClB,qBAAqB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dist/hooks/useMotionEvent.d.ts b/packages/third-party/motion/dist/hooks/useMotionEvent.d.ts deleted file mode 100644 index 291bac4937..0000000000 --- a/packages/third-party/motion/dist/hooks/useMotionEvent.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { MotionValue, MotionValueEventCallbacks } from 'motion-dom'; -import type { MainThreadRef } from '@lynx-js/react'; -export declare function useMotionValueRefEvent>(valueRef: MainThreadRef>, event: 'change', callback: MotionValueEventCallbacks[EventName]): void; diff --git a/packages/third-party/motion/dist/hooks/useMotionEvent.js b/packages/third-party/motion/dist/hooks/useMotionEvent.js deleted file mode 100644 index 7f7d94afbe..0000000000 --- a/packages/third-party/motion/dist/hooks/useMotionEvent.js +++ /dev/null @@ -1,17 +0,0 @@ -import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; -export function useMotionValueRefEvent(valueRef, event, callback) { - const unListenRef = useMainThreadRef(); - useEffect(() => { - void runOnMainThread(() => { - 'main thread'; - unListenRef.current = valueRef.current.on(event, callback); - })(); - return () => { - void runOnMainThread(() => { - 'main thread'; - unListenRef.current?.(); - })(); - }; - }, [callback]); -} -//# sourceMappingURL=useMotionEvent.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/hooks/useMotionEvent.js.map b/packages/third-party/motion/dist/hooks/useMotionEvent.js.map deleted file mode 100644 index e30b101148..0000000000 --- a/packages/third-party/motion/dist/hooks/useMotionEvent.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"useMotionEvent.js","sourceRoot":"","sources":["../../src/hooks/useMotionEvent.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAG9E,MAAM,UAAU,sBAAsB,CAIpC,QAAuC,EACvC,KAAe,EACf,QAAiD;IAEjD,MAAM,WAAW,GAAG,gBAAgB,EAAgB,CAAC;IAErD,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,eAAe,CAAC,GAAG,EAAE;YACxB,aAAa,CAAC;YACd,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,GAAG,EAAE;YACV,KAAK,eAAe,CAAC,GAAG,EAAE;gBACxB,aAAa,CAAC;gBACd,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1B,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/hooks/useMotionValueRef.d.ts b/packages/third-party/motion/dist/hooks/useMotionValueRef.d.ts deleted file mode 100644 index 8adc9a4f9a..0000000000 --- a/packages/third-party/motion/dist/hooks/useMotionValueRef.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { MotionValue } from 'motion-dom'; -import type { MainThreadRef } from '@lynx-js/react'; -export declare function useMotionValueRef(value: T): MainThreadRef>; diff --git a/packages/third-party/motion/dist/hooks/useMotionValueRef.js b/packages/third-party/motion/dist/hooks/useMotionValueRef.js deleted file mode 100644 index 9de7410ebc..0000000000 --- a/packages/third-party/motion/dist/hooks/useMotionValueRef.js +++ /dev/null @@ -1,25 +0,0 @@ -import { runOnMainThread, useMainThreadRef, useMemo } from '@lynx-js/react'; -import { runWorkletCtx } from '@lynx-js/react/worklet-runtime/bindings'; -import { motionValue } from '../animation/index.js'; -export function useMotionValueRef(value) { - // @ts-expect-error expected - const motionValueRef = useMainThreadRef(); - useMemo(() => { - function setMotionValue(value) { - 'main thread'; - if (!motionValueRef.current) { - motionValueRef.current = motionValue(value); - } - } - if (__BACKGROUND__) { - void runOnMainThread(setMotionValue)(value); - } - else { - runWorkletCtx(setMotionValue, [ - value, - ]); - } - }, []); - return motionValueRef; -} -//# sourceMappingURL=useMotionValueRef.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/hooks/useMotionValueRef.js.map b/packages/third-party/motion/dist/hooks/useMotionValueRef.js.map deleted file mode 100644 index 794e3c0925..0000000000 --- a/packages/third-party/motion/dist/hooks/useMotionValueRef.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"useMotionValueRef.js","sourceRoot":"","sources":["../../src/hooks/useMotionValueRef.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE5E,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAMxE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,UAAU,iBAAiB,CAAI,KAAQ;IAC3C,4BAA4B;IAC5B,MAAM,cAAc,GAAkC,gBAAgB,EAEnE,CAAC;IAEJ,OAAO,CAAC,GAAG,EAAE;QACX,SAAS,cAAc,CAAC,KAAQ;YAC9B,aAAa,CAAC;YACd,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;gBAC5B,cAAc,CAAC,OAAO,GAAG,WAAW,CAAI,KAAK,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;QACD,IAAI,cAAc,EAAE,CAAC;YACnB,KAAK,eAAe,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,aAAa,CAAC,cAAoC,EAAE;gBAClD,KAA4B;aAC7B,CAAC,CAAC;QACL,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,cAAc,CAAC;AACxB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/index.d.ts b/packages/third-party/motion/dist/index.d.ts deleted file mode 100644 index 18ee100860..0000000000 --- a/packages/third-party/motion/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { animate, stagger, motionValue, spring, springValue, mix, progress, mapValue, clamp, transformValue, styleEffect, noop, useMotionValueRefEvent, } from './animation/index.js'; -export { useMotionValueRef } from './hooks/useMotionValueRef.js'; -export type { MotionValue } from 'motion-dom'; diff --git a/packages/third-party/motion/dist/index.js b/packages/third-party/motion/dist/index.js deleted file mode 100644 index 154b1db015..0000000000 --- a/packages/third-party/motion/dist/index.js +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -export { animate, stagger, motionValue, spring, springValue, mix, progress, mapValue, clamp, transformValue, styleEffect, noop, useMotionValueRefEvent, } from './animation/index.js'; -export { useMotionValueRef } from './hooks/useMotionValueRef.js'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/index.js.map b/packages/third-party/motion/dist/index.js.map deleted file mode 100644 index c931ef0963..0000000000 --- a/packages/third-party/motion/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,cAAc,EACd,WAAW,EACX,IAAI,EACJ,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/mini/index.d.ts b/packages/third-party/motion/dist/mini/index.d.ts deleted file mode 100644 index 2559c4b39d..0000000000 --- a/packages/third-party/motion/dist/mini/index.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import '../polyfill/shim.js'; -import { spring as spring_ } from 'motion-dom'; -import type { MainThreadRef } from '@lynx-js/react'; -export declare function spring(...args: Parameters): ReturnType; -export interface MotionValue { - get(): T; - set(v: T): void; - getVelocity(): number; - jump(v: T): void; - onChange(callback: (v: T) => void): () => void; - on(event: 'change', callback: (v: T) => void): () => void; - /** - * Internal method to update velocity, usually called by the animation loop. - */ - updateVelocity(v: number): void; - stop(): void; -} -export declare function createMotionValue(initial: T): MotionValue; -export interface MotionValueEventCallbacks { - change: (v: V) => void; -} -export type Easing = (t: number) => number; -export interface AnimationOptions { - type?: 'spring' | 'keyframes' | 'decay'; - stiffness?: number; - damping?: number; - mass?: number; - duration?: number; - ease?: Easing; - from?: number; - to?: number; - velocity?: number; - onUpdate?: (v: number) => void; - onComplete?: () => void; -} -export declare const linear: Easing; -export declare const easeIn: Easing; -export declare const easeOut: Easing; -export declare const easeInOut: Easing; -export declare const circIn: Easing; -export declare const circOut: Easing; -export declare const circInOut: Easing; -export declare const backIn: Easing; -export declare const backOut: Easing; -export declare const backInOut: Easing; -export declare const anticipate: Easing; -export declare function animate(value: MotionValue | number | ((v: number) => void), target: number, options?: AnimationOptions): { - stop: () => void; - then: (cb: () => void) => Promise; - onFinish: () => void; -}; -export declare function useMotionValueRef(value: T): MainThreadRef>; -export declare function useMotionValueRefEvent>(valueRef: MainThreadRef>, event: 'change', callback: MotionValueEventCallbacks[EventName]): void; diff --git a/packages/third-party/motion/dist/mini/index.js b/packages/third-party/motion/dist/mini/index.js deleted file mode 100644 index 90384f78ca..0000000000 --- a/packages/third-party/motion/dist/mini/index.js +++ /dev/null @@ -1,268 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -import '../polyfill/shim.js'; -import { spring as spring_ } from 'motion-dom'; -import { runOnMainThread, useEffect, useMainThreadRef, useMemo, } from '@lynx-js/react'; -import { runWorkletCtx } from '@lynx-js/react/worklet-runtime/bindings'; -import { registerCallable } from '../utils/registeredFunction.js'; -function noopMT() { - 'main thread'; -} -let springHandle = 'springHandle'; -if (__MAIN_THREAD__) { - springHandle = registerCallable(spring_, 'springHandle'); -} -else { - console.log('ohmyoh bts'); -} -export function spring(...args) { - 'main thread'; - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(springHandle)(...args); -} -export function createMotionValue(initial) { - 'main thread'; - class MotionValueImpl { - v; - velocity = 0; - listeners = new Set(); - activeAnimations = new Set(); - lastUpdated = 0; - constructor(initial) { - this.v = initial; - } - get() { - return this.v; - } - set(v) { - const now = Date.now(); - if (typeof v === 'number' && typeof this.v === 'number') { - const delta = v - this.v; - const timeDelta = (now - this.lastUpdated) / 1000; - if (timeDelta > 0) { - // Simple instantaneous velocity - this.velocity = delta / timeDelta; - } - } - this.lastUpdated = now; - this.v = v; - this.notify(); - } - updateVelocity(v) { - this.velocity = v; - } - getVelocity() { - return this.velocity; - } - jump(v) { - this.v = v; - this.velocity = 0; - this.lastUpdated = Date.now(); - this.notify(); - } - onChange(callback) { - this.listeners.add(callback); - return () => this.listeners.delete(callback); - } - on(event, callback) { - if (event === 'change') { - return this.onChange(callback); - } - return noopMT; - } - notify() { - for (const cb of this.listeners) { - cb(this.v); - } - } - attach(cancel) { - this.activeAnimations.add(cancel); - return () => this.activeAnimations.delete(cancel); - } - stop() { - for (const cancel of this.activeAnimations) { - cancel(); - } - this.activeAnimations.clear(); - } - toJSON() { - return String(this.v); - } - } - return new MotionValueImpl(initial); -} -// --- Easings --- -export const linear = t => t; -export const easeIn = t => t * t; -export const easeOut = t => t * (2 - t); -export const easeInOut = t => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; -export const circIn = t => 1 - Math.sin(Math.acos(t)); -export const circOut = t => Math.sin(Math.acos(t - 1)); -export const circInOut = t => t < 0.5 - ? (1 - Math.sqrt(1 - 4 * t * t)) / 2 - : (Math.sqrt(1 - (-2 * t + 2) ** 2) + 1) / 2; -export const backIn = t => t * t * ((1.70158 + 1) * t - 1.70158); -export const backOut = t => --t * t * ((1.70158 + 1) * t + 1.70158) + 1; -export const backInOut = t => { - const c1 = 1.70158; - const c2 = c1 * 1.525; - return t < 0.5 - ? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2 - : (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (2 * t - 2) + c2) + 2) / 2; -}; -export const anticipate = t => { - const s = 1.70158 * 1.525; - return (t *= 2) < 1 - ? 0.5 * (t * t * ((s + 1) * t - s)) - : 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2); -}; -// --- Animate --- -export function animate(value, target, options = {}) { - 'main thread'; - let currentV = 0; - let startVelocity = options.velocity ?? 0; - // Resolve start value - if (typeof value === 'number') { - currentV = value; - } - else if (typeof value === 'function') { - // If passed a setter, we can't easily read, assume 0 or options.from - currentV = options.from ?? 0; - } - else { - currentV = value.get(); - startVelocity = startVelocity || value.getVelocity(); - if (value.stop) { - value.stop(); - } - } - // If type is spring or no duration provided, default to spring. - // Unless ease is provided, then tween. - const isSpring = options.type === 'spring' - || (!options.ease && !options.duration && options.type !== 'keyframes'); - const { from: _from, to: _to, ...springOptions } = options; - // motion-dom spring() returns an animation generator with .next(t) - const solver = isSpring - ? spring({ - ...springOptions, - keyframes: [currentV, target], - velocity: startVelocity, - }) - : null; - const startTime = Date.now(); - let canceled = false; - const controls = { - stop: () => { - canceled = true; - }, - then: (cb) => { - controls.onFinish = cb; - return Promise.resolve(); // Mock promise return async/await usage - }, - onFinish: () => { }, - }; - const duration = options.duration ?? 0.3; - const ease = options.ease ?? easeOut; - let detach; - if (typeof value === 'object' && value && 'attach' in value - && typeof value.attach === 'function') { - detach = value.attach(controls.stop); - } - const tick = () => { - if (canceled) - return; - const now = Date.now(); - const elapsed = (now - startTime) / 1000; // seconds - const elapsedMs = now - startTime; // milliseconds - let finished = false; - let current = 0; - if (isSpring && solver) { - // motion-dom spring generator expects time in milliseconds usually - const state = solver.next(elapsedMs); - current = state.value; - finished = state.done; - } - else { - // Tween - if (elapsed >= duration) { - finished = true; - current = target; - } - else { - const p = elapsed / duration; - const eased = ease(p); - current = currentV + (target - currentV) * eased; - } - } - // Determine how to update - if (typeof value === 'function') { - value(current); - } - else if (typeof value === 'object' && value.set) { - value.set(current); - } - if (options.onUpdate) { - options.onUpdate(current); - } - if (finished) { - // Ensure final frame is exact for tween - if (!isSpring) { - if (typeof value === 'function') { - value(target); - } - else if (typeof value === 'object' && value.set) { - value.set(target); - value.updateVelocity(0); - } - } - if (options.onComplete) { - options.onComplete(); - } - controls.onFinish(); - detach?.(); - } - else { - requestAnimationFrame(tick); - } - }; - requestAnimationFrame(tick); - return controls; -} -export function useMotionValueRef(value) { - // @ts-expect-error expected - const motionValueRef = useMainThreadRef(); - useMemo(() => { - function setMotionValue(value) { - 'main thread'; - if (!motionValueRef.current) { - motionValueRef.current = createMotionValue(value); - } - } - if (__BACKGROUND__) { - void runOnMainThread(setMotionValue)(value); - } - else { - runWorkletCtx(setMotionValue, [ - value, - ]); - } - }, []); - return motionValueRef; -} -export function useMotionValueRefEvent(valueRef, event, callback) { - const unListenRef = useMainThreadRef(); - useEffect(() => { - void runOnMainThread(() => { - 'main thread'; - unListenRef.current = valueRef.current.on(event, callback); - })(); - return () => { - void runOnMainThread(() => { - 'main thread'; - unListenRef.current?.(); - })(); - }; - }, [callback]); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/mini/index.js.map b/packages/third-party/motion/dist/mini/index.js.map deleted file mode 100644 index e018263bdc..0000000000 --- a/packages/third-party/motion/dist/mini/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mini/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EACL,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,OAAO,GACR,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,OA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xB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAIpC,QAAuC,EACvC,KAAe,EACf,QAAiD;IAEjD,MAAM,WAAW,GAAG,gBAAgB,EAAc,CAAC;IAEnD,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,eAAe,CAAC,GAAG,EAAE;YACxB,aAAa,CAAC;YACd,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,GAAG,EAAE;YACV,KAAK,eAAe,CAAC,GAAG,EAAE;gBACxB,aAAa,CAAC;gBACd,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1B,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/modified/motionValue.d.ts b/packages/third-party/motion/dist/modified/motionValue.d.ts deleted file mode 100644 index 88bdf909eb..0000000000 --- a/packages/third-party/motion/dist/modified/motionValue.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { MotionValue } from 'motion-dom'; -import type { MotionValueOptions } from 'motion-dom'; -export declare function motionValue(init: V, options?: MotionValueOptions): MotionValue; diff --git a/packages/third-party/motion/dist/modified/motionValue.js b/packages/third-party/motion/dist/modified/motionValue.js deleted file mode 100644 index 5324443cf2..0000000000 --- a/packages/third-party/motion/dist/modified/motionValue.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -import { MotionValue } from 'motion-dom' with { runtime: 'shared' }; -class CustomMotionValue extends MotionValue { - toJSON() { - return {}; - } -} -export function motionValue(init, options) { - return new CustomMotionValue(init, options); -} -//# sourceMappingURL=motionValue.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/modified/motionValue.js.map b/packages/third-party/motion/dist/modified/motionValue.js.map deleted file mode 100644 index fa6b4144dc..0000000000 --- a/packages/third-party/motion/dist/modified/motionValue.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"motionValue.js","sourceRoot":"","sources":["../../src/modified/motionValue.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC,OAAO,OAAO,EAAE,QAAQ,EAAE,CAAC;AAGpE,MAAM,iBAA2B,SAAQ,WAAc;IACrD,MAAM;QACJ,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CACzB,IAAO,EACP,OAA4B;IAE5B,OAAO,IAAI,iBAAiB,CAAI,IAAI,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/MotionValue.d.ts b/packages/third-party/motion/dist/polyfill/MotionValue.d.ts deleted file mode 100644 index 69647f84bd..0000000000 --- a/packages/third-party/motion/dist/polyfill/MotionValue.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { motionValue } from 'motion-dom'; diff --git a/packages/third-party/motion/dist/polyfill/MotionValue.js b/packages/third-party/motion/dist/polyfill/MotionValue.js deleted file mode 100644 index 03f0eb4960..0000000000 --- a/packages/third-party/motion/dist/polyfill/MotionValue.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -import { MotionValue } from 'motion-dom'; -/** - * This hack is needed to prevent large bulk of cross thread communication happened. - * This is because what MainThreadScript working for syncing MainThread and Background Thread - * But actually this is not needed, because we have single source of truth in MainThread - * So we can just ignore the cross thread communication - */ -// @ts-expect-error expected -MotionValue.prototype.toJSON = function () { - return {}; -}; -export { motionValue } from 'motion-dom'; -//# sourceMappingURL=MotionValue.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/MotionValue.js.map b/packages/third-party/motion/dist/polyfill/MotionValue.js.map deleted file mode 100644 index 08be4d9885..0000000000 --- a/packages/third-party/motion/dist/polyfill/MotionValue.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MotionValue.js","sourceRoot":"","sources":["../../src/polyfill/MotionValue.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;;GAKG;AAEH,4BAA4B;AAC5B,WAAW,CAAC,SAAS,CAAC,MAAM,GAAG;IAC7B,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/element.d.ts b/packages/third-party/motion/dist/polyfill/element.d.ts deleted file mode 100644 index 8ef9f488e8..0000000000 --- a/packages/third-party/motion/dist/polyfill/element.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import type { MainThread } from '@lynx-js/types'; -interface StyleObject { - [key: string]: string | ((property: string, value: string) => void); - setProperty(property: string, value: string): void; -} -export declare class ElementCompt { - private element; - constructor(element: MainThread.Element); - getComputedStyle(): Record; - get style(): StyleObject; - set style(styles: Record); - private getStyleProperty; - get backgroundColor(): string; - set backgroundColor(value: string); - get color(): string; - set color(value: string); - get fontSize(): string; - set fontSize(value: string); - get width(): string; - set width(value: string); - get height(): string; - set height(value: string); - get margin(): string; - set margin(value: string); - get padding(): string; - set padding(value: string); - get display(): string; - set display(value: string); - get position(): string; - set position(value: string); - get top(): string; - set top(value: string); - get left(): string; - set left(value: string); - get right(): string; - set right(value: string); - get bottom(): string; - set bottom(value: string); - getBoundingClientRect(): { - left: number; - top: number; - right: number; - bottom: number; - width: number; - height: number; - x: number; - y: number; - }; -} -export {}; diff --git a/packages/third-party/motion/dist/polyfill/element.js b/packages/third-party/motion/dist/polyfill/element.js deleted file mode 100644 index 0db4e93442..0000000000 --- a/packages/third-party/motion/dist/polyfill/element.js +++ /dev/null @@ -1,166 +0,0 @@ -export class ElementCompt { - element; - constructor(element) { - this.element = element; - } - getComputedStyle() { - const styleObject = {}; - return new Proxy(styleObject, { - get: (_target, prop) => { - // @ts-expect-error Expected - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - return __GetComputedStyleByKey(this.element.element, prop); - }, - }); - } - get style() { - const styleObject = {}; - styleObject.setProperty = (property, value) => { - if (property === 'transform' && value === 'none') { - return this.element.setStyleProperty('transform', 'scale(1, 1)'); - } - this.element.setStyleProperty(property, value); - }; - return new Proxy(styleObject, { - set: (target, prop, value) => { - if (typeof prop === 'string' && prop !== 'setProperty') { - if (prop === 'transform' && value === 'none') { - this.element.setStyleProperty('transform', 'scale(1, 1)'); - return true; - } - console.log('setStyle', prop, value); - this.element.setStyleProperty(prop, String(value)); - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - target[prop] = value; - } - return true; - }, - get: (_target, prop) => { - if (typeof prop === 'string' && prop !== 'setProperty') { - return this.getStyleProperty(prop); - } - return undefined; - }, - }); - } - set style(styles) { - this.element.setStyleProperties(styles); - } - // Individual style property getters and setters - getStyleProperty(name) { - // @ts-expect-error Expected - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - return __GetComputedStyleByKey(this.element.element, name); - } - // Common style properties - get backgroundColor() { - return this.getStyleProperty('backgroundColor'); - } - set backgroundColor(value) { - this.element.setStyleProperty('backgroundColor', value); - } - get color() { - return this.getStyleProperty('color'); - } - set color(value) { - this.element.setStyleProperty('color', value); - } - get fontSize() { - return this.getStyleProperty('fontSize'); - } - set fontSize(value) { - this.element.setStyleProperty('fontSize', value); - } - get width() { - return this.getStyleProperty('width'); - } - set width(value) { - this.element.setStyleProperty('width', value); - } - get height() { - return this.getStyleProperty('height'); - } - set height(value) { - this.element.setStyleProperty('height', value); - } - get margin() { - return this.getStyleProperty('margin'); - } - set margin(value) { - this.element.setStyleProperty('margin', value); - } - get padding() { - return this.getStyleProperty('padding'); - } - set padding(value) { - this.element.setStyleProperty('padding', value); - } - get display() { - return this.getStyleProperty('display'); - } - set display(value) { - this.element.setStyleProperty('display', value); - } - get position() { - return this.getStyleProperty('position'); - } - set position(value) { - this.element.setStyleProperty('position', value); - } - get top() { - return this.getStyleProperty('top'); - } - set top(value) { - this.element.setStyleProperty('top', value); - } - get left() { - return this.getStyleProperty('left'); - } - set left(value) { - this.element.setStyleProperty('left', value); - } - get right() { - return this.getStyleProperty('right'); - } - set right(value) { - this.element.setStyleProperty('right', value); - } - get bottom() { - return this.getStyleProperty('bottom'); - } - set bottom(value) { - this.element.setStyleProperty('bottom', value); - } - getBoundingClientRect() { - // Parse dimensions from computed style - const width = parseFloat(this.getStyleProperty('width')) || 0; - const height = parseFloat(this.getStyleProperty('height')) || 0; - // Parse position - these may be 'auto' or pixel values - const left = parseFloat(this.getStyleProperty('left')) || 0; - const top = parseFloat(this.getStyleProperty('top')) || 0; - // Calculate bounds - const right = left + width; - const bottom = top + height; - console.log('getBoundingClient', { - left, - top, - right, - bottom, - width, - height, - x: left, - y: top, - }); - return { - left, - top, - right, - bottom, - width, - height, - x: left, - y: top, - }; - } -} -//# sourceMappingURL=element.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/element.js.map b/packages/third-party/motion/dist/polyfill/element.js.map deleted file mode 100644 index 8b8e8cfa60..0000000000 --- a/packages/third-party/motion/dist/polyfill/element.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/polyfill/element.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,YAAY;IACf,OAAO,CAAqB;IAEpC,YAAY,OAA2B;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,gBAAgB;QACrB,MAAM,WAAW,GAA2B,EAAE,CAAC;QAE/C,OAAO,IAAI,KAA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AAC;QAC3B,MAAM,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;QAE5B,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE;YAC/B,IAAI;YACJ,GAAG;YACH,KAAK;YACL,MAAM;YACN,KAAK;YACL,MAAM;YACN,CAAC,EAAE,IAAI;YACP,CAAC,EAAE,GAAG;SACP,CAAC,CAAC;QAEH,OAAO;YACL,IAAI;YACJ,GAAG;YACH,KAAK;YACL,MAAM;YACN,KAAK;YACL,MAAM;YACN,CAAC,EAAE,IAAI;YACP,CAAC,EAAE,GAAG;SACP,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/shim.d.ts b/packages/third-party/motion/dist/polyfill/shim.d.ts deleted file mode 100644 index cb0ff5c3b5..0000000000 --- a/packages/third-party/motion/dist/polyfill/shim.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/third-party/motion/dist/polyfill/shim.js b/packages/third-party/motion/dist/polyfill/shim.js deleted file mode 100644 index c1b775767d..0000000000 --- a/packages/third-party/motion/dist/polyfill/shim.js +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -import { document, setupDocument } from '@lynx-js/react/internal/document'; -import { ElementCompt } from './element.js'; -const timeOrigin = Date.now(); -function shimGlobals() { - // Only shim document if it doesn't exist - if (!globalThis.document) { - // @ts-expect-error error - globalThis.document = document; - } - // Only shim performance if it doesn't exist - if (!globalThis.performance) { - // @ts-expect-error error - globalThis.performance = { - now: () => Date.now() - timeOrigin, - }; - } - // Only shim queueMicrotask if it doesn't exist - if (!globalThis.queueMicrotask) { - globalThis.queueMicrotask = (fn) => { - void Promise.resolve().then(() => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - fn(); - }); - }; - } - // Only shim document query methods if they don't exist - // @ts-expect-error error - document.querySelector ??= lynx.querySelector; - // @ts-expect-error error - document.querySelectorAll ??= lynx.querySelectorAll; - // Only shim NodeList if it doesn't exist - if (!globalThis.NodeList) { - // @ts-expect-error error - globalThis.NodeList = class NodeList { - }; - } - // Only shim SVGElement if it doesn't exist - if (!globalThis.SVGElement) { - // @ts-expect-error error - globalThis.SVGElement = class SVGElement { - }; - } - // Only shim HTMLElement if it doesn't exist - if (!globalThis.HTMLElement) { - // @ts-expect-error error - globalThis.HTMLElement = class HTMLElement { - }; - } - // Only shim window if it doesn't exist - if (!globalThis.window) { - // @ts-expect-error error - globalThis.window = { - getComputedStyle: (ele) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access - return ele.getComputedStyle(); - }, - }; - } - // @ts-expect-error error - globalThis.Element ??= ElementCompt; - // @ts-expect-error error - globalThis.EventTarget ??= ElementCompt; - // Only shim getComputedStyle if it doesn't exist - globalThis.getComputedStyle ??= globalThis.window?.getComputedStyle; -} -if (__MAIN_THREAD__) { - setupDocument(); - shimGlobals(); -} -else if (__DEV__) { - // Only shim queueMicrotask if it doesn't exist - // eslint-disable-next-line unicorn/no-lonely-if - if (!globalThis.queueMicrotask) { - globalThis.queueMicrotask = (fn) => { - void Promise.resolve().then(() => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - fn(); - }); - }; - } -} -//# sourceMappingURL=shim.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/polyfill/shim.js.map b/packages/third-party/motion/dist/polyfill/shim.js.map deleted file mode 100644 index 235b5800a4..0000000000 --- a/packages/third-party/motion/dist/polyfill/shim.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"shim.js","sourceRoot":"","sources":["../../src/polyfill/shim.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAE3E,OAAO,EAAE,YAAY,EAAE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5B,yBAAyB;QACzB,UAAU,CAAC,WAAW,GAAG,MAAM,WAAW;SAAG,CAAC;IAChD,CAAC;IAED,uCAAuC;IACvC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;QACvB,yBAAyB;QACzB,UAAU,CAAC,MAAM,GAAG;YAClB,gBAAgB,EAAE,CAAC,GAAQ,EAAE,EAAE;gBAC7B,8IAA8I;gBAC9I,OAAO,GAAG,CAAC,gBAAgB,EAAE,CAAC;YAChC,CAAC;SACF,CAAC;IACJ,CAAC;IACD,yBAAyB;IACzB,UAAU,CAAC,OAAO,KAAK,YAAY,CAAC;IACpC,yBAAyB;IACzB,UAAU,CAAC,WAAW,KAAK,YAAY,CAAC;IAExC,iDAAiD;IACjD,UAAU,CAAC,gBAAgB,KAAK,UAAU,CAAC,MAAM,EAAE,gBAAgB,CAAC;AACtE,CAAC;AAED,IAAI,eAAe,EAAE,CAAC;IACpB,aAAa,EAAE,CAAC;IAEhB,WAAW,EAAE,CAAC;AAChB,CAAC;KAAM,IAAI,OAAO,EAAE,CAAC;IACnB,+CAA+C;IAC/C,gDAAgD;IAChD,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;QAC/B,UAAU,CAAC,cAAc,GAAG,CAAC,EAAO,EAAE,EAAE;YACtC,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC/B,6DAA6D;gBAC7D,EAAE,EAAE,CAAC;YACP,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/types/index.d.ts b/packages/third-party/motion/dist/types/index.d.ts deleted file mode 100644 index 4193003f17..0000000000 --- a/packages/third-party/motion/dist/types/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { MainThread } from '@lynx-js/types'; -export type ElementOrElements = MainThread.Element | MainThread.Element[]; diff --git a/packages/third-party/motion/dist/types/index.js b/packages/third-party/motion/dist/types/index.js deleted file mode 100644 index c56f11813d..0000000000 --- a/packages/third-party/motion/dist/types/index.js +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -import { MainThread } from '@lynx-js/types'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/types/index.js.map b/packages/third-party/motion/dist/types/index.js.map deleted file mode 100644 index 717a8822b2..0000000000 --- a/packages/third-party/motion/dist/types/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/elementHelper.d.ts b/packages/third-party/motion/dist/utils/elementHelper.d.ts deleted file mode 100644 index cc081bbfe4..0000000000 --- a/packages/third-party/motion/dist/utils/elementHelper.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ElementOrSelector } from 'motion-dom'; -import type { MainThread } from '@lynx-js/types'; -export declare function elementOrSelector2Dom(nodesOrSelector: string | MainThread.Element | MainThread.Element[]): ElementOrSelector | undefined; diff --git a/packages/third-party/motion/dist/utils/elementHelper.js b/packages/third-party/motion/dist/utils/elementHelper.js deleted file mode 100644 index 25815b4ed2..0000000000 --- a/packages/third-party/motion/dist/utils/elementHelper.js +++ /dev/null @@ -1,22 +0,0 @@ -import { isMainThreadElement, isMainThreadElementArray, } from './isMainThreadElement.js'; -import { ElementCompt } from '../polyfill/element.js' with { runtime: 'shared' }; -export function elementOrSelector2Dom(nodesOrSelector) { - 'main thread'; - let domElements = undefined; - if (typeof nodesOrSelector === 'string' - || isMainThreadElement(nodesOrSelector) - || isMainThreadElementArray(nodesOrSelector)) { - let elementNodes; - if (typeof nodesOrSelector === 'string') { - elementNodes = lynx.querySelectorAll(nodesOrSelector); - } - else { - elementNodes = nodesOrSelector; - } - domElements = (Array.isArray(elementNodes) - ? elementNodes.map(el => new ElementCompt(el)) - : new ElementCompt(elementNodes)); - } - return domElements; -} -//# sourceMappingURL=elementHelper.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/elementHelper.js.map b/packages/third-party/motion/dist/utils/elementHelper.js.map deleted file mode 100644 index e2f04753c4..0000000000 --- a/packages/third-party/motion/dist/utils/elementHelper.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"elementHelper.js","sourceRoot":"","sources":["../../src/utils/elementHelper.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC,OAAO,OAAO,EAAE,QAAQ,EAAE,CAAC;AAGjF,MAAM,UAAU,qBAAqB,CACnC,eAAmE;IAEnE,aAAa,CAAC;IACd,IAAI,WAAW,GAAkC,SAAS,CAAC;IAE3D,IACE,OAAO,eAAe,KAAK,QAAQ;WAChC,mBAAmB,CAAC,eAAe,CAAC;WACpC,wBAAwB,CAAC,eAAe,CAAC,EAC5C,CAAC;QACD,IAAI,YAA+B,CAAC;QACpC,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,CAAC;YACxC,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,eAAe,CAAC;QACjC,CAAC;QACD,WAAW,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;YACxC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC;YAC9C,CAAC,CAAC,IAAI,YAAY,CAChB,YAAY,CACb,CAAiC,CAAC;IACvC,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/isMainThreadElement.d.ts b/packages/third-party/motion/dist/utils/isMainThreadElement.d.ts deleted file mode 100644 index 279a76de5d..0000000000 --- a/packages/third-party/motion/dist/utils/isMainThreadElement.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { MainThread } from '@lynx-js/types'; -export declare function isMainThreadElement(ele: unknown): ele is MainThread.Element; -export declare function isMainThreadElementArray(eleArr: unknown): eleArr is MainThread.Element[]; diff --git a/packages/third-party/motion/dist/utils/isMainThreadElement.js b/packages/third-party/motion/dist/utils/isMainThreadElement.js deleted file mode 100644 index 5b96996373..0000000000 --- a/packages/third-party/motion/dist/utils/isMainThreadElement.js +++ /dev/null @@ -1,15 +0,0 @@ -export function isMainThreadElement(ele) { - 'main thread'; - // @ts-expect-error error - if (ele && 'element' in ele) { - return true; - } - else { - return false; - } -} -export function isMainThreadElementArray(eleArr) { - 'main thread'; - return Array.isArray(eleArr) && eleArr.every(ele => isMainThreadElement(ele)); -} -//# sourceMappingURL=isMainThreadElement.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/isMainThreadElement.js.map b/packages/third-party/motion/dist/utils/isMainThreadElement.js.map deleted file mode 100644 index 1f0fb00a64..0000000000 --- a/packages/third-party/motion/dist/utils/isMainThreadElement.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"isMainThreadElement.js","sourceRoot":"","sources":["../../src/utils/isMainThreadElement.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,aAAa,CAAC;IACd,yBAAyB;IACzB,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,MAAe;IAEf,aAAa,CAAC;IACd,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;AAChF,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/noop.d.ts b/packages/third-party/motion/dist/utils/noop.d.ts deleted file mode 100644 index 27abd08d2f..0000000000 --- a/packages/third-party/motion/dist/utils/noop.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const noop: () => void; diff --git a/packages/third-party/motion/dist/utils/noop.js b/packages/third-party/motion/dist/utils/noop.js deleted file mode 100644 index 9a6a7d1a13..0000000000 --- a/packages/third-party/motion/dist/utils/noop.js +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -export const noop = () => { }; -//# sourceMappingURL=noop.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/noop.js.map b/packages/third-party/motion/dist/utils/noop.js.map deleted file mode 100644 index 9e7a83a33c..0000000000 --- a/packages/third-party/motion/dist/utils/noop.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"noop.js","sourceRoot":"","sources":["../../src/utils/noop.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,MAAM,CAAC,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/registeredFunction.d.ts b/packages/third-party/motion/dist/utils/registeredFunction.d.ts deleted file mode 100644 index 8a8375c0f8..0000000000 --- a/packages/third-party/motion/dist/utils/registeredFunction.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export declare function registerCallable(func: CallableFunction, id: string): string; -export declare function runOnRegistered(id: string): T; -declare global { - var runOnRegistered: (id: string) => T; -} diff --git a/packages/third-party/motion/dist/utils/registeredFunction.js b/packages/third-party/motion/dist/utils/registeredFunction.js deleted file mode 100644 index cb3d6abe46..0000000000 --- a/packages/third-party/motion/dist/utils/registeredFunction.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -import { noop } from './noop.js'; -const registeredCallableMap = new Map(); // Regular Map for primitive keys -export function registerCallable(func, id) { - registeredCallableMap.set(id, func); - return id; -} -export function runOnRegistered(id) { - const func = registeredCallableMap.get(id) ?? noop; - return func; -} -// We use globalThis trick to get over with closure capture -// @TODO: Remove this when ReactLynx supports importing MTS for module -globalThis.runOnRegistered = runOnRegistered; -//# sourceMappingURL=registeredFunction.js.map \ No newline at end of file diff --git a/packages/third-party/motion/dist/utils/registeredFunction.js.map b/packages/third-party/motion/dist/utils/registeredFunction.js.map deleted file mode 100644 index f33dc54a0b..0000000000 --- a/packages/third-party/motion/dist/utils/registeredFunction.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"registeredFunction.js","sourceRoot":"","sources":["../../src/utils/registeredFunction.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAA4B,CAAC,CAAC,iCAAiC;AAEpG,MAAM,UAAU,gBAAgB,CAAC,IAAsB,EAAE,EAAU;IACjE,qBAAqB,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAEpC,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,EAAU;IAEV,MAAM,IAAI,GAAG,qBAAqB,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;IACnD,OAAO,IAAoB,CAAC;AAC9B,CAAC;AAQD,2DAA2D;AAC3D,sEAAsE;AACtE,UAAU,CAAC,eAAe,GAAG,eAAe,CAAC"} \ No newline at end of file From d4f1fe3b66ccdbdb510d04a1b700b9a6722b5300 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Thu, 8 Jan 2026 21:46:54 +0800 Subject: [PATCH 18/37] feat: rename into xx_ --- .../third-party/motion/src/animation/index.ts | 71 +++++++------------ 1 file changed, 26 insertions(+), 45 deletions(-) diff --git a/packages/third-party/motion/src/animation/index.ts b/packages/third-party/motion/src/animation/index.ts index a175132fd7..88d9844a25 100644 --- a/packages/third-party/motion/src/animation/index.ts +++ b/packages/third-party/motion/src/animation/index.ts @@ -3,30 +3,11 @@ // LICENSE file in the root directory of this source tree. import '../polyfill/shim.js'; -// import { -// animate as animateOrig, -// clamp as clampOrig, -// progress as progressOrig, -// stagger as staggerOrig, -// } from 'framer-motion/dom'; -// import type { -// AnimationSequence, -// ObjectTarget, -// SequenceOptions, -// } from 'framer-motion/dom'; -// import { -// mapValue as mapValueOrig, -// mix as mixOrig, -// spring as springOrig, -// springValue as springValueOrig, -// styleEffect as styleEffectOrig, -// transformValue as transformValueOrig, -// } from 'motion-dom'; import { - animate as animateOrig, - clamp as clampOrig, - progress as progressOrig, - stagger as staggerOrig, + animate as animate_, + clamp as clamp_, + progress as progress_, + stagger as stagger_, } from 'framer-motion/dom' with { runtime: 'shared' }; import type { AnimationSequence, @@ -34,12 +15,12 @@ import type { SequenceOptions, } from 'framer-motion/dom'; import { - mapValue as mapValueOrig, - mix as mixOrig, - spring as springOrig, - springValue as springValueOrig, - styleEffect as styleEffectOrig, - transformValue as transformValueOrig, + mapValue as mapValue_, + mix as mix_, + springValue as springValue_, + spring as spring_, + styleEffect as styleEffect_, + transformValue as transformValue_, } from 'motion-dom' with { runtime: 'shared' }; import type { AnimationOptions, @@ -59,7 +40,7 @@ import type { import { useMotionValueRefEvent } from '../hooks/useMotionEvent.js'; import { ElementCompt } from '../polyfill/element.js' with { runtime: 'shared' }; -import { motionValue as motionValueOrig } from '../polyfill/MotionValue.js' with { runtime: 'shared' }; +import { motionValue as motionValue_ } from '../polyfill/MotionValue.js' with { runtime: 'shared' }; import type { ElementOrElements } from '../types/index.js'; import { elementOrSelector2Dom } from '../utils/elementHelper.js'; import { @@ -184,7 +165,7 @@ function animate( } // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return animateOrig( + return animate_( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument realSubjectOrSequence as any, // eslint-disable-next-line @typescript-eslint/no-unsafe-argument @@ -195,11 +176,11 @@ function animate( } function stagger( - ...args: Parameters -): ReturnType { + ...args: Parameters +): ReturnType { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return staggerOrig( + return stagger_( ...args, ); } @@ -210,18 +191,18 @@ function motionValue( ): MotionValue { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return motionValueOrig( + return motionValue_( init, options, ); } function spring( - ...args: Parameters -): ReturnType { + ...args: Parameters +): ReturnType { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return springOrig(...args); + return spring_(...args); } function springValue( @@ -230,7 +211,7 @@ function springValue( ): MotionValue { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return springValueOrig( + return springValue_( source, options, ); @@ -242,7 +223,7 @@ function mix(from: T, to: T, p?: T): Mixer | number { 'main thread'; // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return mixOrig( + return mix_( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument from as any, // eslint-disable-next-line @typescript-eslint/no-unsafe-argument @@ -254,7 +235,7 @@ function mix(from: T, to: T, p?: T): Mixer | number { function progress(from: number, to: number, value: number): number { 'main thread'; - return progressOrig( + return progress_( from, to, value, @@ -263,7 +244,7 @@ function progress(from: number, to: number, value: number): number { function clamp(min: number, max: number, v: number): number { 'main thread'; - return clampOrig(min, max, v); + return clamp_(min, max, v); } function mapValue( @@ -273,7 +254,7 @@ function mapValue( options?: TransformOptions, ): MotionValue { 'main thread'; - return mapValueOrig( + return mapValue_( inputValue, inputRange, outputRange, @@ -283,7 +264,7 @@ function mapValue( function transformValue(transform: () => O): MotionValue { 'main thread'; - return transformValueOrig(transform); + return transformValue_(transform); } function styleEffect( @@ -295,7 +276,7 @@ function styleEffect( if (!elements) { return () => {}; } - return styleEffectOrig( + return styleEffect_( elements, values, ); From 9fc7e104c4bcf714975b52f8a90ee89be6ab7b08 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Fri, 9 Jan 2026 21:24:54 +0800 Subject: [PATCH 19/37] feat: rename into @lynx-js/motion --- biome.jsonc | 1 + eslint.config.js | 2 + examples/motion/package.json | 4 +- examples/motion/src/Basic/index.tsx | 2 +- examples/motion/src/BasicPercent/index.tsx | 2 +- examples/motion/src/BasicSelector/index.tsx | 2 +- .../motion/src/ColorInterception/index.tsx | 2 +- examples/motion/src/Mini/index.tsx | 2 +- examples/motion/src/MotionValue/index.tsx | 4 +- examples/motion/src/Spring/index.tsx | 2 +- examples/motion/src/Stagger/index.tsx | 2 +- examples/motion/src/Text/index.tsx | 2 +- examples/motion/src/iOSSlider/index.tsx | 2 +- packages/{third-party => }/motion/README.md | 0 packages/motion/README_MINI.md | 64 +++ packages/motion/__tests__/mini.test.tsx | 89 +++++ .../{third-party => }/motion/package.json | 13 +- packages/motion/rslib.config.ts | 17 + .../motion/src/animation/index.ts | 26 +- .../motion/src/env_types/papi.d.ts | 0 .../motion/src/hooks/useMotionEvent.ts | 13 +- .../motion/src/hooks/useMotionValueRef.ts | 15 +- .../{third-party => }/motion/src/index.ts | 0 packages/motion/src/mini/core/MotionValue.ts | 114 ++++++ packages/motion/src/mini/core/animate.ts | 187 +++++++++ packages/motion/src/mini/core/easings.ts | 100 +++++ packages/motion/src/mini/core/spring.ts | 21 + packages/motion/src/mini/index.ts | 51 +++ .../motion/src/modified/motionValue.ts | 2 +- .../motion/src/polyfill/MotionValue.ts | 8 +- .../motion/src/polyfill/element.ts | 20 +- .../motion/src/polyfill/shim.ts | 5 +- .../motion/src/types/index.ts | 2 +- .../motion/src/utils/elementHelper.ts | 0 .../motion/src/utils/isMainThreadElement.ts | 0 .../motion/src/utils/noop.ts | 5 + .../motion/src/utils/registeredFunction.ts | 1 + packages/motion/tsconfig.build.json | 17 + packages/motion/tsconfig.json | 7 + packages/motion/tsconfig.test.json | 7 + .../{third-party => }/motion/vitest.config.ts | 0 .../motion/__tests__/animation.test.tsx | 104 ----- packages/third-party/motion/src/mini/index.ts | 376 ------------------ .../third-party/motion/tsconfig.build.json | 6 - packages/third-party/motion/tsconfig.json | 16 - pnpm-lock.yaml | 56 ++- pnpm-workspace.yaml | 2 +- tsconfig.json | 2 +- 48 files changed, 774 insertions(+), 601 deletions(-) rename packages/{third-party => }/motion/README.md (100%) create mode 100644 packages/motion/README_MINI.md create mode 100644 packages/motion/__tests__/mini.test.tsx rename packages/{third-party => }/motion/package.json (81%) create mode 100644 packages/motion/rslib.config.ts rename packages/{third-party => }/motion/src/animation/index.ts (91%) rename packages/{third-party => }/motion/src/env_types/papi.d.ts (100%) rename packages/{third-party => }/motion/src/hooks/useMotionEvent.ts (75%) rename packages/{third-party => }/motion/src/hooks/useMotionValueRef.ts (79%) rename packages/{third-party => }/motion/src/index.ts (100%) create mode 100644 packages/motion/src/mini/core/MotionValue.ts create mode 100644 packages/motion/src/mini/core/animate.ts create mode 100644 packages/motion/src/mini/core/easings.ts create mode 100644 packages/motion/src/mini/core/spring.ts create mode 100644 packages/motion/src/mini/index.ts rename packages/{third-party => }/motion/src/modified/motionValue.ts (88%) rename packages/{third-party => }/motion/src/polyfill/MotionValue.ts (53%) rename packages/{third-party => }/motion/src/polyfill/element.ts (91%) rename packages/{third-party => }/motion/src/polyfill/shim.ts (93%) rename packages/{third-party => }/motion/src/types/index.ts (84%) rename packages/{third-party => }/motion/src/utils/elementHelper.ts (100%) rename packages/{third-party => }/motion/src/utils/isMainThreadElement.ts (100%) rename packages/{third-party => }/motion/src/utils/noop.ts (64%) rename packages/{third-party => }/motion/src/utils/registeredFunction.ts (93%) create mode 100644 packages/motion/tsconfig.build.json create mode 100644 packages/motion/tsconfig.json create mode 100644 packages/motion/tsconfig.test.json rename packages/{third-party => }/motion/vitest.config.ts (100%) delete mode 100644 packages/third-party/motion/__tests__/animation.test.tsx delete mode 100644 packages/third-party/motion/src/mini/index.ts delete mode 100644 packages/third-party/motion/tsconfig.build.json delete mode 100644 packages/third-party/motion/tsconfig.json diff --git a/biome.jsonc b/biome.jsonc index 3ca2b6d7b2..e759b8aad1 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -54,6 +54,7 @@ "packages/testing-library/**", "packages/react/testing-library/**", "packages/lynx/gesture-runtime/__test__/**", + "packages/motion/__tests__/**" ], "rules": { // We are migrating from ESLint to Biome diff --git a/eslint.config.js b/eslint.config.js index 089725aba7..ffcc728887 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -100,6 +100,8 @@ export default tseslint.config( // gesture-runtime-testing 'packages/lynx/gesture-runtime/__test__/**', + // motion tests + 'packages/motion/__tests__/**', // TODO: enable eslint for tailwind-preset // tailwind-preset 'packages/tailwind-preset/**', diff --git a/examples/motion/package.json b/examples/motion/package.json index 6b8324bf19..b08c60b0c9 100644 --- a/examples/motion/package.json +++ b/examples/motion/package.json @@ -9,7 +9,7 @@ "test:type": "vitest --typecheck.only" }, "dependencies": { - "@lynx-js/motion-lynx": "workspace:*", + "@lynx-js/motion": "workspace:*", "@lynx-js/react": "workspace:*" }, "devDependencies": { @@ -17,7 +17,7 @@ "@lynx-js/qrcode-rsbuild-plugin": "workspace:*", "@lynx-js/react-rsbuild-plugin": "workspace:*", "@lynx-js/rspeedy": "workspace:*", - "@lynx-js/types": "3.4.11", + "@lynx-js/types": "3.6.0", "@types/react": "^18.3.25" } } diff --git a/examples/motion/src/Basic/index.tsx b/examples/motion/src/Basic/index.tsx index c095a452f0..31a0ec472c 100644 --- a/examples/motion/src/Basic/index.tsx +++ b/examples/motion/src/Basic/index.tsx @@ -1,4 +1,4 @@ -import { animate } from '@lynx-js/motion-lynx'; +import { animate } from '@lynx-js/motion'; import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; import type { MainThread } from '@lynx-js/types'; diff --git a/examples/motion/src/BasicPercent/index.tsx b/examples/motion/src/BasicPercent/index.tsx index 6d0bdba9aa..b1784e00d4 100644 --- a/examples/motion/src/BasicPercent/index.tsx +++ b/examples/motion/src/BasicPercent/index.tsx @@ -1,4 +1,4 @@ -import { animate } from '@lynx-js/motion-lynx'; +import { animate } from '@lynx-js/motion'; import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; import type { MainThread } from '@lynx-js/types'; diff --git a/examples/motion/src/BasicSelector/index.tsx b/examples/motion/src/BasicSelector/index.tsx index 1af89885e6..06c47e8567 100644 --- a/examples/motion/src/BasicSelector/index.tsx +++ b/examples/motion/src/BasicSelector/index.tsx @@ -1,4 +1,4 @@ -import { animate } from '@lynx-js/motion-lynx'; +import { animate } from '@lynx-js/motion'; import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; import './styles.css'; diff --git a/examples/motion/src/ColorInterception/index.tsx b/examples/motion/src/ColorInterception/index.tsx index 5c42ef7766..a510ba2961 100644 --- a/examples/motion/src/ColorInterception/index.tsx +++ b/examples/motion/src/ColorInterception/index.tsx @@ -1,4 +1,4 @@ -import { animate } from '@lynx-js/motion-lynx'; +import { animate } from '@lynx-js/motion'; import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; import type { MainThread } from '@lynx-js/types'; diff --git a/examples/motion/src/Mini/index.tsx b/examples/motion/src/Mini/index.tsx index ad4dacdd4d..35863fb554 100644 --- a/examples/motion/src/Mini/index.tsx +++ b/examples/motion/src/Mini/index.tsx @@ -2,7 +2,7 @@ import { animate, useMotionValueRef, useMotionValueRefEvent, -} from '@lynx-js/motion-lynx/mini'; +} from '@lynx-js/motion/mini'; import { root, runOnMainThread, useMainThreadRef } from '@lynx-js/react'; import type { MainThread } from '@lynx-js/types'; diff --git a/examples/motion/src/MotionValue/index.tsx b/examples/motion/src/MotionValue/index.tsx index 277651a708..8349b2981e 100644 --- a/examples/motion/src/MotionValue/index.tsx +++ b/examples/motion/src/MotionValue/index.tsx @@ -1,5 +1,5 @@ -import { motionValue } from '@lynx-js/motion-lynx'; -import type { MotionValue, animate } from '@lynx-js/motion-lynx'; +import { motionValue } from '@lynx-js/motion'; +import type { MotionValue, animate } from '@lynx-js/motion'; import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; import type { MainThread } from '@lynx-js/types'; diff --git a/examples/motion/src/Spring/index.tsx b/examples/motion/src/Spring/index.tsx index 937fdb2b24..7f8fbdfe30 100644 --- a/examples/motion/src/Spring/index.tsx +++ b/examples/motion/src/Spring/index.tsx @@ -1,4 +1,4 @@ -import { animate } from '@lynx-js/motion-lynx'; +import { animate } from '@lynx-js/motion'; import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; import type { MainThread } from '@lynx-js/types'; diff --git a/examples/motion/src/Stagger/index.tsx b/examples/motion/src/Stagger/index.tsx index 5b6b3e889e..d6f949c05e 100644 --- a/examples/motion/src/Stagger/index.tsx +++ b/examples/motion/src/Stagger/index.tsx @@ -1,4 +1,4 @@ -import { animate, stagger } from '@lynx-js/motion-lynx'; +import { animate, stagger } from '@lynx-js/motion'; import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; import './styles.css'; diff --git a/examples/motion/src/Text/index.tsx b/examples/motion/src/Text/index.tsx index 2a56b770e9..67ce94e2e8 100644 --- a/examples/motion/src/Text/index.tsx +++ b/examples/motion/src/Text/index.tsx @@ -1,4 +1,4 @@ -import { animate } from '@lynx-js/motion-lynx'; +import { animate } from '@lynx-js/motion'; import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; import type { MainThread } from '@lynx-js/types'; diff --git a/examples/motion/src/iOSSlider/index.tsx b/examples/motion/src/iOSSlider/index.tsx index 8f98168c27..6b8da08be9 100644 --- a/examples/motion/src/iOSSlider/index.tsx +++ b/examples/motion/src/iOSSlider/index.tsx @@ -7,7 +7,7 @@ import { styleEffect, transformValue, useMotionValueRef, -} from '@lynx-js/motion-lynx'; +} from '@lynx-js/motion'; import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; import type { MainThread } from '@lynx-js/types'; diff --git a/packages/third-party/motion/README.md b/packages/motion/README.md similarity index 100% rename from packages/third-party/motion/README.md rename to packages/motion/README.md diff --git a/packages/motion/README_MINI.md b/packages/motion/README_MINI.md new file mode 100644 index 0000000000..85aac546b1 --- /dev/null +++ b/packages/motion/README_MINI.md @@ -0,0 +1,64 @@ +# Motion Mini + +Motion Mini is a lightweight, main-thread-optimized version of the Motion library for Lynx. It provides a core subset of animation capabilities designed for high performance and low bundle size. + +## Features + +- **Main Thread Animation**: All animations run directly on the main thread, bypassing the JS thread for smoother performance. +- **Small Bundle Size**: Includes only essential animation logic (Spring, Tween, MotionValues). +- **Core API Compatibility**: API is similar to the standard `motion` package, making it easy to learn. + +## Limits & Differences + +| Feature | Standard Motion | Motion Mini | +| :-------------------- | :------------------------------------------------ | :------------------------ | +| **Animation Targets** | Numbers, Strings (colors, units), Objects, Arrays | **Numbers only** (mostly) | +| **Keyframes** | Full support | Limited support | +| **Layout Animations** | Supported | Not supported | +| **Gesture Handlers** | Full suite (drag, pan, hover, etc.) | Not included | + +> **Note**: `MotionValue` in Mini primarily works with numbers. If you need to animate complex strings or colors, consider using the full `motion` package or handle interpolation manually. + +## API Reference + +### `createMotionValue(initial: T)` + +Creates a `MotionValue` that tracks the state and velocity of a value. + +```typescript +const mv = createMotionValue(0); +mv.set(100); +console.log(mv.get()); // 100 +``` + +### `animate(value, target, options)` + +Animates a `MotionValue` or a number to a target value. + +- **value**: `MotionValue` or `number` or `(v) => void` setter. +- **target**: Target value (number). +- **options**: Animation configuration (`duration`, `ease`, `type`, `stiffness`, etc.). + +```typescript +animate(mv, 100, { + type: 'spring', + stiffness: 300, + damping: 30, +}); +``` + +### `useMotionValueRef(initial)` + +React hook to create a `MotionValue` that persists across renders and is safe to use on the main thread. + +```typescript +const mvRef = useMotionValueRef(0); +``` + +### `spring(options)` + +Low-level spring animation generator compatible with `motion-dom`. + +### Easings + +Includes standard easings: `linear`, `easeIn`, `easeOut`, `easeInOut`, `circIn`, `circOut`, `circInOut`, `backIn`, `backOut`, `backInOut`, `anticipate`. diff --git a/packages/motion/__tests__/mini.test.tsx b/packages/motion/__tests__/mini.test.tsx new file mode 100644 index 0000000000..d2f3ac1216 --- /dev/null +++ b/packages/motion/__tests__/mini.test.tsx @@ -0,0 +1,89 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; + +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; +import { act, render } from '@lynx-js/react/testing-library'; + +import { animate, createMotionValue } from '../src/mini/index.js'; +import { noopMT } from '../src/utils/noop.js'; + +describe('motion mini', () => { + let _mockRegisterCallable; + let mockRegisteredMap: Map; + + beforeEach(() => { + mockRegisteredMap = new Map(); + vi.spyOn(globalThis, 'runOnRegistered', 'get').mockImplementation(function( + id: string, + ) { + const func = mockRegisteredMap.get(id) ?? noopMT; + return func; + }); + + function mockRegisterCallable( + func: CallableFunction, + id: string, + ): CallableFunction { + mockRegisteredMap.set(id, func); + return func; + } + + _mockRegisterCallable = mockRegisterCallable; + }); + + afterEach(() => { + vi.restoreAllMocks(); + }); + + test('createMotionValue should work', async () => { + const App = () => { + useMainThreadRef(null); + return ; + }; + + render(, { + enableMainThread: true, + enableBackgroundThread: true, + }); + }); + + test('animate should update value', async () => { + const App = () => { + useEffect(() => { + runOnMainThread(() => { + 'main thread'; + const mv = createMotionValue(0); + + const onUpdate = (v: number) => { + 'main thread'; + }; + const onComplete = () => { + 'main thread'; + }; + + animate(mv, 100, { + duration: 0.1, + onUpdate, + onComplete, + ease: (t) => t, // Explicit ease + }); + + if (mv.get() !== 0) throw new Error('initial animate value wrong'); + })(); + }, []); + return ; + }; + + render(, { + enableMainThread: true, + enableBackgroundThread: true, + }); + + await act(async () => { + await new Promise((resolve) => setTimeout(resolve, 100)); + }); + }); +}); diff --git a/packages/third-party/motion/package.json b/packages/motion/package.json similarity index 81% rename from packages/third-party/motion/package.json rename to packages/motion/package.json index 4b564d462d..e7060dea45 100644 --- a/packages/third-party/motion/package.json +++ b/packages/motion/package.json @@ -1,5 +1,5 @@ { - "name": "@lynx-js/motion-lynx", + "name": "@lynx-js/motion", "version": "0.0.1", "private": false, "description": "This is a motion adapter for Lynx.js", @@ -11,8 +11,8 @@ ], "repository": { "type": "git", - "url": "https://github.com/lynx-family/lynx-stack.git", - "directory": "packages/third-party/motion" + "url": "git+https://github.com/lynx-family/lynx-stack.git", + "directory": "packages/motion" }, "license": "MIT", "sideEffects": [ @@ -24,13 +24,11 @@ ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js", - "require": "./dist/index.js", "default": "./dist/index.js" }, "./mini": { "types": "./dist/mini/index.d.ts", "import": "./dist/mini/index.js", - "require": "./dist/mini/index.js", "default": "./dist/mini/index.js" } }, @@ -43,6 +41,8 @@ "CHANGELOG.md" ], "scripts": { + "build": "rslib build", + "dev": "rslib build --watch", "test": "vitest run" }, "dependencies": { @@ -52,7 +52,8 @@ }, "devDependencies": { "@lynx-js/react": "workspace:*", - "@lynx-js/types": "3.4.11" + "@lynx-js/types": "3.6.0", + "rsbuild-plugin-publint": "0.3.3" }, "peerDependencies": { "@lynx-js/react": "*", diff --git a/packages/motion/rslib.config.ts b/packages/motion/rslib.config.ts new file mode 100644 index 0000000000..5f794e9aa6 --- /dev/null +++ b/packages/motion/rslib.config.ts @@ -0,0 +1,17 @@ +import { defineConfig } from '@rslib/core'; +import { pluginPublint } from 'rsbuild-plugin-publint'; + +export default defineConfig({ + lib: [ + { + format: 'esm', + syntax: 'es2022', + dts: true, + bundle: false, + }, + ], + source: { + tsconfigPath: './tsconfig.build.json', + }, + plugins: [pluginPublint()], +}); diff --git a/packages/third-party/motion/src/animation/index.ts b/packages/motion/src/animation/index.ts similarity index 91% rename from packages/third-party/motion/src/animation/index.ts rename to packages/motion/src/animation/index.ts index 88d9844a25..d5351efcbe 100644 --- a/packages/third-party/motion/src/animation/index.ts +++ b/packages/motion/src/animation/index.ts @@ -47,6 +47,7 @@ import { isMainThreadElement, isMainThreadElementArray, } from '../utils/isMainThreadElement.js'; +import { noopMT } from '../utils/noop.js'; /** * Animate a sequence @@ -154,7 +155,6 @@ function animate( } else { elementNodes = subjectOrSequence; } - console.log('elementNodes', elementNodes); realSubjectOrSequence = (Array.isArray(elementNodes) ? elementNodes.map(el => new ElementCompt(el)) : new ElementCompt( @@ -166,12 +166,10 @@ function animate( // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module return animate_( - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - realSubjectOrSequence as any, - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - optionsOrKeyframes as any, - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - options as any, + // @ts-expect-error expected + realSubjectOrSequence, + optionsOrKeyframes, + options, ); } @@ -224,12 +222,10 @@ function mix(from: T, to: T, p?: T): Mixer | number { // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module return mix_( - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - from as any, - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - to as any, - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - p as any, + // @ts-expect-error expected + from, + to, + p, ); } @@ -274,7 +270,7 @@ function styleEffect( 'main thread'; const elements = elementOrSelector2Dom(subject); if (!elements) { - return () => {}; + return noopMT; } return styleEffect_( elements, @@ -282,8 +278,6 @@ function styleEffect( ); } -export const noop = (): void => {}; - export { animate, stagger, diff --git a/packages/third-party/motion/src/env_types/papi.d.ts b/packages/motion/src/env_types/papi.d.ts similarity index 100% rename from packages/third-party/motion/src/env_types/papi.d.ts rename to packages/motion/src/env_types/papi.d.ts diff --git a/packages/third-party/motion/src/hooks/useMotionEvent.ts b/packages/motion/src/hooks/useMotionEvent.ts similarity index 75% rename from packages/third-party/motion/src/hooks/useMotionEvent.ts rename to packages/motion/src/hooks/useMotionEvent.ts index ed21663368..cc00fa0b84 100644 --- a/packages/third-party/motion/src/hooks/useMotionEvent.ts +++ b/packages/motion/src/hooks/useMotionEvent.ts @@ -1,20 +1,27 @@ // Copyright 2025 The Lynx Authors. All rights reserved. // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. -import type { MotionValue, MotionValueEventCallbacks } from 'motion-dom'; +import type { MotionValueEventCallbacks } from 'motion-dom'; import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; import type { MainThreadRef } from '@lynx-js/react'; +interface Listenable { + on( + event: 'change', + callback: (v: V) => void, + ): () => void; +} + export function useMotionValueRefEvent< V, EventName extends keyof MotionValueEventCallbacks, >( - valueRef: MainThreadRef>, + valueRef: MainThreadRef>, event: 'change', callback: MotionValueEventCallbacks[EventName], ): void { - const unListenRef = useMainThreadRef(); + const unListenRef = useMainThreadRef<() => void>(); useEffect(() => { void runOnMainThread(() => { diff --git a/packages/third-party/motion/src/hooks/useMotionValueRef.ts b/packages/motion/src/hooks/useMotionValueRef.ts similarity index 79% rename from packages/third-party/motion/src/hooks/useMotionValueRef.ts rename to packages/motion/src/hooks/useMotionValueRef.ts index 9e1adec8a6..455aea0767 100644 --- a/packages/third-party/motion/src/hooks/useMotionValueRef.ts +++ b/packages/motion/src/hooks/useMotionValueRef.ts @@ -13,17 +13,18 @@ import type { import { motionValue } from '../animation/index.js'; -export function useMotionValueRef(value: T): MainThreadRef> { +export function useMotionValueRefCore( + value: T, + make: (v: T) => MV, +): MainThreadRef { // @ts-expect-error expected - const motionValueRef: MainThreadRef> = useMainThreadRef< - MotionValue - >(); + const motionValueRef: MainThreadRef = useMainThreadRef(); useMemo(() => { function setMotionValue(value: T) { 'main thread'; if (!motionValueRef.current) { - motionValueRef.current = motionValue(value); + motionValueRef.current = make(value); } } if (__BACKGROUND__) { @@ -37,3 +38,7 @@ export function useMotionValueRef(value: T): MainThreadRef> { return motionValueRef; } + +export function useMotionValueRef(value: T): MainThreadRef> { + return useMotionValueRefCore(value, motionValue); +} diff --git a/packages/third-party/motion/src/index.ts b/packages/motion/src/index.ts similarity index 100% rename from packages/third-party/motion/src/index.ts rename to packages/motion/src/index.ts diff --git a/packages/motion/src/mini/core/MotionValue.ts b/packages/motion/src/mini/core/MotionValue.ts new file mode 100644 index 0000000000..5854ca3b5a --- /dev/null +++ b/packages/motion/src/mini/core/MotionValue.ts @@ -0,0 +1,114 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { noopMT } from '../../utils/noop.js'; + +export interface MotionValue { + get(): T; + set(v: T): void; + getVelocity(): number; + jump(v: T): void; + // Standard Framer Motion API usually has `stop`, `isAnimating` etc. + // For mini version, keeping it simple but compatible with what was requested. + onChange(callback: (v: T) => void): () => void; + on(event: 'change', callback: (v: T) => void): () => void; + /** + * Internal method to update velocity, usually called by the animation loop. + */ + updateVelocity(v: number): void; + stop(): void; + /** + * @internal + */ + attach(cancel: () => void): () => void; +} + +export function createMotionValue(initial: T): MotionValue { + 'main thread'; + class MotionValueImpl implements MotionValue { + v: T; + velocity = 0; + listeners = new Set<(v: T) => void>(); + activeAnimations = new Set<() => void>(); + lastUpdated = 0; + + constructor(initial: T) { + this.v = initial; + } + + get() { + return this.v; + } + + set(v: T) { + const now = Date.now(); + if (typeof v === 'number' && typeof this.v === 'number') { + const delta = v - this.v; + const timeDelta = (now - this.lastUpdated) / 1000; + if (timeDelta > 0) { + // Simple instantaneous velocity + this.velocity = delta / timeDelta; + } + } + this.lastUpdated = now; + this.v = v; + this.notify(); + } + + updateVelocity(v: number) { + this.velocity = v; + } + + getVelocity() { + return this.velocity; + } + + jump(v: T) { + this.v = v; + this.velocity = 0; + this.lastUpdated = Date.now(); + this.notify(); + } + + onChange(callback: (v: T) => void) { + this.listeners.add(callback); + return () => this.listeners.delete(callback); + } + + on(event: 'change', callback: (v: T) => void) { + if (event === 'change') { + return this.onChange(callback); + } + return noopMT; + } + + notify() { + for (const cb of this.listeners) { + cb(this.v); + } + } + + attach(cancel: () => void) { + this.activeAnimations.add(cancel); + return () => this.activeAnimations.delete(cancel); + } + + stop() { + for (const cancel of this.activeAnimations) { + cancel(); + } + this.activeAnimations.clear(); + } + + toJSON() { + return String(this.v); + } + } + + return new MotionValueImpl(initial); +} + +export interface MotionValueEventCallbacks { + change: (v: V) => void; +} diff --git a/packages/motion/src/mini/core/animate.ts b/packages/motion/src/mini/core/animate.ts new file mode 100644 index 0000000000..ece963a281 --- /dev/null +++ b/packages/motion/src/mini/core/animate.ts @@ -0,0 +1,187 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { + anticipate, + backIn, + backInOut, + backOut, + circIn, + circInOut, + circOut, + easeIn, + easeInOut, + easeOut, + linear, +} from './easings.js'; +import type { MotionValue } from './MotionValue.js'; +import { spring } from './spring.js'; + +export type Easing = (t: number) => number; + +export interface AnimationOptions { + type?: 'spring' | 'keyframes' | 'decay'; + stiffness?: number; + damping?: number; + mass?: number; + duration?: number; + ease?: Easing; + from?: number; + to?: number; + velocity?: number; + onUpdate?: (v: number) => void; + onComplete?: () => void; +} + +// --- Easings --- + +// --- Easings --- + +export { + anticipate, + backIn, + backInOut, + backOut, + circIn, + circInOut, + circOut, + easeIn, + easeInOut, + easeOut, + linear, +}; + +// --- Animate --- + +export function animate( + value: MotionValue | number | ((v: number) => void), + target: number, + options: AnimationOptions = {}, +): { + stop: () => void; + then: (cb: () => void) => Promise; + onFinish: () => void; +} { + 'main thread'; + let currentV = 0; + let startVelocity = options.velocity ?? 0; + + // Resolve start value + if (typeof value === 'number') { + currentV = value; + } else if (typeof value === 'function') { + // If passed a setter, we can't easily read, assume 0 or options.from + currentV = options.from ?? 0; + } else { + currentV = value.get(); + startVelocity = startVelocity || value.getVelocity(); + if (value.stop) { + value.stop(); + } + } + + // If type is spring or no duration provided, default to spring. + // Unless ease is provided, then tween. + const isSpring = options.type === 'spring' + || (!options.ease && !options.duration && options.type !== 'keyframes'); + + const { from: _from, to: _to, ...springOptions } = options; + + // motion-dom spring() returns an animation generator with .next(t) + const solver = isSpring + ? spring({ + ...springOptions, + keyframes: [currentV, target], + velocity: startVelocity, + }) + : null; + + const startTime = Date.now(); + let canceled = false; + + const controls = { + stop: () => { + canceled = true; + }, + then: (cb: () => void) => { + controls.onFinish = cb; + return Promise.resolve(); // Mock promise return async/await usage + }, + // biome-ignore lint/suspicious/noEmptyBlockStatements: + onFinish: () => {}, + }; + + const duration = options.duration ?? 0.3; + const ease = options.ease ?? easeOut; + + let detach: (() => void) | undefined; + if ( + typeof value === 'object' && value && 'attach' in value + && typeof value.attach === 'function' + ) { + detach = value.attach(controls.stop); + } + + const tick = () => { + if (canceled) return; + + const now = Date.now(); + const elapsed = (now - startTime) / 1000; // seconds + const elapsedMs = now - startTime; // milliseconds + + let finished = false; + let current = 0; + + if (isSpring && solver) { + // motion-dom spring generator expects time in milliseconds usually + const state = solver.next(elapsedMs) as { value: number; done: boolean }; + current = state.value; + finished = state.done; + } else { + // Tween + if (elapsed >= duration) { + finished = true; + current = target; + } else { + const p = elapsed / duration; + const eased = ease(p); + current = currentV + (target - currentV) * eased; + } + } + + // Determine how to update + if (typeof value === 'function') { + value(current); + } else if (typeof value === 'object' && value.set) { + value.set(current); + } + + if (options.onUpdate) { + options.onUpdate(current); + } + + if (finished) { + // Ensure final frame is exact for tween + if (!isSpring) { + if (typeof value === 'function') { + value(target); + } else if (typeof value === 'object' && value.set) { + value.set(target); + value.updateVelocity(0); + } + } + + if (options.onComplete) { + options.onComplete(); + } + controls.onFinish(); + detach?.(); + } else { + requestAnimationFrame(tick); + } + }; + + requestAnimationFrame(tick); + return controls; +} diff --git a/packages/motion/src/mini/core/easings.ts b/packages/motion/src/mini/core/easings.ts new file mode 100644 index 0000000000..8a1897d13c --- /dev/null +++ b/packages/motion/src/mini/core/easings.ts @@ -0,0 +1,100 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { + anticipate as anticipate_, + backInOut as backInOut_, + backIn as backIn_, + backOut as backOut_, + circInOut as circInOut_, + circIn as circIn_, + circOut as circOut_, + easeInOut as easeInOut_, + easeIn as easeIn_, + easeOut as easeOut_, + noop as linear_, +} from 'motion-utils'; + +import { registerCallable } from '../../utils/registeredFunction.js'; + +let anticipateHandle = 'anticipateHandle'; +let backInHandle = 'backInHandle'; +let backInOutHandle = 'backInOutHandle'; +let backOutHandle = 'backOutHandle'; +let circInHandle = 'circInHandle'; +let circInOutHandle = 'circInOutHandle'; +let circOutHandle = 'circOutHandle'; +let easeInHandle = 'easeInHandle'; +let easeInOutHandle = 'easeInOutHandle'; +let easeOutHandle = 'easeOutHandle'; +let linearHandle = 'linearHandle'; + +if (__MAIN_THREAD__) { + anticipateHandle = registerCallable(anticipate_, 'anticipateHandle'); + backInHandle = registerCallable(backIn_, 'backInHandle'); + backInOutHandle = registerCallable(backInOut_, 'backInOutHandle'); + backOutHandle = registerCallable(backOut_, 'backOutHandle'); + circInHandle = registerCallable(circIn_, 'circInHandle'); + circInOutHandle = registerCallable(circInOut_, 'circInOutHandle'); + circOutHandle = registerCallable(circOut_, 'circOutHandle'); + easeInHandle = registerCallable(easeIn_, 'easeInHandle'); + easeInOutHandle = registerCallable(easeInOut_, 'easeInOutHandle'); + easeOutHandle = registerCallable(easeOut_, 'easeOutHandle'); + linearHandle = registerCallable(linear_, 'linearHandle'); +} + +export function anticipate(t: number): number { + 'main thread'; + return globalThis.runOnRegistered(anticipateHandle)(t); +} + +export function backIn(t: number): number { + 'main thread'; + return globalThis.runOnRegistered(backInHandle)(t); +} + +export function backInOut(t: number): number { + 'main thread'; + return globalThis.runOnRegistered(backInOutHandle)(t); +} + +export function backOut(t: number): number { + 'main thread'; + return globalThis.runOnRegistered(backOutHandle)(t); +} + +export function circIn(t: number): number { + 'main thread'; + return globalThis.runOnRegistered(circInHandle)(t); +} + +export function circInOut(t: number): number { + 'main thread'; + return globalThis.runOnRegistered(circInOutHandle)(t); +} + +export function circOut(t: number): number { + 'main thread'; + return globalThis.runOnRegistered(circOutHandle)(t); +} + +export function easeIn(t: number): number { + 'main thread'; + return globalThis.runOnRegistered(easeInHandle)(t); +} + +export function easeInOut(t: number): number { + 'main thread'; + return globalThis.runOnRegistered(easeInOutHandle)(t); +} + +export function easeOut(t: number): number { + 'main thread'; + return globalThis.runOnRegistered(easeOutHandle)(t); +} + +export function linear(t: number): number { + 'main thread'; + return globalThis.runOnRegistered(linearHandle)(t); +} diff --git a/packages/motion/src/mini/core/spring.ts b/packages/motion/src/mini/core/spring.ts new file mode 100644 index 0000000000..79ec42af52 --- /dev/null +++ b/packages/motion/src/mini/core/spring.ts @@ -0,0 +1,21 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { spring as spring_ } from 'motion-dom'; + +import { registerCallable } from '../../utils/registeredFunction.js'; + +let springHandle = 'springHandle'; + +if (__MAIN_THREAD__) { + springHandle = registerCallable(spring_, 'springHandle'); +} + +export function spring( + ...args: Parameters +): ReturnType { + 'main thread'; + // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module + return globalThis.runOnRegistered(springHandle)(...args); +} diff --git a/packages/motion/src/mini/index.ts b/packages/motion/src/mini/index.ts new file mode 100644 index 0000000000..9bcbc1a6a7 --- /dev/null +++ b/packages/motion/src/mini/index.ts @@ -0,0 +1,51 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. +import type { MainThreadRef } from '@lynx-js/react'; + +import '../polyfill/shim.js'; + +import { useMotionValueRefEvent as useMotionValueRefEvent_ } from '../hooks/useMotionEvent.js'; +import { useMotionValueRefCore } from '../hooks/useMotionValueRef.js'; +import { createMotionValue } from './core/MotionValue.js'; +import type { + MotionValue, + MotionValueEventCallbacks, +} from './core/MotionValue.js'; + +export { + animate, + anticipate, + backIn, + backInOut, + backOut, + circIn, + circInOut, + circOut, + easeIn, + easeInOut, + easeOut, + linear, +} from './core/animate.js'; +export type { AnimationOptions, Easing } from './core/animate.js'; +export { createMotionValue } from './core/MotionValue.js'; +export type { + MotionValue, + MotionValueEventCallbacks, +} from './core/MotionValue.js'; +export { spring } from './core/spring.js'; + +export function useMotionValueRef(value: T): MainThreadRef> { + return useMotionValueRefCore(value, createMotionValue); +} + +export function useMotionValueRefEvent< + V, + EventName extends keyof MotionValueEventCallbacks, +>( + valueRef: MainThreadRef>, + event: 'change', + callback: MotionValueEventCallbacks[EventName], +): void { + return useMotionValueRefEvent_(valueRef, event, callback); +} diff --git a/packages/third-party/motion/src/modified/motionValue.ts b/packages/motion/src/modified/motionValue.ts similarity index 88% rename from packages/third-party/motion/src/modified/motionValue.ts rename to packages/motion/src/modified/motionValue.ts index 740ff58290..e46db8c9e5 100644 --- a/packages/third-party/motion/src/modified/motionValue.ts +++ b/packages/motion/src/modified/motionValue.ts @@ -5,7 +5,7 @@ import { MotionValue } from 'motion-dom' with { runtime: 'shared' }; import type { MotionValueOptions } from 'motion-dom'; -class CustomMotionValue extends MotionValue { +class CustomMotionValue extends MotionValue { toJSON() { return {}; } diff --git a/packages/third-party/motion/src/polyfill/MotionValue.ts b/packages/motion/src/polyfill/MotionValue.ts similarity index 53% rename from packages/third-party/motion/src/polyfill/MotionValue.ts rename to packages/motion/src/polyfill/MotionValue.ts index 6b9fa3c986..24408e0e06 100644 --- a/packages/third-party/motion/src/polyfill/MotionValue.ts +++ b/packages/motion/src/polyfill/MotionValue.ts @@ -4,10 +4,10 @@ import { MotionValue } from 'motion-dom'; /** - * This hack is needed to prevent large bulk of cross thread communication happened. - * This is because what MainThreadScript working for syncing MainThread and Background Thread - * But actually this is not needed, because we have single source of truth in MainThread - * So we can just ignore the cross thread communication + * Prevents excessive cross-thread communication. + * + * This override avoids unnecessary synchronization between the Main and Background + * threads, as the Main Thread serves as the single source of truth. */ // @ts-expect-error expected diff --git a/packages/third-party/motion/src/polyfill/element.ts b/packages/motion/src/polyfill/element.ts similarity index 91% rename from packages/third-party/motion/src/polyfill/element.ts rename to packages/motion/src/polyfill/element.ts index a9d2248877..b37a21ce8f 100644 --- a/packages/third-party/motion/src/polyfill/element.ts +++ b/packages/motion/src/polyfill/element.ts @@ -43,7 +43,6 @@ export class ElementCompt { this.element.setStyleProperty('transform', 'scale(1, 1)'); return true; } - console.log('setStyle', prop, value); this.element.setStyleProperty(prop, String(value)); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment target[prop] = value; @@ -173,28 +172,17 @@ export class ElementCompt { y: number; } { // Parse dimensions from computed style - const width = parseFloat(this.getStyleProperty('width')) || 0; - const height = parseFloat(this.getStyleProperty('height')) || 0; + const width = Number.parseFloat(this.getStyleProperty('width')) || 0; + const height = Number.parseFloat(this.getStyleProperty('height')) || 0; // Parse position - these may be 'auto' or pixel values - const left = parseFloat(this.getStyleProperty('left')) || 0; - const top = parseFloat(this.getStyleProperty('top')) || 0; + const left = Number.parseFloat(this.getStyleProperty('left')) || 0; + const top = Number.parseFloat(this.getStyleProperty('top')) || 0; // Calculate bounds const right = left + width; const bottom = top + height; - console.log('getBoundingClient', { - left, - top, - right, - bottom, - width, - height, - x: left, - y: top, - }); - return { left, top, diff --git a/packages/third-party/motion/src/polyfill/shim.ts b/packages/motion/src/polyfill/shim.ts similarity index 93% rename from packages/third-party/motion/src/polyfill/shim.ts rename to packages/motion/src/polyfill/shim.ts index 58b4778443..355fa384f7 100644 --- a/packages/third-party/motion/src/polyfill/shim.ts +++ b/packages/motion/src/polyfill/shim.ts @@ -24,7 +24,7 @@ function shimGlobals() { // Only shim queueMicrotask if it doesn't exist if (!globalThis.queueMicrotask) { - globalThis.queueMicrotask = (fn: any) => { + globalThis.queueMicrotask = (fn: CallableFunction) => { void Promise.resolve().then(() => { // eslint-disable-next-line @typescript-eslint/no-unsafe-call fn(); @@ -60,6 +60,7 @@ function shimGlobals() { if (!globalThis.window) { // @ts-expect-error error globalThis.window = { + // biome-ignore lint/suspicious/noExplicitAny: getComputedStyle: (ele: any) => { // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access return ele.getComputedStyle(); @@ -83,7 +84,7 @@ if (__MAIN_THREAD__) { // Only shim queueMicrotask if it doesn't exist // eslint-disable-next-line unicorn/no-lonely-if if (!globalThis.queueMicrotask) { - globalThis.queueMicrotask = (fn: any) => { + globalThis.queueMicrotask = (fn: CallableFunction) => { void Promise.resolve().then(() => { // eslint-disable-next-line @typescript-eslint/no-unsafe-call fn(); diff --git a/packages/third-party/motion/src/types/index.ts b/packages/motion/src/types/index.ts similarity index 84% rename from packages/third-party/motion/src/types/index.ts rename to packages/motion/src/types/index.ts index 848414bdb3..e38aaef933 100644 --- a/packages/third-party/motion/src/types/index.ts +++ b/packages/motion/src/types/index.ts @@ -2,6 +2,6 @@ // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. -import { MainThread } from '@lynx-js/types'; +import type { MainThread } from '@lynx-js/types'; export type ElementOrElements = MainThread.Element | MainThread.Element[]; diff --git a/packages/third-party/motion/src/utils/elementHelper.ts b/packages/motion/src/utils/elementHelper.ts similarity index 100% rename from packages/third-party/motion/src/utils/elementHelper.ts rename to packages/motion/src/utils/elementHelper.ts diff --git a/packages/third-party/motion/src/utils/isMainThreadElement.ts b/packages/motion/src/utils/isMainThreadElement.ts similarity index 100% rename from packages/third-party/motion/src/utils/isMainThreadElement.ts rename to packages/motion/src/utils/isMainThreadElement.ts diff --git a/packages/third-party/motion/src/utils/noop.ts b/packages/motion/src/utils/noop.ts similarity index 64% rename from packages/third-party/motion/src/utils/noop.ts rename to packages/motion/src/utils/noop.ts index 71e7b374b5..7df8988f0f 100644 --- a/packages/third-party/motion/src/utils/noop.ts +++ b/packages/motion/src/utils/noop.ts @@ -2,4 +2,9 @@ // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. +// biome-ignore lint/suspicious/noEmptyBlockStatements: export const noop = (): void => {}; + +export function noopMT(): void { + 'main thread'; +} diff --git a/packages/third-party/motion/src/utils/registeredFunction.ts b/packages/motion/src/utils/registeredFunction.ts similarity index 93% rename from packages/third-party/motion/src/utils/registeredFunction.ts rename to packages/motion/src/utils/registeredFunction.ts index 086fea4c04..a94eb6c5c8 100644 --- a/packages/third-party/motion/src/utils/registeredFunction.ts +++ b/packages/motion/src/utils/registeredFunction.ts @@ -19,6 +19,7 @@ export function runOnRegistered( } declare global { + // biome-ignore lint/suspicious/noRedeclare: var runOnRegistered: ( id: string, ) => T; diff --git a/packages/motion/tsconfig.build.json b/packages/motion/tsconfig.build.json new file mode 100644 index 0000000000..799973d8d0 --- /dev/null +++ b/packages/motion/tsconfig.build.json @@ -0,0 +1,17 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "noEmit": true, + "stripInternal": true, + "target": "ESNext", + "lib": ["es2021"], + "module": "nodenext", + "moduleResolution": "nodenext", + "resolveJsonModule": true, + "composite": true, + "jsx": "react-jsx", + "jsxImportSource": "@lynx-js/react", + "rootDir": "src", + }, + "include": ["src/**/*.ts", "src/**/*.tsx"], +} diff --git a/packages/motion/tsconfig.json b/packages/motion/tsconfig.json new file mode 100644 index 0000000000..e13dabad5d --- /dev/null +++ b/packages/motion/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig.build.json" }, + { "path": "./tsconfig.test.json" }, + ], +} diff --git a/packages/motion/tsconfig.test.json b/packages/motion/tsconfig.test.json new file mode 100644 index 0000000000..47898dc37b --- /dev/null +++ b/packages/motion/tsconfig.test.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "noEmit": true + }, + "include": ["__tests__"] +} diff --git a/packages/third-party/motion/vitest.config.ts b/packages/motion/vitest.config.ts similarity index 100% rename from packages/third-party/motion/vitest.config.ts rename to packages/motion/vitest.config.ts diff --git a/packages/third-party/motion/__tests__/animation.test.tsx b/packages/third-party/motion/__tests__/animation.test.tsx deleted file mode 100644 index 08bc349cce..0000000000 --- a/packages/third-party/motion/__tests__/animation.test.tsx +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. - -import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; - -import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; -import { act, render } from '@lynx-js/react/testing-library'; -import { MainThread } from '@lynx-js/types'; - -import { animate } from '../src/index.js'; -import { noop } from '../src/utils/noop.js'; - -describe('motion wrapping animation functions', () => { - let _mockRegisterCallable; - beforeEach(() => { - const mockRegisteredMap = new Map(); - vi.spyOn(globalThis, 'runOnRegistered', 'get').mockImplementation(function( - id: string, - ) { - const func = mockRegisteredMap.get(id) ?? noop; - return func; - }); - - function mockRegisterCallable( - func: CallableFunction, - id: string, - ): CallableFunction { - mockRegisteredMap.set(id, func); - - return func; - } - - _mockRegisterCallable = mockRegisterCallable; - }); - - afterEach(() => { - vi.restoreAllMocks(); - }); - - test('motion animate should be called', async () => { - let _startAnimation: () => void; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call - const _mockAnimate = _mockRegisterCallable(vi.fn(), 'animate'); - - const App = () => { - const boxMTRef = useMainThreadRef(null); - - console.log('renderApp'); - - function startAnimation() { - 'main thread'; - - if (boxMTRef.current) { - animate( - boxMTRef.current, - { scale: 0.4, rotate: '45deg' }, - { - ease: 'circInOut', - duration: 1, - repeat: Number.POSITIVE_INFINITY, - repeatType: 'reverse', - }, - ); - } - } - - _startAnimation = startAnimation; - - return ( - - - - ); - }; - - await act(() => { - render(, { - enableMainThread: true, - enableBackgroundThread: true, - }); - }); - - await runOnMainThread(() => { - 'main thread'; - _startAnimation(); - })(); - - // Check that the mock was called - expect(_mockAnimate).toHaveBeenCalled(); - - // You can also check what arguments it received - expect(_mockAnimate).toHaveBeenCalledWith( - expect.anything(), // the element - { scale: 0.4, rotate: '45deg' }, - { - ease: 'circInOut', - duration: 1, - repeat: Number.POSITIVE_INFINITY, - repeatType: 'reverse', - }, - ); - }); -}); diff --git a/packages/third-party/motion/src/mini/index.ts b/packages/third-party/motion/src/mini/index.ts deleted file mode 100644 index 419424a8cc..0000000000 --- a/packages/third-party/motion/src/mini/index.ts +++ /dev/null @@ -1,376 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -import '../polyfill/shim.js'; - -import { spring as spring_ } from 'motion-dom'; - -import { - runOnMainThread, - useEffect, - useMainThreadRef, - useMemo, -} from '@lynx-js/react'; -import type { MainThreadRef } from '@lynx-js/react'; -import type { - Worklet, - WorkletRef, -} from '@lynx-js/react/worklet-runtime/bindings'; -import { runWorkletCtx } from '@lynx-js/react/worklet-runtime/bindings'; - -import { registerCallable } from '../utils/registeredFunction.js'; - -function noopMT() { - 'main thread'; -} - -let springHandle = 'springHandle'; - -if (__MAIN_THREAD__) { - springHandle = registerCallable(spring_, 'springHandle'); -} else { - console.log('ohmyoh bts'); -} - -export function spring( - ...args: Parameters -): ReturnType { - 'main thread'; - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return globalThis.runOnRegistered(springHandle)(...args); -} - -export interface MotionValue { - get(): T; - set(v: T): void; - getVelocity(): number; - jump(v: T): void; - // Standard Framer Motion API usually has `stop`, `isAnimating` etc. - // For mini version, keeping it simple but compatible with what was requested. - onChange(callback: (v: T) => void): () => void; - on(event: 'change', callback: (v: T) => void): () => void; - /** - * Internal method to update velocity, usually called by the animation loop. - */ - updateVelocity(v: number): void; - stop(): void; - /** - * @internal - */ - attach(cancel: () => void): () => void; -} - -export function createMotionValue(initial: T): MotionValue { - 'main thread'; - class MotionValueImpl implements MotionValue { - v: T; - velocity = 0; - listeners = new Set<(v: T) => void>(); - activeAnimations = new Set<() => void>(); - lastUpdated = 0; - - constructor(initial: T) { - this.v = initial; - } - - get() { - return this.v; - } - - set(v: T) { - const now = Date.now(); - if (typeof v === 'number' && typeof this.v === 'number') { - const delta = v - this.v; - const timeDelta = (now - this.lastUpdated) / 1000; - if (timeDelta > 0) { - // Simple instantaneous velocity - this.velocity = delta / timeDelta; - } - } - this.lastUpdated = now; - this.v = v; - this.notify(); - } - - updateVelocity(v: number) { - this.velocity = v; - } - - getVelocity() { - return this.velocity; - } - - jump(v: T) { - this.v = v; - this.velocity = 0; - this.lastUpdated = Date.now(); - this.notify(); - } - - onChange(callback: (v: T) => void) { - this.listeners.add(callback); - return () => this.listeners.delete(callback); - } - - on(event: 'change', callback: (v: T) => void) { - if (event === 'change') { - return this.onChange(callback); - } - return noopMT; - } - - notify() { - for (const cb of this.listeners) { - cb(this.v); - } - } - - attach(cancel: () => void) { - this.activeAnimations.add(cancel); - return () => this.activeAnimations.delete(cancel); - } - - stop() { - for (const cancel of this.activeAnimations) { - cancel(); - } - this.activeAnimations.clear(); - } - - toJSON() { - return String(this.v); - } - } - - return new MotionValueImpl(initial); -} - -export interface MotionValueEventCallbacks { - change: (v: V) => void; -} - -export type Easing = (t: number) => number; - -export interface AnimationOptions { - type?: 'spring' | 'keyframes' | 'decay'; - stiffness?: number; - damping?: number; - mass?: number; - duration?: number; - ease?: Easing; - from?: number; - to?: number; - velocity?: number; - onUpdate?: (v: number) => void; - onComplete?: () => void; -} - -// --- Easings --- -export const linear: Easing = t => t; -export const easeIn: Easing = t => t * t; -export const easeOut: Easing = t => t * (2 - t); -export const easeInOut: Easing = t => - t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; -export const circIn: Easing = t => 1 - Math.sin(Math.acos(t)); -export const circOut: Easing = t => Math.sin(Math.acos(t - 1)); -export const circInOut: Easing = t => - t < 0.5 - ? (1 - Math.sqrt(1 - 4 * t * t)) / 2 - : (Math.sqrt(1 - (-2 * t + 2) ** 2) + 1) / 2; -export const backIn: Easing = t => t * t * ((1.70158 + 1) * t - 1.70158); -export const backOut: Easing = t => --t * t * ((1.70158 + 1) * t + 1.70158) + 1; -export const backInOut: Easing = t => { - const c1 = 1.70158; - const c2 = c1 * 1.525; - return t < 0.5 - ? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2 - : (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (2 * t - 2) + c2) + 2) / 2; -}; -export const anticipate: Easing = t => { - const s = 1.70158 * 1.525; - return (t *= 2) < 1 - ? 0.5 * (t * t * ((s + 1) * t - s)) - : 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2); -}; - -// --- Animate --- - -export function animate( - value: MotionValue | number | ((v: number) => void), - target: number, - options: AnimationOptions = {}, -): { - stop: () => void; - then: (cb: () => void) => Promise; - onFinish: () => void; -} { - 'main thread'; - let currentV = 0; - let startVelocity = options.velocity ?? 0; - - // Resolve start value - if (typeof value === 'number') { - currentV = value; - } else if (typeof value === 'function') { - // If passed a setter, we can't easily read, assume 0 or options.from - currentV = options.from ?? 0; - } else { - currentV = value.get(); - startVelocity = startVelocity || value.getVelocity(); - if (value.stop) { - value.stop(); - } - } - - // If type is spring or no duration provided, default to spring. - // Unless ease is provided, then tween. - const isSpring = options.type === 'spring' - || (!options.ease && !options.duration && options.type !== 'keyframes'); - - const { from: _from, to: _to, ...springOptions } = options; - - // motion-dom spring() returns an animation generator with .next(t) - const solver = isSpring - ? spring({ - ...springOptions, - keyframes: [currentV, target], - velocity: startVelocity, - }) - : null; - - const startTime = Date.now(); - let canceled = false; - - const controls = { - stop: () => { - canceled = true; - }, - then: (cb: () => void) => { - controls.onFinish = cb; - return Promise.resolve(); // Mock promise return async/await usage - }, - onFinish: () => {}, - }; - - const duration = options.duration ?? 0.3; - const ease = options.ease ?? easeOut; - - let detach: (() => void) | undefined; - if ( - typeof value === 'object' && value && 'attach' in value - && typeof value.attach === 'function' - ) { - detach = value.attach(controls.stop); - } - - const tick = () => { - if (canceled) return; - - const now = Date.now(); - const elapsed = (now - startTime) / 1000; // seconds - const elapsedMs = now - startTime; // milliseconds - - let finished = false; - let current = 0; - - if (isSpring && solver) { - // motion-dom spring generator expects time in milliseconds usually - const state = solver.next(elapsedMs) as { value: number; done: boolean }; - current = state.value; - finished = state.done; - } else { - // Tween - if (elapsed >= duration) { - finished = true; - current = target; - } else { - const p = elapsed / duration; - const eased = ease(p); - current = currentV + (target - currentV) * eased; - } - } - - // Determine how to update - if (typeof value === 'function') { - value(current); - } else if (typeof value === 'object' && value.set) { - value.set(current); - } - - if (options.onUpdate) { - options.onUpdate(current); - } - - if (finished) { - // Ensure final frame is exact for tween - if (!isSpring) { - if (typeof value === 'function') { - value(target); - } else if (typeof value === 'object' && value.set) { - value.set(target); - value.updateVelocity(0); - } - } - - if (options.onComplete) { - options.onComplete(); - } - controls.onFinish(); - detach?.(); - } else { - requestAnimationFrame(tick); - } - }; - - requestAnimationFrame(tick); - return controls; -} - -export function useMotionValueRef(value: T): MainThreadRef> { - // @ts-expect-error expected - const motionValueRef: MainThreadRef> = useMainThreadRef< - MotionValue - >(); - - useMemo(() => { - function setMotionValue(value: T) { - 'main thread'; - if (!motionValueRef.current) { - motionValueRef.current = createMotionValue(value); - } - } - if (__BACKGROUND__) { - void runOnMainThread(setMotionValue)(value); - } else { - runWorkletCtx(setMotionValue as unknown as Worklet, [ - value as WorkletRef, - ]); - } - }, []); - - return motionValueRef; -} - -export function useMotionValueRefEvent< - V, - EventName extends keyof MotionValueEventCallbacks, ->( - valueRef: MainThreadRef>, - event: 'change', - callback: MotionValueEventCallbacks[EventName], -): void { - const unListenRef = useMainThreadRef<() => void>(); - - useEffect(() => { - void runOnMainThread(() => { - 'main thread'; - unListenRef.current = valueRef.current.on(event, callback); - })(); - return () => { - void runOnMainThread(() => { - 'main thread'; - unListenRef.current?.(); - })(); - }; - }, [callback]); -} diff --git a/packages/third-party/motion/tsconfig.build.json b/packages/third-party/motion/tsconfig.build.json deleted file mode 100644 index 670455b7ee..0000000000 --- a/packages/third-party/motion/tsconfig.build.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": [ - "src", - ], -} diff --git a/packages/third-party/motion/tsconfig.json b/packages/third-party/motion/tsconfig.json deleted file mode 100644 index 200a8cdd4e..0000000000 --- a/packages/third-party/motion/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "module": "ESNEXT", - "moduleResolution": "bundler", - "outDir": "./dist", - "rootDir": "./src", - "composite": true, - "jsx": "react-jsx", - "jsxImportSource": "@lynx-js/react", - }, - "include": [ - "src", - "__tests__", - ], -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 77076a499f..7687f80675 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -188,9 +188,9 @@ importers: examples/motion: dependencies: - '@lynx-js/motion-lynx': + '@lynx-js/motion': specifier: workspace:* - version: link:../../packages/third-party/motion + version: link:../../packages/motion '@lynx-js/react': specifier: workspace:* version: link:../../packages/react @@ -208,8 +208,8 @@ importers: specifier: workspace:* version: link:../../packages/rspeedy/core '@lynx-js/types': - specifier: 3.4.11 - version: 3.4.11 + specifier: 3.6.0 + version: 3.6.0 '@types/react': specifier: ^18.3.25 version: 18.3.25 @@ -457,6 +457,28 @@ importers: specifier: ^5.9.3 version: 5.9.3 + packages/motion: + dependencies: + framer-motion: + specifier: 12.23.12 + version: 12.23.12(react-dom@19.2.3(react@19.2.3))(react@19.2.3) + motion-dom: + specifier: 12.23.12 + version: 12.23.12 + motion-utils: + specifier: 12.23.6 + version: 12.23.6 + devDependencies: + '@lynx-js/react': + specifier: workspace:* + version: link:../react + '@lynx-js/types': + specifier: 3.6.0 + version: 3.6.0 + rsbuild-plugin-publint: + specifier: 0.3.3 + version: 0.3.3(@rsbuild/core@1.7.1) + packages/react: dependencies: preact: @@ -1014,25 +1036,6 @@ importers: specifier: 0.3.3 version: 0.3.3(@rsbuild/core@1.7.1) - packages/third-party/motion: - dependencies: - framer-motion: - specifier: 12.23.12 - version: 12.23.12(react-dom@19.2.3(react@19.2.3))(react@19.2.3) - motion-dom: - specifier: 12.23.12 - version: 12.23.12 - motion-utils: - specifier: 12.23.6 - version: 12.23.6 - devDependencies: - '@lynx-js/react': - specifier: workspace:* - version: link:../../react - '@lynx-js/types': - specifier: 3.4.11 - version: 3.4.11 - packages/tools/canary-release: dependencies: '@manypkg/get-packages': @@ -3061,9 +3064,6 @@ packages: '@lynx-js/type-element-api@0.0.2': resolution: {integrity: sha512-Unz3RHf2RM2vOWForwubjLYw9xbBP02ReuOL4KVLc3+0Vzryo8KbgqbhMUZCsJXHVmcaE2zXiE1AV/nqrBAoPA==} - '@lynx-js/types@3.4.11': - resolution: {integrity: sha512-k4mu4d2xmMqMIP1e7WGPdzO/k9x9W35b/OE/awalQUbcLlruFatagEOEM6TANK/VuRvEl0eLXQjhBnSwGkgt5w==} - '@lynx-js/types@3.6.0': resolution: {integrity: sha512-nNCuFP5Cpd7X/D3X7JsQLYkiIUsr6iTsRpqSz4swUdlNpK64Xt9epdjkqxbruuUqplFFmkhjThjWN4Bc8uZNWQ==} @@ -11494,10 +11494,6 @@ snapshots: '@lynx-js/type-element-api@0.0.2': {} - '@lynx-js/types@3.4.11': - dependencies: - csstype: 3.1.3 - '@lynx-js/types@3.6.0': dependencies: csstype: 3.1.3 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 7ce8f98284..dfb85fe144 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -17,7 +17,7 @@ packages: - packages/tailwind-preset - packages/testing-library/* - packages/testing-library/examples/* - - packages/third-party/motion + - packages/motion - packages/tools/* - packages/use-sync-external-store - packages/web-platform/* diff --git a/tsconfig.json b/tsconfig.json index 1d17ab41b8..88be4df1fe 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -123,7 +123,7 @@ "path": "./packages/react" }, { - "path": "./packages/lynx" + "path": "./packages/motion" }, { "path": "./packages/tailwind-preset/tsconfig.build.json" From e9e81879b47288e510d282895222b3f077d55409 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Fri, 16 Jan 2026 17:06:08 +0800 Subject: [PATCH 20/37] feat: add more tests for motion --- biome.jsonc | 2 +- .../motion/__tests__/MotionValue.test.tsx | 464 ++++++++++++++++++ packages/motion/__tests__/animate.test.tsx | 361 ++++++++++++++ .../__tests__/api-compatibility.test.tsx | 443 +++++++++++++++++ packages/motion/__tests__/easings.test.ts | 207 ++++++++ packages/motion/__tests__/hooks.test.tsx | 217 ++++++++ packages/motion/__tests__/utilities.test.ts | 185 +++++++ packages/motion/src/index.ts | 1 - packages/motion/src/mini/core/MotionValue.ts | 27 +- packages/motion/tsconfig.test.json | 9 +- 10 files changed, 1910 insertions(+), 6 deletions(-) create mode 100644 packages/motion/__tests__/MotionValue.test.tsx create mode 100644 packages/motion/__tests__/animate.test.tsx create mode 100644 packages/motion/__tests__/api-compatibility.test.tsx create mode 100644 packages/motion/__tests__/easings.test.ts create mode 100644 packages/motion/__tests__/hooks.test.tsx create mode 100644 packages/motion/__tests__/utilities.test.ts diff --git a/biome.jsonc b/biome.jsonc index e759b8aad1..92155f6a05 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -54,7 +54,7 @@ "packages/testing-library/**", "packages/react/testing-library/**", "packages/lynx/gesture-runtime/__test__/**", - "packages/motion/__tests__/**" + "packages/motion/__tests__/**", ], "rules": { // We are migrating from ESLint to Biome diff --git a/packages/motion/__tests__/MotionValue.test.tsx b/packages/motion/__tests__/MotionValue.test.tsx new file mode 100644 index 0000000000..9d63f66d29 --- /dev/null +++ b/packages/motion/__tests__/MotionValue.test.tsx @@ -0,0 +1,464 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { beforeEach, describe, expect, test, vi } from 'vitest'; + +import { createMotionValue } from '../src/mini/core/MotionValue.js'; +import { noopMT } from '../src/utils/noop.js'; + +describe('MotionValue', () => { + let mockRegisteredMap: Map; + + beforeEach(() => { + mockRegisteredMap = new Map(); + vi.spyOn(globalThis, 'runOnRegistered', 'get').mockImplementation( + function(id: string) { + const func = mockRegisteredMap.get(id) ?? noopMT; + return func; + }, + ); + }); + + describe('createMotionValue', () => { + test('should create motion value with initial number value', () => { + const mv = createMotionValue(0); + expect(mv.get()).toBe(0); + }); + + test('should create motion value with initial string value', () => { + const mv = createMotionValue('hello'); + expect(mv.get()).toBe('hello'); + }); + + test('should create motion value with initial object value', () => { + const obj = { x: 10, y: 20 }; + const mv = createMotionValue(obj); + expect(mv.get()).toBe(obj); + }); + }); + + describe('get() and set()', () => { + test('should get and set number values', () => { + const mv = createMotionValue(0); + expect(mv.get()).toBe(0); + + mv.set(100); + expect(mv.get()).toBe(100); + }); + + test('should get and set string values', () => { + const mv = createMotionValue('initial'); + expect(mv.get()).toBe('initial'); + + mv.set('updated'); + expect(mv.get()).toBe('updated'); + }); + + test('should trigger listeners on set', () => { + const mv = createMotionValue(0); + const listener = vi.fn(); + + mv.onChange(listener); + mv.set(50); + + expect(listener).toHaveBeenCalledWith(50); + expect(listener).toHaveBeenCalledTimes(1); + }); + }); + + describe('velocity tracking', () => { + test('should track velocity on number value changes', () => { + vi.useFakeTimers(); + const mv = createMotionValue(0); + + mv.set(0); + vi.advanceTimersByTime(100); // 0.1s + mv.set(10); + + // velocity = delta / time = 10 / 0.1 = 100 + const velocity = mv.getVelocity(); + expect(velocity).toBeCloseTo(100, 0); + + vi.useRealTimers(); + }); + + test('should update velocity on subsequent changes', () => { + vi.useFakeTimers(); + const mv = createMotionValue(0); + + mv.set(0); + vi.advanceTimersByTime(100); + mv.set(10); + + vi.advanceTimersByTime(100); + mv.set(20); + + // velocity = delta / time = 10 / 0.1 = 100 + const velocity = mv.getVelocity(); + expect(velocity).toBeCloseTo(100, 0); + + vi.useRealTimers(); + }); + + test('should not track velocity for non-number values', () => { + const mv = createMotionValue('a'); + mv.set('b'); + + expect(mv.getVelocity()).toBe(0); + }); + + test('should allow manual velocity update', () => { + const mv = createMotionValue(0); + mv.updateVelocity(500); + + expect(mv.getVelocity()).toBe(500); + }); + }); + + describe('jump()', () => { + test('should set value without triggering velocity calculation', () => { + const mv = createMotionValue(0); + mv.jump(100); + + expect(mv.get()).toBe(100); + expect(mv.getVelocity()).toBe(0); + }); + + test('should trigger listeners on jump', () => { + const mv = createMotionValue(0); + const listener = vi.fn(); + + mv.onChange(listener); + mv.jump(50); + + expect(listener).toHaveBeenCalledWith(50); + }); + + test('should reset velocity to zero', () => { + const mv = createMotionValue(0); + mv.updateVelocity(100); + + mv.jump(50); + + expect(mv.getVelocity()).toBe(0); + }); + }); + + describe('onChange() and on()', () => { + test('should subscribe to value changes with onChange', () => { + const mv = createMotionValue(0); + const listener = vi.fn(); + + mv.onChange(listener); + + mv.set(10); + mv.set(20); + mv.set(30); + + expect(listener).toHaveBeenCalledTimes(3); + expect(listener).toHaveBeenNthCalledWith(1, 10); + expect(listener).toHaveBeenNthCalledWith(2, 20); + expect(listener).toHaveBeenNthCalledWith(3, 30); + }); + + test('should unsubscribe from value changes', () => { + const mv = createMotionValue(0); + const listener = vi.fn(); + + const unsubscribe = mv.onChange(listener); + + mv.set(10); + expect(listener).toHaveBeenCalledTimes(1); + + unsubscribe(); + + mv.set(20); + expect(listener).toHaveBeenCalledTimes(1); // Still 1, not called again + }); + + test('should support multiple listeners', () => { + const mv = createMotionValue(0); + const listener1 = vi.fn(); + const listener2 = vi.fn(); + + mv.onChange(listener1); + mv.onChange(listener2); + + mv.set(10); + + expect(listener1).toHaveBeenCalledWith(10); + expect(listener2).toHaveBeenCalledWith(10); + }); + + test('should subscribe with on() method', () => { + const mv = createMotionValue(0); + const listener = vi.fn(); + + const unsubscribe = mv.on('change', listener); + + mv.set(10); + + expect(listener).toHaveBeenCalledWith(10); + + unsubscribe(); + mv.set(20); + + expect(listener).toHaveBeenCalledTimes(1); + }); + + test('should return noop for unknown event types', () => { + const mv = createMotionValue(0); + // @ts-expect-error - testing invalid event type + const result = mv.on('unknown', vi.fn()); + + expect(result).toBe(noopMT); + }); + }); + + describe('attach() and stop()', () => { + test('should attach animation cancel callbacks', () => { + const mv = createMotionValue(0); + const cancel1 = vi.fn(); + const cancel2 = vi.fn(); + + mv.attach(cancel1); + mv.attach(cancel2); + + mv.stop(); + + expect(cancel1).toHaveBeenCalledTimes(1); + expect(cancel2).toHaveBeenCalledTimes(1); + }); + + test('should detach animation on returned function', () => { + const mv = createMotionValue(0); + const cancel = vi.fn(); + + const detach = mv.attach(cancel); + detach(); + + mv.stop(); + + expect(cancel).not.toHaveBeenCalled(); + }); + + test('should clear all animations after stop', () => { + const mv = createMotionValue(0); + const cancel = vi.fn(); + + mv.attach(cancel); + mv.stop(); + + expect(cancel).toHaveBeenCalledTimes(1); + + // Calling stop again shouldn't call cancel again + mv.stop(); + expect(cancel).toHaveBeenCalledTimes(1); + }); + + test('should support multiple attach/detach cycles', () => { + const mv = createMotionValue(0); + const cancel1 = vi.fn(); + const cancel2 = vi.fn(); + + const detach1 = mv.attach(cancel1); + mv.attach(cancel2); + + detach1(); + mv.stop(); + + expect(cancel1).not.toHaveBeenCalled(); + expect(cancel2).toHaveBeenCalledTimes(1); + }); + }); + + describe('toJSON()', () => { + test('should serialize number values', () => { + const mv = createMotionValue(42); + expect(mv.toJSON()).toBe('42'); + }); + + test('should serialize string values', () => { + const mv = createMotionValue('hello'); + expect(mv.toJSON()).toBe('hello'); + }); + + test('should serialize object values', () => { + const mv = createMotionValue({ x: 10 }); + expect(mv.toJSON()).toBe('[object Object]'); + }); + }); + + describe('integration scenarios', () => { + test('should handle rapid value changes', () => { + const mv = createMotionValue(0); + const listener = vi.fn(); + + mv.onChange(listener); + + for (let i = 1; i <= 100; i++) { + mv.set(i); + } + + expect(listener).toHaveBeenCalledTimes(100); + expect(mv.get()).toBe(100); + }); + + test('should handle animation lifecycle', () => { + const mv = createMotionValue(0); + const cancel = vi.fn(); + const listener = vi.fn(); + + mv.onChange(listener); + const detach = mv.attach(cancel); + + mv.set(50); + expect(listener).toHaveBeenCalledWith(50); + + mv.stop(); + expect(cancel).toHaveBeenCalled(); + + mv.set(100); + expect(listener).toHaveBeenCalledWith(100); + }); + }); + + describe('isAnimating()', () => { + test('should return false when no animations are active', () => { + const mv = createMotionValue(0); + expect(mv.isAnimating()).toBe(false); + }); + + test('should return true when animations are attached', () => { + const mv = createMotionValue(0); + const cancel = vi.fn(); + + mv.attach(cancel); + + expect(mv.isAnimating()).toBe(true); + }); + + test('should return false after stop is called', () => { + const mv = createMotionValue(0); + const cancel = vi.fn(); + + mv.attach(cancel); + expect(mv.isAnimating()).toBe(true); + + mv.stop(); + expect(mv.isAnimating()).toBe(false); + }); + + test('should return false after animation is detached', () => { + const mv = createMotionValue(0); + const cancel = vi.fn(); + + const detach = mv.attach(cancel); + expect(mv.isAnimating()).toBe(true); + + detach(); + expect(mv.isAnimating()).toBe(false); + }); + + test('should track multiple animations', () => { + const mv = createMotionValue(0); + + const detach1 = mv.attach(vi.fn()); + expect(mv.isAnimating()).toBe(true); + + const detach2 = mv.attach(vi.fn()); + expect(mv.isAnimating()).toBe(true); + + detach1(); + expect(mv.isAnimating()).toBe(true); // Still one active + + detach2(); + expect(mv.isAnimating()).toBe(false); // All cleared + }); + }); + + describe('clearListeners()', () => { + test('should remove all listeners', () => { + const mv = createMotionValue(0); + const listener1 = vi.fn(); + const listener2 = vi.fn(); + + mv.onChange(listener1); + mv.onChange(listener2); + + mv.set(10); + expect(listener1).toHaveBeenCalledTimes(1); + expect(listener2).toHaveBeenCalledTimes(1); + + mv.clearListeners(); + + mv.set(20); + expect(listener1).toHaveBeenCalledTimes(1); // Not called again + expect(listener2).toHaveBeenCalledTimes(1); // Not called again + }); + + test('should allow adding new listeners after clearing', () => { + const mv = createMotionValue(0); + const listener1 = vi.fn(); + const listener2 = vi.fn(); + + mv.onChange(listener1); + mv.clearListeners(); + mv.onChange(listener2); + + mv.set(10); + + expect(listener1).not.toHaveBeenCalled(); + expect(listener2).toHaveBeenCalledWith(10); + }); + }); + + describe('destroy()', () => { + test('should stop all animations and clear all listeners', () => { + const mv = createMotionValue(0); + const cancel = vi.fn(); + const listener = vi.fn(); + + mv.attach(cancel); + mv.onChange(listener); + + expect(mv.isAnimating()).toBe(true); + + mv.destroy(); + + expect(cancel).toHaveBeenCalled(); + expect(mv.isAnimating()).toBe(false); + + mv.set(10); + expect(listener).not.toHaveBeenCalled(); + }); + + test('should be idempotent', () => { + const mv = createMotionValue(0); + const cancel = vi.fn(); + + mv.attach(cancel); + + mv.destroy(); + expect(cancel).toHaveBeenCalledTimes(1); + + // Calling destroy again should not cause issues + mv.destroy(); + expect(cancel).toHaveBeenCalledTimes(1); // Still 1 + }); + + test('should allow value operations after destroy', () => { + const mv = createMotionValue(0); + + mv.destroy(); + + // Should still work + mv.set(10); + expect(mv.get()).toBe(10); + + mv.jump(20); + expect(mv.get()).toBe(20); + }); + }); +}); diff --git a/packages/motion/__tests__/animate.test.tsx b/packages/motion/__tests__/animate.test.tsx new file mode 100644 index 0000000000..896e4669e0 --- /dev/null +++ b/packages/motion/__tests__/animate.test.tsx @@ -0,0 +1,361 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; + +import { animate, easeIn, easeOut, linear } from '../src/mini/core/animate.js'; +import { createMotionValue } from '../src/mini/core/MotionValue.js'; +import { spring } from '../src/mini/core/spring.js'; +import { noopMT } from '../src/utils/noop.js'; + +describe('animate', () => { + let mockRegisteredMap: Map; + + beforeEach(() => { + mockRegisteredMap = new Map(); + vi.spyOn(globalThis, 'runOnRegistered', 'get').mockImplementation( + function(id: string) { + const func = mockRegisteredMap.get(id) ?? noopMT; + return func; + }, + ); + + // Mock spring function + mockRegisteredMap.set('springHandle', (options: any) => { + // Simple mock spring generator + const start = options.keyframes[0]; + const end = options.keyframes[1]; + const duration = 300; // Fixed duration for testing + + return { + next: (elapsed: number) => { + const progress = Math.min(elapsed / duration, 1); + const value = start + (end - start) * progress; + return { value, done: progress >= 1 }; + }, + }; + }); + }); + + afterEach(() => { + vi.restoreAllMocks(); + }); + + describe('MotionValue animation', () => { + test('should animate a MotionValue from current to target value', async () => { + const mv = createMotionValue(0); + + animate(mv, 100, { duration: 0.1, ease: linear }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(mv.get()).toBe(100); + }); + + test('should call onUpdate callback during animation', async () => { + const mv = createMotionValue(0); + const onUpdate = vi.fn(); + + animate(mv, 100, { duration: 0.1, ease: linear, onUpdate }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(onUpdate).toHaveBeenCalled(); + expect(onUpdate.mock.calls[onUpdate.mock.calls.length - 1][0]) + .toBeCloseTo(100, 0); + }); + + test('should call onComplete callback when animation finishes', async () => { + const mv = createMotionValue(0); + const onComplete = vi.fn(); + + animate(mv, 100, { duration: 0.1, ease: linear, onComplete }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(onComplete).toHaveBeenCalledTimes(1); + }); + + test('should stop previous animation when starting new one', async () => { + const mv = createMotionValue(0); + const onComplete1 = vi.fn(); + const onComplete2 = vi.fn(); + + animate(mv, 50, { duration: 0.2, ease: linear, onComplete: onComplete1 }); + + await new Promise(resolve => setTimeout(resolve, 50)); + + // Start second animation before first completes + animate(mv, 100, { + duration: 0.1, + ease: linear, + onComplete: onComplete2, + }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(onComplete2).toHaveBeenCalledTimes(1); + expect(mv.get()).toBe(100); + }); + }); + + describe('Number animation', () => { + test('should animate a number value', async () => { + const onUpdate = vi.fn(); + + animate(50, 100, { duration: 0.1, ease: linear, onUpdate }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(onUpdate).toHaveBeenCalled(); + const lastCall = onUpdate.mock.calls[onUpdate.mock.calls.length - 1][0]; + expect(lastCall).toBeCloseTo(100, 0); + }); + }); + + describe('Function callback animation', () => { + test('should animate using setter function', async () => { + const setter = vi.fn(); + + animate(setter, 100, { duration: 0.1, ease: linear, from: 0 }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(setter).toHaveBeenCalled(); + const lastCall = setter.mock.calls[setter.mock.calls.length - 1][0]; + expect(lastCall).toBeCloseTo(100, 0); + }); + }); + + describe('Animation controls', () => { + test('should stop animation when stop() is called', async () => { + const mv = createMotionValue(0); + const onComplete = vi.fn(); + + const controls = animate(mv, 100, { + duration: 0.2, + ease: linear, + onComplete, + }); + + await new Promise(resolve => setTimeout(resolve, 50)); + + controls.stop(); + const valueAfterStop = mv.get(); + + await new Promise(resolve => setTimeout(resolve, 200)); + + expect(mv.get()).toBe(valueAfterStop); // Value shouldn't change after stop + expect(onComplete).not.toHaveBeenCalled(); + }); + + test('should support then() for promise-like behavior', async () => { + const mv = createMotionValue(0); + const thenCallback = vi.fn(); + + const controls = animate(mv, 100, { duration: 0.1, ease: linear }); + controls.then(thenCallback); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(thenCallback).toHaveBeenCalled(); + }); + }); + + describe('Easing functions', () => { + test('should animate with linear easing', async () => { + const mv = createMotionValue(0); + + animate(mv, 100, { duration: 0.1, ease: linear }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(mv.get()).toBe(100); + }); + + test('should animate with easeOut easing', async () => { + const mv = createMotionValue(0); + + animate(mv, 100, { duration: 0.1, ease: easeOut }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(mv.get()).toBe(100); + }); + + test('should animate with easeIn easing', async () => { + const mv = createMotionValue(0); + + animate(mv, 100, { duration: 0.1, ease: easeIn }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(mv.get()).toBe(100); + }); + + test('should animate with custom easing function', async () => { + const mv = createMotionValue(0); + const customEase = (t: number) => t * t; // Quadratic ease + + animate(mv, 100, { duration: 0.1, ease: customEase }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(mv.get()).toBe(100); + }); + }); + + describe('Spring animations', () => { + test('should animate with spring physics', async () => { + const mv = createMotionValue(0); + + animate(mv, 100, { type: 'spring', stiffness: 100, damping: 10 }); + + await new Promise(resolve => setTimeout(resolve, 400)); + + expect(mv.get()).toBeCloseTo(100, 0); + }); + + test('should use spring when no duration or ease provided', async () => { + const mv = createMotionValue(0); + + animate(mv, 100, { stiffness: 200, damping: 20 }); + + await new Promise(resolve => setTimeout(resolve, 400)); + + expect(mv.get()).toBeCloseTo(100, 0); + }); + + test('should respect initial velocity in spring animations', async () => { + const mv = createMotionValue(0); + mv.updateVelocity(500); + + animate(mv, 100, { type: 'spring', stiffness: 100, damping: 10 }); + + await new Promise(resolve => setTimeout(resolve, 400)); + + expect(mv.get()).toBeCloseTo(100, 0); + }); + }); + + describe('Animation options', () => { + test('should use default duration when not specified', async () => { + const mv = createMotionValue(0); + const onComplete = vi.fn(); + + animate(mv, 100, { ease: linear, onComplete }); + + await new Promise(resolve => setTimeout(resolve, 400)); + + expect(onComplete).toHaveBeenCalled(); + }); + + test('should start from current value', async () => { + const mv = createMotionValue(50); + + animate(mv, 100, { duration: 0.1, ease: linear }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(mv.get()).toBe(100); + }); + + test('should start from specified "from" value for setter functions', async () => { + const setter = vi.fn(); + + animate(setter, 100, { duration: 0.1, ease: linear, from: 25 }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + const lastCall = setter.mock.calls[setter.mock.calls.length - 1][0]; + expect(lastCall).toBeCloseTo(100, 0); + }); + + test('should use specified velocity', async () => { + const mv = createMotionValue(0); + + animate(mv, 100, { type: 'spring', velocity: 100 }); + + await new Promise(resolve => setTimeout(resolve, 400)); + + expect(mv.get()).toBeCloseTo(100, 0); + }); + }); + + describe('Edge cases', () => { + test('should handle animation to same value', async () => { + const mv = createMotionValue(100); + const onComplete = vi.fn(); + + animate(mv, 100, { duration: 0.1, ease: linear, onComplete }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(mv.get()).toBe(100); + expect(onComplete).toHaveBeenCalled(); + }); + + test('should handle zero duration', async () => { + const mv = createMotionValue(0); + const onComplete = vi.fn(); + + animate(mv, 100, { duration: 0, ease: linear, onComplete }); + + await new Promise(resolve => setTimeout(resolve, 50)); + + expect(mv.get()).toBe(100); + expect(onComplete).toHaveBeenCalled(); + }); + + test('should handle negative values', async () => { + const mv = createMotionValue(0); + + animate(mv, -100, { duration: 0.1, ease: linear }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(mv.get()).toBe(-100); + }); + + test('should set final velocity to 0 for tween animations', async () => { + const mv = createMotionValue(0); + + animate(mv, 100, { duration: 0.1, ease: linear }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + expect(mv.getVelocity()).toBe(0); + }); + }); + + describe('Animation cleanup', () => { + test('should detach animation on completion', async () => { + const mv = createMotionValue(0); + + animate(mv, 100, { duration: 0.1, ease: linear }); + + await new Promise(resolve => setTimeout(resolve, 150)); + + // Animation should be detached, stop shouldn't do anything + const stopSpy = vi.spyOn(mv, 'stop'); + mv.stop(); + + // Since animation is already complete and detached, this should work fine + expect(stopSpy).toHaveBeenCalled(); + }); + + test('should handle multiple rapid animations', async () => { + const mv = createMotionValue(0); + + for (let i = 1; i <= 5; i++) { + animate(mv, i * 20, { duration: 0.05, ease: linear }); + await new Promise(resolve => setTimeout(resolve, 10)); + } + + await new Promise(resolve => setTimeout(resolve, 100)); + + expect(mv.get()).toBeCloseTo(100, 0); + }); + }); +}); diff --git a/packages/motion/__tests__/api-compatibility.test.tsx b/packages/motion/__tests__/api-compatibility.test.tsx new file mode 100644 index 0000000000..dbdd9a684e --- /dev/null +++ b/packages/motion/__tests__/api-compatibility.test.tsx @@ -0,0 +1,443 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { describe, expect, test } from 'vitest'; + +import { motionValue as motionValueFull } from 'motion-dom'; + +import { createMotionValue as createMotionValueMini } from '../src/mini/core/MotionValue.js'; +import type { MotionValue as MotionValueMini } from '../src/mini/core/MotionValue.js'; + +/** + * API Compatibility Tests + * + * These tests ensure that the mini version of the motion library maintains + * API compatibility with the standard motion-dom library. This is critical + * to prevent breaking changes during future iterations. + */ + +describe('API Compatibility: motion-mini vs motion-dom', () => { + describe('MotionValue Interface', () => { + test('both should have get() method', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + expect(typeof miniMV.get).toBe('function'); + expect(typeof fullMV.get).toBe('function'); + + expect(miniMV.get()).toBe(0); + expect(fullMV.get()).toBe(0); + }); + + test('both should have set() method', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + expect(typeof miniMV.set).toBe('function'); + expect(typeof fullMV.set).toBe('function'); + + miniMV.set(100); + fullMV.set(100); + + expect(miniMV.get()).toBe(100); + expect(fullMV.get()).toBe(100); + }); + + test('both should have onChange() method with same signature', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + expect(typeof miniMV.onChange).toBe('function'); + expect(typeof fullMV.onChange).toBe('function'); + + let miniCalled = false; + let fullCalled = false; + + const miniUnsub = miniMV.onChange((v) => { + miniCalled = true; + expect(v).toBe(50); + }); + + const fullUnsub = fullMV.onChange((v) => { + fullCalled = true; + expect(v).toBe(50); + }); + + miniMV.set(50); + fullMV.set(50); + + expect(miniCalled).toBe(true); + expect(fullCalled).toBe(true); + + // Both should return unsubscribe function + expect(typeof miniUnsub).toBe('function'); + expect(typeof fullUnsub).toBe('function'); + + miniUnsub(); + fullUnsub(); + }); + + test('both should have on() method for event subscription', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + expect(typeof miniMV.on).toBe('function'); + expect(typeof fullMV.on).toBe('function'); + + let miniCalled = false; + let fullCalled = false; + + const miniUnsub = miniMV.on('change', (v) => { + miniCalled = true; + }); + + const fullUnsub = fullMV.on('change', (v) => { + fullCalled = true; + }); + + miniMV.set(75); + fullMV.set(75); + + expect(miniCalled).toBe(true); + expect(fullCalled).toBe(true); + + miniUnsub(); + fullUnsub(); + }); + + test('both should have getVelocity() method', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + expect(typeof miniMV.getVelocity).toBe('function'); + expect(typeof fullMV.getVelocity).toBe('function'); + + // Both should return a number + expect(typeof miniMV.getVelocity()).toBe('number'); + expect(typeof fullMV.getVelocity()).toBe('number'); + }); + + test('both should have stop() method', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + expect(typeof miniMV.stop).toBe('function'); + expect(typeof fullMV.stop).toBe('function'); + + // Should not throw when called + expect(() => miniMV.stop()).not.toThrow(); + expect(() => fullMV.stop()).not.toThrow(); + }); + + test('both should have isAnimating() method', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + expect(typeof miniMV.isAnimating).toBe('function'); + expect(typeof fullMV.isAnimating).toBe('function'); + + // Should return boolean + expect(typeof miniMV.isAnimating()).toBe('boolean'); + expect(typeof fullMV.isAnimating()).toBe('boolean'); + + // Initially should not be animating + expect(miniMV.isAnimating()).toBe(false); + expect(fullMV.isAnimating()).toBe(false); + }); + + test('both should have clearListeners() method', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + expect(typeof miniMV.clearListeners).toBe('function'); + expect(typeof fullMV.clearListeners).toBe('function'); + + // Should not throw when called + expect(() => miniMV.clearListeners()).not.toThrow(); + expect(() => fullMV.clearListeners()).not.toThrow(); + }); + + test('both should have destroy() method', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + expect(typeof miniMV.destroy).toBe('function'); + expect(typeof fullMV.destroy).toBe('function'); + + // Should not throw when called + expect(() => miniMV.destroy()).not.toThrow(); + expect(() => fullMV.destroy()).not.toThrow(); + }); + + test('mini should have jump() method (extension)', () => { + const miniMV = createMotionValueMini(0); + + expect(typeof miniMV.jump).toBe('function'); + + miniMV.jump(100); + expect(miniMV.get()).toBe(100); + }); + + test('both should support type parameter', () => { + // Number + const miniNum = createMotionValueMini(0); + const fullNum = motionValueFull(0); + + miniNum.set(42); + fullNum.set(42); + + expect(miniNum.get()).toBe(42); + expect(fullNum.get()).toBe(42); + + // String + const miniStr = createMotionValueMini('hello'); + const fullStr = motionValueFull('hello'); + + miniStr.set('world'); + fullStr.set('world'); + + expect(miniStr.get()).toBe('world'); + expect(fullStr.get()).toBe('world'); + }); + }); + + describe('Event Callback Signatures', () => { + test('onChange callback should receive current value', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + const miniCallback = (v: number) => { + expect(typeof v).toBe('number'); + expect(v).toBe(123); + }; + + const fullCallback = (v: number) => { + expect(typeof v).toBe('number'); + expect(v).toBe(123); + }; + + miniMV.onChange(miniCallback); + fullMV.onChange(fullCallback); + + miniMV.set(123); + fullMV.set(123); + }); + + test('on("change") callback should match onChange', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + let miniValue = 0; + let fullValue = 0; + + miniMV.on('change', (v) => { + miniValue = v; + }); + + fullMV.on('change', (v) => { + fullValue = v; + }); + + miniMV.set(999); + fullMV.set(999); + + expect(miniValue).toBe(999); + expect(fullValue).toBe(999); + }); + }); + + describe('Return Types', () => { + test('get() should return the value type', () => { + const miniMV = createMotionValueMini(42); + const fullMV = motionValueFull(42); + + const miniResult = miniMV.get(); + const fullResult = fullMV.get(); + + expect(typeof miniResult).toBe('number'); + expect(typeof fullResult).toBe('number'); + }); + + test('set() should return void', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + const miniResult = miniMV.set(10); + const fullResult = fullMV.set(10); + + expect(miniResult).toBeUndefined(); + expect(fullResult).toBeUndefined(); + }); + + test('onChange() should return unsubscribe function', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + const miniUnsub = miniMV.onChange(() => {}); + const fullUnsub = fullMV.onChange(() => {}); + + expect(typeof miniUnsub).toBe('function'); + expect(typeof fullUnsub).toBe('function'); + }); + + test('getVelocity() should return number', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + const miniVel = miniMV.getVelocity(); + const fullVel = fullMV.getVelocity(); + + expect(typeof miniVel).toBe('number'); + expect(typeof fullVel).toBe('number'); + }); + }); + + describe('Behavior Compatibility', () => { + test('both should notify listeners on set', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + let miniNotified = 0; + let fullNotified = 0; + + miniMV.onChange(() => miniNotified++); + fullMV.onChange(() => fullNotified++); + + miniMV.set(1); + fullMV.set(1); + + expect(miniNotified).toBe(1); + expect(fullNotified).toBe(1); + + miniMV.set(2); + fullMV.set(2); + + expect(miniNotified).toBe(2); + expect(fullNotified).toBe(2); + }); + + test('both should support multiple listeners', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + let miniCount1 = 0, miniCount2 = 0; + let fullCount1 = 0, fullCount2 = 0; + + miniMV.onChange(() => miniCount1++); + miniMV.onChange(() => miniCount2++); + + fullMV.onChange(() => fullCount1++); + fullMV.onChange(() => fullCount2++); + + miniMV.set(100); + fullMV.set(100); + + expect(miniCount1).toBe(1); + expect(miniCount2).toBe(1); + expect(fullCount1).toBe(1); + expect(fullCount2).toBe(1); + }); + + test('both should properly unsubscribe listeners', () => { + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + let miniCalled = 0; + let fullCalled = 0; + + const miniUnsub = miniMV.onChange(() => miniCalled++); + const fullUnsub = fullMV.onChange(() => fullCalled++); + + miniMV.set(1); + fullMV.set(1); + + expect(miniCalled).toBe(1); + expect(fullCalled).toBe(1); + + miniUnsub(); + fullUnsub(); + + miniMV.set(2); + fullMV.set(2); + + expect(miniCalled).toBe(1); // Should not increment + expect(fullCalled).toBe(1); // Should not increment + }); + + test('both should maintain separate listener lists', () => { + const miniMV1 = createMotionValueMini(0); + const miniMV2 = createMotionValueMini(0); + + const fullMV1 = motionValueFull(0); + const fullMV2 = motionValueFull(0); + + let miniCount1 = 0, miniCount2 = 0; + let fullCount1 = 0, fullCount2 = 0; + + miniMV1.onChange(() => miniCount1++); + miniMV2.onChange(() => miniCount2++); + + fullMV1.onChange(() => fullCount1++); + fullMV2.onChange(() => fullCount2++); + + miniMV1.set(1); + fullMV1.set(1); + + expect(miniCount1).toBe(1); + expect(miniCount2).toBe(0); + expect(fullCount1).toBe(1); + expect(fullCount2).toBe(0); + }); + }); + + describe('Critical Compatibility Notes', () => { + test('mini extends standard with jump() method', () => { + const miniMV = createMotionValueMini(0); + + // This is an extension in mini, not in standard + expect(typeof miniMV.jump).toBe('function'); + + miniMV.jump(100); + expect(miniMV.get()).toBe(100); + expect(miniMV.getVelocity()).toBe(0); + }); + + test('mini extends standard with attach() method', () => { + const miniMV = createMotionValueMini(0); + + // This is an extension in mini for animation management + expect(typeof (miniMV as any).attach).toBe('function'); + }); + + test('API surface should be compatible for migration', () => { + // This test documents that code using standard motion-dom MotionValue + // can also work with mini MotionValue (mini maintains API compatibility) + // motion-dom is the SUPERSET, motion-mini is the lightweight SUBSET + const useMotionValue = ( + mv: MotionValueMini | ReturnType, + ) => { + const value = mv.get(); + mv.set(value + 1); + + const unsub = mv.onChange((v) => { + expect(v).toBe(value + 1); + }); + + const velocity = mv.getVelocity(); + expect(typeof velocity).toBe('number'); + + return unsub; + }; + + const miniMV = createMotionValueMini(0); + const fullMV = motionValueFull(0); + + const miniUnsub = useMotionValue(miniMV); + const fullUnsub = useMotionValue(fullMV); + + expect(typeof miniUnsub).toBe('function'); + expect(typeof fullUnsub).toBe('function'); + }); + }); +}); diff --git a/packages/motion/__tests__/easings.test.ts b/packages/motion/__tests__/easings.test.ts new file mode 100644 index 0000000000..8cd8b65b6c --- /dev/null +++ b/packages/motion/__tests__/easings.test.ts @@ -0,0 +1,207 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { beforeEach, describe, expect, test, vi } from 'vitest'; + +describe('Easing Functions', () => { + let mockRegisteredMap: Map; + + beforeEach(() => { + mockRegisteredMap = new Map(); + vi.spyOn(globalThis, 'runOnRegistered', 'get').mockImplementation( + function(id: string) { + const func = mockRegisteredMap.get(id) ?? ((t: number) => t); + return func; + }, + ); + + // Mock all easing functions with simple implementations for testing + // In real usage, these would be from motion-utils + mockRegisteredMap.set('linearHandle', (t: number) => t); + mockRegisteredMap.set('easeInHandle', (t: number) => t * t); + mockRegisteredMap.set('easeOutHandle', (t: number) => t * (2 - t)); + mockRegisteredMap.set( + 'easeInOutHandle', + (t: number) => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t, + ); + mockRegisteredMap.set( + 'circInHandle', + (t: number) => 1 - Math.sqrt(1 - t * t), + ); + mockRegisteredMap.set( + 'circOutHandle', + (t: number) => Math.sqrt(1 - (t - 1) * (t - 1)), + ); + mockRegisteredMap.set('circInOutHandle', (t: number) => + t < 0.5 + ? (1 - Math.sqrt(1 - 4 * t * t)) / 2 + : (Math.sqrt(1 - (-2 * t + 2) ** 2) + 1) / 2); + mockRegisteredMap.set('backInHandle', (t: number) => { + const c = 1.70158; + return t * t * ((c + 1) * t - c); + }); + mockRegisteredMap.set('backOutHandle', (t: number) => { + const c = 1.70158; + const t1 = t - 1; + return t1 * t1 * ((c + 1) * t1 + c) + 1; + }); + mockRegisteredMap.set('backInOutHandle', (t: number) => { + const c = 1.70158 * 1.525; + if (t < 0.5) { + return (2 * t) ** 2 * ((c + 1) * 2 * t - c) / 2; + } + return ((2 * t - 2) ** 2 * ((c + 1) * (2 * t - 2) + c) + 2) / 2; + }); + mockRegisteredMap.set('anticipateHandle', (t: number) => { + const c = 1.70158; + return t * t * ((c + 1) * t - c); + }); + }); + + describe('Easing functions export and work correctly', () => { + test('all easing functions should be exported from mini/core/easings', async () => { + const easings = await import('../src/mini/core/easings.js'); + + expect(typeof easings.linear).toBe('function'); + expect(typeof easings.easeIn).toBe('function'); + expect(typeof easings.easeOut).toBe('function'); + expect(typeof easings.easeInOut).toBe('function'); + expect(typeof easings.circIn).toBe('function'); + expect(typeof easings.circOut).toBe('function'); + expect(typeof easings.circInOut).toBe('function'); + expect(typeof easings.backIn).toBe('function'); + expect(typeof easings.backOut).toBe('function'); + expect(typeof easings.backInOut).toBe('function'); + expect(typeof easings.anticipate).toBe('function'); + }); + + test('all easing functions should call globalThis.runOnRegistered', async () => { + const easings = await import('../src/mini/core/easings.js'); + const spy = vi.spyOn(globalThis, 'runOnRegistered', 'get'); + + easings.linear(0.5); + easings.easeIn(0.5); + easings.easeOut(0.5); + easings.easeInOut(0.5); + easings.circIn(0.5); + easings.circOut(0.5); + easings.circInOut(0.5); + easings.backIn(0.5); + easings.backOut(0.5); + easings.backInOut(0.5); + easings.anticipate(0.5); + + // Each call should have invoked runOnRegistered + expect(spy).toHaveBeenCalled(); + }); + + test('easing functions should return numbers', async () => { + const easings = await import('../src/mini/core/easings.js'); + + const funcs = [ + easings.linear, + easings.easeIn, + easings.easeOut, + easings.easeInOut, + easings.circIn, + easings.circOut, + easings.circInOut, + easings.backIn, + easings.backOut, + easings.backInOut, + easings.anticipate, + ]; + + for (const func of funcs) { + const result = func(0.5); + expect(typeof result).toBe('number'); + } + }); + + test('easing functions should handle t=0', async () => { + const easings = await import('../src/mini/core/easings.js'); + + const funcs = [ + easings.linear, + easings.easeIn, + easings.easeOut, + easings.easeInOut, + easings.circIn, + easings.circOut, + easings.circInOut, + easings.backIn, + easings.backOut, + easings.backInOut, + easings.anticipate, + ]; + + for (const func of funcs) { + const result = func(0); + expect(typeof result).toBe('number'); + } + }); + + test('easing functions should handle t=1', async () => { + const easings = await import('../src/mini/core/easings.js'); + + const funcs = [ + easings.linear, + easings.easeIn, + easings.easeOut, + easings.easeInOut, + easings.circIn, + easings.circOut, + easings.circInOut, + easings.backIn, + easings.backOut, + easings.backInOut, + easings.anticipate, + ]; + + for (const func of funcs) { + const result = func(1); + expect(typeof result).toBe('number'); + } + }); + }); + + describe('Registered function behavior', () => { + test('each easing should map to correct registered handle', async () => { + const easings = await import('../src/mini/core/easings.js'); + + easings.linear(0.5); + expect(mockRegisteredMap.get('linearHandle')).toBeDefined(); + + easings.easeIn(0.5); + expect(mockRegisteredMap.get('easeInHandle')).toBeDefined(); + + easings.easeOut(0.5); + expect(mockRegisteredMap.get('easeOutHandle')).toBeDefined(); + + easings.easeInOut(0.5); + expect(mockRegisteredMap.get('easeInOutHandle')).toBeDefined(); + + easings.circIn(0.5); + expect(mockRegisteredMap.get('circInHandle')).toBeDefined(); + + easings.circOut(0.5); + expect(mockRegisteredMap.get('circOutHandle')).toBeDefined(); + + easings.circInOut(0.5); + expect(mockRegisteredMap.get('circInOutHandle')).toBeDefined(); + + easings.backIn(0.5); + expect(mockRegisteredMap.get('backInHandle')).toBeDefined(); + + easings.backOut(0.5); + expect(mockRegisteredMap.get('backOutHandle')).toBeDefined(); + + easings.backInOut(0.5); + expect(mockRegisteredMap.get('backInOutHandle')).toBeDefined(); + + easings.anticipate(0.5); + expect(mockRegisteredMap.get('anticipateHandle')).toBeDefined(); + }); + }); +}); diff --git a/packages/motion/__tests__/hooks.test.tsx b/packages/motion/__tests__/hooks.test.tsx new file mode 100644 index 0000000000..c2b8097a14 --- /dev/null +++ b/packages/motion/__tests__/hooks.test.tsx @@ -0,0 +1,217 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; + +import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; +import { act, render } from '@lynx-js/react/testing-library'; + +import { + useMotionValueRef, + useMotionValueRefEvent, +} from '../src/mini/index.js'; +import { noop } from '../src/utils/noop.js'; + +describe('Hooks', () => { + let mockRegisteredMap: Map; + + beforeEach(() => { + mockRegisteredMap = new Map(); + vi.spyOn(globalThis, 'runOnRegistered', 'get').mockImplementation( + function(id: string) { + const func = mockRegisteredMap.get(id) ?? noop; + return func; + }, + ); + }); + + afterEach(() => { + vi.restoreAllMocks(); + }); + + describe('useMotionValueRef', () => { + test('should create motion value ref with initial value', () => { + const App = () => { + const mvRef = useMotionValueRef(0); + useMainThreadRef(null); + return ; + }; + + render(, { + enableMainThread: true, + enableBackgroundThread: true, + }); + + // Test passes if no errors thrown during render + expect(true).toBe(true); + }); + + test('should create motion value ref without errors', async () => { + let refCreated = false; + + const App = () => { + const mvRef = useMotionValueRef(42); + refCreated = true; + return ; + }; + + render(, { + enableMainThread: true, + enableBackgroundThread: true, + }); + + await act(async () => { + await new Promise(resolve => setTimeout(resolve, 50)); + }); + + expect(refCreated).toBe(true); + }); + + test('should support different value types', async () => { + const numberRef = vi.fn(); + const stringRef = vi.fn(); + + const AppNumber = () => { + useMotionValueRef(123); + numberRef(); + return ; + }; + + const AppString = () => { + useMotionValueRef('test'); + stringRef(); + return ; + }; + + render(, { + enableMainThread: true, + enableBackgroundThread: true, + }); + + render(, { + enableMainThread: true, + enableBackgroundThread: true, + }); + + expect(numberRef).toHaveBeenCalled(); + expect(stringRef).toHaveBeenCalled(); + }); + }); + + describe('useMotionValueRefEvent', () => { + test('should set up event listener without errors', () => { + const callback = vi.fn(); + + const App = () => { + const mvRef = useMotionValueRef(0); + useMotionValueRefEvent(mvRef, 'change', callback); + return ; + }; + + render(, { + enableMainThread: true, + enableBackgroundThread: true, + }); + + // Test passes without throwing + expect(true).toBe(true); + }); + + test('should accept callback function', async () => { + const callback = vi.fn(); + + const App = () => { + const mvRef = useMotionValueRef(0); + useMotionValueRefEvent(mvRef, 'change', callback); + return ; + }; + + render(, { + enableMainThread: true, + enableBackgroundThread: true, + }); + + await act(async () => { + await new Promise(resolve => setTimeout(resolve, 50)); + }); + + // Callback should be a function + expect(typeof callback).toBe('function'); + }); + + test('should work with unmount', async () => { + const callback = vi.fn(); + + const App = () => { + const mvRef = useMotionValueRef(0); + useMotionValueRefEvent(mvRef, 'change', callback); + return ; + }; + + const { unmount } = render(, { + enableMainThread: true, + enableBackgroundThread: true, + }); + + await act(async () => { + await new Promise(resolve => setTimeout(resolve, 50)); + }); + + unmount(); + + // Should not throw + expect(true).toBe(true); + }); + }); + + describe('Integration scenarios', () => { + test('should work together without errors', async () => { + const callback = vi.fn(); + + const App = () => { + const mvRef = useMotionValueRef(0); + useMotionValueRefEvent(mvRef, 'change', callback); + + return ; + }; + + render(, { + enableMainThread: true, + enableBackgroundThread: true, + }); + + await act(async () => { + await new Promise(resolve => setTimeout(resolve, 100)); + }); + + expect(true).toBe(true); + }); + + test('should support multiple motion value refs', async () => { + const callback1 = vi.fn(); + const callback2 = vi.fn(); + + const App = () => { + const mvRef1 = useMotionValueRef(0); + const mvRef2 = useMotionValueRef(100); + + useMotionValueRefEvent(mvRef1, 'change', callback1); + useMotionValueRefEvent(mvRef2, 'change', callback2); + + return ; + }; + + render(, { + enableMainThread: true, + enableBackgroundThread: true, + }); + + await act(async () => { + await new Promise(resolve => setTimeout(resolve, 100)); + }); + + expect(true).toBe(true); + }); + }); +}); diff --git a/packages/motion/__tests__/utilities.test.ts b/packages/motion/__tests__/utilities.test.ts new file mode 100644 index 0000000000..c2edd966d8 --- /dev/null +++ b/packages/motion/__tests__/utilities.test.ts @@ -0,0 +1,185 @@ +// Copyright 2025 The Lynx Authors. All rights reserved. +// Licensed under the Apache License Version 2.0 that can be found in the +// LICENSE file in the root directory of this source tree. + +import { describe, expect, test } from 'vitest'; + +import { noop } from '../src/utils/noop.js'; +import { + registerCallable, + runOnRegistered, +} from '../src/utils/registeredFunction.js'; + +describe('Utilities', () => { + describe('noop functions', () => { + test('noop should be a function that returns undefined', () => { + const result = noop(); + expect(result).toBeUndefined(); + }); + + test('noop should not throw', () => { + expect(() => noop()).not.toThrow(); + }); + + test('noopMT should be exported and not throw', async () => { + // Dynamic import to avoid execution context issues + const { noopMT } = await import('../src/utils/noop.js'); + expect(typeof noopMT).toBe('function'); + expect(() => noopMT()).not.toThrow(); + }); + }); + + describe('registerCallable and runOnRegistered', () => { + test('should register and retrieve a function', () => { + const testFunc = (x: number) => x * 2; + const id = registerCallable(testFunc, 'testFunc123'); + + expect(id).toBe('testFunc123'); + + const retrieved = runOnRegistered('testFunc123'); + expect(retrieved).toBe(testFunc); + }); + + test('should execute registered function correctly', () => { + const add = (a: number, b: number) => a + b; + registerCallable(add, 'add456'); + + const retrieved = runOnRegistered('add456'); + const result = retrieved(5, 3); + + expect(result).toBe(8); + }); + + test('should return noop for unregistered function', () => { + const retrieved = runOnRegistered('nonexistent789'); + expect(retrieved).toBe(noop); + }); + + test('should handle multiple registered functions', () => { + const func1 = () => 'one'; + const func2 = () => 'two'; + const func3 = () => 'three'; + + registerCallable(func1, 'func1x'); + registerCallable(func2, 'func2x'); + registerCallable(func3, 'func3x'); + + expect(runOnRegistered('func1x')()).toBe('one'); + expect(runOnRegistered('func2x')()).toBe('two'); + expect(runOnRegistered('func3x')()).toBe('three'); + }); + + test('should overwrite previously registered function with same id', () => { + const func1 = () => 'first'; + const func2 = () => 'second'; + + registerCallable(func1, 'sameid999'); + registerCallable(func2, 'sameid999'); + + expect(runOnRegistered('sameid999')()).toBe('second'); + }); + + test('should handle functions with different signatures', () => { + const getString = (name: string) => `Hello, ${name}`; + const getNumber = (x: number) => x * x; + const getBoolean = () => true; + + registerCallable(getString, 'getStringX'); + registerCallable(getNumber, 'getNumberX'); + registerCallable(getBoolean, 'getBooleanX'); + + expect(runOnRegistered('getStringX')('World')).toBe( + 'Hello, World', + ); + expect(runOnRegistered('getNumberX')(5)).toBe(25); + expect(runOnRegistered('getBooleanX')()).toBe(true); + }); + + test('should preserve function context', () => { + const obj = { + value: 42, + getValue() { + return this.value; + }, + }; + + registerCallable(obj.getValue.bind(obj), 'getValueZ'); + + const retrieved = runOnRegistered<() => number>('getValueZ'); + expect(retrieved()).toBe(42); + }); + + test('should be accessible via globalThis', () => { + expect(globalThis.runOnRegistered).toBe(runOnRegistered); + }); + + test('should handle async functions', async () => { + const asyncFunc = async (x: number) => { + return x * 2; + }; + + registerCallable(asyncFunc, 'asyncFuncY'); + + const retrieved = runOnRegistered('asyncFuncY'); + const result = await retrieved(5); + + expect(result).toBe(10); + }); + + test('should handle functions that throw', () => { + const throwFunc = () => { + throw new Error('Test error'); + }; + + registerCallable(throwFunc, 'throwFuncW'); + + const retrieved = runOnRegistered('throwFuncW'); + + expect(() => retrieved()).toThrow('Test error'); + }); + + test('should handle functions with no arguments', () => { + const counter = (() => { + let count = 0; + return () => ++count; + })(); + + registerCallable(counter, 'counterV'); + + const retrieved = runOnRegistered('counterV'); + + expect(retrieved()).toBe(1); + expect(retrieved()).toBe(2); + expect(retrieved()).toBe(3); + }); + + test('should handle variadic functions', () => { + const sum = (...numbers: number[]) => numbers.reduce((a, b) => a + b, 0); + + registerCallable(sum, 'sumT'); + + const retrieved = runOnRegistered('sumT'); + + expect(retrieved(1, 2, 3)).toBe(6); + expect(retrieved(10, 20, 30, 40)).toBe(100); + }); + }); + + describe('Edge cases', () => { + test('should handle empty string as id', () => { + const func = () => 'empty'; + registerCallable(func, 'emptyId'); + + const retrieved = runOnRegistered('emptyId'); + expect(retrieved()).toBe('empty'); + }); + + test('should handle special characters in id', () => { + const func = () => 'special'; + registerCallable(func, 'id-with_special'); + + const retrieved = runOnRegistered('id-with_special'); + expect(retrieved()).toBe('special'); + }); + }); +}); diff --git a/packages/motion/src/index.ts b/packages/motion/src/index.ts index 29e92b1b06..a6b708cb91 100644 --- a/packages/motion/src/index.ts +++ b/packages/motion/src/index.ts @@ -13,7 +13,6 @@ export { clamp, transformValue, styleEffect, - noop, useMotionValueRefEvent, } from './animation/index.js'; diff --git a/packages/motion/src/mini/core/MotionValue.ts b/packages/motion/src/mini/core/MotionValue.ts index 5854ca3b5a..caec4ff527 100644 --- a/packages/motion/src/mini/core/MotionValue.ts +++ b/packages/motion/src/mini/core/MotionValue.ts @@ -9,8 +9,6 @@ export interface MotionValue { set(v: T): void; getVelocity(): number; jump(v: T): void; - // Standard Framer Motion API usually has `stop`, `isAnimating` etc. - // For mini version, keeping it simple but compatible with what was requested. onChange(callback: (v: T) => void): () => void; on(event: 'change', callback: (v: T) => void): () => void; /** @@ -18,6 +16,18 @@ export interface MotionValue { */ updateVelocity(v: number): void; stop(): void; + /** + * Check if this MotionValue is currently animating. + */ + isAnimating(): boolean; + /** + * Clear all change listeners. + */ + clearListeners(): void; + /** + * Destroy this MotionValue, stopping all animations and clearing all listeners. + */ + destroy(): void; /** * @internal */ @@ -101,6 +111,19 @@ export function createMotionValue(initial: T): MotionValue { this.activeAnimations.clear(); } + isAnimating() { + return this.activeAnimations.size > 0; + } + + clearListeners() { + this.listeners.clear(); + } + + destroy() { + this.stop(); + this.clearListeners(); + } + toJSON() { return String(this.v); } diff --git a/packages/motion/tsconfig.test.json b/packages/motion/tsconfig.test.json index 47898dc37b..572eddb2d4 100644 --- a/packages/motion/tsconfig.test.json +++ b/packages/motion/tsconfig.test.json @@ -1,7 +1,12 @@ { "extends": "./tsconfig.build.json", "compilerOptions": { - "noEmit": true + "noEmit": true, + "rootDir": ".", + "rootDirs": [ + "src", + "__tests__" + ] }, - "include": ["__tests__"] + "include": ["src", "__tests__"] } From e460d91666ea7f42007773dda6e3e834ac100337 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 19 Jan 2026 11:12:14 +0800 Subject: [PATCH 21/37] chore: update the tsconfig hierarchy --- .../__tests__/{spring.test.ts => spring.test.tsx} | 0 packages/motion/__tests__/tsconfig.json | 13 +++++++++++++ packages/motion/tsconfig.json | 1 - packages/motion/tsconfig.test.json | 12 ------------ 4 files changed, 13 insertions(+), 13 deletions(-) rename packages/motion/__tests__/{spring.test.ts => spring.test.tsx} (100%) create mode 100644 packages/motion/__tests__/tsconfig.json delete mode 100644 packages/motion/tsconfig.test.json diff --git a/packages/motion/__tests__/spring.test.ts b/packages/motion/__tests__/spring.test.tsx similarity index 100% rename from packages/motion/__tests__/spring.test.ts rename to packages/motion/__tests__/spring.test.tsx diff --git a/packages/motion/__tests__/tsconfig.json b/packages/motion/__tests__/tsconfig.json new file mode 100644 index 0000000000..fc4ef0f97a --- /dev/null +++ b/packages/motion/__tests__/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.build.json", + "compilerOptions": { + "composite": false, + "noEmit": true, + "rootDir": ".", + "rootDirs": [ + "src", + "__tests__", + ], + }, + "include": ["src", "__tests__"], +} diff --git a/packages/motion/tsconfig.json b/packages/motion/tsconfig.json index e13dabad5d..296ec37e36 100644 --- a/packages/motion/tsconfig.json +++ b/packages/motion/tsconfig.json @@ -2,6 +2,5 @@ "files": [], "references": [ { "path": "./tsconfig.build.json" }, - { "path": "./tsconfig.test.json" }, ], } diff --git a/packages/motion/tsconfig.test.json b/packages/motion/tsconfig.test.json deleted file mode 100644 index 572eddb2d4..0000000000 --- a/packages/motion/tsconfig.test.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "compilerOptions": { - "noEmit": true, - "rootDir": ".", - "rootDirs": [ - "src", - "__tests__" - ] - }, - "include": ["src", "__tests__"] -} From b2b9e3dbe072d9aa5a1ac8dc8511627c45280b12 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 19 Jan 2026 11:26:19 +0800 Subject: [PATCH 22/37] style: add comments for useMotionValueRef --- packages/motion/src/hooks/useMotionEvent.ts | 3 +++ packages/motion/src/hooks/useMotionValueRef.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/packages/motion/src/hooks/useMotionEvent.ts b/packages/motion/src/hooks/useMotionEvent.ts index cc00fa0b84..58a2f7870e 100644 --- a/packages/motion/src/hooks/useMotionEvent.ts +++ b/packages/motion/src/hooks/useMotionEvent.ts @@ -13,6 +13,9 @@ interface Listenable { ): () => void; } +/** + * @experimental useMotionValueEvent, but only accepts motionValueRef format, highly experimental, subject to change + */ export function useMotionValueRefEvent< V, EventName extends keyof MotionValueEventCallbacks, diff --git a/packages/motion/src/hooks/useMotionValueRef.ts b/packages/motion/src/hooks/useMotionValueRef.ts index 455aea0767..abf97cb971 100644 --- a/packages/motion/src/hooks/useMotionValueRef.ts +++ b/packages/motion/src/hooks/useMotionValueRef.ts @@ -39,6 +39,9 @@ export function useMotionValueRefCore( return motionValueRef; } +/** + * @experimental useMotionValue, but in MainThreadRef format, highly experimental, subject to change + */ export function useMotionValueRef(value: T): MainThreadRef> { return useMotionValueRefCore(value, motionValue); } From 0752985ac1fdf405563627da7c0b28ff65706d91 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 19 Jan 2026 11:49:29 +0800 Subject: [PATCH 23/37] chore: update tsconfig for motion --- packages/motion/package.json | 2 +- tsconfig.json | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/motion/package.json b/packages/motion/package.json index e7060dea45..ad721529fb 100644 --- a/packages/motion/package.json +++ b/packages/motion/package.json @@ -14,7 +14,7 @@ "url": "git+https://github.com/lynx-family/lynx-stack.git", "directory": "packages/motion" }, - "license": "MIT", + "license": "Apache-2.0", "sideEffects": [ "./src/polyfill/shim.ts", "./dist/polyfill/shim.js" diff --git a/tsconfig.json b/tsconfig.json index 88be4df1fe..132ce07bc9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -122,9 +122,6 @@ { "path": "./packages/react" }, - { - "path": "./packages/motion" - }, { "path": "./packages/tailwind-preset/tsconfig.build.json" } From b93796a2afa8e13d36c679a39f046d5a5837d384 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 19 Jan 2026 15:42:49 +0800 Subject: [PATCH 24/37] chore: revert prepare commands back --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index eaa93e0d7b..0cb4f5e1e0 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "type": "module", "scripts": { "build": "tsc --build", + "prepare": "husky && ts-patch install", "test": "vitest" }, "lint-staged": { From 459fdf420cd8bd4958e481b12ffcbaa54c55ae0c Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 19 Jan 2026 16:58:55 +0800 Subject: [PATCH 25/37] fix: motion example test types --- examples/motion/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/motion/package.json b/examples/motion/package.json index b08c60b0c9..01127f5cc9 100644 --- a/examples/motion/package.json +++ b/examples/motion/package.json @@ -5,8 +5,7 @@ "type": "module", "scripts": { "build": "rspeedy build", - "dev": "rspeedy dev", - "test:type": "vitest --typecheck.only" + "dev": "rspeedy dev" }, "dependencies": { "@lynx-js/motion": "workspace:*", From 144f4a805303f2cf14b124b12ec02969a9b9d5e8 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 19 Jan 2026 17:52:21 +0800 Subject: [PATCH 26/37] style: add useMotionValueRef comments --- packages/motion/src/mini/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/motion/src/mini/index.ts b/packages/motion/src/mini/index.ts index 9bcbc1a6a7..6d52cfbda7 100644 --- a/packages/motion/src/mini/index.ts +++ b/packages/motion/src/mini/index.ts @@ -35,10 +35,16 @@ export type { } from './core/MotionValue.js'; export { spring } from './core/spring.js'; +/** + * @experimental useMotionValue, but in MainThreadRef format, highly experimental, subject to change + */ export function useMotionValueRef(value: T): MainThreadRef> { return useMotionValueRefCore(value, createMotionValue); } +/** + * @experimental useMotionValueEvent, but only accepts motionValueRef format, highly experimental, subject to change + */ export function useMotionValueRefEvent< V, EventName extends keyof MotionValueEventCallbacks, From 8aca1a741baffccd77e40f27990a75ad5d924b10 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 19 Jan 2026 20:34:26 +0800 Subject: [PATCH 27/37] chore: fix motion eslint errors --- examples/motion/tsconfig.json | 1 + packages/motion/tsconfig.json | 3 +++ 2 files changed, 4 insertions(+) diff --git a/examples/motion/tsconfig.json b/examples/motion/tsconfig.json index cd63e98e01..eb71444bb0 100644 --- a/examples/motion/tsconfig.json +++ b/examples/motion/tsconfig.json @@ -15,5 +15,6 @@ { "path": "../../packages/rspeedy/core/tsconfig.build.json" }, { "path": "../../packages/rspeedy/plugin-qrcode/tsconfig.build.json" }, { "path": "../../packages/rspeedy/plugin-react/tsconfig.build.json" }, + { "path": "../../packages/motion/tsconfig.json" }, ], } diff --git a/packages/motion/tsconfig.json b/packages/motion/tsconfig.json index 296ec37e36..d573db2196 100644 --- a/packages/motion/tsconfig.json +++ b/packages/motion/tsconfig.json @@ -1,5 +1,8 @@ { "files": [], + "compilerOptions": { + "composite": true, + }, "references": [ { "path": "./tsconfig.build.json" }, ], From af9888a0b46d9abb180af400d6c8ff2de0bb64d2 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 19 Jan 2026 21:31:03 +0800 Subject: [PATCH 28/37] chore: fix eslint error --- packages/motion/turbo.jsonc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 packages/motion/turbo.jsonc diff --git a/packages/motion/turbo.jsonc b/packages/motion/turbo.jsonc new file mode 100644 index 0000000000..d0c4b0958c --- /dev/null +++ b/packages/motion/turbo.jsonc @@ -0,0 +1,21 @@ +{ + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "build": { + "dependsOn": [ + "@lynx-js/react#build", + ], + "inputs": [ + "$TURBO_ROOT$/tsconfig.json", + "$TURBO_ROOT$/tsconfig.build.json", + "package.json", + "src/**", + "rslib.config.ts", + ], + "outputs": [ + "dist", + ], + }, + }, +} From 5ccf97f56c9fb4fd9afab446a45f88c69361be47 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 19 Jan 2026 22:22:26 +0800 Subject: [PATCH 29/37] chore: react build dependents --- packages/lynx/gesture-runtime/turbo.jsonc | 2 +- packages/motion/tsconfig.build.json | 3 +++ packages/motion/turbo.jsonc | 3 ++- tsconfig.json | 6 ++++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/lynx/gesture-runtime/turbo.jsonc b/packages/lynx/gesture-runtime/turbo.jsonc index 72c6dacfba..7fbaa86253 100644 --- a/packages/lynx/gesture-runtime/turbo.jsonc +++ b/packages/lynx/gesture-runtime/turbo.jsonc @@ -4,7 +4,7 @@ "tasks": { "build": { "dependsOn": [ - "@lynx-js/react#build", + "^build", ], "inputs": [ "$TURBO_ROOT$/tsconfig.json", diff --git a/packages/motion/tsconfig.build.json b/packages/motion/tsconfig.build.json index 799973d8d0..8a9f2c692f 100644 --- a/packages/motion/tsconfig.build.json +++ b/packages/motion/tsconfig.build.json @@ -14,4 +14,7 @@ "rootDir": "src", }, "include": ["src/**/*.ts", "src/**/*.tsx"], + "references": [ + { "path": "../react/tsconfig.json" }, + ], } diff --git a/packages/motion/turbo.jsonc b/packages/motion/turbo.jsonc index d0c4b0958c..4085257df6 100644 --- a/packages/motion/turbo.jsonc +++ b/packages/motion/turbo.jsonc @@ -4,7 +4,8 @@ "tasks": { "build": { "dependsOn": [ - "@lynx-js/react#build", + "//#build", + "^build", ], "inputs": [ "$TURBO_ROOT$/tsconfig.json", diff --git a/tsconfig.json b/tsconfig.json index 132ce07bc9..b80ccffe36 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -122,6 +122,12 @@ { "path": "./packages/react" }, + { + "path": "./packages/lynx" + }, + { + "path": "./packages/motion" + }, { "path": "./packages/tailwind-preset/tsconfig.build.json" } From 00665e006e96b4ddaae71e9fcb4ab4567f6750e9 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Wed, 21 Jan 2026 23:07:20 +0800 Subject: [PATCH 30/37] fix: remove document import --- .changeset/shared-runtime-imports.md | 20 ------ packages/motion/README.md | 98 +++++++++++++++++++++++++++- packages/motion/README_MINI.md | 64 ------------------ packages/motion/src/polyfill/shim.ts | 50 +++++++------- packages/motion/turbo.jsonc | 2 +- 5 files changed, 122 insertions(+), 112 deletions(-) delete mode 100644 .changeset/shared-runtime-imports.md delete mode 100644 packages/motion/README_MINI.md diff --git a/.changeset/shared-runtime-imports.md b/.changeset/shared-runtime-imports.md deleted file mode 100644 index 6d4b5330c9..0000000000 --- a/.changeset/shared-runtime-imports.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -"@lynx-js/react": patch ---- - -feat: support declaring cross-thread shared modules via Import Attributes, enabling Main Thread Functions to call standard JS functions directly. - -- Usage: Add `with { runtime: "shared" }` to the `import` statement. For example: - - ```ts - import { func } from './utils.js' with { runtime: 'shared' }; - - function worklet() { - 'main thread'; - func(); // callable inside a main thread function - } - ``` - -- Limitations: - - Only directly imported identifiers are treated as shared; assigning the import to a new variable will result in the loss of this shared capability. - - Functions defined within shared modules do not automatically become Main Thread Functions. Accessing main-thread-only APIs (e.g., `MainThreadRef`) will cause errors. diff --git a/packages/motion/README.md b/packages/motion/README.md index 93c034e4fe..62f74d69d8 100644 --- a/packages/motion/README.md +++ b/packages/motion/README.md @@ -1,3 +1,97 @@ -# motion-lynx +# @lynx-js/motion -This is a port of motion.dev for Lynx. Currently work in progress +A powerful animation library for Lynx, ported from [Motion for React (framer-motion)](https://motion.dev/). It brings declarative animations and gesture handling to the Lynx ecosystem. + +## Installation + +```bash +npm install @lynx-js/motion +``` + +## Usage + +### Basic Animation + +Currently, `@lynx-js/motion` supports imperative animations using the `animate` function on the main thread. + +```tsx +import { animate } from '@lynx-js/motion'; +import { useMainThreadRef, runOnMainThread, useEffect } from '@lynx-js/react'; +import type { MainThread } from '@lynx-js/types'; + +export function MyComponent() { + const elementRef = useMainThreadRef(null); + + useEffect(() => { + runOnMainThread(() => { + 'main thread'; + if (elementRef.current) { + animate( + elementRef.current, + { opacity: 1, x: 100 }, + { duration: 1 }, + ); + } + })(); + }, []); + + return ( + + ); +} +``` + +For more comprehensive examples, please refer to the [examples/motion](../../examples/motion) directory in this repository. + +## Motion Mini (`@lynx-js/motion/mini`) + +Motion Mini is a lightweight, **main-thread-optimized** version of the library. It provides a core subset of animation capabilities designed for high performance and low bundle size. + +To use it, import from `@lynx-js/motion/mini`: + +```tsx +import { animate, createMotionValue } from '@lynx-js/motion/mini'; +``` + +### Key Features + +- **Main Thread Animation**: Runs directly on the main thread, bypassing the JS thread for smoother performance. +- **Small Bundle Size**: Includes only essential animation logic. +- **Optimized for Numbers**: Primarily designed for animating numeric values. + +### Differences from Standard Motion + +| Feature | Standard Motion | Motion Mini | +| :-------------------- | :------------------------------------------------ | :------------------------ | +| **Animation Targets** | Numbers, Strings (colors, units), Objects, Arrays | **Numbers only** (mostly) | +| **Keyframes** | Full support | Limited support | +| **Layout Animations** | Supported | Not supported | +| **Gesture Handlers** | Full suite (drag, pan, hover, etc.) | Not included | + +> **Note**: `MotionValue` in Mini primarily works with numbers. + +### CLI Reference for Mini + +#### `createMotionValue(initial: T)` + +Creates a `MotionValue` that tracks state and velocity. + +```typescript +const mv = createMotionValue(0); +mv.set(100); +``` + +#### `animate(value, target, options)` + +Animates a `MotionValue` or number. + +```typescript +animate(mv, 100, { + type: 'spring', + stiffness: 300, + damping: 30, +}); +``` diff --git a/packages/motion/README_MINI.md b/packages/motion/README_MINI.md deleted file mode 100644 index 85aac546b1..0000000000 --- a/packages/motion/README_MINI.md +++ /dev/null @@ -1,64 +0,0 @@ -# Motion Mini - -Motion Mini is a lightweight, main-thread-optimized version of the Motion library for Lynx. It provides a core subset of animation capabilities designed for high performance and low bundle size. - -## Features - -- **Main Thread Animation**: All animations run directly on the main thread, bypassing the JS thread for smoother performance. -- **Small Bundle Size**: Includes only essential animation logic (Spring, Tween, MotionValues). -- **Core API Compatibility**: API is similar to the standard `motion` package, making it easy to learn. - -## Limits & Differences - -| Feature | Standard Motion | Motion Mini | -| :-------------------- | :------------------------------------------------ | :------------------------ | -| **Animation Targets** | Numbers, Strings (colors, units), Objects, Arrays | **Numbers only** (mostly) | -| **Keyframes** | Full support | Limited support | -| **Layout Animations** | Supported | Not supported | -| **Gesture Handlers** | Full suite (drag, pan, hover, etc.) | Not included | - -> **Note**: `MotionValue` in Mini primarily works with numbers. If you need to animate complex strings or colors, consider using the full `motion` package or handle interpolation manually. - -## API Reference - -### `createMotionValue(initial: T)` - -Creates a `MotionValue` that tracks the state and velocity of a value. - -```typescript -const mv = createMotionValue(0); -mv.set(100); -console.log(mv.get()); // 100 -``` - -### `animate(value, target, options)` - -Animates a `MotionValue` or a number to a target value. - -- **value**: `MotionValue` or `number` or `(v) => void` setter. -- **target**: Target value (number). -- **options**: Animation configuration (`duration`, `ease`, `type`, `stiffness`, etc.). - -```typescript -animate(mv, 100, { - type: 'spring', - stiffness: 300, - damping: 30, -}); -``` - -### `useMotionValueRef(initial)` - -React hook to create a `MotionValue` that persists across renders and is safe to use on the main thread. - -```typescript -const mvRef = useMotionValueRef(0); -``` - -### `spring(options)` - -Low-level spring animation generator compatible with `motion-dom`. - -### Easings - -Includes standard easings: `linear`, `easeIn`, `easeOut`, `easeInOut`, `circIn`, `circOut`, `circInOut`, `backIn`, `backOut`, `backInOut`, `anticipate`. diff --git a/packages/motion/src/polyfill/shim.ts b/packages/motion/src/polyfill/shim.ts index 355fa384f7..e669c74603 100644 --- a/packages/motion/src/polyfill/shim.ts +++ b/packages/motion/src/polyfill/shim.ts @@ -1,17 +1,35 @@ // Copyright 2025 The Lynx Authors. All rights reserved. // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. -import { document, setupDocument } from '@lynx-js/react/internal/document'; import { ElementCompt } from './element.js'; const timeOrigin = Date.now(); +function shimQueueMicroTask() { + if (!globalThis.queueMicrotask) { + if (lynx.queueMicrotask) { + // eslint-disable-next-line @typescript-eslint/unbound-method + globalThis.queueMicrotask = lynx.queueMicrotask; + } else { + const resolved = globalThis.Promise.resolve(); + globalThis.queueMicrotask = (fn) => { + // Schedule as a microtask, and surface exceptions like queueMicrotask would. + resolved.then(fn).catch((err) => { + setTimeout(() => { + throw err; + }, 0); + }); + }; + } + } +} + function shimGlobals() { // Only shim document if it doesn't exist if (!globalThis.document) { // @ts-expect-error error - globalThis.document = document; + globalThis.document = {}; } // Only shim performance if it doesn't exist @@ -22,20 +40,11 @@ function shimGlobals() { }; } - // Only shim queueMicrotask if it doesn't exist - if (!globalThis.queueMicrotask) { - globalThis.queueMicrotask = (fn: CallableFunction) => { - void Promise.resolve().then(() => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - fn(); - }); - }; - } - // Only shim document query methods if they don't exist - // @ts-expect-error error + // eslint-disable-next-line @typescript-eslint/unbound-method document.querySelector ??= lynx.querySelector; // @ts-expect-error error + // eslint-disable-next-line @typescript-eslint/unbound-method document.querySelectorAll ??= lynx.querySelectorAll; // Only shim NodeList if it doesn't exist @@ -74,21 +83,12 @@ function shimGlobals() { // Only shim getComputedStyle if it doesn't exist globalThis.getComputedStyle ??= globalThis.window?.getComputedStyle; + + shimQueueMicroTask(); } if (__MAIN_THREAD__) { - setupDocument(); - shimGlobals(); } else if (__DEV__) { - // Only shim queueMicrotask if it doesn't exist - // eslint-disable-next-line unicorn/no-lonely-if - if (!globalThis.queueMicrotask) { - globalThis.queueMicrotask = (fn: CallableFunction) => { - void Promise.resolve().then(() => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - fn(); - }); - }; - } + shimQueueMicroTask(); } diff --git a/packages/motion/turbo.jsonc b/packages/motion/turbo.jsonc index 4085257df6..fefebb0d6d 100644 --- a/packages/motion/turbo.jsonc +++ b/packages/motion/turbo.jsonc @@ -9,7 +9,7 @@ ], "inputs": [ "$TURBO_ROOT$/tsconfig.json", - "$TURBO_ROOT$/tsconfig.build.json", + "./tsconfig.build.json", "package.json", "src/**", "rslib.config.ts", From 0c2594662aa7c2849076aa3b15095cdc4889468e Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Fri, 23 Jan 2026 17:31:10 +0800 Subject: [PATCH 31/37] chore: fix coding style problems --- examples/motion/src/App.tsx | 12 ++++-- examples/motion/src/Basic/index.tsx | 3 +- examples/motion/src/BasicSelector/index.tsx | 3 +- examples/motion/src/Mini/index.tsx | 16 +++++--- examples/motion/src/MotionValue/index.tsx | 26 +++++++++---- examples/motion/src/Text/index.tsx | 2 +- packages/motion/__tests__/tsconfig.json | 6 +-- packages/motion/src/animation/index.ts | 38 ++----------------- packages/motion/src/hooks/useMotionEvent.ts | 2 +- .../motion/src/hooks/useMotionValueRef.ts | 4 +- packages/motion/src/mini/core/animate.ts | 8 +++- packages/motion/src/polyfill/shim.ts | 15 ++++++-- packages/motion/src/utils/elementHelper.ts | 7 ++++ packages/motion/turbo.jsonc | 2 +- 14 files changed, 78 insertions(+), 66 deletions(-) diff --git a/examples/motion/src/App.tsx b/examples/motion/src/App.tsx index a2381152dc..b0c4fd1014 100644 --- a/examples/motion/src/App.tsx +++ b/examples/motion/src/App.tsx @@ -13,7 +13,12 @@ import Text from './Text/index.js'; import './App.css'; -const CASES = [ +interface CaseItem { + name: string; + comp: () => JSX.Element; +} + +const CASES: CaseItem[] = [ { name: 'Basic', comp: Basic, @@ -59,8 +64,7 @@ const CASES = [ export function App() { const [current, setCurrent] = useState(0); - // @ts-expect-error error - const CurrentComp = CASES[current].comp; + const CurrentComp = CASES[current]?.comp; return ( @@ -79,7 +83,7 @@ export function App() { Current case is: {CASES[current]?.name} - {} + {CurrentComp && } ); diff --git a/examples/motion/src/Basic/index.tsx b/examples/motion/src/Basic/index.tsx index 31a0ec472c..e86d7d6387 100644 --- a/examples/motion/src/Basic/index.tsx +++ b/examples/motion/src/Basic/index.tsx @@ -34,10 +34,11 @@ export default function Basic() { } useEffect(() => { - setTimeout(() => { + const timeoutId = setTimeout(() => { void runOnMainThread(startAnimation)(); }, 1500); return () => { + clearTimeout(timeoutId); void runOnMainThread(endAnimation)(); }; }, []); diff --git a/examples/motion/src/BasicSelector/index.tsx b/examples/motion/src/BasicSelector/index.tsx index 06c47e8567..a5e78163ca 100644 --- a/examples/motion/src/BasicSelector/index.tsx +++ b/examples/motion/src/BasicSelector/index.tsx @@ -29,10 +29,11 @@ export default function Basic() { } useEffect(() => { - setTimeout(() => { + const timeoutId = setTimeout(() => { void runOnMainThread(startAnimation)(); }, 1000); return () => { + clearTimeout(timeoutId); void runOnMainThread(endAnimation)(); }; }, []); diff --git a/examples/motion/src/Mini/index.tsx b/examples/motion/src/Mini/index.tsx index 35863fb554..16b465852e 100644 --- a/examples/motion/src/Mini/index.tsx +++ b/examples/motion/src/Mini/index.tsx @@ -16,18 +16,24 @@ export default function MiniExample() { const x = useMotionValueRef(0); const scale = useMotionValueRef(1); - useMotionValueRefEvent(x, 'change', (v) => { + // Consolidate transform updates to avoid redundant DOM operations + const updateTransform = (xVal?: number, scaleVal?: number) => { 'main thread'; + const xValue = xVal ?? x.current.get(); + const scaleValue = scaleVal ?? scale.current.get(); boxRef.current?.setStyleProperties({ - transform: `translateX(${v}px) scale(${scale.current.get()})`, + transform: `translateX(${xValue}px) scale(${scaleValue})`, }); + }; + + useMotionValueRefEvent(x, 'change', (v) => { + 'main thread'; + updateTransform(v, undefined); }); useMotionValueRefEvent(scale, 'change', (v) => { 'main thread'; - boxRef.current?.setStyleProperties({ - transform: `translateX(${x.current.get()}px) scale(${v})`, - }); + updateTransform(undefined, v); }); const handleTapSpring = () => { diff --git a/examples/motion/src/MotionValue/index.tsx b/examples/motion/src/MotionValue/index.tsx index 8349b2981e..cb9d244996 100644 --- a/examples/motion/src/MotionValue/index.tsx +++ b/examples/motion/src/MotionValue/index.tsx @@ -1,23 +1,24 @@ import { motionValue } from '@lynx-js/motion'; -import type { MotionValue, animate } from '@lynx-js/motion'; +import type { MotionValue } from '@lynx-js/motion'; import { runOnMainThread, useEffect, useMainThreadRef } from '@lynx-js/react'; import type { MainThread } from '@lynx-js/types'; import './styles.css'; export default function Basic() { - const animateMTRef = useMainThreadRef | null>( - null, - ); const boxMTRef = useMainThreadRef(null); const valueMTRef = useMainThreadRef>(); + const intervalMTRef = useMainThreadRef | null>( + null, + ); + const unsubscribeMTRef = useMainThreadRef<(() => void) | null>(null); function bindMotionValueCallback() { 'main thread'; valueMTRef.current ??= motionValue(0.5); - valueMTRef.current.on('change', (value) => { + unsubscribeMTRef.current = valueMTRef.current.on('change', (value) => { boxMTRef.current?.setStyleProperties({ transform: `scale(${value})`, }); @@ -29,7 +30,7 @@ export default function Basic() { bindMotionValueCallback(); - setInterval(() => { + intervalMTRef.current = setInterval(() => { valueMTRef.current?.set(valueMTRef.current.get() + 0.5); }, 1000); } @@ -37,14 +38,23 @@ export default function Basic() { function endAnimation() { 'main thread'; - animateMTRef.current?.stop(); + if (intervalMTRef.current) { + clearInterval(intervalMTRef.current); + intervalMTRef.current = null; + } + + if (unsubscribeMTRef.current) { + unsubscribeMTRef.current(); + unsubscribeMTRef.current = null; + } } useEffect(() => { - setTimeout(() => { + const timeoutId = setTimeout(() => { void runOnMainThread(startAnimation)(); }, 1000); return () => { + clearTimeout(timeoutId); void runOnMainThread(endAnimation)(); }; }, []); diff --git a/examples/motion/src/Text/index.tsx b/examples/motion/src/Text/index.tsx index 67ce94e2e8..fd78c74692 100644 --- a/examples/motion/src/Text/index.tsx +++ b/examples/motion/src/Text/index.tsx @@ -18,7 +18,7 @@ export default function Text() { ease: 'circInOut', duration: 2, onUpdate: (latest) => { - textMTRef.current?.setAttribute('text', latest); + textMTRef.current?.setAttribute('text', String(latest)); }, }); } diff --git a/packages/motion/__tests__/tsconfig.json b/packages/motion/__tests__/tsconfig.json index fc4ef0f97a..66e28b2a5a 100644 --- a/packages/motion/__tests__/tsconfig.json +++ b/packages/motion/__tests__/tsconfig.json @@ -5,9 +5,9 @@ "noEmit": true, "rootDir": ".", "rootDirs": [ - "src", - "__tests__", + "../src", + ".", ], }, - "include": ["src", "__tests__"], + "include": ["../src", "."], } diff --git a/packages/motion/src/animation/index.ts b/packages/motion/src/animation/index.ts index d5351efcbe..8b8d445294 100644 --- a/packages/motion/src/animation/index.ts +++ b/packages/motion/src/animation/index.ts @@ -27,7 +27,6 @@ import type { AnimationPlaybackControlsWithThen, AnyResolvedKeyframe, DOMKeyframesDefinition, - ElementOrSelector, MapInputRange, Mixer, MotionValue, @@ -39,14 +38,9 @@ import type { } from 'motion-dom'; import { useMotionValueRefEvent } from '../hooks/useMotionEvent.js'; -import { ElementCompt } from '../polyfill/element.js' with { runtime: 'shared' }; import { motionValue as motionValue_ } from '../polyfill/MotionValue.js' with { runtime: 'shared' }; import type { ElementOrElements } from '../types/index.js'; import { elementOrSelector2Dom } from '../utils/elementHelper.js'; -import { - isMainThreadElement, - isMainThreadElementArray, -} from '../utils/isMainThreadElement.js'; import { noopMT } from '../utils/noop.js'; /** @@ -134,35 +128,9 @@ function animate( ): AnimationPlaybackControlsWithThen { 'main thread'; - let realSubjectOrSequence: - | AnimationSequence - | MotionValue - | MotionValue - | number - | string - | ElementOrSelector - | O - | O[]; - - if ( - typeof subjectOrSequence === 'string' - || isMainThreadElement(subjectOrSequence) - || isMainThreadElementArray(subjectOrSequence) - ) { - let elementNodes: ElementOrElements; - if (typeof subjectOrSequence === 'string') { - elementNodes = lynx.querySelectorAll(subjectOrSequence); - } else { - elementNodes = subjectOrSequence; - } - realSubjectOrSequence = (Array.isArray(elementNodes) - ? elementNodes.map(el => new ElementCompt(el)) - : new ElementCompt( - elementNodes, - )) as unknown as ElementOrSelector; - } else { - realSubjectOrSequence = subjectOrSequence; - } + const realSubjectOrSequence = + elementOrSelector2Dom(subjectOrSequence as ElementOrElements) + ?? (subjectOrSequence as unknown); // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module return animate_( diff --git a/packages/motion/src/hooks/useMotionEvent.ts b/packages/motion/src/hooks/useMotionEvent.ts index 58a2f7870e..dea14e3367 100644 --- a/packages/motion/src/hooks/useMotionEvent.ts +++ b/packages/motion/src/hooks/useMotionEvent.ts @@ -37,5 +37,5 @@ export function useMotionValueRefEvent< unListenRef.current?.(); })(); }; - }, [callback]); + }, [valueRef, event, callback]); } diff --git a/packages/motion/src/hooks/useMotionValueRef.ts b/packages/motion/src/hooks/useMotionValueRef.ts index abf97cb971..7110841eef 100644 --- a/packages/motion/src/hooks/useMotionValueRef.ts +++ b/packages/motion/src/hooks/useMotionValueRef.ts @@ -17,7 +17,8 @@ export function useMotionValueRefCore( value: T, make: (v: T) => MV, ): MainThreadRef { - // @ts-expect-error expected + // @ts-expect-error - useMainThreadRef doesn't require initial value but TypeScript expects it + // This is safe because we initialize it in the useMemo below before any usage const motionValueRef: MainThreadRef = useMainThreadRef(); useMemo(() => { @@ -30,6 +31,7 @@ export function useMotionValueRefCore( if (__BACKGROUND__) { void runOnMainThread(setMotionValue)(value); } else { + // Type assertion needed to bridge between worklet runtime and motion value types runWorkletCtx(setMotionValue as unknown as Worklet, [ value as WorkletRef, ]); diff --git a/packages/motion/src/mini/core/animate.ts b/packages/motion/src/mini/core/animate.ts index ece963a281..aa58aab465 100644 --- a/packages/motion/src/mini/core/animate.ts +++ b/packages/motion/src/mini/core/animate.ts @@ -100,13 +100,18 @@ export function animate( const startTime = Date.now(); let canceled = false; + let resolvePromise: (() => void) | undefined; + const completionPromise = new Promise((resolve) => { + resolvePromise = resolve; + }); + const controls = { stop: () => { canceled = true; }, then: (cb: () => void) => { controls.onFinish = cb; - return Promise.resolve(); // Mock promise return async/await usage + return completionPromise; // Return actual promise that resolves on completion }, // biome-ignore lint/suspicious/noEmptyBlockStatements: onFinish: () => {}, @@ -176,6 +181,7 @@ export function animate( options.onComplete(); } controls.onFinish(); + resolvePromise?.(); // Resolve the promise when animation completes detach?.(); } else { requestAnimationFrame(tick); diff --git a/packages/motion/src/polyfill/shim.ts b/packages/motion/src/polyfill/shim.ts index e669c74603..d1ccbfbc75 100644 --- a/packages/motion/src/polyfill/shim.ts +++ b/packages/motion/src/polyfill/shim.ts @@ -4,11 +4,16 @@ import { ElementCompt } from './element.js'; -const timeOrigin = Date.now(); +// Capture timeOrigin correctly - use performance.timeOrigin if available, otherwise current timestamp +const timeOrigin = + (typeof performance !== 'undefined' && performance.timeOrigin) + ? performance.timeOrigin + : Date.now(); function shimQueueMicroTask() { if (!globalThis.queueMicrotask) { - if (lynx.queueMicrotask) { + // Guard against undefined lynx global before accessing lynx.queueMicrotask + if (typeof lynx !== 'undefined' && lynx.queueMicrotask) { // eslint-disable-next-line @typescript-eslint/unbound-method globalThis.queueMicrotask = lynx.queueMicrotask; } else { @@ -81,8 +86,10 @@ function shimGlobals() { // @ts-expect-error error globalThis.EventTarget ??= ElementCompt; - // Only shim getComputedStyle if it doesn't exist - globalThis.getComputedStyle ??= globalThis.window?.getComputedStyle; + // Only shim getComputedStyle if it doesn't exist and window.getComputedStyle is available + if (!globalThis.getComputedStyle && globalThis.window?.getComputedStyle) { + globalThis.getComputedStyle = globalThis.window.getComputedStyle; + } shimQueueMicroTask(); } diff --git a/packages/motion/src/utils/elementHelper.ts b/packages/motion/src/utils/elementHelper.ts index 5af14c870a..a5ec0685ae 100644 --- a/packages/motion/src/utils/elementHelper.ts +++ b/packages/motion/src/utils/elementHelper.ts @@ -26,6 +26,13 @@ export function elementOrSelector2Dom( let elementNodes: ElementOrElements; if (typeof nodesOrSelector === 'string') { elementNodes = lynx.querySelectorAll(nodesOrSelector); + // Validate that query returned results + if ( + !elementNodes + || (Array.isArray(elementNodes) && elementNodes.length === 0) + ) { + return undefined; + } } else { elementNodes = nodesOrSelector; } diff --git a/packages/motion/turbo.jsonc b/packages/motion/turbo.jsonc index fefebb0d6d..5bf60893b7 100644 --- a/packages/motion/turbo.jsonc +++ b/packages/motion/turbo.jsonc @@ -9,7 +9,7 @@ ], "inputs": [ "$TURBO_ROOT$/tsconfig.json", - "./tsconfig.build.json", + "tsconfig.build.json", "package.json", "src/**", "rslib.config.ts", From 91b18b3ca1fc92769fdcb820f514555f4575bc34 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Mon, 26 Jan 2026 14:53:31 +0800 Subject: [PATCH 32/37] chore: turn off rslib build cache to prevent building crash --- packages/motion/README.md | 2 +- packages/motion/package.json | 1 - packages/motion/rslib.config.ts | 3 ++ pnpm-lock.yaml | 54 +++++---------------------------- 4 files changed, 11 insertions(+), 49 deletions(-) diff --git a/packages/motion/README.md b/packages/motion/README.md index 62f74d69d8..38e19cfdce 100644 --- a/packages/motion/README.md +++ b/packages/motion/README.md @@ -44,7 +44,7 @@ export function MyComponent() { } ``` -For more comprehensive examples, please refer to the [examples/motion](../../examples/motion) directory in this repository. +For more comprehensive examples, please refer to the [examples/motion](https://github.com/lynx-family/lynx-stack/tree/main/examples/motion) directory in this repository. ## Motion Mini (`@lynx-js/motion/mini`) diff --git a/packages/motion/package.json b/packages/motion/package.json index ad721529fb..776ef8f484 100644 --- a/packages/motion/package.json +++ b/packages/motion/package.json @@ -36,7 +36,6 @@ "types": "dist/index.d.ts", "files": [ "dist", - "src", "README.md", "CHANGELOG.md" ], diff --git a/packages/motion/rslib.config.ts b/packages/motion/rslib.config.ts index 5f794e9aa6..64fad346b7 100644 --- a/packages/motion/rslib.config.ts +++ b/packages/motion/rslib.config.ts @@ -14,4 +14,7 @@ export default defineConfig({ tsconfigPath: './tsconfig.build.json', }, plugins: [pluginPublint()], + performance: { + buildCache: false, + }, }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 75ef7c9a8e..6e2258ea65 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -400,7 +400,7 @@ importers: version: 7.55.2(@types/node@24.6.1) '@modelcontextprotocol/sdk': specifier: ^1.20.0 - version: 1.25.2(hono@4.11.3)(zod@3.25.76) + version: 1.20.0 '@types/debug': specifier: ^4.1.12 version: 4.1.12 @@ -421,7 +421,7 @@ importers: dependencies: '@modelcontextprotocol/sdk': specifier: ^1.20.0 - version: 1.25.2(hono@4.11.3)(zod@3.25.76) + version: 1.20.0 commander: specifier: ^13.1.0 version: 13.1.0 @@ -2932,12 +2932,6 @@ packages: '@hongzhiyuan/preact@10.28.0-fc4af453': resolution: {integrity: sha512-TrM2g079OZN1poroDnU2kQd1gNUB1DMfVoKyz23AE3hZvl9ypRgG2MdgxAJtwT5u3BmYvI4Z0EbdpJTdf428IQ==} - '@hono/node-server@1.19.7': - resolution: {integrity: sha512-vUcD0uauS7EU2caukW8z5lJKtoGMokxNbJtBiwHgpqxEXokaHCBkQUmCHhjFB1VUTWdqj25QoMkMKzgjq+uhrw==} - engines: {node: '>=18.14.1'} - peerDependencies: - hono: ^4 - '@humanfs/core@0.19.1': resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} engines: {node: '>=18.18.0'} @@ -3138,15 +3132,9 @@ packages: '@microsoft/tsdoc@0.16.0': resolution: {integrity: sha512-xgAyonlVVS+q7Vc7qLW0UrJU7rSFcETRWsqdXZtjzRU8dF+6CkozTK4V4y1LwOX7j8r/vHphjDeMeGI4tNGeGA==} - '@modelcontextprotocol/sdk@1.25.2': - resolution: {integrity: sha512-LZFeo4F9M5qOhC/Uc1aQSrBHxMrvxett+9KLHt7OhcExtoiRN9DKgbZffMP/nxjutWDQpfMDfP3nkHI4X9ijww==} + '@modelcontextprotocol/sdk@1.20.0': + resolution: {integrity: sha512-kOQ4+fHuT4KbR2iq2IjeV32HiihueuOf1vJkq18z08CLZ1UQrTc8BXJpVfxZkq45+inLLD+D4xx4nBjUelJa4Q==} engines: {node: '>=18'} - peerDependencies: - '@cfworker/json-schema': ^4.1.1 - zod: ^3.25 || ^4.0 - peerDependenciesMeta: - '@cfworker/json-schema': - optional: true '@module-federation/error-codes@0.22.0': resolution: {integrity: sha512-xF9SjnEy7vTdx+xekjPCV5cIHOGCkdn3pIxo9vU7gEZMIw0SvAEdsy6Uh17xaCpm8V0FWvR0SZoK9Ik6jGOaug==} @@ -6454,10 +6442,6 @@ packages: hastscript@9.0.1: resolution: {integrity: sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==} - hono@4.11.3: - resolution: {integrity: sha512-PmQi306+M/ct/m5s66Hrg+adPnkD5jiO6IjA7WhWw0gSBSo1EcRegwuI1deZ+wd5pzCGynCcn2DprnE4/yEV4w==} - engines: {node: '>=16.9.0'} - hookable@5.5.3: resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==} @@ -6958,9 +6942,6 @@ packages: jju@1.4.0: resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==} - jose@6.1.3: - resolution: {integrity: sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==} - js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -7027,9 +7008,6 @@ packages: json-schema-traverse@1.0.0: resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} - json-schema-typed@8.0.2: - resolution: {integrity: sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==} - json-stable-stringify-without-jsonify@1.0.1: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} @@ -8157,6 +8135,7 @@ packages: engines: {node: '>=0.6.0', teleport: '>=0.2.0'} deprecated: |- You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other. + (For a CapTP with native promises, see @endo/eventual-send and @endo/captp) qs@6.13.0: @@ -11328,10 +11307,6 @@ snapshots: '@hongzhiyuan/preact@10.28.0-fc4af453': {} - '@hono/node-server@1.19.7(hono@4.11.3)': - dependencies: - hono: 4.11.3 - '@humanfs/core@0.19.1': {} '@humanfs/node@0.16.7': @@ -11654,11 +11629,9 @@ snapshots: '@microsoft/tsdoc@0.16.0': {} - '@modelcontextprotocol/sdk@1.25.2(hono@4.11.3)(zod@3.25.76)': + '@modelcontextprotocol/sdk@1.20.0': dependencies: - '@hono/node-server': 1.19.7(hono@4.11.3) - ajv: 8.17.1 - ajv-formats: 3.0.1(ajv@8.17.1) + ajv: 6.12.6 content-type: 1.0.5 cors: 2.8.5 cross-spawn: 7.0.6 @@ -11666,14 +11639,11 @@ snapshots: eventsource-parser: 3.0.6 express: 5.2.1 express-rate-limit: 7.5.1(express@5.2.1) - jose: 6.1.3 - json-schema-typed: 8.0.2 pkce-challenge: 5.0.1 raw-body: 3.0.2 zod: 3.25.76 zod-to-json-schema: 3.25.1(zod@3.25.76) transitivePeerDependencies: - - hono - supports-color '@module-federation/error-codes@0.22.0': {} @@ -13611,10 +13581,6 @@ snapshots: optionalDependencies: ajv: 8.13.0 - ajv-formats@3.0.1(ajv@8.17.1): - optionalDependencies: - ajv: 8.17.1 - ajv-keywords@5.1.0(ajv@8.17.1): dependencies: ajv: 8.17.1 @@ -15734,8 +15700,6 @@ snapshots: property-information: 7.0.0 space-separated-tokens: 2.0.2 - hono@4.11.3: {} - hookable@5.5.3: {} hpack.js@2.1.6: @@ -16301,8 +16265,6 @@ snapshots: jju@1.4.0: {} - jose@6.1.3: {} - js-tokens@4.0.0: {} js-tokens@9.0.1: {} @@ -16392,8 +16354,6 @@ snapshots: json-schema-traverse@1.0.0: {} - json-schema-typed@8.0.2: {} - json-stable-stringify-without-jsonify@1.0.1: {} json-stream-stringify@3.0.1: {} From 15275941510801e15e23bec324cb9a919fa10de0 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Tue, 27 Jan 2026 14:58:12 +0800 Subject: [PATCH 33/37] chore: add changeset --- .changeset/moody-baboons-happen.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/moody-baboons-happen.md diff --git a/.changeset/moody-baboons-happen.md b/.changeset/moody-baboons-happen.md new file mode 100644 index 0000000000..177e805635 --- /dev/null +++ b/.changeset/moody-baboons-happen.md @@ -0,0 +1,5 @@ +--- +'@lynx-js/motion': patch +--- + +Add initial support for `@lynx-js/motion` From 8b891d4376618700477f96bae7e8de137d1103f1 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Tue, 27 Jan 2026 16:08:30 +0800 Subject: [PATCH 34/37] chore: remove empty changeset --- .changeset/tame-cougars-cry.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .changeset/tame-cougars-cry.md diff --git a/.changeset/tame-cougars-cry.md b/.changeset/tame-cougars-cry.md deleted file mode 100644 index 853d812bb3..0000000000 --- a/.changeset/tame-cougars-cry.md +++ /dev/null @@ -1,3 +0,0 @@ ---- - ---- From 2c4892e0a0aad74d00708e8580567ad4f2fcf84c Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Tue, 27 Jan 2026 20:46:37 +0800 Subject: [PATCH 35/37] fix: animate accepts strings to be animated --- packages/motion/src/animation/index.ts | 29 ++++++++++++------- packages/motion/src/mini/core/animate.ts | 4 ++- packages/motion/src/mini/core/spring.ts | 1 - .../motion/src/utils/registeredFunction.ts | 1 - 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/packages/motion/src/animation/index.ts b/packages/motion/src/animation/index.ts index 8b8d445294..00a02628da 100644 --- a/packages/motion/src/animation/index.ts +++ b/packages/motion/src/animation/index.ts @@ -27,6 +27,7 @@ import type { AnimationPlaybackControlsWithThen, AnyResolvedKeyframe, DOMKeyframesDefinition, + ElementOrSelector, MapInputRange, Mixer, MotionValue, @@ -128,13 +129,25 @@ function animate( ): AnimationPlaybackControlsWithThen { 'main thread'; - const realSubjectOrSequence = - elementOrSelector2Dom(subjectOrSequence as ElementOrElements) - ?? (subjectOrSequence as unknown); + // When animating a value (string/number), we shouldn't attempt to resolve it as a selector. + // Value animations use an array or primitive as the second argument (optionsOrKeyframes). + // Element animations use an object as the second argument (styles/keyframes). + const isStringSubject = typeof subjectOrSequence === 'string'; + const isKeyframesObject = typeof optionsOrKeyframes === 'object' + && optionsOrKeyframes !== null + && !Array.isArray(optionsOrKeyframes); + + let realSubjectOrSequence: typeof subjectOrSequence | ElementOrSelector = + subjectOrSequence; + + if (!isStringSubject || isKeyframesObject) { + realSubjectOrSequence = + elementOrSelector2Dom(subjectOrSequence as ElementOrElements) + ?? subjectOrSequence; + } - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module return animate_( - // @ts-expect-error expected + // @ts-expect-error match overload realSubjectOrSequence, optionsOrKeyframes, options, @@ -145,7 +158,6 @@ function stagger( ...args: Parameters ): ReturnType { 'main thread'; - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module return stagger_( ...args, ); @@ -156,7 +168,6 @@ function motionValue( options?: MotionValueOptions, ): MotionValue { 'main thread'; - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module return motionValue_( init, options, @@ -167,7 +178,6 @@ function spring( ...args: Parameters ): ReturnType { 'main thread'; - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module return spring_(...args); } @@ -176,7 +186,6 @@ function springValue( options?: SpringOptions, ): MotionValue { 'main thread'; - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module return springValue_( source, options, @@ -187,8 +196,6 @@ function mix(from: T, to: T): Mixer; function mix(from: number, to: number, p: number): number; function mix(from: T, to: T, p?: T): Mixer | number { 'main thread'; - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module - return mix_( // @ts-expect-error expected from, diff --git a/packages/motion/src/mini/core/animate.ts b/packages/motion/src/mini/core/animate.ts index aa58aab465..388d619533 100644 --- a/packages/motion/src/mini/core/animate.ts +++ b/packages/motion/src/mini/core/animate.ts @@ -105,9 +105,12 @@ export function animate( resolvePromise = resolve; }); + let detach: (() => void) | undefined; + const controls = { stop: () => { canceled = true; + detach?.(); }, then: (cb: () => void) => { controls.onFinish = cb; @@ -120,7 +123,6 @@ export function animate( const duration = options.duration ?? 0.3; const ease = options.ease ?? easeOut; - let detach: (() => void) | undefined; if ( typeof value === 'object' && value && 'attach' in value && typeof value.attach === 'function' diff --git a/packages/motion/src/mini/core/spring.ts b/packages/motion/src/mini/core/spring.ts index 79ec42af52..186cad7df4 100644 --- a/packages/motion/src/mini/core/spring.ts +++ b/packages/motion/src/mini/core/spring.ts @@ -16,6 +16,5 @@ export function spring( ...args: Parameters ): ReturnType { 'main thread'; - // @TODO: Remove the globalThis trick when MTS can treat a module as MTS module return globalThis.runOnRegistered(springHandle)(...args); } diff --git a/packages/motion/src/utils/registeredFunction.ts b/packages/motion/src/utils/registeredFunction.ts index a94eb6c5c8..1d202b47f3 100644 --- a/packages/motion/src/utils/registeredFunction.ts +++ b/packages/motion/src/utils/registeredFunction.ts @@ -26,5 +26,4 @@ declare global { } // We use globalThis trick to get over with closure capture -// @TODO: Remove this when ReactLynx supports importing MTS for module globalThis.runOnRegistered = runOnRegistered; From d76dcf99e93bf1aa7c23c5cb7de35941e658c05a Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Wed, 28 Jan 2026 11:02:26 +0800 Subject: [PATCH 36/37] fix: animate string test --- packages/motion/src/animation/index.ts | 7 ++++++- packages/motion/src/mini/core/animate.ts | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/motion/src/animation/index.ts b/packages/motion/src/animation/index.ts index 00a02628da..2cf62730e5 100644 --- a/packages/motion/src/animation/index.ts +++ b/packages/motion/src/animation/index.ts @@ -137,10 +137,15 @@ function animate( && optionsOrKeyframes !== null && !Array.isArray(optionsOrKeyframes); + const isKeyframesArray = Array.isArray(optionsOrKeyframes) + && optionsOrKeyframes.every( + k => typeof k === 'object' && k !== null && !Array.isArray(k), + ); + let realSubjectOrSequence: typeof subjectOrSequence | ElementOrSelector = subjectOrSequence; - if (!isStringSubject || isKeyframesObject) { + if (!isStringSubject || isKeyframesObject || isKeyframesArray) { realSubjectOrSequence = elementOrSelector2Dom(subjectOrSequence as ElementOrElements) ?? subjectOrSequence; diff --git a/packages/motion/src/mini/core/animate.ts b/packages/motion/src/mini/core/animate.ts index 388d619533..67357e7ee6 100644 --- a/packages/motion/src/mini/core/animate.ts +++ b/packages/motion/src/mini/core/animate.ts @@ -75,7 +75,9 @@ export function animate( currentV = options.from ?? 0; } else { currentV = value.get(); - startVelocity = startVelocity || value.getVelocity(); + if (options.velocity == null) { + startVelocity = value.getVelocity(); + } if (value.stop) { value.stop(); } @@ -111,6 +113,8 @@ export function animate( stop: () => { canceled = true; detach?.(); + controls.onFinish(); + resolvePromise?.(); }, then: (cb: () => void) => { controls.onFinish = cb; From e95f4e21aa272d9c324a9c0310f22d21218e0108 Mon Sep 17 00:00:00 2001 From: f0rdream <14049186+f0rdream@users.noreply.github.com> Date: Wed, 28 Jan 2026 18:09:34 +0800 Subject: [PATCH 37/37] fix: warn unsupported options for mini animate --- packages/motion/LICENSE | 202 ++++++++++++++++++ packages/motion/NOTICE | 35 +++ packages/motion/README.md | 8 + .../motion/__tests__/MotionValue.test.tsx | 20 +- packages/motion/__tests__/shim.test.ts | 23 +- packages/motion/package.json | 3 +- packages/motion/src/mini/core/MotionValue.ts | 7 +- packages/motion/src/mini/core/animate.ts | 25 ++- packages/motion/src/modified/motionValue.ts | 19 -- 9 files changed, 280 insertions(+), 62 deletions(-) create mode 100644 packages/motion/LICENSE create mode 100644 packages/motion/NOTICE delete mode 100644 packages/motion/src/modified/motionValue.ts diff --git a/packages/motion/LICENSE b/packages/motion/LICENSE new file mode 100644 index 0000000000..d11b6a1011 --- /dev/null +++ b/packages/motion/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2025 The Lynx Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/motion/NOTICE b/packages/motion/NOTICE new file mode 100644 index 0000000000..cb0fec5c27 --- /dev/null +++ b/packages/motion/NOTICE @@ -0,0 +1,35 @@ +Copyright 2025 The Lynx Authors. All rights reserved. + +@lynx-js/motion + +This product includes software developed by the Framer team and contributors. + +The following packages are adapted or used: +- framer-motion (MIT License) +- motion-dom (MIT License) +- motion-utils (MIT License) +- motion-canvas (MIT License, where applicable) + +-------------------------------------------------------------------------------- + +The MIT License (MIT) + +Copyright (c) 2018 Framer B.V. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/motion/README.md b/packages/motion/README.md index 38e19cfdce..304e45028b 100644 --- a/packages/motion/README.md +++ b/packages/motion/README.md @@ -95,3 +95,11 @@ animate(mv, 100, { damping: 30, }); ``` + +## License & Attribution + +This package is licensed under the Apache-2.0 License. + +It adapts code from [Motion for React (framer-motion)](https://motion.dev/), [motion-dom](https://github.com/motiondivision/motion/tree/main/packages/motion-dom), and [motion-utils](https://github.com/motiondivision/motion/tree/main/packages/motion-utils) which are licensed under the MIT License. + +See [LICENSE](./LICENSE), [NOTICE](./NOTICE) for details. diff --git a/packages/motion/__tests__/MotionValue.test.tsx b/packages/motion/__tests__/MotionValue.test.tsx index 85e1c6adbf..83f7cbceb4 100644 --- a/packages/motion/__tests__/MotionValue.test.tsx +++ b/packages/motion/__tests__/MotionValue.test.tsx @@ -2,12 +2,11 @@ // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. -import { beforeEach, describe, expect, test, vi } from 'vitest'; +import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; import { runOnMainThread, useEffect } from '@lynx-js/react'; import { act, render } from '@lynx-js/react/testing-library'; import { createMotionValue } from '../src/mini/core/MotionValue.js'; -import { noopMT } from '../src/utils/noop.js'; describe('MotionValue', () => { let mockRegisteredMap: Map; @@ -395,16 +394,17 @@ describe('MotionValue', () => { try { const mv = createMotionValue(0); - // Calling on() with an unsupported event should not throw + // Calling on() with an unsupported event should throw // @ts-expect-error - testing unsupported event - const unsub = mv.on('unsupported', () => {}); - - // The returned function should be callable without error - if (typeof unsub !== 'function') { - throw new Error('on() did not return a function'); + mv.on('unsupported', () => {}); + } catch (e: any) { + if ( + e.message + === 'mini animate() does not support event type other than \'change\'' + ) { + // Expected error + return; } - unsub(); // Should not throw - } catch (e) { (globalThis as any).__TEST_ERROR = String(e); } })(); diff --git a/packages/motion/__tests__/shim.test.ts b/packages/motion/__tests__/shim.test.ts index 85b52ad5e4..6dcdb790a7 100644 --- a/packages/motion/__tests__/shim.test.ts +++ b/packages/motion/__tests__/shim.test.ts @@ -57,11 +57,11 @@ describe('Shim', () => { globalThis.document = origDocument; globalThis.performance = origPerformance; globalThis.queueMicrotask = origQueueMicrotask; - // @ts-expect-error + globalThis.NodeList = origNodeList; - // @ts-expect-error + globalThis.SVGElement = origSVGElement; - // @ts-expect-error + globalThis.HTMLElement = origHTMLElement; globalThis.window = origWindow; (globalThis as any).Element = origElement; @@ -98,20 +98,3 @@ describe('Shim queueMicrotask', () => { expect(called).toBe(true); }); }); - -describe('Modified MotionValue', () => { - test('should export CustomMotionValue factory', async () => { - const module = await import('../src/modified/motionValue.js'); - expect(module.motionValue).toBeDefined(); - }); - - test('CustomMotionValue should have toJSON that returns empty object', async () => { - const { motionValue } = await import('../src/modified/motionValue.js'); - const mv = motionValue(42); - - expect(mv).toBeDefined(); - // The custom toJSON should return empty object - const json = (mv as any).toJSON(); - expect(json).toEqual({}); - }); -}); diff --git a/packages/motion/package.json b/packages/motion/package.json index 776ef8f484..8ff1a9d74b 100644 --- a/packages/motion/package.json +++ b/packages/motion/package.json @@ -16,7 +16,6 @@ }, "license": "Apache-2.0", "sideEffects": [ - "./src/polyfill/shim.ts", "./dist/polyfill/shim.js" ], "type": "module", @@ -37,6 +36,8 @@ "files": [ "dist", "README.md", + "NOTICE", + "LICENSE", "CHANGELOG.md" ], "scripts": { diff --git a/packages/motion/src/mini/core/MotionValue.ts b/packages/motion/src/mini/core/MotionValue.ts index caec4ff527..ded407b41a 100644 --- a/packages/motion/src/mini/core/MotionValue.ts +++ b/packages/motion/src/mini/core/MotionValue.ts @@ -2,8 +2,6 @@ // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. -import { noopMT } from '../../utils/noop.js'; - export interface MotionValue { get(): T; set(v: T): void; @@ -89,8 +87,11 @@ export function createMotionValue(initial: T): MotionValue { on(event: 'change', callback: (v: T) => void) { if (event === 'change') { return this.onChange(callback); + } else { + throw new Error( + `mini animate() does not support event type other than 'change'`, + ); } - return noopMT; } notify() { diff --git a/packages/motion/src/mini/core/animate.ts b/packages/motion/src/mini/core/animate.ts index 67357e7ee6..7180c3896b 100644 --- a/packages/motion/src/mini/core/animate.ts +++ b/packages/motion/src/mini/core/animate.ts @@ -36,8 +36,6 @@ export interface AnimationOptions { // --- Easings --- -// --- Easings --- - export { anticipate, backIn, @@ -83,10 +81,11 @@ export function animate( } } - // If type is spring or no duration provided, default to spring. - // Unless ease is provided, then tween. + if (options.type === 'decay' || options.type === 'keyframes') { + throw new Error('mini animate() does not support type=decay/keyframes yet'); + } const isSpring = options.type === 'spring' - || (!options.ease && !options.duration && options.type !== 'keyframes'); + || (!options.ease && !options.duration && options.type == null); const { from: _from, to: _to, ...springOptions } = options; @@ -103,21 +102,29 @@ export function animate( let canceled = false; let resolvePromise: (() => void) | undefined; + let settled = false; const completionPromise = new Promise((resolve) => { resolvePromise = resolve; }); + const settle = () => { + if (settled) return; + settled = true; + controls.onFinish(); + resolvePromise?.(); + }; + let detach: (() => void) | undefined; const controls = { stop: () => { canceled = true; detach?.(); - controls.onFinish(); - resolvePromise?.(); + settle(); }, then: (cb: () => void) => { controls.onFinish = cb; + if (settled) cb(); return completionPromise; // Return actual promise that resolves on completion }, // biome-ignore lint/suspicious/noEmptyBlockStatements: @@ -186,8 +193,8 @@ export function animate( if (options.onComplete) { options.onComplete(); } - controls.onFinish(); - resolvePromise?.(); // Resolve the promise when animation completes + + settle(); detach?.(); } else { requestAnimationFrame(tick); diff --git a/packages/motion/src/modified/motionValue.ts b/packages/motion/src/modified/motionValue.ts deleted file mode 100644 index e46db8c9e5..0000000000 --- a/packages/motion/src/modified/motionValue.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2025 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. - -import { MotionValue } from 'motion-dom' with { runtime: 'shared' }; -import type { MotionValueOptions } from 'motion-dom'; - -class CustomMotionValue extends MotionValue { - toJSON() { - return {}; - } -} - -export function motionValue( - init: V, - options?: MotionValueOptions, -): MotionValue { - return new CustomMotionValue(init, options); -}