@udixio/tailwind 2.0.0 → 2.2.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/CHANGELOG.md +21 -0
- package/dist/browser.cjs +1 -1
- package/dist/browser.js +2 -2
- package/dist/node.cjs +1 -1
- package/dist/node.js +2 -2
- package/dist/plugins-tailwind/animation.d.ts.map +1 -1
- package/dist/{tailwind.plugin-ImuL0_jV.cjs → tailwind.plugin-BS-y_NhA.cjs} +70 -54
- package/dist/{tailwind.plugin-DLbaMny3.js → tailwind.plugin-BWkO2e-A.js} +70 -54
- package/package.json +1 -1
- package/src/plugins-tailwind/animation.ts +80 -53
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## 2.2.0 (2025-10-16)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **animation:** refactor `createAnimation` to support enhanced parameterization and new utilities ([96d1423](https://github.com/Udixio/UI/commit/96d1423))
|
|
6
|
+
- **animation:** add `supportsNegativeValues` and enhance `slide` utility generation ([e9558db](https://github.com/Udixio/UI/commit/e9558db))
|
|
7
|
+
|
|
8
|
+
### ❤️ Thank You
|
|
9
|
+
|
|
10
|
+
- Joël VIGREUX
|
|
11
|
+
|
|
12
|
+
## 2.1.0 (2025-10-16)
|
|
13
|
+
|
|
14
|
+
### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- **animation:** remove redundant `updateAnimNamesAndWillChange` logic and centralize handling in `animation` plugin ([d13c4d7](https://github.com/Udixio/UI/commit/d13c4d7))
|
|
17
|
+
|
|
18
|
+
### ❤️ Thank You
|
|
19
|
+
|
|
20
|
+
- Joël VIGREUX
|
|
21
|
+
|
|
1
22
|
# 2.0.0 (2025-10-15)
|
|
2
23
|
|
|
3
24
|
### 🚀 Features
|
package/dist/browser.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const tailwind_plugin = require("./tailwind.plugin-
|
|
3
|
+
const tailwind_plugin = require("./tailwind.plugin-BS-y_NhA.cjs");
|
|
4
4
|
exports.TailwindImplPluginBrowser = tailwind_plugin.TailwindImplPluginBrowser;
|
|
5
5
|
exports.TailwindPlugin = tailwind_plugin.TailwindPlugin;
|
|
6
6
|
exports.animation = tailwind_plugin.animation;
|
package/dist/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as main } from "./tailwind.plugin-
|
|
2
|
-
import { T, b, a, f, s } from "./tailwind.plugin-
|
|
1
|
+
import { m as main } from "./tailwind.plugin-BWkO2e-A.js";
|
|
2
|
+
import { T, b, a, f, s } from "./tailwind.plugin-BWkO2e-A.js";
|
|
3
3
|
export {
|
|
4
4
|
T as TailwindImplPluginBrowser,
|
|
5
5
|
b as TailwindPlugin,
|
package/dist/node.cjs
CHANGED
|
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
));
|
|
25
25
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
26
26
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
27
|
-
const tailwind_plugin = require("./tailwind.plugin-
|
|
27
|
+
const tailwind_plugin = require("./tailwind.plugin-BS-y_NhA.cjs");
|
|
28
28
|
const theme = require("@udixio/theme");
|
|
29
29
|
const fs = require("fs");
|
|
30
30
|
const console = require("node:console");
|
package/dist/node.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { T as TailwindImplPluginBrowser, m as main } from "./tailwind.plugin-
|
|
5
|
-
import { a, f, s } from "./tailwind.plugin-
|
|
4
|
+
import { T as TailwindImplPluginBrowser, m as main } from "./tailwind.plugin-BWkO2e-A.js";
|
|
5
|
+
import { a, f, s } from "./tailwind.plugin-BWkO2e-A.js";
|
|
6
6
|
import { PluginAbstract, FontPlugin } from "@udixio/theme";
|
|
7
7
|
import * as fs from "fs";
|
|
8
8
|
import * as console from "node:console";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../src/plugins-tailwind/animation.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../src/plugins-tailwind/animation.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAiHD,eAAO,MAAM,SAAS,sFAocrB,CAAC"}
|
|
@@ -10,24 +10,24 @@ const createAnimationFunc = ({
|
|
|
10
10
|
addBase,
|
|
11
11
|
prefix,
|
|
12
12
|
matchUtilities,
|
|
13
|
-
addUtilities
|
|
13
|
+
addUtilities,
|
|
14
|
+
animationNames
|
|
14
15
|
}) => (name, styles, values, callback) => {
|
|
16
|
+
animationNames.add(name);
|
|
15
17
|
const variableName = (propertyName) => {
|
|
16
18
|
return `--${prefix}-${propertyName}`;
|
|
17
19
|
};
|
|
18
|
-
const param = (propertyName) => {
|
|
19
|
-
var _a;
|
|
20
|
-
const defaultValue = (_a = values[propertyName]) == null ? void 0 : _a.DEFAULT;
|
|
20
|
+
const param = (propertyName, defaultValue = ((_a) => (_a = values[propertyName]) == null ? void 0 : _a.DEFAULT)()) => {
|
|
21
21
|
return `var(${variableName(propertyName)} ${defaultValue ? `, ${defaultValue}` : ""})`;
|
|
22
22
|
};
|
|
23
23
|
const dependencies = [];
|
|
24
|
-
Object.values(styles(param)).forEach((step) => {
|
|
24
|
+
Object.values(styles({ param, variableName })).forEach((step) => {
|
|
25
25
|
Object.keys(step).forEach((key) => {
|
|
26
26
|
dependencies.push(textCase.kebabCase(key));
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
addBase({
|
|
30
|
-
[`@keyframes ${prefix}-${name}`]: styles(param)
|
|
30
|
+
[`@keyframes ${prefix}-${name}`]: styles({ param, variableName })
|
|
31
31
|
});
|
|
32
32
|
addUtilities({
|
|
33
33
|
[`.${prefix}-${name}, .${prefix}-${name}-in, .${prefix}-${name}-out`]: {
|
|
@@ -67,7 +67,8 @@ const createAnimationFunc = ({
|
|
|
67
67
|
})
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
|
-
values: value.values
|
|
70
|
+
values: value.values,
|
|
71
|
+
supportsNegativeValues: value.supportsNegativeValues
|
|
71
72
|
}
|
|
72
73
|
);
|
|
73
74
|
});
|
|
@@ -75,12 +76,14 @@ const createAnimationFunc = ({
|
|
|
75
76
|
};
|
|
76
77
|
const animation = plugin.withOptions(
|
|
77
78
|
({ prefix = "anim" }) => {
|
|
78
|
-
return ({ addBase, matchUtilities, addUtilities }) => {
|
|
79
|
+
return ({ addBase, matchUtilities, addUtilities, theme: theme2 }) => {
|
|
80
|
+
const animationNames = /* @__PURE__ */ new Set();
|
|
79
81
|
const createAnimation = createAnimationFunc({
|
|
80
82
|
addBase,
|
|
81
83
|
prefix,
|
|
82
84
|
matchUtilities,
|
|
83
|
-
addUtilities
|
|
85
|
+
addUtilities,
|
|
86
|
+
animationNames
|
|
84
87
|
});
|
|
85
88
|
addBase({
|
|
86
89
|
"@keyframes enter": {
|
|
@@ -122,14 +125,15 @@ const animation = plugin.withOptions(
|
|
|
122
125
|
});
|
|
123
126
|
createAnimation(
|
|
124
127
|
"fade",
|
|
125
|
-
(
|
|
128
|
+
({ param }) => ({
|
|
126
129
|
from: {
|
|
127
|
-
opacity:
|
|
130
|
+
opacity: param("opacity")
|
|
128
131
|
}
|
|
129
132
|
}),
|
|
130
133
|
{
|
|
131
134
|
opacity: {
|
|
132
135
|
DEFAULT: "0",
|
|
136
|
+
supportsNegativeValues: true,
|
|
133
137
|
values: {
|
|
134
138
|
0: "0",
|
|
135
139
|
5: "0.05",
|
|
@@ -152,13 +156,45 @@ const animation = plugin.withOptions(
|
|
|
152
156
|
);
|
|
153
157
|
createAnimation(
|
|
154
158
|
"scale",
|
|
155
|
-
(
|
|
159
|
+
({ param, variableName }) => ({
|
|
156
160
|
from: {
|
|
157
|
-
scale:
|
|
161
|
+
scale: `${param("scale-x", param("scale"))} ${param("scale-y", param("scale"))}`
|
|
158
162
|
}
|
|
159
163
|
}),
|
|
160
164
|
{
|
|
161
|
-
scale: {
|
|
165
|
+
["scale"]: {
|
|
166
|
+
DEFAULT: ".95",
|
|
167
|
+
values: {
|
|
168
|
+
0: "0",
|
|
169
|
+
50: ".5",
|
|
170
|
+
75: ".75",
|
|
171
|
+
90: ".9",
|
|
172
|
+
95: ".95",
|
|
173
|
+
100: "1",
|
|
174
|
+
105: "1.05",
|
|
175
|
+
110: "1.1",
|
|
176
|
+
125: "1.25",
|
|
177
|
+
150: "1.5"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
["scale-x"]: {
|
|
181
|
+
as: "x",
|
|
182
|
+
DEFAULT: ".95",
|
|
183
|
+
values: {
|
|
184
|
+
0: "0",
|
|
185
|
+
50: ".5",
|
|
186
|
+
75: ".75",
|
|
187
|
+
90: ".9",
|
|
188
|
+
95: ".95",
|
|
189
|
+
100: "1",
|
|
190
|
+
105: "1.05",
|
|
191
|
+
110: "1.1",
|
|
192
|
+
125: "1.25",
|
|
193
|
+
150: "1.5"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
["scale-y"]: {
|
|
197
|
+
as: "y",
|
|
162
198
|
DEFAULT: ".95",
|
|
163
199
|
values: {
|
|
164
200
|
0: "0",
|
|
@@ -178,47 +214,22 @@ const animation = plugin.withOptions(
|
|
|
178
214
|
const slideValues = {
|
|
179
215
|
DEFAULT: "2rem",
|
|
180
216
|
values: {
|
|
217
|
+
...theme2("spacing"),
|
|
218
|
+
// échelle spacing
|
|
181
219
|
full: "100%",
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
1: "
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
4: "1rem",
|
|
192
|
-
5: "1.25rem",
|
|
193
|
-
6: "1.5rem",
|
|
194
|
-
7: "1.75rem",
|
|
195
|
-
8: "2rem",
|
|
196
|
-
9: "2.25rem",
|
|
197
|
-
10: "2.5rem",
|
|
198
|
-
11: "2.75rem",
|
|
199
|
-
12: "3rem",
|
|
200
|
-
14: "3.5rem",
|
|
201
|
-
16: "4rem",
|
|
202
|
-
20: "5rem",
|
|
203
|
-
24: "6rem",
|
|
204
|
-
28: "7rem",
|
|
205
|
-
32: "8rem",
|
|
206
|
-
36: "9rem",
|
|
207
|
-
40: "10rem",
|
|
208
|
-
44: "11rem",
|
|
209
|
-
48: "12rem",
|
|
210
|
-
52: "13rem",
|
|
211
|
-
56: "14rem",
|
|
212
|
-
60: "15rem",
|
|
213
|
-
64: "16rem",
|
|
214
|
-
72: "18rem",
|
|
215
|
-
80: "20rem",
|
|
216
|
-
96: "24rem"
|
|
217
|
-
}
|
|
220
|
+
// ajout de "full"
|
|
221
|
+
"1/2": "50%",
|
|
222
|
+
// (optionnel) fractions
|
|
223
|
+
"1/3": "33.333333%",
|
|
224
|
+
"2/3": "66.666667%",
|
|
225
|
+
"1/4": "25%",
|
|
226
|
+
"3/4": "75%"
|
|
227
|
+
},
|
|
228
|
+
supportsNegativeValues: true
|
|
218
229
|
};
|
|
219
230
|
createAnimation(
|
|
220
231
|
"slide",
|
|
221
|
-
(param) => ({
|
|
232
|
+
({ param }) => ({
|
|
222
233
|
from: {
|
|
223
234
|
translate: `calc(${param("distance")} * ${param("dx")}) calc(${param("distance")} * ${param("dy")});`
|
|
224
235
|
},
|
|
@@ -276,8 +287,8 @@ const animation = plugin.withOptions(
|
|
|
276
287
|
const dxdy = {
|
|
277
288
|
"from-top": { dx: "0", dy: "1" },
|
|
278
289
|
"from-bottom": { dx: "0", dy: "-1" },
|
|
279
|
-
"from-left": { dx: "1", dy: "0" },
|
|
280
|
-
"from-right": { dx: "
|
|
290
|
+
"from-left": { dx: "-1", dy: "0" },
|
|
291
|
+
"from-right": { dx: "1", dy: "0" },
|
|
281
292
|
"from-top-left": { dx: "1", dy: "1" },
|
|
282
293
|
"from-top-right": { dx: "-1", dy: "1" },
|
|
283
294
|
"from-bottom-left": { dx: "1", dy: "-1" },
|
|
@@ -305,7 +316,6 @@ const animation = plugin.withOptions(
|
|
|
305
316
|
});
|
|
306
317
|
addUtilities({
|
|
307
318
|
[`.${prefix}-${name}-scroll-${directionAlias}`]: {
|
|
308
|
-
[`--${prefix}-name-${name}-${directionAlias}`]: `${prefix}-${name}`,
|
|
309
319
|
[`--${prefix}-name-${name}`]: `${prefix}-${name}`,
|
|
310
320
|
[`--${prefix}-dependencies-${name}`]: dependencies.join(", "),
|
|
311
321
|
animationTimeline: `var(--${prefix}-timeline, view())`,
|
|
@@ -440,6 +450,12 @@ const animation = plugin.withOptions(
|
|
|
440
450
|
}
|
|
441
451
|
}
|
|
442
452
|
);
|
|
453
|
+
addBase({
|
|
454
|
+
[`[class*="${prefix}-"]`]: {
|
|
455
|
+
animationName: Array.from(animationNames).map((name) => `var(--${prefix}-name-${name}, noop)`).join(", "),
|
|
456
|
+
["will-change"]: Array.from(animationNames).map((name) => `var(--${prefix}-dependencies-${name}, noop)`).join(", ")
|
|
457
|
+
}
|
|
458
|
+
});
|
|
443
459
|
};
|
|
444
460
|
}
|
|
445
461
|
);
|
|
@@ -9,24 +9,24 @@ const createAnimationFunc = ({
|
|
|
9
9
|
addBase,
|
|
10
10
|
prefix,
|
|
11
11
|
matchUtilities,
|
|
12
|
-
addUtilities
|
|
12
|
+
addUtilities,
|
|
13
|
+
animationNames
|
|
13
14
|
}) => (name, styles, values, callback) => {
|
|
15
|
+
animationNames.add(name);
|
|
14
16
|
const variableName = (propertyName) => {
|
|
15
17
|
return `--${prefix}-${propertyName}`;
|
|
16
18
|
};
|
|
17
|
-
const param = (propertyName) => {
|
|
18
|
-
var _a;
|
|
19
|
-
const defaultValue = (_a = values[propertyName]) == null ? void 0 : _a.DEFAULT;
|
|
19
|
+
const param = (propertyName, defaultValue = ((_a) => (_a = values[propertyName]) == null ? void 0 : _a.DEFAULT)()) => {
|
|
20
20
|
return `var(${variableName(propertyName)} ${defaultValue ? `, ${defaultValue}` : ""})`;
|
|
21
21
|
};
|
|
22
22
|
const dependencies = [];
|
|
23
|
-
Object.values(styles(param)).forEach((step) => {
|
|
23
|
+
Object.values(styles({ param, variableName })).forEach((step) => {
|
|
24
24
|
Object.keys(step).forEach((key) => {
|
|
25
25
|
dependencies.push(kebabCase(key));
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
28
|
addBase({
|
|
29
|
-
[`@keyframes ${prefix}-${name}`]: styles(param)
|
|
29
|
+
[`@keyframes ${prefix}-${name}`]: styles({ param, variableName })
|
|
30
30
|
});
|
|
31
31
|
addUtilities({
|
|
32
32
|
[`.${prefix}-${name}, .${prefix}-${name}-in, .${prefix}-${name}-out`]: {
|
|
@@ -66,7 +66,8 @@ const createAnimationFunc = ({
|
|
|
66
66
|
})
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
|
-
values: value.values
|
|
69
|
+
values: value.values,
|
|
70
|
+
supportsNegativeValues: value.supportsNegativeValues
|
|
70
71
|
}
|
|
71
72
|
);
|
|
72
73
|
});
|
|
@@ -74,12 +75,14 @@ const createAnimationFunc = ({
|
|
|
74
75
|
};
|
|
75
76
|
const animation = plugin.withOptions(
|
|
76
77
|
({ prefix = "anim" }) => {
|
|
77
|
-
return ({ addBase, matchUtilities, addUtilities }) => {
|
|
78
|
+
return ({ addBase, matchUtilities, addUtilities, theme }) => {
|
|
79
|
+
const animationNames = /* @__PURE__ */ new Set();
|
|
78
80
|
const createAnimation = createAnimationFunc({
|
|
79
81
|
addBase,
|
|
80
82
|
prefix,
|
|
81
83
|
matchUtilities,
|
|
82
|
-
addUtilities
|
|
84
|
+
addUtilities,
|
|
85
|
+
animationNames
|
|
83
86
|
});
|
|
84
87
|
addBase({
|
|
85
88
|
"@keyframes enter": {
|
|
@@ -121,14 +124,15 @@ const animation = plugin.withOptions(
|
|
|
121
124
|
});
|
|
122
125
|
createAnimation(
|
|
123
126
|
"fade",
|
|
124
|
-
(
|
|
127
|
+
({ param }) => ({
|
|
125
128
|
from: {
|
|
126
|
-
opacity:
|
|
129
|
+
opacity: param("opacity")
|
|
127
130
|
}
|
|
128
131
|
}),
|
|
129
132
|
{
|
|
130
133
|
opacity: {
|
|
131
134
|
DEFAULT: "0",
|
|
135
|
+
supportsNegativeValues: true,
|
|
132
136
|
values: {
|
|
133
137
|
0: "0",
|
|
134
138
|
5: "0.05",
|
|
@@ -151,13 +155,45 @@ const animation = plugin.withOptions(
|
|
|
151
155
|
);
|
|
152
156
|
createAnimation(
|
|
153
157
|
"scale",
|
|
154
|
-
(
|
|
158
|
+
({ param, variableName }) => ({
|
|
155
159
|
from: {
|
|
156
|
-
scale:
|
|
160
|
+
scale: `${param("scale-x", param("scale"))} ${param("scale-y", param("scale"))}`
|
|
157
161
|
}
|
|
158
162
|
}),
|
|
159
163
|
{
|
|
160
|
-
scale: {
|
|
164
|
+
["scale"]: {
|
|
165
|
+
DEFAULT: ".95",
|
|
166
|
+
values: {
|
|
167
|
+
0: "0",
|
|
168
|
+
50: ".5",
|
|
169
|
+
75: ".75",
|
|
170
|
+
90: ".9",
|
|
171
|
+
95: ".95",
|
|
172
|
+
100: "1",
|
|
173
|
+
105: "1.05",
|
|
174
|
+
110: "1.1",
|
|
175
|
+
125: "1.25",
|
|
176
|
+
150: "1.5"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
["scale-x"]: {
|
|
180
|
+
as: "x",
|
|
181
|
+
DEFAULT: ".95",
|
|
182
|
+
values: {
|
|
183
|
+
0: "0",
|
|
184
|
+
50: ".5",
|
|
185
|
+
75: ".75",
|
|
186
|
+
90: ".9",
|
|
187
|
+
95: ".95",
|
|
188
|
+
100: "1",
|
|
189
|
+
105: "1.05",
|
|
190
|
+
110: "1.1",
|
|
191
|
+
125: "1.25",
|
|
192
|
+
150: "1.5"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
["scale-y"]: {
|
|
196
|
+
as: "y",
|
|
161
197
|
DEFAULT: ".95",
|
|
162
198
|
values: {
|
|
163
199
|
0: "0",
|
|
@@ -177,47 +213,22 @@ const animation = plugin.withOptions(
|
|
|
177
213
|
const slideValues = {
|
|
178
214
|
DEFAULT: "2rem",
|
|
179
215
|
values: {
|
|
216
|
+
...theme("spacing"),
|
|
217
|
+
// échelle spacing
|
|
180
218
|
full: "100%",
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
1: "
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
4: "1rem",
|
|
191
|
-
5: "1.25rem",
|
|
192
|
-
6: "1.5rem",
|
|
193
|
-
7: "1.75rem",
|
|
194
|
-
8: "2rem",
|
|
195
|
-
9: "2.25rem",
|
|
196
|
-
10: "2.5rem",
|
|
197
|
-
11: "2.75rem",
|
|
198
|
-
12: "3rem",
|
|
199
|
-
14: "3.5rem",
|
|
200
|
-
16: "4rem",
|
|
201
|
-
20: "5rem",
|
|
202
|
-
24: "6rem",
|
|
203
|
-
28: "7rem",
|
|
204
|
-
32: "8rem",
|
|
205
|
-
36: "9rem",
|
|
206
|
-
40: "10rem",
|
|
207
|
-
44: "11rem",
|
|
208
|
-
48: "12rem",
|
|
209
|
-
52: "13rem",
|
|
210
|
-
56: "14rem",
|
|
211
|
-
60: "15rem",
|
|
212
|
-
64: "16rem",
|
|
213
|
-
72: "18rem",
|
|
214
|
-
80: "20rem",
|
|
215
|
-
96: "24rem"
|
|
216
|
-
}
|
|
219
|
+
// ajout de "full"
|
|
220
|
+
"1/2": "50%",
|
|
221
|
+
// (optionnel) fractions
|
|
222
|
+
"1/3": "33.333333%",
|
|
223
|
+
"2/3": "66.666667%",
|
|
224
|
+
"1/4": "25%",
|
|
225
|
+
"3/4": "75%"
|
|
226
|
+
},
|
|
227
|
+
supportsNegativeValues: true
|
|
217
228
|
};
|
|
218
229
|
createAnimation(
|
|
219
230
|
"slide",
|
|
220
|
-
(param) => ({
|
|
231
|
+
({ param }) => ({
|
|
221
232
|
from: {
|
|
222
233
|
translate: `calc(${param("distance")} * ${param("dx")}) calc(${param("distance")} * ${param("dy")});`
|
|
223
234
|
},
|
|
@@ -275,8 +286,8 @@ const animation = plugin.withOptions(
|
|
|
275
286
|
const dxdy = {
|
|
276
287
|
"from-top": { dx: "0", dy: "1" },
|
|
277
288
|
"from-bottom": { dx: "0", dy: "-1" },
|
|
278
|
-
"from-left": { dx: "1", dy: "0" },
|
|
279
|
-
"from-right": { dx: "
|
|
289
|
+
"from-left": { dx: "-1", dy: "0" },
|
|
290
|
+
"from-right": { dx: "1", dy: "0" },
|
|
280
291
|
"from-top-left": { dx: "1", dy: "1" },
|
|
281
292
|
"from-top-right": { dx: "-1", dy: "1" },
|
|
282
293
|
"from-bottom-left": { dx: "1", dy: "-1" },
|
|
@@ -304,7 +315,6 @@ const animation = plugin.withOptions(
|
|
|
304
315
|
});
|
|
305
316
|
addUtilities({
|
|
306
317
|
[`.${prefix}-${name}-scroll-${directionAlias}`]: {
|
|
307
|
-
[`--${prefix}-name-${name}-${directionAlias}`]: `${prefix}-${name}`,
|
|
308
318
|
[`--${prefix}-name-${name}`]: `${prefix}-${name}`,
|
|
309
319
|
[`--${prefix}-dependencies-${name}`]: dependencies.join(", "),
|
|
310
320
|
animationTimeline: `var(--${prefix}-timeline, view())`,
|
|
@@ -439,6 +449,12 @@ const animation = plugin.withOptions(
|
|
|
439
449
|
}
|
|
440
450
|
}
|
|
441
451
|
);
|
|
452
|
+
addBase({
|
|
453
|
+
[`[class*="${prefix}-"]`]: {
|
|
454
|
+
animationName: Array.from(animationNames).map((name) => `var(--${prefix}-name-${name}, noop)`).join(", "),
|
|
455
|
+
["will-change"]: Array.from(animationNames).map((name) => `var(--${prefix}-dependencies-${name}, noop)`).join(", ")
|
|
456
|
+
}
|
|
457
|
+
});
|
|
442
458
|
};
|
|
443
459
|
}
|
|
444
460
|
);
|
package/package.json
CHANGED
|
@@ -11,22 +11,26 @@ const createAnimationFunc =
|
|
|
11
11
|
prefix,
|
|
12
12
|
matchUtilities,
|
|
13
13
|
addUtilities,
|
|
14
|
+
animationNames,
|
|
14
15
|
}: {
|
|
15
16
|
addBase: PluginAPI['addBase'];
|
|
16
17
|
matchUtilities: PluginAPI['matchUtilities'];
|
|
17
18
|
addUtilities: PluginAPI['addUtilities'];
|
|
18
19
|
prefix: string;
|
|
20
|
+
animationNames: Set<string>;
|
|
19
21
|
}) =>
|
|
20
22
|
(
|
|
21
23
|
name: string,
|
|
22
|
-
styles: (
|
|
23
|
-
param: (propertyName: string) => string
|
|
24
|
-
|
|
24
|
+
styles: (args: {
|
|
25
|
+
param: (propertyName: string, defaultValue?: string) => string;
|
|
26
|
+
variableName: (propertyName: string) => string;
|
|
27
|
+
}) => Record<string, Record<string, string>>,
|
|
25
28
|
values: Record<
|
|
26
29
|
string,
|
|
27
30
|
{
|
|
28
31
|
as?: string;
|
|
29
32
|
DEFAULT: string;
|
|
33
|
+
supportsNegativeValues?: boolean;
|
|
30
34
|
values: Record<string, string>;
|
|
31
35
|
}
|
|
32
36
|
>,
|
|
@@ -36,25 +40,29 @@ const createAnimationFunc =
|
|
|
36
40
|
dependencies: string[];
|
|
37
41
|
}) => void,
|
|
38
42
|
) => {
|
|
43
|
+
animationNames.add(name);
|
|
44
|
+
|
|
39
45
|
const variableName = (propertyName: string) => {
|
|
40
46
|
return `--${prefix}-${propertyName}`;
|
|
41
47
|
};
|
|
42
48
|
|
|
43
|
-
const param = (
|
|
44
|
-
|
|
49
|
+
const param = (
|
|
50
|
+
propertyName: string,
|
|
51
|
+
defaultValue = values[propertyName]?.DEFAULT,
|
|
52
|
+
) => {
|
|
45
53
|
return `var(${variableName(propertyName)} ${defaultValue ? `, ${defaultValue}` : ''})`;
|
|
46
54
|
};
|
|
47
55
|
|
|
48
56
|
const dependencies: string[] = [];
|
|
49
57
|
|
|
50
|
-
Object.values(styles(param)).forEach((step) => {
|
|
58
|
+
Object.values(styles({ param, variableName })).forEach((step) => {
|
|
51
59
|
Object.keys(step).forEach((key) => {
|
|
52
60
|
dependencies.push(kebabCase(key));
|
|
53
61
|
});
|
|
54
62
|
});
|
|
55
63
|
|
|
56
64
|
addBase({
|
|
57
|
-
[`@keyframes ${prefix}-${name}`]: styles(param),
|
|
65
|
+
[`@keyframes ${prefix}-${name}`]: styles({ param, variableName }),
|
|
58
66
|
});
|
|
59
67
|
|
|
60
68
|
addUtilities({
|
|
@@ -98,6 +106,7 @@ const createAnimationFunc =
|
|
|
98
106
|
},
|
|
99
107
|
{
|
|
100
108
|
values: value.values,
|
|
109
|
+
supportsNegativeValues: value.supportsNegativeValues,
|
|
101
110
|
},
|
|
102
111
|
);
|
|
103
112
|
});
|
|
@@ -109,12 +118,15 @@ const createAnimationFunc =
|
|
|
109
118
|
// - usage: compose triggers ({prefix}-in|{prefix}-out or {prefix}-view*) + effects (fade/scale/slide/spin) + params
|
|
110
119
|
export const animation = plugin.withOptions(
|
|
111
120
|
({ prefix = 'anim' }: AnimationPluginOptions) => {
|
|
112
|
-
return ({ addBase, matchUtilities, addUtilities }: PluginAPI) => {
|
|
121
|
+
return ({ addBase, matchUtilities, addUtilities, theme }: PluginAPI) => {
|
|
122
|
+
const animationNames: Set<string> = new Set();
|
|
123
|
+
|
|
113
124
|
const createAnimation = createAnimationFunc({
|
|
114
125
|
addBase,
|
|
115
126
|
prefix,
|
|
116
127
|
matchUtilities,
|
|
117
128
|
addUtilities,
|
|
129
|
+
animationNames,
|
|
118
130
|
});
|
|
119
131
|
|
|
120
132
|
addBase({
|
|
@@ -162,14 +174,15 @@ export const animation = plugin.withOptions(
|
|
|
162
174
|
|
|
163
175
|
createAnimation(
|
|
164
176
|
'fade',
|
|
165
|
-
(
|
|
177
|
+
({ param }) => ({
|
|
166
178
|
from: {
|
|
167
|
-
opacity:
|
|
179
|
+
opacity: param('opacity'),
|
|
168
180
|
},
|
|
169
181
|
}),
|
|
170
182
|
{
|
|
171
183
|
opacity: {
|
|
172
184
|
DEFAULT: '0',
|
|
185
|
+
supportsNegativeValues: true,
|
|
173
186
|
values: {
|
|
174
187
|
0: '0',
|
|
175
188
|
5: '0.05',
|
|
@@ -193,13 +206,45 @@ export const animation = plugin.withOptions(
|
|
|
193
206
|
|
|
194
207
|
createAnimation(
|
|
195
208
|
'scale',
|
|
196
|
-
(
|
|
209
|
+
({ param, variableName }) => ({
|
|
197
210
|
from: {
|
|
198
|
-
scale:
|
|
211
|
+
scale: `${param('scale-x', param('scale'))} ${param('scale-y', param('scale'))}`,
|
|
199
212
|
},
|
|
200
213
|
}),
|
|
201
214
|
{
|
|
202
|
-
scale: {
|
|
215
|
+
['scale']: {
|
|
216
|
+
DEFAULT: '.95',
|
|
217
|
+
values: {
|
|
218
|
+
0: '0',
|
|
219
|
+
50: '.5',
|
|
220
|
+
75: '.75',
|
|
221
|
+
90: '.9',
|
|
222
|
+
95: '.95',
|
|
223
|
+
100: '1',
|
|
224
|
+
105: '1.05',
|
|
225
|
+
110: '1.1',
|
|
226
|
+
125: '1.25',
|
|
227
|
+
150: '1.5',
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
['scale-x']: {
|
|
231
|
+
as: 'x',
|
|
232
|
+
DEFAULT: '.95',
|
|
233
|
+
values: {
|
|
234
|
+
0: '0',
|
|
235
|
+
50: '.5',
|
|
236
|
+
75: '.75',
|
|
237
|
+
90: '.9',
|
|
238
|
+
95: '.95',
|
|
239
|
+
100: '1',
|
|
240
|
+
105: '1.05',
|
|
241
|
+
110: '1.1',
|
|
242
|
+
125: '1.25',
|
|
243
|
+
150: '1.5',
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
['scale-y']: {
|
|
247
|
+
as: 'y',
|
|
203
248
|
DEFAULT: '.95',
|
|
204
249
|
values: {
|
|
205
250
|
0: '0',
|
|
@@ -248,47 +293,19 @@ export const animation = plugin.withOptions(
|
|
|
248
293
|
const slideValues = {
|
|
249
294
|
DEFAULT: '2rem',
|
|
250
295
|
values: {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
1
|
|
257
|
-
|
|
258
|
-
2.5: '0.625rem',
|
|
259
|
-
3: '0.75rem',
|
|
260
|
-
3.5: '0.875rem',
|
|
261
|
-
4: '1rem',
|
|
262
|
-
5: '1.25rem',
|
|
263
|
-
6: '1.5rem',
|
|
264
|
-
7: '1.75rem',
|
|
265
|
-
8: '2rem',
|
|
266
|
-
9: '2.25rem',
|
|
267
|
-
10: '2.5rem',
|
|
268
|
-
11: '2.75rem',
|
|
269
|
-
12: '3rem',
|
|
270
|
-
14: '3.5rem',
|
|
271
|
-
16: '4rem',
|
|
272
|
-
20: '5rem',
|
|
273
|
-
24: '6rem',
|
|
274
|
-
28: '7rem',
|
|
275
|
-
32: '8rem',
|
|
276
|
-
36: '9rem',
|
|
277
|
-
40: '10rem',
|
|
278
|
-
44: '11rem',
|
|
279
|
-
48: '12rem',
|
|
280
|
-
52: '13rem',
|
|
281
|
-
56: '14rem',
|
|
282
|
-
60: '15rem',
|
|
283
|
-
64: '16rem',
|
|
284
|
-
72: '18rem',
|
|
285
|
-
80: '20rem',
|
|
286
|
-
96: '24rem',
|
|
296
|
+
...theme('spacing'), // échelle spacing
|
|
297
|
+
full: '100%', // ajout de "full"
|
|
298
|
+
'1/2': '50%', // (optionnel) fractions
|
|
299
|
+
'1/3': '33.333333%',
|
|
300
|
+
'2/3': '66.666667%',
|
|
301
|
+
'1/4': '25%',
|
|
302
|
+
'3/4': '75%',
|
|
287
303
|
},
|
|
304
|
+
supportsNegativeValues: true,
|
|
288
305
|
};
|
|
289
306
|
createAnimation(
|
|
290
307
|
'slide',
|
|
291
|
-
(param) => ({
|
|
308
|
+
({ param }) => ({
|
|
292
309
|
from: {
|
|
293
310
|
translate: `calc(${param('distance')} * ${param('dx')}) calc(${param('distance')} * ${param('dy')});`,
|
|
294
311
|
},
|
|
@@ -356,8 +373,8 @@ export const animation = plugin.withOptions(
|
|
|
356
373
|
const dxdy: Record<typeof direction, { dx: string; dy: string }> = {
|
|
357
374
|
'from-top': { dx: '0', dy: '1' },
|
|
358
375
|
'from-bottom': { dx: '0', dy: '-1' },
|
|
359
|
-
'from-left': { dx: '1', dy: '0' },
|
|
360
|
-
'from-right': { dx: '
|
|
376
|
+
'from-left': { dx: '-1', dy: '0' },
|
|
377
|
+
'from-right': { dx: '1', dy: '0' },
|
|
361
378
|
'from-top-left': { dx: '1', dy: '1' },
|
|
362
379
|
'from-top-right': { dx: '-1', dy: '1' },
|
|
363
380
|
'from-bottom-left': { dx: '1', dy: '-1' },
|
|
@@ -391,7 +408,6 @@ export const animation = plugin.withOptions(
|
|
|
391
408
|
|
|
392
409
|
addUtilities({
|
|
393
410
|
[`.${prefix}-${name}-scroll-${directionAlias}`]: {
|
|
394
|
-
[`--${prefix}-name-${name}-${directionAlias}`]: `${prefix}-${name}`,
|
|
395
411
|
[`--${prefix}-name-${name}`]: `${prefix}-${name}`,
|
|
396
412
|
[`--${prefix}-dependencies-${name}`]: dependencies.join(', '),
|
|
397
413
|
animationTimeline: `var(--${prefix}-timeline, view())`,
|
|
@@ -539,6 +555,17 @@ export const animation = plugin.withOptions(
|
|
|
539
555
|
},
|
|
540
556
|
},
|
|
541
557
|
);
|
|
558
|
+
|
|
559
|
+
addBase({
|
|
560
|
+
[`[class*="${prefix}-"]`]: {
|
|
561
|
+
animationName: Array.from(animationNames)
|
|
562
|
+
.map((name) => `var(--${prefix}-name-${name}, noop)`)
|
|
563
|
+
.join(', '),
|
|
564
|
+
['will-change']: Array.from(animationNames)
|
|
565
|
+
.map((name) => `var(--${prefix}-dependencies-${name}, noop)`)
|
|
566
|
+
.join(', '),
|
|
567
|
+
},
|
|
568
|
+
});
|
|
542
569
|
};
|
|
543
570
|
},
|
|
544
571
|
);
|