@octaviaflow/motion 1.0.0 → 1.1.3
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/CHANGELOG.md +13 -0
- package/es/index.js +56 -0
- package/lib/index.js +40 -33
- package/package.json +5 -8
- package/src/__tests__/motion.test.js +293 -0
- package/umd/index.js +80 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@octaviaflow/motion` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.1.3] - 2026-02-07
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Synchronized version to 1.1.3 across all OctaviaFlow Design System packages
|
|
13
|
+
- Aligned package versioning for unified release
|
package/es/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const fast01 = "70ms";
|
|
2
|
+
const fast02 = "110ms";
|
|
3
|
+
const moderate01 = "150ms";
|
|
4
|
+
const moderate02 = "240ms";
|
|
5
|
+
const slow01 = "400ms";
|
|
6
|
+
const slow02 = "700ms";
|
|
7
|
+
const durationFast01 = fast01;
|
|
8
|
+
const durationFast02 = fast02;
|
|
9
|
+
const durationModerate01 = moderate01;
|
|
10
|
+
const durationModerate02 = moderate02;
|
|
11
|
+
const durationSlow01 = slow01;
|
|
12
|
+
const durationSlow02 = slow02;
|
|
13
|
+
const unstable_tokens = [
|
|
14
|
+
"fast01",
|
|
15
|
+
"fast02",
|
|
16
|
+
"moderate01",
|
|
17
|
+
"moderate02",
|
|
18
|
+
"slow01",
|
|
19
|
+
"slow02",
|
|
20
|
+
"durationFast01",
|
|
21
|
+
"durationFast02",
|
|
22
|
+
"durationModerate01",
|
|
23
|
+
"durationModerate02",
|
|
24
|
+
"durationSlow01",
|
|
25
|
+
"durationSlow02"
|
|
26
|
+
];
|
|
27
|
+
const easings = {
|
|
28
|
+
standard: {
|
|
29
|
+
productive: "cubic-bezier(0.2, 0, 0.38, 0.9)",
|
|
30
|
+
expressive: "cubic-bezier(0.4, 0.14, 0.3, 1)"
|
|
31
|
+
},
|
|
32
|
+
entrance: {
|
|
33
|
+
productive: "cubic-bezier(0, 0, 0.38, 0.9)",
|
|
34
|
+
expressive: "cubic-bezier(0, 0, 0.3, 1)"
|
|
35
|
+
},
|
|
36
|
+
exit: {
|
|
37
|
+
productive: "cubic-bezier(0.2, 0, 1, 0.9)",
|
|
38
|
+
expressive: "cubic-bezier(0.4, 0.14, 1, 1)"
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
function motion(name, mode) {
|
|
42
|
+
if (!easings[name]) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
`Unable to find easing \`${name}\` in our supported easings. Expected One of: ${Object.keys(easings).join(", ")}`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
const easing = easings[name];
|
|
48
|
+
if (!easing[mode]) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
`Unable to find a mode for the easing \`${name}\` called: \`${mode}\``
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
return easing[mode];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { durationFast01, durationFast02, durationModerate01, durationModerate02, durationSlow01, durationSlow02, easings, fast01, fast02, moderate01, moderate02, motion, slow01, slow02, unstable_tokens };
|
package/lib/index.js
CHANGED
|
@@ -2,50 +2,57 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
5
|
+
const fast01 = "70ms";
|
|
6
|
+
const fast02 = "110ms";
|
|
7
|
+
const moderate01 = "150ms";
|
|
8
|
+
const moderate02 = "240ms";
|
|
9
|
+
const slow01 = "400ms";
|
|
10
|
+
const slow02 = "700ms";
|
|
11
|
+
const durationFast01 = fast01;
|
|
12
|
+
const durationFast02 = fast02;
|
|
13
|
+
const durationModerate01 = moderate01;
|
|
14
|
+
const durationModerate02 = moderate02;
|
|
15
|
+
const durationSlow01 = slow01;
|
|
16
|
+
const durationSlow02 = slow02;
|
|
17
|
+
const unstable_tokens = [
|
|
18
|
+
"fast01",
|
|
19
|
+
"fast02",
|
|
20
|
+
"moderate01",
|
|
21
|
+
"moderate02",
|
|
22
|
+
"slow01",
|
|
23
|
+
"slow02",
|
|
24
|
+
"durationFast01",
|
|
25
|
+
"durationFast02",
|
|
26
|
+
"durationModerate01",
|
|
27
|
+
"durationModerate02",
|
|
28
|
+
"durationSlow01",
|
|
29
|
+
"durationSlow02"
|
|
30
|
+
];
|
|
31
|
+
const easings = {
|
|
29
32
|
standard: {
|
|
30
|
-
productive:
|
|
31
|
-
expressive:
|
|
33
|
+
productive: "cubic-bezier(0.2, 0, 0.38, 0.9)",
|
|
34
|
+
expressive: "cubic-bezier(0.4, 0.14, 0.3, 1)"
|
|
32
35
|
},
|
|
33
36
|
entrance: {
|
|
34
|
-
productive:
|
|
35
|
-
expressive:
|
|
37
|
+
productive: "cubic-bezier(0, 0, 0.38, 0.9)",
|
|
38
|
+
expressive: "cubic-bezier(0, 0, 0.3, 1)"
|
|
36
39
|
},
|
|
37
40
|
exit: {
|
|
38
|
-
productive:
|
|
39
|
-
expressive:
|
|
41
|
+
productive: "cubic-bezier(0.2, 0, 1, 0.9)",
|
|
42
|
+
expressive: "cubic-bezier(0.4, 0.14, 1, 1)"
|
|
40
43
|
}
|
|
41
44
|
};
|
|
42
45
|
function motion(name, mode) {
|
|
43
46
|
if (!easings[name]) {
|
|
44
|
-
throw new Error(
|
|
47
|
+
throw new Error(
|
|
48
|
+
`Unable to find easing \`${name}\` in our supported easings. Expected One of: ${Object.keys(easings).join(", ")}`
|
|
49
|
+
);
|
|
45
50
|
}
|
|
46
|
-
|
|
51
|
+
const easing = easings[name];
|
|
47
52
|
if (!easing[mode]) {
|
|
48
|
-
throw new Error(
|
|
53
|
+
throw new Error(
|
|
54
|
+
`Unable to find a mode for the easing \`${name}\` called: \`${mode}\``
|
|
55
|
+
);
|
|
49
56
|
}
|
|
50
57
|
return easing[mode];
|
|
51
58
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octaviaflow/motion",
|
|
3
3
|
"description": "Motion helpers for digital and software products using the OctaviaFlow Design System",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.3",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -20,17 +20,14 @@
|
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"@babel/runtime": "^7.25.0"
|
|
25
|
-
},
|
|
23
|
+
"dependencies": {},
|
|
26
24
|
"scripts": {
|
|
27
25
|
"build": "bun run clean && octaviaflow-cli bundle src/index.js --name OctaviaFlowMotion",
|
|
28
|
-
"clean": "rimraf es lib umd"
|
|
26
|
+
"clean": "rimraf es lib umd",
|
|
27
|
+
"test": "bun test ."
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@babel/preset-env": "^7.28.6",
|
|
33
|
-
"@octaviaflow/cli": "^1.0.0",
|
|
30
|
+
"@octaviaflow/cli": "^2.0.0",
|
|
34
31
|
"rimraf": "^6.0.0"
|
|
35
32
|
}
|
|
36
33
|
}
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 31/January/2026
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { describe, it, expect } from "bun:test";
|
|
11
|
+
import {
|
|
12
|
+
fast01,
|
|
13
|
+
fast02,
|
|
14
|
+
moderate01,
|
|
15
|
+
moderate02,
|
|
16
|
+
slow01,
|
|
17
|
+
slow02,
|
|
18
|
+
durationFast01,
|
|
19
|
+
durationFast02,
|
|
20
|
+
durationModerate01,
|
|
21
|
+
durationModerate02,
|
|
22
|
+
durationSlow01,
|
|
23
|
+
durationSlow02,
|
|
24
|
+
unstable_tokens,
|
|
25
|
+
easings,
|
|
26
|
+
motion,
|
|
27
|
+
} from "../index.js";
|
|
28
|
+
|
|
29
|
+
describe("Motion durations", () => {
|
|
30
|
+
describe("Legacy duration tokens", () => {
|
|
31
|
+
it("should export fast01", () => {
|
|
32
|
+
expect(fast01).toBe("70ms");
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("should export fast02", () => {
|
|
36
|
+
expect(fast02).toBe("110ms");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("should export moderate01", () => {
|
|
40
|
+
expect(moderate01).toBe("150ms");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("should export moderate02", () => {
|
|
44
|
+
expect(moderate02).toBe("240ms");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("should export slow01", () => {
|
|
48
|
+
expect(slow01).toBe("400ms");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("should export slow02", () => {
|
|
52
|
+
expect(slow02).toBe("700ms");
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe("V11 duration tokens", () => {
|
|
57
|
+
it("should export durationFast01 matching fast01", () => {
|
|
58
|
+
expect(durationFast01).toBe(fast01);
|
|
59
|
+
expect(durationFast01).toBe("70ms");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("should export durationFast02 matching fast02", () => {
|
|
63
|
+
expect(durationFast02).toBe(fast02);
|
|
64
|
+
expect(durationFast02).toBe("110ms");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("should export durationModerate01 matching moderate01", () => {
|
|
68
|
+
expect(durationModerate01).toBe(moderate01);
|
|
69
|
+
expect(durationModerate01).toBe("150ms");
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("should export durationModerate02 matching moderate02", () => {
|
|
73
|
+
expect(durationModerate02).toBe(moderate02);
|
|
74
|
+
expect(durationModerate02).toBe("240ms");
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("should export durationSlow01 matching slow01", () => {
|
|
78
|
+
expect(durationSlow01).toBe(slow01);
|
|
79
|
+
expect(durationSlow01).toBe("400ms");
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("should export durationSlow02 matching slow02", () => {
|
|
83
|
+
expect(durationSlow02).toBe(slow02);
|
|
84
|
+
expect(durationSlow02).toBe("700ms");
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe("Duration format", () => {
|
|
89
|
+
it("should have all durations in milliseconds", () => {
|
|
90
|
+
const durations = [
|
|
91
|
+
fast01,
|
|
92
|
+
fast02,
|
|
93
|
+
moderate01,
|
|
94
|
+
moderate02,
|
|
95
|
+
slow01,
|
|
96
|
+
slow02,
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
durations.forEach((duration) => {
|
|
100
|
+
expect(duration).toMatch(/^\d+ms$/);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("should have increasing duration values", () => {
|
|
105
|
+
const fast01Value = parseInt(fast01);
|
|
106
|
+
const fast02Value = parseInt(fast02);
|
|
107
|
+
const moderate01Value = parseInt(moderate01);
|
|
108
|
+
const moderate02Value = parseInt(moderate02);
|
|
109
|
+
const slow01Value = parseInt(slow01);
|
|
110
|
+
const slow02Value = parseInt(slow02);
|
|
111
|
+
|
|
112
|
+
expect(fast01Value).toBeLessThan(fast02Value);
|
|
113
|
+
expect(fast02Value).toBeLessThan(moderate01Value);
|
|
114
|
+
expect(moderate01Value).toBeLessThan(moderate02Value);
|
|
115
|
+
expect(moderate02Value).toBeLessThan(slow01Value);
|
|
116
|
+
expect(slow01Value).toBeLessThan(slow02Value);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
describe("unstable_tokens", () => {
|
|
121
|
+
it("should export an array of token names", () => {
|
|
122
|
+
expect(Array.isArray(unstable_tokens)).toBe(true);
|
|
123
|
+
expect(unstable_tokens.length).toBe(12);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("should include all legacy tokens", () => {
|
|
127
|
+
expect(unstable_tokens).toContain("fast01");
|
|
128
|
+
expect(unstable_tokens).toContain("fast02");
|
|
129
|
+
expect(unstable_tokens).toContain("moderate01");
|
|
130
|
+
expect(unstable_tokens).toContain("moderate02");
|
|
131
|
+
expect(unstable_tokens).toContain("slow01");
|
|
132
|
+
expect(unstable_tokens).toContain("slow02");
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it("should include all V11 tokens", () => {
|
|
136
|
+
expect(unstable_tokens).toContain("durationFast01");
|
|
137
|
+
expect(unstable_tokens).toContain("durationFast02");
|
|
138
|
+
expect(unstable_tokens).toContain("durationModerate01");
|
|
139
|
+
expect(unstable_tokens).toContain("durationModerate02");
|
|
140
|
+
expect(unstable_tokens).toContain("durationSlow01");
|
|
141
|
+
expect(unstable_tokens).toContain("durationSlow02");
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
describe("Easings", () => {
|
|
147
|
+
describe("easings object structure", () => {
|
|
148
|
+
it("should export easings object", () => {
|
|
149
|
+
expect(easings).toBeDefined();
|
|
150
|
+
expect(typeof easings).toBe("object");
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it("should have standard, entrance, and exit types", () => {
|
|
154
|
+
expect(easings.standard).toBeDefined();
|
|
155
|
+
expect(easings.entrance).toBeDefined();
|
|
156
|
+
expect(easings.exit).toBeDefined();
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("should have productive and expressive modes for each type", () => {
|
|
160
|
+
["standard", "entrance", "exit"].forEach((type) => {
|
|
161
|
+
expect(easings[type].productive).toBeDefined();
|
|
162
|
+
expect(easings[type].expressive).toBeDefined();
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
describe("easing values", () => {
|
|
168
|
+
it("should have standard productive easing", () => {
|
|
169
|
+
expect(easings.standard.productive).toBe(
|
|
170
|
+
"cubic-bezier(0.2, 0, 0.38, 0.9)",
|
|
171
|
+
);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it("should have standard expressive easing", () => {
|
|
175
|
+
expect(easings.standard.expressive).toBe(
|
|
176
|
+
"cubic-bezier(0.4, 0.14, 0.3, 1)",
|
|
177
|
+
);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it("should have entrance productive easing", () => {
|
|
181
|
+
expect(easings.entrance.productive).toBe("cubic-bezier(0, 0, 0.38, 0.9)");
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it("should have entrance expressive easing", () => {
|
|
185
|
+
expect(easings.entrance.expressive).toBe("cubic-bezier(0, 0, 0.3, 1)");
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it("should have exit productive easing", () => {
|
|
189
|
+
expect(easings.exit.productive).toBe("cubic-bezier(0.2, 0, 1, 0.9)");
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it("should have exit expressive easing", () => {
|
|
193
|
+
expect(easings.exit.expressive).toBe("cubic-bezier(0.4, 0.14, 1, 1)");
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
describe("easing format", () => {
|
|
198
|
+
it("should have all easings in cubic-bezier format", () => {
|
|
199
|
+
const cubicBezierRegex =
|
|
200
|
+
/^cubic-bezier\([0-9.]+,\s*[0-9.]+,\s*[0-9.]+,\s*[0-9.]+\)$/;
|
|
201
|
+
|
|
202
|
+
Object.values(easings).forEach((typeEasings) => {
|
|
203
|
+
Object.values(typeEasings).forEach((easing) => {
|
|
204
|
+
expect(easing).toMatch(cubicBezierRegex);
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
describe("motion function", () => {
|
|
212
|
+
describe("valid inputs", () => {
|
|
213
|
+
it("should return standard productive easing", () => {
|
|
214
|
+
expect(motion("standard", "productive")).toBe(
|
|
215
|
+
"cubic-bezier(0.2, 0, 0.38, 0.9)",
|
|
216
|
+
);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it("should return standard expressive easing", () => {
|
|
220
|
+
expect(motion("standard", "expressive")).toBe(
|
|
221
|
+
"cubic-bezier(0.4, 0.14, 0.3, 1)",
|
|
222
|
+
);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it("should return entrance productive easing", () => {
|
|
226
|
+
expect(motion("entrance", "productive")).toBe(
|
|
227
|
+
"cubic-bezier(0, 0, 0.38, 0.9)",
|
|
228
|
+
);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it("should return entrance expressive easing", () => {
|
|
232
|
+
expect(motion("entrance", "expressive")).toBe(
|
|
233
|
+
"cubic-bezier(0, 0, 0.3, 1)",
|
|
234
|
+
);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it("should return exit productive easing", () => {
|
|
238
|
+
expect(motion("exit", "productive")).toBe("cubic-bezier(0.2, 0, 1, 0.9)");
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it("should return exit expressive easing", () => {
|
|
242
|
+
expect(motion("exit", "expressive")).toBe(
|
|
243
|
+
"cubic-bezier(0.4, 0.14, 1, 1)",
|
|
244
|
+
);
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
describe("error handling", () => {
|
|
249
|
+
it("should throw error for invalid easing name", () => {
|
|
250
|
+
expect(() => motion("invalid", "productive")).toThrow();
|
|
251
|
+
expect(() => motion("invalid", "productive")).toThrow(
|
|
252
|
+
/Unable to find easing/,
|
|
253
|
+
);
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
it("should throw error for invalid mode", () => {
|
|
257
|
+
expect(() => motion("standard", "invalid")).toThrow();
|
|
258
|
+
expect(() => motion("standard", "invalid")).toThrow(
|
|
259
|
+
/Unable to find a mode/,
|
|
260
|
+
);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it("should include available easings in error message", () => {
|
|
264
|
+
expect(() => motion("invalid", "productive")).toThrow(
|
|
265
|
+
/standard, entrance, exit/,
|
|
266
|
+
);
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it("should mention the invalid easing name in error", () => {
|
|
270
|
+
expect(() => motion("wrong", "productive")).toThrow(/wrong/);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it("should mention the invalid mode in error", () => {
|
|
274
|
+
expect(() => motion("standard", "wrong")).toThrow(/wrong/);
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
describe("all combinations", () => {
|
|
279
|
+
it("should work for all valid type and mode combinations", () => {
|
|
280
|
+
const types = ["standard", "entrance", "exit"];
|
|
281
|
+
const modes = ["productive", "expressive"];
|
|
282
|
+
|
|
283
|
+
types.forEach((type) => {
|
|
284
|
+
modes.forEach((mode) => {
|
|
285
|
+
const result = motion(type, mode);
|
|
286
|
+
expect(result).toBeDefined();
|
|
287
|
+
expect(typeof result).toBe("string");
|
|
288
|
+
expect(result).toMatch(/^cubic-bezier/);
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
});
|
package/umd/index.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.OctaviaFlowMotion = {}));
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
|
+
|
|
7
|
+
const fast01 = "70ms";
|
|
8
|
+
const fast02 = "110ms";
|
|
9
|
+
const moderate01 = "150ms";
|
|
10
|
+
const moderate02 = "240ms";
|
|
11
|
+
const slow01 = "400ms";
|
|
12
|
+
const slow02 = "700ms";
|
|
13
|
+
const durationFast01 = fast01;
|
|
14
|
+
const durationFast02 = fast02;
|
|
15
|
+
const durationModerate01 = moderate01;
|
|
16
|
+
const durationModerate02 = moderate02;
|
|
17
|
+
const durationSlow01 = slow01;
|
|
18
|
+
const durationSlow02 = slow02;
|
|
19
|
+
const unstable_tokens = [
|
|
20
|
+
"fast01",
|
|
21
|
+
"fast02",
|
|
22
|
+
"moderate01",
|
|
23
|
+
"moderate02",
|
|
24
|
+
"slow01",
|
|
25
|
+
"slow02",
|
|
26
|
+
"durationFast01",
|
|
27
|
+
"durationFast02",
|
|
28
|
+
"durationModerate01",
|
|
29
|
+
"durationModerate02",
|
|
30
|
+
"durationSlow01",
|
|
31
|
+
"durationSlow02"
|
|
32
|
+
];
|
|
33
|
+
const easings = {
|
|
34
|
+
standard: {
|
|
35
|
+
productive: "cubic-bezier(0.2, 0, 0.38, 0.9)",
|
|
36
|
+
expressive: "cubic-bezier(0.4, 0.14, 0.3, 1)"
|
|
37
|
+
},
|
|
38
|
+
entrance: {
|
|
39
|
+
productive: "cubic-bezier(0, 0, 0.38, 0.9)",
|
|
40
|
+
expressive: "cubic-bezier(0, 0, 0.3, 1)"
|
|
41
|
+
},
|
|
42
|
+
exit: {
|
|
43
|
+
productive: "cubic-bezier(0.2, 0, 1, 0.9)",
|
|
44
|
+
expressive: "cubic-bezier(0.4, 0.14, 1, 1)"
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
function motion(name, mode) {
|
|
48
|
+
if (!easings[name]) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
`Unable to find easing \`${name}\` in our supported easings. Expected One of: ${Object.keys(easings).join(", ")}`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
const easing = easings[name];
|
|
54
|
+
if (!easing[mode]) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`Unable to find a mode for the easing \`${name}\` called: \`${mode}\``
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return easing[mode];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
exports.durationFast01 = durationFast01;
|
|
63
|
+
exports.durationFast02 = durationFast02;
|
|
64
|
+
exports.durationModerate01 = durationModerate01;
|
|
65
|
+
exports.durationModerate02 = durationModerate02;
|
|
66
|
+
exports.durationSlow01 = durationSlow01;
|
|
67
|
+
exports.durationSlow02 = durationSlow02;
|
|
68
|
+
exports.easings = easings;
|
|
69
|
+
exports.fast01 = fast01;
|
|
70
|
+
exports.fast02 = fast02;
|
|
71
|
+
exports.moderate01 = moderate01;
|
|
72
|
+
exports.moderate02 = moderate02;
|
|
73
|
+
exports.motion = motion;
|
|
74
|
+
exports.slow01 = slow01;
|
|
75
|
+
exports.slow02 = slow02;
|
|
76
|
+
exports.unstable_tokens = unstable_tokens;
|
|
77
|
+
|
|
78
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
79
|
+
|
|
80
|
+
}));
|