@nemigo/tailwind 2.0.1 → 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/dist/extra.js +6 -3
- package/dist/fluid.js +31 -25
- package/package.json +7 -9
package/dist/extra.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
// oxlint-disable no-console
|
|
1
3
|
import plugin from "tailwindcss/plugin";
|
|
2
4
|
const manual = (v) => Number.isNaN(Number(v));
|
|
3
|
-
const unit = (v,
|
|
5
|
+
const unit = (v, u, util) => {
|
|
4
6
|
if (manual(v))
|
|
5
7
|
return v;
|
|
6
8
|
if (v.startsWith("0."))
|
|
7
9
|
console.warn("Tailwind-Extra:", `Use ${util}-[${v.slice(1)}] instead ${util}-[${v}]`);
|
|
8
|
-
return v +
|
|
10
|
+
return v + u;
|
|
9
11
|
};
|
|
10
12
|
const main = plugin((api) => {
|
|
11
13
|
const hover = "@media (hover:hover) { &:hover:not(:disabled):not(.disabled) }";
|
|
@@ -128,7 +130,7 @@ const main = plugin((api) => {
|
|
|
128
130
|
};
|
|
129
131
|
}
|
|
130
132
|
if (v.includes(",")) {
|
|
131
|
-
const sorted = v.split(",").sort().join();
|
|
133
|
+
const sorted = v.split(",").sort().join(",");
|
|
132
134
|
if (sorted !== v)
|
|
133
135
|
console.warn("Tailwind-Extra:", `Use t-[${sorted}] instead t-[${v}]`);
|
|
134
136
|
return {
|
|
@@ -143,4 +145,5 @@ const main = plugin((api) => {
|
|
|
143
145
|
},
|
|
144
146
|
});
|
|
145
147
|
});
|
|
148
|
+
// oxlint-disable-next-line no-default-export
|
|
146
149
|
export default main;
|
package/dist/fluid.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
// oxlint-disable no-console
|
|
1
3
|
import plugin from "tailwindcss/plugin";
|
|
2
4
|
const getConfigScreens = (cfg) => {
|
|
3
5
|
const theme = cfg.theme;
|
|
@@ -9,7 +11,7 @@ const getConfigScreens = (cfg) => {
|
|
|
9
11
|
const medias = Object.values(screens).filter((v) => typeof v === "string");
|
|
10
12
|
if (medias.length <= 1)
|
|
11
13
|
return null;
|
|
12
|
-
const digitRegExp = /\D/
|
|
14
|
+
const digitRegExp = /\D/gu;
|
|
13
15
|
const converter = (v) => Number(v.replace(digitRegExp, ""));
|
|
14
16
|
const sorted = medias.map(converter).toSorted((a, b) => a - b);
|
|
15
17
|
const min = sorted[0];
|
|
@@ -18,35 +20,38 @@ const getConfigScreens = (cfg) => {
|
|
|
18
20
|
return { min, max, diff };
|
|
19
21
|
};
|
|
20
22
|
const manual = (v) => Number.isNaN(Number(v));
|
|
21
|
-
const unit = (v,
|
|
23
|
+
const unit = (v, u) => (manual(v) ? v : v + u);
|
|
24
|
+
const clamp = (v, property, util) => {
|
|
25
|
+
const rule = {};
|
|
26
|
+
if (v.includes("~")) {
|
|
27
|
+
const [_min, _max] = v.split("~");
|
|
28
|
+
if (_min.startsWith("0.") || _max.startsWith("0.")) {
|
|
29
|
+
if (!_max.startsWith("0.")) {
|
|
30
|
+
console.warn("Tailwind-Fluid:", `Use ${util}-[${_min.slice(1)}~${_max}] instead ${util}-[${v}]`);
|
|
31
|
+
}
|
|
32
|
+
else if (_min.startsWith("0.")) {
|
|
33
|
+
console.warn("Tailwind-Fluid:", `Use ${util}-[${_min.slice(1)}~${_max.slice(1)}] instead ${util}-[${v}]`);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
console.warn("Tailwind-Fluid:", `Use ${util}-[${_min}~${_max.slice(1)}] instead ${util}-[${v}]`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const max = Number(_max) || 0;
|
|
40
|
+
const min = Number(_min) || 0;
|
|
41
|
+
const rounded = Number((max - min).toFixed(3));
|
|
42
|
+
const adaptive = `calc(var(--V) * ${rounded} + ${min}em)`;
|
|
43
|
+
rule[property] = `clamp(${min}em,${adaptive},${max}em)`;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
rule[property] = unit(v, "em");
|
|
47
|
+
}
|
|
48
|
+
return rule;
|
|
49
|
+
};
|
|
22
50
|
const main = plugin((api) => {
|
|
23
51
|
const screens = getConfigScreens(api.config());
|
|
24
52
|
if (!screens)
|
|
25
53
|
return;
|
|
26
54
|
api.addBase({ ":root": { "--V": `calc((100vw - ${screens.min}em) / ${screens.diff})` } });
|
|
27
|
-
const clamp = (v, property, util) => {
|
|
28
|
-
const rule = {};
|
|
29
|
-
if (v.includes("~")) {
|
|
30
|
-
const [_min, _max] = v.split("~");
|
|
31
|
-
if (_min.startsWith("0.") || _max.startsWith("0.")) {
|
|
32
|
-
if (!_max.startsWith("0."))
|
|
33
|
-
console.warn("Tailwind-Fluid:", `Use ${util}-[${_min.slice(1)}~${_max}] instead ${util}-[${v}]`);
|
|
34
|
-
else if (!_min.startsWith("0."))
|
|
35
|
-
console.warn("Tailwind-Fluid:", `Use ${util}-[${_min}~${_max.slice(1)}] instead ${util}-[${v}]`);
|
|
36
|
-
else
|
|
37
|
-
console.warn("Tailwind-Fluid:", `Use ${util}-[${_min.slice(1)}~${_max.slice(1)}] instead ${util}-[${v}]`);
|
|
38
|
-
}
|
|
39
|
-
const max = Number(_max) || 0;
|
|
40
|
-
const min = Number(_min) || 0;
|
|
41
|
-
const rounded = Number((max - min).toFixed(3));
|
|
42
|
-
const adaptive = `calc(var(--V) * ${rounded} + ${min}em)`;
|
|
43
|
-
rule[property] = `clamp(${min}em,${adaptive},${max}em)`;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
rule[property] = unit(v, "em");
|
|
47
|
-
}
|
|
48
|
-
return rule;
|
|
49
|
-
};
|
|
50
55
|
const createUtilities = (arr) => {
|
|
51
56
|
const acc = {};
|
|
52
57
|
for (const [util, property] of arr) {
|
|
@@ -100,4 +105,5 @@ const main = plugin((api) => {
|
|
|
100
105
|
/**
|
|
101
106
|
* @type {Plugin}
|
|
102
107
|
*/
|
|
108
|
+
// oxlint-disable-next-line no-default-export
|
|
103
109
|
export default main;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nemigo/tailwind",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Vlad Logvin",
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "svelte-package && rimraf .svelte-kit",
|
|
11
|
+
"build": "bunx --bun svelte-package && bunx --bun rimraf .svelte-kit",
|
|
12
12
|
"check": "bunx --bun tsc --noemit",
|
|
13
13
|
"eslint": "bunx --bun eslint ./",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"lint:fix:unsafe": "biome lint --fix --unsafe",
|
|
18
|
-
"format": "biome check --write --linter-enabled=false"
|
|
14
|
+
"oxlint": "bunx --bun oxlint --config .././../oxlintrc.jsonc --ignore-path ../configs/.eslint.ignore ./",
|
|
15
|
+
"bilint": "bunx --bun biome lint",
|
|
16
|
+
"format": "bunx --bun biome check --write --linter-enabled=false"
|
|
19
17
|
},
|
|
20
18
|
"exports": {
|
|
21
19
|
"./extra": {
|
|
@@ -28,9 +26,9 @@
|
|
|
28
26
|
}
|
|
29
27
|
},
|
|
30
28
|
"peerDependencies": {
|
|
31
|
-
"tailwindcss": ">=4.
|
|
29
|
+
"tailwindcss": ">=4.1.0"
|
|
32
30
|
},
|
|
33
31
|
"devDependencies": {
|
|
34
|
-
"@nemigo/configs": "2.
|
|
32
|
+
"@nemigo/configs": "2.2.0"
|
|
35
33
|
}
|
|
36
34
|
}
|