@e1011/es-kit 1.1.62 → 1.1.66
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/dist/hooks/esm/index.css +362 -362
- package/dist/hooks/esm/src/core/hooks/useAnimation.js +1 -1
- package/dist/hooks/esm/src/core/hooks/useAnimation.js.map +1 -1
- package/dist/hooks/index.css +362 -362
- package/dist/hooks/src/core/hooks/useAnimation.js +1 -1
- package/dist/hooks/src/core/hooks/useAnimation.js.map +1 -1
- package/dist/lib/cjs/index.css +3 -3
- package/dist/lib/cjs/src/core/hooks/useAnimation.js +1 -1
- package/dist/lib/cjs/src/core/hooks/useAnimation.js.map +1 -1
- package/dist/lib/cjs/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -1
- package/dist/lib/esm/index.css +3 -3
- package/dist/lib/esm/src/core/hooks/useAnimation.js +1 -1
- package/dist/lib/esm/src/core/hooks/useAnimation.js.map +1 -1
- package/dist/lib/esm/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/core/hooks/useAnimation.d.ts +4 -3
- package/dist/types/src/core/hooks/useAnimation.d.ts.map +1 -1
- package/dist/types/src/core/ui/components/atoms/animatedSnippet/AnimatedSnippet.d.ts +5 -0
- package/dist/types/src/core/ui/components/atoms/animatedSnippet/AnimatedSnippet.d.ts.map +1 -0
- package/dist/types/src/core/ui/components/atoms/animatedSnippet/animatedSnippet.stories.d.ts +5 -0
- package/dist/types/src/core/ui/components/atoms/animatedSnippet/animatedSnippet.stories.d.ts.map +1 -0
- package/dist/types/src/core/ui/types/CommonProps.d.ts +1 -0
- package/dist/types/src/core/ui/types/CommonProps.d.ts.map +1 -1
- package/dist/types/src/core/utils/appState/peregrineMQ/peregrineMQ.d.ts.map +1 -1
- package/dist/types/src/core/utils/appState/stateMachine/tiny-state-machine.base.d.ts +1 -1
- package/dist/ui/esm/index.css +3 -3
- package/dist/ui/index.css +3 -3
- package/dist/utils/esm/index.css +362 -362
- package/dist/utils/esm/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -1
- package/dist/utils/index.css +362 -362
- package/dist/utils/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -1
- package/package.json +10 -10
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{gsap as
|
|
1
|
+
import{gsap as e}from"../../../node_modules/gsap/index.js";import{useState as r,useRef as t,useEffect as o,useLayoutEffect as n}from"react";const a=a=>{let{start:s=0,end:d,duration:u=2,ease:l="expo.inOut",rounded:p,roundingFn:v}=a;const[c,i]=r(d),m=t(s);return o((()=>{m.current=c}),[c]),n((()=>{const r={val:m.current},t=e.context((()=>{e.to(r,u,{val:d,ease:l,duration:u,...p?{roundProps:"val"}:{},onUpdate(){i(v?v(r.val):r.val)},onComplete(){i(v?v(r.val):r.val)}})}));return()=>t.revert()}),[u,l,d,p,v,s]),c};export{a as useAnimation};
|
|
2
2
|
//# sourceMappingURL=useAnimation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnimation.js","sources":["../../../../../../src/core/hooks/useAnimation.ts"],"sourcesContent":["import gsap from 'gsap'\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react'\n\n/**\n * Type definition for the parameters used in the `useAnimation` hook.\n * @typedef {Object} UseAnimationType\n * @property {number} start - The starting value of the animation.\n * @property {number} end - The ending value of the animation.\n * @property {number} duration - The duration of the animation in seconds.\n * @property {string} [ease='expo.inOut'] - The easing function for the animation.\n * @property {boolean} [rounded] - Flag to determine if the value should be rounded during the animation.\n */\nexport type UseAnimationType = {\n start
|
|
1
|
+
{"version":3,"file":"useAnimation.js","sources":["../../../../../../src/core/hooks/useAnimation.ts"],"sourcesContent":["import gsap from 'gsap'\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react'\n\n/**\n * Type definition for the parameters used in the `useAnimation` hook.\n * @typedef {Object} UseAnimationType\n * @property {number} start - The starting value of the animation.\n * @property {number} end - The ending value of the animation.\n * @property {number} duration - The duration of the animation in seconds.\n * @property {string} [ease='expo.inOut'] - The easing function for the animation.\n * @property {boolean} [rounded] - Flag to determine if the value should be rounded during the animation.\n */\nexport type UseAnimationType = {\n start?: number\n end: number\n duration?: number\n ease?: string\n rounded?: boolean\n roundingFn?: (value: number | string) => number | string\n}\n\n/**\n * Custom hook to create an animation using GSAP.\n * @param {UseAnimationType} params - The parameters for the animation.\n * @returns {number} The current value of the animation.\n */\nexport const useAnimation = ({\n start = 0,\n end,\n duration = 2,\n ease = 'expo.inOut',\n rounded,\n roundingFn,\n}: UseAnimationType): number | string => {\n const [val, setVal] = useState<number | string>(end)\n\n const startValueRef = useRef<number | string>(start)\n\n useEffect(() => {\n startValueRef.current = val\n }, [val])\n\n useLayoutEffect(() => {\n const valObj = { val: startValueRef.current }\n\n const gsapCtx = gsap.context(() => {\n gsap.to(valObj, duration, {\n val: end,\n ease,\n duration,\n ...(rounded ? { roundProps: 'val' } : {}),\n onUpdate () {\n setVal(roundingFn ? roundingFn(valObj.val) : valObj.val)\n },\n onComplete () {\n setVal(roundingFn ? roundingFn(valObj.val) : valObj.val)\n },\n })\n })\n\n return (): void => gsapCtx.revert()\n }, [duration, ease, end, rounded, roundingFn, start])\n\n return val\n}\n"],"names":["useAnimation","_ref","start","end","duration","ease","rounded","roundingFn","val","setVal","useState","startValueRef","useRef","useEffect","current","useLayoutEffect","valObj","gsapCtx","gsap","context","to","roundProps","onUpdate","onComplete","revert"],"mappings":"4IA0BaA,MAAAA,EAAeC,IAOa,IAPZC,MAC3BA,EAAQ,EAACC,IACTA,EAAGC,SACHA,EAAW,EAACC,KACZA,EAAO,aAAYC,QACnBA,EAAOC,WACPA,GACiBN,EACjB,MAAOO,EAAKC,GAAUC,EAA0BP,GAE1CQ,EAAgBC,EAAwBV,GA2B9C,OAzBAW,GAAU,KACRF,EAAcG,QAAUN,CAAG,GAC1B,CAACA,IAEJO,GAAgB,KACd,MAAMC,EAAS,CAAER,IAAKG,EAAcG,SAE9BG,EAAUC,EAAKC,SAAQ,KAC3BD,EAAKE,GAAGJ,EAAQZ,EAAU,CACxBI,IAAKL,EACLE,OACAD,cACIE,EAAU,CAAEe,WAAY,OAAU,GACtCC,QAAAA,GACEb,EAAOF,EAAaA,EAAWS,EAAOR,KAAOQ,EAAOR,IACrD,EACDe,UAAAA,GACEd,EAAOF,EAAaA,EAAWS,EAAOR,KAAOQ,EAAOR,IACtD,GACA,IAGJ,MAAO,IAAYS,EAAQO,QAAQ,GAClC,CAACpB,EAAUC,EAAMF,EAAKG,EAASC,EAAYL,IAEvCM,CAAG"}
|