@opencosmos/ui 1.3.1 → 1.3.3
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/.claude/CLAUDE.md +47 -47
- package/README.md +21 -21
- package/dist/{hooks-CKW8vE9H.d.ts → hooks-CFPKFXhH.d.ts} +1 -1
- package/dist/{hooks-1b8WaQf1.d.mts → hooks-CeAuZ0i5.d.mts} +1 -1
- package/dist/hooks.d.mts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.d.mts +78 -11
- package/dist/index.d.ts +78 -11
- package/dist/index.js +585 -342
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +548 -312
- package/dist/index.mjs.map +1 -1
- package/dist/{providers-CXPDMsl7.d.mts → providers-CzKisd2T.d.mts} +1 -1
- package/dist/{providers-Dn_Msjvz.d.ts → providers-D39-kwai.d.ts} +1 -1
- package/dist/providers.d.mts +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js.map +1 -1
- package/dist/providers.mjs.map +1 -1
- package/dist/tokens.js.map +1 -1
- package/dist/{utils-Cs04sxth.d.mts → utils-CkatYLG4.d.mts} +1 -1
- package/dist/{utils-CIIM7dAC.d.ts → utils-Y1Zi7biA.d.ts} +1 -1
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs.map +1 -1
- package/package.json +257 -257
- package/src/component-registry.ts +4 -4
- package/src/components/data-display/CollapsibleCodeBlock.tsx +1 -1
- package/src/components/data-display/OpenCosmosIcon.tsx +39 -0
- package/src/components/data-display/index.ts +1 -0
- package/src/components/layout/AppSidebar.tsx +277 -0
- package/src/components/layout/CustomizerPanel.tsx +2 -2
- package/src/components/layout/index.ts +1 -0
- package/src/hooks/useTheme.ts +1 -1
- package/src/hooks.ts +1 -1
- package/src/index.ts +6 -4
- package/src/lib/store/customizer.ts +1 -1
- package/src/lib/store/theme.ts +1 -1
- package/src/lib/syntax-parser/index.ts +1 -1
- package/src/providers/ThemeProvider.tsx +2 -2
- package/src/providers.ts +1 -1
- package/src/tokens.ts +3 -3
- package/src/utils.ts +1 -1
package/.claude/CLAUDE.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @opencosmos/ui — AI Context
|
|
2
2
|
|
|
3
3
|
> 100 accessible React components | Radix UI + Tailwind CSS | 3 themes | TypeScript strict mode | MIT
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
pnpm add @
|
|
8
|
+
pnpm add @opencosmos/ui
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Provider Hierarchy (Required)
|
|
@@ -13,9 +13,9 @@ pnpm add @thesage/ui
|
|
|
13
13
|
Wrap your app root in this exact order:
|
|
14
14
|
|
|
15
15
|
```tsx
|
|
16
|
-
import { ThemeProvider, TooltipProvider } from '@
|
|
17
|
-
import { Toaster } from '@
|
|
18
|
-
import '@
|
|
16
|
+
import { ThemeProvider, TooltipProvider } from '@opencosmos/ui/providers'
|
|
17
|
+
import { Toaster } from '@opencosmos/ui'
|
|
18
|
+
import '@opencosmos/ui/globals.css'
|
|
19
19
|
|
|
20
20
|
export default function RootLayout({ children }) {
|
|
21
21
|
return (
|
|
@@ -33,19 +33,19 @@ export default function RootLayout({ children }) {
|
|
|
33
33
|
|
|
34
34
|
```tsx
|
|
35
35
|
// Main exports (most common)
|
|
36
|
-
import { Button, Card, Input, Dialog, Badge } from '@
|
|
36
|
+
import { Button, Card, Input, Dialog, Badge } from '@opencosmos/ui'
|
|
37
37
|
|
|
38
38
|
// Subpath exports
|
|
39
|
-
import { useMotionPreference, useTheme } from '@
|
|
40
|
-
import { ThemeProvider, TooltipProvider } from '@
|
|
41
|
-
import { cn } from '@
|
|
42
|
-
import { spacing, typography } from '@
|
|
39
|
+
import { useMotionPreference, useTheme } from '@opencosmos/ui/hooks'
|
|
40
|
+
import { ThemeProvider, TooltipProvider } from '@opencosmos/ui/providers'
|
|
41
|
+
import { cn } from '@opencosmos/ui/utils'
|
|
42
|
+
import { spacing, typography } from '@opencosmos/ui/tokens'
|
|
43
43
|
|
|
44
44
|
// Heavy/optional features (require peer dependencies)
|
|
45
|
-
import { Form, FormField, FormItem } from '@
|
|
46
|
-
import { Calendar, DatePicker } from '@
|
|
47
|
-
import { DataTable } from '@
|
|
48
|
-
import { DragDrop } from '@
|
|
45
|
+
import { Form, FormField, FormItem } from '@opencosmos/ui/forms' // react-hook-form + zod
|
|
46
|
+
import { Calendar, DatePicker } from '@opencosmos/ui/dates' // date-fns + react-day-picker
|
|
47
|
+
import { DataTable } from '@opencosmos/ui/tables' // @tanstack/react-table
|
|
48
|
+
import { DragDrop } from '@opencosmos/ui/dnd' // @dnd-kit/*
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
## Themes
|
|
@@ -56,7 +56,7 @@ Three themes, each with light and dark modes:
|
|
|
56
56
|
- **Volt** — Bold, electric, cyberpunk neon
|
|
57
57
|
|
|
58
58
|
```tsx
|
|
59
|
-
import { useTheme } from '@
|
|
59
|
+
import { useTheme } from '@opencosmos/ui/hooks'
|
|
60
60
|
const { theme, setTheme, mode, setMode } = useTheme()
|
|
61
61
|
setTheme('volt')
|
|
62
62
|
setMode('dark')
|
|
@@ -67,13 +67,13 @@ setMode('dark')
|
|
|
67
67
|
- Use CSS variables: `bg-background`, `text-foreground`, `border-border`
|
|
68
68
|
- NEVER hardcode colors: no `bg-white`, `text-black`, `bg-neutral-100`
|
|
69
69
|
- All components accept `className` for Tailwind overrides
|
|
70
|
-
- Merge classes with `cn()`: `import { cn } from '@
|
|
70
|
+
- Merge classes with `cn()`: `import { cn } from '@opencosmos/ui/utils'`
|
|
71
71
|
|
|
72
72
|
## Motion
|
|
73
73
|
|
|
74
74
|
Every animation MUST respect user preferences:
|
|
75
75
|
```tsx
|
|
76
|
-
import { useMotionPreference } from '@
|
|
76
|
+
import { useMotionPreference } from '@opencosmos/ui/hooks'
|
|
77
77
|
const { shouldAnimate, scale } = useMotionPreference()
|
|
78
78
|
```
|
|
79
79
|
|
|
@@ -81,14 +81,14 @@ const { shouldAnimate, scale } = useMotionPreference()
|
|
|
81
81
|
|
|
82
82
|
| Category | Count | Import | Examples |
|
|
83
83
|
|----------|-------|--------|----------|
|
|
84
|
-
| Actions | 5 | `@
|
|
85
|
-
| Forms | 18 | `@
|
|
86
|
-
| Navigation | 7 | `@
|
|
87
|
-
| Overlays | 8 | `@
|
|
88
|
-
| Feedback | 6 | `@
|
|
89
|
-
| Data Display | 14 | `@
|
|
90
|
-
| Layout | 8 | `@
|
|
91
|
-
| Features | 3 | `@
|
|
84
|
+
| Actions | 5 | `@opencosmos/ui` | Button, Toggle, ToggleGroup, Link, Magnetic |
|
|
85
|
+
| Forms | 18 | `@opencosmos/ui` | Input, Textarea, Select, Checkbox, Switch, Slider, Combobox, RadioGroup, Label, SearchBar |
|
|
86
|
+
| Navigation | 7 | `@opencosmos/ui` | Tabs, Breadcrumb, Pagination, NavigationMenu, Menubar, Command |
|
|
87
|
+
| Overlays | 8 | `@opencosmos/ui` | Dialog, AlertDialog, Popover, Tooltip, HoverCard, ContextMenu, DropdownMenu, Drawer |
|
|
88
|
+
| Feedback | 6 | `@opencosmos/ui` | Alert, Toaster/toast, Progress, Skeleton, Spinner |
|
|
89
|
+
| Data Display | 14 | `@opencosmos/ui` | Card, Badge, Avatar, Table, Carousel, AspectRatio, Collapsible, CodeBlock |
|
|
90
|
+
| Layout | 8 | `@opencosmos/ui` | Accordion, Separator, ScrollArea, ResizablePanel, Sheet |
|
|
91
|
+
| Features | 3 | `@opencosmos/ui` | CustomizerPanel, ThemeSwitcher |
|
|
92
92
|
|
|
93
93
|
## High-Frequency Component Quick Reference
|
|
94
94
|
|
|
@@ -163,7 +163,7 @@ const { shouldAnimate, scale } = useMotionPreference()
|
|
|
163
163
|
|
|
164
164
|
### Form (react-hook-form integration)
|
|
165
165
|
```tsx
|
|
166
|
-
import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage } from '@
|
|
166
|
+
import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage } from '@opencosmos/ui/forms'
|
|
167
167
|
|
|
168
168
|
<Form {...form}>
|
|
169
169
|
<FormField control={form.control} name="email" render={({ field }) => (
|
|
@@ -180,16 +180,16 @@ import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage } from '
|
|
|
180
180
|
|
|
181
181
|
| Entrypoint | Size | Peer Deps Required |
|
|
182
182
|
|------------|------|--------------------|
|
|
183
|
-
| `@
|
|
184
|
-
| `@
|
|
185
|
-
| `@
|
|
186
|
-
| `@
|
|
187
|
-
| `@
|
|
188
|
-
| `@
|
|
189
|
-
| `@
|
|
190
|
-
| `@
|
|
191
|
-
| `@
|
|
192
|
-
| `@
|
|
183
|
+
| `@opencosmos/ui` (core) | 146 KB | None |
|
|
184
|
+
| `@opencosmos/ui/dates` | 29 KB | date-fns, react-day-picker |
|
|
185
|
+
| `@opencosmos/ui/tokens` | 11 KB | None |
|
|
186
|
+
| `@opencosmos/ui/utils` | 10 KB | None |
|
|
187
|
+
| `@opencosmos/ui/forms` | 9 KB | react-hook-form, zod |
|
|
188
|
+
| `@opencosmos/ui/tables` | 8 KB | @tanstack/react-table |
|
|
189
|
+
| `@opencosmos/ui/dnd` | 8 KB | @dnd-kit/* |
|
|
190
|
+
| `@opencosmos/ui/providers` | 8 KB | None |
|
|
191
|
+
| `@opencosmos/ui/hooks` | 6 KB | None |
|
|
192
|
+
| `@opencosmos/ui/webgl` | 1 KB | framer-motion |
|
|
193
193
|
|
|
194
194
|
`sideEffects: false` enables tree-shaking. Heavy features isolated behind subpath exports.
|
|
195
195
|
|
|
@@ -214,26 +214,26 @@ For gaps SDE doesn't cover, these libraries integrate well:
|
|
|
214
214
|
## Eject (Full Customization)
|
|
215
215
|
|
|
216
216
|
```bash
|
|
217
|
-
npx @
|
|
218
|
-
npx @
|
|
219
|
-
npx @
|
|
217
|
+
npx @opencosmos/ui eject Button # copies to src/components/ui/Button.tsx
|
|
218
|
+
npx @opencosmos/ui eject Dialog --dir my/dir # custom target
|
|
219
|
+
npx @opencosmos/ui eject --list # list all components
|
|
220
220
|
```
|
|
221
221
|
|
|
222
222
|
Imports are automatically rewritten:
|
|
223
223
|
- `../../lib/utils` → `./utils` (auto-scaffolded)
|
|
224
|
-
- `../../hooks/*` → `@
|
|
225
|
-
- `../category/*` → `@
|
|
224
|
+
- `../../hooks/*` → `@opencosmos/ui/hooks`
|
|
225
|
+
- `../category/*` → `@opencosmos/ui`
|
|
226
226
|
|
|
227
|
-
Ejected components keep working with SDE themes and CSS variables. Also available via MCP tool `eject_component` and web UI at
|
|
227
|
+
Ejected components keep working with SDE themes and CSS variables. Also available via MCP tool `eject_component` and web UI at opencosmos.ai/studio.
|
|
228
228
|
|
|
229
229
|
## Full API Reference
|
|
230
230
|
|
|
231
231
|
For complete props, variants, and examples for all 100 components:
|
|
232
|
-
- Web: https://
|
|
233
|
-
- MCP Server: `npx @
|
|
232
|
+
- Web: https://opencosmos.ai/studio/llms-full.txt
|
|
233
|
+
- MCP Server: `npx @opencosmos/mcp` (tools: list_components, search_components, get_component)
|
|
234
234
|
|
|
235
235
|
## Resources
|
|
236
236
|
|
|
237
|
-
- Docs: https://
|
|
238
|
-
- GitHub: https://github.com/shalomormsby/
|
|
239
|
-
- NPM: https://www.npmjs.com/package/@
|
|
237
|
+
- Docs: https://opencosmos.ai/studio/docs
|
|
238
|
+
- GitHub: https://github.com/shalomormsby/opencosmos-ui
|
|
239
|
+
- NPM: https://www.npmjs.com/package/@opencosmos/ui
|
package/README.md
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OpenCosmos UI (@opencosmos/ui)
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@opencosmos/ui)
|
|
6
|
+
[](https://github.com/shalomormsby/opencosmos-ui/blob/main/LICENSE)
|
|
7
|
+
[](https://www.npmjs.com/package/@opencosmos/ui)
|
|
8
8
|
|
|
9
9
|
**Sage — Make it Lovable.**
|
|
10
10
|
|
|
11
11
|
Components that feel alive. Themes with real personality. Motion your users control. Designed for humans. Fluent with AI.
|
|
12
12
|
|
|
13
|
-
[Documentation](https://
|
|
13
|
+
[Documentation](https://opencosmos.ai/studio) | [Components](https://opencosmos.ai/studio/components) | [GitHub](https://github.com/shalomormsby/opencosmos-ui)
|
|
14
14
|
|
|
15
15
|
</div>
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
-
**
|
|
19
|
+
**OpenCosmos UI** is a component library and design system built on **Radix UI** primitives and **Tailwind CSS**. 100 accessible components across 11 functional categories, three distinct themes with runtime switching, and a user-controlled motion system — all wired through a 4-layer design token architecture.
|
|
20
20
|
|
|
21
21
|
## Features
|
|
22
22
|
|
|
@@ -30,7 +30,7 @@ Components that feel alive. Themes with real personality. Motion your users cont
|
|
|
30
30
|
## Installation
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
pnpm add @
|
|
33
|
+
pnpm add @opencosmos/ui
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
Sage requires **Tailwind CSS** as a styling engine:
|
|
@@ -64,7 +64,7 @@ pnpm add @dnd-kit/core @dnd-kit/sortable @dnd-kit/utilities
|
|
|
64
64
|
module.exports = {
|
|
65
65
|
content: [
|
|
66
66
|
"./src/**/*.{ts,tsx}",
|
|
67
|
-
"./node_modules/@
|
|
67
|
+
"./node_modules/@opencosmos/ui/dist/**/*.{js,ts,jsx,tsx}"
|
|
68
68
|
],
|
|
69
69
|
}
|
|
70
70
|
```
|
|
@@ -72,13 +72,13 @@ module.exports = {
|
|
|
72
72
|
### Import styles
|
|
73
73
|
|
|
74
74
|
```tsx
|
|
75
|
-
import '@
|
|
75
|
+
import '@opencosmos/ui/globals.css';
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
## Usage
|
|
79
79
|
|
|
80
80
|
```tsx
|
|
81
|
-
import { Button, Card, ThemeProvider } from '@
|
|
81
|
+
import { Button, Card, ThemeProvider } from '@opencosmos/ui';
|
|
82
82
|
|
|
83
83
|
export default function App() {
|
|
84
84
|
return (
|
|
@@ -101,15 +101,15 @@ export default function App() {
|
|
|
101
101
|
### Subpath imports
|
|
102
102
|
|
|
103
103
|
```tsx
|
|
104
|
-
import { useMotionPreference, useTheme } from '@
|
|
105
|
-
import { ThemeProvider } from '@
|
|
106
|
-
import { cn } from '@
|
|
104
|
+
import { useMotionPreference, useTheme } from '@opencosmos/ui/hooks'
|
|
105
|
+
import { ThemeProvider } from '@opencosmos/ui/providers'
|
|
106
|
+
import { cn } from '@opencosmos/ui/utils'
|
|
107
107
|
|
|
108
108
|
// Optional feature imports
|
|
109
|
-
import { Form, FormField } from '@
|
|
110
|
-
import { DatePicker } from '@
|
|
111
|
-
import { DataTable } from '@
|
|
112
|
-
import { SortableList } from '@
|
|
109
|
+
import { Form, FormField } from '@opencosmos/ui/forms'
|
|
110
|
+
import { DatePicker } from '@opencosmos/ui/dates'
|
|
111
|
+
import { DataTable } from '@opencosmos/ui/tables'
|
|
112
|
+
import { SortableList } from '@opencosmos/ui/dnd'
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
## Component categories
|
|
@@ -130,14 +130,14 @@ import { SortableList } from '@thesage/ui/dnd'
|
|
|
130
130
|
Need to deeply customize a component? Eject it into your project for full ownership:
|
|
131
131
|
|
|
132
132
|
```bash
|
|
133
|
-
npx @
|
|
134
|
-
npx @
|
|
135
|
-
npx @
|
|
133
|
+
npx @opencosmos/ui eject Button
|
|
134
|
+
npx @opencosmos/ui eject Dialog --dir components/sage
|
|
135
|
+
npx @opencosmos/ui eject --list # see all available components
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
This copies the component source into your project with imports automatically rewritten. The ejected component still works with Sage themes and CSS variables — you just own the code now.
|
|
139
139
|
|
|
140
|
-
You can also eject from [
|
|
140
|
+
You can also eject from [opencosmos.ai/studio](https://opencosmos.ai/studio) — every component page has an **Eject** button that lets you copy or download the source directly.
|
|
141
141
|
|
|
142
142
|
## Bundle size
|
|
143
143
|
|
|
@@ -208,7 +208,7 @@ declare function useForm<T extends Record<string, any>>({ initialValues, validat
|
|
|
208
208
|
|
|
209
209
|
/**
|
|
210
210
|
* Hooks subpath export
|
|
211
|
-
* Allows: import { ... } from '@
|
|
211
|
+
* Allows: import { ... } from '@opencosmos/ui/hooks'
|
|
212
212
|
*/
|
|
213
213
|
|
|
214
214
|
type hooks_MotionPreference = MotionPreference;
|
|
@@ -208,7 +208,7 @@ declare function useForm<T extends Record<string, any>>({ initialValues, validat
|
|
|
208
208
|
|
|
209
209
|
/**
|
|
210
210
|
* Hooks subpath export
|
|
211
|
-
* Allows: import { ... } from '@
|
|
211
|
+
* Allows: import { ... } from '@opencosmos/ui/hooks'
|
|
212
212
|
*/
|
|
213
213
|
|
|
214
214
|
type hooks_MotionPreference = MotionPreference;
|
package/dist/hooks.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { M as MotionPreference, T as ThemeHook, U as UseFormOptions, a as UseFormReturn, u as useForm, b as useMotionPreference, c as useTheme } from './hooks-
|
|
1
|
+
export { M as MotionPreference, T as ThemeHook, U as UseFormOptions, a as UseFormReturn, u as useForm, b as useMotionPreference, c as useTheme } from './hooks-CeAuZ0i5.mjs';
|
|
2
2
|
import './index-DscTIrZ2.mjs';
|
|
3
3
|
import './validation-Bj1ye-v_.mjs';
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { M as MotionPreference, T as ThemeHook, U as UseFormOptions, a as UseFormReturn, u as useForm, b as useMotionPreference, c as useTheme } from './hooks-
|
|
1
|
+
export { M as MotionPreference, T as ThemeHook, U as UseFormOptions, a as UseFormReturn, u as useForm, b as useMotionPreference, c as useTheme } from './hooks-CFPKFXhH.js';
|
|
2
2
|
import './index-DscTIrZ2.js';
|
|
3
3
|
import './validation-Bj1ye-v_.js';
|