@webjsdev/ui 0.3.9 → 0.3.11
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 +21 -13
- package/package.json +3 -3
- package/packages/registry/README.md +14 -10
- package/packages/registry/components/accordion.ts +18 -0
- package/packages/registry/components/alert-dialog.ts +203 -22
- package/packages/registry/components/aspect-ratio.ts +12 -0
- package/packages/registry/components/card.ts +20 -1
- package/packages/registry/components/checkbox.ts +45 -3
- package/packages/registry/components/collapsible.ts +15 -0
- package/packages/registry/components/dialog.ts +205 -22
- package/packages/registry/components/dropdown-menu.ts +390 -22
- package/packages/registry/components/hover-card.ts +162 -4
- package/packages/registry/components/input.ts +34 -2
- package/packages/registry/components/kbd.ts +35 -2
- package/packages/registry/components/label.ts +21 -0
- package/packages/registry/components/native-select.ts +28 -7
- package/packages/registry/components/popover.ts +43 -7
- package/packages/registry/components/radio-group.ts +37 -9
- package/packages/registry/components/sonner.ts +53 -5
- package/packages/registry/components/switch.ts +23 -1
- package/packages/registry/components/tabs.ts +29 -2
- package/packages/registry/components/textarea.ts +21 -2
- package/packages/registry/components/toggle-group.ts +81 -8
- package/packages/registry/components/toggle.ts +82 -3
- package/packages/registry/components/tooltip.ts +57 -0
- package/packages/registry/lib/utils.ts +178 -13
- package/packages/registry/registry.json +1 -1
- package/packages/registry/themes/base-colors.js +1 -1
- package/packages/registry/themes/index.css +11 -0
- package/src/commands/add.js +50 -0
- package/src/commands/info.js +1 -4
- package/src/commands/init.js +126 -24
- package/src/registry/extract.js +1 -7
- package/src/registry/fetcher.js +9 -1
- package/src/registry/local.js +1 -1
- package/src/utils/index.js +0 -1
- package/src/utils/detect-project.js +0 -63
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Detect the host project type so we can pick sensible defaults for paths.
|
|
6
|
-
*
|
|
7
|
-
* @param {string} cwd
|
|
8
|
-
* @returns {{ type: 'webjs' | 'next' | 'vite' | 'astro' | 'plain', meta: any }}
|
|
9
|
-
*/
|
|
10
|
-
export function detectProject(cwd = process.cwd()) {
|
|
11
|
-
const pkgPath = join(cwd, 'package.json');
|
|
12
|
-
if (!existsSync(pkgPath)) return { type: 'plain', meta: {} };
|
|
13
|
-
|
|
14
|
-
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
15
|
-
const deps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };
|
|
16
|
-
|
|
17
|
-
if (deps['@webjsdev/server'] || deps['@webjsdev/cli'] || existsSync(join(cwd, 'app', 'layout.ts')) || existsSync(join(cwd, 'app', 'layout.js'))) {
|
|
18
|
-
return { type: 'webjs', meta: { pkg } };
|
|
19
|
-
}
|
|
20
|
-
if (deps['next']) return { type: 'next', meta: { pkg } };
|
|
21
|
-
if (deps['vite'] || deps['@vitejs/plugin-react'] || deps['@vitejs/plugin-vue']) return { type: 'vite', meta: { pkg } };
|
|
22
|
-
if (deps['astro']) return { type: 'astro', meta: { pkg } };
|
|
23
|
-
|
|
24
|
-
return { type: 'plain', meta: { pkg } };
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Pick default `aliases` + `tailwind.css` path based on the detected project.
|
|
29
|
-
*
|
|
30
|
-
* @param {string} cwd
|
|
31
|
-
*/
|
|
32
|
-
export function defaultsForProject(cwd = process.cwd()) {
|
|
33
|
-
const { type } = detectProject(cwd);
|
|
34
|
-
switch (type) {
|
|
35
|
-
case 'webjs':
|
|
36
|
-
return {
|
|
37
|
-
// styles/globals.css, NOT app/globals.css: in webjs, app/ is routing-only,
|
|
38
|
-
// so a non-routing stylesheet lives outside it.
|
|
39
|
-
tailwindCss: 'styles/globals.css',
|
|
40
|
-
aliases: { components: 'components', utils: 'lib/utils', ui: 'components/ui', lib: 'lib' },
|
|
41
|
-
};
|
|
42
|
-
case 'next':
|
|
43
|
-
return {
|
|
44
|
-
tailwindCss: 'app/globals.css',
|
|
45
|
-
aliases: { components: '@/components', utils: '@/lib/utils', ui: '@/components/ui', lib: '@/lib' },
|
|
46
|
-
};
|
|
47
|
-
case 'vite':
|
|
48
|
-
return {
|
|
49
|
-
tailwindCss: 'src/index.css',
|
|
50
|
-
aliases: { components: 'src/components', utils: 'src/lib/utils', ui: 'src/components/ui', lib: 'src/lib' },
|
|
51
|
-
};
|
|
52
|
-
case 'astro':
|
|
53
|
-
return {
|
|
54
|
-
tailwindCss: 'src/styles/globals.css',
|
|
55
|
-
aliases: { components: 'src/components', utils: 'src/lib/utils', ui: 'src/components/ui', lib: 'src/lib' },
|
|
56
|
-
};
|
|
57
|
-
default:
|
|
58
|
-
return {
|
|
59
|
-
tailwindCss: 'styles/globals.css',
|
|
60
|
-
aliases: { components: 'components', utils: 'lib/utils', ui: 'components/ui', lib: 'lib' },
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|