@udixio/tailwind 1.5.0 → 1.6.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 CHANGED
@@ -1,3 +1,18 @@
1
+ ## 1.6.0 (2025-08-29)
2
+
3
+ ### 🚀 Features
4
+
5
+ - **tailwind:** add dynamic variant support and improve dark mode handling ([f5ea520](https://github.com/Udixio/UI/commit/f5ea520))
6
+
7
+ ### 🩹 Fixes
8
+
9
+ - **tailwind:** correct export paths in package.json for node builds ([1e5e6d3](https://github.com/Udixio/UI/commit/1e5e6d3))
10
+ - **tailwind:** refine color handling and improve theme initialization ([dbb2254](https://github.com/Udixio/UI/commit/dbb2254))
11
+
12
+ ### ❤️ Thank You
13
+
14
+ - Joël VIGREUX
15
+
1
16
  ## 1.5.0 (2025-08-28)
2
17
 
3
18
  ### 🚀 Features
@@ -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;AAE/E,MAAM,WAAW,qBAAqB;IAEpC,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;CAExB;AAED,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;IACtB,SAAS,CAAC,MAAM,EAAE,MAAM,CACtB,MAAM,EACN;QACE,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,CACF,CAAM;IAEP,MAAM;IAMN,SAAS;IAmBH,MAAM;CAoBb"}
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;AAE/E,MAAM,WAAW,qBAAqB;IAEpC,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;CAExB;AAED,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;IACtB,SAAS,CAAC,MAAM,EAAE,MAAM,CACtB,MAAM,EACN;QACE,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,CACF,CAAM;IAEP,MAAM;IAMN,SAAS;IAqBH,MAAM;CAsBb"}
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-JU5cwZvP.cjs");
3
+ const tailwind_plugin = require("./tailwind.plugin-DYs0pbWt.cjs");
4
4
  exports.TailwindImplPluginBrowser = tailwind_plugin.TailwindImplPluginBrowser;
5
5
  exports.TailwindPlugin = tailwind_plugin.TailwindPlugin;
6
6
  exports.default = tailwind_plugin.main;
package/dist/browser.js CHANGED
@@ -1,5 +1,5 @@
1
- import { m as main } from "./tailwind.plugin-Ce1R9Jc0.js";
2
- import { T, a, f, s } from "./tailwind.plugin-Ce1R9Jc0.js";
1
+ import { m as main } from "./tailwind.plugin-DJ3FRnT8.js";
2
+ import { T, a, f, s } from "./tailwind.plugin-DJ3FRnT8.js";
3
3
  export {
4
4
  T as TailwindImplPluginBrowser,
5
5
  a as TailwindPlugin,
@@ -7,6 +7,7 @@ export declare class TailwindPlugin extends PluginAbstract<TailwindImplPlugin, T
7
7
  }
8
8
  declare class TailwindImplPlugin extends TailwindImplPluginBrowser {
9
9
  private isNodeJs;
10
+ loadColor(): void;
10
11
  onLoad(): Promise<void>;
11
12
  }
12
13
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"tailwind.plugin.d.ts","sourceRoot":"","sources":["../../src/node/tailwind.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAI9F,qBAAa,cAAe,SAAQ,cAAc,CAChD,kBAAkB,EAClB,qBAAqB,CACtB;IACQ,YAAY,wBAAgB;IAC5B,IAAI,SAAc;IACzB,WAAW,4BAAsB;CAClC;AAED,cAAM,kBAAmB,SAAQ,yBAAyB;IACxD,OAAO,CAAC,QAAQ;IAQD,MAAM;CA2FtB"}
1
+ {"version":3,"file":"tailwind.plugin.d.ts","sourceRoot":"","sources":["../../src/node/tailwind.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAI9F,qBAAa,cAAe,SAAQ,cAAc,CAChD,kBAAkB,EAClB,qBAAqB,CACtB;IACQ,YAAY,wBAAgB;IAC5B,IAAI,SAAc;IACzB,WAAW,4BAAsB;CAClC;AAED,cAAM,kBAAmB,SAAQ,yBAAyB;IACxD,OAAO,CAAC,QAAQ;IAQP,SAAS;IAuBH,MAAM;CA2FtB"}
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-JU5cwZvP.cjs");
27
+ const tailwind_plugin = require("./tailwind.plugin-DYs0pbWt.cjs");
28
28
  const theme = require("@udixio/theme");
29
29
  const fs = require("fs");
30
30
  const console = require("node:console");
@@ -60,6 +60,24 @@ class TailwindImplPlugin extends tailwind_plugin.TailwindImplPluginBrowser {
60
60
  isNodeJs() {
61
61
  return typeof process !== "undefined" && process.versions != null && process.versions.node != null;
62
62
  }
63
+ loadColor() {
64
+ if (!this.isNodeJs()) {
65
+ super.loadColor();
66
+ return;
67
+ }
68
+ this.outputCss += `
69
+ @custom-variant dark (&:where(.dark, .dark *));
70
+ @theme {
71
+ --color-*: initial;
72
+ ${Object.entries(this.colors).map(([key, value]) => `--color-${key}: ${value.light};`).join("\n ")}
73
+ }
74
+ @layer theme {
75
+ .dark {
76
+ ${Object.entries(this.colors).map(([key, value]) => `--color-${key}: ${value.dark};`).join("\n ")}
77
+ }
78
+ }
79
+ `;
80
+ }
63
81
  async onLoad() {
64
82
  var _a;
65
83
  if (!this.isNodeJs()) {
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-Ce1R9Jc0.js";
5
- import { f, s } from "./tailwind.plugin-Ce1R9Jc0.js";
4
+ import { T as TailwindImplPluginBrowser, m as main } from "./tailwind.plugin-DJ3FRnT8.js";
5
+ import { f, s } from "./tailwind.plugin-DJ3FRnT8.js";
6
6
  import { PluginAbstract, FontPlugin } from "@udixio/theme";
7
7
  import * as fs from "fs";
8
8
  import * as console from "node:console";
@@ -20,6 +20,24 @@ class TailwindImplPlugin extends TailwindImplPluginBrowser {
20
20
  isNodeJs() {
21
21
  return typeof process !== "undefined" && process.versions != null && process.versions.node != null;
22
22
  }
23
+ loadColor() {
24
+ if (!this.isNodeJs()) {
25
+ super.loadColor();
26
+ return;
27
+ }
28
+ this.outputCss += `
29
+ @custom-variant dark (&:where(.dark, .dark *));
30
+ @theme {
31
+ --color-*: initial;
32
+ ${Object.entries(this.colors).map(([key, value]) => `--color-${key}: ${value.light};`).join("\n ")}
33
+ }
34
+ @layer theme {
35
+ .dark {
36
+ ${Object.entries(this.colors).map(([key, value]) => `--color-${key}: ${value.dark};`).join("\n ")}
37
+ }
38
+ }
39
+ `;
40
+ }
23
41
  async onLoad() {
24
42
  var _a;
25
43
  if (!this.isNodeJs()) {
@@ -183,20 +183,23 @@ class TailwindImplPluginBrowser extends PluginImplAbstract {
183
183
  }
184
184
  loadColor() {
185
185
  this.outputCss += `
186
- @custom-variant dark (&:where(.dark, .dark *));
187
- @theme {
188
- --color-*: initial;
189
- ${Object.entries(this.colors).map(([key, value]) => `--color-${key}: ${value.light};`).join("\n ")}
190
- }
186
+ @variant dynamic-default (&:where(.dynamic, .dynamic *));
187
+ @variant dynamic-dark (&:where(.dynamic:where(.dark, .dark *), .dark:where(.dynamic, .dynamic *)));
191
188
  @layer theme {
192
- .dark {
193
- ${Object.entries(this.colors).map(([key, value]) => `--color-${key}: ${value.dark};`).join("\n ")}
189
+ .dynamic {
190
+ ${Object.entries(this.colors).map(([key, value]) => `--color-${key}: ${value.light};`).join("\n ")}
194
191
  }
195
192
  }
193
+ @layer theme {
194
+ :is(.dynamic.dark, .dynamic .dark, .dark .dynamic) {
195
+ ${Object.entries(this.colors).map(([key, value]) => `--color-${key}: ${value.dark};`).join("\n ")}
196
+ }
197
+ }
196
198
  `;
197
199
  }
198
200
  async onLoad() {
199
201
  var _a;
202
+ console.log("onLoad");
200
203
  this.colors = {};
201
204
  for (const isDark of [false, true]) {
202
205
  this.api.themes.update({ isDark });
@@ -184,20 +184,23 @@ class TailwindImplPluginBrowser extends theme.PluginImplAbstract {
184
184
  }
185
185
  loadColor() {
186
186
  this.outputCss += `
187
- @custom-variant dark (&:where(.dark, .dark *));
188
- @theme {
189
- --color-*: initial;
190
- ${Object.entries(this.colors).map(([key, value]) => `--color-${key}: ${value.light};`).join("\n ")}
191
- }
187
+ @variant dynamic-default (&:where(.dynamic, .dynamic *));
188
+ @variant dynamic-dark (&:where(.dynamic:where(.dark, .dark *), .dark:where(.dynamic, .dynamic *)));
192
189
  @layer theme {
193
- .dark {
194
- ${Object.entries(this.colors).map(([key, value]) => `--color-${key}: ${value.dark};`).join("\n ")}
190
+ .dynamic {
191
+ ${Object.entries(this.colors).map(([key, value]) => `--color-${key}: ${value.light};`).join("\n ")}
195
192
  }
196
193
  }
194
+ @layer theme {
195
+ :is(.dynamic.dark, .dynamic .dark, .dark .dynamic) {
196
+ ${Object.entries(this.colors).map(([key, value]) => `--color-${key}: ${value.dark};`).join("\n ")}
197
+ }
198
+ }
197
199
  `;
198
200
  }
199
201
  async onLoad() {
200
202
  var _a;
203
+ console.log("onLoad");
201
204
  this.colors = {};
202
205
  for (const isDark of [false, true]) {
203
206
  this.api.themes.update({ isDark });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@udixio/tailwind",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "type": "module",
5
5
  "main": "./dist/node.js",
6
6
  "module": "./dist/node.js",
@@ -20,9 +20,9 @@
20
20
  "require": "./dist/node.cjs",
21
21
  "default": "./dist/node.js"
22
22
  },
23
- "import": "./dist/browser.js",
24
- "require": "./dist/browser.cjs",
25
- "default": "./dist/browser.js"
23
+ "import": "./dist/node.js",
24
+ "require": "./dist/node.cjs",
25
+ "default": "./dist/node.js"
26
26
  }
27
27
  },
28
28
  "dependencies": {
@@ -34,24 +34,27 @@ export class TailwindImplPluginBrowser extends PluginImplAbstract<TailwindPlugin
34
34
 
35
35
  loadColor() {
36
36
  this.outputCss += `
37
- @custom-variant dark (&:where(.dark, .dark *));
38
- @theme {
39
- --color-*: initial;
40
- ${Object.entries(this.colors)
41
- .map(([key, value]) => `--color-${key}: ${value.light};`)
42
- .join('\n ')}
43
- }
37
+ @variant dynamic-default (&:where(.dynamic, .dynamic *));
38
+ @variant dynamic-dark (&:where(.dynamic:where(.dark, .dark *), .dark:where(.dynamic, .dynamic *)));
44
39
  @layer theme {
45
- .dark {
46
- ${Object.entries(this.colors)
47
- .map(([key, value]) => `--color-${key}: ${value.dark};`)
48
- .join('\n ')}
40
+ .dynamic {
41
+ ${Object.entries(this.colors)
42
+ .map(([key, value]) => `--color-${key}: ${value.light};`)
43
+ .join('\n ')}
49
44
  }
50
45
  }
46
+ @layer theme {
47
+ :is(.dynamic.dark, .dynamic .dark, .dark .dynamic) {
48
+ ${Object.entries(this.colors)
49
+ .map(([key, value]) => `--color-${key}: ${value.dark};`)
50
+ .join('\n ')}
51
+ }
52
+ }
51
53
  `;
52
54
  }
53
55
 
54
56
  async onLoad() {
57
+ console.log('onLoad');
55
58
  this.colors = {};
56
59
  for (const isDark of [false, true]) {
57
60
  this.api.themes.update({ isDark: isDark });
@@ -66,6 +69,7 @@ export class TailwindImplPluginBrowser extends PluginImplAbstract<TailwindPlugin
66
69
 
67
70
  if (typeof window !== 'undefined') {
68
71
  const { tailwindBrowserInit } = await import('./tailwind-browser');
72
+
69
73
  this.outputCss = await tailwindBrowserInit(this.outputCss);
70
74
  }
71
75
 
@@ -22,6 +22,29 @@ class TailwindImplPlugin extends TailwindImplPluginBrowser {
22
22
  );
23
23
  }
24
24
 
25
+ override loadColor() {
26
+ if (!this.isNodeJs()) {
27
+ super.loadColor();
28
+ return;
29
+ }
30
+ this.outputCss += `
31
+ @custom-variant dark (&:where(.dark, .dark *));
32
+ @theme {
33
+ --color-*: initial;
34
+ ${Object.entries(this.colors)
35
+ .map(([key, value]) => `--color-${key}: ${value.light};`)
36
+ .join('\n ')}
37
+ }
38
+ @layer theme {
39
+ .dark {
40
+ ${Object.entries(this.colors)
41
+ .map(([key, value]) => `--color-${key}: ${value.dark};`)
42
+ .join('\n ')}
43
+ }
44
+ }
45
+ `;
46
+ }
47
+
25
48
  override async onLoad() {
26
49
  if (!this.isNodeJs()) {
27
50
  await super.onLoad();