@windi-ui/tailwind 0.7.1 → 0.8.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.
@@ -0,0 +1,21 @@
1
+ import { Config } from "@windi-ui/core";
2
+ export type SafelistAxis = 'c' | 'v' | 's';
3
+ export interface SafelistOptions {
4
+ /** The kinds of classes to list. All three by default. */
5
+ axes?: SafelistAxis[];
6
+ /**
7
+ * The palettes of the Tailwind theme that have all 11 shades. By default those of Tailwind 4's default theme; name
8
+ * yours when the theme adds or removes palettes. Colors of the config's `build` are added to them.
9
+ */
10
+ palettes?: string[];
11
+ }
12
+ /** The classes of the given names as one brace expression, sorted: `{c-{blue,red},v-{default,solid},s-{default,lg}}`. */
13
+ export declare function classSource(names: Record<SafelistAxis, string[]>, axes?: SafelistAxis[]): string;
14
+ /**
15
+ * The `c-*`, `v-*` and `s-*` classes a config registers, for `@source inline("...")` in a Tailwind 4 stylesheet.
16
+ * It runs without Tailwind, so it knows the palettes of the theme only by name: see `palettes`.
17
+ * @param config the options, or the plugin `windiui()` made from them.
18
+ */
19
+ export declare function safelistSource(config?: Config | {
20
+ handler: unknown;
21
+ }, { axes, palettes }?: SafelistOptions): string;
@@ -0,0 +1,21 @@
1
+ import { Config } from "@windi-ui/core";
2
+ export type SafelistAxis = 'c' | 'v' | 's';
3
+ export interface SafelistOptions {
4
+ /** The kinds of classes to list. All three by default. */
5
+ axes?: SafelistAxis[];
6
+ /**
7
+ * The palettes of the Tailwind theme that have all 11 shades. By default those of Tailwind 4's default theme; name
8
+ * yours when the theme adds or removes palettes. Colors of the config's `build` are added to them.
9
+ */
10
+ palettes?: string[];
11
+ }
12
+ /** The classes of the given names as one brace expression, sorted: `{c-{blue,red},v-{default,solid},s-{default,lg}}`. */
13
+ export declare function classSource(names: Record<SafelistAxis, string[]>, axes?: SafelistAxis[]): string;
14
+ /**
15
+ * The `c-*`, `v-*` and `s-*` classes a config registers, for `@source inline("...")` in a Tailwind 4 stylesheet.
16
+ * It runs without Tailwind, so it knows the palettes of the theme only by name: see `palettes`.
17
+ * @param config the options, or the plugin `windiui()` made from them.
18
+ */
19
+ export declare function safelistSource(config?: Config | {
20
+ handler: unknown;
21
+ }, { axes, palettes }?: SafelistOptions): string;
@@ -0,0 +1,83 @@
1
+ import { create } from "@windi-ui/core";
2
+ import { r as unwrap } from "./configState-DfiH-8b9.mjs";
3
+ // src/safelist.ts
4
+ const AXES = [
5
+ "c",
6
+ "v",
7
+ "s"
8
+ ];
9
+ const SHADES = [
10
+ 50,
11
+ 100,
12
+ 200,
13
+ 300,
14
+ 400,
15
+ 500,
16
+ 600,
17
+ 700,
18
+ 800,
19
+ 900,
20
+ 950
21
+ ];
22
+ /** The palettes of Tailwind 4's default theme. Tailwind 3 has no mauve, olive, mist and taupe. */
23
+ const PALETTES = [
24
+ "slate",
25
+ "gray",
26
+ "zinc",
27
+ "neutral",
28
+ "stone",
29
+ "mauve",
30
+ "olive",
31
+ "mist",
32
+ "taupe",
33
+ "red",
34
+ "orange",
35
+ "amber",
36
+ "yellow",
37
+ "lime",
38
+ "green",
39
+ "emerald",
40
+ "teal",
41
+ "cyan",
42
+ "sky",
43
+ "blue",
44
+ "indigo",
45
+ "violet",
46
+ "purple",
47
+ "fuchsia",
48
+ "pink",
49
+ "rose"
50
+ ];
51
+ const braces = (items) => items.length === 1 ? items[0] : `{${items.join(",")}}`;
52
+ /** The classes of the given names as one brace expression, sorted: `{c-{blue,red},v-{default,solid},s-{default,lg}}`. */
53
+ function classSource(names, axes = AXES) {
54
+ return braces(axes.map((axis) => `${axis}-${braces([...names[axis]].sort())}`));
55
+ }
56
+ /**
57
+ * The `c-*`, `v-*` and `s-*` classes a config registers, for `@source inline("...")` in a Tailwind 4 stylesheet.
58
+ * It runs without Tailwind, so it knows the palettes of the theme only by name: see `palettes`.
59
+ * @param config the options, or the plugin `windiui()` made from them.
60
+ */
61
+ function safelistSource(config = {}, { axes, palettes = PALETTES } = {}) {
62
+ const colors = Object.fromEntries([
63
+ ...palettes,
64
+ "default",
65
+ "accent"
66
+ ].flatMap((p) => SHADES.map((s) => [`${p}-${s}`, ""])));
67
+ const gt = create(unwrap(config)).generator({
68
+ colors: () => colors,
69
+ spacing: () => "",
70
+ fontSize: () => "",
71
+ applyTextColor() {},
72
+ applyBackgroundColor() {},
73
+ applyBorderColor() {},
74
+ colorValue: (value) => value
75
+ });
76
+ return classSource({
77
+ c: gt.colors.names(),
78
+ v: gt.variants.names(),
79
+ s: gt.sizes.names()
80
+ }, axes);
81
+ }
82
+ export { classSource, safelistSource };
83
+
package/dist/v3.cjs ADDED
@@ -0,0 +1,5 @@
1
+ // src/v3.ts
2
+ /** Builds for Tailwind 3 without looking at the Tailwind that runs the plugin. */
3
+ var v3_default = require("./plugin-BDVW4Keh.cjs").createWindiUIPlugin(3);
4
+ module.exports = v3_default;
5
+
package/dist/v3.d.cts ADDED
@@ -0,0 +1,7 @@
1
+ import { n as WindiUIPlugin } from "./plugin-QCWiD6Wb.cjs";
2
+ /** Builds for Tailwind 3 without looking at the Tailwind that runs the plugin. */
3
+ declare const _default: WindiUIPlugin<{
4
+ handler: import("tailwindcss/types/config").PluginCreator;
5
+ config?: Partial<import("tailwindcss/types/config").Config>;
6
+ }>;
7
+ export = _default;
package/dist/v3.d.mts ADDED
@@ -0,0 +1,7 @@
1
+ import { n as WindiUIPlugin } from "./plugin-ayXaeLBM.mjs";
2
+ /** Builds for Tailwind 3 without looking at the Tailwind that runs the plugin. */
3
+ declare const _default: WindiUIPlugin<{
4
+ handler: import("tailwindcss/types/config").PluginCreator;
5
+ config?: Partial<import("tailwindcss/types/config").Config>;
6
+ }>;
7
+ export { _default as default };
package/dist/v3.mjs ADDED
@@ -0,0 +1,6 @@
1
+ import { t as createWindiUIPlugin } from "./plugin-DJjsT2Zj.mjs";
2
+ // src/v3.ts
3
+ /** Builds for Tailwind 3 without looking at the Tailwind that runs the plugin. */
4
+ var v3_default = createWindiUIPlugin(3);
5
+ export { v3_default as default };
6
+
package/dist/v4.cjs ADDED
@@ -0,0 +1,5 @@
1
+ // src/v4.ts
2
+ /** Builds for Tailwind 4 without looking at the Tailwind that runs the plugin. */
3
+ var v4_default = require("./plugin-BDVW4Keh.cjs").createWindiUIPlugin(4);
4
+ module.exports = v4_default;
5
+
package/dist/v4.d.cts ADDED
@@ -0,0 +1,4 @@
1
+ import { n as WindiUIPlugin, t as TailwindV4Plugin } from "./plugin-QCWiD6Wb.cjs";
2
+ /** Builds for Tailwind 4 without looking at the Tailwind that runs the plugin. */
3
+ declare const _default: WindiUIPlugin<TailwindV4Plugin>;
4
+ export = _default;
package/dist/v4.d.mts ADDED
@@ -0,0 +1,4 @@
1
+ import { n as WindiUIPlugin, t as TailwindV4Plugin } from "./plugin-ayXaeLBM.mjs";
2
+ /** Builds for Tailwind 4 without looking at the Tailwind that runs the plugin. */
3
+ declare const _default: WindiUIPlugin<TailwindV4Plugin>;
4
+ export { _default as default };
package/dist/v4.mjs ADDED
@@ -0,0 +1,6 @@
1
+ import { t as createWindiUIPlugin } from "./plugin-DJjsT2Zj.mjs";
2
+ // src/v4.ts
3
+ /** Builds for Tailwind 4 without looking at the Tailwind that runs the plugin. */
4
+ var v4_default = createWindiUIPlugin(4);
5
+ export { v4_default as default };
6
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windi-ui/tailwind",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "license": "MIT",
5
5
  "author": "Waleed Khaled <https://github.com/Waleed-KH>",
6
6
  "description": "Modern, modular, and customizable UI component library",
@@ -17,30 +17,50 @@
17
17
  "url": "https://github.com/windi-ui/windi-ui/issues"
18
18
  },
19
19
  "type": "module",
20
- "module": "dist/index.mjs",
21
- "main": "dist/index.cjs",
22
- "types": "dist/index.d.ts",
20
+ "module": "./dist/index.mjs",
21
+ "main": "./dist/index.cjs",
22
+ "types": "./dist/index.d.cts",
23
23
  "exports": {
24
24
  ".": {
25
25
  "import": "./dist/index.mjs",
26
- "require": "./dist/index.cjs",
27
- "types": "./dist/index.d.ts"
28
- }
26
+ "require": "./dist/index.cjs"
27
+ },
28
+ "./config": {
29
+ "import": "./dist/config.mjs",
30
+ "require": "./dist/config.cjs"
31
+ },
32
+ "./presets": {
33
+ "import": "./dist/presets.mjs",
34
+ "require": "./dist/presets.cjs"
35
+ },
36
+ "./safelist": {
37
+ "import": "./dist/safelist.mjs",
38
+ "require": "./dist/safelist.cjs"
39
+ },
40
+ "./v3": {
41
+ "import": "./dist/v3.mjs",
42
+ "require": "./dist/v3.cjs"
43
+ },
44
+ "./v4": {
45
+ "import": "./dist/v4.mjs",
46
+ "require": "./dist/v4.cjs"
47
+ },
48
+ "./package.json": "./package.json"
29
49
  },
30
50
  "files": [
31
51
  "dist"
32
52
  ],
33
53
  "dependencies": {
34
- "@windi-ui/core": "0.7.1"
54
+ "@windi-ui/core": "0.8.0",
55
+ "unconfig": "^7.5.0"
35
56
  },
36
57
  "peerDependencies": {
37
58
  "tailwindcss": ">=3.3.0"
38
59
  },
39
60
  "devDependencies": {
40
- "tailwindcss": "^3.4.17"
61
+ "tailwindcss": "^3.4.19"
41
62
  },
42
63
  "scripts": {
43
- "build": "unbuild",
44
- "stub": "unbuild --stub"
64
+ "build": "tsdown"
45
65
  }
46
66
  }
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import createPlugin from 'tailwindcss/plugin';
2
- import { Config } from '@windi-ui/core';
3
-
4
- declare function WindUITailwindCSS(config?: Config): ReturnType<typeof createPlugin>;
5
-
6
- export = WindUITailwindCSS;