@kopexa/motion-utils 0.0.0-canary-20250718183330
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 +24 -0
- package/dist/chunk-7S4HQXW4.mjs +46 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +73 -0
- package/dist/index.mjs +11 -0
- package/dist/transition-utils.d.mts +44 -0
- package/dist/transition-utils.d.ts +44 -0
- package/dist/transition-utils.js +71 -0
- package/dist/transition-utils.mjs +11 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @kopexa/motion-utils
|
|
2
|
+
|
|
3
|
+
A Quick description of the component
|
|
4
|
+
|
|
5
|
+
> This is an internal utility, not intended for public usage.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
yarn add @kopexa/motion-utils
|
|
11
|
+
# or
|
|
12
|
+
npm i @kopexa/motion-utils
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Contribution
|
|
16
|
+
|
|
17
|
+
Yes please! See the
|
|
18
|
+
[contributing guidelines](https://github.com/kopexa-grc/sight/blob/master/CONTRIBUTING.md)
|
|
19
|
+
for details.
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
This project is licensed under the terms of the
|
|
24
|
+
[MIT license](https://github.com/kopexa-grc/sight/blob/master/LICENSE).
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/transition-utils.ts
|
|
4
|
+
var TRANSITION_EASINGS = {
|
|
5
|
+
ease: [0.36, 0.66, 0.4, 1],
|
|
6
|
+
easeIn: [0.4, 0, 1, 1],
|
|
7
|
+
easeOut: [0, 0, 0.2, 1],
|
|
8
|
+
easeInOut: [0.4, 0, 0.2, 1],
|
|
9
|
+
spring: [0.155, 1.105, 0.295, 1.12],
|
|
10
|
+
springOut: [0.57, -0.15, 0.62, 0.07],
|
|
11
|
+
softSpring: [0.16, 1.11, 0.3, 1.02]
|
|
12
|
+
};
|
|
13
|
+
var TRANSITION_DEFAULTS = {
|
|
14
|
+
enter: {
|
|
15
|
+
duration: 0.2,
|
|
16
|
+
ease: TRANSITION_EASINGS.easeOut
|
|
17
|
+
},
|
|
18
|
+
exit: {
|
|
19
|
+
duration: 0.1,
|
|
20
|
+
ease: TRANSITION_EASINGS.easeIn
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var TRANSITION_VARIANTS = {
|
|
24
|
+
fade: {
|
|
25
|
+
enter: {
|
|
26
|
+
opacity: 1,
|
|
27
|
+
transition: {
|
|
28
|
+
duration: 0.4,
|
|
29
|
+
ease: TRANSITION_EASINGS.ease
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
exit: {
|
|
33
|
+
opacity: 0,
|
|
34
|
+
transition: {
|
|
35
|
+
duration: 0.3,
|
|
36
|
+
ease: TRANSITION_EASINGS.ease
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
TRANSITION_EASINGS,
|
|
44
|
+
TRANSITION_DEFAULTS,
|
|
45
|
+
TRANSITION_VARIANTS
|
|
46
|
+
};
|
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
TRANSITION_DEFAULTS: () => TRANSITION_DEFAULTS,
|
|
25
|
+
TRANSITION_EASINGS: () => TRANSITION_EASINGS,
|
|
26
|
+
TRANSITION_VARIANTS: () => TRANSITION_VARIANTS
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
29
|
+
|
|
30
|
+
// src/transition-utils.ts
|
|
31
|
+
var TRANSITION_EASINGS = {
|
|
32
|
+
ease: [0.36, 0.66, 0.4, 1],
|
|
33
|
+
easeIn: [0.4, 0, 1, 1],
|
|
34
|
+
easeOut: [0, 0, 0.2, 1],
|
|
35
|
+
easeInOut: [0.4, 0, 0.2, 1],
|
|
36
|
+
spring: [0.155, 1.105, 0.295, 1.12],
|
|
37
|
+
springOut: [0.57, -0.15, 0.62, 0.07],
|
|
38
|
+
softSpring: [0.16, 1.11, 0.3, 1.02]
|
|
39
|
+
};
|
|
40
|
+
var TRANSITION_DEFAULTS = {
|
|
41
|
+
enter: {
|
|
42
|
+
duration: 0.2,
|
|
43
|
+
ease: TRANSITION_EASINGS.easeOut
|
|
44
|
+
},
|
|
45
|
+
exit: {
|
|
46
|
+
duration: 0.1,
|
|
47
|
+
ease: TRANSITION_EASINGS.easeIn
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var TRANSITION_VARIANTS = {
|
|
51
|
+
fade: {
|
|
52
|
+
enter: {
|
|
53
|
+
opacity: 1,
|
|
54
|
+
transition: {
|
|
55
|
+
duration: 0.4,
|
|
56
|
+
ease: TRANSITION_EASINGS.ease
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
exit: {
|
|
60
|
+
opacity: 0,
|
|
61
|
+
transition: {
|
|
62
|
+
duration: 0.3,
|
|
63
|
+
ease: TRANSITION_EASINGS.ease
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
TRANSITION_DEFAULTS,
|
|
71
|
+
TRANSITION_EASINGS,
|
|
72
|
+
TRANSITION_VARIANTS
|
|
73
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Transition, Target, TargetAndTransition } from 'motion';
|
|
2
|
+
|
|
3
|
+
type WithMotionState<P> = Partial<Record<"enter" | "exit", P>>;
|
|
4
|
+
type TransitionConfig = WithMotionState<Transition>;
|
|
5
|
+
type TransitionEndConfig = WithMotionState<Target>;
|
|
6
|
+
type TransitionProperties = {
|
|
7
|
+
/**
|
|
8
|
+
* Custom `transition` definition for `enter` and `exit`
|
|
9
|
+
*/
|
|
10
|
+
transition?: TransitionConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Custom `transitionEnd` definition for `enter` and `exit`
|
|
13
|
+
*/
|
|
14
|
+
transitionEnd?: TransitionEndConfig;
|
|
15
|
+
};
|
|
16
|
+
type TargetResolver<P = object> = (props: P & TransitionProperties) => TargetAndTransition;
|
|
17
|
+
type Variant<P = object> = TargetAndTransition | TargetResolver<P>;
|
|
18
|
+
type Variants<P = object> = Record<string, {
|
|
19
|
+
enter: Variant<P>;
|
|
20
|
+
exit: Variant<P>;
|
|
21
|
+
initial?: Variant<P>;
|
|
22
|
+
}>;
|
|
23
|
+
declare const TRANSITION_EASINGS: {
|
|
24
|
+
readonly ease: readonly [0.36, 0.66, 0.4, 1];
|
|
25
|
+
readonly easeIn: readonly [0.4, 0, 1, 1];
|
|
26
|
+
readonly easeOut: readonly [0, 0, 0.2, 1];
|
|
27
|
+
readonly easeInOut: readonly [0.4, 0, 0.2, 1];
|
|
28
|
+
readonly spring: readonly [0.155, 1.105, 0.295, 1.12];
|
|
29
|
+
readonly springOut: readonly [0.57, -0.15, 0.62, 0.07];
|
|
30
|
+
readonly softSpring: readonly [0.16, 1.11, 0.3, 1.02];
|
|
31
|
+
};
|
|
32
|
+
declare const TRANSITION_DEFAULTS: {
|
|
33
|
+
readonly enter: {
|
|
34
|
+
readonly duration: 0.2;
|
|
35
|
+
readonly ease: readonly [0, 0, 0.2, 1];
|
|
36
|
+
};
|
|
37
|
+
readonly exit: {
|
|
38
|
+
readonly duration: 0.1;
|
|
39
|
+
readonly ease: readonly [0.4, 0, 1, 1];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
declare const TRANSITION_VARIANTS: Variants;
|
|
43
|
+
|
|
44
|
+
export { TRANSITION_DEFAULTS, TRANSITION_EASINGS, TRANSITION_VARIANTS, type TransitionConfig, type TransitionEndConfig, type TransitionProperties, type Variants };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Transition, Target, TargetAndTransition } from 'motion';
|
|
2
|
+
|
|
3
|
+
type WithMotionState<P> = Partial<Record<"enter" | "exit", P>>;
|
|
4
|
+
type TransitionConfig = WithMotionState<Transition>;
|
|
5
|
+
type TransitionEndConfig = WithMotionState<Target>;
|
|
6
|
+
type TransitionProperties = {
|
|
7
|
+
/**
|
|
8
|
+
* Custom `transition` definition for `enter` and `exit`
|
|
9
|
+
*/
|
|
10
|
+
transition?: TransitionConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Custom `transitionEnd` definition for `enter` and `exit`
|
|
13
|
+
*/
|
|
14
|
+
transitionEnd?: TransitionEndConfig;
|
|
15
|
+
};
|
|
16
|
+
type TargetResolver<P = object> = (props: P & TransitionProperties) => TargetAndTransition;
|
|
17
|
+
type Variant<P = object> = TargetAndTransition | TargetResolver<P>;
|
|
18
|
+
type Variants<P = object> = Record<string, {
|
|
19
|
+
enter: Variant<P>;
|
|
20
|
+
exit: Variant<P>;
|
|
21
|
+
initial?: Variant<P>;
|
|
22
|
+
}>;
|
|
23
|
+
declare const TRANSITION_EASINGS: {
|
|
24
|
+
readonly ease: readonly [0.36, 0.66, 0.4, 1];
|
|
25
|
+
readonly easeIn: readonly [0.4, 0, 1, 1];
|
|
26
|
+
readonly easeOut: readonly [0, 0, 0.2, 1];
|
|
27
|
+
readonly easeInOut: readonly [0.4, 0, 0.2, 1];
|
|
28
|
+
readonly spring: readonly [0.155, 1.105, 0.295, 1.12];
|
|
29
|
+
readonly springOut: readonly [0.57, -0.15, 0.62, 0.07];
|
|
30
|
+
readonly softSpring: readonly [0.16, 1.11, 0.3, 1.02];
|
|
31
|
+
};
|
|
32
|
+
declare const TRANSITION_DEFAULTS: {
|
|
33
|
+
readonly enter: {
|
|
34
|
+
readonly duration: 0.2;
|
|
35
|
+
readonly ease: readonly [0, 0, 0.2, 1];
|
|
36
|
+
};
|
|
37
|
+
readonly exit: {
|
|
38
|
+
readonly duration: 0.1;
|
|
39
|
+
readonly ease: readonly [0.4, 0, 1, 1];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
declare const TRANSITION_VARIANTS: Variants;
|
|
43
|
+
|
|
44
|
+
export { TRANSITION_DEFAULTS, TRANSITION_EASINGS, TRANSITION_VARIANTS, type TransitionConfig, type TransitionEndConfig, type TransitionProperties, type Variants };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/transition-utils.ts
|
|
22
|
+
var transition_utils_exports = {};
|
|
23
|
+
__export(transition_utils_exports, {
|
|
24
|
+
TRANSITION_DEFAULTS: () => TRANSITION_DEFAULTS,
|
|
25
|
+
TRANSITION_EASINGS: () => TRANSITION_EASINGS,
|
|
26
|
+
TRANSITION_VARIANTS: () => TRANSITION_VARIANTS
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(transition_utils_exports);
|
|
29
|
+
var TRANSITION_EASINGS = {
|
|
30
|
+
ease: [0.36, 0.66, 0.4, 1],
|
|
31
|
+
easeIn: [0.4, 0, 1, 1],
|
|
32
|
+
easeOut: [0, 0, 0.2, 1],
|
|
33
|
+
easeInOut: [0.4, 0, 0.2, 1],
|
|
34
|
+
spring: [0.155, 1.105, 0.295, 1.12],
|
|
35
|
+
springOut: [0.57, -0.15, 0.62, 0.07],
|
|
36
|
+
softSpring: [0.16, 1.11, 0.3, 1.02]
|
|
37
|
+
};
|
|
38
|
+
var TRANSITION_DEFAULTS = {
|
|
39
|
+
enter: {
|
|
40
|
+
duration: 0.2,
|
|
41
|
+
ease: TRANSITION_EASINGS.easeOut
|
|
42
|
+
},
|
|
43
|
+
exit: {
|
|
44
|
+
duration: 0.1,
|
|
45
|
+
ease: TRANSITION_EASINGS.easeIn
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var TRANSITION_VARIANTS = {
|
|
49
|
+
fade: {
|
|
50
|
+
enter: {
|
|
51
|
+
opacity: 1,
|
|
52
|
+
transition: {
|
|
53
|
+
duration: 0.4,
|
|
54
|
+
ease: TRANSITION_EASINGS.ease
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
exit: {
|
|
58
|
+
opacity: 0,
|
|
59
|
+
transition: {
|
|
60
|
+
duration: 0.3,
|
|
61
|
+
ease: TRANSITION_EASINGS.ease
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
TRANSITION_DEFAULTS,
|
|
69
|
+
TRANSITION_EASINGS,
|
|
70
|
+
TRANSITION_VARIANTS
|
|
71
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kopexa/motion-utils",
|
|
3
|
+
"version": "0.0.0-canary-20250718183330",
|
|
4
|
+
"description": "utility package to work with motion library",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"motion-utils"
|
|
7
|
+
],
|
|
8
|
+
"author": "Kopexa <hello@kopexa.com>",
|
|
9
|
+
"homepage": "https://kopexa.com",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/kopexa-grc/sight.git",
|
|
22
|
+
"directory": "packages/utilities/motion-utils"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/kopexa-grc/sight/issues"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"react": ">=19.0.0-rc.0",
|
|
29
|
+
"react-dom": ">=19.0.0-rc.0",
|
|
30
|
+
"motion": ">=12.23.6",
|
|
31
|
+
"@kopexa/theme": "0.0.0-canary-20250718183330"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@kopexa/shared-utils": "0.0.0-canary-20250718183330",
|
|
35
|
+
"@kopexa/react-utils": "0.0.0-canary-20250718183330"
|
|
36
|
+
},
|
|
37
|
+
"clean-package": "../../../clean-package.config.json",
|
|
38
|
+
"module": "dist/index.mjs",
|
|
39
|
+
"types": "dist/index.d.ts",
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"import": "./dist/index.mjs",
|
|
44
|
+
"require": "./dist/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./package.json": "./package.json"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsup src --dts",
|
|
50
|
+
"build:fast": "tsup src",
|
|
51
|
+
"dev": "pnpm build:fast --watch",
|
|
52
|
+
"clean": "rimraf dist .turbo",
|
|
53
|
+
"typecheck": "tsc --noEmit"
|
|
54
|
+
}
|
|
55
|
+
}
|