@infinityfx/lively 4.0.10 → 5.0.0-alpha.0

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.
Files changed (89) hide show
  1. package/dist/animate.js +1 -1
  2. package/dist/animations/text-animation.js +3 -0
  3. package/dist/animations/text-animation.js.map +1 -0
  4. package/dist/animations/view-animation.js +3 -0
  5. package/dist/animations/view-animation.js.map +1 -0
  6. package/dist/animations.js +2 -0
  7. package/dist/animations.js.map +1 -0
  8. package/dist/core/animation-link.js +2 -0
  9. package/dist/core/animation-link.js.map +1 -0
  10. package/dist/core/animator.js +2 -0
  11. package/dist/core/animator.js.map +1 -0
  12. package/dist/core/clip.js +1 -1
  13. package/dist/core/clip.js.map +1 -1
  14. package/dist/core/state.js +2 -0
  15. package/dist/core/state.js.map +1 -0
  16. package/dist/core/track.js +1 -1
  17. package/dist/core/track.js.map +1 -1
  18. package/dist/core/utils.js +1 -1
  19. package/dist/core/utils.js.map +1 -1
  20. package/dist/hooks/use-audio.js +1 -1
  21. package/dist/hooks/use-hover.js +3 -0
  22. package/dist/hooks/use-hover.js.map +1 -0
  23. package/dist/hooks/use-link.js +2 -1
  24. package/dist/hooks/use-link.js.map +1 -1
  25. package/dist/hooks/use-scroll.js +1 -1
  26. package/dist/hooks/use-spring.js +2 -1
  27. package/dist/hooks/use-spring.js.map +1 -1
  28. package/dist/hooks/use-tap.js +3 -0
  29. package/dist/hooks/use-tap.js.map +1 -0
  30. package/dist/hooks/use-viewport.js +1 -1
  31. package/dist/hooks/use-visible.js +1 -1
  32. package/dist/hooks.js +1 -1
  33. package/dist/index.js +1 -1
  34. package/dist/layout-group.js +3 -0
  35. package/dist/types/animate.d.ts +31 -19
  36. package/dist/types/animations/text-animation.d.ts +5 -0
  37. package/dist/types/animations/view-animation.d.ts +9 -0
  38. package/dist/types/animations.d.ts +3 -0
  39. package/dist/types/core/animation-link.d.ts +19 -0
  40. package/dist/types/core/animator.d.ts +75 -0
  41. package/dist/types/core/clip.d.ts +32 -35
  42. package/dist/types/core/state.d.ts +16 -0
  43. package/dist/types/core/track.d.ts +30 -22
  44. package/dist/types/core/utils.d.ts +891 -35
  45. package/dist/types/hooks/use-audio.d.ts +1 -2
  46. package/dist/types/hooks/use-hover.d.ts +1 -0
  47. package/dist/types/hooks/use-link.d.ts +3 -1
  48. package/dist/types/hooks/use-scroll.d.ts +4 -6
  49. package/dist/types/hooks/use-spring.d.ts +9 -6
  50. package/dist/types/hooks/use-tap.d.ts +1 -0
  51. package/dist/types/hooks/use-viewport.d.ts +7 -2
  52. package/dist/types/hooks/use-visible.d.ts +1 -6
  53. package/dist/types/hooks.d.ts +5 -5
  54. package/dist/types/index.d.ts +5 -3
  55. package/dist/types/layout-group.d.ts +7 -0
  56. package/package.json +17 -17
  57. package/dist/animatable.js +0 -3
  58. package/dist/animatable.js.map +0 -1
  59. package/dist/core/action.js +0 -2
  60. package/dist/core/action.js.map +0 -1
  61. package/dist/core/cache.js +0 -2
  62. package/dist/core/cache.js.map +0 -1
  63. package/dist/core/link.js +0 -2
  64. package/dist/core/link.js.map +0 -1
  65. package/dist/core/timeline.js +0 -2
  66. package/dist/core/timeline.js.map +0 -1
  67. package/dist/hooks/use-path.js +0 -2
  68. package/dist/hooks/use-path.js.map +0 -1
  69. package/dist/hooks/use-trigger.js +0 -3
  70. package/dist/hooks/use-trigger.js.map +0 -1
  71. package/dist/layout/layout-group.js +0 -3
  72. package/dist/layout/morph.js +0 -3
  73. package/dist/layout/morph.js.map +0 -1
  74. package/dist/layout/typable.js +0 -3
  75. package/dist/layout/typable.js.map +0 -1
  76. package/dist/layout.js +0 -2
  77. package/dist/layout.js.map +0 -1
  78. package/dist/types/animatable.d.ts +0 -112
  79. package/dist/types/core/action.d.ts +0 -15
  80. package/dist/types/core/cache.d.ts +0 -23
  81. package/dist/types/core/link.d.ts +0 -14
  82. package/dist/types/core/timeline.d.ts +0 -41
  83. package/dist/types/hooks/use-path.d.ts +0 -1
  84. package/dist/types/hooks/use-trigger.d.ts +0 -4
  85. package/dist/types/layout/layout-group.d.ts +0 -16
  86. package/dist/types/layout/morph.d.ts +0 -24
  87. package/dist/types/layout/typable.d.ts +0 -11
  88. package/dist/types/layout.d.ts +0 -4
  89. /package/dist/{layout/layout-group.js.map → layout-group.js.map} +0 -0
@@ -1,7 +1,6 @@
1
- import { Link } from "../core/link";
2
1
  export default function useAudio({ bands, minFrequency, maxFrequency, smoothing }?: {
3
2
  bands?: number | undefined;
4
3
  minFrequency?: number | undefined;
5
4
  maxFrequency?: number | undefined;
6
5
  smoothing?: number | undefined;
7
- }): [React.RefObject<HTMLAudioElement | null>, Link<number[]>];
6
+ }): readonly [import("react").RefObject<HTMLAudioElement | null>, import("..").AnimationLink<number[], number[]>];
@@ -0,0 +1 @@
1
+ export default function useHover<T extends HTMLElement = any>(): readonly [import("react").RefObject<T | null>, boolean];
@@ -1 +1,3 @@
1
- export default function useLink<T = any>(initial: T): import("../core/link").Link<T>;
1
+ import AnimationLink from "../core/animation-link";
2
+ export default function useLink<T>(initial: T): AnimationLink<T>;
3
+ export default function useLink<T, K = T>(initial: AnimationLink<T>, transform: (value: T, index: number) => K): AnimationLink<K>;
@@ -1,9 +1,7 @@
1
- export default function useScroll<T extends HTMLElement>({ restore, target }?: {
2
- restore?: number;
3
- target?: React.RefObject<T>;
4
- }): import("../core/link").Link<{
1
+ export default function useScroll<T extends HTMLElement>(target?: React.RefObject<T>): import("..").AnimationLink<{
2
+ x: number;
3
+ y: number;
4
+ }, {
5
5
  x: number;
6
6
  y: number;
7
- top: number;
8
- left: number;
9
7
  }>;
@@ -1,6 +1,9 @@
1
- export default function useSpring<T extends number | number[]>(initial: T, { stiffness, damping, mass, restThreshold }?: {
2
- stiffness?: number | undefined;
3
- damping?: number | undefined;
4
- mass?: number | undefined;
5
- restThreshold?: number | undefined;
6
- }): import("../core/link").Link<T>;
1
+ import AnimationLink from "../core/animation-link";
2
+ type SpringOptions = {
3
+ stiffness?: number;
4
+ damping?: number;
5
+ mass?: number;
6
+ };
7
+ export default function useSpring(initial: number, options?: SpringOptions): AnimationLink<number>;
8
+ export default function useSpring(initial: number[], options?: SpringOptions): AnimationLink<number[]>;
9
+ export {};
@@ -0,0 +1 @@
1
+ export default function useTap<T extends HTMLElement = any>(): readonly [import("react").RefObject<T | null>, boolean];
@@ -1,2 +1,7 @@
1
- import { Link } from "../core/link";
2
- export default function useViewport<T extends Element = any>(threshold?: number): [React.Ref<T>, Link<[number, number]>];
1
+ export default function useViewport<T extends Element = any>(threshold?: number): readonly [import("react").RefObject<T | null>, import("..").AnimationLink<{
2
+ x: number;
3
+ y: number;
4
+ }, {
5
+ x: number;
6
+ y: number;
7
+ }>];
@@ -1,6 +1 @@
1
- import { Trigger } from "./use-trigger";
2
- export default function useVisible<T extends Element = any>({ enter, exit, threshold }?: {
3
- enter?: boolean | number;
4
- exit?: boolean | number;
5
- threshold?: number;
6
- }): [React.Ref<T>, Trigger, Trigger];
1
+ export default function useVisible<T extends Element = any>(threshold?: number): readonly [import("react").RefObject<T | null>, number, number];
@@ -1,10 +1,10 @@
1
1
  import useLink from "./hooks/use-link";
2
- import useTrigger from "./hooks/use-trigger";
3
- import useReducedMotion from "./hooks/use-reduced-motion";
4
- import useScroll from "./hooks/use-scroll";
5
- import usePath from "./hooks/use-path";
2
+ import useHover from "./hooks/use-hover";
3
+ import useTap from "./hooks/use-tap";
6
4
  import useViewport from "./hooks/use-viewport";
7
5
  import useVisible from "./hooks/use-visible";
6
+ import useScroll from "./hooks/use-scroll";
7
+ import useReducedMotion from "./hooks/use-reduced-motion";
8
8
  import useAudio from "./hooks/use-audio";
9
9
  import useSpring from "./hooks/use-spring";
10
- export { useLink, useTrigger, useReducedMotion, useScroll, usePath, useViewport, useVisible, useAudio, useSpring };
10
+ export { useLink, useHover, useTap, useViewport, useVisible, useScroll, useReducedMotion, useAudio, useSpring };
@@ -1,4 +1,6 @@
1
- import Animatable from "./animatable";
2
1
  import Animate from "./animate";
3
- export { type AnimatableType } from "./animatable";
4
- export { Animatable, Animate };
2
+ import LayoutGroup from "./layout-group";
3
+ import Clip from "./core/clip";
4
+ import type AnimationLink from "./core/animation-link";
5
+ import type Animator from "./core/animator";
6
+ export { Animate, LayoutGroup, Clip, AnimationLink, Animator };
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ export declare const LayoutGroupContext: React.Context<string>;
3
+ export default function LayoutGroup({ children, skipInitialMount, mode }: {
4
+ children: React.ReactNode;
5
+ skipInitialMount?: boolean;
6
+ mode?: 'wait' | 'swap';
7
+ }): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infinityfx/lively",
3
- "version": "4.0.10",
3
+ "version": "5.0.0-alpha.0",
4
4
  "type": "module",
5
5
  "description": "Feature complete, lightweight react animation library.",
6
6
  "main": "dist/index.js",
@@ -15,9 +15,9 @@
15
15
  "types": "./dist/types/hooks.d.ts",
16
16
  "default": "./dist/hooks.js"
17
17
  },
18
- "./layout": {
19
- "types": "./dist/types/layout.d.ts",
20
- "default": "./dist/layout.js"
18
+ "./animations": {
19
+ "types": "./dist/types/animations.d.ts",
20
+ "default": "./dist/animations.js"
21
21
  }
22
22
  },
23
23
  "typesVersions": {
@@ -25,8 +25,8 @@
25
25
  "hooks": [
26
26
  "./dist/types/hooks.d.ts"
27
27
  ],
28
- "layout": [
29
- "./dist/types/layout.d.ts"
28
+ "animations": [
29
+ "./dist/types/animations.d.ts"
30
30
  ]
31
31
  }
32
32
  },
@@ -52,25 +52,25 @@
52
52
  "watch": "rollup -c -w"
53
53
  },
54
54
  "dependencies": {
55
- "tslib": "^2.6.3"
55
+ "tslib": "^2.8.1"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "react": ">=19.0.0",
59
59
  "react-dom": ">=19.0.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@rollup/plugin-commonjs": "^26.0.1",
63
- "@rollup/plugin-node-resolve": "^15.2.3",
62
+ "@rollup/plugin-commonjs": "^29.0.0",
63
+ "@rollup/plugin-node-resolve": "^16.0.3",
64
64
  "@rollup/plugin-terser": "^0.4.4",
65
- "@rollup/plugin-typescript": "^11.1.6",
66
- "@types/react": "^19.0.0",
67
- "@types/react-dom": "^19.0.0",
68
- "react": "^19.0.0",
69
- "react-dom": "^19.0.0",
70
- "rollup": "^4.18.0",
71
- "rollup-plugin-delete": "^2.0.0",
65
+ "@rollup/plugin-typescript": "^12.3.0",
66
+ "@types/react": "^19.2.14",
67
+ "@types/react-dom": "^19.2.3",
68
+ "react": "^19.2.4",
69
+ "react-dom": "^19.2.4",
70
+ "rollup": "^4.59.0",
71
+ "rollup-plugin-delete": "^3.0.2",
72
72
  "rollup-plugin-preserve-directives": "^0.4.0",
73
- "typescript": "^5.5.2"
73
+ "typescript": "^5.9.3"
74
74
  },
75
75
  "sideEffects": false
76
76
  }
@@ -1,3 +0,0 @@
1
- "use client";
2
- import{jsx as e}from"react/jsx-runtime";import{createContext as r,useRef as n,use as t,useMemo as i,useCallback as a,useImperativeHandle as o,useEffect as s,useLayoutEffect as u,Children as c,isValidElement as d,cloneElement as m}from"react";import l from"./core/clip.js";import p from"./core/timeline.js";import{merge as f,pick as h,combineRefs as g}from"./core/utils.js";const v=r(null);function y(r){const y=n(null),b=n([]),x=t(v),w=r.inherit&&x?f({},r,h(x,["group","animations","triggers","animate","initial","stagger","staggerLimit","deform","disabled","paused"])):r,{id:L="",inherit:j,triggers:k=[],disabled:E,adaptive:z=!1,manual:A=!1,paused:C}=w,M=void 0!==r.order?r.order:(j&&void 0!==x?.index?x.index:-1)+1,D=n([]),O=i((()=>{const e={animate:l.from(w.animate,w.initial)};for(const r in w.animations)e[r]=l.from(w.animations[r],w.initial);return e}),[]),T=n(new p({...w,mountClips:k.reduce(((e,{name:r,on:n})=>("mount"===n&&e.push(O[r||"animate"]),e)),[])})),V=a(((e,n={},t=1)=>{const i=O[e];if(E||j&&t<2)return 0;f(n,{reverse:i?.reverse});let a=0,o=n.delay||0,s=i?T.current.time(i):0;for(const r of b.current)r.current?.inherit&&(a=Math.max(r.current.play(e,f({delay:o+s},n),t+1),a));const u=(n.reverse?a:o)*(M/t+1/t);return i&&T.current.add(i,f({delay:u},n)),r.onAnimationEnd&&setTimeout(r.onAnimationEnd.bind({},e),1e3*(s+u)),s+u}),[E,j,M]);function q(e,r={}){let n=0;for(const{name:t,on:i,...a}of k)i===e&&(n=Math.max(V(t||"animate",f(a,r)),n));return n}return o(g(y,r.ref),(()=>({play:V,trigger:q,timeline:T.current,children:b.current,inherit:j,adaptive:z,group:w.group,id:L})),[k]),s((()=>T.current.pause(!(!C&&!E))),[C,E]),s((()=>{for(let e=0;e<k.length;e++){let{name:r,on:n,...t}=k[e];if("string"==typeof n)continue;const i="boolean"==typeof n?n:n.called,a=D.current[e];void 0!==a&&i&&i!==a&&V(r||"animate",t),D.current[e]=i}}),[k]),u((()=>{const e=()=>T.current.cache();return T.current.link(w.animate),window.addEventListener("resize",e),x?.add(y),document.fonts.ready.then((()=>{A||T.current.mounted||q("mount"),T.current.mounted=!0})),()=>{window.removeEventListener("resize",e),T.current.unlink(),x?.remove(y)}}),[]),e(v,{value:{...r.passthrough?x:{index:M,...w},add:e=>{r.passthrough&&x?.add(e),b.current.includes(e)||b.current.push(e)},remove:e=>{r.passthrough&&x?.remove(e);const n=b.current.indexOf(e)||-1;n>=0&&b.current.splice(n,1)}},children:c.map(r.children,(e=>d(e)?m(e,{ref:g((e=>T.current.insert(e)),e.props.ref),pathLength:1,style:f({backfaceVisibility:"hidden",willChange:"transform"},e.props.style,O.animate.initial,{strokeDasharray:1}),"data-lively-offset-boundary":!(!["x","y"].some((e=>r.cachable?.includes(e)))&&void 0!==r.cachable)||void 0}):e))})}y.isLively=!0;export{v as AnimatableContext,y as default};
3
- //# sourceMappingURL=animatable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"animatable.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,2 +0,0 @@
1
- class i{constructor(i,t,s,n={}){this.commit=!0,this.onfinish=null,this.composite=s.composite,s.composite="combine"===s.composite?"accumulate":"replace",this.animation=i.element.animate(t,s),this.dynamic=n,this.track=i,this.animation.onfinish=this.finish.bind(this)}finish(){try{this.commit&&this.animation.commitStyles()}catch(i){}this.animation.cancel(),this.onfinish?.()}step(i){const t=this.animation.effect?.getComputedTiming().progress||0;for(const s in this.dynamic)this.track.apply(s,this.dynamic[s]?.call(this.track,t,i))}}export{i as default};
2
- //# sourceMappingURL=action.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action.js","sources":["../../src/core/action.ts"],"sourcesContent":[null],"names":["Action","constructor","track","keyframes","config","dynamic","this","commit","onfinish","composite","animation","element","animate","finish","bind","commitStyles","ex","cancel","step","index","progress","effect","getComputedTiming","prop","apply","call"],"mappings":"AAGc,MAAOA,EASjB,WAAAC,CAAYC,EAAcC,EAAkDC,EAAqFC,EAA6B,CAAA,GAN9LC,KAAMC,QAAY,EAIlBD,KAAQE,SAAwB,KAG5BF,KAAKG,UAAYL,EAAOK,UACvBL,EAAeK,UAAiC,YAArBL,EAAOK,UAA0B,aAAe,UAC5EH,KAAKI,UAAYR,EAAMS,QAAQC,QAAQT,EAAWC,GAClDE,KAAKD,QAAUA,EACfC,KAAKJ,MAAQA,EAEbI,KAAKI,UAAUF,SAAWF,KAAKO,OAAOC,KAAKR,KAC9C,CAED,MAAAO,GACI,IACQP,KAAKC,QAAQD,KAAKI,UAAUK,cACnC,CAAC,MAAOC,GAAM,CACfV,KAAKI,UAAUO,SAEfX,KAAKE,YACR,CAED,IAAAU,CAAKC,GACD,MAAMC,EAAWd,KAAKI,UAAUW,QAAQC,oBAAoBF,UAAY,EAExE,IAAK,MAAMG,KAAQjB,KAAKD,QACpBC,KAAKJ,MAAMsB,MAAMD,EAAMjB,KAAKD,QAAQkB,IAAkCE,KAAKnB,KAAKJ,MAAOkB,EAAUD,GAExG"}
@@ -1,2 +0,0 @@
1
- import e from"./clip.js";class t{constructor(e,t=["x","y","sx","sy","borderRadius","backgroundColor","color","rotate"]){this.element=e,this.include=t.map((e=>"strokeLength"===e?"strokeDashoffset":e)),this.computed=getComputedStyle(e),this.data=this.read()}read(){const e={};for(const t of this.include)e[t]=this.computed[t];if(this.element instanceof SVGElement)return e;e.sx=this.element.offsetWidth,e.sy=this.element.offsetHeight,e.x=e.sx/2,e.y=e.sy/2;let t=this.element;for(;t&&(e.x+=t.offsetLeft,e.y+=t.offsetTop,t=t.offsetParent,!t?.dataset.livelyOffsetBoundary););return e}update(){this.data=this.read()}difference(t=this.data,{duration:s=.5,easing:o="ease",reverse:r=!1}){const a=this.read(),i=[[1,1],[1,1]],n=[["0px","0px"],["0px","0px"]],c={duration:s,easing:o,reverse:r,composite:"combine"},f={...c,composite:"override"};for(const e of this.include)switch(e){case"x":case"y":n[0]["x"==e?0:1]=t[e]-a[e]+"px";break;case"sx":case"sy":i[0]["sx"==e?0:1]=0===a[e]?1:t[e]/a[e];break;default:f[e]=[t[e],a[e]]}return c.scale=i.map((e=>e.join(" "))),c.translate=n.map((e=>e.join(" "))),[new e(c),new e(f)]}}export{t as StyleCache};
2
- //# sourceMappingURL=cache.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cache.js","sources":["../../src/core/cache.ts"],"sourcesContent":[null],"names":["StyleCache","constructor","element","include","this","map","key","computed","getComputedStyle","data","read","prop","SVGElement","sx","offsetWidth","sy","offsetHeight","x","y","parent","offsetLeft","offsetTop","offsetParent","dataset","livelyOffsetBoundary","update","difference","from","duration","easing","reverse","to","scale","translate","keyframes1","composite","keyframes2","val","join","Clip"],"mappings":"+BAeaA,EAOT,WAAAC,CAAYC,EAAmCC,EAAyB,CAAC,IAAK,IAAK,KAAM,KAAM,eAAgB,kBAAmB,QAAS,WACvIC,KAAKF,QAAUA,EACfE,KAAKD,QAAUA,EAAQE,KAAIC,GAAe,iBAARA,EAAyB,mBAAqBA,IAChFF,KAAKG,SAAWC,iBAAiBN,GACjCE,KAAKK,KAAOL,KAAKM,MACpB,CAED,IAAAA,GACI,MAAMD,EAAO,CAAA,EAGb,IAAK,MAAME,KAAQP,KAAKD,QAASM,EAAKE,GAAQP,KAAKG,SAASI,GAE5D,GAAIP,KAAKF,mBAAmBU,WAAY,OAAOH,EAC/CA,EAAKI,GAAKT,KAAKF,QAAQY,YACvBL,EAAKM,GAAKX,KAAKF,QAAQc,aACvBP,EAAKQ,EAAIR,EAAKI,GAAK,EACnBJ,EAAKS,EAAIT,EAAKM,GAAK,EAEnB,IAAII,EAA6Bf,KAAKF,QACtC,KAAOiB,IACHV,EAAKQ,GAAKE,EAAOC,WACjBX,EAAKS,GAAKC,EAAOE,UAEjBF,EAASA,EAAOG,cACZH,GAAQI,QAAQC,wBAGxB,OAAOf,CACV,CAED,MAAAgB,GACIrB,KAAKK,KAAOL,KAAKM,MACpB,CAED,UAAAgB,CAAWC,EAAkBvB,KAAKK,MAAMmB,SAAEA,EAAW,GAAGC,OAAEA,EAAS,OAAMC,QAAEA,GAAU,IACjF,MAAMC,EAAK3B,KAAKM,OAEVsB,EAAQ,CAAC,CAAC,EAAG,GAAI,CAAC,EAAG,IACvBC,EAAY,CAAC,CAAC,MAAO,OAAQ,CAAC,MAAO,QACnCC,EAA6B,CAAEN,WAAUC,SAAQC,UAASK,UAAW,WACvEC,EAA6B,IAAKF,EAAYC,UAAW,YAE7D,IAAK,MAAM7B,KAAOF,KAAKD,QACnB,OAAQG,GACJ,IAAK,IACL,IAAK,IACD2B,EAAU,GAAU,KAAP3B,EAAa,EAAI,GAAKqB,EAAKrB,GAAOyB,EAAGzB,GAAO,KACzD,MACJ,IAAK,KACL,IAAK,KACD0B,EAAM,GAAU,MAAP1B,EAAc,EAAI,GAAiB,IAAZyB,EAAGzB,GAAa,EAAIqB,EAAKrB,GAAOyB,EAAGzB,GACnE,MACJ,QAAS8B,EAAW9B,GAAO,CAACqB,EAAKrB,GAAeyB,EAAGzB,IAO3D,OAHA4B,EAAWF,MAAQA,EAAM3B,KAAIgC,GAAOA,EAAIC,KAAK,OAC7CJ,EAAWD,UAAYA,EAAU5B,KAAIgC,GAAOA,EAAIC,KAAK,OAE9C,CAAC,IAAIC,EAAKL,GAAa,IAAIK,EAAKH,GAC1C"}
package/dist/core/link.js DELETED
@@ -1,2 +0,0 @@
1
- const e=new Set;function n(s,c){let t={value:s,cached:s,subscriptions:new Set};const r=function(e){return e instanceof Function?n(t.value,(n=>e(r(),n))):c?c(e||0):t.value};return r.set=(n,s)=>{t.value=n,e.forEach((n=>{if(!n.key.deref())return e.delete(n);n.observe(s||{})}))},r.subscribe=e=>t.subscriptions.add(e),r.unsubscribe=e=>t.subscriptions.delete(e),e.add({key:new WeakRef(r),observe:function(e){const n=r();n!==t.cached&&(t.cached=n,t.subscriptions.forEach((n=>n(e))))}}),r}function s(e){return void 0!==e.subscribe}export{n as createLink,s as isLink};
2
- //# sourceMappingURL=link.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"link.js","sources":["../../src/core/link.ts"],"sourcesContent":[null],"names":["links","Set","createLink","initial","computed","internal","value","cached","subscriptions","Link","arg","Function","index","set","options","forEach","link","key","deref","delete","observe","subscribe","callback","add","unsubscribe","WeakRef","current","subscription","isLink","val","undefined"],"mappings":"AAgBA,MAAMA,EAAQ,IAAIC,IAKF,SAAAC,EAAiBC,EAAYC,GACzC,IAAIC,EAAW,CACXC,MAAOH,EACPI,OAAQJ,EACRK,cAAe,IAAIP,KAGvB,MAAMQ,EAAgB,SAAUC,GAC5B,OAAIA,aAAeC,SAAiBT,EAAWG,EAASC,OAAQM,GAAkBF,EAAID,IAAQG,KAEvFR,EAAWA,EAASM,GAAO,GAAKL,EAASC,KACpD,EA+BA,OA7BAG,EAAKI,IAAM,CAACP,EAAUQ,KAClBT,EAASC,MAAQA,EAEjBN,EAAMe,SAAQC,IACV,IAAKA,EAAKC,IAAIC,QAAS,OAAOlB,EAAMmB,OAAOH,GAE3CA,EAAKI,QAAQN,GAAW,CAAA,EAAG,GAC7B,EAGNL,EAAKY,UAAaC,GAA2BjB,EAASG,cAAce,IAAID,GAExEb,EAAKe,YAAeF,GAA2BjB,EAASG,cAAcW,OAAOG,GAY7EtB,EAAMuB,IAAI,CACNN,IAAK,IAAIQ,QAAQhB,GACjBW,QAZJ,SAAiBN,GACb,MAAMY,EAAUjB,IAEZiB,IAAYrB,EAASE,SACrBF,EAASE,OAASmB,EAElBrB,EAASG,cAAcO,SAAQY,GAAgBA,EAAab,KAEnE,IAOML,CACX,CAEM,SAAUmB,EAAUC,GACtB,YAAoCC,IAAnBD,EAAKR,SAC1B"}
@@ -1,2 +0,0 @@
1
- import t from"./clip.js";import{isLink as s}from"./link.js";import i from"./track.js";import{IndexedMap as e,merge as a}from"./utils.js";class r{constructor({stagger:t=.1,staggerLimit:s=10,deform:i=!0,cachable:a,mountClips:r}){this.index=0,this.paused=!1,this.tracks=new e,this.frame=0,this.linked=[],this.mounted=!1,this.stagger=t,this.staggerLimit=s-1,this.deform=i,this.cachable=a,this.mountClips=r}step(){cancelAnimationFrame(this.frame),this.paused||this.tracks.stack.forEach(((t,s)=>t.step(s))),this.frame=requestAnimationFrame(this.step.bind(this))}time(t){return this.tracks.size?t.duration+t.delay+this.stagger*Math.max(Math.min(this.staggerLimit,this.tracks.size-1),0):0}receiver(s,i,e){if(!this.paused)for(let r=0;r<this.tracks.size;r++){const c=this.tracks.stack[r],h=i(r);e.duration?(a(e,{composite:"override"}),new t({...e,[s]:h}).play(c,{})):requestAnimationFrame((()=>{c.apply(s,h),c.correct()}))}}link(i){if(this.step(),!(this.linked.length||!i||i instanceof t))for(let t in i){const e=i[t];if(s(e)){const s=this.receiver.bind(this,t,e);e.subscribe(s),this.linked.push((()=>e.unsubscribe(s))),s({})}}}unlink(){cancelAnimationFrame(this.frame),this.linked.forEach((t=>t())),this.linked=[]}transition(t,s={}){for(let i=0;i<this.tracks.size;i++)this.tracks.stack[i].transition(t?.tracks.stack[i],s)}insert(t){if((t instanceof HTMLElement||t instanceof SVGElement)&&!this.tracks.has(t)){const s=new i(t,this.deform,this.cachable);this.tracks.set(t,s),this.mounted&&this.mountClips.forEach((t=>t.play(s,{})))}}add(t,{immediate:s=!1,composite:i,reverse:e,delay:a=0,commit:r}){let c,h=0;for(;c=this.tracks.stack[h];)c.element.isConnected?(s&&c.clear(),t.play(c,{delay:a+Math.min(h,this.staggerLimit)*(this.stagger<0?t.duration/this.tracks.size:1)*Math.abs(this.stagger),composite:i,reverse:e,commit:r}),h++):this.tracks.delete(c.element)}pause(t){for(const s of this.tracks.stack)s.pause(t);this.paused=t}cache(){for(const t of this.tracks.stack)t.cache.update()}}export{r as default};
2
- //# sourceMappingURL=timeline.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"timeline.js","sources":["../../src/core/timeline.ts"],"sourcesContent":[null],"names":["Timeline","constructor","stagger","staggerLimit","deform","cachable","mountClips","this","index","paused","tracks","IndexedMap","frame","linked","mounted","step","cancelAnimationFrame","stack","forEach","track","i","requestAnimationFrame","bind","time","clip","size","duration","delay","Math","max","min","receiver","prop","link","config","value","merge","composite","Clip","play","apply","correct","length","isLink","subscribe","push","unsubscribe","unlink","transition","from","options","insert","element","HTMLElement","SVGElement","has","Track","set","add","immediate","reverse","commit","isConnected","clear","abs","delete","pause","cache","update"],"mappings":"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"}
@@ -1,2 +0,0 @@
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
- //# sourceMappingURL=use-path.js.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- "use client";
2
- import{useRef as r,useState as t,useMemo as n}from"react";function e(){const e=r(0),[c,o]=t(0);return n((()=>{function r(){o(++e.current)}return r.called=c,r}),[c])}export{e as default};
3
- //# sourceMappingURL=use-trigger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-trigger.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,3 +0,0 @@
1
- "use client";
2
- import{jsx as e}from"react/jsx-runtime";import{useRef as r,useState as n,useLayoutEffect as t,Children as i,isValidElement as c,cloneElement as o}from"react";import u from"../animatable.js";import{Groups as s}from"./morph.js";function d(e,r,n=[]){const t="nodes"in e?e.nodes:e;for(let e=0;e<t.length;e++){const i=[...n,e];let c=r(t[e],i);if(c||(c=d(t[e].nodes,r,i)),c)return c}}function l(e,r){return d(e,((e,n)=>{if(e.key===r)return n}))||null}function a(e,r){let n=e[r[0]];for(let e=1;e<r.length&&n;e++)n=n.nodes[r[e]];return n}function p(e,r,n,t){const i=r[r.length-1],c=r.length>1?a(e,r.slice(0,-1))?.nodes:e;c&&(t?c.splice(i,n,t):c.splice(i,n))}function m({tree:e,nodes:r,mounting:n,partialIndex:t=[],keys:u=new Set,parent:s=["",0]}){return i.forEach(r,((r,i)=>{if([void 0,null,!1].includes(r))return;const d=c(r),p=d&&(Array.isArray(r.props.children)||c(r.props.children)),f=d&&r.type.isLively&&"id"in r.props,h=p&&(!r.type.isLively||r.props.traverseLayout),y=[...t,i],g=p&&!r.type.isLively?o(r,void 0,[]):r,[k,v]=s,x=f?r.props.id:`$l.${k?k+".":""}${y.slice(-v).join("")}`,j=l(e,x),w=j?a(e,j):void 0;w&&(f||w.key.startsWith("$l."))?(j&&j.join("")!==y.join("")&&n.set(x,{replace:!0,node:w,index:y}),w.node=g):n.set(x,{node:{key:x,node:g,nodes:[]},index:y}),h&&m({tree:e,nodes:r.props.children,mounting:n,partialIndex:y,keys:u,parent:f?[x,1]:v?[k,v+1]:void 0}),u.add(x)})),u}function f(e){const r=e.map((e=>c(e.node)?e.nodes.length?o(e.node,{key:e.key},f(e.nodes)):o(e.node,{key:e.key}):e.node));return r.length>1?r:r[0]}function h({children:i,transition:c,initialMount:o=!0}){const a=r(!o),h=r(null),[y,g]=n({}),k=r([]),v=r(new Map),x=r(void 0),j=r(0),w=r(new Set),E=m({tree:k.current,nodes:i,mounting:v.current});if(v.current.forEach(((e,r)=>{E.has(r)||v.current.delete(r)})),d(k.current,(e=>{E.has(e.key)||w.current.add(e.key)})),w.current.size&&h.current){for(const e of h.current.children){const r=e.current?.id,n=w.current.has(r);if(e.current&&n)if(E.has(r))w.current.delete(r),e.current.trigger("mount",{immediate:!0}),e.current.timeline.mounted=!0;else if(e.current.timeline.mounted){const r=Date.now()+1e3*e.current.trigger("unmount",{immediate:!0});if(j.current=Math.max(j.current,r),e.current.group){const r=s[e.current.group].get(e.current.timeline);r&&(r.state="unmounted")}e.current.timeline.mounted=!1}}const e=j.current-Date.now();clearTimeout(x.current);const r=(e=!0)=>{w.current.forEach((e=>{const r=l(k.current,e);r&&p(k.current,r,1)})),w.current.clear(),e&&g({})};e>0?x.current=setTimeout(r,e):r(!1)}return!w.current.size&&v.current.size&&(v.current.forEach((({node:e,index:r,replace:n},t)=>{if(n){const e=l(k.current,t);e&&p(k.current,e,1)}p(k.current,r,0,e)})),v.current.clear()),t((()=>{if(!h.current)return;let e,r=h.current.children.slice();for(;e=r.pop();)a.current&&e.current&&(e.current.timeline.mounted=!0),e.current?.id&&e.current.timeline.mounted&&e.current.adaptive&&null!==l(k.current,e.current.id)&&(e.current.timeline.transition(void 0,c),r.push(...e.current.children));a.current=!1})),e(u,{ref:h,passthrough:!0,cachable:[],children:f(k.current)})}export{h as default};
3
- //# sourceMappingURL=layout-group.js.map
@@ -1,3 +0,0 @@
1
- "use client";
2
- import{jsx as t}from"react/jsx-runtime";import{use as e,useRef as r,useLayoutEffect as n}from"react";import o,{AnimatableContext as u}from"../animatable.js";import{combineRefs as i}from"../core/utils.js";const s={};function m({children:m,group:a,transition:c,...l}){const d=e(u),f=d?.group?`${d.group}.${a}`:a;f in s||(s[f]=new Map);const p=r(null);return n((()=>{const t=p.current?.timeline;if(!t)return;if(s[f].has(t)){s[f].get(t).state="mounted"}else s[f].set(t,{state:"mounted"});const e=Array.from(s[f].entries()).find((([t,e])=>"unmounted"===e.state));return e&&!t.mounted?(t.transition(e[0],c),e[1].state="collected"):t.mounted||p.current?.trigger("mount"),t.mounted=!0,()=>{const e=s[f].get(t);e.state="unmounted",setTimeout((()=>e.state="collected"),1)}}),[]),t(o,{...l,group:f,manual:!0,ref:i(p,l.ref),children:m})}m.isLively=!0;export{s as Groups,m as default};
3
- //# sourceMappingURL=morph.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"morph.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,3 +0,0 @@
1
- "use client";
2
- import{jsx as r}from"react/jsx-runtime";import{Children as t}from"react";import e from"../animatable.js";function i({children:i,stagger:a=1,staggerLimit:m=Number.MAX_VALUE,...p}){return r(e,{...p,stagger:-1*a,staggerLimit:m,children:t.map(i,(t=>"string"!=typeof t&&"number"!=typeof t?t:t.toString().split("").map((t=>r("span",{style:{whiteSpace:" "===t?"pre-wrap":void 0},children:t})))))})}i.isLively=!0;export{i as default};
3
- //# sourceMappingURL=typable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typable.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
package/dist/layout.js DELETED
@@ -1,2 +0,0 @@
1
- export{default as LayoutGroup}from"./layout/layout-group.js";export{default as Morph}from"./layout/morph.js";export{default as Typable}from"./layout/typable.js";
2
- //# sourceMappingURL=layout.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,112 +0,0 @@
1
- import Clip, { AnimatableInitials, ClipProperties } from "./core/clip";
2
- import { Trigger } from "./hooks/use-trigger";
3
- import Timeline, { PlayOptions } from "./core/timeline";
4
- import { CachableKey } from "./core/cache";
5
- type StaticTrigger = 'mount' | 'unmount';
6
- export type AnimatableType<T extends string = any> = {
7
- play: (animation: T | 'animate', options?: PlayOptions, layer?: number) => number;
8
- trigger: (trigger: StaticTrigger, options?: PlayOptions) => number;
9
- timeline: Timeline;
10
- children: React.RefObject<AnimatableType | null>[];
11
- inherit: boolean | undefined;
12
- adaptive: boolean;
13
- group: string | undefined;
14
- id: string;
15
- };
16
- type SharedProps<T extends string = any> = {
17
- group?: string;
18
- animations?: {
19
- [key in T]: ClipProperties | Clip;
20
- };
21
- triggers?: ({
22
- name?: T | 'animate';
23
- on: Trigger | boolean | StaticTrigger;
24
- } & PlayOptions)[];
25
- animate?: ClipProperties | Clip;
26
- initial?: AnimatableInitials;
27
- /**
28
- * How much to stagger child elements' animations by in seconds.
29
- *
30
- * @default 0.1
31
- */
32
- stagger?: number;
33
- /**
34
- * Integer number, after which child elements no longer stagger their animation, but play all at once.
35
- *
36
- * @default 10
37
- */
38
- staggerLimit?: number;
39
- /**
40
- * Whether scale animations will cause artifacting to `border-radius` and/or child elements.
41
- *
42
- * @default true
43
- */
44
- deform?: boolean;
45
- disabled?: boolean;
46
- paused?: boolean;
47
- };
48
- export type AnimatableProps<T extends string = any> = {
49
- ref?: React.Ref<AnimatableType>;
50
- children: React.ReactNode;
51
- /**
52
- * A unique identifier within a [`LayoutGroup`](https://lively.infinityfx.dev/docs/components/layout-group) parent.
53
- */
54
- id?: string;
55
- /**
56
- * Where in the order of a cascade animation this component should play it's animations.
57
- */
58
- order?: number;
59
- /**
60
- * Whether to participate in cascade animations and inherit animation properties from a parent.
61
- *
62
- * @default false
63
- */
64
- inherit?: boolean;
65
- /**
66
- * Whether to **not** participate in cascading animations.
67
- *
68
- * @default false
69
- */
70
- passthrough?: boolean;
71
- /**
72
- * Whether to animate layout changes when this component is a child of a [`LayoutGroup`](https://lively.infinityfx.dev/docs/components/layout-group).
73
- *
74
- * @default false
75
- */
76
- adaptive?: boolean;
77
- /**
78
- * Which properties to keep track of for layout change animations.
79
- *
80
- * @default ['x', 'y', 'sx', 'sy', 'rotate', 'color', 'backgroundColor', 'borderRadius', 'opacity']
81
- */
82
- cachable?: CachableKey[];
83
- /**
84
- * Whether to disable automatic mount/unmount triggering.
85
- *
86
- * @default false
87
- */
88
- manual?: boolean;
89
- onAnimationEnd?: (animation: T | 'animate') => void;
90
- /**
91
- * Whether to observe layout changes within children, when this component is a child of a [`LayoutGroup`](https://lively.infinityfx.dev/docs/components/layout-group).
92
- *
93
- * @default false
94
- */
95
- traverseLayout?: boolean;
96
- } & SharedProps<T>;
97
- type AnimatableContext = {
98
- index?: number;
99
- add: (child: React.RefObject<AnimatableType | null>) => void;
100
- remove: (child: React.RefObject<AnimatableType | null>) => void;
101
- } & SharedProps;
102
- export declare const AnimatableContext: import("react").Context<AnimatableContext | null>;
103
- /**
104
- * Wrap around a react component to animate it.
105
- *
106
- * @see {@link https://lively.infinityfx.dev/docs/components/animatable}
107
- */
108
- declare function Animatable<T extends string>(props: AnimatableProps<T>): import("react/jsx-runtime").JSX.Element;
109
- declare namespace Animatable {
110
- var isLively: boolean;
111
- }
112
- export default Animatable;
@@ -1,15 +0,0 @@
1
- import type { CompositeType, DynamicProperties } from "./clip";
2
- import type Track from "./track";
3
- export default class Action {
4
- composite: CompositeType;
5
- commit: boolean;
6
- track: Track;
7
- animation: Animation;
8
- dynamic: DynamicProperties;
9
- onfinish: (() => void) | null;
10
- constructor(track: Track, keyframes: Keyframe[] | PropertyIndexedKeyframes, config: Omit<KeyframeAnimationOptions, 'composite'> & {
11
- composite: CompositeType;
12
- }, dynamic?: DynamicProperties);
13
- finish(): void;
14
- step(index: number): void;
15
- }
@@ -1,23 +0,0 @@
1
- import Clip, { AnimatableKey } from "./clip";
2
- import { TransitionOptions } from "./track";
3
- type PartialCachableKey = Exclude<AnimatableKey, 'scale' | 'translate'>;
4
- export type CachableKey = PartialCachableKey | 'x' | 'y' | 'sx' | 'sy';
5
- type CacheData = {
6
- [key in PartialCachableKey]?: string;
7
- } & {
8
- x: number;
9
- y: number;
10
- sx: number;
11
- sy: number;
12
- };
13
- export declare class StyleCache {
14
- element: HTMLElement | SVGElement;
15
- data: CacheData;
16
- computed: CSSStyleDeclaration;
17
- include: CachableKey[];
18
- constructor(element: HTMLElement | SVGElement, include?: CachableKey[]);
19
- read(): CacheData;
20
- update(): void;
21
- difference(from: CacheData | undefined, { duration, easing, reverse }: TransitionOptions): Clip[];
22
- }
23
- export {};
@@ -1,14 +0,0 @@
1
- import { ClipConfig } from "./clip";
2
- type Computed<P> = (index: number) => P;
3
- export type Computation<T, P> = (value: T, index: number) => P;
4
- type LinkCallback = (options: ClipConfig) => void;
5
- export type Link<T> = {
6
- (index?: number): T;
7
- <P>(computation: Computation<T, P>): Link<ReturnType<typeof computation>>;
8
- set(value: T, options?: ClipConfig): void;
9
- subscribe(callback: LinkCallback): void;
10
- unsubscribe(callback: LinkCallback): void;
11
- };
12
- export declare function createLink<T, P>(initial: T, computed?: Computed<P>): Link<T>;
13
- export declare function isLink<T>(val: any): val is Link<T>;
14
- export {};
@@ -1,41 +0,0 @@
1
- import { CachableKey } from "./cache";
2
- import Clip, { ClipProperties, CompositeType } from "./clip";
3
- import Track, { TransitionOptions } from "./track";
4
- import { IndexedMap } from "./utils";
5
- export type PlayOptions = {
6
- composite?: CompositeType;
7
- immediate?: boolean;
8
- reverse?: boolean;
9
- delay?: number;
10
- commit?: boolean;
11
- };
12
- export default class Timeline {
13
- index: number;
14
- stagger: number;
15
- staggerLimit: number;
16
- deform: boolean;
17
- cachable?: CachableKey[];
18
- paused: boolean;
19
- tracks: IndexedMap<Element, Track>;
20
- frame: number;
21
- linked: (() => void)[];
22
- mounted: boolean;
23
- mountClips: Clip[];
24
- constructor({ stagger, staggerLimit, deform, cachable, mountClips }: {
25
- stagger?: number;
26
- staggerLimit?: number;
27
- deform?: boolean;
28
- cachable?: CachableKey[];
29
- mountClips: Clip[];
30
- });
31
- step(): void;
32
- time(clip: Clip): number;
33
- private receiver;
34
- link(clip?: ClipProperties | Clip): void;
35
- unlink(): void;
36
- transition(from: Timeline | undefined, options?: TransitionOptions): void;
37
- insert(element: any): void;
38
- add(clip: Clip, { immediate, composite, reverse, delay, commit }: PlayOptions): void;
39
- pause(value: boolean): void;
40
- cache(): void;
41
- }
@@ -1 +0,0 @@
1
- export default function usePath<T extends SVGGeometryElement = any>(): [React.Ref<T>, (transform: (value: [number, number], index: number) => any) => (progress: number, index: number) => any];
@@ -1,4 +0,0 @@
1
- export type Trigger = (() => void) & {
2
- called: number;
3
- };
4
- export default function useTrigger(): Trigger;
@@ -1,16 +0,0 @@
1
- import type { TransitionOptions } from "../core/track";
2
- /**
3
- * Animate layout changes or unmounts.
4
- *
5
- * @see {@link https://lively.infinityfx.dev/docs/components/layout-group}
6
- */
7
- export default function LayoutGroup({ children, transition, initialMount }: {
8
- children: React.ReactNode;
9
- transition?: Omit<TransitionOptions, 'reverse'>;
10
- /**
11
- * Whether to play mount mount animations on first render
12
- *
13
- * @default true
14
- */
15
- initialMount?: boolean;
16
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,24 +0,0 @@
1
- import { AnimatableProps } from "../animatable";
2
- import Timeline from "../core/timeline";
3
- import { TransitionOptions } from "../core/track";
4
- export declare const Groups: {
5
- [key: string]: Map<Timeline, {
6
- state: 'mounted' | 'unmounted' | 'collected';
7
- }>;
8
- };
9
- /**
10
- * Peform layout morphs between components when one mounts and unmount.
11
- *
12
- * @see {@link https://lively.infinityfx.dev/docs/components/morph}
13
- */
14
- declare function Morph({ children, group, transition, ...props }: {
15
- /**
16
- * Global identifier, components with the same group will morph between eachother.
17
- */
18
- group: string;
19
- transition?: Omit<TransitionOptions, 'reverse'>;
20
- } & AnimatableProps): import("react/jsx-runtime").JSX.Element;
21
- declare namespace Morph {
22
- var isLively: boolean;
23
- }
24
- export default Morph;
@@ -1,11 +0,0 @@
1
- import { AnimatableProps } from "../animatable";
2
- /**
3
- * Wrap around text to animate it.
4
- *
5
- * @see {@link https://lively.infinityfx.dev/docs/components/typable}
6
- */
7
- declare function Typable({ children, stagger, staggerLimit, ...props }: AnimatableProps): import("react/jsx-runtime").JSX.Element;
8
- declare namespace Typable {
9
- var isLively: boolean;
10
- }
11
- export default Typable;
@@ -1,4 +0,0 @@
1
- import LayoutGroup from "./layout/layout-group";
2
- import Morph from "./layout/morph";
3
- import Typable from "./layout/typable";
4
- export { LayoutGroup, Morph, Typable };