moi-computer 0.11.0 → 0.11.1-next.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.
- package/client/AGENTS.md +2 -2
- package/client/components/ui/button.tsx +1 -53
- package/client/components/ui/collapsible.tsx +1 -15
- package/client/components/ui/dialog.tsx +1 -58
- package/client/components/ui/dropdown-menu.tsx +1 -254
- package/client/components/ui/hover-card.tsx +1 -44
- package/client/components/ui/input.tsx +1 -21
- package/client/components/ui/popover.tsx +1 -88
- package/client/components/ui/resizable.tsx +1 -40
- package/client/components/ui/skeleton.tsx +1 -13
- package/client/components/ui/slider.tsx +1 -70
- package/client/components/ui/spinner.tsx +1 -18
- package/client/components/ui/switch.tsx +1 -23
- package/client/components/ui/tabs.tsx +1 -0
- package/client/components/ui/textarea.tsx +1 -18
- package/client/components/ui/tooltip.tsx +1 -51
- package/client/features/chat/ChatPanel.tsx +6 -6
- package/client/features/chat/ChatPopup.tsx +3 -4
- package/client/features/chat/TurnView.tsx +5 -4
- package/client/features/chat/api.ts +5 -14
- package/client/features/chat/chat-frames.ts +5 -2
- package/client/features/chat/composer/ChatComposer.tsx +5 -1
- package/client/features/chat/composer/ModelPicker.tsx +4 -3
- package/client/features/chat/composer/banners/ErrorBanner.tsx +20 -12
- package/client/features/chat/composer/useWorkspaceComposerState.tsx +15 -7
- package/client/features/chat/group-turns.ts +11 -0
- package/client/features/chat/session-view.ts +53 -0
- package/client/features/chat/useChat.ts +5 -1
- package/client/features/dev/ChatStatesPage.tsx +3 -1
- package/client/features/dev/DevIndexPage.tsx +5 -0
- package/client/features/dev/DevRoutes.tsx +2 -0
- package/client/features/dev/HarnessDebugPage.tsx +1 -1
- package/client/features/dev/UiComponentPreviews.tsx +834 -0
- package/client/features/dev/UiComponentsPage.tsx +60 -0
- package/client/features/home/WorkspacePreview.tsx +1 -1
- package/client/features/home/workspace-setup/DemoDialog.tsx +3 -2
- package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +5 -8
- package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +7 -20
- package/client/features/settings/SettingsLayout.tsx +1 -1
- package/client/features/settings/WorkspaceSettings.tsx +4 -1
- package/client/features/views/ViewManager.tsx +14 -9
- package/client/features/widgets/WidgetFrame.tsx +1 -1
- package/client/features/widgets/Widgets.tsx +1 -3
- package/client/features/workspace/WorkspaceScreen.tsx +5 -1
- package/client/features/workspace/WorkspaceSplitLayout.tsx +6 -1
- package/client/features/workspace/api.ts +2 -4
- package/client/index.css +22 -29
- package/dist/{chunk-tny85yt2.js → chunk-4s15axjs.js} +2 -2
- package/dist/{chunk-c9pjqx9m.js → chunk-53a7pxcz.js} +1 -1
- package/dist/chunk-6664vxpk.css +1 -0
- package/dist/{chunk-104m57qw.js → chunk-87thzbtw.js} +2 -2
- package/dist/chunk-a6jad1a6.js +1 -0
- package/dist/chunk-dghwstd2.js +9 -0
- package/dist/chunk-eg120aca.js +1 -0
- package/dist/{chunk-v7wr1df4.js → chunk-j3wvxjr7.js} +1 -1
- package/dist/chunk-vwjeezeb.js +1 -0
- package/dist/chunk-w482ew2c.js +546 -0
- package/dist/chunk-yc471zah.js +70 -0
- package/dist/index.html +1 -1
- package/lib/format.ts +49 -1
- package/lib/themes.ts +6 -6
- package/lib/types.ts +5 -7
- package/package.json +17 -7
- package/registry.json +643 -0
- package/server/AGENTS.md +1 -0
- package/server/agent.ts +1 -1
- package/server/api.ts +25 -29
- package/server/applets.ts +30 -29
- package/server/bundler/applet-css.ts +6 -1
- package/server/bundler/build-applet.ts +5 -1
- package/server/bundler/build-worker.ts +178 -0
- package/server/cli-ui-components.ts +28 -33
- package/server/cli.ts +6 -11
- package/server/data-dir.ts +1 -1
- package/server/harness/README.md +13 -9
- package/server/harness/acp/NOTES.md +426 -0
- package/server/harness/acp/discovery.ts +27 -30
- package/server/harness/acp/model-state.ts +57 -0
- package/server/harness/acp/session.ts +18 -6
- package/server/harness/claude-code/NOTES.md +47 -12
- package/server/harness/claude-code/cli.ts +40 -0
- package/server/harness/claude-code/index.ts +11 -5
- package/server/harness/claude-code/models.ts +72 -19
- package/server/harness/claude-code/session.ts +408 -299
- package/server/harness/hermes/NOTES.md +18 -0
- package/server/harness/hermes/discovery.ts +20 -0
- package/server/harness/hermes/index.ts +9 -0
- package/server/harness/hermes/models.ts +28 -8
- package/server/harness/types.ts +4 -2
- package/server/moi-scaffold.ts +1 -1
- package/server/preview.ts +3 -1
- package/server/registry.ts +63 -41
- package/server/scratchpad-executor.ts +79 -56
- package/server/scratchpad-shape-defaults.ts +82 -0
- package/server/tldraw-package.d.ts +4 -0
- package/server/ui-components.ts +101 -434
- package/server/view-builders.ts +2 -1
- package/server/web.ts +9 -5
- package/server/workspace-env.ts +3 -2
- package/tsconfig.json +0 -1
- package/ui-components/accordion.tsx +71 -0
- package/ui-components/alert-dialog.tsx +165 -0
- package/ui-components/alert.tsx +68 -0
- package/ui-components/attachment.tsx +195 -0
- package/ui-components/avatar.tsx +90 -0
- package/ui-components/badge.tsx +49 -0
- package/ui-components/button-group.tsx +78 -0
- package/ui-components/button.tsx +55 -0
- package/ui-components/calendar.tsx +180 -0
- package/ui-components/card.tsx +84 -0
- package/ui-components/carousel.tsx +235 -0
- package/ui-components/chart.tsx +338 -0
- package/ui-components/checkbox.tsx +27 -0
- package/ui-components/collapsible.tsx +15 -0
- package/ui-components/combobox.tsx +265 -0
- package/ui-components/context-menu.tsx +244 -0
- package/ui-components/dialog.tsx +138 -0
- package/ui-components/docs/accordion.md +463 -0
- package/ui-components/docs/alert-dialog.md +481 -0
- package/ui-components/docs/alert.md +301 -0
- package/ui-components/docs/attachment.md +689 -0
- package/ui-components/docs/avatar.md +495 -0
- package/ui-components/docs/badge.md +258 -0
- package/ui-components/docs/button-group.md +879 -0
- package/ui-components/docs/button.md +26 -0
- package/ui-components/docs/calendar.md +862 -0
- package/ui-components/docs/card.md +265 -0
- package/ui-components/docs/carousel.md +627 -0
- package/ui-components/docs/chart.md +1256 -0
- package/ui-components/docs/checkbox.md +477 -0
- package/ui-components/docs/collapsible.md +446 -0
- package/ui-components/docs/combobox.md +1003 -0
- package/ui-components/docs/context-menu.md +860 -0
- package/ui-components/docs/data-table.md +1580 -0
- package/ui-components/docs/date-picker.md +614 -0
- package/ui-components/docs/dialog.md +414 -0
- package/ui-components/docs/drawer.md +51 -0
- package/ui-components/docs/dropdown-menu.md +1000 -0
- package/ui-components/docs/field.md +1192 -0
- package/ui-components/docs/hover-card.md +275 -0
- package/ui-components/docs/input-group.md +866 -0
- package/ui-components/docs/input.md +456 -0
- package/ui-components/docs/label.md +295 -0
- package/ui-components/docs/pagination.md +416 -0
- package/ui-components/docs/popover.md +348 -0
- package/ui-components/docs/progress.md +214 -0
- package/ui-components/docs/radio-group.md +389 -0
- package/ui-components/docs/resizable.md +265 -0
- package/ui-components/docs/select.md +616 -0
- package/ui-components/docs/separator.md +216 -0
- package/ui-components/docs/skeleton.md +205 -0
- package/ui-components/docs/slider.md +226 -0
- package/ui-components/docs/spinner.md +332 -0
- package/ui-components/docs/switch.md +236 -0
- package/ui-components/docs/table.md +551 -0
- package/ui-components/docs/tabs.md +379 -0
- package/ui-components/docs/textarea.md +187 -0
- package/ui-components/docs/toggle-group.md +370 -0
- package/ui-components/docs/toggle.md +91 -0
- package/ui-components/docs/tooltip.md +290 -0
- package/ui-components/drawer.tsx +213 -0
- package/ui-components/dropdown-menu.tsx +263 -0
- package/ui-components/field.tsx +224 -0
- package/ui-components/hover-card.tsx +46 -0
- package/ui-components/input-group.tsx +146 -0
- package/ui-components/input.tsx +20 -0
- package/ui-components/label.tsx +17 -0
- package/ui-components/pagination.tsx +124 -0
- package/ui-components/popover.tsx +81 -0
- package/ui-components/progress.tsx +63 -0
- package/ui-components/radio-group.tsx +37 -0
- package/ui-components/resizable.tsx +40 -0
- package/ui-components/scoped-portal.tsx +31 -0
- package/ui-components/select.tsx +195 -0
- package/ui-components/separator.tsx +18 -0
- package/ui-components/skeleton.tsx +15 -0
- package/ui-components/slider.tsx +75 -0
- package/ui-components/spinner.tsx +20 -0
- package/ui-components/switch.tsx +26 -0
- package/ui-components/table.tsx +86 -0
- package/ui-components/tabs.tsx +75 -0
- package/ui-components/textarea.tsx +17 -0
- package/ui-components/toggle-group.tsx +85 -0
- package/ui-components/toggle.tsx +42 -0
- package/ui-components/tooltip.tsx +61 -0
- package/ui-components/utils.ts +8 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +11 -20
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +4 -3
- package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +67 -203
- package/dist/chunk-59zf0m6n.js +0 -1
- package/dist/chunk-bj3akjs2.js +0 -1
- package/dist/chunk-j2w2vak4.js +0 -546
- package/dist/chunk-k2r9c95m.js +0 -10
- package/dist/chunk-kmbxhgwv.js +0 -1
- package/dist/chunk-p1yqa71k.js +0 -83
- package/dist/chunk-r5xrenjy.css +0 -1
|
@@ -1,214 +1,78 @@
|
|
|
1
|
-
# UI components
|
|
1
|
+
# UI components
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
relative imports, and overlays patched so applet styling survives portalling. Components land
|
|
6
|
-
in `.moi/ui/` as plain source files you own.
|
|
7
|
-
|
|
8
|
-
This file is the catalog plus the essential usage rules (condensed from the official shadcn
|
|
9
|
-
skill). Read it once; fetch full per-component docs with `moi ui-components docs <name>` **before
|
|
10
|
-
composing a component you haven't used in this workspace** — the parts API is Base UI, not the
|
|
11
|
-
Radix-era shadcn you may know.
|
|
3
|
+
Use bundled components for standard controls. They use Base UI, Tabler icons, and workspace
|
|
4
|
+
theme tokens. Follow [DESIGN.md](DESIGN.md) for visual decisions.
|
|
12
5
|
|
|
13
6
|
## Workflow
|
|
14
7
|
|
|
8
|
+
Run commands from the project root. Check what's available and installed, read the docs
|
|
9
|
+
before using or changing a component, then add all missing components in one call.
|
|
10
|
+
|
|
15
11
|
```sh
|
|
16
|
-
moi ui-components
|
|
17
|
-
moi ui-components
|
|
18
|
-
moi ui-components add
|
|
19
|
-
|
|
20
|
-
# component; --install runs the bun install too
|
|
21
|
-
moi ui-components docs select table # official docs as markdown
|
|
22
|
-
moi bundle # rebuild applets
|
|
12
|
+
moi ui-components # catalog and installed state
|
|
13
|
+
moi ui-components docs select date-picker # usage and examples
|
|
14
|
+
moi ui-components add select date-picker --install
|
|
15
|
+
moi bundle # rebuild after editing applets
|
|
23
16
|
```
|
|
24
17
|
|
|
18
|
+
`add` copies source and support files into `.moi/ui/`. `--install` runs `bun install` in `.moi/`
|
|
19
|
+
and may need network access. Without it, run the dependency command printed by `add`. Rebuilding
|
|
20
|
+
with `moi bundle` is always a separate step.
|
|
21
|
+
|
|
22
|
+
Recipes, ready-made component compositions, use the same `add` and `docs` commands. They install
|
|
23
|
+
their building blocks; follow the recipe docs to compose them.
|
|
24
|
+
|
|
25
|
+
## Imports
|
|
26
|
+
|
|
27
|
+
Use relative imports from applets and shared modules under `.moi/`:
|
|
28
|
+
|
|
25
29
|
```tsx
|
|
26
|
-
// In an applet — always relative, never @/ aliases, never the host app's components:
|
|
27
30
|
import { Button } from '../ui/button'
|
|
28
|
-
import {
|
|
31
|
+
import { cn } from '../ui/utils'
|
|
32
|
+
import { IconSearch } from '@tabler/icons-react'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Adapt aliases in examples to relative imports. Applets cannot use `@/` aliases or import host
|
|
36
|
+
components. Use `moi ui-components` for installation; no `components.json` setup is needed.
|
|
37
|
+
|
|
38
|
+
## Composition
|
|
39
|
+
|
|
40
|
+
Use the anatomy and props in `moi ui-components docs <name>`. Inspect the installed source
|
|
41
|
+
when an example differs or a component has local edits; it defines the supported API.
|
|
42
|
+
Keep required groups, labels, and titles when composing parts.
|
|
43
|
+
|
|
44
|
+
Custom triggers and close controls use the `render` prop:
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
<DialogTrigger render={<Button variant="outline" />}>Open</DialogTrigger>
|
|
29
48
|
```
|
|
30
49
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
`date-picker` (pattern: calendar in a popover — see its docs; installs `calendar` + `popover` +
|
|
61
|
-
`button`)
|
|
62
|
-
|
|
63
|
-
**Overlays (portal-patched):** `dialog` · `alert-dialog` (destructive confirm) · `popover` ·
|
|
64
|
-
`dropdown-menu` · `context-menu` (right-click) · `hover-card` · `tooltip`
|
|
65
|
-
|
|
66
|
-
**Display & feedback:** `alert` (callouts) · `badge` · `avatar` · `skeleton` · `spinner` ·
|
|
67
|
-
`progress` · `table` · `data-table` (pattern on `table` + `@tanstack/react-table` — see its
|
|
68
|
-
docs) · `chart` (Recharts wired to theme tokens) · `attachment` (file/image tile) · `bubble`
|
|
69
|
-
(chat message)
|
|
70
|
-
|
|
71
|
-
**Structure & navigation:** `accordion` · `collapsible` · `tabs` · `carousel` · `pagination` ·
|
|
72
|
-
`resizable` (split panels) · `separator` (divider line)
|
|
73
|
-
|
|
74
|
-
Picking one: quick info on hover → `hover-card` or `tooltip` · contextual panel on click →
|
|
75
|
-
`popover` · focused task needing input → `dialog` · destructive confirmation → `alert-dialog` ·
|
|
76
|
-
option sets of 2–7 → `toggle-group` · long searchable lists → `combobox` · boolean setting →
|
|
77
|
-
`switch`, boolean in a form → `checkbox`.
|
|
78
|
-
|
|
79
|
-
## Composition rules
|
|
80
|
-
|
|
81
|
-
- **Custom triggers use the `render` prop** — this is Base UI, there is no `asChild`. Never wrap
|
|
82
|
-
a trigger in an extra element. Applies to every Trigger and Close part (`DialogTrigger`,
|
|
83
|
-
`PopoverTrigger`, `DropdownMenuTrigger`, `TooltipTrigger`, `CollapsibleTrigger`,
|
|
84
|
-
`DialogClose`, …).
|
|
85
|
-
|
|
86
|
-
```tsx
|
|
87
|
-
<DialogTrigger render={<Button variant="outline" />}>Open</DialogTrigger>
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
- **`render` to a non-button element needs `nativeButton={false}`:**
|
|
91
|
-
|
|
92
|
-
```tsx
|
|
93
|
-
<Button render={<a href="/docs" />} nativeButton={false}>Read the docs</Button>
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
- **Items always live inside their Group**: `SelectItem`/`SelectLabel` → `SelectGroup`;
|
|
97
|
-
`DropdownMenuItem`/`DropdownMenuLabel`/`DropdownMenuSub` → `DropdownMenuGroup`;
|
|
98
|
-
`ContextMenuItem` → `ContextMenuGroup`. A Label outside its Group **crashes the component at
|
|
99
|
-
runtime** (Base UI requires the group context); keep items grouped too.
|
|
100
|
-
- **`Dialog` and `AlertDialog` always need a Title** (`DialogTitle` — use
|
|
101
|
-
`className="sr-only"` to hide it visually).
|
|
102
|
-
- **`TabsTrigger` must be inside `TabsList`**, never directly in `Tabs`.
|
|
103
|
-
- **`Avatar` always needs `AvatarFallback`** for when the image fails.
|
|
104
|
-
- **Button has no `isLoading`** — compose: `<Button disabled><Spinner data-icon="inline-start" />Saving…</Button>`.
|
|
105
|
-
- **Use components, not custom markup**: callout → `Alert` (+`AlertTitle`/`AlertDescription`),
|
|
106
|
-
loading placeholder → `Skeleton` (no custom `animate-pulse` divs), status chip → `Badge` (no
|
|
107
|
-
styled spans), divider → `Separator` (no `<hr>`/border divs), inline loading → `Spinner`.
|
|
108
|
-
|
|
109
|
-
## Base UI API gotchas
|
|
110
|
-
|
|
111
|
-
The biggest source of bugs when you know Radix-era shadcn. When unsure, `moi ui-components docs
|
|
112
|
-
<name>` has the real API.
|
|
113
|
-
|
|
114
|
-
- **Select needs an `items` prop on the root**; the placeholder is a `{ value: null }` item, not
|
|
115
|
-
a `placeholder` prop:
|
|
116
|
-
|
|
117
|
-
```tsx
|
|
118
|
-
const items = [
|
|
119
|
-
{ label: 'Pick a fruit', value: null },
|
|
120
|
-
{ label: 'Apple', value: 'apple' },
|
|
121
|
-
]
|
|
122
|
-
<Select items={items}>
|
|
123
|
-
<SelectTrigger><SelectValue /></SelectTrigger>
|
|
124
|
-
<SelectContent>
|
|
125
|
-
<SelectGroup>
|
|
126
|
-
{items.map(item => (
|
|
127
|
-
<SelectItem key={item.value} value={item.value}>{item.label}</SelectItem>
|
|
128
|
-
))}
|
|
129
|
-
</SelectGroup>
|
|
130
|
-
</SelectContent>
|
|
131
|
-
</Select>
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
Extras: `multiple` + render-function `SelectValue` for multi-select; `itemToStringValue` for
|
|
135
|
-
object values; `alignItemWithTrigger={false}` to position like a plain dropdown.
|
|
136
|
-
- **ToggleGroup**: no `type` prop — single-select by default, `multiple` for multi; `value`/
|
|
137
|
-
`defaultValue` is **always an array** (`defaultValue={["daily"]}`; controlled single value:
|
|
138
|
-
`value={[value]} onValueChange={v => setValue(v[0])}`).
|
|
139
|
-
- **Slider**: plain number for one thumb (`defaultValue={50}`), array only for ranges.
|
|
140
|
-
- **Accordion**: no `type`/`collapsible` props — `defaultValue` is **always an array**
|
|
141
|
-
(`defaultValue={["item-1"]}`), `multiple` to allow several open.
|
|
142
|
-
- **`AlertAction` is absolutely positioned** in the alert's top-right corner, and the alert
|
|
143
|
-
reserves only ~4.5rem of right padding for it. Keep it to one small control (`size="sm"`
|
|
144
|
-
button or icon button); anything wider overlaps the title and description text.
|
|
145
|
-
|
|
146
|
-
## Forms
|
|
147
|
-
|
|
148
|
-
- Lay out forms with `FieldGroup` + `Field` — never raw `div`s with spacing utilities:
|
|
149
|
-
|
|
150
|
-
```tsx
|
|
151
|
-
<FieldGroup>
|
|
152
|
-
<Field>
|
|
153
|
-
<FieldLabel htmlFor="email">Email</FieldLabel>
|
|
154
|
-
<Input id="email" type="email" />
|
|
155
|
-
<FieldDescription>Work email preferred.</FieldDescription>
|
|
156
|
-
</Field>
|
|
157
|
-
</FieldGroup>
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
`Field orientation="horizontal"` for settings rows; `FieldSet` + `FieldLegend` for groups of
|
|
161
|
-
related checkboxes/radios/switches.
|
|
162
|
-
- **Validation and disabled need both attributes**: `data-invalid` on `Field` + `aria-invalid`
|
|
163
|
-
on the control; `data-disabled` on `Field` + `disabled` on the control.
|
|
164
|
-
- **Inside `InputGroup`, use `InputGroupInput`/`InputGroupTextarea`** — never raw
|
|
165
|
-
`Input`/`Textarea`. A button attached to an input is `InputGroup` + `InputGroupAddon`, never
|
|
166
|
-
absolute positioning over an `Input`.
|
|
167
|
-
- **2–7 exclusive options → `ToggleGroup`**, not a loop of `Button`s with manual active state.
|
|
168
|
-
- Control chooser: free text → `input`/`textarea` · predefined options → `select` · searchable →
|
|
169
|
-
`combobox` · boolean setting → `switch` · boolean consent → `checkbox` · one-of-few →
|
|
170
|
-
`radio-group` · numeric range → `slider`.
|
|
171
|
-
|
|
172
|
-
## Styling
|
|
173
|
-
|
|
174
|
-
- **Semantic tokens only, never raw colors**: `bg-primary`, `text-muted-foreground`,
|
|
175
|
-
`text-destructive`, `bg-popover` — not `bg-blue-500` or `text-emerald-600`. Every token pairs
|
|
176
|
-
`name`/`name-foreground` (background / text-on-it): `background`, `card`, `popover`,
|
|
177
|
-
`primary`, `secondary`, `muted`, `accent`, `destructive`, plus `border`, `input`, `ring`,
|
|
178
|
-
`chart-1…5`, and `--radius`. Status colors come from `Badge` variants or `text-destructive`.
|
|
179
|
-
- **Built-in variants before custom classes**: `variant="outline"`, `size="sm"` — not
|
|
180
|
-
hand-rolled border/bg utilities on `Button`.
|
|
181
|
-
- **Prefer each component's default size.** Use smaller variants such as `sm` or `xs` only when a
|
|
182
|
-
real density constraint calls for them and the reduced control remains comfortable to use. When
|
|
183
|
-
using a non-default size, compare it with neighboring controls. Controls in the same group must
|
|
184
|
-
have matching heights and compatible visual weight.
|
|
185
|
-
- **`className` is for layout** (`max-w-md`, `mt-4`, `w-full`) — never for overriding a
|
|
186
|
-
component's colors or typography.
|
|
187
|
-
- **`gap-*`, not `space-x-*`/`space-y-*`** (`flex flex-col gap-4`). **`size-10`, not
|
|
188
|
-
`w-10 h-10`.** **`truncate`**, not the three-class spell.
|
|
189
|
-
- **`cn()` from `../ui/utils` for conditional classes** — no template-literal ternaries. The
|
|
190
|
-
same import works from `_`-prefixed shared modules next to your applets (a
|
|
191
|
-
`.moi/widgets/_utils.tsx` importing `cn` uses `../ui/utils` too) — no need to re-implement
|
|
192
|
-
it.
|
|
193
|
-
- **No manual `z-index` on overlays** — dialog/popover/menu/tooltip handle their own stacking.
|
|
194
|
-
|
|
195
|
-
## Icons
|
|
196
|
-
|
|
197
|
-
- Tabler only: `import { IconSearch } from '@tabler/icons-react'` — every name is
|
|
198
|
-
`Icon`-prefixed. Installed components already come converted.
|
|
199
|
-
- In a `Button`, mark position with `data-icon="inline-start"` / `"inline-end"`; **no sizing
|
|
200
|
-
classes on icons inside components** (Button, DropdownMenuItem, Alert size them via CSS).
|
|
201
|
-
- Pass icons as component objects (`icon={IconCheck}`), never as string keys into a lookup map.
|
|
202
|
-
|
|
203
|
-
## Customization
|
|
204
|
-
|
|
205
|
-
Cheapest first — stop at the first level that works:
|
|
206
|
-
|
|
207
|
-
1. **Workspace theme** (`moi theme`) — fonts, colors, radius flow into every component through
|
|
208
|
-
tokens.
|
|
209
|
-
2. **Built-in variants + `className` layout** at the callsite (merges correctly via `cn`).
|
|
210
|
-
3. **Edit the file in `.moi/ui/`** — e.g. add a `cva` variant to `button.tsx`; propagates to
|
|
211
|
-
every applet using it, and `add` won't overwrite it without `--force`.
|
|
212
|
-
4. **Wrapper components** — compose primitives into app-level pieces (a `ConfirmDialog` wrapping
|
|
213
|
-
`AlertDialog` parts) in a `_`-prefixed shared module (`.moi/widgets/_utils.tsx` — see the
|
|
214
|
-
workspace layout in the skill).
|
|
50
|
+
Don't nest buttons inside triggers. When `render` replaces a button with a non-button
|
|
51
|
+
element, also pass `nativeButton={false}`.
|
|
52
|
+
|
|
53
|
+
## Overlays
|
|
54
|
+
|
|
55
|
+
Use the installed portal and stacking behavior; don't add a second portal or z-index overrides.
|
|
56
|
+
`applet-portal.tsx` preserves applet styles for portalled content. Never edit or remove it.
|
|
57
|
+
|
|
58
|
+
## Styling and icons
|
|
59
|
+
|
|
60
|
+
- Use semantic theme tokens and built-in variants. Reserve `className` for layout;
|
|
61
|
+
avoid overriding component colors or typography and adding manual `dark:` color overrides.
|
|
62
|
+
- Prefer default sizes. Use smaller controls when space calls for them, keeping neighboring
|
|
63
|
+
controls consistent and comfortable to use.
|
|
64
|
+
- Prefer `gap-*` for spacing, `size-*` for equal width and height, and `truncate` for ellipsis.
|
|
65
|
+
- Use `cn()` from `../ui/utils` for conditional classes.
|
|
66
|
+
- Use Tabler icons with explicit `stroke` following [the icon guidance](DESIGN.md#icons).
|
|
67
|
+
Let components size their icons; in buttons, mark position with
|
|
68
|
+
`data-icon="inline-start"` or `data-icon="inline-end"`.
|
|
69
|
+
|
|
70
|
+
## Customization and updates
|
|
71
|
+
|
|
72
|
+
Use `moi theme` for workspace-wide appearance. When variants and layout props aren't enough,
|
|
73
|
+
edit the source in `.moi/ui/`; every importing applet gets the change. Put reusable compositions
|
|
74
|
+
in `_`-prefixed shared modules next to applets.
|
|
75
|
+
|
|
76
|
+
Existing files are skipped by `add`. Use `--force` only for an intended reinstall, after checking
|
|
77
|
+
local edits. Existing support files remain protected even with `--force`; request a dependency
|
|
78
|
+
component explicitly to update it.
|
package/dist/chunk-59zf0m6n.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_c as r}from"/chunk-v7wr1df4.js";if(typeof globalThis.structuredClone==="function")globalThis.structuredClone=globalThis.structuredClone.bind(globalThis);async function o(a){let[{mount:t}]=await Promise.all([import("/chunk-p1yqa71k.js"),import("/chunk-kmbxhgwv.js").then((e)=>e.loadAppConfig())]);t(a)}globalThis.__init=o;
|
package/dist/chunk-bj3akjs2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"/chunk-pcnahct1.js";import"/chunk-v7wr1df4.js";export{a as sanitizeSvg};
|