tailwind-preset-mantine 2.0.0-beta.2 → 2.0.0-beta.3

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/README.md CHANGED
@@ -96,13 +96,13 @@ npx tailwind-preset-mantine theme.js -o theme.css
96
96
  ```
97
97
 
98
98
  Options:
99
- - `-o, --output`: Output file name (default: "theme.css")
100
- - `-w, --watch`: Watch for changes (coming soon)
99
+ - `-o, --output`: Output file name/location (default: "theme.css")
101
100
 
102
101
  3. Import the generated CSS file in your application:
103
102
 
104
103
  ```css
105
- @import "./theme.css";
104
+ @import "tailwind-preset-mantine";
105
+ @import "./theme.css"; /* <-- add the generated theme */
106
106
  ```
107
107
 
108
108
  ## Minimal template
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-preset-mantine",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.3",
4
4
  "description": "Integrate Mantine with Tailwind CSS",
5
5
  "keywords": [
6
6
  "mantine",
package/src/cli.js CHANGED
@@ -1,4 +1,5 @@
1
- #!/usr/bin/env -S npx tsx
1
+ #!/usr/bin/env node
2
+ import "tsx";
2
3
 
3
4
  import { writeFile } from "node:fs/promises";
4
5
  import { resolve } from "node:path";
@@ -15,12 +16,6 @@ const options = {
15
16
  default: "theme.css",
16
17
  description: "Output file name",
17
18
  },
18
- watch: {
19
- type: "boolean",
20
- short: "w",
21
- default: false,
22
- description: "Watch for changes",
23
- },
24
19
  };
25
20
 
26
21
  // Parse command line arguments
@@ -34,11 +29,6 @@ if (positionals.length === 0) {
34
29
  const inputFile = positionals[0];
35
30
  const outputFile = values.output;
36
31
 
37
- if (values.watch) {
38
- console.log(`Watching ${inputFile} for changes...`);
39
- // TODO: Implement file watching
40
- }
41
-
42
32
  try {
43
33
  // Read the input theme file
44
34
  const themePath = resolve(pwd, inputFile);
package/src/generate.js CHANGED
@@ -143,7 +143,7 @@ ${isDefault ? '@custom-variant dark (&:where([data-mantine-color-scheme="dark"],
143
143
  }
144
144
 
145
145
  /* colors - all */
146
- ${Object.keys(theme.colors)
146
+ ${Object.keys(theme.colors ?? {})
147
147
  .map((key) =>
148
148
  `
149
149
  --color-${key}-50: rgb(from var(--mantine-color-${key}-0) r g b / <alpha-value>);
@@ -162,7 +162,7 @@ ${isDefault ? '@custom-variant dark (&:where([data-mantine-color-scheme="dark"],
162
162
  .join("\n")}
163
163
 
164
164
  /* colors - variant specific */
165
- ${Object.keys(theme.colors)
165
+ ${Object.keys(theme.colors ?? {})
166
166
  .map((key) =>
167
167
  `
168
168
  --color-${key}-filled: rgb(from var(--mantine-color-${key}-filled) r g b / <alpha-value>);
@@ -177,7 +177,7 @@ ${isDefault ? '@custom-variant dark (&:where([data-mantine-color-scheme="dark"],
177
177
  .join("\n")}
178
178
 
179
179
  /* breakpoints */
180
- ${Object.entries(theme.breakpoints)
180
+ ${Object.entries(theme.breakpoints ?? {})
181
181
  .map(([key, value]) =>
182
182
  `
183
183
  --breakpoint-${key}: ${value};
package/test/cli.test.js CHANGED
@@ -97,6 +97,12 @@ test("processes custom TS theme", async (t) => {
97
97
  await testThemeGeneration(inputPath, "custom-theme-ts-output.css");
98
98
  });
99
99
 
100
+ // Test: CLI should process CJS theme
101
+ test("processes CJS theme", async (t) => {
102
+ const inputPath = join(FIXTURES_DIR, "cjs-theme.cjs");
103
+ await testThemeGeneration(inputPath, "cjs-theme-output.css");
104
+ });
105
+
100
106
  // Test: CLI should handle custom output path
101
107
  test("handles custom output path with --output flag", async (t) => {
102
108
  const inputPath = join(FIXTURES_DIR, "default-theme.js");
@@ -0,0 +1,18 @@
1
+ const { createTheme } = require("@mantine/core");
2
+
3
+ module.exports = createTheme({
4
+ colors: {
5
+ "deep-red": [
6
+ "#ffeaec",
7
+ "#fcd4d7",
8
+ "#f4a7ac",
9
+ "#ec777e",
10
+ "#e64f57",
11
+ "#e3353f",
12
+ "#e22732",
13
+ "#c91a25",
14
+ "#b41220",
15
+ "#9e0419",
16
+ ],
17
+ },
18
+ });