@carbon/motion 11.43.0 → 11.44.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/es/index.js +6 -6
- package/lib/index.d.ts +24 -0
- package/lib/index.js +6 -6
- package/package.json +8 -4
- package/src/{index.js → index.ts} +12 -7
- package/tsconfig.json +8 -0
- package/tsconfig.types.json +9 -0
- package/umd/index.js +6 -6
package/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//#region src/index.
|
|
1
|
+
//#region src/index.ts
|
|
2
2
|
/**
|
|
3
|
-
* Copyright IBM Corp. 2018,
|
|
3
|
+
* Copyright IBM Corp. 2018, 2026
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -45,12 +45,12 @@ const easings = {
|
|
|
45
45
|
expressive: "cubic-bezier(0.4, 0.14, 1, 1)"
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
|
|
49
|
-
if (!easings[name]) throw new Error(`Unable to find easing \`${name}\` in our supported easings. Expected
|
|
48
|
+
const motion = (name, mode) => {
|
|
49
|
+
if (!easings[name]) throw new Error(`Unable to find easing \`${name}\` in our supported easings. Expected one of: ${Object.keys(easings).join(", ")}`);
|
|
50
50
|
const easing = easings[name];
|
|
51
|
-
if (!easing[mode]) throw new Error(`Unable to find a mode for the easing \`${name}\` called: \`${mode}
|
|
51
|
+
if (!easing[mode]) throw new Error(`Unable to find a mode for the easing \`${name}\` called: \`${mode}\`. Expected one of: ${Object.keys(easing).join(", ")}`);
|
|
52
52
|
return easing[mode];
|
|
53
|
-
}
|
|
53
|
+
};
|
|
54
54
|
|
|
55
55
|
//#endregion
|
|
56
56
|
export { durationFast01, durationFast02, durationModerate01, durationModerate02, durationSlow01, durationSlow02, easings, fast01, fast02, moderate01, moderate02, motion, slow01, slow02, unstable_tokens };
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2018, 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export declare const fast01 = "70ms";
|
|
8
|
+
export declare const fast02 = "110ms";
|
|
9
|
+
export declare const moderate01 = "150ms";
|
|
10
|
+
export declare const moderate02 = "240ms";
|
|
11
|
+
export declare const slow01 = "400ms";
|
|
12
|
+
export declare const slow02 = "700ms";
|
|
13
|
+
export declare const durationFast01 = "70ms";
|
|
14
|
+
export declare const durationFast02 = "110ms";
|
|
15
|
+
export declare const durationModerate01 = "150ms";
|
|
16
|
+
export declare const durationModerate02 = "240ms";
|
|
17
|
+
export declare const durationSlow01 = "400ms";
|
|
18
|
+
export declare const durationSlow02 = "700ms";
|
|
19
|
+
export declare const unstable_tokens: readonly ["fast01", "fast02", "moderate01", "moderate02", "slow01", "slow02", "durationFast01", "durationFast02", "durationModerate01", "durationModerate02", "durationSlow01", "durationSlow02"];
|
|
20
|
+
export type EasingName = 'standard' | 'entrance' | 'exit';
|
|
21
|
+
export type EasingMode = 'productive' | 'expressive';
|
|
22
|
+
export type EasingMap = Record<EasingName, Record<EasingMode, string>>;
|
|
23
|
+
export declare const easings: EasingMap;
|
|
24
|
+
export declare const motion: (name: EasingName, mode: EasingMode) => string;
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
//#region src/index.
|
|
3
|
+
//#region src/index.ts
|
|
4
4
|
/**
|
|
5
|
-
* Copyright IBM Corp. 2018,
|
|
5
|
+
* Copyright IBM Corp. 2018, 2026
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -47,12 +47,12 @@ const easings = {
|
|
|
47
47
|
expressive: "cubic-bezier(0.4, 0.14, 1, 1)"
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
|
|
51
|
-
if (!easings[name]) throw new Error(`Unable to find easing \`${name}\` in our supported easings. Expected
|
|
50
|
+
const motion = (name, mode) => {
|
|
51
|
+
if (!easings[name]) throw new Error(`Unable to find easing \`${name}\` in our supported easings. Expected one of: ${Object.keys(easings).join(", ")}`);
|
|
52
52
|
const easing = easings[name];
|
|
53
|
-
if (!easing[mode]) throw new Error(`Unable to find a mode for the easing \`${name}\` called: \`${mode}
|
|
53
|
+
if (!easing[mode]) throw new Error(`Unable to find a mode for the easing \`${name}\` called: \`${mode}\`. Expected one of: ${Object.keys(easing).join(", ")}`);
|
|
54
54
|
return easing[mode];
|
|
55
|
-
}
|
|
55
|
+
};
|
|
56
56
|
|
|
57
57
|
//#endregion
|
|
58
58
|
exports.durationFast01 = durationFast01;
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/motion",
|
|
3
3
|
"description": "Motion helpers for digital and software products using the Carbon Design System",
|
|
4
|
-
"version": "11.
|
|
4
|
+
"version": "11.44.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
8
|
+
"types": "lib/index.d.ts",
|
|
8
9
|
"sass": "index.scss",
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
@@ -26,16 +27,19 @@
|
|
|
26
27
|
"provenance": true
|
|
27
28
|
},
|
|
28
29
|
"scripts": {
|
|
29
|
-
"build": "
|
|
30
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
31
|
+
"build": "yarn clean && carbon-cli bundle src/index.ts --name CarbonMotion && yarn build:types",
|
|
30
32
|
"clean": "rimraf es lib umd",
|
|
31
33
|
"postinstall": "ibmtelemetry --config=telemetry.yml"
|
|
32
34
|
},
|
|
33
35
|
"devDependencies": {
|
|
34
36
|
"@carbon/cli": "^11.42.0",
|
|
35
|
-
"rimraf": "^6.0.1"
|
|
37
|
+
"rimraf": "^6.0.1",
|
|
38
|
+
"typescript": "^5.7.3",
|
|
39
|
+
"typescript-config-carbon": "^0.9.0"
|
|
36
40
|
},
|
|
37
41
|
"dependencies": {
|
|
38
42
|
"@ibm/telemetry-js": "^1.5.0"
|
|
39
43
|
},
|
|
40
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "937649543e9cc6af9dfb6b53a2adb76760bca986"
|
|
41
45
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2018,
|
|
2
|
+
* Copyright IBM Corp. 2018, 2026
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -32,9 +32,13 @@ export const unstable_tokens = [
|
|
|
32
32
|
'durationModerate02',
|
|
33
33
|
'durationSlow01',
|
|
34
34
|
'durationSlow02',
|
|
35
|
-
];
|
|
35
|
+
] as const;
|
|
36
36
|
|
|
37
|
-
export
|
|
37
|
+
export type EasingName = 'standard' | 'entrance' | 'exit';
|
|
38
|
+
export type EasingMode = 'productive' | 'expressive';
|
|
39
|
+
export type EasingMap = Record<EasingName, Record<EasingMode, string>>;
|
|
40
|
+
|
|
41
|
+
export const easings: EasingMap = {
|
|
38
42
|
standard: {
|
|
39
43
|
productive: 'cubic-bezier(0.2, 0, 0.38, 0.9)',
|
|
40
44
|
expressive: 'cubic-bezier(0.4, 0.14, 0.3, 1)',
|
|
@@ -49,20 +53,21 @@ export const easings = {
|
|
|
49
53
|
},
|
|
50
54
|
};
|
|
51
55
|
|
|
52
|
-
export
|
|
56
|
+
export const motion = (name: EasingName, mode: EasingMode) => {
|
|
53
57
|
if (!easings[name]) {
|
|
54
58
|
throw new Error(
|
|
55
59
|
`Unable to find easing \`${name}\` in our supported easings. Expected ` +
|
|
56
|
-
`
|
|
60
|
+
`one of: ${Object.keys(easings).join(', ')}`
|
|
57
61
|
);
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
const easing = easings[name];
|
|
61
65
|
if (!easing[mode]) {
|
|
62
66
|
throw new Error(
|
|
63
|
-
`Unable to find a mode for the easing \`${name}\` called: \`${mode}
|
|
67
|
+
`Unable to find a mode for the easing \`${name}\` called: \`${mode}\`. ` +
|
|
68
|
+
`Expected one of: ${Object.keys(easing).join(', ')}`
|
|
64
69
|
);
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
return easing[mode];
|
|
68
|
-
}
|
|
73
|
+
};
|
package/tsconfig.json
ADDED
package/umd/index.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
})(this, function(exports) {
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
7
7
|
|
|
8
|
-
//#region src/index.
|
|
8
|
+
//#region src/index.ts
|
|
9
9
|
/**
|
|
10
|
-
* Copyright IBM Corp. 2018,
|
|
10
|
+
* Copyright IBM Corp. 2018, 2026
|
|
11
11
|
*
|
|
12
12
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -52,12 +52,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
52
52
|
expressive: "cubic-bezier(0.4, 0.14, 1, 1)"
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
|
|
56
|
-
if (!easings[name]) throw new Error(`Unable to find easing \`${name}\` in our supported easings. Expected
|
|
55
|
+
const motion = (name, mode) => {
|
|
56
|
+
if (!easings[name]) throw new Error(`Unable to find easing \`${name}\` in our supported easings. Expected one of: ${Object.keys(easings).join(", ")}`);
|
|
57
57
|
const easing = easings[name];
|
|
58
|
-
if (!easing[mode]) throw new Error(`Unable to find a mode for the easing \`${name}\` called: \`${mode}
|
|
58
|
+
if (!easing[mode]) throw new Error(`Unable to find a mode for the easing \`${name}\` called: \`${mode}\`. Expected one of: ${Object.keys(easing).join(", ")}`);
|
|
59
59
|
return easing[mode];
|
|
60
|
-
}
|
|
60
|
+
};
|
|
61
61
|
|
|
62
62
|
//#endregion
|
|
63
63
|
exports.durationFast01 = durationFast01;
|