@infinityfx/lively 4.0.0-beta.3 → 4.0.0-beta.4

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/animate.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{__rest as i}from"tslib";import{jsx as r,Fragment as t}from"react/jsx-runtime";import{Children as n,isValidElement as e,cloneElement as o}from"react";import m from"./animatable.js";import a from"./animations/move.js";import s from"./animations/pop.js";function l(l){var{children:p,animations:c=[a,s],levels:f=2}=l,h=i(l,["children","animations","levels"]);return r(t,{children:function i(t,a=f){let s,l=f-a;for(;!(s=c[l])&&l>=0;)l--;return a<1||n.count(t)<1?t:r(m,Object.assign({},h,{animate:s,inherit:a<f||h.inherit,children:n.map(t,(r=>e(r)?o(r,{},i(r.props.children,a-1)):r))}))}(p)})}l.isLively=!0;export{l as default};
2
+ import{__rest as i}from"tslib";import{jsx as r,Fragment as t}from"react/jsx-runtime";import{Children as e,isValidElement as n,cloneElement as a}from"react";import o from"./animatable.js";function l(l){var{children:m,animations:p=[{translate:["0px 16px","0px 0px"],opacity:[0,1],duration:.35}],levels:s=2}=l,c=i(l,["children","animations","levels"]);return r(t,{children:function i(t,l=s){let m,f=s-l;for(;!(m=p[f])&&f>=0;)f--;return l<1||e.count(t)<1?t:r(o,Object.assign({},c,{animate:m,inherit:l<s||c.inherit,children:e.map(t,(r=>n(r)?a(r,{},i(r.props.children,l-1)):r))}))}(m)})}l.isLively=!0;export{l as default};
3
3
  //# sourceMappingURL=animate.js.map
@@ -1,2 +1,2 @@
1
- import{useRef as t,useCallback as r}from"react";function n(){const n=t(null);return[r((t=>(r,e)=>{if(!n.current)return t([0,0],e);const u=n.current.getTotalLength()*r,{x:o,y:c}=n.current.getPointAtLength(u);return t([o,c],e)}),[n]),n]}export{n as default};
1
+ import{useRef as t,useCallback as r}from"react";function n(){const n=t(null),e=r((t=>(r,e)=>{if(!n.current)return t([0,0],e);const u=n.current.getTotalLength()*r,{x:o,y:c}=n.current.getPointAtLength(u);return t([o,c],e)}),[n]);return[n,e]}export{n as default};
2
2
  //# sourceMappingURL=use-path.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-path.js","sources":["../../src/hooks/use-path.ts"],"sourcesContent":[null],"names":["usePath","ref","useRef","useCallback","transform","progress","index","current","len","getTotalLength","x","y","getPointAtLength"],"mappings":"gDAEc,SAAUA,IACpB,MAAMC,EAAMC,EAAU,MAatB,MAAO,CAXMC,GAAaC,GACf,CAACC,EAAkBC,KACtB,IAAKL,EAAIM,QAAS,OAAOH,EAAU,CAAC,EAAG,GAAIE,GAE3C,MAAME,EAAMP,EAAIM,QAAQE,iBAAmBJ,GACrCK,EAAEA,EAACC,EAAEA,GAAMV,EAAIM,QAAQK,iBAAiBJ,GAE9C,OAAOJ,EAAU,CAACM,EAAGC,GAAIL,EAAM,GAEpC,CAACL,IAEUA,EAClB"}
1
+ {"version":3,"file":"use-path.js","sources":["../../src/hooks/use-path.ts"],"sourcesContent":[null],"names":["usePath","ref","useRef","link","useCallback","transform","progress","index","current","len","getTotalLength","x","y","getPointAtLength"],"mappings":"gDAEc,SAAUA,IACpB,MAAMC,EAAMC,EAAU,MAEhBC,EAAOC,GAAaC,GACf,CAACC,EAAkBC,KACtB,IAAKN,EAAIO,QAAS,OAAOH,EAAU,CAAC,EAAG,GAAIE,GAE3C,MAAME,EAAMR,EAAIO,QAAQE,iBAAmBJ,GACrCK,EAAEA,EAACC,EAAEA,GAAMX,EAAIO,QAAQK,iBAAiBJ,GAE9C,OAAOJ,EAAU,CAACM,EAAGC,GAAIL,EAAM,GAEpC,CAACN,IAEJ,MAAO,CAACA,EAAKE,EACjB"}
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{useRef as e}from"react";import n from"./use-link.js";import t from"./use-mount-effect.js";function r(r=.5){const i=e(null),o=n([-1,-1]);return t((()=>{function e(){if(!i.current)return;const{x:e,y:n,width:t,height:s}=i.current.getBoundingClientRect();o.set([(e+t*r)/(window.innerWidth+2*t*(r-.5)),(n+s*r)/(window.innerHeight+2*s*(r-.5))])}return e(),window.addEventListener("scroll",e),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}}),[r]),[o,i]}export{r as default};
2
+ import{useRef as e}from"react";import n from"./use-link.js";import t from"./use-mount-effect.js";function r(r=.5){const i=e(null),o=n([-1,-1]);return t((()=>{function e(){if(!i.current)return;const{x:e,y:n,width:t,height:s}=i.current.getBoundingClientRect();o.set([(e+t*r)/(window.innerWidth+2*t*(r-.5)),(n+s*r)/(window.innerHeight+2*s*(r-.5))])}return e(),window.addEventListener("scroll",e),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}}),[r]),[i,o]}export{r as default};
3
3
  //# sourceMappingURL=use-viewport.js.map
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{useRef as e,useEffect as r}from"react";import t from"./use-trigger.js";import s from"./use-viewport.js";function i({enter:i=1,exit:n=!1,threshold:u=.5}={}){const[o,c]=s(u),b=e({visible:!1,enters:!0===i?1/0:+i,exits:!0===n?1/0:+n}),f=t();return r((()=>{function e(){const[e,r]=o(),t=e>0&&e<1&&r>0&&r<1,{visible:s,enters:i,exits:n}=b.current;!s&&t&&i&&(b.current.enters--,f()),s&&!t&&n&&(b.current.exits--,f()),b.current.visible=t}return e(),o.subscribe(e),()=>o.unsubscribe(e)}),[]),[f,c]}export{i as default};
2
+ import{useRef as r,useEffect as e}from"react";import t from"./use-trigger.js";import n from"./use-viewport.js";function o({enter:o=1,exit:u=!1,threshold:c=.5}={}){const[s,i]=n(c),f=r(!1),l=t(),m=t();return e((()=>{function r(){const[r,e]=i(),t=r>0&&r<1&&e>0&&e<1;!f.current&&t&&l.called<(!0===o?1/0:+o)&&l(),f.current&&!t&&m.called<(!0===u?1/0:+u)&&m(),f.current=t}return r(),i.subscribe(r),()=>i.unsubscribe(r)}),[]),[s,l,m]}export{o as default};
3
3
  //# sourceMappingURL=use-visible.js.map
@@ -1,2 +1,2 @@
1
1
  /// <reference types="react" />
2
- export default function usePath<T extends SVGGeometryElement = any>(): [(transform: (value: [number, number], index: number) => any) => (progress: number, index: number) => any, React.Ref<T>];
2
+ export default function usePath<T extends SVGGeometryElement = any>(): [React.Ref<T>, (transform: (value: [number, number], index: number) => any) => (progress: number, index: number) => any];
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { Link } from "../core/link";
3
- export default function useViewport<T extends Element = any>(threshold?: number): [Link<[number, number]>, React.Ref<T>];
3
+ export default function useViewport<T extends Element = any>(threshold?: number): [React.Ref<T>, Link<[number, number]>];
@@ -4,4 +4,4 @@ export default function useVisible<T extends Element = any>({ enter, exit, thres
4
4
  enter?: boolean | number;
5
5
  exit?: boolean | number;
6
6
  threshold?: number;
7
- }): [Trigger, React.Ref<T>];
7
+ }): [React.Ref<T>, Trigger, Trigger];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infinityfx/lively",
3
- "version": "4.0.0-beta.3",
3
+ "version": "4.0.0-beta.4",
4
4
  "type": "module",
5
5
  "description": "Feature complete, lightweight react animation library.",
6
6
  "main": "dist/index.js",
@@ -8,15 +8,11 @@
8
8
  "types": "dist/types/index.d.ts",
9
9
  "exports": {
10
10
  ".": "./dist/index.js",
11
- "./animations": "./dist/animations.js",
12
11
  "./hooks": "./dist/hooks.js",
13
12
  "./layout": "./dist/layout.js"
14
13
  },
15
14
  "typesVersions": {
16
15
  "*": {
17
- "animations": [
18
- "./dist/types/animations.d.ts"
19
- ],
20
16
  "hooks": [
21
17
  "./dist/types/hooks.d.ts"
22
18
  ],
@@ -1,2 +0,0 @@
1
- import o from"../core/clip.js";const t=new o({opacity:1,duration:.65},{opacity:0});export{t as default};
2
- //# sourceMappingURL=fade.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fade.js","sources":["../../src/animations/fade.ts"],"sourcesContent":[null],"names":["Fade","Clip","opacity","duration"],"mappings":"+BAEA,MAAMA,EAAO,IAAIC,EAAK,CAClBC,QAAS,EACTC,SAAU,KACX,CACCD,QAAS"}
@@ -1,2 +0,0 @@
1
- import t from"../core/clip.js";const a=new t({opacity:1,translate:"0px 0px",duration:.5},{opacity:0,translate:"0px 20px"});export{a as default};
2
- //# sourceMappingURL=move.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"move.js","sources":["../../src/animations/move.ts"],"sourcesContent":[null],"names":["Move","Clip","opacity","translate","duration"],"mappings":"+BAEA,MAAMA,EAAO,IAAIC,EAAK,CAClBC,QAAS,EACTC,UAAW,UACXC,SAAU,IACX,CACCF,QAAS,EACTC,UAAW"}
@@ -1,2 +0,0 @@
1
- import o from"../core/clip.js";const a=new o({opacity:1,scale:1,duration:.25},{opacity:0,scale:.85});export{a as default};
2
- //# sourceMappingURL=pop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pop.js","sources":["../../src/animations/pop.ts"],"sourcesContent":[null],"names":["Pop","Clip","opacity","scale","duration"],"mappings":"+BAEA,MAAMA,EAAM,IAAIC,EAAK,CACjBC,QAAS,EACTC,MAAO,EACPC,SAAU,KACX,CACCF,QAAS,EACTC,MAAO"}
@@ -1,2 +0,0 @@
1
- import e from"../core/clip.js";const r=new e({scale:1},{transformOrigin:"left",scale:"0 1"});export{r as default};
2
- //# sourceMappingURL=scale.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scale.js","sources":["../../src/animations/scale.ts"],"sourcesContent":[null],"names":["Scale","Clip","scale","transformOrigin"],"mappings":"+BAEA,MAAMA,EAAQ,IAAIC,EAAK,CACnBC,MAAO,GACR,CACCC,gBAAiB,OACjBD,MAAO"}
@@ -1,2 +0,0 @@
1
- import t from"../core/clip.js";const e=new t({clipPath:"inset(0% 0% 0% 0%)"},{clipPath:"inset(0% 100% 0% 0%)"});export{e as default};
2
- //# sourceMappingURL=wipe.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wipe.js","sources":["../../src/animations/wipe.ts"],"sourcesContent":[null],"names":["Wipe","Clip","clipPath"],"mappings":"+BAEA,MAAMA,EAAO,IAAIC,EAAK,CAClBC,SAAU,sBACX,CACCA,SAAU"}
@@ -1,2 +0,0 @@
1
- export{default as Fade}from"./animations/fade.js";export{default as Move}from"./animations/move.js";export{default as Pop}from"./animations/pop.js";export{default as Scale}from"./animations/scale.js";export{default as Wipe}from"./animations/wipe.js";export{default as Clip}from"./core/clip.js";
2
- //# sourceMappingURL=animations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"animations.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- import Clip from "../core/clip";
2
- declare const Fade: Clip;
3
- export default Fade;
@@ -1,3 +0,0 @@
1
- import Clip from "../core/clip";
2
- declare const Move: Clip;
3
- export default Move;
@@ -1,3 +0,0 @@
1
- import Clip from "../core/clip";
2
- declare const Pop: Clip;
3
- export default Pop;
@@ -1,3 +0,0 @@
1
- import Clip from "../core/clip";
2
- declare const Scale: Clip;
3
- export default Scale;
@@ -1,3 +0,0 @@
1
- import Clip from "../core/clip";
2
- declare const Wipe: Clip;
3
- export default Wipe;
@@ -1,7 +0,0 @@
1
- import Fade from "./animations/fade";
2
- import Move from "./animations/move";
3
- import Pop from "./animations/pop";
4
- import Scale from "./animations/scale";
5
- import Wipe from "./animations/wipe";
6
- import Clip from "./core/clip";
7
- export { Fade, Move, Pop, Scale, Wipe, Clip };