Skip to content

Commit 42bd897

Browse files
committed
Initialize solidcn project with core files, including package.json, README, and configuration for TypeScript and Biome. Add .gitignore, CI/CD workflows, and setup for documentation and CLI. Implement basic structure for SolidJS components and registry system.
0 parents  commit 42bd897

228 files changed

Lines changed: 22913 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/settings.local.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(pnpm test:*)",
5+
"Bash(pnpm run typecheck:*)",
6+
"Bash(pnpm -r typecheck:*)",
7+
"Bash(pnpm build:*)",
8+
"Bash(pnpm -r build:*)",
9+
"Bash(pnpm install:*)",
10+
"Bash(pnpm exec:*)",
11+
"Bash(npx biome:*)",
12+
"Bash(ls:*)",
13+
"Bash(cat:*)",
14+
"WebSearch",
15+
"WebFetch(domain:github.com)"
16+
],
17+
"deny": []
18+
}
19+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
description: Docs site UI — Phase 7/8 shadcn/ui parity (layout, CodeBlock, typography)
3+
globs: apps/docs/**/*
4+
alwaysApply: false
5+
---
6+
7+
# Docs UI — shadcn/ui parity (solidcn)
8+
9+
## Theme
10+
11+
- **Default: light** — `:root` uses white background, dark foreground, subtle `border-border`.
12+
- **Dark:** `dark` class on `<html>` (see `apps/docs/src/lib/theme.ts`).
13+
- Font: **Inter** (linked in `entry-server.tsx`), `antialiased` on `body`.
14+
15+
## Layout (`apps/docs/src/components/layout/`)
16+
17+
- **Header:** `h-14`, `border-b border-border`, `bg-background/95`, backdrop blur. Only one top-nav item is “active” — check order: Components → Registry → CLI → Docs (Docs is **not** active on `/docs/cli` or `/docs/components/*`).
18+
- **Desktop sidebar:** `w-[220px]` / `xl:w-[240px]`, `border-r`, group titles `uppercase tracking-widest text-[11px]`, active item `bg-muted font-medium`.
19+
- **Mobile:** drawer + overlay; menu state in `app.tsx` (not in `DocLayout`).
20+
- **DocLayout:** `max-w-screen-2xl` wrapper, **no** duplicate `MobileSidebar`. Main: `article.docs-prose` + right TOC (`xl`+), **`xl:gap-16`** between columns.
21+
- **DocPage:** optional `docPath` → **`DocsSeo`** (title, description, OG, canonical via `lib/site.ts`), **Copy page** (markdown export), **`DocPager`** (prev/next from `getDocNeighbors` / sidebar order). Optional **`playground`** = StackBlitz iframe.
22+
- **404:** `routes/[...404].tsx` + prerender `/404` in `app.config.ts`.
23+
- **TableOfContents:** label **“On this page”**, nav with `border-l` + active indicator `border-foreground`. Active section uses **scroll spy** (`getBoundingClientRect().top <= headerOffset`), not `IntersectionObserver` alone — so at the bottom of the page the last item (e.g. **API Reference**) stays highlighted instead of sticking on **Sizes**.
24+
25+
## CodeBlock (`components/ui/CodeBlock.tsx`)
26+
27+
- **Shiki** follows docs theme: `docsTheme()` → `github-light` / `github-dark` (use `createEffect`, not only `onMount`).
28+
- **`variant="card"` (default):** bordered blocks in prose. **No `filename` (light):** `#f6f8fa`, **dark:** `zinc-950`. Do **not** use a global `.shiki { background: transparent }` on these — it breaks contrast.
29+
- **`variant="figure"`** (component demos): flat panel using **`--docs-code` / `--docs-code-foreground`** in `app.css`; root has `docs-code-figure` + **`pre.shiki { background: transparent !important }`** so one surface matches **ui.shadcn.com**. **Copy** = icon (`Copy` / `Check`), top-right. **`border-t`** separates preview from code.
30+
- **With `filename`:** header bar is theme-aware — **light:** `bg-muted/50` (card) or code surface (figure); **dark:** zinc bars. Copy text button in header row.
31+
32+
## Component demo
33+
34+
- `ComponentDemo` (shadcn order): **(1)** preview with bottom border → **(2)** **View code** / **Hide code** pill on the seam → **(3)** `CodeBlock variant="figure"`; collapsed: **`max-h-64`** (~shadcn `CodeCollapsibleWrapper`) + **bottom-only** fade (`linear-gradient` to `hsl(var(--docs-code))`, not a full-panel dark wash); expanded: full height. `ChevronDown` rotates when open. Outer card avoids `overflow-hidden` so the pill isn’t clipped.
35+
36+
## Content pages (prose)
37+
38+
- Main doc title: `text-4xl font-bold tracking-tight`.
39+
- Subsections: `text-xl font-semibold` (h2), `leading-7` on explanatory paragraphs.
40+
- Inline code: `rounded-md border border-border bg-muted px-1.5 py-0.5 font-mono text-xs` (or `text-[13px]` for short names).
41+
- **CLI** page: use **TOC** (`TocItem[]`) + `id` / `scroll-mt-24` on each block linked from the TOC.
42+
43+
## Global CSS (`app.css`)
44+
45+
- HSL tokens on `:root` and `.dark`.
46+
- `.docs-prose` utility — `max-width: 48rem`, `scroll-margin` for headings.
47+
48+
## Don’ts
49+
50+
- No emoji as icons in public docs UI — **lucide-solid** only.
51+
- Don’t hardcode dark zinc for normal code blocks in light mode (except dark filename bar in dark theme). **Home “Quick install”:** light = soft strip `#f6f8fa` + `bg-card` terminal; dark = `zinc-950` strip + `zinc-900` panel.

.cursor/rules/registry-and-cli.mdc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
description: Open registry JSON, CLI schemas, and docs public/r parity
3+
globs:
4+
- packages/cli/**/*
5+
- apps/docs/public/r/**/*
6+
- packages/cli/src/schema/**/*
7+
alwaysApply: false
8+
---
9+
10+
# Registry & CLI
11+
12+
## Schema source of truth
13+
14+
- `packages/cli/src/schema/json-schemas/registry.json`
15+
- `packages/cli/src/schema/json-schemas/registry-item.json`
16+
- `packages/cli/src/schema/json-schemas/config.json` (solidcn.json)
17+
18+
## Example hosted registry (docs site)
19+
20+
`apps/docs/public/r/` — `registry.json` and per-item `*.json` must stay **consistent**:
21+
22+
- Every entry in `registry.json` has a fetchable JSON file
23+
- Paths follow CLI / `solidcn add` conventions
24+
25+
## After changing core components
26+
27+
1. Update or regenerate registry items if needed (`pnpm registry:build` from root when using that workflow)
28+
2. Keep docs pages under `apps/docs/src/routes/docs/components/` and `apps/docs/src/lib/nav.ts` in sync
29+
30+
## CLI
31+
32+
- Do not hardcode absolute paths; use `cwd` / project config
33+
- Registry commands (build, create, add) must align with the schemas above

.cursor/rules/solidcn-monorepo.mdc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
description: solidcn monorepo — stack, packages, and where to edit
3+
globs: "**/*"
4+
alwaysApply: true
5+
---
6+
7+
# solidcn monorepo
8+
9+
A **[shadcn/ui](https://ui.shadcn.com)** port for **SolidJS** — copy-paste components, not a black-box library.
10+
11+
## Stack
12+
13+
- **SolidJS** + **SolidStart** (`apps/docs`)
14+
- **@kobalte/core** — headless accessible primitives
15+
- **corvu** — advanced primitives (Drawer, Resizable, etc.)
16+
- **Tailwind CSS v4** + **tailwind-variants**
17+
- **Biome** — lint + format (not Prettier)
18+
- **pnpm** workspaces
19+
20+
## Package map
21+
22+
| Path | Package | Notes |
23+
|------|---------|--------|
24+
| `packages/core` | `@solidcn/core` | UI components — build before running docs dev |
25+
| `packages/toast` | `@solidcn/toast` | Standard + Sileo toast |
26+
| `packages/themes` | `@solidcn/themes` | CSS vars, ThemeProvider |
27+
| `packages/cli` | `solidcn` | CLI: init, add, registry, mcp |
28+
| `packages/create-solidcn-app` | `create-solidcn-app` | `npm create solidcn-app` |
29+
| `packages/mcp-cloudflare` | `@solidcn/mcp-cloudflare` | HTTP MCP Worker |
30+
| `apps/docs` | `@solidcn/docs` | Documentation (SolidStart) |
31+
| `apps/storybook` | — | Visual stories |
32+
33+
## Before changing docs / Storybook
34+
35+
Build workspace packages that are imported:
36+
37+
```bash
38+
pnpm --filter @solidcn/core build
39+
pnpm --filter @solidcn/toast build
40+
pnpm --filter @solidcn/themes build
41+
```
42+
43+
## Conventions
44+
45+
- TypeScript **strict** + `exactOptionalPropertyTypes`
46+
- Use **Biome** for formatting; `biome.json` sets `semicolons: "always"`
47+
- UI icons: **lucide-solid**; avoid emoji in public docs UI
48+
- Solid: prefer `<Show>`, `<For>`; avoid React patterns (`dangerouslySetInnerHTML` — use Solid’s `innerHTML` prop when needed)
49+
50+
## Docs site (Phase 7/8)
51+
52+
- Follow **`docs-ui-shadcn-like.mdc`** (shadcn-like layout, CodeBlock + Shiki tied to `docsTheme`, TOC, typography).
53+
- `DocLayout` does not own the mobile sidebar — desktop `Sidebar` only; mobile menu state lives in `app.tsx`.

.github/workflows/ci.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, dev]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
ci:
15+
name: Build, Typecheck & Lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup pnpm
22+
uses: pnpm/action-setup@v4
23+
with:
24+
version: 9
25+
26+
- name: Setup Node
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 20
30+
cache: pnpm
31+
32+
- name: Install dependencies
33+
run: pnpm install --frozen-lockfile
34+
35+
- name: Typecheck
36+
run: pnpm typecheck
37+
38+
- name: Lint
39+
run: pnpm lint
40+
41+
- name: Build packages
42+
run: pnpm build
43+
44+
registry-validate:
45+
name: Validate Registry JSON
46+
runs-on: ubuntu-latest
47+
needs: ci
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Setup pnpm
53+
uses: pnpm/action-setup@v4
54+
with:
55+
version: 9
56+
57+
- name: Setup Node
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: 20
61+
cache: pnpm
62+
63+
- name: Install dependencies
64+
run: pnpm install --frozen-lockfile
65+
66+
- name: Build CLI
67+
run: pnpm --filter solidcn build
68+
69+
- name: Build registry
70+
run: pnpm --filter solidcn registry:build
71+
72+
- name: Validate registry
73+
run: |
74+
node -e "
75+
import('./packages/cli/dist/registry/validator.js').then(({ isValidRegistryIndex }) => {
76+
const fs = await import('fs');
77+
const registry = JSON.parse(fs.readFileSync('apps/docs/public/r/registry.json', 'utf-8'));
78+
if (!isValidRegistryIndex(registry)) {
79+
console.error('registry.json is invalid');
80+
process.exit(1);
81+
}
82+
console.log('registry.json is valid');
83+
});
84+
"

.github/workflows/deploy-docs.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy Docs to Cloudflare Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "apps/docs/**"
9+
- "packages/core/**"
10+
- "packages/toast/**"
11+
- "packages/themes/**"
12+
workflow_dispatch:
13+
14+
jobs:
15+
deploy:
16+
name: Deploy
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
deployments: write
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup pnpm
27+
uses: pnpm/action-setup@v4
28+
with:
29+
version: 9
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 20
35+
cache: pnpm
36+
37+
- name: Install dependencies
38+
run: pnpm install --frozen-lockfile
39+
40+
- name: Build packages
41+
run: |
42+
pnpm --filter @solidcn/core build
43+
pnpm --filter @solidcn/toast build
44+
pnpm --filter @solidcn/themes build
45+
46+
- name: Build docs
47+
run: pnpm --filter @solidcn/docs build
48+
env:
49+
VITE_STORYBOOK_URL: ${{ vars.STORYBOOK_URL || 'https://storybook.solidcn.nizarfadlan.dev' }}
50+
51+
- name: Deploy to Cloudflare Pages
52+
uses: cloudflare/wrangler-action@v3
53+
with:
54+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
55+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
56+
command: pages deploy apps/docs/.output/public --project-name=solidcn-docs

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
node_modules
2+
dist
3+
.turbo
4+
*.tsbuildinfo
5+
6+
# SolidStart
7+
apps/docs/.solid
8+
apps/docs/.output
9+
apps/docs/.vinxi
10+
11+
# Storybook
12+
apps/storybook/
13+
14+
# env
15+
.env
16+
.env.local
17+
.env.*.local
18+
19+
# OS
20+
.DS_Store
21+
Thumbs.db
22+
23+
# Editor
24+
.idea/
25+
26+
# Cursor — commit `.cursor/rules` (like shadcn/ui); ignore other local files
27+
.cursor/*
28+
!.cursor/rules/
29+
!.cursor/rules/**
30+
!.cursor/rules/

.vscode/settings.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"editor.defaultFormatter": "biomejs.biome",
3+
"editor.formatOnSave": true,
4+
"[javascript]": {
5+
"editor.defaultFormatter": "biomejs.biome"
6+
},
7+
"[javascriptreact]": {
8+
"editor.defaultFormatter": "biomejs.biome"
9+
},
10+
"[typescript]": {
11+
"editor.defaultFormatter": "biomejs.biome"
12+
},
13+
"[typescriptreact]": {
14+
"editor.defaultFormatter": "biomejs.biome"
15+
},
16+
"[json]": {
17+
"editor.defaultFormatter": "biomejs.biome"
18+
},
19+
"[jsonc]": {
20+
"editor.defaultFormatter": "biomejs.biome"
21+
},
22+
"typescript.format.enable": false,
23+
"javascript.format.enable": false,
24+
"prettier.enable": false,
25+
"editor.codeActionsOnSave": {
26+
"source.organizeImports.biome": "explicit",
27+
"quickfix.biome": "explicit"
28+
},
29+
"json.schemas": [
30+
{
31+
"fileMatch": ["biome.json"],
32+
"url": "https://biomejs.dev/schemas/1.9.4/schema.json"
33+
}
34+
]
35+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Nizar Izzuddin Yatim Fadlan
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)