@formant/aesthetics 0.0.0 → 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.
Files changed (2) hide show
  1. package/README.md +229 -9
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -1,21 +1,241 @@
1
- # Next.js template
1
+ # @formant/aesthetics
2
2
 
3
- This is a Next.js template with shadcn/ui.
3
+ Formant design system themed React components built on shadcn/ui, Radix, and Tailwind CSS v4.
4
4
 
5
- ## Adding components
5
+ [![npm version](https://badge.fury.io/js/@formant%2Faesthetics.svg)](https://www.npmjs.com/package/@formant/aesthetics)
6
6
 
7
- To add components to your app, run the following command:
7
+ ## Installation
8
8
 
9
9
  ```bash
10
- npx shadcn@latest add button
10
+ npm install @formant/aesthetics
11
11
  ```
12
12
 
13
- This will place the ui components in the `components` directory.
13
+ Peer dependencies required:
14
+ ```bash
15
+ npm install react react-dom tailwindcss@^4.0.0
16
+ ```
17
+
18
+ ## Minimal Example (Vite + React + Tailwind v4)
19
+
20
+ Here's the complete setup based on what we discovered building `formant-metaphysics`:
21
+
22
+ ### 1. `index.css`
23
+
24
+ ```css
25
+ @import "tailwindcss";
26
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500&display=swap');
27
+
28
+ /* CRITICAL: This tells Tailwind to scan the compiled library for classes.
29
+ Path is relative to this CSS file. */
30
+ @source "../../node_modules/@formant/aesthetics/dist/**/*.js";
31
+
32
+ @theme inline {
33
+ --font-heading: 'Space Grotesk', sans-serif;
34
+ --font-sans: 'Inter', sans-serif;
35
+ --font-mono: 'JetBrains Mono', monospace;
36
+ --color-background: var(--background);
37
+ --color-foreground: var(--foreground);
38
+ --color-card: var(--card);
39
+ --color-card-foreground: var(--card-foreground);
40
+ --color-primary: var(--primary);
41
+ --color-primary-foreground: var(--primary-foreground);
42
+ /* ... (see full theme in styles/globals.css) */
43
+ --radius-sm: calc(var(--radius) * 0.6);
44
+ --radius-md: calc(var(--radius) * 0.8);
45
+ --radius-lg: var(--radius);
46
+ }
47
+
48
+ :root {
49
+ /* Formant Dark Theme (Slate Mist) */
50
+ --background: #202428;
51
+ --foreground: #F2F3F4;
52
+ --card: #0A0F11;
53
+ --primary: #ACC3B3;
54
+ --primary-foreground: #0A0F11;
55
+ --muted: #202428;
56
+ --muted-foreground: #A3ABA9;
57
+ --border: rgba(163, 171, 169, 0.1);
58
+ --input: rgba(163, 171, 169, 0.2);
59
+ --ring: #ACC3B3;
60
+ --radius: 0.25rem;
61
+ }
62
+
63
+ @layer base {
64
+ * {
65
+ @apply border-border outline-ring/50;
66
+ }
67
+ body {
68
+ @apply bg-background text-foreground;
69
+ font-family: 'Inter', sans-serif;
70
+ }
71
+ h1, h2, h3, h4, h5, h6 {
72
+ font-family: 'Space Grotesk', sans-serif;
73
+ letter-spacing: -0.02em;
74
+ }
75
+ }
76
+ ```
77
+
78
+ ### 2. `App.tsx`
79
+
80
+ ```tsx
81
+ import { Button, Card, CardHeader, CardTitle, Badge } from "@formant/aesthetics";
82
+
83
+ function App() {
84
+ return (
85
+ <div className="min-h-screen bg-background text-foreground p-8">
86
+ <Card>
87
+ <CardHeader>
88
+ <CardTitle>Hello @formant/aesthetics</CardTitle>
89
+ <Badge>v0.0.0</Badge>
90
+ </CardHeader>
91
+ <div className="p-6 space-y-4">
92
+ <Button>Default</Button>
93
+ <Button variant="secondary">Secondary</Button>
94
+ <Button variant="destructive">Destructive</Button>
95
+ </div>
96
+ </Card>
97
+ </div>
98
+ );
99
+ }
14
100
 
15
- ## Using components
101
+ export default App;
102
+ ```
16
103
 
17
- To use the components in your app, import them as follows:
104
+ ### 3. `main.tsx`
18
105
 
19
106
  ```tsx
20
- import { Button } from "@/components/ui/button";
107
+ import { StrictMode } from 'react'
108
+ import { createRoot } from 'react-dom/client'
109
+ import './index.css'
110
+ import App from './App'
111
+
112
+ createRoot(document.getElementById('root')!).render(
113
+ <StrictMode>
114
+ <App />
115
+ </StrictMode>,
116
+ )
117
+ ```
118
+
119
+ ### Key Insights
120
+
121
+ 1. **`@source` path must be relative to the CSS file** — from `src/index.css`, go up 2 levels to `node_modules/`
122
+ 2. **Theme variables live in `:root`** — Tailwind needs them at build time to generate classes like `bg-background`
123
+ 3. **No runtime CSS injection needed** — the theme is baked into your CSS, components just use the variables
124
+
125
+ ## Alternative: Using the Canonical Theme
126
+
127
+ If you want the complete Formant theme without copying the CSS:
128
+
129
+ ```css
130
+ @import "tailwindcss";
131
+ @import "@formant/aesthetics/styles";
132
+
133
+ /* Customize specific variables */
134
+ @theme inline {
135
+ --color-primary: #your-color;
136
+ }
137
+ ```
138
+
139
+ ## Full Setup Reference
140
+
141
+ ### 1. Import components
142
+
143
+ ```tsx
144
+ import { Button, Card, CardHeader, CardTitle } from "@formant/aesthetics";
145
+
146
+ function App() {
147
+ return (
148
+ <Card>
149
+ <CardHeader>
150
+ <CardTitle>Hello Formant</CardTitle>
151
+ </CardHeader>
152
+ <Button>Click me</Button>
153
+ </Card>
154
+ );
155
+ }
21
156
  ```
157
+
158
+ ### 2. Configure Tailwind to scan the library
159
+
160
+ In your `index.css` (or `globals.css`):
161
+
162
+ ```css
163
+ @import "tailwindcss";
164
+
165
+ /* Tell Tailwind to scan the compiled library for classes */
166
+ @source "../../node_modules/@formant/aesthetics/dist/**/*.js";
167
+
168
+ /* Formant theme variables */
169
+ @theme inline {
170
+ --color-background: var(--background);
171
+ --color-foreground: var(--foreground);
172
+ --color-card: var(--card);
173
+ --color-primary: var(--primary);
174
+ /* ... other theme vars ... */
175
+ }
176
+
177
+ :root {
178
+ /* Formant Dark Theme (Slate Mist) */
179
+ --background: #202428;
180
+ --foreground: #F2F3F4;
181
+ --card: #0A0F11;
182
+ --primary: #ACC3B3;
183
+ /* ... etc ... */
184
+ }
185
+ ```
186
+
187
+ ### 3. Import the canonical theme (optional)
188
+
189
+ For the complete Formant theme including fonts and all CSS variables:
190
+
191
+ ```css
192
+ @import "@formant/aesthetics/styles";
193
+ ```
194
+
195
+ Then customize as needed:
196
+
197
+ ```css
198
+ @import "@formant/aesthetics/styles";
199
+
200
+ @theme inline {
201
+ /* Override specific variables */
202
+ --color-primary: #your-color;
203
+ }
204
+ ```
205
+
206
+ ## What's included
207
+
208
+ - **40+ shadcn/ui components** — Accordion, Alert, Badge, Button, Card, Dialog, Dropdown, Form, Input, Select, Table, Tabs, Toast, etc.
209
+ - **Formant brand components** — `FormantLogo`, `FormantLogoWithText`
210
+ - **Theme provider** — `ThemeProvider` from next-themes (dark/light mode with keyboard shortcut)
211
+ - **Charts** — Recharts components (BarChart, LineChart, PieChart, etc.)
212
+ - **Utilities** — `cn()` for class merging
213
+
214
+ ## Development
215
+
216
+ ```bash
217
+ # Install dependencies
218
+ npm install
219
+
220
+ # Build the library
221
+ npm run build
222
+
223
+ # Watch mode for development
224
+ npm run dev
225
+
226
+ # Type check
227
+ npm run typecheck
228
+ ```
229
+
230
+ ## Architecture
231
+
232
+ - **Source**: TypeScript React components in `components/`
233
+ - **Build**: tsup compiles to `dist/index.js` + `dist/index.d.ts`
234
+ - **Styling**: Tailwind CSS v4 with CSS variables for theming
235
+ - **Distribution**: Published to npm as `@formant/aesthetics`
236
+
237
+ The compiled JavaScript preserves all Tailwind class names as strings, allowing consuming projects to scan them and generate only the CSS they need.
238
+
239
+ ## License
240
+
241
+ MIT
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@formant/aesthetics",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "type": "module",
5
5
  "description": "Formant design system — themed React components built on shadcn/ui, Radix, and Tailwind CSS v4",
6
6
  "license": "MIT",
7
+ "private": false,
7
8
  "repository": {
8
9
  "type": "git",
9
10
  "url": "https://github.com/FormantIO/aesthetics.git"