motionframe-plugins 1.0.3 → 1.0.4
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/package.json +3 -3
- package/src/catalog.js +1 -1
- package/src/config.js +6 -6
- package/src/styles.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motionframe-plugins",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A configurable, namespaced Animate.css integration for Tailwind CSS",
|
|
5
5
|
"main": "plugin.js",
|
|
6
6
|
"exports": "./plugin.js",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"README.md",
|
|
11
11
|
"LICENSE"
|
|
12
12
|
],
|
|
13
|
-
"homepage": "https://sericpieap.github.io/tailwind-
|
|
14
|
-
"repository": "https://github.com/sericpieap/tailwind-
|
|
13
|
+
"homepage": "https://sericpieap.github.io/animatecss-tailwind-adapter/",
|
|
14
|
+
"repository": "https://github.com/sericpieap/animatecss-tailwind-adapter/",
|
|
15
15
|
"author": "sericpieap",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"keywords": [
|
package/src/catalog.js
CHANGED
|
@@ -10,7 +10,7 @@ function animateCssPath() {
|
|
|
10
10
|
try {
|
|
11
11
|
return require.resolve('animate.css/animate.css');
|
|
12
12
|
} catch (error) {
|
|
13
|
-
const wrapped = new Error('animatecss-tailwind-
|
|
13
|
+
const wrapped = new Error('animatecss-tailwind-adapter: unable to resolve animate.css/animate.css');
|
|
14
14
|
wrapped.cause = error;
|
|
15
15
|
throw wrapped;
|
|
16
16
|
}
|
package/src/config.js
CHANGED
|
@@ -36,7 +36,7 @@ const isRecord = value => value !== null && typeof value === 'object' && !Array.
|
|
|
36
36
|
|
|
37
37
|
function assertString(value, path) {
|
|
38
38
|
if (typeof value !== 'string' || value.trim() === '') {
|
|
39
|
-
throw new TypeError(`animatecss-tailwind-
|
|
39
|
+
throw new TypeError(`animatecss-tailwind-adapter: ${path} must be a non-empty string`);
|
|
40
40
|
}
|
|
41
41
|
return value.trim();
|
|
42
42
|
}
|
|
@@ -44,13 +44,13 @@ function assertString(value, path) {
|
|
|
44
44
|
function stringList(value, path, allowWildcard = false) {
|
|
45
45
|
if (allowWildcard && value === '*') return '*';
|
|
46
46
|
if (!Array.isArray(value)) {
|
|
47
|
-
throw new TypeError(`animatecss-tailwind-
|
|
47
|
+
throw new TypeError(`animatecss-tailwind-adapter: ${path} must be an array${allowWildcard ? " or '*'" : ''}`);
|
|
48
48
|
}
|
|
49
49
|
return [...new Set(value.map((item, index) => assertString(item, `${path}[${index}]`)))];
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
function stringMap(value, path) {
|
|
53
|
-
if (!isRecord(value)) throw new TypeError(`animatecss-tailwind-
|
|
53
|
+
if (!isRecord(value)) throw new TypeError(`animatecss-tailwind-adapter: ${path} must be an object`);
|
|
54
54
|
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
55
55
|
assertString(key, `${path} key`),
|
|
56
56
|
assertString(item, `${path}.${key}`)
|
|
@@ -58,7 +58,7 @@ function stringMap(value, path) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
function normalizeOptions(options) {
|
|
61
|
-
if (!isRecord(options)) throw new TypeError('animatecss-tailwind-
|
|
61
|
+
if (!isRecord(options)) throw new TypeError('animatecss-tailwind-adapter: options must be an object');
|
|
62
62
|
|
|
63
63
|
const config = {
|
|
64
64
|
prefix: assertString(options.prefix ?? DEFAULTS.prefix, 'prefix'),
|
|
@@ -78,12 +78,12 @@ function normalizeOptions(options) {
|
|
|
78
78
|
|
|
79
79
|
['namespaceKeyframes', 'respectReducedMotion', 'modifiers'].forEach((key) => {
|
|
80
80
|
if (typeof config[key] !== 'boolean') {
|
|
81
|
-
throw new TypeError(`animatecss-tailwind-
|
|
81
|
+
throw new TypeError(`animatecss-tailwind-adapter: ${key} must be a boolean`);
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
|
|
85
85
|
if (!/^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$/.test(config.prefix)) {
|
|
86
|
-
throw new TypeError('animatecss-tailwind-
|
|
86
|
+
throw new TypeError('animatecss-tailwind-adapter: prefix must be a valid CSS class identifier');
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
return Object.freeze(config);
|
package/src/styles.js
CHANGED
|
@@ -14,7 +14,7 @@ function selectAnimations(catalog, config) {
|
|
|
14
14
|
|
|
15
15
|
if (unknown.length || badAliases.length) {
|
|
16
16
|
const invalid = [...unknown, ...badAliases.map(([alias, target]) => `${alias} -> ${target}`)];
|
|
17
|
-
throw new Error(`animatecss-tailwind-
|
|
17
|
+
throw new Error(`animatecss-tailwind-adapter: unknown animation(s): ${invalid.join(', ')}`);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const selected = requested
|