react-ui-animate 5.0.0-rc.9 → 5.0.1-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +0,0 @@
1
- import type { Descriptor } from './types';
2
- export declare function filterCallbackOptions(options: Record<string, any> | undefined, attach: boolean): Record<string, any>;
3
- export declare function isDescriptor(x: unknown): x is Descriptor;
@@ -1,2 +0,0 @@
1
- export { useValue } from './useValue';
2
- export { useMount } from './useMount';
@@ -1,16 +0,0 @@
1
- import { MotionValue } from '@raidipesh78/re-motion';
2
- import type { Primitive, Descriptor } from '../types';
3
- export type ConfigSingle<T extends Primitive> = {
4
- from?: T;
5
- enter?: T | Descriptor;
6
- exit?: T | Descriptor;
7
- };
8
- export type ConfigMulti<I extends Record<string, Primitive>> = {
9
- from: I;
10
- enter?: I | Descriptor;
11
- exit?: I | Descriptor;
12
- };
13
- export declare function useMount<T extends Primitive = number>(isOpen: boolean, config?: ConfigSingle<T>): (fn: (value: MotionValue<T>, mounted: boolean) => React.ReactNode) => React.ReactNode;
14
- export declare function useMount<I extends Record<string, Primitive>>(isOpen: boolean, config: ConfigMulti<I>): (fn: (values: {
15
- [K in keyof I]: MotionValue<I[K]>;
16
- }, mounted: boolean) => React.ReactNode) => React.ReactNode;
@@ -1,9 +0,0 @@
1
- import { MotionValue } from '@raidipesh78/re-motion';
2
- import type { Primitive, Descriptor, Controls } from '../types';
3
- type Widen<T> = T extends number ? number : T extends string ? string : T;
4
- type ValueReturn<T> = T extends Primitive ? MotionValue<Widen<T>> : T extends Primitive[] ? MotionValue<Widen<Primitive>>[] : {
5
- [K in keyof T]: MotionValue<Widen<T[K]>>;
6
- };
7
- type Base = Primitive | Primitive[] | Record<string, Primitive>;
8
- export declare function useValue<T extends Base>(initial: T): [ValueReturn<T>, (to: Base | Descriptor) => void, Controls];
9
- export {};
@@ -1,5 +0,0 @@
1
- export * from './hooks';
2
- export * from './modules';
3
- export * from './descriptors';
4
- export * from './Config';
5
- export * from './to';
@@ -1,17 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import type { MotionValue } from '@raidipesh78/re-motion';
3
- import type { Primitive } from '../types';
4
- import { type ConfigMulti, type ConfigSingle } from '../hooks/useMount';
5
- interface MountPropsSingle<T extends Primitive> extends Partial<ConfigSingle<T>> {
6
- state: boolean;
7
- children: (animation: MotionValue<T>) => ReactNode;
8
- }
9
- interface MountPropsMulti<I extends Record<string, Primitive>> extends ConfigMulti<I> {
10
- state: boolean;
11
- children: (animation: {
12
- [K in keyof I]: MotionValue<I[K]>;
13
- }) => ReactNode;
14
- }
15
- export declare function Mount<T extends Primitive = number>(props: MountPropsSingle<T>): JSX.Element;
16
- export declare function Mount<I extends Record<string, Primitive>>(props: MountPropsMulti<I>): JSX.Element;
17
- export {};
@@ -1 +0,0 @@
1
- export { Mount } from './Mount';
@@ -1,9 +0,0 @@
1
- type ExtrapolateType = 'identity' | 'extend' | 'clamp';
2
- interface ExtrapolateConfig {
3
- extrapolate?: ExtrapolateType;
4
- extrapolateRight?: ExtrapolateType;
5
- extrapolateLeft?: ExtrapolateType;
6
- easing?: (t: number) => number;
7
- }
8
- export declare function to(input: number, inRange: number[], outRange: (number | string)[], config?: ExtrapolateConfig): number | string;
9
- export {};
@@ -1,41 +0,0 @@
1
- export type Primitive = number | string;
2
- export interface Callbacks {
3
- onStart?: () => void;
4
- onChange?: (v: number) => void;
5
- onComplete?: () => void;
6
- }
7
- export interface SpringOptions {
8
- stiffness?: number;
9
- damping?: number;
10
- mass?: number;
11
- }
12
- export interface TimingOptions {
13
- duration?: number;
14
- easing?: (t: number) => number;
15
- }
16
- export interface DecayOptions {
17
- velocity?: number;
18
- }
19
- export interface SequenceOptions {
20
- animations?: Descriptor[];
21
- }
22
- export interface DelayOptions {
23
- delay?: number;
24
- }
25
- export interface LoopOptions {
26
- iterations?: number;
27
- animation?: Descriptor;
28
- }
29
- export type DriverType = 'spring' | 'timing' | 'decay' | 'delay' | 'sequence' | 'loop';
30
- export interface Descriptor {
31
- type: DriverType;
32
- to?: Primitive | Primitive[] | Record<string, Primitive>;
33
- options?: SpringOptions & TimingOptions & DecayOptions & SequenceOptions & DelayOptions & LoopOptions & Callbacks;
34
- }
35
- export interface Controls {
36
- start(): void;
37
- pause(): void;
38
- resume(): void;
39
- cancel(): void;
40
- reset(): void;
41
- }
@@ -1,47 +0,0 @@
1
- import { Gesture } from './Gesture';
2
- export interface DragEvent {
3
- down: boolean;
4
- movement: {
5
- x: number;
6
- y: number;
7
- };
8
- offset: {
9
- x: number;
10
- y: number;
11
- };
12
- velocity: {
13
- x: number;
14
- y: number;
15
- };
16
- event: PointerEvent;
17
- cancel: () => void;
18
- }
19
- export interface DragConfig {
20
- threshold?: number;
21
- axis?: 'x' | 'y';
22
- initial?: () => {
23
- x: number;
24
- y: number;
25
- };
26
- }
27
- export declare class DragGesture extends Gesture<DragEvent> {
28
- private config;
29
- private prev;
30
- private lastTime;
31
- private movement;
32
- private velocity;
33
- private start;
34
- private offset;
35
- private pointerCaptured;
36
- private activePointerId;
37
- private attachedEls;
38
- private activeEl;
39
- private pointerDownPos;
40
- private thresholdPassed;
41
- constructor(config?: DragConfig);
42
- attach(elements: HTMLElement | HTMLElement[] | Window): () => void;
43
- private onDown;
44
- private onMove;
45
- private onUp;
46
- cancel(): void;
47
- }
@@ -1,13 +0,0 @@
1
- type Listener<E> = (event: E) => void;
2
- export declare abstract class Gesture<E> {
3
- static readonly VELOCITY_LIMIT = 20;
4
- private changeListeners;
5
- private endListeners;
6
- onChange(listener: Listener<E>): this;
7
- onEnd(listener: Listener<E>): this;
8
- protected emitChange(event: E): void;
9
- protected emitEnd(event: E): void;
10
- abstract attach(elements: HTMLElement | HTMLElement | Window): () => void;
11
- abstract cancel(): void;
12
- }
13
- export {};
@@ -1,30 +0,0 @@
1
- import { Gesture } from './Gesture';
2
- export interface MoveEvent {
3
- movement: {
4
- x: number;
5
- y: number;
6
- };
7
- offset: {
8
- x: number;
9
- y: number;
10
- };
11
- velocity: {
12
- x: number;
13
- y: number;
14
- };
15
- event: PointerEvent;
16
- cancel?: () => void;
17
- }
18
- export declare class MoveGesture extends Gesture<MoveEvent> {
19
- private attachedEls;
20
- private prev;
21
- private lastTime;
22
- private movement;
23
- private offset;
24
- private velocity;
25
- private startPos;
26
- attach(elements: HTMLElement | HTMLElement[] | Window): () => void;
27
- cancel(): void;
28
- private onMove;
29
- private onLeave;
30
- }
@@ -1,29 +0,0 @@
1
- import { Gesture } from './Gesture';
2
- export interface ScrollEvent {
3
- movement: {
4
- x: number;
5
- y: number;
6
- };
7
- offset: {
8
- x: number;
9
- y: number;
10
- };
11
- velocity: {
12
- x: number;
13
- y: number;
14
- };
15
- event: Event;
16
- cancel?: () => void;
17
- }
18
- export declare class ScrollGesture extends Gesture<ScrollEvent> {
19
- private attachedEls;
20
- private movement;
21
- private offset;
22
- private velocity;
23
- private prevScroll;
24
- private lastTime;
25
- private endTimeout?;
26
- attach(elements: HTMLElement | HTMLElement[] | Window): () => void;
27
- cancel(): void;
28
- private onScroll;
29
- }
@@ -1,28 +0,0 @@
1
- import { Gesture } from './Gesture';
2
- export interface WheelEvent {
3
- movement: {
4
- x: number;
5
- y: number;
6
- };
7
- offset: {
8
- x: number;
9
- y: number;
10
- };
11
- velocity: {
12
- x: number;
13
- y: number;
14
- };
15
- event: globalThis.WheelEvent;
16
- cancel?: () => void;
17
- }
18
- export declare class WheelGesture extends Gesture<WheelEvent> {
19
- private attachedEls;
20
- private movement;
21
- private offset;
22
- private velocity;
23
- private lastTime;
24
- private endTimeout?;
25
- attach(elements: HTMLElement | HTMLElement[] | Window): () => void;
26
- cancel(): void;
27
- private onWheel;
28
- }
@@ -1,4 +0,0 @@
1
- export { useDrag } from './useDrag';
2
- export { useMove } from './useMove';
3
- export { useScroll } from './useScroll';
4
- export { useWheel } from './useWheel';
@@ -1,5 +0,0 @@
1
- import { RefObject } from 'react';
2
- import { type DragConfig, type DragEvent } from '../controllers/DragGesture';
3
- export declare function useDrag<T extends HTMLElement>(refs: RefObject<T> | Array<RefObject<T>>, onDrag: (e: DragEvent & {
4
- index: number;
5
- }) => void, config?: DragConfig): void;
@@ -1,8 +0,0 @@
1
- import { RefObject } from 'react';
2
- import { type MoveEvent } from '../controllers/MoveGesture';
3
- export declare function useMove(refs: Window, onMove: (e: MoveEvent & {
4
- index: 0;
5
- }) => void): void;
6
- export declare function useMove<T extends HTMLElement>(refs: RefObject<T> | Array<RefObject<T>>, onMove: (e: MoveEvent & {
7
- index: number;
8
- }) => void): void;
@@ -1,13 +0,0 @@
1
- import { RefObject } from 'react';
2
- interface GestureInstance<E> {
3
- onChange(handler: (event: E) => void): this;
4
- onEnd(handler: (event: E) => void): this;
5
- attach(target: Window | HTMLElement): () => void;
6
- }
7
- interface GestureConstructor<C, E> {
8
- new (config?: C): GestureInstance<E>;
9
- }
10
- export declare function useRecognizer<T extends HTMLElement, C, E>(GestureClass: GestureConstructor<C, E>, refs: Window | RefObject<T> | Array<RefObject<T>>, onEvent: (e: E & {
11
- index: number;
12
- }) => void, config?: C): void;
13
- export {};
@@ -1,8 +0,0 @@
1
- import { RefObject } from 'react';
2
- import { type ScrollEvent } from '../controllers/ScrollGesture';
3
- export declare function useScroll(refs: Window, onScroll: (e: ScrollEvent & {
4
- index: 0;
5
- }) => void): void;
6
- export declare function useScroll<T extends HTMLElement>(refs: RefObject<T> | Array<RefObject<T>>, onScroll: (e: ScrollEvent & {
7
- index: number;
8
- }) => void): void;
@@ -1,8 +0,0 @@
1
- import { RefObject } from 'react';
2
- import { type WheelEvent } from '../controllers/WheelGesture';
3
- export declare function useWheel(refs: Window, onWheel: (e: WheelEvent & {
4
- index: 0;
5
- }) => void): void;
6
- export declare function useWheel<T extends HTMLElement>(refs: RefObject<T> | Array<RefObject<T>>, onWheel: (e: WheelEvent & {
7
- index: number;
8
- }) => void): void;
@@ -1 +0,0 @@
1
- export * from './hooks';
@@ -1 +0,0 @@
1
- export { useOutsideClick } from './useOutsideClick';
@@ -1,2 +0,0 @@
1
- import { RefObject, DependencyList } from 'react';
2
- export declare function useOutsideClick(ref: RefObject<HTMLElement>, callback: (event: MouseEvent | TouchEvent) => void, deps?: DependencyList): void;
package/dist/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export { combine, Easing, makeMotion as makeAnimated, motion as animate, } from '@raidipesh78/re-motion';
2
- export * from './animation';
3
- export * from './hooks';
4
- export * from './gestures';
5
- export * from './utils';
package/dist/index.js DELETED
@@ -1,2 +0,0 @@
1
- var e=require("@raidipesh78/re-motion"),t=require("react"),n=require("react/jsx-runtime"),o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var r=function(){return r=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)};function f(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(e);i<o.length;i++)t.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(n[o[i]]=e[o[i]])}return n}function a(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,i,r=n.call(e),f=[];try{for(;(void 0===t||t-- >0)&&!(o=r.next()).done;)f.push(o.value)}catch(e){i={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return f}function s(e,t,n){if(n||2===arguments.length)for(var o,i=0,r=t.length;i<r;i++)!o&&i in t||(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))}function l(e,t){return void 0===e&&(e={}),t?e:(e.onStart,e.onChange,e.onComplete,f(e,["onStart","onChange","onComplete"]))}function u(e){return"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type}function c(t,n){var o,i,r=n.type,f=n.to,a=n.options,s=void 0===a?{}:a;switch(r){case"spring":return e.spring(t,f,s);case"timing":return e.timing(t,f,s);case"decay":return e.decay(t,null!==(o=s.velocity)&&void 0!==o?o:0,s);case"delay":return e.delay(null!==(i=s.delay)&&void 0!==i?i:0);default:return console.warn("Unsupported animation type: ".concat(r)),{start:function(){},pause:function(){},resume:function(){},cancel:function(){},reset:function(){}}}}function d(t,n){var o=Object.entries(t).filter((function(e){var t=a(e,1)[0];return"decay"===n.type||"delay"===n.type||void 0!==n.to[t]})).map((function(e,t){var o=a(e,2),i=o[0];return c(o[1],{type:n.type,to:"decay"===n.type||"delay"===n.type?n.to:n.to[i],options:l(n.options,0===t)})}));return e.parallel(o)}function p(n){var o=t.useRef(null),i=t.useMemo((function(){return Array.isArray(n)?n.map((function(t){return new e.MotionValue(t)})):"object"==typeof n?Object.fromEntries(Object.entries(n).map((function(t){var n=a(t,2),o=n[0],i=n[1];return[o,new e.MotionValue(i)]}))):new e.MotionValue(n)}),[]);return[i,function(t){var f=null;f=Array.isArray(n)?function(t,n){var o,i;if(!u(n))return n.forEach((function(e,n){var o;null===(o=t[n])||void 0===o||o.set(e)})),null;var f=n,a=Object.fromEntries(t.map((function(e,t){return[t.toString(),e]})));switch(f.type){case"sequence":var s=f.options.animations.map((function(t){var n,o;return"delay"===t.type?e.delay(null!==(o=null===(n=t.options)||void 0===n?void 0:n.delay)&&void 0!==o?o:0):d(a,r(r({},t),{to:Array.isArray(t.to)?Object.fromEntries(t.to.map((function(e,t){return[t.toString(),e]}))):t.to}))}));return e.sequence(s,f.options);case"loop":var c=f.options.animation;if("sequence"===c.type){var p=c.options.animations.map((function(e){return d(a,r(r({},e),{to:Array.isArray(e.to)?Object.fromEntries(e.to.map((function(e,t){return[t.toString(),e]}))):e.to}))})),v=e.sequence(p,l(c.options,!0));return e.loop(v,null!==(o=f.options.iterations)&&void 0!==o?o:0,l(f.options,!0))}var h=d(a,c);return e.loop(h,null!==(i=f.options.iterations)&&void 0!==i?i:0,l(f.options,!0));default:return d(a,f)}}(i,t):"object"==typeof n?function(t,n){var o,i;if(u(n))switch(n.type){case"sequence":var r=n.options.animations.map((function(n){var o;return"delay"===n.type?e.delay(null!==(o=n.options.delay)&&void 0!==o?o:0):d(t,n)}));return e.sequence(r,n.options);case"loop":var f=n.options.animation;if("sequence"===f.type){r=f.options.animations.map((function(e){return d(t,e)}));return e.loop(e.sequence(r,l(f.options,!0)),null!==(o=n.options.iterations)&&void 0!==o?o:0,l(n.options,!0))}return e.loop(d(t,f),null!==(i=n.options.iterations)&&void 0!==i?i:0,l(n.options,!0));default:return d(t,n)}return Object.entries(n).forEach((function(e){var n,o=a(e,2),i=o[0],r=o[1];null===(n=t[i])||void 0===n||n.set(r)})),null}(i,t):function(t,n){var o,i,r,f,a,s,l,u,d;if("number"==typeof n||"string"==typeof n)return t.set(n),null;if("sequence"===n.type){var p=(null!==(i=null===(o=n.options)||void 0===o?void 0:o.animations)&&void 0!==i?i:[]).map((function(e){return c(t,e)}));return e.sequence(p,n.options)}if("loop"===n.type){var v=null===(r=n.options)||void 0===r?void 0:r.animation;if(!v)return null;if("sequence"===v.type){p=(null!==(a=null===(f=v.options)||void 0===f?void 0:f.animations)&&void 0!==a?a:[]).map((function(e){return c(t,e)}));return e.loop(e.sequence(p),null!==(l=null===(s=n.options)||void 0===s?void 0:s.iterations)&&void 0!==l?l:0,n.options)}return e.loop(c(t,v),null!==(d=null===(u=n.options)||void 0===u?void 0:u.iterations)&&void 0!==d?d:0,n.options)}return c(t,n)}(i,t),o.current=f,f&&f.start()},{start:function(){var e;return null===(e=o.current)||void 0===e?void 0:e.start()},pause:function(){var e;return null===(e=o.current)||void 0===e?void 0:e.pause()},resume:function(){var e;return null===(e=o.current)||void 0===e?void 0:e.resume()},cancel:function(){var e;return null===(e=o.current)||void 0===e?void 0:e.cancel()},reset:function(){var e;return null===(e=o.current)||void 0===e?void 0:e.reset()}}]}"function"==typeof SuppressedError&&SuppressedError;var v={Timing:{BOUNCE:{duration:500,easing:e.Easing.bounce},EASE_IN:{duration:500,easing:e.Easing.in(e.Easing.ease)},EASE_OUT:{duration:500,easing:e.Easing.out(e.Easing.ease)},EASE_IN_OUT:{duration:500,easing:e.Easing.inOut(e.Easing.ease)},POWER1:{duration:500,easing:e.Easing.bezier(.17,.42,.51,.97)},POWER2:{duration:500,easing:e.Easing.bezier(.07,.11,.13,1)},POWER3:{duration:500,easing:e.Easing.bezier(.09,.7,.16,1.04)},POWER4:{duration:500,easing:e.Easing.bezier(.05,.54,0,1.03)},LINEAR:{duration:500,easing:e.Easing.linear}},Spring:{ELASTIC:{mass:1,damping:18,stiffness:250},EASE:{mass:1,damping:20,stiffness:158},STIFF:{mass:1,damping:18,stiffness:350},WOBBLE:{mass:1,damping:8,stiffness:250}}},h=function(e,t){var n,o,i;return{type:"spring",to:e,options:{stiffness:null!==(n=null==t?void 0:t.stiffness)&&void 0!==n?n:v.Spring.EASE.stiffness,damping:null!==(o=null==t?void 0:t.damping)&&void 0!==o?o:v.Spring.EASE.damping,mass:null!==(i=null==t?void 0:t.mass)&&void 0!==i?i:v.Spring.EASE.mass,onStart:null==t?void 0:t.onStart,onChange:null==t?void 0:t.onChange,onComplete:null==t?void 0:t.onComplete}}};function m(e,n){var o,i,f;void 0===n&&(n={});var s=a(t.useState(e),2),l=s[0],c=s[1],d=null!==(o=n.from)&&void 0!==o?o:0,v=null!==(i=n.enter)&&void 0!==i?i:1,m=null!==(f=n.exit)&&void 0!==f?f:0,y=a(p(d),2),g=y[0],b=y[1];return t.useLayoutEffect((function(){e?(c(!0),queueMicrotask((function(){b(u(v)?v:h(v))}))):queueMicrotask((function(){b(u(m)?r(r({},m),{options:r(r({},m.options),{onComplete:function(){var e,t;null===(t=null===(e=m.options)||void 0===e?void 0:e.onComplete)||void 0===t||t.call(e),c(!1)}})}):h(m,{onComplete:function(){c(!1)}}))}))}),[e,JSON.stringify(v),JSON.stringify(m)]),function(e){return e(g,l)}}var y={transparent:"#00000000",aliceblue:"#f0f8ffff",antiquewhite:"#faebd7ff",aqua:"#00ffffff",aquamarine:"#7fffd4ff",azure:"#f0ffffff",beige:"#f5f5dcff",bisque:"#ffe4c4ff",black:"#000000ff",blanchedalmond:"#ffebcdff",blue:"#0000ffff",blueviolet:"#8a2be2ff",brown:"#a52a2aff",burlywood:"#deb887ff",burntsienna:"#ea7e5dff",cadetblue:"#5f9ea0ff",chartreuse:"#7fff00ff",chocolate:"#d2691eff",coral:"#ff7f50ff",cornflowerblue:"#6495edff",cornsilk:"#fff8dcff",crimson:"#dc143cff",cyan:"#00ffffff",darkblue:"#00008bff",darkcyan:"#008b8bff",darkgoldenrod:"#b8860bff",darkgray:"#a9a9a9ff",darkgreen:"#006400ff",darkgrey:"#a9a9a9ff",darkkhaki:"#bdb76bff",darkmagenta:"#8b008bff",darkolivegreen:"#556b2fff",darkorange:"#ff8c00ff",darkorchid:"#9932ccff",darkred:"#8b0000ff",darksalmon:"#e9967aff",darkseagreen:"#8fbc8fff",darkslateblue:"#483d8bff",darkslategray:"#2f4f4fff",darkslategrey:"#2f4f4fff",darkturquoise:"#00ced1ff",darkviolet:"#9400d3ff",deeppink:"#ff1493ff",deepskyblue:"#00bfffff",dimgray:"#696969ff",dimgrey:"#696969ff",dodgerblue:"#1e90ffff",firebrick:"#b22222ff",floralwhite:"#fffaf0ff",forestgreen:"#228b22ff",fuchsia:"#ff00ffff",gainsboro:"#dcdcdcff",ghostwhite:"#f8f8ffff",gold:"#ffd700ff",goldenrod:"#daa520ff",gray:"#808080ff",green:"#008000ff",greenyellow:"#adff2fff",grey:"#808080ff",honeydew:"#f0fff0ff",hotpink:"#ff69b4ff",indianred:"#cd5c5cff",indigo:"#4b0082ff",ivory:"#fffff0ff",khaki:"#f0e68cff",lavender:"#e6e6faff",lavenderblush:"#fff0f5ff",lawngreen:"#7cfc00ff",lemonchiffon:"#fffacdff",lightblue:"#add8e6ff",lightcoral:"#f08080ff",lightcyan:"#e0ffffff",lightgoldenrodyellow:"#fafad2ff",lightgray:"#d3d3d3ff",lightgreen:"#90ee90ff",lightgrey:"#d3d3d3ff",lightpink:"#ffb6c1ff",lightsalmon:"#ffa07aff",lightseagreen:"#20b2aaff",lightskyblue:"#87cefaff",lightslategray:"#778899ff",lightslategrey:"#778899ff",lightsteelblue:"#b0c4deff",lightyellow:"#ffffe0ff",lime:"#00ff00ff",limegreen:"#32cd32ff",linen:"#faf0e6ff",magenta:"#ff00ffff",maroon:"#800000ff",mediumaquamarine:"#66cdaaff",mediumblue:"#0000cdff",mediumorchid:"#ba55d3ff",mediumpurple:"#9370dbff",mediumseagreen:"#3cb371ff",mediumslateblue:"#7b68eeff",mediumspringgreen:"#00fa9aff",mediumturquoise:"#48d1ccff",mediumvioletred:"#c71585ff",midnightblue:"#191970ff",mintcream:"#f5fffaff",mistyrose:"#ffe4e1ff",moccasin:"#ffe4b5ff",navajowhite:"#ffdeadff",navy:"#000080ff",oldlace:"#fdf5e6ff",olive:"#808000ff",olivedrab:"#6b8e23ff",orange:"#ffa500ff",orangered:"#ff4500ff",orchid:"#da70d6ff",palegoldenrod:"#eee8aaff",palegreen:"#98fb98ff",paleturquoise:"#afeeeeff",palevioletred:"#db7093ff",papayawhip:"#ffefd5ff",peachpuff:"#ffdab9ff",peru:"#cd853fff",pink:"#ffc0cbff",plum:"#dda0ddff",powderblue:"#b0e0e6ff",purple:"#800080ff",rebeccapurple:"#663399ff",red:"#ff0000ff",rosybrown:"#bc8f8fff",royalblue:"#4169e1ff",saddlebrown:"#8b4513ff",salmon:"#fa8072ff",sandybrown:"#f4a460ff",seagreen:"#2e8b57ff",seashell:"#fff5eeff",sienna:"#a0522dff",silver:"#c0c0c0ff",skyblue:"#87ceebff",slateblue:"#6a5acdff",slategray:"#708090ff",slategrey:"#708090ff",snow:"#fffafaff",springgreen:"#00ff7fff",steelblue:"#4682b4ff",tan:"#d2b48cff",teal:"#008080ff",thistle:"#d8bfd8ff",tomato:"#ff6347ff",turquoise:"#40e0d0ff",violet:"#ee82eeff",wheat:"#f5deb3ff",white:"#ffffffff",whitesmoke:"#f5f5f5ff",yellow:"#ffff00ff",yellowgreen:"#9acd32ff"},g=/-?\d+(\.\d+)?/g,b=/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,E=/^rgba?\(\s*-?\d+(\.\d+)?%?(?:\s*,\s*-?\d+(\.\d+)?%?){2}(?:\s*,\s*(0|1|0?\.\d+))?\s*\)$/i,w=/^hsla?\(\s*\d+(\.\d+)?(?:\s*,\s*\d+(\.\d+)?%){2}(?:\s*,\s*(0|1|0?\.\d+))?\s*\)$/i;function x(e){var t=e.trim().toLowerCase();return b.test(t)||E.test(t)||w.test(t)||void 0!==y[t]}function T(e){var t,n,o,i,r,f,l=e.trim().toLowerCase();if(y[l]&&(l=y[l]),b.test(l)){var u=l.slice(1);3===u.length?u=u[0]+u[0]+u[1]+u[1]+u[2]+u[2]:4===u.length&&(u=u[0]+u[0]+u[1]+u[1]+u[2]+u[2]+u[3]+u[3]);var c=8===u.length,d=parseInt(u,16);return[h=d>>(c?24:16)&255,m=d>>(c?16:8)&255,x=d>>(c?8:0)&255,M=c?(255&d)/255:1]}if(E.test(l)){var p=s([],a(l.matchAll(g)),!1).map((function(e){return+e[0]})),v=a(p,4),h=v[0],m=v[1],x=v[2],T=v[3];return[h,m,x,M=void 0===T?1:T]}if(w.test(l)){p=s([],a(l.matchAll(g)),!1).map((function(e){return+e[0]}));var L=a(p,4),I=L[0],C=L[1],S=L[2],O=L[3],M=void 0===O?1:O;C/=100,S/=100;var k=(1-Math.abs(2*S-1))*C,P=k*(1-Math.abs(I/60%2-1)),A=S-k/2,Y=a([0,0,0],3),_=Y[0],q=Y[1],j=Y[2];return I<60?(_=(t=a([k,P,0],3))[0],q=t[1],j=t[2]):I<120?(_=(n=a([P,k,0],3))[0],q=n[1],j=n[2]):I<180?(_=(o=a([0,k,P],3))[0],q=o[1],j=o[2]):I<240?(_=(i=a([0,P,k],3))[0],q=i[1],j=i[2]):I<300?(_=(r=a([P,0,k],3))[0],q=r[1],j=r[2]):(_=(f=a([k,0,P],3))[0],q=f[1],j=f[2]),[Math.round(255*(_+A)),Math.round(255*(q+A)),Math.round(255*(j+A)),M]}throw new Error("Unrecognized CSS color: ".concat(e))}function L(e,t,n){var o=/^([a-zA-Z$_][\w$]*)\((-?\d*\.?\d+)([a-zA-Z%]*)\)$/,i=e.match(o),r=t.match(o);if(i&&r&&i[1]===r[1]&&i[3]===r[3]){var f=i[1],s=parseFloat(i[2]),l=parseFloat(r[2]),u=i[3],c=s+(l-s)*n;return"".concat(f,"(").concat(c.toFixed(3)).concat(u,")")}if(x(e)&&x(t)){var d=T(e),p=T(t),v=a(d,4),h=v[0],m=v[1],y=v[2],g=v[3],b=a(p,4),E=b[0],w=b[1],I=b[2],C=b[3],S=Math.round(h+(E-h)*n),O=Math.round(m+(w-m)*n),M=Math.round(y+(I-y)*n),k=g+(C-g)*n;return k<1?"rgba(".concat(S,",").concat(O,",").concat(M,",").concat(k.toFixed(3),")"):"rgb(".concat(S,",").concat(O,",").concat(M,")")}var P=e.split(/(\s+)/),A=t.split(/(\s+)/);if(P.length!==A.length)throw new Error('interpolate: template mismatch:\n "'.concat(e,'"\n vs "').concat(t,'"'));var Y=/^(-?\d+(\.\d+)?)([a-zA-Z%]*)$/;return P.map((function(e,t){var o=A[t];if(e===o&&/\s+/.test(e))return function(){return e};var i=e.match(Y),r=o.match(Y);if(i&&r&&i[3]===r[3]){var f=parseFloat(i[1]),a=parseFloat(r[1]),s=i[3];return function(){return"".concat((f+(a-f)*n).toFixed(3)).concat(s)}}if(x(e)&&x(o))return function(){return L(e,o,n)};if(e===o)return function(){return e};throw new Error('interpolate: cannot interpolate tokens "'.concat(e,'" vs "').concat(o,'"'))})).map((function(e){return e()})).join("")}function I(e,t,n){return Math.min(Math.max(e,t),n)}function C(e,t,n){return 0===t||Math.abs(t)===1/0?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}var S=function(){function e(){this.changeListeners=new Set,this.endListeners=new Set}return e.prototype.onChange=function(e){return this.changeListeners.add(e),this},e.prototype.onEnd=function(e){return this.endListeners.add(e),this},e.prototype.emitChange=function(e){this.changeListeners.forEach((function(t){return t(e)}))},e.prototype.emitEnd=function(e){this.endListeners.forEach((function(t){return t(e)}))},e.VELOCITY_LIMIT=20,e}(),O=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.prev={x:0,y:0},n.lastTime=0,n.movement={x:0,y:0},n.velocity={x:0,y:0},n.start={x:0,y:0},n.offset={x:0,y:0},n.pointerCaptured=!1,n.activePointerId=null,n.attachedEls=new Set,n.activeEl=null,n.pointerDownPos={x:0,y:0},n.thresholdPassed=!1,n.config=t,n}return i(t,e),t.prototype.attach=function(e){var t=this;if(e===window)return function(){};var n=Array.isArray(e)?e:[e],o=this.onDown.bind(this),i=this.onMove.bind(this),r=this.onUp.bind(this);return n.forEach((function(e){t.attachedEls.add(e),e.addEventListener("pointerdown",o,{passive:!1})})),window.addEventListener("pointermove",i,{passive:!1}),window.addEventListener("pointerup",r),window.addEventListener("pointercancel",r),function(){n.forEach((function(e){e.removeEventListener("pointerdown",o),t.attachedEls.delete(e)})),window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",r),window.removeEventListener("pointercancel",r)}},t.prototype.onDown=function(e){var t,n,o;if(0===e.button){var i=e.currentTarget;this.attachedEls.has(i)&&(this.activeEl=i,this.activePointerId=e.pointerId,this.pointerCaptured=!1,this.start=!1===this.thresholdPassed&&0===this.start.x&&0===this.start.y?null!==(o=null===(n=(t=this.config).initial)||void 0===n?void 0:n.call(t))&&void 0!==o?o:{x:0,y:0}:r({},this.offset),this.offset=r({},this.start),this.pointerDownPos={x:e.clientX,y:e.clientY},this.thresholdPassed=!1,this.prev={x:e.clientX,y:e.clientY},this.lastTime=e.timeStamp,this.emitChange({down:!0,movement:{x:0,y:0},offset:r({},this.offset),velocity:{x:0,y:0},event:e,cancel:this.cancel.bind(this)}))}},t.prototype.onMove=function(e){var t;if(this.activePointerId===e.pointerId&&this.activeEl){var n=null!==(t=this.config.threshold)&&void 0!==t?t:0;if(!this.thresholdPassed){var o=e.clientX-this.pointerDownPos.x,i=e.clientY-this.pointerDownPos.y;if(Math.hypot(o,i)<n)return;this.thresholdPassed=!0,this.activeEl.setPointerCapture(e.pointerId),this.pointerCaptured=!0}this.pointerCaptured&&e.preventDefault();var f=Math.max((e.timeStamp-this.lastTime)/1e3,1e-6);this.lastTime=e.timeStamp;var a=(e.clientX-this.prev.x)/f/1e3,s=(e.clientY-this.prev.y)/f/1e3;this.velocity={x:I(a,-S.VELOCITY_LIMIT,S.VELOCITY_LIMIT),y:I(s,-S.VELOCITY_LIMIT,S.VELOCITY_LIMIT)};var l={x:e.clientX-this.pointerDownPos.x,y:e.clientY-this.pointerDownPos.y};this.movement={x:"y"===this.config.axis?0:l.x,y:"x"===this.config.axis?0:l.y},this.offset={x:this.start.x+this.movement.x,y:this.start.y+this.movement.y},this.prev={x:e.clientX,y:e.clientY},this.emitChange({down:!0,movement:r({},this.movement),offset:r({},this.offset),velocity:r({},this.velocity),event:e,cancel:this.cancel.bind(this)})}},t.prototype.onUp=function(e){this.activePointerId===e.pointerId&&this.activeEl&&(this.activeEl.releasePointerCapture(e.pointerId),this.emitEnd({down:!1,movement:r({},this.movement),offset:r({},this.offset),velocity:r({},this.velocity),event:e,cancel:this.cancel.bind(this)}),this.activePointerId=null,this.pointerCaptured=!1)},t.prototype.cancel=function(){this.activeEl&&null!==this.activePointerId&&(this.activeEl.releasePointerCapture(this.activePointerId),this.activePointerId=null,this.activeEl=null)},t}(S);function M(e,n,o,i){var f=k(o),a=k(i);if(n!==window){var s=Array.isArray(n)?n:[n],l=t.useRef([]);l.current.length!==s.length&&(l.current=s.map((function(t,n){var o=new e(a.current),i=function(e){return f.current(r(r({},e),{index:n}))};return o.onChange(i).onEnd(i),o}))),t.useEffect((function(){var e=s.map((function(e,t){var n=e.current;return n?l.current[t].attach(n):null})).filter((function(e){return!!e}));return function(){return e.forEach((function(e){return e()}))}}),[s.map((function(e){return e.current}))])}else{var u=t.useRef();if(!u.current){var c=new e(a.current),d=function(e){return f.current(r(r({},e),{index:0}))};c.onChange(d).onEnd(d),u.current=c}t.useEffect((function(){var e=u.current.attach(window);return function(){e()}}),[n])}}function k(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),n}var P=function(e){function t(){var t=e.apply(this,s([],a(arguments),!1))||this;return t.attachedEls=new Set,t.prev={x:0,y:0},t.lastTime=0,t.movement={x:0,y:0},t.offset={x:0,y:0},t.velocity={x:0,y:0},t.startPos=null,t}return i(t,e),t.prototype.attach=function(e){var t=this,n=Array.isArray(e)?e:[e],o=this.onMove.bind(this),i=this.onLeave.bind(this);return n.forEach((function(e){t.attachedEls.add(e),e.addEventListener("pointermove",o,{passive:!1}),e.addEventListener("pointerleave",i)})),function(){n.forEach((function(e){e.removeEventListener("pointermove",o),e.removeEventListener("pointerleave",i),t.attachedEls.delete(e)}))}},t.prototype.cancel=function(){},t.prototype.onMove=function(e){var t=this,n=e.timeStamp;null===this.startPos&&(this.startPos={x:e.clientX,y:e.clientY},this.prev={x:e.clientX,y:e.clientY},this.lastTime=n);var o=Math.max((n-this.lastTime)/1e3,1e-6);this.lastTime=n;var i=e.clientX-this.prev.x,f=e.clientY-this.prev.y;this.prev={x:e.clientX,y:e.clientY},this.movement={x:e.clientX-this.startPos.x,y:e.clientY-this.startPos.y};var a=e.currentTarget,s=a instanceof HTMLElement?a.getBoundingClientRect():{left:0,top:0};this.offset={x:e.clientX-s.left,y:e.clientY-s.top};var l=i/o/1e3,u=f/o/1e3;this.velocity={x:I(l,-S.VELOCITY_LIMIT,S.VELOCITY_LIMIT),y:I(u,-S.VELOCITY_LIMIT,S.VELOCITY_LIMIT)},this.emitChange({movement:r({},this.movement),offset:r({},this.offset),velocity:r({},this.velocity),event:e,cancel:function(){return t.onLeave(e)}})},t.prototype.onLeave=function(e){this.emitEnd({movement:r({},this.movement),offset:r({},this.offset),velocity:r({},this.velocity),event:e,cancel:function(){}})},t}(S);var A=function(e){function t(){var t=e.apply(this,s([],a(arguments),!1))||this;return t.attachedEls=new Set,t.movement={x:0,y:0},t.offset={x:0,y:0},t.velocity={x:0,y:0},t.prevScroll={x:0,y:0},t.lastTime=0,t}return i(t,e),t.prototype.attach=function(e){var t=this,n=Array.isArray(e)?e:[e],o=this.onScroll.bind(this);return n.forEach((function(e){t.attachedEls.add(e),e.addEventListener("scroll",o,{passive:!0})})),function(){n.forEach((function(e){e.removeEventListener("scroll",o),t.attachedEls.delete(e)})),null!=t.endTimeout&&(clearTimeout(t.endTimeout),t.endTimeout=void 0)}},t.prototype.cancel=function(){},t.prototype.onScroll=function(e){var t=this,n=Date.now(),o=Math.max((n-this.lastTime)/1e3,1e-6);this.lastTime=n;var i=e.currentTarget,f=i instanceof HTMLElement?i.scrollLeft:window.scrollX,a=i instanceof HTMLElement?i.scrollTop:window.scrollY,s=f-this.prevScroll.x,l=a-this.prevScroll.y;this.prevScroll={x:f,y:a},this.movement={x:s,y:l},this.offset={x:f,y:a};var u=s/o/1e3,c=l/o/1e3;this.velocity={x:I(u,-S.VELOCITY_LIMIT,S.VELOCITY_LIMIT),y:I(c,-S.VELOCITY_LIMIT,S.VELOCITY_LIMIT)},this.emitChange({movement:r({},this.movement),offset:r({},this.offset),velocity:r({},this.velocity),event:e,cancel:function(){null!=t.endTimeout&&clearTimeout(t.endTimeout)}}),null!=this.endTimeout&&clearTimeout(this.endTimeout),this.endTimeout=window.setTimeout((function(){t.emitEnd({movement:r({},t.movement),offset:r({},t.offset),velocity:r({},t.velocity),event:e,cancel:function(){}})}),150)},t}(S);var Y=function(e){function t(){var t=e.apply(this,s([],a(arguments),!1))||this;return t.attachedEls=new Set,t.movement={x:0,y:0},t.offset={x:0,y:0},t.velocity={x:0,y:0},t.lastTime=0,t}return i(t,e),t.prototype.attach=function(e){var t=this,n=Array.isArray(e)?e:[e],o=this.onWheel.bind(this);return n.forEach((function(e){t.attachedEls.add(e),e.addEventListener("wheel",o,{passive:!1})})),function(){n.forEach((function(e){e.removeEventListener("wheel",o),t.attachedEls.delete(e)})),null!=t.endTimeout&&(clearTimeout(t.endTimeout),t.endTimeout=void 0)}},t.prototype.cancel=function(){},t.prototype.onWheel=function(e){var t=this;e.preventDefault();var n=e.timeStamp,o=Math.max((n-this.lastTime)/1e3,1e-6);this.lastTime=n;var i=e.deltaX,f=e.deltaY;this.movement={x:i,y:f},this.offset.x+=i,this.offset.y+=f;var a=i/o/1e3,s=f/o/1e3;this.velocity={x:I(a,-S.VELOCITY_LIMIT,S.VELOCITY_LIMIT),y:I(s,-S.VELOCITY_LIMIT,S.VELOCITY_LIMIT)},this.emitChange({movement:r({},this.movement),offset:r({},this.offset),velocity:r({},this.velocity),event:e,cancel:function(){null!=t.endTimeout&&clearTimeout(t.endTimeout)}}),null!=this.endTimeout&&clearTimeout(this.endTimeout),this.endTimeout=window.setTimeout((function(){t.emitEnd({movement:r({},t.movement),offset:r({},t.offset),velocity:r({},t.velocity),event:e,cancel:function(){}})}),150)},t}(S);Object.defineProperty(exports,"Easing",{enumerable:!0,get:function(){return e.Easing}}),Object.defineProperty(exports,"animate",{enumerable:!0,get:function(){return e.motion}}),Object.defineProperty(exports,"combine",{enumerable:!0,get:function(){return e.combine}}),Object.defineProperty(exports,"makeAnimated",{enumerable:!0,get:function(){return e.makeMotion}}),exports.Config=v,exports.Mount=function(e){var t=e.state,o=e.children,i=m(t,f(e,["state","children"]));return n.jsx(n.Fragment,{children:i((function(e,t){return t&&o(e)}))})},exports.clamp=I,exports.move=function(e,t,n){var o=e[t],i=e.length,r=t-n;if(r>0)return s(s(s(s([],a(e.slice(0,n)),!1),[o],!1),a(e.slice(n,t)),!1),a(e.slice(t+1,i)),!1);if(r<0){var f=n+1;return s(s(s(s([],a(e.slice(0,t)),!1),a(e.slice(t+1,f)),!1),[o],!1),a(e.slice(f,i)),!1)}return e},exports.rubberClamp=function(e,t,n,o){return void 0===o&&(o=.15),0===o?I(e,t,n):e<t?-C(t-e,n-t,o)+t:e>n?+C(e-n,n-t,o)+n:e},exports.snapTo=function(e,t,n){var o=e+.2*t,i=function(e){return Math.abs(e-o)},r=n.map(i),f=Math.min.apply(Math,s([],a(r),!1));return n.reduce((function(e,t){return i(t)===f?t:e}))},exports.to=function(e,t,n,o){var i,r,f,a,s=t.length;if(s<2||n.length!==s)throw new Error("interpolate: inRange and outRange must be arrays of the same length >= 2");var l=null!==(r=null!==(i=null==o?void 0:o.extrapolateLeft)&&void 0!==i?i:null==o?void 0:o.extrapolate)&&void 0!==r?r:"extend",u=null!==(a=null!==(f=null==o?void 0:o.extrapolateRight)&&void 0!==f?f:null==o?void 0:o.extrapolate)&&void 0!==a?a:"extend";return function(e){var i=e;e<t[0]&&"clamp"===l?i=t[0]:e>t[s-1]&&"clamp"===u&&(i=t[s-1]);var r=0;if(i<=t[0])r=0;else if(i>=t[s-1])r=s-2;else for(var f=0;f<s-1;f++)if(i>=t[f]&&i<=t[f+1]){r=f;break}var a=t[r],c=(i-a)/(t[r+1]-a);(null==o?void 0:o.easing)&&(c=o.easing(c));var d=n[r],p=n[r+1];return"number"==typeof d&&"number"==typeof p?d+(p-d)*c:L(String(d),String(p),c)}(e)},exports.useDrag=function(e,t,n){return M(O,e,t,n)},exports.useMount=m,exports.useMove=function(e,t){return M(P,e,t)},exports.useOutsideClick=function(e,n,o){void 0===o&&(o=[]);var i=t.useRef(n);t.useEffect((function(){i.current=n}),s([n],a(o),!1)),t.useEffect((function(){function t(t){var n=e.current,o=t.target;n&&o&&o.isConnected&&(n.contains(o)||i.current(t))}return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),function(){document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}),[e])},exports.useScroll=function(e,t){return M(A,e,t)},exports.useValue=p,exports.useWheel=function(e,t){return M(Y,e,t)},exports.withDecay=function(e,t){return{type:"decay",options:{velocity:e,onStart:null==t?void 0:t.onStart,onChange:null==t?void 0:t.onChange,onComplete:null==t?void 0:t.onComplete}}},exports.withDelay=function(e){return{type:"delay",options:{delay:e}}},exports.withLoop=function(e,t,n){return void 0===t&&(t=1/0),{type:"loop",options:{animation:e,iterations:t,onStart:null==n?void 0:n.onStart,onComplete:null==n?void 0:n.onComplete}}},exports.withSequence=function(e,t){return{type:"sequence",options:{animations:e,onStart:null==t?void 0:t.onStart,onComplete:null==t?void 0:t.onComplete}}},exports.withSpring=h,exports.withTiming=function(e,t){return{type:"timing",to:e,options:{duration:null==t?void 0:t.duration,easing:null==t?void 0:t.easing,onStart:null==t?void 0:t.onStart,onChange:null==t?void 0:t.onChange,onComplete:null==t?void 0:t.onComplete}}};
2
- //# sourceMappingURL=index.js.map