@lynx-js/motion 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @lynx-js/motion
2
2
 
3
+ ## 0.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix an issue that motion/mini will accidentally imports full version, causing compiling error ([#2204](https://github.com/lynx-family/lynx-stack/pull/2204))
8
+
3
9
  ## 0.0.2
4
10
 
5
11
  ### Patch Changes
@@ -1,6 +1,7 @@
1
1
  import type { MotionValue } from 'motion-dom';
2
2
  import type { MainThreadRef } from '@lynx-js/react';
3
- export declare function useMotionValueRefCore<T, MV>(value: T, make: (v: T) => MV): MainThreadRef<MV>;
3
+ import { useMotionValueRefCore } from './useMotionValueRefCore.js';
4
+ export { useMotionValueRefCore };
4
5
  /**
5
6
  * @experimental useMotionValue, but in MainThreadRef format, highly experimental, subject to change
6
7
  */
@@ -1,20 +1,5 @@
1
- import { runOnMainThread, useMainThreadRef, useMemo } from "@lynx-js/react";
2
- import { runWorkletCtx } from "@lynx-js/react/worklet-runtime/bindings";
1
+ import { useMotionValueRefCore } from "./useMotionValueRefCore.js";
3
2
  import { motionValue } from "../animation/index.js";
4
- function useMotionValueRefCore(value, make) {
5
- const motionValueRef = useMainThreadRef();
6
- useMemo(()=>{
7
- function setMotionValue(value) {
8
- 'main thread';
9
- if (!motionValueRef.current) motionValueRef.current = make(value);
10
- }
11
- if (__BACKGROUND__) runOnMainThread(setMotionValue)(value);
12
- else runWorkletCtx(setMotionValue, [
13
- value
14
- ]);
15
- }, []);
16
- return motionValueRef;
17
- }
18
3
  function useMotionValueRef(value) {
19
4
  return useMotionValueRefCore(value, motionValue);
20
5
  }
@@ -0,0 +1,2 @@
1
+ import type { MainThreadRef } from '@lynx-js/react';
2
+ export declare function useMotionValueRefCore<T, MV>(value: T, make: (v: T) => MV): MainThreadRef<MV>;
@@ -0,0 +1,17 @@
1
+ import { runOnMainThread, useMainThreadRef, useMemo } from "@lynx-js/react";
2
+ import { runWorkletCtx } from "@lynx-js/react/worklet-runtime/bindings";
3
+ function useMotionValueRefCore(value, make) {
4
+ const motionValueRef = useMainThreadRef();
5
+ useMemo(()=>{
6
+ function setMotionValue(value) {
7
+ 'main thread';
8
+ if (!motionValueRef.current) motionValueRef.current = make(value);
9
+ }
10
+ if (__BACKGROUND__) runOnMainThread(setMotionValue)(value);
11
+ else runWorkletCtx(setMotionValue, [
12
+ value
13
+ ]);
14
+ }, []);
15
+ return motionValueRef;
16
+ }
17
+ export { useMotionValueRefCore };
@@ -1,5 +1,5 @@
1
1
  import type { MainThreadRef } from '@lynx-js/react';
2
- import '../polyfill/shim.js';
2
+ import './polyfill.js';
3
3
  import type { MotionValue, MotionValueEventCallbacks } from './core/MotionValue.js';
4
4
  export { animate, anticipate, backIn, backInOut, backOut, circIn, circInOut, circOut, easeIn, easeInOut, easeOut, linear, } from './core/animate.js';
5
5
  export type { AnimationOptions, Easing } from './core/animate.js';
@@ -1,6 +1,6 @@
1
- import "../polyfill/shim.js";
1
+ import "./polyfill.js";
2
2
  import { useMotionValueRefEvent } from "../hooks/useMotionEvent.js";
3
- import { useMotionValueRefCore } from "../hooks/useMotionValueRef.js";
3
+ import { useMotionValueRefCore } from "../hooks/useMotionValueRefCore.js";
4
4
  import { createMotionValue } from "./core/MotionValue.js";
5
5
  import { animate, anticipate, backIn, backInOut, backOut, circIn, circInOut, circOut, easeIn, easeInOut, easeOut, linear } from "./core/animate.js";
6
6
  import { spring } from "./core/spring.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ function shimQueueMicroTask() {
2
+ if (!globalThis.queueMicrotask) if ("u" > typeof lynx && lynx.queueMicrotask) globalThis.queueMicrotask = lynx.queueMicrotask;
3
+ else {
4
+ const resolved = globalThis.Promise.resolve();
5
+ globalThis.queueMicrotask = (fn)=>{
6
+ resolved.then(fn).catch((err)=>{
7
+ setTimeout(()=>{
8
+ throw err;
9
+ }, 0);
10
+ });
11
+ };
12
+ }
13
+ }
14
+ shimQueueMicroTask();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/motion",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "private": false,
5
5
  "description": "This is a motion adapter for Lynx.js",
6
6
  "keywords": [
@@ -16,7 +16,8 @@
16
16
  },
17
17
  "license": "Apache-2.0",
18
18
  "sideEffects": [
19
- "./dist/polyfill/shim.js"
19
+ "./dist/polyfill/shim.js",
20
+ "./dist/mini/polyfill.js"
20
21
  ],
21
22
  "type": "module",
22
23
  "exports": {
@@ -41,14 +42,14 @@
41
42
  "CHANGELOG.md"
42
43
  ],
43
44
  "dependencies": {
44
- "framer-motion": "12.23.12",
45
+ "framer-motion": "12.34.1",
45
46
  "motion-dom": "12.23.12",
46
47
  "motion-utils": "12.23.6"
47
48
  },
48
49
  "devDependencies": {
49
- "@lynx-js/types": "3.6.0",
50
+ "@lynx-js/types": "3.7.0",
50
51
  "rsbuild-plugin-publint": "0.3.4",
51
- "@lynx-js/react": "0.116.2"
52
+ "@lynx-js/react": "0.116.3"
52
53
  },
53
54
  "peerDependencies": {
54
55
  "@lynx-js/react": "*",