@udixio/tailwind 2.3.7 → 2.4.1
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 +17 -0
- package/dist/browser/tailwind.plugin.d.ts.map +1 -1
- 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/state.d.ts.map +1 -1
- package/dist/{tailwind.plugin-D7mbDtcZ.cjs → tailwind.plugin-CweksRYP.cjs} +67 -35
- package/dist/{tailwind.plugin-WLIf7Hf5.js → tailwind.plugin-Cy4ccIsB.js} +67 -35
- package/package.json +2 -2
- package/src/browser/tailwind.plugin.ts +0 -4
- package/src/plugins-tailwind/state.ts +81 -38
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## 2.4.1 (2025-11-05)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated @udixio/theme to 2.1.3
|
|
6
|
+
|
|
7
|
+
## 2.4.0 (2025-11-03)
|
|
8
|
+
|
|
9
|
+
### 🚀 Features
|
|
10
|
+
|
|
11
|
+
- **ui-react, plugins-tailwind:** migrate to `State` component for unified state handling ([92996bc](https://github.com/Udixio/UI/commit/92996bc))
|
|
12
|
+
- **ui-react, plugins-tailwind:** enhance `State` component and streamline state utilities ([0e1858a](https://github.com/Udixio/UI/commit/0e1858a))
|
|
13
|
+
|
|
14
|
+
### ❤️ Thank You
|
|
15
|
+
|
|
16
|
+
- Joël VIGREUX
|
|
17
|
+
|
|
1
18
|
## 2.3.7 (2025-10-17)
|
|
2
19
|
|
|
3
20
|
### 🩹 Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind.plugin.d.ts","sourceRoot":"","sources":["../../src/browser/tailwind.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAO/E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAgFD,qBAAa,cAAe,SAAQ,cAAc,CAChD,yBAAyB,EACzB,qBAAqB,CACtB;IACQ,YAAY,wBAAgB;IAC5B,IAAI,SAAc;IACzB,WAAW,mCAA6B;CACzC;AAED,qBAAa,yBAA0B,SAAQ,kBAAkB,CAAC,qBAAqB,CAAC;IAC/E,SAAS,SAAM;IAEtB,MAAM;IAeN,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE;
|
|
1
|
+
{"version":3,"file":"tailwind.plugin.d.ts","sourceRoot":"","sources":["../../src/browser/tailwind.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAO/E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAgFD,qBAAa,cAAe,SAAQ,cAAc,CAChD,yBAAyB,EACzB,qBAAqB,CACtB;IACQ,YAAY,wBAAgB;IAC5B,IAAI,SAAc;IACzB,WAAW,mCAA6B;CACzC;AAED,qBAAa,yBAA0B,SAAQ,kBAAkB,CAAC,qBAAqB,CAAC;IAC/E,SAAS,SAAM;IAEtB,MAAM;IAeN,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE;IA8E/C,SAAS;eAC+B,MAAM;cAAQ,MAAM;;IAetD,MAAM;CAYb"}
|
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-CweksRYP.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-Cy4ccIsB.js";
|
|
2
|
+
import { T, b, a, f, s } from "./tailwind.plugin-Cy4ccIsB.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-CweksRYP.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-Cy4ccIsB.js";
|
|
5
|
+
import { a, f, s } from "./tailwind.plugin-Cy4ccIsB.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":"state.d.ts","sourceRoot":"","sources":["../../src/plugins-tailwind/state.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/plugins-tailwind/state.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAcF,eAAO,MAAM,KAAK,4EAmGhB,CAAC"}
|
|
@@ -492,10 +492,9 @@ const font = plugin.withOptions((options) => {
|
|
|
492
492
|
};
|
|
493
493
|
});
|
|
494
494
|
const defaultConfig = {
|
|
495
|
-
statePrefix: "state",
|
|
496
495
|
disabledStyles: {
|
|
497
496
|
textOpacity: 0.38,
|
|
498
|
-
backgroundOpacity: 0.
|
|
497
|
+
backgroundOpacity: 0.1
|
|
499
498
|
},
|
|
500
499
|
transition: {
|
|
501
500
|
duration: 150
|
|
@@ -503,7 +502,6 @@ const defaultConfig = {
|
|
|
503
502
|
};
|
|
504
503
|
const state = plugin.withOptions(({ colorKeys }) => {
|
|
505
504
|
const resolved = {
|
|
506
|
-
...defaultConfig,
|
|
507
505
|
disabledStyles: {
|
|
508
506
|
...defaultConfig.disabledStyles,
|
|
509
507
|
...{}
|
|
@@ -513,40 +511,77 @@ const state = plugin.withOptions(({ colorKeys }) => {
|
|
|
513
511
|
...{}
|
|
514
512
|
}
|
|
515
513
|
};
|
|
516
|
-
return ({
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}
|
|
514
|
+
return ({ matchUtilities, addUtilities }) => {
|
|
515
|
+
matchUtilities(
|
|
516
|
+
{
|
|
517
|
+
[`state-group`]: (groupName) => {
|
|
518
|
+
const groupVariant = groupName ? `/${groupName}` : "";
|
|
519
|
+
return {
|
|
520
|
+
[`@apply group-hover${groupVariant}:bg-[var(--state-color)]/[0.08]`]: {},
|
|
521
|
+
[`@apply group-active${groupVariant}:bg-[var(--state-color)]/[0.10]`]: {},
|
|
522
|
+
[`@apply group-focus-visible${groupVariant}:bg-[var(--state-color)]/[0.10]`]: {},
|
|
523
|
+
[`@apply transition-colors`]: {},
|
|
524
|
+
[`@apply duration-${resolved.transition.duration}`]: {},
|
|
525
|
+
[`@apply group-disabled${groupVariant}:text-on-surface/[${resolved.disabledStyles.textOpacity}]`]: {},
|
|
526
|
+
[`@apply group-disabled${groupVariant}:bg-on-surface/[${resolved.disabledStyles.backgroundOpacity}]`]: {}
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
values: {
|
|
532
|
+
DEFAULT: ""
|
|
533
|
+
}
|
|
531
534
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
[`@apply
|
|
539
|
-
[`@apply bg-
|
|
535
|
+
);
|
|
536
|
+
matchUtilities(
|
|
537
|
+
{
|
|
538
|
+
[`state-ripple-group`]: (groupName) => {
|
|
539
|
+
const groupVariant = groupName ? `/${groupName}` : "";
|
|
540
|
+
return {
|
|
541
|
+
[`@apply group-hover${groupVariant}:bg-[var(--state-color)]/[0.08]`]: {},
|
|
542
|
+
[`@apply group-focus-visible${groupVariant}:bg-[var(--state-color)]/[0.10]`]: {},
|
|
543
|
+
[`@apply transition-colors`]: {},
|
|
544
|
+
[`@apply duration-${resolved.transition.duration}`]: {},
|
|
545
|
+
[`@apply group-disabled${groupVariant}:text-on-surface/[${resolved.disabledStyles.textOpacity}]`]: {},
|
|
546
|
+
[`@apply group-disabled${groupVariant}:bg-on-surface/[${resolved.disabledStyles.backgroundOpacity}]`]: {}
|
|
540
547
|
};
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
values: {
|
|
552
|
+
DEFAULT: ""
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
);
|
|
556
|
+
addUtilities({
|
|
557
|
+
[`.state-layer`]: {
|
|
558
|
+
[`@apply hover:bg-[var(--state-color)]/[0.08]`]: {},
|
|
559
|
+
[`@apply active:bg-[var(--state-color)]/[0.10]`]: {},
|
|
560
|
+
[`@apply focus-visible:bg-[var(--state-color)]/[0.10]`]: {},
|
|
561
|
+
[`@apply transition-colors`]: {},
|
|
562
|
+
[`@apply duration-${resolved.transition.duration}`]: {},
|
|
563
|
+
[`@apply disabled:text-on-surface/[${resolved.disabledStyles.textOpacity}]`]: {},
|
|
564
|
+
[`@apply disabled:bg-on-surface/[${resolved.disabledStyles.backgroundOpacity}]`]: {}
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
matchUtilities(
|
|
568
|
+
{
|
|
569
|
+
[`state`]: (colorName) => {
|
|
570
|
+
return {
|
|
571
|
+
[`--state-color`]: `var(--color-${colorName})`
|
|
545
572
|
};
|
|
546
573
|
}
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
values: colorKeys.reduce(
|
|
577
|
+
(acc, key) => {
|
|
578
|
+
acc[key] = key;
|
|
579
|
+
return acc;
|
|
580
|
+
},
|
|
581
|
+
{}
|
|
582
|
+
)
|
|
547
583
|
}
|
|
548
|
-
|
|
549
|
-
addComponents(newComponents);
|
|
584
|
+
);
|
|
550
585
|
};
|
|
551
586
|
});
|
|
552
587
|
const shadow = plugin(
|
|
@@ -728,11 +763,9 @@ class TailwindImplPluginBrowser extends theme.PluginImplAbstract {
|
|
|
728
763
|
}`;
|
|
729
764
|
const sourceColor = this.api.context.sourceColor;
|
|
730
765
|
const originalSourceColorHex = materialColorUtilities.hexFromArgb(sourceColor.toInt());
|
|
731
|
-
console.log("to subthmes", this.api.context.id);
|
|
732
766
|
for (const [key, value] of Object.entries(this.options.subThemes ?? {})) {
|
|
733
767
|
const newHue = materialColorUtilities.Hct.fromInt(materialColorUtilities.argbFromHex(value)).hue;
|
|
734
768
|
const newColor = materialColorUtilities.Hct.from(newHue, sourceColor.chroma, sourceColor.tone);
|
|
735
|
-
console.log("newColor", materialColorUtilities.hexFromArgb(newColor.toInt()));
|
|
736
769
|
this.api.context.sourceColor = materialColorUtilities.hexFromArgb(newColor.toInt());
|
|
737
770
|
const colors2 = this.getColors();
|
|
738
771
|
this.outputCss += `
|
|
@@ -752,7 +785,6 @@ class TailwindImplPluginBrowser extends theme.PluginImplAbstract {
|
|
|
752
785
|
})}
|
|
753
786
|
}`;
|
|
754
787
|
}
|
|
755
|
-
console.log("finish");
|
|
756
788
|
this.api.context.sourceColor = originalSourceColorHex;
|
|
757
789
|
}
|
|
758
790
|
getColors() {
|
|
@@ -491,10 +491,9 @@ const font = plugin.withOptions((options) => {
|
|
|
491
491
|
};
|
|
492
492
|
});
|
|
493
493
|
const defaultConfig = {
|
|
494
|
-
statePrefix: "state",
|
|
495
494
|
disabledStyles: {
|
|
496
495
|
textOpacity: 0.38,
|
|
497
|
-
backgroundOpacity: 0.
|
|
496
|
+
backgroundOpacity: 0.1
|
|
498
497
|
},
|
|
499
498
|
transition: {
|
|
500
499
|
duration: 150
|
|
@@ -502,7 +501,6 @@ const defaultConfig = {
|
|
|
502
501
|
};
|
|
503
502
|
const state = plugin.withOptions(({ colorKeys }) => {
|
|
504
503
|
const resolved = {
|
|
505
|
-
...defaultConfig,
|
|
506
504
|
disabledStyles: {
|
|
507
505
|
...defaultConfig.disabledStyles,
|
|
508
506
|
...{}
|
|
@@ -512,40 +510,77 @@ const state = plugin.withOptions(({ colorKeys }) => {
|
|
|
512
510
|
...{}
|
|
513
511
|
}
|
|
514
512
|
};
|
|
515
|
-
return ({
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
}
|
|
513
|
+
return ({ matchUtilities, addUtilities }) => {
|
|
514
|
+
matchUtilities(
|
|
515
|
+
{
|
|
516
|
+
[`state-group`]: (groupName) => {
|
|
517
|
+
const groupVariant = groupName ? `/${groupName}` : "";
|
|
518
|
+
return {
|
|
519
|
+
[`@apply group-hover${groupVariant}:bg-[var(--state-color)]/[0.08]`]: {},
|
|
520
|
+
[`@apply group-active${groupVariant}:bg-[var(--state-color)]/[0.10]`]: {},
|
|
521
|
+
[`@apply group-focus-visible${groupVariant}:bg-[var(--state-color)]/[0.10]`]: {},
|
|
522
|
+
[`@apply transition-colors`]: {},
|
|
523
|
+
[`@apply duration-${resolved.transition.duration}`]: {},
|
|
524
|
+
[`@apply group-disabled${groupVariant}:text-on-surface/[${resolved.disabledStyles.textOpacity}]`]: {},
|
|
525
|
+
[`@apply group-disabled${groupVariant}:bg-on-surface/[${resolved.disabledStyles.backgroundOpacity}]`]: {}
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
values: {
|
|
531
|
+
DEFAULT: ""
|
|
532
|
+
}
|
|
530
533
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
[`@apply
|
|
538
|
-
[`@apply bg-
|
|
534
|
+
);
|
|
535
|
+
matchUtilities(
|
|
536
|
+
{
|
|
537
|
+
[`state-ripple-group`]: (groupName) => {
|
|
538
|
+
const groupVariant = groupName ? `/${groupName}` : "";
|
|
539
|
+
return {
|
|
540
|
+
[`@apply group-hover${groupVariant}:bg-[var(--state-color)]/[0.08]`]: {},
|
|
541
|
+
[`@apply group-focus-visible${groupVariant}:bg-[var(--state-color)]/[0.10]`]: {},
|
|
542
|
+
[`@apply transition-colors`]: {},
|
|
543
|
+
[`@apply duration-${resolved.transition.duration}`]: {},
|
|
544
|
+
[`@apply group-disabled${groupVariant}:text-on-surface/[${resolved.disabledStyles.textOpacity}]`]: {},
|
|
545
|
+
[`@apply group-disabled${groupVariant}:bg-on-surface/[${resolved.disabledStyles.backgroundOpacity}]`]: {}
|
|
539
546
|
};
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
values: {
|
|
551
|
+
DEFAULT: ""
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
);
|
|
555
|
+
addUtilities({
|
|
556
|
+
[`.state-layer`]: {
|
|
557
|
+
[`@apply hover:bg-[var(--state-color)]/[0.08]`]: {},
|
|
558
|
+
[`@apply active:bg-[var(--state-color)]/[0.10]`]: {},
|
|
559
|
+
[`@apply focus-visible:bg-[var(--state-color)]/[0.10]`]: {},
|
|
560
|
+
[`@apply transition-colors`]: {},
|
|
561
|
+
[`@apply duration-${resolved.transition.duration}`]: {},
|
|
562
|
+
[`@apply disabled:text-on-surface/[${resolved.disabledStyles.textOpacity}]`]: {},
|
|
563
|
+
[`@apply disabled:bg-on-surface/[${resolved.disabledStyles.backgroundOpacity}]`]: {}
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
matchUtilities(
|
|
567
|
+
{
|
|
568
|
+
[`state`]: (colorName) => {
|
|
569
|
+
return {
|
|
570
|
+
[`--state-color`]: `var(--color-${colorName})`
|
|
544
571
|
};
|
|
545
572
|
}
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
values: colorKeys.reduce(
|
|
576
|
+
(acc, key) => {
|
|
577
|
+
acc[key] = key;
|
|
578
|
+
return acc;
|
|
579
|
+
},
|
|
580
|
+
{}
|
|
581
|
+
)
|
|
546
582
|
}
|
|
547
|
-
|
|
548
|
-
addComponents(newComponents);
|
|
583
|
+
);
|
|
549
584
|
};
|
|
550
585
|
});
|
|
551
586
|
const shadow = plugin(
|
|
@@ -727,11 +762,9 @@ class TailwindImplPluginBrowser extends PluginImplAbstract {
|
|
|
727
762
|
}`;
|
|
728
763
|
const sourceColor = this.api.context.sourceColor;
|
|
729
764
|
const originalSourceColorHex = hexFromArgb(sourceColor.toInt());
|
|
730
|
-
console.log("to subthmes", this.api.context.id);
|
|
731
765
|
for (const [key, value] of Object.entries(this.options.subThemes ?? {})) {
|
|
732
766
|
const newHue = Hct.fromInt(argbFromHex(value)).hue;
|
|
733
767
|
const newColor = Hct.from(newHue, sourceColor.chroma, sourceColor.tone);
|
|
734
|
-
console.log("newColor", hexFromArgb(newColor.toInt()));
|
|
735
768
|
this.api.context.sourceColor = hexFromArgb(newColor.toInt());
|
|
736
769
|
const colors2 = this.getColors();
|
|
737
770
|
this.outputCss += `
|
|
@@ -751,7 +784,6 @@ class TailwindImplPluginBrowser extends PluginImplAbstract {
|
|
|
751
784
|
})}
|
|
752
785
|
}`;
|
|
753
786
|
}
|
|
754
|
-
console.log("finish");
|
|
755
787
|
this.api.context.sourceColor = originalSourceColorHex;
|
|
756
788
|
}
|
|
757
789
|
getColors() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@udixio/tailwind",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/node.js",
|
|
6
6
|
"module": "./dist/node.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"chalk": "^5.6.0",
|
|
32
32
|
"pathe": "^2.0.3",
|
|
33
33
|
"tslib": "^2.3.0",
|
|
34
|
-
"@udixio/theme": "2.1.
|
|
34
|
+
"@udixio/theme": "2.1.3"
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|
|
@@ -165,13 +165,10 @@ export class TailwindImplPluginBrowser extends PluginImplAbstract<TailwindPlugin
|
|
|
165
165
|
const sourceColor = this.api.context.sourceColor;
|
|
166
166
|
const originalSourceColorHex = hexFromArgb(sourceColor.toInt());
|
|
167
167
|
|
|
168
|
-
console.log('to subthmes', this.api.context.id);
|
|
169
168
|
for (const [key, value] of Object.entries(this.options.subThemes ?? {})) {
|
|
170
169
|
const newHue = Hct.fromInt(argbFromHex(value)).hue;
|
|
171
170
|
const newColor = Hct.from(newHue, sourceColor.chroma, sourceColor.tone);
|
|
172
171
|
|
|
173
|
-
console.log('newColor', hexFromArgb(newColor.toInt()));
|
|
174
|
-
|
|
175
172
|
this.api.context.sourceColor = hexFromArgb(newColor.toInt());
|
|
176
173
|
const colors = this.getColors();
|
|
177
174
|
this.outputCss += `
|
|
@@ -196,7 +193,6 @@ export class TailwindImplPluginBrowser extends PluginImplAbstract<TailwindPlugin
|
|
|
196
193
|
})}
|
|
197
194
|
}`;
|
|
198
195
|
}
|
|
199
|
-
console.log('finish');
|
|
200
196
|
// Restore original sourceColor after processing subThemes
|
|
201
197
|
this.api.context.sourceColor = originalSourceColorHex;
|
|
202
198
|
}
|
|
@@ -7,10 +7,9 @@ export type StateOptions = {
|
|
|
7
7
|
type Components = Record<string, Record<string, object>>;
|
|
8
8
|
|
|
9
9
|
const defaultConfig = {
|
|
10
|
-
statePrefix: 'state',
|
|
11
10
|
disabledStyles: {
|
|
12
11
|
textOpacity: 0.38,
|
|
13
|
-
backgroundOpacity: 0.
|
|
12
|
+
backgroundOpacity: 0.1,
|
|
14
13
|
},
|
|
15
14
|
transition: {
|
|
16
15
|
duration: 150,
|
|
@@ -30,46 +29,90 @@ export const state = plugin.withOptions(({ colorKeys }: StateOptions) => {
|
|
|
30
29
|
},
|
|
31
30
|
};
|
|
32
31
|
|
|
33
|
-
return ({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
[`@apply ${group}active:bg-${colorName}/[0.12]`]: {},
|
|
43
|
-
[`@apply ${group}focus-visible:bg-${colorName}/[0.12]`]: {},
|
|
44
|
-
[`@apply transition-colors`]: {},
|
|
45
|
-
[`@apply duration-${resolved.transition.duration}`]: {},
|
|
46
|
-
[`@apply ${group}disabled:text-on-surface/[${resolved.disabledStyles.textOpacity}]`]:
|
|
47
|
-
{},
|
|
48
|
-
[`@apply ${group}disabled:bg-on-surface/[${resolved.disabledStyles.backgroundOpacity}]`]:
|
|
49
|
-
{},
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
for (const colorName of colorKeys) {
|
|
55
|
-
for (const stateName of ['hover', 'active', 'focus', 'disabled']) {
|
|
56
|
-
const className = `.${stateName}-${resolved.statePrefix}-${colorName}`;
|
|
57
|
-
if (stateName === 'disabled') {
|
|
58
|
-
newComponents[className] = {
|
|
59
|
-
[`@apply text-on-surface/[${resolved.disabledStyles.textOpacity}]`]:
|
|
32
|
+
return ({ matchUtilities, addUtilities }: PluginAPI) => {
|
|
33
|
+
matchUtilities(
|
|
34
|
+
{
|
|
35
|
+
[`state-group`]: (groupName: string) => {
|
|
36
|
+
const groupVariant = groupName ? `/${groupName}` : '';
|
|
37
|
+
return {
|
|
38
|
+
[`@apply group-hover${groupVariant}:bg-[var(--state-color)]/[0.08]`]:
|
|
39
|
+
{},
|
|
40
|
+
[`@apply group-active${groupVariant}:bg-[var(--state-color)]/[0.10]`]:
|
|
60
41
|
{},
|
|
61
|
-
[`@apply bg-
|
|
42
|
+
[`@apply group-focus-visible${groupVariant}:bg-[var(--state-color)]/[0.10]`]:
|
|
43
|
+
{},
|
|
44
|
+
[`@apply transition-colors`]: {},
|
|
45
|
+
[`@apply duration-${resolved.transition.duration}`]: {},
|
|
46
|
+
[`@apply group-disabled${groupVariant}:text-on-surface/[${resolved.disabledStyles.textOpacity}]`]:
|
|
47
|
+
{},
|
|
48
|
+
[`@apply group-disabled${groupVariant}:bg-on-surface/[${resolved.disabledStyles.backgroundOpacity}]`]:
|
|
62
49
|
{},
|
|
63
50
|
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
values: {
|
|
55
|
+
DEFAULT: '',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
matchUtilities(
|
|
61
|
+
{
|
|
62
|
+
[`state-ripple-group`]: (groupName: string) => {
|
|
63
|
+
const groupVariant = groupName ? `/${groupName}` : '';
|
|
64
|
+
return {
|
|
65
|
+
[`@apply group-hover${groupVariant}:bg-[var(--state-color)]/[0.08]`]:
|
|
66
|
+
{},
|
|
67
|
+
[`@apply group-focus-visible${groupVariant}:bg-[var(--state-color)]/[0.10]`]:
|
|
68
|
+
{},
|
|
69
|
+
[`@apply transition-colors`]: {},
|
|
70
|
+
[`@apply duration-${resolved.transition.duration}`]: {},
|
|
71
|
+
[`@apply group-disabled${groupVariant}:text-on-surface/[${resolved.disabledStyles.textOpacity}]`]:
|
|
72
|
+
{},
|
|
73
|
+
[`@apply group-disabled${groupVariant}:bg-on-surface/[${resolved.disabledStyles.backgroundOpacity}]`]:
|
|
74
|
+
{},
|
|
68
75
|
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
values: {
|
|
80
|
+
DEFAULT: '',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
addUtilities({
|
|
86
|
+
[`.state-layer`]: {
|
|
87
|
+
[`@apply hover:bg-[var(--state-color)]/[0.08]`]: {},
|
|
88
|
+
[`@apply active:bg-[var(--state-color)]/[0.10]`]: {},
|
|
89
|
+
[`@apply focus-visible:bg-[var(--state-color)]/[0.10]`]: {},
|
|
90
|
+
[`@apply transition-colors`]: {},
|
|
91
|
+
[`@apply duration-${resolved.transition.duration}`]: {},
|
|
92
|
+
[`@apply disabled:text-on-surface/[${resolved.disabledStyles.textOpacity}]`]:
|
|
93
|
+
{},
|
|
94
|
+
[`@apply disabled:bg-on-surface/[${resolved.disabledStyles.backgroundOpacity}]`]:
|
|
95
|
+
{},
|
|
96
|
+
},
|
|
97
|
+
});
|
|
72
98
|
|
|
73
|
-
|
|
99
|
+
matchUtilities(
|
|
100
|
+
{
|
|
101
|
+
[`state`]: (colorName: string) => {
|
|
102
|
+
return {
|
|
103
|
+
[`--state-color`]: `var(--color-${colorName})`,
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
values: colorKeys.reduce(
|
|
109
|
+
(acc, key) => {
|
|
110
|
+
acc[key] = key;
|
|
111
|
+
return acc;
|
|
112
|
+
},
|
|
113
|
+
{} as Record<string, string>,
|
|
114
|
+
),
|
|
115
|
+
},
|
|
116
|
+
);
|
|
74
117
|
};
|
|
75
118
|
});
|