moi-computer 0.4.0 → 0.4.1-next.0
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 +41 -5
- package/bin/moi.mjs +11 -0
- package/client/api/workspace-keys.ts +1 -0
- package/client/app/AppRouter.tsx +5 -1
- package/client/app/routes/WorkspaceRoute.tsx +9 -5
- package/client/app/shell/SidebarLayout.tsx +9 -7
- package/client/components/shared/BottomPanel.tsx +24 -5
- package/client/components/shared/Composer.tsx +1 -1
- package/client/components/shared/PanelHeader.tsx +1 -1
- package/client/components/ui/button.tsx +5 -5
- package/client/components/ui/dropdown-menu.tsx +6 -6
- package/client/components/ui/hover-card.tsx +1 -1
- package/client/components/ui/input.tsx +1 -1
- package/client/components/ui/popover.tsx +1 -1
- package/client/components/ui/skeleton.tsx +1 -1
- package/client/components/ui/textarea.tsx +1 -1
- package/client/components/ui/tooltip.tsx +1 -1
- package/client/features/applets/applet-cache.ts +20 -1
- package/client/features/applets/applet-log.ts +10 -30
- package/client/features/applets/applet-runtime.ts +272 -0
- package/client/features/applets/useApplet.ts +36 -10
- package/client/features/chat/ChatComposer.tsx +1 -1
- package/client/features/chat/ChatEmptyState.tsx +186 -0
- package/client/features/chat/ChatPanel.tsx +95 -54
- package/client/features/chat/ChatPopup.tsx +3 -13
- package/client/features/chat/ChatPromptBubbles.tsx +74 -0
- package/client/features/chat/MarkdownContent.tsx +15 -3
- package/client/features/chat/ModelPicker.tsx +1 -1
- package/client/features/chat/TurnView.tsx +6 -17
- package/client/features/chat/chat-send.ts +26 -1
- package/client/features/chat/tool-group/CodeBlock.tsx +1 -1
- package/client/features/chat/tool-group/ReadImagePreview.tsx +1 -1
- package/client/features/chat/tool-group/SubagentCard.tsx +1 -1
- package/client/features/chat/tool-group/TimelineRow.tsx +4 -4
- package/client/features/chat/tool-group/ToolCallGroup.tsx +12 -5
- package/client/features/chat/tool-group/ToolOutput.tsx +2 -2
- package/client/features/chat/tool-group/format.ts +3 -3
- package/client/features/chat/useAppletChatMessage.ts +69 -0
- package/client/features/chat/useChat.ts +49 -14
- package/client/features/chat/useStickToBottom.ts +11 -1
- package/client/features/connectors/McpServerCards.tsx +3 -3
- package/client/features/dev/HarnessDebugPage.tsx +4 -4
- package/client/features/dev/PixelPainter.tsx +1 -1
- package/client/features/dev/PlaygroundPage.tsx +1 -1
- package/client/features/dev/ToolCallsPage.tsx +2 -2
- package/client/features/home/HomePage.tsx +17 -14
- package/client/features/home/WorkspacePreview.tsx +12 -13
- package/client/features/home/api.ts +8 -5
- package/client/features/home/workspace-presentation.tsx +1 -1
- package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +1 -1
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +21 -8
- package/client/features/scratchpad/Scratchpad.tsx +41 -2
- package/client/features/scratchpad/ScratchpadControls.tsx +13 -13
- package/client/features/scratchpad/useScratchpadSnapshot.tsx +1 -1
- package/client/features/settings/EnvironmentSettings.tsx +1 -1
- package/client/features/settings/IconPicker.tsx +11 -11
- package/client/features/settings/SettingsLayout.tsx +1 -1
- package/client/features/settings/WorkspaceSettings.tsx +2 -2
- package/client/features/settings/api.ts +33 -1
- package/client/features/widgets/HiddenPanel.tsx +4 -3
- package/client/features/widgets/Widgets.tsx +1 -0
- package/client/features/workspace/CustomizePanel.tsx +96 -82
- package/client/features/workspace/WorkspaceScreen.tsx +129 -107
- package/client/features/workspace/WorkspaceSkillUpdateBanner.tsx +91 -0
- package/client/features/workspace/WorkspaceTabs.tsx +1 -1
- package/client/features/workspace/api.ts +52 -0
- package/client/features/workspace/moi-context.ts +63 -17
- package/client/features/workspace/tab-resolution.ts +75 -0
- package/client/features/workspace/useWorkspaceNavigation.ts +128 -0
- package/client/features/workspace/useWorkspaceSkillUpdates.ts +160 -0
- package/client/index.css +10 -15
- package/client/lib/app-icon-registry.ts +77 -70
- package/client/lib/rate-limit.ts +77 -0
- package/client/runtime/useWorkspaceEvents.ts +15 -2
- package/client/runtime/workspace-theme.ts +115 -0
- package/client/store/ui.ts +42 -17
- package/client/theme.css +20 -15
- package/dist/{chunk-fh2mf6v9.js → chunk-3m1xe1j3.js} +94 -94
- package/dist/chunk-5vaevt8z.js +2 -0
- package/dist/{chunk-69nhbjhy.js → chunk-7bzpmtxp.js} +4 -4
- package/dist/chunk-h0hk61pm.js +9 -0
- package/dist/{chunk-35fq49qa.js → chunk-h3evrtyp.js} +1 -1
- package/dist/chunk-k5sjx9s5.js +1 -0
- package/dist/{chunk-2vaafjp4.js → chunk-m9qja0nx.js} +1 -1
- package/dist/chunk-s7za1qsv.css +1 -0
- package/dist/{chunk-72atbmh3.js → chunk-tcfa3vt3.js} +1 -1
- package/dist/chunk-v797g6ap.js +51 -0
- package/dist/chunk-xyrw8318.js +27 -0
- package/dist/index.html +1 -1
- package/lib/app-icons.ts +73 -0
- package/lib/moi-context.ts +104 -3
- package/lib/themes.ts +83 -45
- package/lib/types.ts +44 -9
- package/lib/workspace-tabs.ts +48 -0
- package/package.json +4 -1
- package/server/api.ts +57 -5
- package/server/app-settings.ts +65 -0
- package/server/applets.ts +132 -22
- package/server/bundler/build-applet.ts +74 -16
- package/server/cli.ts +144 -17
- package/server/control.ts +53 -7
- package/server/data-dir.ts +1 -1
- package/server/events.ts +1 -1
- package/server/functions-worker.ts +15 -1
- package/server/functions.ts +51 -6
- package/server/layout.ts +9 -14
- package/server/moi-scaffold.ts +37 -3
- package/server/registry.ts +1 -1
- package/server/skill-update.ts +47 -0
- package/server/skill-version.ts +2 -11
- package/server/tabs.ts +59 -0
- package/server/theme.ts +8 -14
- package/server/view-builders.ts +6 -2
- package/workspace/.claude/skills/moi-workspace/DESIGN.md +265 -107
- package/workspace/.claude/skills/moi-workspace/SKILL.md +85 -11
- package/client/features/workspace/useWorkspaceTheme.ts +0 -82
- package/dist/chunk-19g80zc9.css +0 -1
- package/dist/chunk-7mkv2gr0.js +0 -2
- package/dist/chunk-gt7n06ef.js +0 -1
- package/dist/chunk-jwmc32rp.js +0 -63
- package/dist/chunk-kh24bstm.js +0 -10
- package/dist/chunk-sfa4mbmx.js +0 -15
- package/workspace/.claude/skills/moi-workspace/VIEW-DESIGN.md +0 -22
package/server/skill-version.ts
CHANGED
|
@@ -7,21 +7,12 @@
|
|
|
7
7
|
import { readdir } from 'node:fs/promises'
|
|
8
8
|
import { join } from 'node:path'
|
|
9
9
|
|
|
10
|
-
import type { WorkspaceType } from '@/lib/types'
|
|
10
|
+
import type { WorkspaceSkillStatus, WorkspaceType } from '@/lib/types'
|
|
11
11
|
|
|
12
12
|
import { findWorkspaceForPath, liftToWorkspaceRoot, listWorkspaces } from './registry'
|
|
13
13
|
import { BUNDLED_SKILLS_DIR } from './skills-template'
|
|
14
14
|
import { skillsDirFor } from './workspace-init'
|
|
15
15
|
|
|
16
|
-
export type SkillStatus = {
|
|
17
|
-
name: string
|
|
18
|
-
// Version stamped in the workspace's copy. `null` means absent — either the
|
|
19
|
-
// skill isn't installed or it predates skill versioning (treated as behind).
|
|
20
|
-
installed: string | null
|
|
21
|
-
// Version shipped with this CLI. `null` only if a bundled skill lacks a stamp.
|
|
22
|
-
bundled: string | null
|
|
23
|
-
}
|
|
24
|
-
|
|
25
16
|
// The version is stamped as a self-contained marker in SKILL.md, e.g.
|
|
26
17
|
// `<moi-skill version="0.1.0" />`, rather than in YAML frontmatter. SKILL.md
|
|
27
18
|
// frontmatter is NOT reliably strict YAML — the free-text `description` routinely
|
|
@@ -99,7 +90,7 @@ export async function bundledSkillNames(): Promise<string[]> {
|
|
|
99
90
|
export async function skillStatuses(
|
|
100
91
|
workspaceRoot: string,
|
|
101
92
|
type?: WorkspaceType
|
|
102
|
-
): Promise<
|
|
93
|
+
): Promise<WorkspaceSkillStatus[]> {
|
|
103
94
|
const names = await bundledSkillNames()
|
|
104
95
|
const skillsDir = skillsDirFor(workspaceRoot, type)
|
|
105
96
|
return Promise.all(
|
package/server/tabs.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// `moi tabs` / `moi tab focus` server logic: assemble the tab listing and
|
|
2
|
+
// validate a focus target. Pure given its inputs — the control handler wires
|
|
3
|
+
// in the workspace lookups (see control.ts), tests pass fakes.
|
|
4
|
+
import type { ViewInfo, WorkspaceTabId } from '@/lib/types'
|
|
5
|
+
import { viewIdFromTab, viewTabId } from '@/lib/workspace-tabs'
|
|
6
|
+
|
|
7
|
+
// One row of `moi tabs`. `isDefault` marks the workspace's saved default tab
|
|
8
|
+
// (`layout.tabs.active`) — where a bare `/workspace/:id` lands.
|
|
9
|
+
export type TabRow = {
|
|
10
|
+
id: WorkspaceTabId
|
|
11
|
+
title: string
|
|
12
|
+
isDefault: boolean
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// The always-present tabs, titled like the tab bar renders them.
|
|
16
|
+
const STATIC_TABS: { id: WorkspaceTabId; title: string }[] = [
|
|
17
|
+
{ id: 'agent', title: 'Agent' },
|
|
18
|
+
{ id: 'widgets', title: 'Widgets' },
|
|
19
|
+
{ id: 'scratchpad', title: 'Scratchpad' }
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
// The `moi tabs` listing: static tabs plus each built view, the saved default
|
|
23
|
+
// marked. View builders are transient build-state, not addressable tabs, so
|
|
24
|
+
// they don't list (and a builder default simply marks no row).
|
|
25
|
+
export function assembleTabRows(views: ViewInfo[], defaultTab: WorkspaceTabId): TabRow[] {
|
|
26
|
+
return [
|
|
27
|
+
...STATIC_TABS,
|
|
28
|
+
...views.map(view => ({ id: viewTabId(view.id), title: view.config.title || view.id }))
|
|
29
|
+
].map(row => ({ ...row, isDefault: row.id === defaultTab }))
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type FocusTabDeps = {
|
|
33
|
+
// Whether a view id exists in the workspace (source or built) — hasViewId.
|
|
34
|
+
hasView: (viewId: string) => Promise<boolean>
|
|
35
|
+
// The built views, for the error message's valid-id list — getViewList.
|
|
36
|
+
viewList: () => Promise<ViewInfo[]>
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type FocusTabResult = { ok: true; tab: WorkspaceTabId } | { ok: false; error: string }
|
|
40
|
+
|
|
41
|
+
// Validate a `moi tab focus` target: static ids pass as-is, `view:<id>` must
|
|
42
|
+
// name a real view. Anything else — including view-builder tabs — fails with
|
|
43
|
+
// the list of valid ids. Addressing is by tab id, never by title.
|
|
44
|
+
export async function resolveFocusTab(raw: unknown, deps: FocusTabDeps): Promise<FocusTabResult> {
|
|
45
|
+
const tab = typeof raw === 'string' ? raw.trim() : ''
|
|
46
|
+
if (STATIC_TABS.some(row => row.id === tab)) return { ok: true, tab: tab as WorkspaceTabId }
|
|
47
|
+
|
|
48
|
+
const viewId = tab.startsWith('view:') ? viewIdFromTab(tab as WorkspaceTabId) : null
|
|
49
|
+
if (viewId && (await deps.hasView(viewId))) return { ok: true, tab: tab as WorkspaceTabId }
|
|
50
|
+
|
|
51
|
+
const validIds = [
|
|
52
|
+
...STATIC_TABS.map(row => row.id),
|
|
53
|
+
...(await deps.viewList()).map(view => viewTabId(view.id))
|
|
54
|
+
]
|
|
55
|
+
return {
|
|
56
|
+
ok: false,
|
|
57
|
+
error: `Unknown tab "${tab || String(raw ?? '')}". Valid tabs: ${validIds.join(', ')}`
|
|
58
|
+
}
|
|
59
|
+
}
|
package/server/theme.ts
CHANGED
|
@@ -8,9 +8,8 @@ export type ThemeUpdateResult =
|
|
|
8
8
|
| { ok: true; theme: ThemeShape; applied: { font?: FontTheme; color?: ColorTheme } }
|
|
9
9
|
| { ok: false; error: string }
|
|
10
10
|
|
|
11
|
-
// Pure merge + validation for a theme update.
|
|
12
|
-
//
|
|
13
|
-
// `undefined` bg/fg, which JSON.stringify drops on save.
|
|
11
|
+
// Pure merge + validation for a theme update. The workspace stores only the
|
|
12
|
+
// selected font and primary; all other color tokens are derived at runtime.
|
|
14
13
|
export function applyThemeUpdate(
|
|
15
14
|
current: WorkspaceLayout['theme'],
|
|
16
15
|
update: ThemeUpdate
|
|
@@ -22,15 +21,10 @@ export function applyThemeUpdate(
|
|
|
22
21
|
return { ok: false, error: `Unknown color theme: ${update.color}` }
|
|
23
22
|
}
|
|
24
23
|
|
|
24
|
+
const primary = update.color ? COLOR_THEMES[update.color as ColorTheme].primary : current?.primary
|
|
25
25
|
const theme: ThemeShape = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (update.color) {
|
|
31
|
-
const preset = COLOR_THEMES[update.color as ColorTheme]
|
|
32
|
-
theme.background = preset.background
|
|
33
|
-
theme.foreground = preset.foreground
|
|
26
|
+
font: (update.font as FontTheme) ?? current?.font ?? 'default',
|
|
27
|
+
...(primary ? { primary } : {})
|
|
34
28
|
}
|
|
35
29
|
|
|
36
30
|
return {
|
|
@@ -43,13 +37,13 @@ export function applyThemeUpdate(
|
|
|
43
37
|
}
|
|
44
38
|
}
|
|
45
39
|
|
|
46
|
-
// Reverse-lookup: resolve stored
|
|
47
|
-
export function matchColorTheme(
|
|
40
|
+
// Reverse-lookup: resolve the stored primary to a preset key, or null for custom colors.
|
|
41
|
+
export function matchColorTheme(primary: string | undefined): ColorTheme | null {
|
|
48
42
|
for (const [key, preset] of Object.entries(COLOR_THEMES) as [
|
|
49
43
|
ColorTheme,
|
|
50
44
|
(typeof COLOR_THEMES)[ColorTheme]
|
|
51
45
|
][]) {
|
|
52
|
-
if (preset.
|
|
46
|
+
if (preset.primary === primary) return key
|
|
53
47
|
}
|
|
54
48
|
return null
|
|
55
49
|
}
|
package/server/view-builders.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mkdir, rename } from 'node:fs/promises'
|
|
2
2
|
import { join } from 'node:path'
|
|
3
3
|
|
|
4
|
+
import { APP_ICON_IDS, isAppIconId } from '@/lib/app-icons'
|
|
4
5
|
import { newBuilderId } from '@/lib/ids'
|
|
5
6
|
import type { AppletKind, ViewBuilder, ViewInfo } from '@/lib/types'
|
|
6
7
|
|
|
@@ -193,8 +194,11 @@ export async function setBuilder(
|
|
|
193
194
|
if (!/^[a-z0-9][a-z0-9_-]*$/.test(appletId)) {
|
|
194
195
|
throw new ViewBuilderError('Invalid applet id', 400)
|
|
195
196
|
}
|
|
196
|
-
if (input.icon !== undefined &&
|
|
197
|
-
throw new ViewBuilderError(
|
|
197
|
+
if (input.icon !== undefined && !isAppIconId(input.icon)) {
|
|
198
|
+
throw new ViewBuilderError(
|
|
199
|
+
`Unknown view icon id "${input.icon}". Use one of: ${APP_ICON_IDS.join(', ')}`,
|
|
200
|
+
400
|
|
201
|
+
)
|
|
198
202
|
}
|
|
199
203
|
// Views and widgets are separate applet namespaces, so an id is only unique
|
|
200
204
|
// within a kind — a view and a widget may both be called "stats".
|
|
@@ -1,110 +1,268 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
1
|
+
# moi applet design
|
|
2
|
+
|
|
3
|
+
This is the visual contract for widgets and views inside a moi workspace. The host app stays calm,
|
|
4
|
+
precise, and quiet. Applets may be more expressive and information-rich while still feeling related
|
|
5
|
+
to the workspace around them.
|
|
6
|
+
|
|
7
|
+
This file owns visual direction, layout, states, and interaction design. `SKILL.md` owns file layout,
|
|
8
|
+
imports, styling syntax, and build instructions. The workspace theme owns fonts and semantic color
|
|
9
|
+
values.
|
|
10
|
+
|
|
11
|
+
## Visual direction
|
|
12
|
+
|
|
13
|
+
Design around the content and the task. Give every applet a clear first reading, then add detail in
|
|
14
|
+
proportion to its size and purpose. Dense information is welcome when hierarchy and alignment keep
|
|
15
|
+
it easy to scan.
|
|
16
|
+
|
|
17
|
+
An applet may have one expressive focal point: a visualization, strong surface, image, tactile
|
|
18
|
+
interaction, or satisfying state change. It is optional. Use it when it helps the content and keep
|
|
19
|
+
the rest restrained so it remains meaningful. Avoid decorative clutter, competing effects, and a
|
|
20
|
+
different visual system for every section.
|
|
21
|
+
|
|
22
|
+
Every visible element must help the user understand useful content, see a real state, or take an
|
|
23
|
+
action. Do not add category eyebrows that repeat the title, readiness badges for an obvious default
|
|
24
|
+
state, helper copy that repeats nearby text, decorative status pills, or icons with no useful
|
|
25
|
+
meaning. Clear and simple applets contain fewer elements, and each one earns its place.
|
|
26
|
+
|
|
27
|
+
Widgets and views in one workspace should feel like a family through shared typography, palette,
|
|
28
|
+
spacing, or interaction patterns. They do not need to look identical.
|
|
29
|
+
|
|
30
|
+
## Color
|
|
31
|
+
|
|
32
|
+
Start with the semantic colors supplied by the applet's surface. Widgets use the host's dark card
|
|
33
|
+
theme. Views inherit the workspace surface. Semantic colors keep ordinary text, structure, controls,
|
|
34
|
+
and states readable and consistent.
|
|
35
|
+
|
|
36
|
+
| Intent | Tailwind token | Use |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| Primary content | `text-foreground` | Headings, values, body text, and important icons |
|
|
39
|
+
| Secondary content | `text-muted-foreground` | Labels, captions, timestamps, and supporting metadata |
|
|
40
|
+
| Main surface | `bg-background text-foreground` | The default applet surface |
|
|
41
|
+
| Inset surface | `bg-card text-card-foreground` | A real contained object or raised region inside the applet |
|
|
42
|
+
| Floating surface | `bg-popover text-popover-foreground` | Menus, tooltips, and other floating content |
|
|
43
|
+
| Primary action | `bg-primary text-primary-foreground` | The most important action in a local region |
|
|
44
|
+
| Subdued surface | `bg-muted` | Skeletons, quiet fills, and disabled structure |
|
|
45
|
+
| Interaction | `bg-accent text-accent-foreground` | Hover, active, selected, and subtle highlighted states |
|
|
46
|
+
| Error or danger | `text-destructive` / `bg-destructive` | Errors, destructive actions, and invalid states |
|
|
47
|
+
| Structure | `ring-1 ring-border`, `border-input`, `ring-ring` | Custom container edges, controls, and visible focus |
|
|
48
|
+
|
|
49
|
+
Use lower foreground opacity only for tertiary metadata that remains readable. Avoid weak alpha text
|
|
50
|
+
for important labels or values. Keep inset surfaces rare so a widget does not become a stack of
|
|
51
|
+
cards.
|
|
52
|
+
|
|
53
|
+
Keep container edges subtle. Use `ring-1 ring-border` for custom container outlines. Do not use a
|
|
54
|
+
bare `border`, black borders, or raw high-contrast border colors as custom container chrome.
|
|
55
|
+
|
|
56
|
+
Custom color is welcome when it carries identity, data, status, or useful emphasis. On a saturated
|
|
57
|
+
surface, choose an explicit light or dark foreground with strong contrast. Keep state colors
|
|
58
|
+
consistent and pair them with text, shape, or an icon when they convey meaning.
|
|
59
|
+
|
|
60
|
+
Use solid filled surfaces by default. A restrained shadow, glow, texture, image, or visualization
|
|
61
|
+
may add depth when it supports the subject. Do not use gradients as generic visual polish. Use a
|
|
62
|
+
gradient only when it encodes information or is essential to the specific content.
|
|
63
|
+
|
|
64
|
+
Use purple, violet, and fuchsia only when the content, brand, or user preference calls for them.
|
|
65
|
+
Never use a purple gradient as a default creativity or technology cue.
|
|
66
|
+
|
|
67
|
+
### Color starting points
|
|
68
|
+
|
|
69
|
+
These are anchors, not fixed palettes. Tint them or use a single accent.
|
|
70
|
+
|
|
71
|
+
| Content | Useful color families | Typical range |
|
|
72
|
+
| --- | --- | --- |
|
|
73
|
+
| Weather, sky, time | Sky, blue, indigo | 500–700 |
|
|
74
|
+
| Night or dark environments | Indigo, slate | 800–900 |
|
|
75
|
+
| Overcast or neutral data | Slate, zinc, neutral | 500–800 |
|
|
76
|
+
| Nature and health | Emerald, green, teal | 500–700 |
|
|
77
|
+
| Finance and positive movement | Emerald, teal | 600–700 |
|
|
78
|
+
| Music and creative media | Blue, teal, amber, rose | 500–700 |
|
|
79
|
+
| Alerts and urgency | Red, orange | 500–700 |
|
|
80
|
+
| Notes and text | Amber, yellow | 400–600 |
|
|
81
|
+
| Social and communication | Pink, rose | 400–600 |
|
|
82
|
+
| Productivity and systems | Cyan, sky | 500–700 |
|
|
83
|
+
|
|
84
|
+
Use the middle and darker parts of a Tailwind color scale for substantial surfaces, then verify the
|
|
85
|
+
foreground contrast. Brighter values work better as small accents, chart marks, and status signals.
|
|
86
|
+
|
|
87
|
+
## Typography and hierarchy
|
|
88
|
+
|
|
89
|
+
Inherit the workspace font. Use sentence case for headings, labels, actions, and navigation. Use
|
|
90
|
+
regular weight for most text and medium for emphasis. Other weights are reserved for owner
|
|
91
|
+
hand-tuning.
|
|
92
|
+
|
|
93
|
+
Use a small, consistent type scale. `text-sm` (14 px) is the default for UI text. Use smaller text
|
|
94
|
+
only for genuinely compact metadata and larger text only for clear headings or one meaningful
|
|
95
|
+
display value. Do not create many label styles with slightly different sizes.
|
|
96
|
+
|
|
97
|
+
Keep text contrast clear. Use `text-foreground` for primary content and `text-muted-foreground` for
|
|
98
|
+
genuinely secondary content. Avoid several near-identical text styles that make hierarchy hard to
|
|
99
|
+
read.
|
|
100
|
+
|
|
101
|
+
Reserve `font-mono` for code, command text, and truly code-like identifiers. Do not use monospace for
|
|
102
|
+
numeric UI values, measurements, percentages, timers, timestamps, prices, counts, or labels. Numbers
|
|
103
|
+
inherit the workspace's default font; add `tabular-nums` when stable digit widths or alignment help.
|
|
104
|
+
A stronger display treatment may lead a widget or view when it serves the content, but it should not
|
|
105
|
+
become a separate type system. Keep no more than two clear type roles in one applet.
|
|
106
|
+
|
|
107
|
+
Build hierarchy with a visible size gap. Give the main value, message, or task the strongest
|
|
108
|
+
emphasis, keep supporting content quieter, and make tertiary metadata easy to ignore. A widget may
|
|
109
|
+
use a large hero value when its footprint supports it. If two elements compete for attention, reduce
|
|
110
|
+
one.
|
|
111
|
+
|
|
112
|
+
Use a 4 px spacing rhythm. As a guide:
|
|
113
|
+
|
|
114
|
+
- 4–8 px keeps tightly related items together.
|
|
115
|
+
- 12–16 px separates groups within a region.
|
|
116
|
+
- 24 px or more marks a section change in larger widgets and views.
|
|
117
|
+
|
|
118
|
+
Prefer spacing over dividers. Keep repeated rows, chart labels, status markers, counters, and
|
|
119
|
+
trailing actions in stable lanes so changing values do not shift the layout.
|
|
120
|
+
|
|
121
|
+
## Shape and radius
|
|
122
|
+
|
|
123
|
+
Use the shared shadcn radius scale and keep its default radius on standard controls. Ordinary cards,
|
|
124
|
+
fields, list rows, and repeated sections should use `rounded-lg` or `rounded-xl`. Reserve
|
|
125
|
+
`rounded-2xl` and `rounded-3xl` for one expressive focal surface, and use `rounded-full` only for
|
|
126
|
+
real pills, circular buttons, avatars, and status dots. Controls and rectangular content regions
|
|
127
|
+
must not look capsule-shaped.
|
|
128
|
+
|
|
129
|
+
## Interaction and motion
|
|
130
|
+
|
|
131
|
+
Widgets support quick interactions such as a filter, toggle, refresh, or direct action. Multi-step
|
|
132
|
+
workflows and deep navigation belong in a view. Views may use tabs, filters, and master-detail
|
|
133
|
+
layouts when they organize one coherent screen.
|
|
134
|
+
|
|
135
|
+
Every interactive area must be obvious, keyboard-operable, and large enough to use comfortably.
|
|
136
|
+
Controls need a visible focus state and an accessible name. Use Tabler icons with consistent visual
|
|
137
|
+
weight. Do not rely on color alone, and keep charts understandable with labels, legends, patterns,
|
|
138
|
+
or direct values where needed.
|
|
139
|
+
|
|
140
|
+
Rank motion by purpose:
|
|
141
|
+
|
|
142
|
+
1. Optional entrance motion introduces the applet or a newly revealed region.
|
|
143
|
+
2. Interaction feedback covers hover, active, loading, disabled, and optimistic states.
|
|
144
|
+
3. At most one signature animation may act as the expressive focal point.
|
|
145
|
+
|
|
146
|
+
Keep motion short, interruptible, and safe for reduced-motion preferences. Animate transform and
|
|
147
|
+
opacity where possible. Do not loop decorative motion or animate frequently updating numbers. Audio
|
|
148
|
+
and video must be user-initiated.
|
|
149
|
+
|
|
150
|
+
A single interactive surface may use a restrained tactile treatment such as an inset highlight,
|
|
151
|
+
ring, or soft shadow. Keep this away from the widget's outer root because the host owns the card
|
|
152
|
+
shell.
|
|
84
153
|
|
|
85
154
|
## States
|
|
86
155
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
##
|
|
104
|
-
|
|
105
|
-
Widgets
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
156
|
+
Design every state the applet can actually reach. Static applets do not need invented async states.
|
|
157
|
+
Data-driven applets need the following when applicable:
|
|
158
|
+
|
|
159
|
+
- **Loading:** show a skeleton that mirrors the final layout and preserves its surface. Use a spinner
|
|
160
|
+
only for a compact inline action or work with no meaningful content shape.
|
|
161
|
+
- **Error:** explain the problem in one human sentence and provide a retry or clear recovery action.
|
|
162
|
+
- **Empty:** show a short explanation and a useful next step. Never leave a data region blank.
|
|
163
|
+
- **Refreshing:** keep current data visible and show progress on the refresh action. Do not replace
|
|
164
|
+
useful content with the initial loading state.
|
|
165
|
+
- **Stale:** show a quiet timestamp or status near the affected data and keep it current.
|
|
166
|
+
- **Disabled:** preserve the label and structure while making the unavailable state clear without
|
|
167
|
+
relying on color alone.
|
|
168
|
+
|
|
169
|
+
Keep state layouts stable so loading, success, empty, and error do not cause avoidable jumps. Errors
|
|
170
|
+
and empty states should still fit the configured widget height or the view's normal content frame.
|
|
171
|
+
|
|
172
|
+
## Widgets
|
|
173
|
+
|
|
174
|
+
Widgets are compact dashboard surfaces seen alongside other widgets. They should reveal their main
|
|
175
|
+
meaning within a quick scan. Larger widgets may add supporting charts, lists, metadata, filters, and
|
|
176
|
+
direct actions while keeping one clear first reading.
|
|
177
|
+
|
|
178
|
+
### Frame
|
|
179
|
+
|
|
180
|
+
The host card owns the outer radius, border, shadow, clipping, and elevation. A widget owns only its
|
|
181
|
+
content surface. Its root fills the available rectangle and must not add outer card chrome. The
|
|
182
|
+
content may use a semantic background, solid color, image, or visualization.
|
|
183
|
+
|
|
184
|
+
Use a column layout when content needs a footer or timestamp, and keep lower-priority information at
|
|
185
|
+
the bottom. Important content needs safe padding from every edge. Use `p-4` as the compact default;
|
|
186
|
+
`p-5` suits larger footprints when the content still fits.
|
|
187
|
+
|
|
188
|
+
### Grid and sizing
|
|
189
|
+
|
|
190
|
+
The dashboard grid has four columns, 160 px rows, 8 px gaps, and a maximum width of 640 px. A widget
|
|
191
|
+
may span one to four rows and columns. Width shrinks with the workspace; height stays fixed by the
|
|
192
|
+
selected row span.
|
|
193
|
+
|
|
194
|
+
The exact height is:
|
|
195
|
+
|
|
196
|
+
`rowSpan × 160 + (rowSpan − 1) × 8`
|
|
197
|
+
|
|
198
|
+
Common maximum sizes are:
|
|
199
|
+
|
|
200
|
+
| Footprint | Maximum outer size | Approximate content after `p-4` |
|
|
201
|
+
| --- | --- | --- |
|
|
202
|
+
| 1 × 1 | 154 × 160 px | 122 × 128 px |
|
|
203
|
+
| 2 × 1 | 316 × 160 px | 284 × 128 px |
|
|
204
|
+
| 2 × 2 | 316 × 328 px | 284 × 296 px |
|
|
205
|
+
| 4 × 2 | 640 × 328 px | 608 × 296 px |
|
|
206
|
+
| 4 × 3 | 640 × 496 px | 608 × 464 px |
|
|
207
|
+
| 4 × 4 | 640 × 664 px | 608 × 632 px |
|
|
208
|
+
|
|
209
|
+
Treat width as flexible and height as the hard constraint. Start with the smallest footprint that
|
|
210
|
+
presents the content clearly. Test the narrowest realistic width and the longest realistic values.
|
|
211
|
+
Clip decorative overflow deliberately, clamp supporting prose, and keep the widget itself from
|
|
212
|
+
creating horizontal page scroll or an accidental inner page scroller.
|
|
213
|
+
|
|
214
|
+
### Composition
|
|
215
|
+
|
|
216
|
+
Give the eye one primary element and no more than two supporting groups in a small widget. Larger
|
|
217
|
+
footprints may carry more information when spacing and alignment preserve the first reading. Prefer
|
|
218
|
+
live information over labels that repeat obvious context.
|
|
219
|
+
|
|
220
|
+
Keep controls limited to the immediate task. A compact mode switch can work; tabs, wizards, and
|
|
221
|
+
multi-step flows usually indicate that the content should become a view.
|
|
222
|
+
|
|
223
|
+
## Views
|
|
224
|
+
|
|
225
|
+
Views are full app screens for denser information and sustained work. They own their page hierarchy,
|
|
226
|
+
content layout, spacing, chrome, and scrolling. A view should feel complete at the available size and
|
|
227
|
+
remain usable when the chat shares the workspace.
|
|
228
|
+
|
|
229
|
+
One view represents one screen. Cross-screen navigation belongs to the workspace. Internal tabs,
|
|
230
|
+
filters, or a master-detail split may organize the current task without introducing a separate
|
|
231
|
+
client-side routing system.
|
|
232
|
+
|
|
233
|
+
Let the content choose the frame. Most views need clear page context, a primary work area, and an
|
|
234
|
+
obvious place for the main action. A header with a title and optional subtitle or action is a useful
|
|
235
|
+
default. A canvas, map, or immersive data surface may establish context another way.
|
|
236
|
+
|
|
237
|
+
Use generous, consistent page padding such as 24 or 32 px for normal views. Constrain prose, forms,
|
|
238
|
+
and narrow task flows to a readable maximum width. Let tables, boards, maps, and visual workspaces use
|
|
239
|
+
more of the frame when that improves the task.
|
|
240
|
+
|
|
241
|
+
Prefer one main page scroller. Use bounded internal scrolling only for regions that benefit from
|
|
242
|
+
independent position, such as a sticky table body, timeline, or board. The page itself must not
|
|
243
|
+
create horizontal scroll.
|
|
244
|
+
|
|
245
|
+
Views and widgets share the same color, type, motion, and state vocabulary. Views may use more
|
|
246
|
+
sections, controls, and information layers while preserving a clear primary work area. Avoid
|
|
247
|
+
stretching a widget-like card to fill the page.
|
|
248
|
+
|
|
249
|
+
## Final review
|
|
250
|
+
|
|
251
|
+
After implementation, do a removal pass from top to bottom. For every label, badge, icon, helper
|
|
252
|
+
sentence, container, divider, and decoration, ask which user decision, action, or understanding it
|
|
253
|
+
improves. Remove it when the screen stays equally clear and usable without it.
|
|
254
|
+
|
|
255
|
+
Before finishing an applet, confirm:
|
|
256
|
+
|
|
257
|
+
- Every visible element has a clear purpose.
|
|
258
|
+
- Its purpose and first reading are clear at the intended size.
|
|
259
|
+
- Semantic colors handle structure and custom color has a reason.
|
|
260
|
+
- Surfaces use solid fills by default; gradients have a content-specific reason.
|
|
261
|
+
- Purple appears only for a content, brand, or user reason and never as a default gradient.
|
|
262
|
+
- Type, spacing, density, and expression support the content.
|
|
263
|
+
- Numeric UI values use the default font, with `tabular-nums` when alignment helps.
|
|
264
|
+
- Custom container outlines use a subtle `ring-border`.
|
|
265
|
+
- The layout handles realistic content and deliberate overflow.
|
|
266
|
+
- Every reachable state and interaction is complete and accessible.
|
|
267
|
+
- The widget or view follows its frame, sizing, and scrolling rules.
|
|
268
|
+
- It feels related to the workspace without copying the quieter host shell.
|