@labelbee/lb-components 1.2.3-alpha.2 → 1.2.3-alpha.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.
@@ -1 +1 @@
1
- "use strict";var React=require("react");const useRafState=t=>{const e=React.useRef(0),[a,r]=React.useState(t),n=React.useCallback(c=>{cancelAnimationFrame(e.current),e.current=requestAnimationFrame(()=>{r(c)})},[]);return React.useEffect(()=>()=>cancelAnimationFrame(e.current),[]),[a,n]};module.exports=useRafState;
1
+ "use strict";var React=require("react");const useRafState=t=>{const e=React.useRef(0),[a,r]=React.useState(t),n=React.useCallback(c=>{!cancelAnimationFrame||!requestAnimationFrame||(cancelAnimationFrame(e.current),e.current=requestAnimationFrame(()=>{r(c)}))},[]);return React.useEffect(()=>{if(!!cancelAnimationFrame)return()=>cancelAnimationFrame(e.current)},[]),[a,n]};module.exports=useRafState;
@@ -1 +1 @@
1
- import{useRef as s,useState as u,useCallback as o,useEffect as m}from"react";const f=t=>{const e=s(0),[a,r]=u(t),n=o(c=>{cancelAnimationFrame(e.current),e.current=requestAnimationFrame(()=>{r(c)})},[]);return m(()=>()=>cancelAnimationFrame(e.current),[]),[a,n]};export{f as default};
1
+ import{useRef as i,useState as m,useCallback as s,useEffect as u}from"react";const o=t=>{const e=i(0),[a,n]=m(t),r=s(c=>{!cancelAnimationFrame||!requestAnimationFrame||(cancelAnimationFrame(e.current),e.current=requestAnimationFrame(()=>{n(c)}))},[]);return u(()=>{if(!!cancelAnimationFrame)return()=>cancelAnimationFrame(e.current)},[]),[a,r]};export{o as default};
@@ -1 +1 @@
1
- {"version":3,"file":"useRafState.js","sources":["../../src/hooks/useRafState.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from 'react';\nimport { useCallback, useRef, useState, useEffect } from 'react';\n\nconst useRafState = <S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>] => {\n const frame = useRef(0);\n const [state, setState] = useState(initialState);\n\n const setRafState = useCallback((value: S | ((prevState: S) => S)) => {\n cancelAnimationFrame(frame.current);\n\n frame.current = requestAnimationFrame(() => {\n setState(value);\n });\n }, []);\n\n useEffect(() => {\n return () => cancelAnimationFrame(frame.current);\n }, [])\n\n return [state, setRafState];\n};\n\nexport default useRafState;"],"names":[],"mappings":";;MAGM,cAAc,CAAI,iBAAkE;AACxF,QAAM,QAAQ,OAAO;AACrB,QAAM,CAAC,OAAO,YAAY,SAAS;AAEnC,QAAM,cAAc,YAAY,CAAC,UAAqC;AACpE,yBAAqB,MAAM;AAE3B,UAAM,UAAU,sBAAsB,MAAM;AAC1C,eAAS;AAAA;AAAA,KAEV;AAEH,YAAU,MAAM;AACd,WAAO,MAAM,qBAAqB,MAAM;AAAA,KACvC;AAEH,SAAO,CAAC,OAAO;AAAA;;;;"}
1
+ {"version":3,"file":"useRafState.js","sources":["../../src/hooks/useRafState.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from 'react';\nimport { useCallback, useRef, useState, useEffect } from 'react';\n\nconst useRafState = <S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>] => {\n const frame = useRef(0);\n const [state, setState] = useState(initialState);\n\n const setRafState = useCallback((value: S | ((prevState: S) => S)) => {\n if (!cancelAnimationFrame || !requestAnimationFrame) {\n return;\n }\n\n cancelAnimationFrame(frame.current);\n\n frame.current = requestAnimationFrame(() => {\n setState(value);\n });\n }, []);\n\n useEffect(() => {\n if (!cancelAnimationFrame) {\n return;\n }\n\n return () => cancelAnimationFrame(frame.current);\n }, []);\n\n return [state, setRafState];\n};\n\nexport default useRafState;\n"],"names":[],"mappings":";;MAGM,cAAc,CAAI,iBAAkE;AACxF,QAAM,QAAQ,OAAO;AACrB,QAAM,CAAC,OAAO,YAAY,SAAS;AAEnC,QAAM,cAAc,YAAY,CAAC,UAAqC;AACpE,QAAI,CAAC,wBAAwB,CAAC,uBAAuB;AACnD;AAAA;AAGF,yBAAqB,MAAM;AAE3B,UAAM,UAAU,sBAAsB,MAAM;AAC1C,eAAS;AAAA;AAAA,KAEV;AAEH,YAAU,MAAM;AACd,QAAI,CAAC,sBAAsB;AACzB;AAAA;AAGF,WAAO,MAAM,qBAAqB,MAAM;AAAA,KACvC;AAEH,SAAO,CAAC,OAAO;AAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.2.3-alpha.2",
3
+ "version": "1.2.3-alpha.3",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -42,7 +42,7 @@
42
42
  "email": "brady_luo.sz@foxmail.com"
43
43
  },
44
44
  "dependencies": {
45
- "@labelbee/lb-annotation": "1.5.4-alpha.2",
45
+ "@labelbee/lb-annotation": "1.5.4-alpha.3",
46
46
  "@ant-design/icons": "^4.6.2",
47
47
  "classnames": "^2.3.0",
48
48
  "@labelbee/lb-utils": "^1.0.3",