zero-doc 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.
@@ -0,0 +1,62 @@
1
+ import React, { createContext, useContext, useState, useEffect } from 'react';
2
+
3
+ interface ThemeContextType {
4
+ isDark: boolean;
5
+ toggleTheme: () => void;
6
+ }
7
+
8
+ const ThemeContext = createContext<ThemeContextType | undefined>(undefined);
9
+
10
+ export const ThemeProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
11
+ const [isDark, setIsDark] = useState(() => {
12
+ if (typeof window === 'undefined') return false;
13
+ const saved = localStorage.getItem('theme');
14
+ if (saved === 'dark' || saved === 'light') {
15
+ return saved === 'dark';
16
+ }
17
+ return window.matchMedia('(prefers-color-scheme: dark)').matches;
18
+ });
19
+
20
+ useEffect(() => {
21
+ const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
22
+ const handleChange = (e: MediaQueryListEvent) => {
23
+ if (!localStorage.getItem('theme')) {
24
+ setIsDark(e.matches);
25
+ }
26
+ };
27
+
28
+ mediaQuery.addEventListener('change', handleChange);
29
+ return () => mediaQuery.removeEventListener('change', handleChange);
30
+ }, []);
31
+
32
+ useEffect(() => {
33
+ const root = document.documentElement;
34
+ if (isDark) {
35
+ root.classList.add('dark');
36
+ } else {
37
+ root.classList.remove('dark');
38
+ }
39
+ }, [isDark]);
40
+
41
+ const toggleTheme = () => {
42
+ setIsDark(prev => {
43
+ const newValue = !prev;
44
+ localStorage.setItem('theme', newValue ? 'dark' : 'light');
45
+ return newValue;
46
+ });
47
+ };
48
+
49
+ return (
50
+ <ThemeContext.Provider value={{ isDark, toggleTheme }}>
51
+ {children}
52
+ </ThemeContext.Provider>
53
+ );
54
+ };
55
+
56
+ export const useTheme = () => {
57
+ const context = useContext(ThemeContext);
58
+ if (!context) {
59
+ throw new Error('useTheme must be used within ThemeProvider');
60
+ }
61
+ return context;
62
+ };
@@ -0,0 +1,32 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ body {
6
+ margin: 0;
7
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
8
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
9
+ sans-serif;
10
+ -webkit-font-smoothing: antialiased;
11
+ -moz-osx-font-smoothing: grayscale;
12
+ }
13
+
14
+ code {
15
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
16
+ }
17
+
18
+ @keyframes fade-in {
19
+ from {
20
+ opacity: 0;
21
+ transform: translateY(10px);
22
+ }
23
+ to {
24
+ opacity: 1;
25
+ transform: translateY(0);
26
+ }
27
+ }
28
+
29
+ .animate-fade-in {
30
+ animation: fade-in 0.3s ease-out;
31
+ }
32
+
@@ -0,0 +1,11 @@
1
+ import React from 'react'
2
+ import ReactDOM from 'react-dom/client'
3
+ import App from './App.tsx'
4
+ import './index.css'
5
+
6
+ ReactDOM.createRoot(document.getElementById('root')!).render(
7
+ <React.StrictMode>
8
+ <App />
9
+ </React.StrictMode>,
10
+ )
11
+
@@ -0,0 +1,54 @@
1
+ export interface RouteParameter {
2
+ name: string;
3
+ in: 'path' | 'query' | 'body' | 'header';
4
+ type?: string;
5
+ required?: boolean;
6
+ description?: string;
7
+ inferredType?: string;
8
+ }
9
+
10
+ export interface RouteEndpoint {
11
+ id: string;
12
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
13
+ path: string;
14
+ group: string;
15
+ file: string;
16
+ line: number;
17
+ handler: {
18
+ name?: string;
19
+ isAsync: boolean;
20
+ parameters: string[];
21
+ };
22
+ parameters: RouteParameter[];
23
+ requestBody?: {
24
+ required: boolean;
25
+ fields: RouteParameter[];
26
+ };
27
+ response?: {
28
+ statusCode: number;
29
+ type?: string;
30
+ };
31
+ metadata?: {
32
+ tags?: string[];
33
+ summary?: string;
34
+ description?: string;
35
+ deprecated?: boolean;
36
+ title?: string;
37
+ aiGenerated?: boolean;
38
+ };
39
+ }
40
+
41
+ export interface APIInventory {
42
+ version: string;
43
+ generatedAt: string;
44
+ project: {
45
+ name?: string;
46
+ framework: 'express' | 'fastify' | 'unknown';
47
+ };
48
+ endpoints: RouteEndpoint[];
49
+ stats: {
50
+ totalEndpoints: number;
51
+ byMethod: Record<string, number>;
52
+ };
53
+ }
54
+
@@ -0,0 +1,13 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ export default {
3
+ darkMode: 'class',
4
+ content: [
5
+ "./index.html",
6
+ "./src/**/*.{js,ts,jsx,tsx}",
7
+ ],
8
+ theme: {
9
+ extend: {},
10
+ },
11
+ plugins: [],
12
+ }
13
+
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+ "moduleResolution": "bundler",
9
+ "allowImportingTsExtensions": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "noEmit": true,
13
+ "jsx": "react-jsx",
14
+ "strict": true,
15
+ "noUnusedLocals": true,
16
+ "noUnusedParameters": true,
17
+ "noFallthroughCasesInSwitch": true
18
+ },
19
+ "include": ["src"],
20
+ "references": [{ "path": "./tsconfig.node.json" }]
21
+ }
22
+
@@ -0,0 +1,11 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "skipLibCheck": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "allowSyntheticDefaultImports": true
8
+ },
9
+ "include": ["vite.config.ts"]
10
+ }
11
+
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ server: {
7
+ port: 5173,
8
+ open: true
9
+ }
10
+ })
11
+