vds-test-empty 1.0.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/.cursorrules ADDED
@@ -0,0 +1,12 @@
1
+ # VDS — Vibe Design System
2
+ Bu proje VDS kullanıyor. Komutlar:
3
+ - npm run vds → projeyi tara
4
+ - npm run vds:stories → Storybook story'lerini üret
5
+ - npm run vds:watch → değişiklikleri izle
6
+ - npm run storybook → design system'ı aç (localhost:6006)
7
+
8
+ Geliştirme kuralları:
9
+ - UI component'leri src/components/ui/ altına koy
10
+ - Variant'lar için cva() kullan
11
+ - Tailwind CSS kullan
12
+ - Named export veya default export — ikisi de çalışır
@@ -0,0 +1,10 @@
1
+ import type { StorybookConfig } from "@storybook/react-vite";
2
+ const config: StorybookConfig = {
3
+ stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
4
+ addons: ["@storybook/addon-essentials"],
5
+ framework: {
6
+ name: "@storybook/react-vite",
7
+ options: {},
8
+ },
9
+ };
10
+ export default config;
@@ -0,0 +1,4 @@
1
+ import type { Preview } from "@storybook/react";
2
+ import "../src/index.css";
3
+ const preview: Preview = { parameters: { layout: "centered" } };
4
+ export default preview;
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "vds-test-empty",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "vds": "node vds-core/scan.mjs",
9
+ "vds:stories": "node vds-core/story-generator.mjs",
10
+ "vds:watch": "node vds-core/watch.mjs",
11
+ "storybook": "storybook dev -p 6006",
12
+ "build-storybook": "storybook build"
13
+ },
14
+ "keywords": [],
15
+ "author": "",
16
+ "license": "ISC",
17
+ "type": "commonjs",
18
+ "devDependencies": {
19
+ "@storybook/react": "^10.2.13",
20
+ "@storybook/react-vite": "^10.2.13",
21
+ "storybook": "^10.2.13"
22
+ }
23
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "branch": null,
3
+ "engineer": null,
4
+ "scannedAt": "2026-02-28T18:28:49.571Z",
5
+ "totalComponents": 0,
6
+ "components": [],
7
+ "foundations": {
8
+ "colors": {},
9
+ "typography": {},
10
+ "radius": {},
11
+ "shadows": {},
12
+ "spacing": {},
13
+ "breakpoints": {},
14
+ "zIndex": {},
15
+ "motion": {
16
+ "transitionDuration": {},
17
+ "transitionTimingFunction": {},
18
+ "animation": {}
19
+ },
20
+ "icons": [],
21
+ "brand": {
22
+ "assets": []
23
+ }
24
+ },
25
+ "componentSuggestions": []
26
+ }
@@ -0,0 +1,22 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+
3
+ const meta = { title: "Foundations/Brand" } satisfies Meta;
4
+ export default meta;
5
+ type Story = StoryObj;
6
+
7
+ const assets = [];
8
+
9
+ export const Default: Story = {
10
+ render: () => (
11
+ <div>
12
+ <h2 style={{ marginBottom: 16 }}>Logo and favicon paths</h2>
13
+ <ul style={{ listStyle: "none", padding: 0 }}>
14
+ {assets.length === 0 ? <li>No brand assets found.</li> : assets.map((a, i) => (
15
+ <li key={i} style={{ padding: "8px 0", borderBottom: "1px solid #222" }}>
16
+ <strong>{a.type || "asset"}</strong>: <code>{a.path || a.name || ""}</code>
17
+ </li>
18
+ ))}
19
+ </ul>
20
+ </div>
21
+ ),
22
+ };
@@ -0,0 +1,21 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+
3
+ const meta = { title: "Foundations/Colors" } satisfies Meta;
4
+ export default meta;
5
+ type Story = StoryObj;
6
+
7
+ const colors = [];
8
+
9
+ export const Default: Story = {
10
+ render: () => (
11
+ <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(140px, 1fr))", gap: "1rem" }}>
12
+ {colors.map(({ name, hex }) => (
13
+ <div key={name}>
14
+ <div style={{ backgroundColor: hex, height: 80, borderRadius: 8, border: "1px solid #333" }} />
15
+ <p style={{ marginTop: 8, fontSize: 12 }}>{name}</p>
16
+ <code style={{ fontSize: 11 }}>{hex}</code>
17
+ </div>
18
+ ))}
19
+ </div>
20
+ ),
21
+ };
@@ -0,0 +1,52 @@
1
+ # VDS Core — Ghost mode
2
+
3
+ Zero-config, autonomous design system. Drop this folder into any Vite + React project and activate with one route.
4
+
5
+ ## Activation (any project)
6
+
7
+ 1. **Scan** (regenerate manifest):
8
+ ```bash
9
+ npm run vds
10
+ ```
11
+ Add to `package.json` if missing:
12
+ ```json
13
+ "vds": "node vds-core/scan.mjs"
14
+ ```
15
+
16
+ 2. **Mount** the dashboard (e.g. in your router):
17
+ ```tsx
18
+ import VdsDashboard from "@/vds-core";
19
+ // ...
20
+ <Route path="/vds" element={<VdsDashboard />} />
21
+ ```
22
+
23
+ 3. Ensure `public/vds-output.json` exists (created by step 1). Then open `/vds`.
24
+
25
+ ## Live component preview (optional)
26
+
27
+ To see **live renders** of components in the dashboard (isolated, no app chrome):
28
+
29
+ 1. Add the preview route **outside** any layout that has your app header, sidebar, or nav. Otherwise every preview iframe will show your full app shell instead of just the component.
30
+ ```tsx
31
+ import VdsPreview from "./vds-core/VdsPreview"; // or from node_modules/vibe-design-system/vds-core-template/
32
+ // ...
33
+ <Routes>
34
+ {/* Preview must NOT be inside a layout with header/sidebar */}
35
+ <Route path="/vds-preview" element={<VdsPreview />} />
36
+ <Route path="/" element={<YourLayoutWithHeader />}>
37
+ <Route index element={<Home />} />
38
+ {/* ... */}
39
+ </Route>
40
+ </Routes>
41
+ ```
42
+
43
+ 2. If you open the dashboard from the **standalone server** (e.g. `npm run vds:watch` → Dashboard at `http://localhost:3334/vds`), run your app as well (e.g. `npm run dev` on port 5173). The dashboard will load previews from that app. If your app runs on another port (e.g. 3000), set:
44
+ ```bash
45
+ VDS_PREVIEW_URL=http://localhost:3000 node vds-core/dashboard-server.mjs
46
+ ```
47
+
48
+ ## Layout
49
+
50
+ - `vds-core/scan.mjs` — Node script; scans `src/components`, CSS, Tailwind config. Writes `vds-output.json` and `public/vds-output.json`. Paths are relative to **project root** (parent of `vds-core`).
51
+ - `vds-core/VdsPreview.tsx` — Optional; mount at `/vds-preview` so the dashboard can show live component renders.
52
+ - Dashboard UI reads `/vds-output.json`, renders Foundations + Component Library.
@@ -0,0 +1,72 @@
1
+ /**
2
+ * VDS Component Preview — mount at /vds-preview so the dashboard can show live component renders.
3
+ *
4
+ * Important: Render this route OUTSIDE any layout that contains your app header, sidebar, or nav.
5
+ * Otherwise every component preview iframe will show your full app shell instead of the component alone.
6
+ *
7
+ * Example (React Router):
8
+ * <Route path="/vds-preview" element={<VdsPreview />} /> // at root, not inside <LayoutWithHeader>
9
+ *
10
+ * Requires Vite; uses import.meta.glob. Path alias @/components must point to src/components.
11
+ */
12
+ import React, { useEffect, useState, Suspense } from "react";
13
+ import { useSearchParams } from "react-router-dom";
14
+
15
+ const componentModules = import.meta.glob("@/components/**/*.tsx");
16
+
17
+ export default function VdsPreview() {
18
+ const [searchParams] = useSearchParams();
19
+ const file = searchParams.get("file");
20
+ const [Component, setComponent] = useState<React.ComponentType | null>(null);
21
+ const [error, setError] = useState<string | null>(null);
22
+
23
+ useEffect(() => {
24
+ if (!file) {
25
+ setError("Missing ?file= parameter");
26
+ setComponent(null);
27
+ return;
28
+ }
29
+ const normalized = file.replace(/\\/g, "/");
30
+ const key = Object.keys(componentModules).find((k) => {
31
+ const kk = k.replace(/\\/g, "/");
32
+ return kk === `@/components/${normalized}` || kk.endsWith("/components/" + normalized) || kk.endsWith(normalized);
33
+ });
34
+ if (!key) {
35
+ setError(`Component not found: ${file}`);
36
+ setComponent(null);
37
+ return;
38
+ }
39
+ const loader = componentModules[key] as () => Promise<{ default: React.ComponentType }>;
40
+ loader()
41
+ .then((m) => {
42
+ setComponent(() => m.default);
43
+ setError(null);
44
+ })
45
+ .catch((err) => {
46
+ setError(String(err?.message || err));
47
+ setComponent(null);
48
+ });
49
+ }, [file]);
50
+
51
+ if (error) {
52
+ return (
53
+ <div style={{ padding: 24, background: "#0f172a", minHeight: 200, color: "#94a3b8", fontSize: 13 }}>
54
+ {error}
55
+ </div>
56
+ );
57
+ }
58
+ if (!Component) {
59
+ return (
60
+ <div style={{ padding: 24, background: "#0f172a", minHeight: 200, color: "#94a3b8", fontSize: 13 }}>
61
+ Loading…
62
+ </div>
63
+ );
64
+ }
65
+ return (
66
+ <div style={{ padding: 24, background: "#020617", minHeight: 200 }}>
67
+ <Suspense fallback={<div style={{ color: "#94a3b8", fontSize: 13 }}>Loading component…</div>}>
68
+ <Component />
69
+ </Suspense>
70
+ </div>
71
+ );
72
+ }
@@ -0,0 +1,237 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * VDS Dashboard Server — http://localhost:PORT
4
+ * - /vds → pre-compiled dashboard from node_modules/vibe-design-system/dist/dashboard
5
+ * - Port: 3333, or first available 3333..3342 (EADDRINUSE resilience)
6
+ * - Proje kökünde çalıştırın: node vds-core/dashboard-server.mjs (init ile kopyalanır)
7
+ */
8
+ import fs from "fs";
9
+ import path from "path";
10
+ import { fileURLToPath } from "url";
11
+ import http from "http";
12
+ import net from "net";
13
+
14
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
15
+ const PROJECT_ROOT = path.join(__dirname, "..");
16
+ const PUBLIC_MANIFEST = path.join(PROJECT_ROOT, "public", "vds-output.json");
17
+ const ASSET_EXTENSIONS = /\.(svg|png|jpg|jpeg|ico|webp|gif)$/i;
18
+
19
+ const PORT_MIN = 3333;
20
+ const PORT_MAX = 3342;
21
+ const MIME = {
22
+ ".html": "text/html; charset=utf-8",
23
+ ".js": "application/javascript; charset=utf-8",
24
+ ".css": "text/css; charset=utf-8",
25
+ ".json": "application/json; charset=utf-8",
26
+ ".ico": "image/x-icon",
27
+ ".svg": "image/svg+xml",
28
+ ".png": "image/png",
29
+ ".jpg": "image/jpeg",
30
+ ".jpeg": "image/jpeg",
31
+ ".webp": "image/webp",
32
+ ".gif": "image/gif",
33
+ ".woff2": "font/woff2",
34
+ };
35
+
36
+ function findDashboardDir() {
37
+ const candidates = [
38
+ path.join(PROJECT_ROOT, "node_modules", "vibe-design-system", "dist", "dashboard"),
39
+ ];
40
+ let dir = PROJECT_ROOT;
41
+ for (let i = 0; i < 5; i++) {
42
+ const nm = path.join(dir, "node_modules", "vibe-design-system", "dist", "dashboard");
43
+ if (!candidates.includes(nm)) candidates.push(nm);
44
+ const parent = path.dirname(dir);
45
+ if (parent === dir) break;
46
+ dir = parent;
47
+ }
48
+ for (const d of candidates) {
49
+ if (fs.existsSync(d) && fs.statSync(d).isDirectory()) return d;
50
+ }
51
+ return null;
52
+ }
53
+
54
+ function findAvailablePort(startPort) {
55
+ return new Promise((resolve) => {
56
+ const tryPort = (port) => {
57
+ if (port > PORT_MAX) {
58
+ resolve(null);
59
+ return;
60
+ }
61
+ const server = net.createServer(() => {});
62
+ server.once("error", (err) => {
63
+ if (err.code === "EADDRINUSE") tryPort(port + 1);
64
+ else resolve(port);
65
+ });
66
+ server.once("listening", () => {
67
+ server.close(() => resolve(port));
68
+ });
69
+ server.listen(port, "127.0.0.1");
70
+ };
71
+ tryPort(startPort);
72
+ });
73
+ }
74
+
75
+ function readManifest() {
76
+ try {
77
+ if (fs.existsSync(PUBLIC_MANIFEST)) {
78
+ return fs.readFileSync(PUBLIC_MANIFEST, "utf-8");
79
+ }
80
+ } catch (_) {}
81
+ return JSON.stringify({ components: [], totalComponents: 0, scannedAt: new Date().toISOString() });
82
+ }
83
+
84
+ const sseClients = new Set();
85
+
86
+ function notifyManifestChange() {
87
+ const data = JSON.stringify({ type: "vds-output-changed", ts: Date.now() });
88
+ for (const res of sseClients) {
89
+ try {
90
+ res.write(`data: ${data}\n\n`);
91
+ } catch (_) {}
92
+ }
93
+ }
94
+
95
+ function setupWatcher() {
96
+ const dir = path.dirname(PUBLIC_MANIFEST);
97
+ if (!fs.existsSync(dir)) return;
98
+ try {
99
+ fs.watch(PUBLIC_MANIFEST, (event, filename) => {
100
+ if (filename && event === "change") notifyManifestChange();
101
+ });
102
+ } catch (_) {}
103
+ }
104
+
105
+ function safeEnd(res, statusCode, body, contentType = "text/plain; charset=utf-8") {
106
+ if (res.writableEnded) return;
107
+ res.writeHead(statusCode, { "Content-Type": contentType });
108
+ res.end(body);
109
+ }
110
+
111
+ const server = http.createServer((req, res) => {
112
+ const url = req.url?.split("?")[0] || "";
113
+ const method = req.method;
114
+
115
+ try {
116
+ if (method === "GET" && url === "/api/vds-preview-url") {
117
+ const url = process.env.VDS_PREVIEW_URL || "http://localhost:5173";
118
+ safeEnd(res, 200, JSON.stringify({ url }), "application/json; charset=utf-8");
119
+ return;
120
+ }
121
+ if (method === "GET" && (url === "/vds-output.json" || url === "/api/vds-output")) {
122
+ safeEnd(res, 200, readManifest(), "application/json; charset=utf-8");
123
+ return;
124
+ }
125
+
126
+ if (method === "GET" && url.startsWith("/api/vds-asset")) {
127
+ const u = new URL(req.url || "", `http://127.0.0.1`);
128
+ const filePath = u.searchParams.get("path");
129
+ if (!filePath || filePath.includes("..") || path.isAbsolute(filePath)) {
130
+ safeEnd(res, 400, "Bad request");
131
+ return;
132
+ }
133
+ if (!ASSET_EXTENSIONS.test(filePath)) {
134
+ safeEnd(res, 403, "Forbidden");
135
+ return;
136
+ }
137
+ const fullPath = path.join(PROJECT_ROOT, filePath);
138
+ const resolved = path.resolve(fullPath);
139
+ if (!resolved.startsWith(path.resolve(PROJECT_ROOT)) || !fs.existsSync(resolved) || !fs.statSync(resolved).isFile()) {
140
+ safeEnd(res, 404, "Not found");
141
+ return;
142
+ }
143
+ const ext = path.extname(resolved).toLowerCase();
144
+ const contentType = MIME[ext] || "application/octet-stream";
145
+ try {
146
+ const data = fs.readFileSync(resolved);
147
+ if (res.writableEnded) return;
148
+ res.writeHead(200, { "Content-Type": contentType });
149
+ res.end(data);
150
+ } catch (_) {
151
+ safeEnd(res, 500, "Internal Server Error");
152
+ }
153
+ return;
154
+ }
155
+
156
+ if (method === "GET" && url === "/api/vds-output/events") {
157
+ res.writeHead(200, {
158
+ "Content-Type": "text/event-stream",
159
+ "Cache-Control": "no-cache",
160
+ Connection: "keep-alive",
161
+ });
162
+ sseClients.add(res);
163
+ res.write("data: " + JSON.stringify({ type: "connected" }) + "\n\n");
164
+ req.on("close", () => sseClients.delete(res));
165
+ return;
166
+ }
167
+
168
+ if (method === "GET" && (url === "/vds" || url.startsWith("/vds/"))) {
169
+ const dashboardDir = findDashboardDir();
170
+ if (!dashboardDir) {
171
+ safeEnd(
172
+ res,
173
+ 503,
174
+ "VDS dashboard bulunamadı. npm install vibe-design-system ile kurun; paket dist/dashboard içerir.",
175
+ "text/plain; charset=utf-8"
176
+ );
177
+ return;
178
+ }
179
+ const sub = url === "/vds" || url === "/vds/" ? "/vds/index.html" : url;
180
+ const relativePath = sub.slice("/vds".length).replace(/^\//, "") || "index.html";
181
+ const filePath = path.join(dashboardDir, relativePath);
182
+ if (!path.resolve(filePath).startsWith(path.resolve(dashboardDir))) {
183
+ safeEnd(res, 403, "Forbidden");
184
+ return;
185
+ }
186
+ if (!fs.existsSync(filePath) || !fs.statSync(filePath).isFile()) {
187
+ const indexHtml = path.join(dashboardDir, "index.html");
188
+ if (fs.existsSync(indexHtml)) {
189
+ let html = fs.readFileSync(indexHtml, "utf-8");
190
+ const sseScript =
191
+ "<script>try{var es=new EventSource('/api/vds-output/events');es.onmessage=function(){location.reload();};}catch(e){}</script>";
192
+ if (!html.includes("api/vds-output/events")) {
193
+ html = html.replace("</body>", sseScript + "</body>");
194
+ }
195
+ safeEnd(res, 200, html, "text/html; charset=utf-8");
196
+ return;
197
+ }
198
+ safeEnd(res, 404, "Not found");
199
+ return;
200
+ }
201
+ const ext = path.extname(filePath).toLowerCase();
202
+ const contentType = MIME[ext] || "application/octet-stream";
203
+ const data = fs.readFileSync(filePath);
204
+ if (res.writableEnded) return;
205
+ res.writeHead(200, { "Content-Type": contentType });
206
+ res.end(data);
207
+ return;
208
+ }
209
+
210
+ safeEnd(res, 404, "Not found");
211
+ } catch (err) {
212
+ if (!res.writableEnded) {
213
+ console.error("[VDS] Request error:", err?.message || err);
214
+ safeEnd(res, 500, "Internal Server Error");
215
+ }
216
+ }
217
+ });
218
+
219
+ setupWatcher();
220
+
221
+ findAvailablePort(PORT_MIN).then((port) => {
222
+ if (port == null) {
223
+ console.error("[VDS] 3333–3342 aralığında boş port bulunamadı.");
224
+ process.exit(1);
225
+ }
226
+ const dashboardDir = findDashboardDir();
227
+ const resolvedPath = dashboardDir ? path.resolve(dashboardDir) : null;
228
+ const exists = Boolean(dashboardDir && fs.existsSync(dashboardDir));
229
+ console.log("[VDS] dist/dashboard path:", resolvedPath ?? "(aranıyor...)");
230
+ console.log("[VDS] dist/dashboard exists:", exists);
231
+ if (!exists) {
232
+ console.warn("[VDS] Dashboard klasörü bulunamadı; /vds istekleri 503 dönecek.");
233
+ }
234
+ server.listen(port, "127.0.0.1", () => {
235
+ console.log(`VDS şu adreste: http://localhost:${port}/vds`);
236
+ });
237
+ });