sigma-ui 1.0.12 → 1.0.14
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 +5 -4
- package/__generated/registry-schemes/colors/blue.json +0 -1
- package/__generated/registry-schemes/colors/gray.json +0 -1
- package/__generated/registry-schemes/colors/green.json +0 -1
- package/__generated/registry-schemes/colors/index.json +0 -1170
- package/__generated/registry-schemes/colors/orange.json +0 -1
- package/__generated/registry-schemes/colors/red.json +0 -1
- package/__generated/registry-schemes/colors/rose.json +0 -1
- package/__generated/registry-schemes/colors/violet.json +0 -1
- package/__generated/registry-schemes/colors/yellow.json +0 -1
- package/__generated/registry-schemes/colors/zinc.json +0 -1
- package/dist/index.js +95 -200
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/__generated/registry-schemes/colors/amber.json +0 -99
- package/__generated/registry-schemes/colors/cyan.json +0 -99
- package/__generated/registry-schemes/colors/emerald.json +0 -99
- package/__generated/registry-schemes/colors/fuchsia.json +0 -99
- package/__generated/registry-schemes/colors/indigo.json +0 -99
- package/__generated/registry-schemes/colors/lime.json +0 -99
- package/__generated/registry-schemes/colors/neutral.json +0 -99
- package/__generated/registry-schemes/colors/pink.json +0 -99
- package/__generated/registry-schemes/colors/purple.json +0 -99
- package/__generated/registry-schemes/colors/sky.json +0 -99
- package/__generated/registry-schemes/colors/slate.json +0 -99
- package/__generated/registry-schemes/colors/stone.json +0 -99
- package/__generated/registry-schemes/colors/teal.json +0 -99
|
@@ -89,7 +89,6 @@
|
|
|
89
89
|
},
|
|
90
90
|
"templates": {
|
|
91
91
|
"tailwind": {
|
|
92
|
-
"withoutVariables": "@import \"tailwindcss\";\n@config \"../../tailwind.config.js\";",
|
|
93
92
|
"withVariables": "@import \"tailwindcss\";\n@config \"../../tailwind.config.js\";\n\n@layer base {\n /* Override Tailwind 4 default hover cursor for buttons and button-like elements */\n button:not(:disabled),\n [role=\"button\"]:not(:disabled) {\n cursor: pointer;\n }\n\n :root {\n --radius: 0.5rem;\n }\n \n :root {\n --background: 0 0% 100%;\n --foreground: 13 81.1% 14.5%;\n --muted: 34.3 100% 91.8%;\n --muted-foreground: 24.6 95% 53.1%;\n --popover: 0 0% 100%;\n --popover-foreground: 13 81.1% 14.5%;\n --card: 0 0% 100%;\n --card-foreground: 13 81.1% 14.5%;\n --border: 32.1 97.7% 83.1%;\n --input: 32.1 97.7% 83.1%;\n --primary: 15.3 74.6% 27.8%;\n --primary-foreground: 33.3 100% 96.5%;\n --secondary: 34.3 100% 91.8%;\n --secondary-foreground: 15.3 74.6% 27.8%;\n --accent: 34.3 100% 91.8%;\n --accent-foreground: 15.3 74.6% 27.8%;\n --destructive: 0 84.2% 60.2%;\n --destructive-foreground: 33.3 100% 96.5%;\n --ring: 13 81.1% 14.5%;\n }\n \n .dark {\n --background: 13 81.1% 14.5%;\n --foreground: 33.3 100% 96.5%;\n --muted: 15 79.1% 33.7%;\n --muted-foreground: 27 96% 61%;\n --popover: 13 81.1% 14.5%;\n --popover-foreground: 33.3 100% 96.5%;\n --card: 13 81.1% 14.5%;\n --card-foreground: 33.3 100% 96.5%;\n --border: 15 79.1% 33.7%;\n --input: 15 79.1% 33.7%;\n --primary: 33.3 100% 96.5%;\n --primary-foreground: 15.3 74.6% 27.8%;\n --secondary: 15 79.1% 33.7%;\n --secondary-foreground: 33.3 100% 96.5%;\n --accent: 15 79.1% 33.7%;\n --accent-foreground: 33.3 100% 96.5%;\n --destructive: 0 62.8% 30.6%;\n --destructive-foreground: 33.3 100% 96.5%;\n --ring: 30.7 97.2% 72.4%;\n }\n\n * {\n @apply border-border;\n }\n\n body {\n @apply bg-background text-foreground;\n }\n\n .fade-slide-top-enter-active,\n .fade-slide-top-leave-active {\n transition: all 0.3s ease;\n }\n\n .fade-slide-top-enter-from,\n .fade-slide-top-leave-to {\n opacity: 0;\n filter: blur(4px);\n transform: translateY(8px);\n }\n}"
|
|
94
93
|
},
|
|
95
94
|
"css": {
|
|
@@ -89,7 +89,6 @@
|
|
|
89
89
|
},
|
|
90
90
|
"templates": {
|
|
91
91
|
"tailwind": {
|
|
92
|
-
"withoutVariables": "@import \"tailwindcss\";\n@config \"../../tailwind.config.js\";",
|
|
93
92
|
"withVariables": "@import \"tailwindcss\";\n@config \"../../tailwind.config.js\";\n\n@layer base {\n /* Override Tailwind 4 default hover cursor for buttons and button-like elements */\n button:not(:disabled),\n [role=\"button\"]:not(:disabled) {\n cursor: pointer;\n }\n\n :root {\n --radius: 0.5rem;\n }\n \n :root {\n --background: 0 0% 100%;\n --foreground: 0 74.7% 15.5%;\n --muted: 0 93.3% 94.1%;\n --muted-foreground: 0 84.2% 60.2%;\n --popover: 0 0% 100%;\n --popover-foreground: 0 74.7% 15.5%;\n --card: 0 0% 100%;\n --card-foreground: 0 74.7% 15.5%;\n --border: 0 96.3% 89.4%;\n --input: 0 96.3% 89.4%;\n --primary: 0 62.8% 30.6%;\n --primary-foreground: 0 85.7% 97.3%;\n --secondary: 0 93.3% 94.1%;\n --secondary-foreground: 0 62.8% 30.6%;\n --accent: 0 93.3% 94.1%;\n --accent-foreground: 0 62.8% 30.6%;\n --destructive: 0 84.2% 60.2%;\n --destructive-foreground: 0 85.7% 97.3%;\n --ring: 0 74.7% 15.5%;\n }\n \n .dark {\n --background: 0 74.7% 15.5%;\n --foreground: 0 85.7% 97.3%;\n --muted: 0 70% 35.3%;\n --muted-foreground: 0 90.6% 70.8%;\n --popover: 0 74.7% 15.5%;\n --popover-foreground: 0 85.7% 97.3%;\n --card: 0 74.7% 15.5%;\n --card-foreground: 0 85.7% 97.3%;\n --border: 0 70% 35.3%;\n --input: 0 70% 35.3%;\n --primary: 0 85.7% 97.3%;\n --primary-foreground: 0 62.8% 30.6%;\n --secondary: 0 70% 35.3%;\n --secondary-foreground: 0 85.7% 97.3%;\n --accent: 0 70% 35.3%;\n --accent-foreground: 0 85.7% 97.3%;\n --destructive: 0 62.8% 30.6%;\n --destructive-foreground: 0 85.7% 97.3%;\n --ring: 0 93.5% 81.8%;\n }\n\n * {\n @apply border-border;\n }\n\n body {\n @apply bg-background text-foreground;\n }\n\n .fade-slide-top-enter-active,\n .fade-slide-top-leave-active {\n transition: all 0.3s ease;\n }\n\n .fade-slide-top-enter-from,\n .fade-slide-top-leave-to {\n opacity: 0;\n filter: blur(4px);\n transform: translateY(8px);\n }\n}"
|
|
94
93
|
},
|
|
95
94
|
"css": {
|
|
@@ -89,7 +89,6 @@
|
|
|
89
89
|
},
|
|
90
90
|
"templates": {
|
|
91
91
|
"tailwind": {
|
|
92
|
-
"withoutVariables": "@import \"tailwindcss\";\n@config \"../../tailwind.config.js\";",
|
|
93
92
|
"withVariables": "@import \"tailwindcss\";\n@config \"../../tailwind.config.js\";\n\n@layer base {\n /* Override Tailwind 4 default hover cursor for buttons and button-like elements */\n button:not(:disabled),\n [role=\"button\"]:not(:disabled) {\n cursor: pointer;\n }\n\n :root {\n --radius: 0.5rem;\n }\n \n :root {\n --background: 0 0% 100%;\n --foreground: 343.1 87.7% 15.9%;\n --muted: 355.6 100% 94.7%;\n --muted-foreground: 349.7 89.2% 60.2%;\n --popover: 0 0% 100%;\n --popover-foreground: 343.1 87.7% 15.9%;\n --card: 0 0% 100%;\n --card-foreground: 343.1 87.7% 15.9%;\n --border: 352.7 96.1% 90%;\n --input: 352.7 96.1% 90%;\n --primary: 341.5 75.5% 30.4%;\n --primary-foreground: 355.7 100% 97.3%;\n --secondary: 355.6 100% 94.7%;\n --secondary-foreground: 341.5 75.5% 30.4%;\n --accent: 355.6 100% 94.7%;\n --accent-foreground: 341.5 75.5% 30.4%;\n --destructive: 0 84.2% 60.2%;\n --destructive-foreground: 355.7 100% 97.3%;\n --ring: 343.1 87.7% 15.9%;\n }\n \n .dark {\n --background: 343.1 87.7% 15.9%;\n --foreground: 355.7 100% 97.3%;\n --muted: 343.4 79.7% 34.7%;\n --muted-foreground: 351.3 94.5% 71.4%;\n --popover: 343.1 87.7% 15.9%;\n --popover-foreground: 355.7 100% 97.3%;\n --card: 343.1 87.7% 15.9%;\n --card-foreground: 355.7 100% 97.3%;\n --border: 343.4 79.7% 34.7%;\n --input: 343.4 79.7% 34.7%;\n --primary: 355.7 100% 97.3%;\n --primary-foreground: 341.5 75.5% 30.4%;\n --secondary: 343.4 79.7% 34.7%;\n --secondary-foreground: 355.7 100% 97.3%;\n --accent: 343.4 79.7% 34.7%;\n --accent-foreground: 355.7 100% 97.3%;\n --destructive: 0 62.8% 30.6%;\n --destructive-foreground: 355.7 100% 97.3%;\n --ring: 352.6 95.7% 81.8%;\n }\n\n * {\n @apply border-border;\n }\n\n body {\n @apply bg-background text-foreground;\n }\n\n .fade-slide-top-enter-active,\n .fade-slide-top-leave-active {\n transition: all 0.3s ease;\n }\n\n .fade-slide-top-enter-from,\n .fade-slide-top-leave-to {\n opacity: 0;\n filter: blur(4px);\n transform: translateY(8px);\n }\n}"
|
|
94
93
|
},
|
|
95
94
|
"css": {
|
|
@@ -89,7 +89,6 @@
|
|
|
89
89
|
},
|
|
90
90
|
"templates": {
|
|
91
91
|
"tailwind": {
|
|
92
|
-
"withoutVariables": "@import \"tailwindcss\";\n@config \"../../tailwind.config.js\";",
|
|
93
92
|
"withVariables": "@import \"tailwindcss\";\n@config \"../../tailwind.config.js\";\n\n@layer base {\n /* Override Tailwind 4 default hover cursor for buttons and button-like elements */\n button:not(:disabled),\n [role=\"button\"]:not(:disabled) {\n cursor: pointer;\n }\n\n :root {\n --radius: 0.5rem;\n }\n \n :root {\n --background: 0 0% 100%;\n --foreground: 261.2 72.6% 22.9%;\n --muted: 251.4 91.3% 95.5%;\n --muted-foreground: 258.3 89.5% 66.3%;\n --popover: 0 0% 100%;\n --popover-foreground: 261.2 72.6% 22.9%;\n --card: 0 0% 100%;\n --card-foreground: 261.2 72.6% 22.9%;\n --border: 250.5 95.2% 91.8%;\n --input: 250.5 95.2% 91.8%;\n --primary: 263.5 67.4% 34.9%;\n --primary-foreground: 250 100% 97.6%;\n --secondary: 251.4 91.3% 95.5%;\n --secondary-foreground: 263.5 67.4% 34.9%;\n --accent: 251.4 91.3% 95.5%;\n --accent-foreground: 263.5 67.4% 34.9%;\n --destructive: 0 84.2% 60.2%;\n --destructive-foreground: 250 100% 97.6%;\n --ring: 261.2 72.6% 22.9%;\n }\n \n .dark {\n --background: 261.2 72.6% 22.9%;\n --foreground: 250 100% 97.6%;\n --muted: 263.4 69.3% 42.2%;\n --muted-foreground: 255.1 91.7% 76.3%;\n --popover: 261.2 72.6% 22.9%;\n --popover-foreground: 250 100% 97.6%;\n --card: 261.2 72.6% 22.9%;\n --card-foreground: 250 100% 97.6%;\n --border: 263.4 69.3% 42.2%;\n --input: 263.4 69.3% 42.2%;\n --primary: 250 100% 97.6%;\n --primary-foreground: 263.5 67.4% 34.9%;\n --secondary: 263.4 69.3% 42.2%;\n --secondary-foreground: 250 100% 97.6%;\n --accent: 263.4 69.3% 42.2%;\n --accent-foreground: 250 100% 97.6%;\n --destructive: 0 62.8% 30.6%;\n --destructive-foreground: 250 100% 97.6%;\n --ring: 252.5 94.7% 85.1%;\n }\n\n * {\n @apply border-border;\n }\n\n body {\n @apply bg-background text-foreground;\n }\n\n .fade-slide-top-enter-active,\n .fade-slide-top-leave-active {\n transition: all 0.3s ease;\n }\n\n .fade-slide-top-enter-from,\n .fade-slide-top-leave-to {\n opacity: 0;\n filter: blur(4px);\n transform: translateY(8px);\n }\n}"
|
|
94
93
|
},
|
|
95
94
|
"css": {
|
|
@@ -89,7 +89,6 @@
|
|
|
89
89
|
},
|
|
90
90
|
"templates": {
|
|
91
91
|
"tailwind": {
|
|
92
|
-
"withoutVariables": "@import \"tailwindcss\";\n@config \"../../tailwind.config.js\";",
|
|
93
92
|
"withVariables": "@import \"tailwindcss\";\n@config \"../../tailwind.config.js\";\n\n@layer base {\n /* Override Tailwind 4 default hover cursor for buttons and button-like elements */\n button:not(:disabled),\n [role=\"button\"]:not(:disabled) {\n cursor: pointer;\n }\n\n :root {\n --radius: 0.5rem;\n }\n \n :root {\n --background: 0 0% 100%;\n --foreground: 26 83.3% 14.1%;\n --muted: 54.9 96.7% 88%;\n --muted-foreground: 45.4 93.4% 47.5%;\n --popover: 0 0% 100%;\n --popover-foreground: 26 83.3% 14.1%;\n --card: 0 0% 100%;\n --card-foreground: 26 83.3% 14.1%;\n --border: 52.8 98.3% 76.9%;\n --input: 52.8 98.3% 76.9%;\n --primary: 28.4 72.5% 25.7%;\n --primary-foreground: 54.5 91.7% 95.3%;\n --secondary: 54.9 96.7% 88%;\n --secondary-foreground: 28.4 72.5% 25.7%;\n --accent: 54.9 96.7% 88%;\n --accent-foreground: 28.4 72.5% 25.7%;\n --destructive: 0 84.2% 60.2%;\n --destructive-foreground: 54.5 91.7% 95.3%;\n --ring: 26 83.3% 14.1%;\n }\n \n .dark {\n --background: 26 83.3% 14.1%;\n --foreground: 54.5 91.7% 95.3%;\n --muted: 31.8 81% 28.8%;\n --muted-foreground: 47.9 95.8% 53.1%;\n --popover: 26 83.3% 14.1%;\n --popover-foreground: 54.5 91.7% 95.3%;\n --card: 26 83.3% 14.1%;\n --card-foreground: 54.5 91.7% 95.3%;\n --border: 31.8 81% 28.8%;\n --input: 31.8 81% 28.8%;\n --primary: 54.5 91.7% 95.3%;\n --primary-foreground: 28.4 72.5% 25.7%;\n --secondary: 31.8 81% 28.8%;\n --secondary-foreground: 54.5 91.7% 95.3%;\n --accent: 31.8 81% 28.8%;\n --accent-foreground: 54.5 91.7% 95.3%;\n --destructive: 0 62.8% 30.6%;\n --destructive-foreground: 54.5 91.7% 95.3%;\n --ring: 50.4 97.8% 63.5%;\n }\n\n * {\n @apply border-border;\n }\n\n body {\n @apply bg-background text-foreground;\n }\n\n .fade-slide-top-enter-active,\n .fade-slide-top-leave-active {\n transition: all 0.3s ease;\n }\n\n .fade-slide-top-enter-from,\n .fade-slide-top-leave-to {\n opacity: 0;\n filter: blur(4px);\n transform: translateY(8px);\n }\n}"
|
|
94
93
|
},
|
|
95
94
|
"css": {
|
|
@@ -89,7 +89,6 @@
|
|
|
89
89
|
},
|
|
90
90
|
"templates": {
|
|
91
91
|
"tailwind": {
|
|
92
|
-
"withoutVariables": "@import \"tailwindcss\";\n@config \"../../tailwind.config.js\";",
|
|
93
92
|
"withVariables": "@import \"tailwindcss\";\n@config \"../../tailwind.config.js\";\n\n@layer base {\n /* Override Tailwind 4 default hover cursor for buttons and button-like elements */\n button:not(:disabled),\n [role=\"button\"]:not(:disabled) {\n cursor: pointer;\n }\n\n :root {\n --radius: 0.5rem;\n }\n \n :root {\n --background: 0 0% 100%;\n --foreground: 240 10% 3.9%;\n --muted: 240 4.8% 95.9%;\n --muted-foreground: 240 3.8% 46.1%;\n --popover: 0 0% 100%;\n --popover-foreground: 240 10% 3.9%;\n --card: 0 0% 100%;\n --card-foreground: 240 10% 3.9%;\n --border: 240 5.9% 90%;\n --input: 240 5.9% 90%;\n --primary: 240 5.9% 10%;\n --primary-foreground: 0 0% 98%;\n --secondary: 240 4.8% 95.9%;\n --secondary-foreground: 240 5.9% 10%;\n --accent: 240 4.8% 95.9%;\n --accent-foreground: 240 5.9% 10%;\n --destructive: 0 84.2% 60.2%;\n --destructive-foreground: 0 0% 98%;\n --ring: 240 10% 3.9%;\n }\n \n .dark {\n --background: 240 10% 3.9%;\n --foreground: 0 0% 98%;\n --muted: 240 3.7% 15.9%;\n --muted-foreground: 240 5% 64.9%;\n --popover: 240 10% 3.9%;\n --popover-foreground: 0 0% 98%;\n --card: 240 10% 3.9%;\n --card-foreground: 0 0% 98%;\n --border: 240 3.7% 15.9%;\n --input: 240 3.7% 15.9%;\n --primary: 0 0% 98%;\n --primary-foreground: 240 5.9% 10%;\n --secondary: 240 3.7% 15.9%;\n --secondary-foreground: 0 0% 98%;\n --accent: 240 3.7% 15.9%;\n --accent-foreground: 0 0% 98%;\n --destructive: 0 62.8% 30.6%;\n --destructive-foreground: 0 0% 98%;\n --ring: 240 4.9% 83.9%;\n }\n\n * {\n @apply border-border;\n }\n\n body {\n @apply bg-background text-foreground;\n }\n\n .fade-slide-top-enter-active,\n .fade-slide-top-leave-active {\n transition: all 0.3s ease;\n }\n\n .fade-slide-top-enter-from,\n .fade-slide-top-leave-to {\n opacity: 0;\n filter: blur(4px);\n transform: translateY(8px);\n }\n}"
|
|
94
93
|
},
|
|
95
94
|
"css": {
|
package/dist/index.js
CHANGED
|
@@ -26,95 +26,6 @@ import { tmpdir } from "node:os";
|
|
|
26
26
|
import path from "pathe";
|
|
27
27
|
import { Project, ScriptKind } from "ts-morph";
|
|
28
28
|
|
|
29
|
-
// src/utils/transformers/transform-css-vars.ts
|
|
30
|
-
import MagicString from "magic-string";
|
|
31
|
-
import { parse } from "@vue/compiler-sfc";
|
|
32
|
-
import { SyntaxKind } from "ts-morph";
|
|
33
|
-
var transformCssVars = async ({
|
|
34
|
-
sourceFile,
|
|
35
|
-
config,
|
|
36
|
-
baseColor
|
|
37
|
-
}) => {
|
|
38
|
-
const isVueFile = sourceFile.getFilePath().endsWith("vue");
|
|
39
|
-
if (config.tailwind?.cssVariables || !baseColor?.inlineColors) {
|
|
40
|
-
return sourceFile;
|
|
41
|
-
}
|
|
42
|
-
let template2 = null;
|
|
43
|
-
if (isVueFile) {
|
|
44
|
-
const parsed = parse(sourceFile.getText());
|
|
45
|
-
template2 = parsed.descriptor.template;
|
|
46
|
-
if (!template2) {
|
|
47
|
-
return sourceFile;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
sourceFile.getDescendantsOfKind(SyntaxKind.StringLiteral).forEach((node) => {
|
|
51
|
-
if (template2 && template2.loc.start.offset >= node.getPos()) {
|
|
52
|
-
return sourceFile;
|
|
53
|
-
}
|
|
54
|
-
const value = node.getText();
|
|
55
|
-
const hasClosingDoubleQuote = value.match(/"/g)?.length === 2;
|
|
56
|
-
if (value.search("'") === -1 && hasClosingDoubleQuote) {
|
|
57
|
-
const mapped = applyColorMapping(value.replace(/"/g, ""), baseColor.inlineColors);
|
|
58
|
-
node.replaceWithText(`"${mapped}"`);
|
|
59
|
-
} else {
|
|
60
|
-
const s = new MagicString(value);
|
|
61
|
-
s.replace(/'(.*?)'/g, (substring) => {
|
|
62
|
-
return `'${applyColorMapping(substring.replace(/'/g, ""), baseColor.inlineColors)}'`;
|
|
63
|
-
});
|
|
64
|
-
node.replaceWithText(s.toString());
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
return sourceFile;
|
|
68
|
-
};
|
|
69
|
-
function splitClassName(className) {
|
|
70
|
-
if (!className.includes("/") && !className.includes(":")) {
|
|
71
|
-
return [null, className, null];
|
|
72
|
-
}
|
|
73
|
-
const parts = [];
|
|
74
|
-
const [rest, alpha] = className.split("/");
|
|
75
|
-
if (!rest.includes(":")) {
|
|
76
|
-
return [null, rest, alpha];
|
|
77
|
-
}
|
|
78
|
-
const split = rest.split(":");
|
|
79
|
-
const name = split.pop();
|
|
80
|
-
const variant = split.join(":");
|
|
81
|
-
parts.push(variant ?? null, name ?? null, alpha ?? null);
|
|
82
|
-
return parts;
|
|
83
|
-
}
|
|
84
|
-
var PREFIXES = ["bg-", "text-", "border-", "ring-offset-", "ring-"];
|
|
85
|
-
function applyColorMapping(input, mapping) {
|
|
86
|
-
if (input.includes(" border ")) {
|
|
87
|
-
input = input.replace(" border ", " border border-border ");
|
|
88
|
-
}
|
|
89
|
-
const classNames = input.split(" ");
|
|
90
|
-
const lightMode = /* @__PURE__ */ new Set();
|
|
91
|
-
const darkMode = /* @__PURE__ */ new Set();
|
|
92
|
-
for (const className of classNames) {
|
|
93
|
-
const [variant, value, modifier] = splitClassName(className);
|
|
94
|
-
const prefix = PREFIXES.find((prefix2) => value?.startsWith(prefix2));
|
|
95
|
-
if (!prefix) {
|
|
96
|
-
if (!lightMode.has(className)) {
|
|
97
|
-
lightMode.add(className);
|
|
98
|
-
}
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
const needle = value?.replace(prefix, "");
|
|
102
|
-
if (needle && needle in mapping.light) {
|
|
103
|
-
lightMode.add(
|
|
104
|
-
[variant, `${prefix}${mapping.light[needle]}`].filter(Boolean).join(":") + (modifier ? `/${modifier}` : "")
|
|
105
|
-
);
|
|
106
|
-
darkMode.add(
|
|
107
|
-
["dark", variant, `${prefix}${mapping.dark[needle]}`].filter(Boolean).join(":") + (modifier ? `/${modifier}` : "")
|
|
108
|
-
);
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
if (!lightMode.has(className)) {
|
|
112
|
-
lightMode.add(className);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return [...Array.from(lightMode), ...Array.from(darkMode)].join(" ").trim();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
29
|
// src/utils/transformers/transform-import.ts
|
|
119
30
|
var transformImport = async ({ sourceFile, config }) => {
|
|
120
31
|
const importDeclarations = sourceFile.getImportDeclarations();
|
|
@@ -149,7 +60,6 @@ var transformImport = async ({ sourceFile, config }) => {
|
|
|
149
60
|
|
|
150
61
|
// src/utils/transformers/index.ts
|
|
151
62
|
var transformers = [
|
|
152
|
-
transformCssVars,
|
|
153
63
|
transformImport
|
|
154
64
|
// transformTwPrefixes,
|
|
155
65
|
];
|
|
@@ -194,7 +104,7 @@ function resolveImport(importPath, config) {
|
|
|
194
104
|
// src/schemas/index.ts
|
|
195
105
|
import { z } from "zod";
|
|
196
106
|
var DEFAULT_TYPESCRIPT_CONFIG = "tsconfig.json";
|
|
197
|
-
var DEFAULT_TAILWIND_BASE_COLOR = "
|
|
107
|
+
var DEFAULT_TAILWIND_BASE_COLOR = "zinc";
|
|
198
108
|
var commonFields = {
|
|
199
109
|
styleSystem: z.string(),
|
|
200
110
|
baseColor: z.string().default(DEFAULT_TAILWIND_BASE_COLOR),
|
|
@@ -205,7 +115,6 @@ var commonFields = {
|
|
|
205
115
|
};
|
|
206
116
|
var tailwindFields = {
|
|
207
117
|
config: z.string(),
|
|
208
|
-
cssVariables: z.boolean().default(true),
|
|
209
118
|
prefix: z.string().optional()
|
|
210
119
|
};
|
|
211
120
|
var registryItemSchema = z.object({
|
|
@@ -243,7 +152,6 @@ var registryBaseColorSchema = z.object({
|
|
|
243
152
|
}),
|
|
244
153
|
templates: z.object({
|
|
245
154
|
tailwind: z.object({
|
|
246
|
-
withoutVariables: z.string(),
|
|
247
155
|
withVariables: z.string()
|
|
248
156
|
}),
|
|
249
157
|
css: z.object({
|
|
@@ -261,7 +169,6 @@ var rawConfigSchema = z.object({
|
|
|
261
169
|
baseColor: commonFields.baseColor,
|
|
262
170
|
tailwind: z.object({
|
|
263
171
|
config: tailwindFields.config,
|
|
264
|
-
cssVariables: tailwindFields.cssVariables,
|
|
265
172
|
prefix: tailwindFields.prefix
|
|
266
173
|
}),
|
|
267
174
|
aliases: z.object({
|
|
@@ -394,37 +301,28 @@ import path3 from "pathe";
|
|
|
394
301
|
|
|
395
302
|
// ../../apps/docs/src/lib/registry/colors.ts
|
|
396
303
|
var baseColors = [
|
|
397
|
-
{ name: "slate", label: "Slate" },
|
|
398
|
-
{ name: "gray", label: "Gray" },
|
|
399
304
|
{ name: "zinc", label: "Zinc" },
|
|
400
|
-
{ name: "
|
|
401
|
-
{ name: "
|
|
305
|
+
{ name: "gray", label: "Gray" },
|
|
306
|
+
{ name: "blue", label: "Blue" },
|
|
307
|
+
{ name: "rose", label: "Rose" },
|
|
402
308
|
{ name: "red", label: "Red" },
|
|
403
309
|
{ name: "orange", label: "Orange" },
|
|
404
|
-
{ name: "amber", label: "Amber" },
|
|
405
310
|
{ name: "yellow", label: "Yellow" },
|
|
406
|
-
{ name: "lime", label: "Lime" },
|
|
407
311
|
{ name: "green", label: "Green" },
|
|
408
|
-
{ name: "
|
|
409
|
-
{ name: "teal", label: "Teal" },
|
|
410
|
-
{ name: "cyan", label: "Cyan" },
|
|
411
|
-
{ name: "sky", label: "Sky" },
|
|
412
|
-
{ name: "blue", label: "Blue" },
|
|
413
|
-
{ name: "indigo", label: "Indigo" },
|
|
414
|
-
{ name: "violet", label: "Violet" },
|
|
415
|
-
{ name: "purple", label: "Purple" },
|
|
416
|
-
{ name: "fuchsia", label: "Fuchsia" },
|
|
417
|
-
{ name: "pink", label: "Pink" },
|
|
418
|
-
{ name: "rose", label: "Rose" }
|
|
312
|
+
{ name: "violet", label: "Violet" }
|
|
419
313
|
];
|
|
420
314
|
|
|
421
315
|
// src/utils/registry/index.ts
|
|
422
316
|
var REGISTRY_PATH = new URL("../__generated/registry-schemes/", import.meta.url);
|
|
317
|
+
var DIRS = {
|
|
318
|
+
STYLE_SYSTEM: "style-system",
|
|
319
|
+
COLORS: "colors"
|
|
320
|
+
};
|
|
423
321
|
var filePaths = {
|
|
424
322
|
index: () => `index.json`,
|
|
425
|
-
styles: () =>
|
|
426
|
-
baseColors: (baseColor) =>
|
|
427
|
-
selectedStyleComponent: (params) =>
|
|
323
|
+
styles: () => `${DIRS.STYLE_SYSTEM}/index.json`,
|
|
324
|
+
baseColors: (baseColor) => `${DIRS.COLORS}/${baseColor}.json`,
|
|
325
|
+
selectedStyleComponent: (params) => `${DIRS.STYLE_SYSTEM}/${params.styleSystem}/${params.componentName}.json`
|
|
428
326
|
};
|
|
429
327
|
function getRegistryBaseColors() {
|
|
430
328
|
return baseColors;
|
|
@@ -924,9 +822,10 @@ import { Command as Command3 } from "commander";
|
|
|
924
822
|
import { template } from "lodash-es";
|
|
925
823
|
import ora2 from "ora";
|
|
926
824
|
import prompts2 from "prompts";
|
|
927
|
-
import { addDependency as addDependency2, addDevDependency as addDevDependency2 } from "nypm";
|
|
825
|
+
import { addDependency as addDependency2, addDevDependency as addDevDependency2, detectPackageManager as detectPackageManager2 } from "nypm";
|
|
928
826
|
import { consola as consola5 } from "consola";
|
|
929
827
|
import { colors as colors4 } from "consola/utils";
|
|
828
|
+
import { execSync as execSync2 } from "node:child_process";
|
|
930
829
|
|
|
931
830
|
// ../../node_modules/.pnpm/prettier@3.5.0/node_modules/prettier/index.mjs
|
|
932
831
|
import { createRequire as __prettierCreateRequire } from "module";
|
|
@@ -15670,7 +15569,7 @@ var column;
|
|
|
15670
15569
|
var token;
|
|
15671
15570
|
var key;
|
|
15672
15571
|
var root;
|
|
15673
|
-
var
|
|
15572
|
+
var parse2 = function parse3(text, reviver) {
|
|
15674
15573
|
source = String(text);
|
|
15675
15574
|
parseState = "start";
|
|
15676
15575
|
stack = [];
|
|
@@ -16501,7 +16400,7 @@ function syntaxError(message) {
|
|
|
16501
16400
|
err.columnNumber = column;
|
|
16502
16401
|
return err;
|
|
16503
16402
|
}
|
|
16504
|
-
var dist_default = { parse:
|
|
16403
|
+
var dist_default = { parse: parse2 };
|
|
16505
16404
|
var import_code_frame = __toESM(require_lib2(), 1);
|
|
16506
16405
|
var safeLastIndexOf = (string, searchString, index) => index < 0 ? -1 : string.lastIndexOf(searchString, index);
|
|
16507
16406
|
function getPosition(text, textIndex) {
|
|
@@ -23828,7 +23727,7 @@ var debugApis = {
|
|
|
23828
23727
|
var src_default = index_exports;
|
|
23829
23728
|
|
|
23830
23729
|
// src/commands/init.ts
|
|
23831
|
-
import { Project as Project2, SyntaxKind as
|
|
23730
|
+
import { Project as Project2, SyntaxKind as SyntaxKind2 } from "ts-morph";
|
|
23832
23731
|
|
|
23833
23732
|
// src/utils/get-project-info.ts
|
|
23834
23733
|
import { existsSync as existsSync4 } from "node:fs";
|
|
@@ -23896,8 +23795,27 @@ function transformCJSToESM(filename, code) {
|
|
|
23896
23795
|
}
|
|
23897
23796
|
|
|
23898
23797
|
// src/utils/transformers/transform-tw-prefix.ts
|
|
23899
|
-
import { SyntaxKind
|
|
23900
|
-
import { MagicString
|
|
23798
|
+
import { SyntaxKind } from "ts-morph";
|
|
23799
|
+
import { MagicString, parse as parse7 } from "@vue/compiler-sfc";
|
|
23800
|
+
|
|
23801
|
+
// src/utils/transformers/transform-css-vars.ts
|
|
23802
|
+
function splitClassName(className) {
|
|
23803
|
+
if (!className.includes("/") && !className.includes(":")) {
|
|
23804
|
+
return [null, className, null];
|
|
23805
|
+
}
|
|
23806
|
+
const parts = [];
|
|
23807
|
+
const [rest, alpha] = className.split("/");
|
|
23808
|
+
if (!rest.includes(":")) {
|
|
23809
|
+
return [null, rest, alpha];
|
|
23810
|
+
}
|
|
23811
|
+
const split = rest.split(":");
|
|
23812
|
+
const name = split.pop();
|
|
23813
|
+
const variant = split.join(":");
|
|
23814
|
+
parts.push(variant ?? null, name ?? null, alpha ?? null);
|
|
23815
|
+
return parts;
|
|
23816
|
+
}
|
|
23817
|
+
|
|
23818
|
+
// src/utils/transformers/transform-tw-prefix.ts
|
|
23901
23819
|
function applyPrefix(input, prefix = "") {
|
|
23902
23820
|
const classNames = input.split(" ");
|
|
23903
23821
|
const prefixed = [];
|
|
@@ -23962,45 +23880,6 @@ export function cn(...inputs: ClassValue[]) {
|
|
|
23962
23880
|
`;
|
|
23963
23881
|
var TAILWIND_CONFIG_TEMPLATE = `const animate = require("tailwindcss-animate")
|
|
23964
23882
|
|
|
23965
|
-
/** @type {import('tailwindcss').Config} */
|
|
23966
|
-
module.exports = {
|
|
23967
|
-
darkMode: ["class"],
|
|
23968
|
-
content: [
|
|
23969
|
-
'./pages/**/*.{<%- extension %>,<%- extension %>x,vue}',
|
|
23970
|
-
'./components/**/*.{<%- extension %>,<%- extension %>x,vue}',
|
|
23971
|
-
'./app/**/*.{<%- extension %>,<%- extension %>x,vue}',
|
|
23972
|
-
'./src/**/*.{<%- extension %>,<%- extension %>x,vue}',
|
|
23973
|
-
],
|
|
23974
|
-
prefix: "<%- prefix %>",
|
|
23975
|
-
theme: {
|
|
23976
|
-
container: {
|
|
23977
|
-
center: true,
|
|
23978
|
-
padding: "2rem",
|
|
23979
|
-
screens: {
|
|
23980
|
-
"2xl": "1400px",
|
|
23981
|
-
},
|
|
23982
|
-
},
|
|
23983
|
-
extend: {
|
|
23984
|
-
keyframes: {
|
|
23985
|
-
"accordion-down": {
|
|
23986
|
-
from: { height: 0 },
|
|
23987
|
-
to: { height: "var(--reka-accordion-content-height)" },
|
|
23988
|
-
},
|
|
23989
|
-
"accordion-up": {
|
|
23990
|
-
from: { height: "var(--reka-accordion-content-height)" },
|
|
23991
|
-
to: { height: 0 },
|
|
23992
|
-
},
|
|
23993
|
-
},
|
|
23994
|
-
animation: {
|
|
23995
|
-
"accordion-down": "accordion-down 0.2s ease-out",
|
|
23996
|
-
"accordion-up": "accordion-up 0.2s ease-out",
|
|
23997
|
-
},
|
|
23998
|
-
},
|
|
23999
|
-
},
|
|
24000
|
-
plugins: [animate],
|
|
24001
|
-
}`;
|
|
24002
|
-
var TAILWIND_CONFIG_WITH_VARIABLES_TEMPLATE = `const animate = require("tailwindcss-animate")
|
|
24003
|
-
|
|
24004
23883
|
/** @type {import('tailwindcss').Config} */
|
|
24005
23884
|
module.exports = {
|
|
24006
23885
|
darkMode: ["class"],
|
|
@@ -24602,14 +24481,6 @@ async function promptForConfig(cwd, defaultConfig = null, skip2 = false) {
|
|
|
24602
24481
|
message: `Specify the path to ${highlight("global CSS")} file ${colors4.gray("(it will be overwritten / created)")}`,
|
|
24603
24482
|
initial: (_, values) => defaultConfig?.cssPath ?? TAILWIND_CSS_PATH[values.framework]
|
|
24604
24483
|
},
|
|
24605
|
-
{
|
|
24606
|
-
type: (_, answers) => answers.styleSystem === "tailwind" ? "toggle" : null,
|
|
24607
|
-
name: "tailwindCssVariables",
|
|
24608
|
-
message: `Generate and use ${highlight("CSS variables")} for colors and other parameters? ${colors4.gray("(recommended)")}`,
|
|
24609
|
-
initial: defaultConfig?.tailwind.cssVariables ?? true,
|
|
24610
|
-
active: "yes",
|
|
24611
|
-
inactive: "no"
|
|
24612
|
-
},
|
|
24613
24484
|
{
|
|
24614
24485
|
type: "text",
|
|
24615
24486
|
name: "components",
|
|
@@ -24656,8 +24527,7 @@ function createConfig(options8) {
|
|
|
24656
24527
|
cssPath: options8.cssPath,
|
|
24657
24528
|
baseColor: options8.tailwindBaseColor,
|
|
24658
24529
|
tailwind: {
|
|
24659
|
-
config: options8.tailwindConfig || ""
|
|
24660
|
-
cssVariables: options8.tailwindCssVariables
|
|
24530
|
+
config: options8.tailwindConfig || ""
|
|
24661
24531
|
},
|
|
24662
24532
|
aliases: {
|
|
24663
24533
|
utils: options8.utils || "",
|
|
@@ -24701,9 +24571,7 @@ async function writeFiles(config) {
|
|
|
24701
24571
|
writeFilesSpinner?.succeed();
|
|
24702
24572
|
}
|
|
24703
24573
|
async function writeTailwindConfig(config) {
|
|
24704
|
-
const unformattedConfig = template(
|
|
24705
|
-
config.tailwind.cssVariables ? TAILWIND_CONFIG_WITH_VARIABLES_TEMPLATE : TAILWIND_CONFIG_TEMPLATE
|
|
24706
|
-
)({
|
|
24574
|
+
const unformattedConfig = template(TAILWIND_CONFIG_TEMPLATE)({
|
|
24707
24575
|
framework: config.framework,
|
|
24708
24576
|
prefix: config.tailwind.prefix,
|
|
24709
24577
|
extension: "ts"
|
|
@@ -24730,11 +24598,7 @@ async function writeCssFile(config) {
|
|
|
24730
24598
|
const file = config.resolvedPaths.tailwindCss;
|
|
24731
24599
|
let data = "";
|
|
24732
24600
|
if (config.styleSystem === "tailwind") {
|
|
24733
|
-
|
|
24734
|
-
data = config.tailwind.prefix ? applyPrefixesCss(baseColorData.templates.tailwind.withVariables, config.tailwind.prefix) : baseColorData.templates.tailwind.withVariables;
|
|
24735
|
-
} else {
|
|
24736
|
-
data = baseColorData.templates.tailwind.withoutVariables;
|
|
24737
|
-
}
|
|
24601
|
+
data = config.tailwind.prefix ? applyPrefixesCss(baseColorData.templates.tailwind.withVariables, config.tailwind.prefix) : baseColorData.templates.tailwind.withVariables;
|
|
24738
24602
|
} else if (config.styleSystem === "css") {
|
|
24739
24603
|
data = baseColorData.templates.css.withVariables;
|
|
24740
24604
|
if (config.generatePreflight) {
|
|
@@ -24784,22 +24648,53 @@ async function installDependencies2(config, cwd) {
|
|
|
24784
24648
|
}
|
|
24785
24649
|
const deps = [...baseDeps, ...PROJECT_DEPENDENCIES.sharedBase].filter(Boolean);
|
|
24786
24650
|
const devDeps = baseDevDeps.filter(Boolean);
|
|
24787
|
-
|
|
24788
|
-
|
|
24789
|
-
|
|
24790
|
-
|
|
24791
|
-
|
|
24792
|
-
|
|
24793
|
-
|
|
24794
|
-
|
|
24795
|
-
|
|
24796
|
-
|
|
24797
|
-
|
|
24798
|
-
|
|
24799
|
-
|
|
24800
|
-
|
|
24801
|
-
|
|
24802
|
-
|
|
24651
|
+
const installTasks = [
|
|
24652
|
+
config.framework === "nuxt" && PROJECT_DEPENDENCIES.nuxt.length && { type: "devDependencies", deps: PROJECT_DEPENDENCIES.nuxt, installer: addDevDependency2 },
|
|
24653
|
+
deps.length && { type: "dependencies", deps, installer: addDependency2 },
|
|
24654
|
+
devDeps.length && { type: "devDependencies", deps: devDeps, installer: addDevDependency2 }
|
|
24655
|
+
].filter(Boolean);
|
|
24656
|
+
for (const task of installTasks) {
|
|
24657
|
+
try {
|
|
24658
|
+
dependenciesSpinner.text = `Installing ${task.type}...`;
|
|
24659
|
+
await task.installer(task.deps, { cwd, silent: true });
|
|
24660
|
+
} catch (error) {
|
|
24661
|
+
consola5.warn(`nypm failed to install ${task.type}:`, error);
|
|
24662
|
+
const isCorepackError = error instanceof Error && error.message?.includes("corepack");
|
|
24663
|
+
if (isCorepackError) {
|
|
24664
|
+
consola5.info(`Falling back to direct package manager execution for ${task.type}...`);
|
|
24665
|
+
const pm = await detectPackageManager2(cwd);
|
|
24666
|
+
let command = "";
|
|
24667
|
+
const depsString = task.deps.join(" ");
|
|
24668
|
+
const devFlag = task.type === "devDependencies" ? "-D " : "";
|
|
24669
|
+
switch (pm?.name) {
|
|
24670
|
+
case "npm":
|
|
24671
|
+
command = `npm install ${devFlag}${depsString}`;
|
|
24672
|
+
break;
|
|
24673
|
+
case "yarn":
|
|
24674
|
+
command = `yarn add ${devFlag}${depsString}`;
|
|
24675
|
+
break;
|
|
24676
|
+
case "bun":
|
|
24677
|
+
command = `bun add ${devFlag}${depsString}`;
|
|
24678
|
+
break;
|
|
24679
|
+
case "pnpm":
|
|
24680
|
+
default:
|
|
24681
|
+
command = `pnpm add ${devFlag}${depsString}`;
|
|
24682
|
+
break;
|
|
24683
|
+
}
|
|
24684
|
+
try {
|
|
24685
|
+
consola5.info(`Running: ${command}`);
|
|
24686
|
+
execSync2(command, { cwd, stdio: "inherit" });
|
|
24687
|
+
consola5.success(`Successfully installed ${task.type} using direct package manager execution.`);
|
|
24688
|
+
} catch (fallbackError) {
|
|
24689
|
+
const errorMessage = fallbackError instanceof Error ? fallbackError.message : "Unknown error";
|
|
24690
|
+
consola5.error(`Fallback package manager execution failed for ${task.type}:`, errorMessage);
|
|
24691
|
+
}
|
|
24692
|
+
} else {
|
|
24693
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
24694
|
+
consola5.error(`Failed to install ${task.type} using nypm: ${errorMessage}`);
|
|
24695
|
+
}
|
|
24696
|
+
}
|
|
24697
|
+
}
|
|
24803
24698
|
dependenciesSpinner?.succeed();
|
|
24804
24699
|
}
|
|
24805
24700
|
async function ensureDirectoriesExist(config) {
|
|
@@ -24848,17 +24743,17 @@ async function updateViteConfig() {
|
|
|
24848
24743
|
return;
|
|
24849
24744
|
}
|
|
24850
24745
|
const configObject = exportAssignment.getExpression();
|
|
24851
|
-
if (!configObject.asKind(
|
|
24746
|
+
if (!configObject.asKind(SyntaxKind2.CallExpression)) {
|
|
24852
24747
|
consola5.warn("Default export is not a defineConfig call");
|
|
24853
24748
|
return;
|
|
24854
24749
|
}
|
|
24855
|
-
const defineConfigCall = configObject.asKindOrThrow(
|
|
24750
|
+
const defineConfigCall = configObject.asKindOrThrow(SyntaxKind2.CallExpression);
|
|
24856
24751
|
const configArg = defineConfigCall.getArguments()[0];
|
|
24857
|
-
if (!configArg?.asKind(
|
|
24752
|
+
if (!configArg?.asKind(SyntaxKind2.ObjectLiteralExpression)) {
|
|
24858
24753
|
consola5.warn("defineConfig argument is not an object literal");
|
|
24859
24754
|
return;
|
|
24860
24755
|
}
|
|
24861
|
-
const configObjLiteral = configArg.asKindOrThrow(
|
|
24756
|
+
const configObjLiteral = configArg.asKindOrThrow(SyntaxKind2.ObjectLiteralExpression);
|
|
24862
24757
|
sourceFile.addImportDeclaration({
|
|
24863
24758
|
moduleSpecifier: "@tailwindcss/vite",
|
|
24864
24759
|
defaultImport: "tailwindcss"
|
|
@@ -24875,16 +24770,16 @@ async function updateViteConfig() {
|
|
|
24875
24770
|
consola5.warn("Could not create plugins property");
|
|
24876
24771
|
return;
|
|
24877
24772
|
}
|
|
24878
|
-
const pluginsArray = pluginsProp.getFirstChildByKind(
|
|
24773
|
+
const pluginsArray = pluginsProp.getFirstChildByKind(SyntaxKind2.ArrayLiteralExpression);
|
|
24879
24774
|
if (!pluginsArray) {
|
|
24880
24775
|
consola5.warn("Could not find or create plugins array");
|
|
24881
24776
|
return;
|
|
24882
24777
|
}
|
|
24883
24778
|
const hasTailwindPlugin = pluginsArray.getElements().some((element) => {
|
|
24884
|
-
if (element.getKind() !==
|
|
24779
|
+
if (element.getKind() !== SyntaxKind2.CallExpression) {
|
|
24885
24780
|
return false;
|
|
24886
24781
|
}
|
|
24887
|
-
const callExpr = element.asKindOrThrow(
|
|
24782
|
+
const callExpr = element.asKindOrThrow(SyntaxKind2.CallExpression);
|
|
24888
24783
|
const expression = callExpr.getExpression();
|
|
24889
24784
|
return expression.getText() === "tailwindcss";
|
|
24890
24785
|
});
|