vaderjs-daisyui 0.0.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/Components/Actions/Button/index.tsx +63 -0
- package/Components/Actions/Dropdown/index.tsx +104 -0
- package/Components/Actions/Fab/index.tsx +76 -0
- package/Components/Actions/Modal/index.tsx +147 -0
- package/Components/Actions/Swap/index.tsx +52 -0
- package/Components/Actions/ThemeController/index.tsx +133 -0
- package/Components/Data/Display/Accordion/index.tsx +82 -0
- package/Components/Data/Display/Avatar/index.tsx +96 -0
- package/Components/Data/Display/Badge/index.tsx +46 -0
- package/Components/Data/Display/Card/index.tsx +72 -0
- package/Components/Data/Display/Carousel/index.tsx +72 -0
- package/Components/Data/Display/ChatBubble/index.tsx +57 -0
- package/Components/Data/Display/Collapse/index.tsx +60 -0
- package/Components/Data/Display/Countdown/index.tsx +97 -0
- package/Components/Data/Display/Diff/index.tsx +60 -0
- package/Components/Data/Display/Hover/Card/index.tsx +37 -0
- package/Components/Data/Display/Hover/Gallery/index.tsx +57 -0
- package/Components/Data/Display/Keyboard/index.tsx +31 -0
- package/Components/Data/Display/List/index.tsx +93 -0
- package/Components/Data/Display/Stat/index.tsx +114 -0
- package/Components/Data/Display/Table/index.tsx +33 -0
- package/Components/Data/Display/TextRotate/index.tsx +118 -0
- package/Components/Data/Display/Timeline/index.tsx +209 -0
- package/Components/Navigation/BreadCrumbs/index.tsx +201 -0
- package/Components/Navigation/Doc/index.tsx +394 -0
- package/Components/Navigation/Link/index.tsx +87 -0
- package/index.ts +130 -0
- package/package.json +15 -0
package/index.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { VaderPlugin } from "vaderjs/plugins";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import { spawn } from "child_process";
|
|
5
|
+
|
|
6
|
+
const PROJECT_ROOT = process.cwd();
|
|
7
|
+
|
|
8
|
+
/* --------------------------- utils --------------------------- */
|
|
9
|
+
|
|
10
|
+
function spawnSync(cmd: string, args: string[], opts: any = {}) {
|
|
11
|
+
const { status } = require("child_process").spawnSync(cmd, args, { stdio: "inherit", ...opts });
|
|
12
|
+
if (status !== 0) throw new Error(`${cmd} failed with exit code ${status}`);
|
|
13
|
+
return status;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function tailwindInstalled(): boolean {
|
|
17
|
+
try {
|
|
18
|
+
spawnSync("bunx", ["tailwindcss", "--version"], { stdio: "ignore" });
|
|
19
|
+
return true;
|
|
20
|
+
} catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Ensure root.css exists and copy to public/styles.css if missing
|
|
27
|
+
*/
|
|
28
|
+
function ensureStyles(inputPath: string) {
|
|
29
|
+
const outputPath = path.join(PROJECT_ROOT, "public/styles.css");
|
|
30
|
+
|
|
31
|
+
if (!fs.existsSync(outputPath)) {
|
|
32
|
+
if (!fs.existsSync(inputPath)) {
|
|
33
|
+
fs.writeFileSync(
|
|
34
|
+
inputPath,
|
|
35
|
+
`@tailwind base;\n@tailwind components;\n@tailwind utilities;\n@import "daisyui";`
|
|
36
|
+
);
|
|
37
|
+
console.log(`Created default root.css at ${inputPath}`);
|
|
38
|
+
}
|
|
39
|
+
fs.copyFileSync(inputPath, outputPath);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Auto-generate tailwind.config.js if missing
|
|
45
|
+
*/
|
|
46
|
+
function ensureTailwindConfig() {
|
|
47
|
+
const configPath = path.join(PROJECT_ROOT, "tailwind.config.js");
|
|
48
|
+
|
|
49
|
+
if (!fs.existsSync(configPath)) {
|
|
50
|
+
const configContent = `module.exports = {
|
|
51
|
+
content: ["./app/**/*.{js,ts,jsx,tsx}"],
|
|
52
|
+
theme: { extend: {} },
|
|
53
|
+
plugins: [require("daisyui")],
|
|
54
|
+
};`;
|
|
55
|
+
|
|
56
|
+
fs.writeFileSync(configPath, configContent);
|
|
57
|
+
console.log(`✅ Created tailwind.config.js`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Run tailwind build
|
|
63
|
+
*/
|
|
64
|
+
async function runTailwind(input: string, output: string) {
|
|
65
|
+
return new Promise<void>((resolve, reject) => {
|
|
66
|
+
const proc = spawn("bunx", ["tailwindcss", "-i", input, "-o", output], { stdio: "inherit" });
|
|
67
|
+
proc.on("close", (code) => {
|
|
68
|
+
if (code !== 0) reject(new Error(`Tailwind exited with ${code}`));
|
|
69
|
+
else resolve();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Auto-install dependencies if missing
|
|
76
|
+
*/
|
|
77
|
+
async function autoInstallDeps() {
|
|
78
|
+
console.log("📦 Tailwind dependencies missing, installing...");
|
|
79
|
+
// Clear Bun cache to avoid stale deps
|
|
80
|
+
spawnSync("bun", ["pm", "cache", "rm"]);
|
|
81
|
+
// Install Node/Bun deps
|
|
82
|
+
spawnSync("bun", [
|
|
83
|
+
"add",
|
|
84
|
+
"-d",
|
|
85
|
+
"tailwindcss@latest",
|
|
86
|
+
"@tailwindcss/cli@latest",
|
|
87
|
+
"daisyui@latest",
|
|
88
|
+
"postcss@latest",
|
|
89
|
+
"autoprefixer@latest",
|
|
90
|
+
]);
|
|
91
|
+
console.log("✅ Dependencies installed.");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* --------------------------- plugin --------------------------- */
|
|
95
|
+
|
|
96
|
+
const plugin: VaderPlugin = {
|
|
97
|
+
name: "Vader Aria",
|
|
98
|
+
version: "0.1.0",
|
|
99
|
+
description: "Tailwind + DaisyUI integration for VaderJS",
|
|
100
|
+
|
|
101
|
+
async onBuildStart(api) {
|
|
102
|
+
const rootCss = path.join(PROJECT_ROOT, "root.css");
|
|
103
|
+
|
|
104
|
+
// Ensure root CSS exists
|
|
105
|
+
ensureStyles(rootCss);
|
|
106
|
+
|
|
107
|
+
// Auto-install deps if Tailwind is not available
|
|
108
|
+
if (!tailwindInstalled()) {
|
|
109
|
+
await autoInstallDeps();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Ensure tailwind.config.js exists
|
|
113
|
+
ensureTailwindConfig();
|
|
114
|
+
|
|
115
|
+
// Run Tailwind build
|
|
116
|
+
console.log("🚀 Running TailwindCSS build...");
|
|
117
|
+
const output = path.join(PROJECT_ROOT, "public/styles.css");
|
|
118
|
+
await runTailwind(rootCss, output);
|
|
119
|
+
|
|
120
|
+
// Inject link into HTML
|
|
121
|
+
api.injectHTML(`<link rel="stylesheet" href="/styles.css" />`);
|
|
122
|
+
console.log("✅ TailwindCSS + DaisyUI loaded");
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
onBuildFinish(api) {
|
|
126
|
+
// Optional cleanup
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export default plugin;
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vaderjs-daisyui",
|
|
3
|
+
"description": "Lightweight React-like components wrapping DaisyUI classes. Zero dependencies, fully typed, and ready to ship.",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"vaderjs": "latest"
|
|
6
|
+
},
|
|
7
|
+
"devDependencies": {
|
|
8
|
+
"@tailwindcss/cli": "^4.1.18",
|
|
9
|
+
"autoprefixer": "^10.4.23",
|
|
10
|
+
"daisyui": "^5.5.14",
|
|
11
|
+
"postcss": "^8.5.6",
|
|
12
|
+
"tailwindcss": "^4.1.18"
|
|
13
|
+
},
|
|
14
|
+
"version": "0.0.1"
|
|
15
|
+
}
|