@ssgoi/core 0.0.3 → 2.1.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.
- package/README.md +252 -23
- package/dist/animator.d.ts +28 -17
- package/dist/animator.d.ts.map +1 -1
- package/dist/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/create-transition-callback.d.ts +3 -32
- package/dist/create-transition-callback.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +374 -213
- package/dist/presets/index.cjs +1 -0
- package/dist/presets/index.d.ts +16 -0
- package/dist/presets/index.d.ts.map +1 -0
- package/dist/presets/index.js +35 -0
- package/dist/transition-strategy.d.ts +60 -0
- package/dist/transition-strategy.d.ts.map +1 -0
- package/dist/transition.d.ts +55 -11
- package/dist/transition.d.ts.map +1 -1
- package/dist/transitions/blur.d.ts +5 -1
- package/dist/transitions/blur.d.ts.map +1 -1
- package/dist/transitions/bounce.d.ts +5 -0
- package/dist/transitions/bounce.d.ts.map +1 -1
- package/dist/transitions/fade.d.ts +3 -0
- package/dist/transitions/fade.d.ts.map +1 -1
- package/dist/transitions/fly.d.ts +30 -0
- package/dist/transitions/fly.d.ts.map +1 -0
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.d.ts +1 -0
- package/dist/transitions/index.d.ts.map +1 -1
- package/dist/transitions/index.js +200 -120
- package/dist/transitions/none.d.ts +3 -0
- package/dist/transitions/none.d.ts.map +1 -1
- package/dist/transitions/rotate.d.ts +6 -0
- package/dist/transitions/rotate.d.ts.map +1 -1
- package/dist/transitions/scale.d.ts +6 -3
- package/dist/transitions/scale.d.ts.map +1 -1
- package/dist/transitions/slide.d.ts +6 -1
- package/dist/transitions/slide.d.ts.map +1 -1
- package/dist/types.d.ts +19 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/utils-8Eptbv7c.cjs +2 -0
- package/dist/utils-DTRMUQW4.js +31 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/view-transitions/drill.d.ts +9 -0
- package/dist/view-transitions/drill.d.ts.map +1 -0
- package/dist/view-transitions/fade.d.ts +3 -1
- package/dist/view-transitions/fade.d.ts.map +1 -1
- package/dist/view-transitions/hero.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +1 -1
- package/dist/view-transitions/index.d.ts +2 -1
- package/dist/view-transitions/index.d.ts.map +1 -1
- package/dist/view-transitions/index.js +233 -177
- package/dist/view-transitions/scroll.d.ts +8 -0
- package/dist/view-transitions/scroll.d.ts.map +1 -0
- package/package.json +28 -10
- package/dist/utils-BSgyev81.cjs +0 -1
- package/dist/utils-DR41YsAh.js +0 -16
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SpringConfig } from '../types';
|
|
2
|
+
export declare const defaultSpring: SpringConfig;
|
|
3
|
+
export declare const gentle: SpringConfig;
|
|
4
|
+
export declare const wobbly: SpringConfig;
|
|
5
|
+
export declare const stiff: SpringConfig;
|
|
6
|
+
export declare const slow: SpringConfig;
|
|
7
|
+
export declare const molasses: SpringConfig;
|
|
8
|
+
export declare const config: {
|
|
9
|
+
readonly default: SpringConfig;
|
|
10
|
+
readonly gentle: SpringConfig;
|
|
11
|
+
readonly wobbly: SpringConfig;
|
|
12
|
+
readonly stiff: SpringConfig;
|
|
13
|
+
readonly slow: SpringConfig;
|
|
14
|
+
readonly molasses: SpringConfig;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/presets/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,aAAa,EAAE,YAG3B,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,YAGpB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,YAGpB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,YAGnB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,YAGlB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,YAGtB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;CAOT,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const s = {
|
|
2
|
+
stiffness: 170,
|
|
3
|
+
damping: 26
|
|
4
|
+
}, n = {
|
|
5
|
+
stiffness: 120,
|
|
6
|
+
damping: 14
|
|
7
|
+
}, t = {
|
|
8
|
+
stiffness: 180,
|
|
9
|
+
damping: 12
|
|
10
|
+
}, f = {
|
|
11
|
+
stiffness: 210,
|
|
12
|
+
damping: 20
|
|
13
|
+
}, i = {
|
|
14
|
+
stiffness: 280,
|
|
15
|
+
damping: 60
|
|
16
|
+
}, e = {
|
|
17
|
+
stiffness: 280,
|
|
18
|
+
damping: 120
|
|
19
|
+
}, o = {
|
|
20
|
+
default: s,
|
|
21
|
+
gentle: n,
|
|
22
|
+
wobbly: t,
|
|
23
|
+
stiff: f,
|
|
24
|
+
slow: i,
|
|
25
|
+
molasses: e
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
o as config,
|
|
29
|
+
s as defaultSpring,
|
|
30
|
+
n as gentle,
|
|
31
|
+
e as molasses,
|
|
32
|
+
i as slow,
|
|
33
|
+
f as stiff,
|
|
34
|
+
t as wobbly
|
|
35
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { TransitionConfig } from './types';
|
|
2
|
+
import { Animator } from './animator';
|
|
3
|
+
export declare const TRANSITION_STRATEGY: unique symbol;
|
|
4
|
+
export interface StrategyContext<TAnimationValue = number> {
|
|
5
|
+
currentAnimation: {
|
|
6
|
+
animator: Animator<TAnimationValue>;
|
|
7
|
+
direction: "in" | "out";
|
|
8
|
+
} | null;
|
|
9
|
+
}
|
|
10
|
+
export interface AnimationSetup<TAnimationValue = number> {
|
|
11
|
+
config?: TransitionConfig<TAnimationValue>;
|
|
12
|
+
state: {
|
|
13
|
+
position: TAnimationValue;
|
|
14
|
+
velocity: TAnimationValue extends number ? number : Record<string, number>;
|
|
15
|
+
};
|
|
16
|
+
from: TAnimationValue;
|
|
17
|
+
to: TAnimationValue;
|
|
18
|
+
direction: "forward" | "backward";
|
|
19
|
+
}
|
|
20
|
+
export interface TransitionConfigs<TAnimationValue = number> {
|
|
21
|
+
in?: Promise<TransitionConfig<TAnimationValue>>;
|
|
22
|
+
out?: Promise<TransitionConfig<TAnimationValue>>;
|
|
23
|
+
}
|
|
24
|
+
export interface TransitionStrategy<TAnimationValue = number> {
|
|
25
|
+
runIn: (configs: TransitionConfigs<TAnimationValue>) => Promise<AnimationSetup<TAnimationValue>>;
|
|
26
|
+
runOut: (configs: TransitionConfigs<TAnimationValue>) => Promise<AnimationSetup<TAnimationValue>>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates a transition callback that can be used with framework-specific implementations
|
|
30
|
+
* This is the core logic that frameworks can wrap with their own APIs
|
|
31
|
+
*
|
|
32
|
+
* UX Animation Behavior - 4 Main Scenarios:
|
|
33
|
+
*
|
|
34
|
+
* 1. No animation running + IN trigger:
|
|
35
|
+
* - Start entrance animation (0 → 1)
|
|
36
|
+
* - Return cleanup function for exit
|
|
37
|
+
*
|
|
38
|
+
* 2. No animation running + OUT trigger:
|
|
39
|
+
* - Clone element, start exit animation (1 → 0)
|
|
40
|
+
* - Remove clone when complete
|
|
41
|
+
*
|
|
42
|
+
* 3. IN animation running + OUT trigger:
|
|
43
|
+
* - Stop current IN animation (DOM is disappearing)
|
|
44
|
+
* - Clone element for exit animation
|
|
45
|
+
* - Create REVERSED IN animation (not OUT animation) with current state
|
|
46
|
+
* - This gives natural backward motion instead of jumping to OUT definition
|
|
47
|
+
*
|
|
48
|
+
* 4. OUT animation running + IN trigger:
|
|
49
|
+
* - Stop current OUT animation (cleanup any cloned elements)
|
|
50
|
+
* - Create REVERSED OUT animation (not IN animation) with current state
|
|
51
|
+
* - This gives natural backward motion instead of jumping to IN definition
|
|
52
|
+
* - Switch to entrance mode
|
|
53
|
+
*
|
|
54
|
+
* Closure Structure:
|
|
55
|
+
* - Outer function: Returns entrance callback
|
|
56
|
+
* - Inner function (entrance callback): Returns cleanup callback (exit)
|
|
57
|
+
* - Cleanup callback: Handles exit transitions
|
|
58
|
+
*/
|
|
59
|
+
export declare const createDefaultStrategy: <TAnimationValue = number>(context: StrategyContext<TAnimationValue>) => TransitionStrategy<TAnimationValue>;
|
|
60
|
+
//# sourceMappingURL=transition-strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transition-strategy.d.ts","sourceRoot":"","sources":["../src/lib/transition-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,eAAO,MAAM,mBAAmB,eAAoC,CAAC;AAErE,MAAM,WAAW,eAAe,CAAC,eAAe,GAAG,MAAM;IAEvD,gBAAgB,EAAE;QAChB,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;QACpC,SAAS,EAAE,IAAI,GAAG,KAAK,CAAC;KACzB,GAAG,IAAI,CAAC;CACV;AAED,MAAM,WAAW,cAAc,CAAC,eAAe,GAAG,MAAM;IACtD,MAAM,CAAC,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAC3C,KAAK,EAAE;QACL,QAAQ,EAAE,eAAe,CAAC;QAC1B,QAAQ,EAAE,eAAe,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC5E,CAAC;IACF,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,EAAE,eAAe,CAAC;IACpB,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB,CAAC,eAAe,GAAG,MAAM;IACzD,EAAE,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,CAAC;IAChD,GAAG,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,kBAAkB,CAAC,eAAe,GAAG,MAAM;IAC1D,KAAK,EAAE,CACL,OAAO,EAAE,iBAAiB,CAAC,eAAe,CAAC,KACxC,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;IAC9C,MAAM,EAAE,CACN,OAAO,EAAE,iBAAiB,CAAC,eAAe,CAAC,KACxC,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,eAAO,MAAM,qBAAqB,GAAI,eAAe,GAAG,MAAM,EAC5D,SAAS,eAAe,CAAC,eAAe,CAAC,KACxC,kBAAkB,CAAC,eAAe,CA0HpC,CAAC"}
|
package/dist/transition.d.ts
CHANGED
|
@@ -1,16 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
type TransitionKey = string | symbol;
|
|
1
|
+
import { StrategyContext, TRANSITION_STRATEGY, TransitionStrategy } from './transition-strategy';
|
|
2
|
+
import { TransitionCallback, TransitionOptions, TransitionKey } from './types';
|
|
3
|
+
export declare function generateAutoKey(): TransitionKey;
|
|
6
4
|
/**
|
|
7
5
|
* Framework-agnostic transition function that can be used as a ref
|
|
8
|
-
*
|
|
6
|
+
*
|
|
7
|
+
* @description
|
|
8
|
+
* Creates a transition that can be attached to DOM elements via ref.
|
|
9
|
+
* Manages entrance and exit animations with a complete lifecycle system.
|
|
10
|
+
*
|
|
11
|
+
* **IN Animation Lifecycle (Element Entering):**
|
|
12
|
+
* 1. `prepare` - Setup element's initial state (e.g., opacity: 0)
|
|
13
|
+
* 2. `wait` - Optional async delay before animation starts
|
|
14
|
+
* 3. `onStart` - Called when animation begins
|
|
15
|
+
* 4. `tick` - Called on each animation frame with progress value (0 → 1)
|
|
16
|
+
* 5. `onEnd` - Called when animation completes
|
|
17
|
+
*
|
|
18
|
+
* **OUT Animation Lifecycle (Element Exiting):**
|
|
19
|
+
* 1. `prepare` - Setup element's initial state for exit
|
|
20
|
+
* 2. `wait` - Optional async delay before animation starts
|
|
21
|
+
* 3. `onStart` - Called when animation begins
|
|
22
|
+
* 4. `tick` - Called on each animation frame with progress value (1 → 0)
|
|
23
|
+
* 5. `onEnd` - Called when animation completes and element is removed
|
|
24
|
+
*
|
|
25
|
+
* The `key` parameter is crucial for transition management - it uniquely identifies
|
|
26
|
+
* each transition instance, allowing the system to track, cleanup, and prevent
|
|
27
|
+
* conflicts between multiple transitions on the same element.
|
|
28
|
+
*
|
|
29
|
+
* @param {object} options - Configuration object
|
|
30
|
+
* @param {TransitionKey} options.key - Unique identifier for this transition instance.
|
|
31
|
+
* Can be string or symbol. Used to manage and cleanup
|
|
32
|
+
* transitions internally.
|
|
33
|
+
* @param {Function} options.in - Configuration for entrance animation.
|
|
34
|
+
* Returns TransitionConfig with lifecycle hooks.
|
|
35
|
+
* @param {Function} options.out - Configuration for exit animation.
|
|
36
|
+
* Returns TransitionConfig with lifecycle hooks.
|
|
37
|
+
*
|
|
38
|
+
* @template TAnimationValue - The type of value being animated (number | object)
|
|
39
|
+
*
|
|
40
|
+
* @returns {TransitionCallback} A callback function to be used as a ref
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // Simple fade transition
|
|
45
|
+
* <div ref={transition({
|
|
46
|
+
* key: 'hero-fade',
|
|
47
|
+
* in: (element) => ({
|
|
48
|
+
* prepare: (el) => el.style.opacity = '0',
|
|
49
|
+
* tick: (progress) => el.style.opacity = progress.toString(),
|
|
50
|
+
* }),
|
|
51
|
+
* out: (element) => ({
|
|
52
|
+
* tick: (progress) => el.style.opacity = progress.toString(),
|
|
53
|
+
* })
|
|
54
|
+
* })} />
|
|
55
|
+
* ```
|
|
9
56
|
*/
|
|
10
|
-
export declare function transition(options: {
|
|
11
|
-
|
|
12
|
-
in?: Transition["in"];
|
|
13
|
-
out?: Transition["out"];
|
|
57
|
+
export declare function transition<TAnimationValue = number>(options: TransitionOptions<undefined, TAnimationValue> & {
|
|
58
|
+
[TRANSITION_STRATEGY]?: (context: StrategyContext<TAnimationValue>) => TransitionStrategy<TAnimationValue>;
|
|
14
59
|
}): TransitionCallback;
|
|
15
|
-
export {};
|
|
16
60
|
//# sourceMappingURL=transition.d.ts.map
|
package/dist/transition.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../src/lib/transition.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../src/lib/transition.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,KAAK,EAAc,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AA+D7C,wBAAgB,eAAe,IAAI,aAAa,CAY/C;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAgB,UAAU,CAAC,eAAe,GAAG,MAAM,EACjD,OAAO,EAAE,iBAAiB,CAAC,SAAS,EAAE,eAAe,CAAC,GAAG;IACvD,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,eAAe,CAAC,KAAK,kBAAkB,CAAC,eAAe,CAAC,CAAC;CAC5G,GACA,kBAAkB,CAmBpB"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { TransitionKey } from '../types';
|
|
1
2
|
interface BlurOptions {
|
|
2
|
-
amount?: number;
|
|
3
|
+
amount?: number | string;
|
|
4
|
+
opacity?: number;
|
|
3
5
|
scale?: boolean;
|
|
4
6
|
fade?: boolean;
|
|
5
7
|
spring?: {
|
|
6
8
|
stiffness?: number;
|
|
7
9
|
damping?: number;
|
|
8
10
|
};
|
|
11
|
+
key?: TransitionKey;
|
|
9
12
|
}
|
|
10
13
|
export declare const blur: (options?: BlurOptions) => {
|
|
14
|
+
key?: TransitionKey | undefined;
|
|
11
15
|
in: (element: HTMLElement) => {
|
|
12
16
|
spring: {
|
|
13
17
|
stiffness?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blur.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/blur.ts"],"names":[],"mappings":"AAAA,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"blur.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/blur.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB;;kBAe5B,WAAW;;wBArBb,MAAM;sBACR,MAAM;;yBAsBG,MAAM;;mBAmBV,WAAW;;wBA1Cd,MAAM;sBACR,MAAM;;yBA2CG,MAAM;;CAqB5B,CAAC"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import { TransitionKey } from '../types';
|
|
1
2
|
interface BounceOptions {
|
|
2
3
|
height?: number;
|
|
4
|
+
intensity?: number;
|
|
3
5
|
scale?: boolean;
|
|
4
6
|
fade?: boolean;
|
|
7
|
+
direction?: 'up' | 'down';
|
|
5
8
|
spring?: {
|
|
6
9
|
stiffness?: number;
|
|
7
10
|
damping?: number;
|
|
8
11
|
};
|
|
12
|
+
key?: TransitionKey;
|
|
9
13
|
}
|
|
10
14
|
export declare const bounce: (options?: BounceOptions) => {
|
|
15
|
+
key?: TransitionKey | undefined;
|
|
11
16
|
in: (element: HTMLElement) => {
|
|
12
17
|
spring: {
|
|
13
18
|
stiffness?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bounce.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/bounce.ts"],"names":[],"mappings":"AAAA,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"bounce.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/bounce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,MAAM,GAAI,UAAS,aAAkB;;kBAYhC,WAAW;;wBAlBb,MAAM;sBACR,MAAM;;yBAmBG,MAAM;;mBA0BV,WAAW;;wBA9Cd,MAAM;sBACR,MAAM;;yBA+CG,MAAM;;CA4B5B,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TransitionKey } from '../types';
|
|
1
2
|
interface FadeOptions {
|
|
2
3
|
from?: number;
|
|
3
4
|
to?: number;
|
|
@@ -5,8 +6,10 @@ interface FadeOptions {
|
|
|
5
6
|
stiffness?: number;
|
|
6
7
|
damping?: number;
|
|
7
8
|
};
|
|
9
|
+
key?: TransitionKey;
|
|
8
10
|
}
|
|
9
11
|
export declare const fade: (options?: FadeOptions) => {
|
|
12
|
+
key?: TransitionKey | undefined;
|
|
10
13
|
in: (element: HTMLElement) => {
|
|
11
14
|
spring: {
|
|
12
15
|
stiffness?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fade.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/fade.ts"],"names":[],"mappings":"AAAA,UAAU,WAAW;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"fade.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/fade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,WAAW;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB;;kBAS5B,WAAW;;wBAfb,MAAM;sBACR,MAAM;;yBAgBG,MAAM;;mBAKV,WAAW;;wBAtBd,MAAM;sBACR,MAAM;;yBAuBG,MAAM;;CAO5B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TransitionKey } from '../types';
|
|
2
|
+
interface FlyOptions {
|
|
3
|
+
x?: number | string;
|
|
4
|
+
y?: number | string;
|
|
5
|
+
opacity?: number;
|
|
6
|
+
spring?: {
|
|
7
|
+
stiffness?: number;
|
|
8
|
+
damping?: number;
|
|
9
|
+
};
|
|
10
|
+
key?: TransitionKey;
|
|
11
|
+
}
|
|
12
|
+
export declare const fly: (options?: FlyOptions) => {
|
|
13
|
+
key?: TransitionKey | undefined;
|
|
14
|
+
in: (element: HTMLElement) => {
|
|
15
|
+
spring: {
|
|
16
|
+
stiffness?: number;
|
|
17
|
+
damping?: number;
|
|
18
|
+
};
|
|
19
|
+
tick: (progress: number) => void;
|
|
20
|
+
};
|
|
21
|
+
out: (element: HTMLElement) => {
|
|
22
|
+
spring: {
|
|
23
|
+
stiffness?: number;
|
|
24
|
+
damping?: number;
|
|
25
|
+
};
|
|
26
|
+
tick: (progress: number) => void;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=fly.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fly.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/fly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,UAAU;IAClB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,GAAG,GAAI,UAAS,UAAe;;kBAkB1B,WAAW;;wBAxBb,MAAM;sBACR,MAAM;;yBAyBG,MAAM;;mBAQV,WAAW;;wBAlCd,MAAM;sBACR,MAAM;;yBAmCG,MAAM;;CAU5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=($={})=>{const{from:n=0,to:s=1,spring:r={stiffness:300,damping:30},key:u}=$;return{in:l=>({spring:r,tick:y=>{const c=n+(s-n)*y;l.style.opacity=c.toString()}}),out:l=>({spring:r,tick:y=>{const c=n+(s-n)*y;l.style.opacity=c.toString()}}),...u&&{key:u}}},m=($={})=>{const{start:n=0,opacity:s=0,axis:r="both",spring:u={stiffness:300,damping:30},key:l}=$,y=c=>{switch(r){case"x":return`scaleX(${c})`;case"y":return`scaleY(${c})`;case"both":default:return`scale(${c})`}};return{in:c=>({spring:u,tick:t=>{const e=n+(1-n)*t;c.style.transform=y(e),c.style.opacity=(s+(1-s)*t).toString()}}),out:c=>({spring:u,tick:t=>{const e=n+(1-n)*t;c.style.transform=y(e),c.style.opacity=(s+(1-s)*t).toString()}}),...l&&{key:l}}},d=($={})=>{const{direction:n,distance:s=100,opacity:r=0,fade:u=!0,axis:l,spring:y={stiffness:400,damping:35},key:c}=$,e=n||(l==="x"?"left":l==="y"?"up":"left"),o=a=>typeof a=="number"?`${a}px`:a,f=a=>{const i=1-a,p=typeof s=="number"?i*s:`calc(${o(s)} * ${i})`;switch(e){case"left":return typeof s=="number"?`translateX(${-p}px)`:`translateX(calc(-1 * ${p}))`;case"right":return typeof s=="number"?`translateX(${p}px)`:`translateX(${p})`;case"up":return typeof s=="number"?`translateY(${-p}px)`:`translateY(calc(-1 * ${p}))`;case"down":return typeof s=="number"?`translateY(${p}px)`:`translateY(${p})`}};return{in:a=>({spring:y,tick:i=>{a.style.transform=f(i),u&&(a.style.opacity=(r+(1-r)*i).toString())}}),out:a=>({spring:y,tick:i=>{a.style.transform=f(i),u&&(a.style.opacity=(r+(1-r)*i).toString())}}),...c&&{key:c}}},g=($={})=>{const{degrees:n=360,clockwise:s=!0,scale:r=!1,fade:u=!0,origin:l="center",axis:y="2d",perspective:c=800,spring:t={stiffness:500,damping:25},key:e}=$,o=s?n:-n,f=a=>{const i=(1-a)*o;switch(y){case"x":return`perspective(${c}px) rotateX(${i}deg)`;case"y":return`perspective(${c}px) rotateY(${i}deg)`;case"z":return`rotateZ(${i}deg)`;case"2d":default:return`rotate(${i}deg)`}};return{in:a=>({spring:t,tick:i=>{const p=[f(i)];r&&p.push(`scale(${i})`),a.style.transform=p.join(" "),a.style.transformOrigin=l,u&&(a.style.opacity=i.toString())}}),out:a=>({spring:t,tick:i=>{const p=[f(i)];r&&p.push(`scale(${i})`),a.style.transform=p.join(" "),a.style.transformOrigin=l,u&&(a.style.opacity=i.toString())}}),...e&&{key:e}}},x=($={})=>{const{height:n=20,intensity:s=1,scale:r=!0,fade:u=!0,direction:l="up",spring:y={stiffness:800,damping:15},key:c}=$;return{in:t=>({spring:y,tick:e=>{const o=[],f=Math.sin(e*Math.PI*(1+s)),a=1-e,i=f*n*a;if(l==="up"?o.push(`translateY(${-Math.abs(i)}px)`):o.push(`translateY(${Math.abs(i)}px)`),r){const p=.8+e*.2+f*.05*a;o.push(`scale(${p})`)}t.style.transform=o.join(" "),u&&(t.style.opacity=e.toString())}}),out:t=>({spring:y,tick:e=>{const o=[],f=Math.sin(e*Math.PI*(1+s)),a=1-e,i=f*n*a;if(l==="up"?o.push(`translateY(${-Math.abs(i)}px)`):o.push(`translateY(${Math.abs(i)}px)`),r){const p=.8+e*.2+f*.05*a;o.push(`scale(${p})`)}t.style.transform=o.join(" "),u&&(t.style.opacity=e.toString())}}),...c&&{key:c}}},k=($={})=>{const{amount:n=10,opacity:s=0,scale:r=!1,fade:u=!0,spring:l={stiffness:300,damping:30},key:y}=$,c=t=>typeof t=="number"?`${t}px`:t;return{in:t=>({spring:l,tick:e=>{const o=1-e,f=typeof n=="number"?o*n:`calc(${c(n)} * ${o})`;t.style.filter=typeof n=="number"?`blur(${f}px)`:`blur(${f})`,r&&(t.style.transform=`scale(${.8+e*.2})`),u&&(t.style.opacity=(s+(1-s)*e).toString())}}),out:t=>({spring:l,tick:e=>{const o=1-e,f=typeof n=="number"?o*n:`calc(${c(n)} * ${o})`;t.style.filter=typeof n=="number"?`blur(${f}px)`:`blur(${f})`,r&&(t.style.transform=`scale(${.8+e*.2})`),u&&(t.style.opacity=(s+(1-s)*e).toString())}}),...y&&{key:y}}},h=($={})=>{const{x:n=0,y:s=-100,opacity:r=0,spring:u={stiffness:400,damping:35},key:l}=$,y=t=>typeof t=="number"?`${t}px`:t,c=t=>typeof t=="number"?`${t}px`:t;return{in:t=>({spring:u,tick:e=>{const o=typeof n=="number"?(1-e)*n:`calc(${y(n)} * ${1-e})`,f=typeof s=="number"?(1-e)*s:`calc(${c(s)} * ${1-e})`;t.style.transform=`translate(${typeof n=="number"?o+"px":o}, ${typeof s=="number"?f+"px":f})`,t.style.opacity=(r+(1-r)*e).toString()}}),out:t=>({spring:u,tick:e=>{const o=typeof n=="number"?(1-e)*n:`calc(${y(n)} * ${1-e})`,f=typeof s=="number"?(1-e)*s:`calc(${c(s)} * ${1-e})`;t.style.transform=`translate(${typeof n=="number"?o+"px":o}, ${typeof s=="number"?f+"px":f})`,t.style.opacity=(r+(1-r)*e).toString()}}),...l&&{key:l}}},S=($={})=>{const{spring:n={stiffness:1e3,damping:100},key:s}=$;return{in:r=>({spring:n,tick:u=>{}}),out:r=>({spring:n,tick:u=>{}}),...s&&{key:s}}};exports.blur=k;exports.bounce=x;exports.fade=b;exports.fly=h;exports.none=S;exports.rotate=g;exports.scale=m;exports.slide=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC"}
|