@infinityfx/lively 4.0.4 → 4.0.6
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/.rollup.cache/F/projects/code/lively/dist/animatable.js +147 -0
- package/.rollup.cache/F/projects/code/lively/dist/animatable.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/animate.js +26 -0
- package/.rollup.cache/F/projects/code/lively/dist/animate.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/core/action.js +28 -0
- package/.rollup.cache/F/projects/code/lively/dist/core/action.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/core/cache.js +55 -0
- package/.rollup.cache/F/projects/code/lively/dist/core/cache.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/core/clip.js +71 -0
- package/.rollup.cache/F/projects/code/lively/dist/core/clip.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/core/link.js +39 -0
- package/.rollup.cache/F/projects/code/lively/dist/core/link.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/core/timeline.js +107 -0
- package/.rollup.cache/F/projects/code/lively/dist/core/timeline.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/core/track.js +147 -0
- package/.rollup.cache/F/projects/code/lively/dist/core/track.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/core/utils.js +95 -0
- package/.rollup.cache/F/projects/code/lively/dist/core/utils.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-audio.js +63 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-audio.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-link.js +7 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-link.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-path.js +15 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-path.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-reduced-motion.js +14 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-reduced-motion.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-scroll.js +21 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-scroll.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-spring.js +37 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-spring.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-trigger.js +15 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-trigger.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-viewport.js +27 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-viewport.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-visible.js +26 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks/use-visible.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks.js +11 -0
- package/.rollup.cache/F/projects/code/lively/dist/hooks.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/index.js +4 -0
- package/.rollup.cache/F/projects/code/lively/dist/index.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/layout/layout-group.js +209 -0
- package/.rollup.cache/F/projects/code/lively/dist/layout/layout-group.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/layout/morph.js +48 -0
- package/.rollup.cache/F/projects/code/lively/dist/layout/morph.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/layout/typable.js +21 -0
- package/.rollup.cache/F/projects/code/lively/dist/layout/typable.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/layout.js +5 -0
- package/.rollup.cache/F/projects/code/lively/dist/layout.js.map +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/tsconfig.tsbuildinfo +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/animatable.d.ts +112 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/animate.d.ts +19 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/core/action.d.ts +15 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/core/cache.d.ts +23 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/core/clip.d.ts +52 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/core/link.d.ts +14 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/core/timeline.d.ts +41 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/core/track.d.ts +32 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/core/utils.d.ts +39 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/hooks/use-audio.d.ts +7 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/hooks/use-link.d.ts +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/hooks/use-path.d.ts +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/hooks/use-reduced-motion.d.ts +1 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/hooks/use-scroll.d.ts +9 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/hooks/use-spring.d.ts +6 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/hooks/use-trigger.d.ts +4 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/hooks/use-viewport.d.ts +2 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/hooks/use-visible.d.ts +6 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/hooks.d.ts +10 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/index.d.ts +3 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/layout/layout-group.d.ts +16 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/layout/morph.d.ts +24 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/layout/typable.d.ts +11 -0
- package/.rollup.cache/F/projects/code/lively/dist/types/layout.d.ts +4 -0
- package/dist/animatable.js +1 -1
- package/dist/animate.js +1 -1
- package/dist/core/action.js +1 -1
- package/dist/core/action.js.map +1 -1
- package/dist/core/cache.js +1 -1
- package/dist/core/cache.js.map +1 -1
- package/dist/core/clip.js +1 -1
- package/dist/core/clip.js.map +1 -1
- package/dist/core/timeline.js +1 -1
- package/dist/core/timeline.js.map +1 -1
- package/dist/core/track.js +1 -1
- package/dist/core/track.js.map +1 -1
- package/dist/core/utils.js +1 -1
- package/dist/core/utils.js.map +1 -1
- package/dist/hooks/use-audio.js +1 -1
- package/dist/hooks/use-scroll.js +1 -1
- package/dist/layout/layout-group.js +1 -1
- package/dist/layout/morph.js +1 -1
- package/dist/layout/typable.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/core/utils.d.ts +1 -0
- package/package.json +1 -1
- package/tsconfig.json +4 -2
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type Action from "./action";
|
|
2
|
+
import { CachableKey, StyleCache } from "./cache";
|
|
3
|
+
import type { Easing } from "./clip";
|
|
4
|
+
export type TransitionOptions = {
|
|
5
|
+
duration?: number;
|
|
6
|
+
easing?: Easing;
|
|
7
|
+
reverse?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export default class Track {
|
|
10
|
+
element: HTMLElement | SVGElement;
|
|
11
|
+
deform: boolean;
|
|
12
|
+
playing: number;
|
|
13
|
+
active: Action[];
|
|
14
|
+
queue: Action[];
|
|
15
|
+
cache: StyleCache;
|
|
16
|
+
paused: boolean;
|
|
17
|
+
scale: [number, number];
|
|
18
|
+
corrected: {
|
|
19
|
+
borderRadius: string;
|
|
20
|
+
boxShadow: string;
|
|
21
|
+
};
|
|
22
|
+
constructor(element: HTMLElement | SVGElement, deform: boolean, cachable?: CachableKey[]);
|
|
23
|
+
push(action: Action): void;
|
|
24
|
+
next(): void;
|
|
25
|
+
clear(partial?: boolean): void;
|
|
26
|
+
pause(value: boolean): void;
|
|
27
|
+
step(index: number): void;
|
|
28
|
+
transition(previous: Track | undefined, options: TransitionOptions): void;
|
|
29
|
+
apply(prop: string, val: any): void;
|
|
30
|
+
decomposeScale(): [number, number];
|
|
31
|
+
correct(): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AnimatableKeyframe } from "./clip";
|
|
2
|
+
import type Track from "./track";
|
|
3
|
+
type SharedKeys<T, P> = keyof Omit<T | P, keyof (Omit<T, keyof P> & Omit<P, keyof T>)>;
|
|
4
|
+
type MergedMaps<T, P> = T & P & {
|
|
5
|
+
[K in SharedKeys<T, P>]: MergedPair<T[K], P[K]>;
|
|
6
|
+
};
|
|
7
|
+
type MergedPair<T, P> = [T, P] extends [{
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}, {
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}] ? MergedMaps<T, P> : T & P;
|
|
12
|
+
type Merged<T extends [...any]> = T extends [infer L, ...infer R] ? MergedPair<L, Merged<R>> : unknown;
|
|
13
|
+
export declare function merge<T extends {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}[]>(...objects: T): Merged<T>;
|
|
16
|
+
export declare function pick<T extends {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}, K extends keyof T>(map: T, keys: K[]): { [key in K]: T[K]; };
|
|
19
|
+
export declare function combineRefs(...refs: (React.Ref<any> | undefined)[]): (el: any) => void;
|
|
20
|
+
export declare const limitSmallestQuantity: (val: number, e: number) => number;
|
|
21
|
+
export declare const lengthToOffset: (val: any) => number;
|
|
22
|
+
export declare class IndexedMap<K, V> extends Map<K, V> {
|
|
23
|
+
stack: V[];
|
|
24
|
+
set(key: K, value: V): this;
|
|
25
|
+
delete(key: K): boolean;
|
|
26
|
+
}
|
|
27
|
+
type AnimatableObjectProperty = {
|
|
28
|
+
value?: string | number;
|
|
29
|
+
after?: string | number;
|
|
30
|
+
offset: number;
|
|
31
|
+
};
|
|
32
|
+
export declare function distributeAnimatableKeyframes(prop: string, keyframes: AnimatableObjectProperty[], map?: {
|
|
33
|
+
[key: number]: Keyframe;
|
|
34
|
+
}): {
|
|
35
|
+
[key: number]: Keyframe;
|
|
36
|
+
};
|
|
37
|
+
export declare function normalizeAnimatableKeyframes(keyframes: (AnimatableKeyframe | undefined)[]): boolean;
|
|
38
|
+
export declare function createDynamic(prop: string, keyframes: Keyframe[], easing: string): (this: Track, t: number) => string;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Link } from "../core/link";
|
|
2
|
+
export default function useAudio({ bands, minFrequency, maxFrequency, smoothing }?: {
|
|
3
|
+
bands?: number | undefined;
|
|
4
|
+
minFrequency?: number | undefined;
|
|
5
|
+
maxFrequency?: number | undefined;
|
|
6
|
+
smoothing?: number | undefined;
|
|
7
|
+
}): [React.RefObject<HTMLAudioElement | null>, Link<number[]>];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useLink<T = any>(initial: T): import("../core/link").Link<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function usePath<T extends SVGGeometryElement = any>(): [React.Ref<T>, (transform: (value: [number, number], index: number) => any) => (progress: number, index: number) => any];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useReducedMotion(): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
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>;
|
|
@@ -0,0 +1,10 @@
|
|
|
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";
|
|
6
|
+
import useViewport from "./hooks/use-viewport";
|
|
7
|
+
import useVisible from "./hooks/use-visible";
|
|
8
|
+
import useAudio from "./hooks/use-audio";
|
|
9
|
+
import useSpring from "./hooks/use-spring";
|
|
10
|
+
export { useLink, useTrigger, useReducedMotion, useScroll, usePath, useViewport, useVisible, useAudio, useSpring };
|
|
@@ -0,0 +1,16 @@
|
|
|
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;
|
|
@@ -0,0 +1,24 @@
|
|
|
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;
|
|
@@ -0,0 +1,11 @@
|
|
|
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;
|
package/dist/animatable.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{
|
|
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&&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
3
|
//# sourceMappingURL=animatable.js.map
|
package/dist/animate.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{
|
|
2
|
+
import{jsx as r,Fragment as t}from"react/jsx-runtime";import{Children as i,isValidElement as e,cloneElement as n}from"react";import a from"./animatable.js";function o({children:o,animations:p=[{translate:["0px 16px","0px 0px"],opacity:[0,1],duration:.35}],levels:l=2,...m}){return r(t,{children:function t(o,c=l){let s,u=l-c;for(;!(s=p[u])&&u>=0;)u--;return c<1||i.count(o)<1?o:r(a,{...m,animate:s,inherit:c<l||m.inherit,children:i.map(o,(r=>e(r)?n(r,{},t(r.props.children,c-1)):r))})}(o)})}o.isLively=!0;export{o as default};
|
|
3
3
|
//# sourceMappingURL=animate.js.map
|
package/dist/core/action.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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(){
|
|
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
2
|
//# sourceMappingURL=action.js.map
|
package/dist/core/action.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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","
|
|
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"}
|
package/dist/core/cache.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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,!
|
|
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
2
|
//# sourceMappingURL=cache.js.map
|
package/dist/core/cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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","
|
|
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,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KAAK,OAE9C,CAAC,IAAIC,EAAKL,GAAa,IAAIK,EAAKH,GAC1C"}
|
package/dist/core/clip.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"./action.js";import{isLink as e}from"./link.js";import{normalizeAnimatableKeyframes as i,createDynamic as s,distributeAnimatableKeyframes as n,merge as r}from"./utils.js";class a{constructor({duration:t=1,delay:a=0,repeat:o=1,alternate:h=!1,easing:l="ease",reverse:c=!1,composite:m="none",...y},d={}){this.dynamic={};const f={};for(let t in y){let r=y[t],a=d[t];if(r instanceof Function){e(r)||(this.dynamic[t]=r);continue}const o=Array.isArray(r)?r:[r];o.length<2&&void 0!==a&&o.unshift(a),null===o[0]&&(void 0!==a?o[0]=a:o.splice(0,1)),i(o)&&("borderRadius"!==t?n(t,o,f):this.dynamic[t]=s(t,Object.values(n(t,o)),l))}this.keyframes=Object.values(f),this.initial=r({},d,this.keyframes.length?this.keyframes[0]:{}),delete this.initial.offset,this.isEmpty=!this.keyframes.length&&!Object.keys(this.dynamic).length,this.duration=this.isEmpty?0:t,this.delay=a,this.repeat=o,this.alternate=h,this.easing=l,this.reverse=c,this.composite=m}static from(t,e){return t instanceof a?t:new a(t||{},e)}unique(t){const e=new a({});for(const i in this)this.hasOwnProperty(i)&&(e[i]=i in t?t[i]:this[i]);return e}play(e,{composite:i=this.composite,reverse:s=this.reverse,commit:n=!0,delay:r=0}){if(this.isEmpty)return;const a=new t(e,this.keyframes,{duration:1e3*this.duration,delay:1e3*(r+this.delay),iterations:this.repeat,direction:this.alternate?s?"alternate-reverse":"alternate":s?"reverse":"normal",fill:"both",easing:this.easing,composite:i},this.dynamic);a.commit=n,e.push(a)}}export{a as default};
|
|
2
2
|
//# sourceMappingURL=clip.js.map
|
package/dist/core/clip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clip.js","sources":["../../src/core/clip.ts"],"sourcesContent":[null],"names":["Clip","constructor","
|
|
1
|
+
{"version":3,"file":"clip.js","sources":["../../src/core/clip.ts"],"sourcesContent":[null],"names":["Clip","constructor","duration","delay","repeat","alternate","easing","reverse","composite","properties","initial","this","dynamic","keyframes","prop","val","init","Function","isLink","arr","Array","isArray","length","undefined","unshift","splice","normalizeAnimatableKeyframes","distributeAnimatableKeyframes","createDynamic","Object","values","merge","offset","isEmpty","keys","from","data","unique","config","clip","key","hasOwnProperty","play","track","commit","action","Action","iterations","direction","fill","push"],"mappings":"yLAoCc,MAAOA,EAcjB,WAAAC,EAAYC,SAAEA,EAAW,EAACC,MAAEA,EAAQ,EAACC,OAAEA,EAAS,EAACC,UAAEA,GAAY,EAAKC,OAAEA,EAAS,OAAMC,QAAEA,GAAU,EAAKC,UAAEA,EAAY,UAAWC,GAA8BC,EAA8B,IAV3LC,KAAOC,QAAsB,GAWzB,MAAMC,EAEF,CAAA,EAEJ,IAAK,IAAIC,KAAQL,EAAY,CACzB,IAAIM,EAAMN,EAAWK,GAAwBE,EAAON,EAAQI,GAE5D,GAAIC,aAAeE,SAAU,CACpBC,EAAOH,KAAMJ,KAAKC,QAAQE,GAAyBC,GACxD,QACH,CAED,MAAMI,EAAMC,MAAMC,QAAQN,GAAOA,EAAM,CAACA,GAEpCI,EAAIG,OAAS,QAAcC,IAATP,GAAoBG,EAAIK,QAAQR,GACvC,OAAXG,EAAI,UAAsBI,IAATP,EAAqBG,EAAI,GAAKH,EAAOG,EAAIM,OAAO,EAAG,IAEnEC,EAA6BP,KAErB,iBAATL,EAKJa,EAA8Bb,EAAMK,EAAYN,GAJ5CF,KAAKC,QAAQE,GAAQc,EAAcd,EAAMe,OAAOC,OAAOH,EAA8Bb,EAAMK,IAAcb,GAKhH,CAEDK,KAAKE,UAAYgB,OAAOC,OAAOjB,GAC/BF,KAAKD,QAAUqB,EAAM,CAAE,EAAErB,EAASC,KAAKE,UAAUS,OAAUX,KAAKE,UAAU,GAAa,CAAE,UAElFF,KAAKD,QAAQsB,OACpBrB,KAAKsB,SAAWtB,KAAKE,UAAUS,SAAWO,OAAOK,KAAKvB,KAAKC,SAASU,OACpEX,KAAKT,SAAWS,KAAKsB,QAAU,EAAI/B,EACnCS,KAAKR,MAAQA,EACbQ,KAAKP,OAASA,EACdO,KAAKN,UAAYA,EACjBM,KAAKL,OAASA,EACdK,KAAKJ,QAAUA,EACfI,KAAKH,UAAYA,CACpB,CAED,WAAO2B,CAAKC,EAA8B1B,GACtC,OAAO0B,aAAgBpC,EAAOoC,EAAO,IAAIpC,EAAKoC,GAAQ,CAAA,EAAI1B,EAC7D,CAED,MAAA2B,CAAOC,GACH,MAAMC,EAAO,IAAIvC,EAAK,CAAA,GAEtB,IAAK,MAAMwC,KAAO7B,KACVA,KAAK8B,eAAeD,KACnBD,EAAaC,GAAOA,KAAOF,EAASA,EAAOE,GAAgB7B,KAAK6B,IAIzE,OAAOD,CACV,CAED,IAAAG,CAAKC,GAAcnC,UAAEA,EAAYG,KAAKH,UAASD,QAAEA,EAAUI,KAAKJ,QAAOqC,OAAEA,GAAS,EAAIzC,MAAEA,EAAQ,IAC5F,GAAIQ,KAAKsB,QAAS,OAElB,MAAMY,EAAS,IAAIC,EAAOH,EAAOhC,KAAKE,UAAW,CAC7CX,SAA0B,IAAhBS,KAAKT,SACfC,MAA8B,KAAtBA,EAAQQ,KAAKR,OACrB4C,WAAYpC,KAAKP,OACjB4C,UAAWrC,KAAKN,UACXE,EAAU,oBAAsB,YAChCA,EAAU,UAAY,SAC3B0C,KAAM,OACN3C,OAAQK,KAAKL,OACbE,aACDG,KAAKC,SAERiC,EAAOD,OAASA,EAEhBD,EAAMO,KAAKL,EACd"}
|
package/dist/core/timeline.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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(
|
|
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
2
|
//# sourceMappingURL=timeline.js.map
|
|
@@ -1 +1 @@
|
|
|
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","
|
|
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":"yIAcc,MAAOA,EAcjB,WAAAC,EAAYC,QAAEA,EAAU,GAAGC,aAAEA,EAAe,GAAEC,OAAEA,GAAS,EAAIC,SAAEA,EAAQC,WAAEA,IAZzEC,KAAKC,MAAW,EAKhBD,KAAME,QAAY,EAClBF,KAAAG,OAAqC,IAAIC,EACzCJ,KAAKK,MAAW,EAChB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,MAAMhD,KAASZ,KAAKG,OAAOO,MAAOE,EAAMgD,MAAMC,QACtD"}
|
package/dist/core/track.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{StyleCache as t}from"./cache.js";import{lengthToOffset as e}from"./utils.js";class
|
|
1
|
+
import{StyleCache as t}from"./cache.js";import{lengthToOffset as e,limitSmallestQuantity as s}from"./utils.js";class i{constructor(e,s,i){this.playing=0,this.active=[],this.queue=[],this.paused=!1,this.scale=[1,1],this.corrected={borderRadius:"",boxShadow:""},this.element=e,this.deform=s,this.cache=new t(e,i)}push(t){t.onfinish=this.next.bind(this),this.playing&&"none"===t.composite?(this.queue.push(t),t.animation.pause()):(this.active.push(t),"none"===t.composite&&this.playing++,this.paused&&t.animation.pause())}next(){this.cache.update(),--this.playing>0||(this.active=this.queue.length?this.queue.splice(0,1):[],this.playing=this.active.length,this.pause(!1),this.playing||this.correct())}clear(t){this.active.forEach((e=>{e.onfinish=null;try{t?e.commit||"combine"===e.composite||e.animation.cancel():e.animation.finish()}catch(t){e.animation.cancel()}})),t||(this.active=[],this.queue=[],this.playing=0),this.deform||(this.element.style.borderRadius="",this.element.style.boxShadow="",this.corrected.borderRadius=this.cache.data.borderRadius=this.cache.computed.borderRadius,this.corrected.boxShadow=this.cache.data.boxShadow=this.cache.computed.boxShadow,this.scale=[1,1])}pause(t){for(const e of this.active)e.animation[t?"pause":"play"]();this.paused=t}step(t){for(const e of this.active)e.step(t);!this.paused&&this.active.length&&this.correct()}transition(t,e){this.clear(!0);const s=this.cache.difference(t?.cache.data,e);this.cache.update(),t?.clear(),t?.cache.update(),s.forEach((t=>t.play(this,{commit:!1})))}apply(t,s){const i="strokeLength"===t;this.element.style[i?"strokeDashoffset":t]=i?e(s):s}decomposeScale(){const[t,e]=this.cache.computed.scale.split(" ");let i=parseFloat(t),a=e?parseFloat(e):i;return isNaN(i)&&(i=1),isNaN(a)&&(a=1),/%$/.test(t)&&(i/=100),/%$/.test(e)&&(a/=100),[s(i,1e-4),s(a,1e-4)]}correct(){if(this.deform)return;const t=this.cache.computed,e=t.borderRadius.split(/\s*\/\s*/);e.length<2&&(e[1]=e[0]);const s=t.boxShadow.split(/(?<=px),\s?/),[i,a]=s[0].split(/(?<=\))\s/),o=t.borderRadius!==this.corrected.borderRadius?[1,1]:this.scale,h=t.boxShadow!==this.corrected.boxShadow?[1,1]:this.scale,[c,r]=this.scale=this.decomposeScale();if(this.element.style.borderRadius=e.map(((t,e)=>t.split(" ").map((t=>parseFloat(t)*o[e]/this.scale[e]+(t.match(/[^\d\.]+$/)?.[0]||"px"))).join(" "))).join("/"),this.corrected.borderRadius=t.borderRadius,a){const e=a.split(" ").map(parseFloat),s=+(c<r),o=s?r:c,n=Math.max(...h),l=new Array(3).fill([e[0]*h[0]/c,e[1]*h[1]/r,e[2]*n/o,e[3]*n/o]);l[1][0]-=s?1/c:0,l[1][1]-=s?0:1/r,l[2][0]+=s?1/c:0,l[2][1]+=s?0:1/r,this.element.style.boxShadow=l.map((t=>`${i} ${t.map((t=>`${t}px`)).join(" ")}`)).join(", "),this.corrected.boxShadow=t.boxShadow}for(let t=0;t<this.element.children.length;t++){const e=this.element.children[t],s=e.offsetLeft,i=e.offsetTop,a=e.offsetWidth,o=e.offsetHeight,[h,n]=getComputedStyle(e).translate.split(" ").map(parseFloat);e.style.transform=`translate(${-h||0}px, ${-n||0}px) scale(${1/c}, ${1/r}) translate(${s*(1-c)+a/2*(1-c)+(h||0)}px, ${i*(1-r)+o/2*(1-r)+(n||0)}px)`}}}export{i as default};
|
|
2
2
|
//# sourceMappingURL=track.js.map
|
package/dist/core/track.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track.js","sources":["../../src/core/track.ts"],"sourcesContent":[null],"names":["Track","constructor","element","deform","cachable","this","playing","active","queue","paused","scale","corrected","borderRadius","boxShadow","cache","StyleCache","push","action","onfinish","next","bind","composite","animation","pause","update","length","splice","clear","partial","forEach","commit","cancel","finish","ex","style","data","computed","value","step","index","
|
|
1
|
+
{"version":3,"file":"track.js","sources":["../../src/core/track.ts"],"sourcesContent":[null],"names":["Track","constructor","element","deform","cachable","this","playing","active","queue","paused","scale","corrected","borderRadius","boxShadow","cache","StyleCache","push","action","onfinish","next","bind","composite","animation","pause","update","length","splice","correct","clear","partial","forEach","commit","cancel","finish","ex","style","data","computed","value","step","index","transition","previous","options","clips","difference","clip","play","apply","prop","val","isStroke","lengthToOffset","decomposeScale","xString","yString","split","x","parseFloat","y","isNaN","test","limitSmallestQuantity","radii","shadows","color","shadow","previousRadiusScale","previousShadowScale","map","axis","i","radius","match","join","props","ms","pms","Math","max","Array","fill","children","child","l","offsetLeft","t","offsetTop","w","offsetWidth","h","offsetHeight","tx","ty","getComputedStyle","translate","transform"],"mappings":"+GAWc,MAAOA,EAejB,WAAAC,CAAYC,EAAmCC,EAAiBC,GAXhEC,KAAOC,QAAW,EAClBD,KAAME,OAAa,GACnBF,KAAKG,MAAa,GAElBH,KAAMI,QAAY,EAClBJ,KAAAK,MAA0B,CAAC,EAAG,GAC9BL,KAAAM,UAAY,CACRC,aAAc,GACdC,UAAW,IAIXR,KAAKH,QAAUA,EACfG,KAAKF,OAASA,EACdE,KAAKS,MAAQ,IAAIC,EAAWb,EAASE,EACxC,CAED,IAAAY,CAAKC,GACDA,EAAOC,SAAWb,KAAKc,KAAKC,KAAKf,MAE7BA,KAAKC,SAAgC,SAArBW,EAAOI,WACvBhB,KAAKG,MAAMQ,KAAKC,GAChBA,EAAOK,UAAUC,UAEjBlB,KAAKE,OAAOS,KAAKC,GACQ,SAArBA,EAAOI,WAAsBhB,KAAKC,UAClCD,KAAKI,QAAQQ,EAAOK,UAAUC,QAEzC,CAED,IAAAJ,GACId,KAAKS,MAAMU,WAELnB,KAAKC,QAAU,IAErBD,KAAKE,OAASF,KAAKG,MAAMiB,OAASpB,KAAKG,MAAMkB,OAAO,EAAG,GAAK,GAC5DrB,KAAKC,QAAUD,KAAKE,OAAOkB,OAC3Bp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AKC,OAAOX,GAEhBzD,EAAgD,IAAIqE,MAAM,GAAGC,KAAK,CACpEN,EAAM,GAAKP,EAAoB,GAAKX,EACpCkB,EAAM,GAAKP,EAAoB,GAAKT,EACpCgB,EAAM,GAAKE,EAAMD,EACjBD,EAAM,GAAKE,EAAMD,IAErBjE,EAAU,GAAG,IAAM4D,EAAI,EAAId,EAAI,EAC/B9C,EAAU,GAAG,IAAM4D,EAAI,EAAI,EAAIZ,EAC/BhD,EAAU,GAAG,IAAM4D,EAAI,EAAId,EAAI,EAC/B9C,EAAU,GAAG,IAAM4D,EAAI,EAAI,EAAIZ,EAE/BtD,KAAKH,QAAQiC,MAAMtB,UAAYF,EAAU0D,KAAInB,GAAO,GAAGe,KAASf,EAAImB,KAAInB,GAAO,GAAGA,QAASwB,KAAK,SAAQA,KAAK,MAC7GrE,KAAKM,UAAUE,UAAYwB,EAASxB,SACvC,CAED,IAAK,IAAI0D,EAAI,EAAGA,EAAIlE,KAAKH,QAAQgF,SAASzD,OAAQ8C,IAAK,CACnD,MAAMY,EAAQ9E,KAAKH,QAAQgF,SAASX,GAC9Ba,EAAID,EAAME,WACZC,EAAIH,EAAMI,UACVC,EAAIL,EAAMM,YACVC,EAAIP,EAAMQ,cAEPC,EAAIC,GAAMC,iBAAiBX,GAAOY,UAAUvC,MAAM,KAAKa,IAAIX,YAElEyB,EAAMhD,MAAM6D,UAAY,cAAcJ,GAAM,SAASC,GAAM,cAAc,EAAIpC,MAAM,EAAIE,gBAAgByB,GAAK,EAAI3B,GAAK+B,EAAI,GAAK,EAAI/B,IAAMmC,GAAM,SAASN,GAAK,EAAI3B,GAAK+B,EAAI,GAAK,EAAI/B,IAAMkC,GAAM,OACjM,CACJ"}
|
package/dist/core/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function t(...t){for(let e=1;e<t.length;e++)for(const n in t[e])n in t[0]&&void 0!==t[0][n]||(t[0][n]=t[e][n]);return t[0]}function e(t,e){const n={};for(const o of e)n[o]=t[o];return n}function n(...t){return e=>{t.forEach((t=>{t&&"current"in t&&(t.current=e),t instanceof Function&&t(e)}))}}const o=t=>1-parseFloat(t.toString());class r extends Map{constructor(){super(...arguments),this.stack=[]}set(t,e){return this.stack.push(e),super.set(t,e)}delete(t){const e=this.stack.indexOf(this.get(t));return e>=0&&this.stack.splice(e,1),super.delete(t)}}function
|
|
1
|
+
function t(...t){for(let e=1;e<t.length;e++)for(const n in t[e])n in t[0]&&void 0!==t[0][n]||(t[0][n]=t[e][n]);return t[0]}function e(t,e){const n={};for(const o of e)n[o]=t[o];return n}function n(...t){return e=>{t.forEach((t=>{t&&"current"in t&&(t.current=e),t instanceof Function&&t(e)}))}}const o=(t,e)=>(Math.sign(t)||1)*Math.max(Math.abs(t),e),s=t=>1-parseFloat(t.toString());class r extends Map{constructor(){super(...arguments),this.stack=[]}set(t,e){return this.stack.push(e),super.set(t,e)}delete(t){const e=this.stack.indexOf(this.get(t));return e>=0&&this.stack.splice(e,1),super.delete(t)}}function i(t,e,n={}){const o=(e,o)=>{const r=1e4*e,i="strokeLength"===t;r in n||(n[r]={offset:e}),n[r][i?"strokeDashoffset":t]=i?s(o):o};for(let t=0;t<e.length;t++){let{offset:n,value:s,after:r}=e[t];void 0!==s&&(void 0!==r&&1===n&&(n-=1e-4),o(n,s)),void 0!==r&&(n=Math.min(n+1e-4,1),o(n,r))}return n}function c(t){let e,n=0;for(let o=0;o<t.length;o++){let s=t[o],r=t.length<2?1:Math.round(o/(t.length-1)*1e4)/1e4;0===o&&(e=s),s&&"object"==typeof s?"offset"in s||(s.offset=r):(s===e&&n++,t[o]={offset:r,value:null!==s?s:void 0})}return n<2||n!==t.length}function f(t,e,n){return function(o){const s=this.element.animate(e,{duration:1e3,fill:"forwards",easing:n});s.currentTime=1e3*o;const r=getComputedStyle(this.element)[t];return s.cancel(),r}}export{r as IndexedMap,n as combineRefs,f as createDynamic,i as distributeAnimatableKeyframes,s as lengthToOffset,o as limitSmallestQuantity,t as merge,c as normalizeAnimatableKeyframes,e as pick};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
package/dist/core/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/core/utils.ts"],"sourcesContent":[null],"names":["merge","objects","i","length","key","undefined","pick","map","keys","picked","combineRefs","refs","el","forEach","ref","current","Function","
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/core/utils.ts"],"sourcesContent":[null],"names":["merge","objects","i","length","key","undefined","pick","map","keys","picked","combineRefs","refs","el","forEach","ref","current","Function","limitSmallestQuantity","val","e","Math","sign","max","abs","lengthToOffset","parseFloat","toString","IndexedMap","Map","constructor","this","stack","set","value","push","super","indexOf","get","splice","delete","distributeAnimatableKeyframes","prop","keyframes","offset","isStroke","after","min","normalizeAnimatableKeyframes","match","equal","keyframe","round","createDynamic","easing","t","animation","element","animate","duration","fill","currentTime","getComputedStyle","cancel"],"mappings":"AAWgB,SAAAA,KAA8CC,GAC1D,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAQE,OAAQD,IAChC,IAAK,MAAME,KAAOH,EAAQC,GAClBE,KAAOH,EAAQ,SAA0BI,IAApBJ,EAAQ,GAAGG,KAEpCH,EAAQ,GAAGG,GAAOH,EAAQC,GAAGE,IAIrC,OAAOH,EAAQ,EACnB,CAEgB,SAAAK,EAA2DC,EAAQC,GAC/E,MAAMC,EAAS,CAAA,EAEf,IAAK,MAAML,KAAOI,EAAMC,EAAOL,GAAOG,EAAIH,GAE1C,OAAOK,CACX,CAEgB,SAAAC,KAAeC,GAC3B,OAAQC,IACJD,EAAKE,SAAQC,IACLA,GAAO,YAAaA,IAAMA,EAA6BC,QAAUH,GACjEE,aAAeE,UAAUF,EAAIF,EAAG,GACtC,CAEV,CAEO,MAAMK,EAAwB,CAACC,EAAaC,KAAeC,KAAKC,KAAKH,IAAQ,GAAKE,KAAKE,IAAIF,KAAKG,IAAIL,GAAMC,GAEpGK,EAAkBN,GA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YA,IAAWA,EAASP,OAASA,IAE3CO,IAAaF,GAAOC,IACxBP,EAAUxC,GAAK,CAAEyC,SAAQV,MAAoB,OAAbiB,EAAoBA,OAAW7C,GAEtE,CAED,OAAO4C,EAAQ,GAAKA,IAAUP,EAAUvC,MAC5C,UAGgBiD,EAAcX,EAAcC,EAAuBW,GAC/D,OAAO,SAAuBC,GAC1B,MAAMC,EAAYzB,KAAK0B,QAAQC,QAAQf,EAAW,CAAEgB,SAAU,IAAMC,KAAM,WAAYN,WACtFE,EAAUK,YAAc,IAAON,EAE/B,MAAMrB,EAAQ4B,iBAAiB/B,KAAK0B,SAASf,GAI7C,OAFAc,EAAUO,SAEH7B,CACX,CACJ"}
|
package/dist/hooks/use-audio.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{useRef as e,useEffect as n}from"react";import t from"./use-link.js";let r;function o({bands:o=8,minFrequency:
|
|
2
|
+
import{useRef as e,useEffect as n}from"react";import t from"./use-link.js";let r;function o({bands:o=8,minFrequency:c=100,maxFrequency:a=2e3,smoothing:i=.7}={}){const u=e(new Float32Array(1024)),s=e(void 0),d=e(void 0),l=e(null),m=t(new Array(8).fill(0));let f;function v(){if(!s.current)return;s.current.getFloatFrequencyData(u.current);const e=m(),n=Math.floor(c/24e3*1024),t=Math.floor(a/24e3*1024);for(let r=0;r<o;r++){const c=n+(t-n)/o*r,a=Math.floor(c),i=Math.ceil(c),s=c-a,d=u.current[a]*(1-s)+u.current[i]*s;e[r]=Math.max(0,(100+d)/70)}m.set(e),f=requestAnimationFrame(v)}function y(){"suspended"===r.state&&r.resume(),f=requestAnimationFrame(v)}function p(){cancelAnimationFrame(f),m.set(new Array(o).fill(0),{duration:.3})}return n((()=>{const e=l.current;if(e)return r||(r=new AudioContext),s.current||(s.current=new AnalyserNode(r,{fftSize:2048,smoothingTimeConstant:i})),d.current||(d.current=r.createMediaElementSource(e)),s.current.connect(r.destination),d.current.connect(s.current),e.addEventListener("play",y),e.addEventListener("pause",p),e.addEventListener("ended",p),()=>{s.current?.disconnect(),d.current?.disconnect(),e.removeEventListener("play",y),e.removeEventListener("pause",p),e.removeEventListener("ended",p)}}),[]),[l,m]}export{o as default};
|
|
3
3
|
//# sourceMappingURL=use-audio.js.map
|
package/dist/hooks/use-scroll.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{useLayoutEffect as t}from"react";import e from"./use-link.js";function r({restore:r=0,target:o}={}){const n=e({x:0,y:0,top:0,left:0});return t((()=>{const t=
|
|
2
|
+
import{useLayoutEffect as t}from"react";import e from"./use-link.js";function r({restore:r=0,target:o}={}){const n=e({x:0,y:0,top:0,left:0});return t((()=>{const t=o?.current?o.current:window;function e(t){const e=o?.current||document.documentElement,r=e.scrollLeft,c=r/(e.scrollWidth-e.clientWidth||1),l=e.scrollTop,s=l/(e.scrollHeight-e.clientHeight||1);n.set({x:c,y:s,top:l,left:r},{duration:t})}e(r);const c=()=>e();return t.addEventListener("scroll",c),()=>t.removeEventListener("scroll",c)}),[o]),n}export{r as default};
|
|
3
3
|
//# sourceMappingURL=use-scroll.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
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 o,cloneElement as c}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 o=r(t[e],i);if(o||(o=d(t[e].nodes,r,i)),o)return o}}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 m(e,r,n,t){
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{useRef as r,useState as n,useLayoutEffect as t,Children as i,isValidElement as o,cloneElement as c}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 o=r(t[e],i);if(o||(o=d(t[e].nodes,r,i)),o)return o}}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 m(e,r,n,t){const i=r[r.length-1],o=r.length>1?a(e,r.slice(0,-1))?.nodes:e;o&&(t?o.splice(i,n,t):o.splice(i,n))}function p({tree:e,nodes:r,mounting:n,partialIndex:t=[],keys:u=new Set,parent:s=["",0]}){return i.forEach(r,((r,i)=>{const d=o(r),f=d&&(Array.isArray(r.props.children)||o(r.props.children)),h=d&&r.type.isLively&&"id"in r.props,y=f&&(!r.type.isLively||r.props.traverseLayout),g=[...t,i],k=f&&!r.type.isLively?c(r,void 0,[]):r,[v,x]=s,j=h?r.props.id:`$l.${v?v+".":""}${g.slice(-x).join("")}`,w=l(e,j),E=w?a(e,w):void 0;E&&(h||E.key.startsWith("$l."))?(w&&w.join("")!==g.join("")&&(m(e,w,1),m(e,g,0,E)),E.node=k):n.set(j,{node:k,index:g}),y&&p({tree:e,nodes:r.props.children,mounting:n,partialIndex:g,keys:u,parent:h?[j,1]:x?[v,x+1]:void 0}),u.add(j)})),u}function f(e){const r=e.map((e=>o(e.node)?e.nodes.length?c(e.node,{key:e.key},f(e.nodes)):c(e.node,{key:e.key}):e.node));return r.length>1?r:r[0]}function h({children:i,transition:o,initialMount:c=!0}){const a=r(!c),h=r(null),[y,g]=n({}),k=r([]),v=r(new Map),x=r(void 0),j=r(0),w=r(new Set),E=p({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)if(n&&E.has(r))w.current.delete(r),e.current.trigger("mount",{immediate:!0}),e.current.timeline.mounted=!0;else if(n&&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&&m(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},n)=>{m(k.current,r,0,{key:n,node:e,nodes:[]})})),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,o),r.push(...e.current.children));a.current=!1})),e(u,{ref:h,passthrough:!0,cachable:[],children:f(k.current)})}export{h as default};
|
|
3
3
|
//# sourceMappingURL=layout-group.js.map
|
package/dist/layout/morph.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{
|
|
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
3
|
//# sourceMappingURL=morph.js.map
|
package/dist/layout/typable.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{
|
|
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
3
|
//# sourceMappingURL=typable.js.map
|