moi-computer 0.9.1-next.0 → 0.9.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/api/app-config.ts +51 -0
- package/client/api/workspace-keys.ts +1 -0
- package/client/app/routes/WorkspaceRoute.tsx +4 -2
- package/client/features/applets/api.ts +38 -0
- package/client/features/applets/applet-thumbnail.ts +208 -0
- package/client/features/chat/ChatEmptyState.tsx +5 -3
- package/client/features/chat/ChatPanel.tsx +2 -8
- package/client/features/chat/ChatSelector.tsx +29 -10
- package/client/features/chat/MarkdownContent.tsx +2 -2
- package/client/features/home/HomePage.tsx +13 -0
- package/client/features/home/WorkspacePreview.tsx +10 -5
- package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +9 -0
- package/client/features/home/workspace-setup/InstallMoiDialog.tsx +245 -0
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +1 -1
- package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +1 -1
- package/client/features/views/ViewBuilder.tsx +18 -4
- package/client/features/views/ViewManager.tsx +18 -2
- package/client/features/widgets/WidgetFrame.tsx +1 -1
- package/client/features/widgets/WidgetGrid.tsx +1 -1
- package/client/features/widgets/Widgets.tsx +16 -15
- package/client/features/workspace/CustomizePanel.tsx +29 -8
- package/client/features/workspace/WorkspaceScreen.tsx +8 -14
- package/client/index.tsx +6 -1
- package/client/runtime/useWorkspaceEvents.ts +17 -0
- package/client/runtime/workspace-theme.ts +29 -6
- package/dist/chunk-5c19v3zr.js +10 -0
- package/dist/chunk-6wx91x8j.js +1 -0
- package/dist/chunk-8s41nd3g.js +1 -0
- package/dist/{chunk-6w6j9g4b.js → chunk-a7fzp0z0.js} +2 -2
- package/dist/{chunk-pp62fnxh.js → chunk-b959mdkj.js} +1 -1
- package/dist/chunk-cagtq45k.js +1 -0
- package/dist/chunk-cva7jpt4.js +82 -0
- package/dist/chunk-sapvd7he.css +1 -0
- package/dist/{chunk-sxc24vfp.js → chunk-zbeq02yc.js} +1 -1
- package/dist/chunk-zbt8emsw.js +2 -0
- package/dist/chunk-zfz3b4xg.js +2 -0
- package/dist/index.html +1 -1
- package/lib/types.ts +60 -41
- package/package.json +1 -1
- package/server/api.ts +69 -31
- package/server/app-config.ts +144 -0
- package/server/applets.ts +17 -0
- package/server/cli.ts +47 -11
- package/server/layout.ts +40 -45
- package/server/moi-scaffold.ts +37 -1
- package/server/thumbnails.ts +197 -0
- package/server/views.ts +10 -1
- package/server/widgets.ts +4 -18
- package/workspace/.claude/skills/moi-workspace/SKILL.md +13 -1
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +153 -253
- package/client/features/drawings/annotation-availability.ts +0 -10
- package/client/features/widgets/api.ts +0 -47
- package/client/features/widgets/useWidgetThumbnails.ts +0 -107
- package/client/features/widgets/widget-snapshot.ts +0 -71
- package/dist/chunk-3becmq75.js +0 -81
- package/dist/chunk-8ew39cvq.js +0 -10
- package/dist/chunk-c8gtrjwp.js +0 -1
- package/dist/chunk-v964b5g7.js +0 -1
- package/dist/chunk-zx33ts9d.css +0 -1
|
@@ -1,301 +1,201 @@
|
|
|
1
1
|
# moi applet design
|
|
2
2
|
|
|
3
|
-
This
|
|
4
|
-
|
|
5
|
-
|
|
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 host owns fonts and semantic color values.
|
|
9
|
-
Widgets and views resolve color tokens in different scopes, described below.
|
|
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, or satisfying
|
|
18
|
-
state change. It is optional. Use it when it helps the content and keep the rest restrained so it
|
|
19
|
-
remains meaningful. Avoid decorative clutter, competing effects, and a different visual system for
|
|
20
|
-
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
|
-
Widgets and views use the same semantic token vocabulary. Use
|
|
33
|
-
`h-full w-full bg-background text-foreground` for most applet roots. Each token keeps the same
|
|
34
|
-
purpose in both applet types; the host changes its value to suit the surrounding surface.
|
|
35
|
-
|
|
36
|
-
### How tokens resolve
|
|
37
|
-
|
|
38
|
-
- **Widgets:** The host applies a widget-local semantic theme derived from the selected workspace
|
|
39
|
-
color. `background` is the workspace `primary`, `foreground` is its paired readable color, and
|
|
40
|
-
the local `primary` pair becomes the light action surface derived from that color. The host frame
|
|
41
|
-
stays transparent, so every widget root must cover the full frame with an opaque background. An
|
|
42
|
-
image or visualization may own the surface when it has an opaque fallback.
|
|
43
|
-
- **Views:** Semantic tokens inherit the workspace page theme. The default root uses the normal
|
|
44
|
-
workspace page surface and text.
|
|
45
|
-
- **Portalled UI:** Menus, tooltips, and popovers render in workspace scope and keep
|
|
46
|
-
`bg-popover text-popover-foreground`.
|
|
47
|
-
|
|
48
|
-
### Semantic token reference
|
|
49
|
-
|
|
50
|
-
| Context or intent | Tailwind classes | Use |
|
|
51
|
-
| --- | --- | --- |
|
|
52
|
-
| Applet root | `bg-background text-foreground` | The full widget surface or view page |
|
|
53
|
-
| Main content | `text-foreground` | Titles, labels, values, and important icons |
|
|
54
|
-
| Supporting content | `text-muted-foreground` | Descriptions and secondary information |
|
|
55
|
-
| Inset surface | `bg-card text-card-foreground` | A functionally distinct contained region, used sparingly |
|
|
56
|
-
| Floating surface | `bg-popover text-popover-foreground` | Menus, tooltips, and other floating content |
|
|
57
|
-
| Quiet fill | `bg-muted` | Inset regions, skeletons, and disabled structure |
|
|
58
|
-
| Control state | `bg-accent text-accent-foreground` | Hover, active, and selected controls |
|
|
59
|
-
| Main action | `bg-primary text-primary-foreground hover:bg-primary/90` | The most important action in a local region |
|
|
60
|
-
| Positive or active state | `text-success` / `bg-success/10` | Positive outcomes, healthy states, presence, and progress indicators |
|
|
61
|
-
| Error or danger | `text-destructive` / `bg-destructive/10` | Errors, destructive actions, and invalid states |
|
|
62
|
-
| Object edge | `ring-1 ring-border` | Complete outlines around containers and controls |
|
|
63
|
-
| Focus | `focus-visible:ring-2 focus-visible:ring-ring` | Visible keyboard focus on interactive elements |
|
|
64
|
-
| Separator | `border-b border-border` | A one-sided division between adjacent regions |
|
|
65
|
-
|
|
66
|
-
Use lower opacity from the surface's foreground only for tertiary metadata that remains readable.
|
|
67
|
-
Avoid weak alpha text for important labels or values.
|
|
68
|
-
|
|
69
|
-
Prefer a subtle ring for the complete outline of a container or control. Use `ring-1 ring-border` on
|
|
70
|
-
semantic surfaces. Reserve one-sided borders such as `border-b` for separators between adjacent
|
|
71
|
-
regions. Never use a border and a ring on the same element. Avoid raw high-contrast colors for
|
|
72
|
-
either treatment.
|
|
73
|
-
|
|
74
|
-
Derive extra neutral or tonal colors and custom gradients from the local semantic tokens with
|
|
75
|
-
`color-mix()`. Use Tailwind palette colors only when they have clear content meaning, distinguish
|
|
76
|
-
infographic data, or follow an explicit user request. Keep each mapping consistent and explain it
|
|
77
|
-
with labels, legends, shapes, or direct values. Do not use palette colors for generic decoration or
|
|
78
|
-
unrelated widget backgrounds. Purple, violet, and fuchsia need a content, brand, or user reason;
|
|
79
|
-
never use a purple gradient as a default creativity or technology cue. On a saturated surface,
|
|
80
|
-
choose an explicit light or dark foreground with strong contrast.
|
|
81
|
-
|
|
82
|
-
### Surfaces and grouping
|
|
83
|
-
|
|
84
|
-
Use an open layout by default. Group content with spacing, alignment, type hierarchy, and, when
|
|
85
|
-
needed, a one-sided separator. Add one surface around content that shares a functional boundary: an
|
|
86
|
-
interactive object, an independently scrolling region, a distinct state, or a self-contained work
|
|
87
|
-
region. Page headers, tab rows, summaries, metrics, and ordinary sections stay unboxed by default.
|
|
88
|
-
Standard controls keep their normal component surfaces.
|
|
89
|
-
|
|
90
|
-
Never use a large rounded surface as a second page frame around the header, navigation, summary,
|
|
91
|
-
primary content, and supporting sections. Avoid adjacent or nested cards and wrappers that only
|
|
92
|
-
repeat the page structure.
|
|
93
|
-
|
|
94
|
-
Align page-level content to shared edges or grid columns. Apply outer padding once on the root or
|
|
95
|
-
layout grid, then use gaps to group unboxed content. When removing a surface, remove its card-like
|
|
96
|
-
padding and radius and realign its children; do not leave spacing that implies an invisible card.
|
|
3
|
+
This visual contract covers widgets and views inside a moi workspace. Applets may be expressive
|
|
4
|
+
while staying related to the calm host. This guide owns design decisions, `SKILL.md` owns
|
|
5
|
+
implementation, and the host owns fonts and semantic color values.
|
|
97
6
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
Texture is optional. Choose the root treatment after the content layout is clear, and use no more
|
|
101
|
-
than one texture per applet. Pair a texture with an opaque semantic base, such as
|
|
102
|
-
`h-full w-full bg-background text-foreground texture-checker`. The same classes resolve through the
|
|
103
|
-
widget-local theme or view page theme.
|
|
7
|
+
## Core principles and visual hierarchy
|
|
104
8
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
| Checker | `texture-checker` | Two softly tinted semantic squares with no empty cells |
|
|
108
|
-
| Grid | `texture-grid` | Fine semantic graph-paper lines over the base color |
|
|
109
|
-
| Noise | `texture-noise` | Foreground-tinted fractal grain that lets the base tint show through |
|
|
110
|
-
| Linear gradient | `texture-gradient-linear` | A restrained top-to-bottom wash derived from `primary` |
|
|
111
|
-
| Inset shadow | `texture-inset-shadow` | A soft edge glow derived from `primary` |
|
|
9
|
+
Design around the content and task. Give every applet one clear first reading, then add detail in
|
|
10
|
+
proportion to its purpose and space. Dense information needs hierarchy, alignment, and stable lanes.
|
|
112
11
|
|
|
113
|
-
|
|
114
|
-
|
|
12
|
+
An applet may have one expressive focal point, such as a visualization, image, strong surface, or
|
|
13
|
+
state change. Keep the rest restrained. Avoid decorative clutter and competing effects.
|
|
115
14
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
| Sparse content with large quiet areas | Any texture that preserves contrast |
|
|
120
|
-
| Dense content inside a functionally justified opaque or tonal work surface | A checker, grid, or noise texture may appear on the exposed background |
|
|
121
|
-
| Opaque full-bleed image, map, canvas, or visualization | No texture |
|
|
15
|
+
Every visible element must explain content, show a real state, or enable an action. Remove repeated
|
|
16
|
+
labels, obvious readiness badges, redundant helper copy, decorative status pills, and meaningless
|
|
17
|
+
icons. Relate a workspace's applets through typography, palette, spacing, or interaction patterns.
|
|
122
18
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
19
|
+
Lead with the main value, message, or task. Quiet supporting content and make tertiary metadata easy
|
|
20
|
+
to ignore. A widget may use one large hero value when its footprint supports it. When two elements
|
|
21
|
+
compete, reduce one.
|
|
126
22
|
|
|
127
|
-
|
|
128
|
-
tuning variables.
|
|
23
|
+
## Shared system
|
|
129
24
|
|
|
130
|
-
|
|
131
|
-
they remain distinct at a glance. A widget that opens, summarizes, or represents a view shares that
|
|
132
|
-
view's texture as part of the same visual language.
|
|
25
|
+
### Color and surfaces
|
|
133
26
|
|
|
134
|
-
|
|
27
|
+
Use `h-full w-full bg-background text-foreground` for most roots. Widgets and views share token
|
|
28
|
+
meaning while the host resolves their values differently:
|
|
135
29
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
30
|
+
- **Widgets:** `background` is the workspace `primary`, `foreground` is its readable pair, and the
|
|
31
|
+
local `primary` pair becomes a derived light action surface. The transparent host frame requires
|
|
32
|
+
an opaque root or an opaque fallback behind a full-bleed image or visualization.
|
|
33
|
+
- **Views:** tokens inherit the workspace page theme, so the default root matches the page.
|
|
34
|
+
- **Floating UI:** menus, tooltips, and popovers use `bg-popover text-popover-foreground` inside
|
|
35
|
+
the applet scope.
|
|
139
36
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
37
|
+
| Intent | Classes and guidance |
|
|
38
|
+
| --- | --- |
|
|
39
|
+
| Main content | `text-foreground` for titles, labels, values, and important icons |
|
|
40
|
+
| Supporting content | `text-muted-foreground` for descriptions and secondary information |
|
|
41
|
+
| Inset surface | `bg-card text-card-foreground`, used only for a distinct functional region |
|
|
42
|
+
| Quiet fill | `bg-muted` for inset regions, skeletons, and disabled structure |
|
|
43
|
+
| Control state | `bg-accent text-accent-foreground` for hover, active, and selected controls |
|
|
44
|
+
| Main action | `bg-primary text-primary-foreground hover:bg-primary/90` |
|
|
45
|
+
| State | Views may use `text-success`, `bg-success/10`, `text-destructive`, or `bg-destructive/10`; widgets use `text-foreground`. Add clear wording and, when useful, an icon or shape. |
|
|
46
|
+
| Object edge | `ring-1 ring-border` for complete container and control outlines |
|
|
47
|
+
| Focus | `focus-visible:ring-2 focus-visible:ring-ring` |
|
|
48
|
+
| Separator | A one-sided border such as `border-b border-border` between adjacent regions |
|
|
49
|
+
|
|
50
|
+
Use lower foreground opacity only for readable tertiary metadata. Important text needs full
|
|
51
|
+
contrast. Saturated surfaces need an explicit readable light or dark foreground. Never rely on
|
|
52
|
+
color alone.
|
|
53
|
+
|
|
54
|
+
Use rings for complete outlines and one-sided borders for separators; never combine both. Keep
|
|
55
|
+
edges subtle and avoid raw high-contrast colors. Derive tonal colors and custom gradients from
|
|
56
|
+
local tokens with `color-mix()`. Tailwind palette colors need a content, data, brand, or user reason.
|
|
57
|
+
Explain consistent data mappings with labels, legends, shapes, or values. Never use palette colors
|
|
58
|
+
for generic decoration or unrelated widget backgrounds. Purple, violet, and fuchsia also need a
|
|
59
|
+
reason and never act as a default creativity or technology cue.
|
|
60
|
+
|
|
61
|
+
Use an open layout. Group with spacing, alignment, type, and occasional separators. Add a surface
|
|
62
|
+
only around an interactive object, independent scroller, distinct state, or self-contained work
|
|
63
|
+
area. Standard controls keep their surfaces; headers, tabs, summaries, metrics, and ordinary
|
|
64
|
+
sections stay unboxed.
|
|
65
|
+
|
|
66
|
+
Avoid large rounded page frames, adjacent or nested cards, and structural wrappers. Align content
|
|
67
|
+
to shared edges or grid columns. Apply outer padding once, then use gaps. Removing a surface also
|
|
68
|
+
means removing its card-like padding and radius and realigning its children.
|
|
69
|
+
|
|
70
|
+
### Stacking and overlays
|
|
71
|
+
|
|
72
|
+
Use DOM order for normal stacking: later siblings appear above earlier ones. Avoid z-index for
|
|
73
|
+
ordinary layout. When floating UI must escape clipping or a local stacking context, portal it into
|
|
74
|
+
the closest `[data-applet]` root to preserve applet scope and theme tokens. Never portal applet UI
|
|
75
|
+
to `document.body`.
|
|
76
|
+
|
|
77
|
+
Add a local, minimal z-index only when DOM order and a scoped portal cannot solve the stacking need.
|
|
78
|
+
Several layers or escalating values mean the layout structure needs reconsideration.
|
|
143
79
|
|
|
144
|
-
|
|
145
|
-
near-identical text styles that make hierarchy hard to read.
|
|
80
|
+
### Textures
|
|
146
81
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
A stronger display treatment may lead a widget or view when it serves the content, but it should not
|
|
151
|
-
become a separate type system. Keep no more than two clear type roles in one applet.
|
|
82
|
+
Texture is optional and belongs only on the applet root. Choose it after the content layout is
|
|
83
|
+
clear, use at most one, and pair it with an opaque semantic base such as
|
|
84
|
+
`bg-background text-foreground texture-checker`.
|
|
152
85
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
one.
|
|
86
|
+
Available treatments are `texture-checker`, `texture-grid`, `texture-noise`,
|
|
87
|
+
`texture-gradient-linear`, and `texture-inset-shadow`. They use semantic colors without replacing
|
|
88
|
+
the base background color.
|
|
157
89
|
|
|
158
|
-
|
|
90
|
+
Match treatment to density. Dense root content uses plain `bg-background`,
|
|
91
|
+
`texture-gradient-linear`, or `texture-inset-shadow`; sparse content may use any readable texture.
|
|
92
|
+
Checker, grid, or noise may surround dense content only when it already needs an opaque or tonal
|
|
93
|
+
work surface. Full-bleed images, maps, canvases, and visualizations use no texture.
|
|
159
94
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
95
|
+
Never add wrappers to rescue a busy texture; choose a quieter root. Do not texture cards, panels,
|
|
96
|
+
controls, or text regions, stack textures, or add tuning variables. Check nearby applets: unrelated
|
|
97
|
+
applets use different textures, while a widget representing a view shares its texture. Any texture
|
|
98
|
+
should become easy to ignore while reading.
|
|
163
99
|
|
|
164
|
-
|
|
165
|
-
trailing actions in stable lanes so changing values do not shift the layout.
|
|
100
|
+
### Type, spacing, and shape
|
|
166
101
|
|
|
167
|
-
|
|
102
|
+
Inherit the workspace font and use sentence case. Use regular weight for most text and medium for
|
|
103
|
+
emphasis; other weights are reserved for owner hand-tuning. `text-sm` (14 px) is the UI default.
|
|
104
|
+
Use smaller text for compact metadata and larger text for headings or one display value. Keep at
|
|
105
|
+
most two clear type roles and avoid near-identical label styles.
|
|
168
106
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
`
|
|
172
|
-
real pills, circular buttons, avatars, and status dots. Controls and rectangular content regions
|
|
173
|
-
must not look capsule-shaped.
|
|
107
|
+
Reserve `font-mono` for code, commands, and code-like identifiers. Numeric values, measurements,
|
|
108
|
+
percentages, timers, timestamps, prices, counts, and labels use the workspace font. Add
|
|
109
|
+
`tabular-nums` when stable widths or alignment help.
|
|
174
110
|
|
|
175
|
-
|
|
111
|
+
Follow a 4 px spacing rhythm: 4–8 px within a tight group, 12–16 px between groups in a region, and
|
|
112
|
+
24 px or more at section changes in larger applets. Prefer spacing over dividers. Keep repeated
|
|
113
|
+
rows, chart labels, status markers, counters, and trailing actions in stable lanes so changing
|
|
114
|
+
values do not shift the layout.
|
|
176
115
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
116
|
+
Use the shared shadcn radius scale and default control radii. Use `rounded-lg` or `rounded-xl` for
|
|
117
|
+
ordinary regions, `rounded-2xl` or `rounded-3xl` for one focal surface, and `rounded-full` only for
|
|
118
|
+
real pills, circles, avatars, and status dots. Rectangular controls must not become capsules.
|
|
180
119
|
|
|
181
|
-
|
|
182
|
-
visible focus state and an accessible name. Use Tabler icons with consistent visual weight. Do not
|
|
183
|
-
rely on color alone, and keep charts understandable with labels, legends, patterns, or direct values
|
|
184
|
-
where needed.
|
|
120
|
+
### Interaction, motion, and states
|
|
185
121
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
122
|
+
Controls must be obvious, keyboard-operable, comfortably sized, visibly focused, and accessibly
|
|
123
|
+
named. Use Tabler icons with consistent visual weight. Keep charts understandable through labels,
|
|
124
|
+
legends, patterns, or direct values as needed.
|
|
189
125
|
|
|
190
|
-
|
|
126
|
+
Use short, interruptible motion for meaningful state changes and control feedback. Respect reduced
|
|
127
|
+
motion and prefer transform and opacity. Avoid looping decoration and animation on frequently
|
|
128
|
+
updating numbers. Audio and video must be user-initiated.
|
|
191
129
|
|
|
192
|
-
Design
|
|
193
|
-
Data-driven applets need the following when applicable:
|
|
130
|
+
Design only states the applet can reach. For data-driven applets, handle these when applicable:
|
|
194
131
|
|
|
195
|
-
- **Loading:**
|
|
196
|
-
|
|
197
|
-
- **Error:** explain the problem in one human sentence and
|
|
198
|
-
- **Empty:**
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
- **Stale:** show a quiet timestamp or status near the affected data
|
|
202
|
-
- **Disabled:** preserve the label and structure while making
|
|
203
|
-
|
|
132
|
+
- **Loading:** preserve the final layout and surface with a matching skeleton. Use a spinner only
|
|
133
|
+
for compact inline work or work without a meaningful content shape.
|
|
134
|
+
- **Error:** explain the problem in one human sentence and offer retry or a clear recovery action.
|
|
135
|
+
- **Empty:** explain the absence briefly and provide a useful next step; never leave a data region
|
|
136
|
+
blank.
|
|
137
|
+
- **Refreshing:** keep current data visible and show progress on the refresh control.
|
|
138
|
+
- **Stale:** show a quiet, current timestamp or status near the affected data.
|
|
139
|
+
- **Disabled:** preserve the label and structure while making unavailability clear without color
|
|
140
|
+
alone.
|
|
204
141
|
|
|
205
|
-
Keep
|
|
206
|
-
and
|
|
207
|
-
|
|
208
|
-
surface in the same position and size.
|
|
142
|
+
Keep loading, populated, empty, success, and error layouts stable. A primary surface remains in the
|
|
143
|
+
same position and size through those states. Errors and empty states must fit the configured Widget
|
|
144
|
+
height or the View's normal content frame.
|
|
209
145
|
|
|
210
146
|
## Widgets
|
|
211
147
|
|
|
212
|
-
Widgets are compact dashboard surfaces seen
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
### Frame
|
|
217
|
-
|
|
218
|
-
The host card owns the outer radius, border, shadow, clipping, and elevation. It leaves the inside
|
|
219
|
-
transparent. The widget root fills that rectangle and adds no outer card chrome. Its surface follows
|
|
220
|
-
the color guidance above.
|
|
221
|
-
|
|
222
|
-
Use a column layout when content needs a footer or timestamp, and keep lower-priority information at
|
|
223
|
-
the bottom. Important content needs safe padding from every edge. Use `p-4` as the compact default;
|
|
224
|
-
`p-5` suits larger footprints when the content still fits.
|
|
148
|
+
Widgets are compact dashboard surfaces seen beside other widgets. Their main meaning should be
|
|
149
|
+
clear in a quick scan. Larger footprints may add charts, lists, metadata, filters, and direct
|
|
150
|
+
actions while preserving one first reading.
|
|
225
151
|
|
|
226
|
-
|
|
152
|
+
The host card owns outer radius, border, shadow, clipping, and elevation. Its interior is
|
|
153
|
+
transparent. Fill it with an opaque `h-full w-full` root and add no outer card chrome. Use `p-4` as
|
|
154
|
+
the compact padding default or `p-5` for larger footprints when content still fits. Use a column
|
|
155
|
+
layout when content needs a footer or timestamp and keep lower-priority information at the bottom.
|
|
227
156
|
|
|
228
|
-
The
|
|
229
|
-
|
|
230
|
-
selected row span.
|
|
231
|
-
|
|
232
|
-
The exact height is:
|
|
157
|
+
The grid has four columns, 160 px rows, 8 px gaps, and a maximum width of 640 px. A Widget may span
|
|
158
|
+
one to four rows and columns. Width shrinks with the workspace; height remains fixed by row span:
|
|
233
159
|
|
|
234
160
|
`rowSpan × 160 + (rowSpan − 1) × 8`
|
|
235
161
|
|
|
236
|
-
Common maximum sizes are:
|
|
237
|
-
|
|
238
|
-
| Footprint | Maximum outer size | Approximate content after `p-4` |
|
|
239
|
-
| --- | --- | --- |
|
|
240
|
-
| 1 × 1 | 154 × 160 px | 122 × 128 px |
|
|
241
|
-
| 2 × 1 | 316 × 160 px | 284 × 128 px |
|
|
242
|
-
| 2 × 2 | 316 × 328 px | 284 × 296 px |
|
|
243
|
-
| 4 × 2 | 640 × 328 px | 608 × 296 px |
|
|
244
|
-
| 4 × 3 | 640 × 496 px | 608 × 464 px |
|
|
245
|
-
| 4 × 4 | 640 × 664 px | 608 × 632 px |
|
|
246
|
-
|
|
247
162
|
Treat width as flexible and height as the hard constraint. Start with the smallest footprint that
|
|
248
|
-
presents the content clearly. Test the narrowest realistic width and
|
|
249
|
-
Clip decorative overflow deliberately, clamp supporting prose, and
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
### Composition
|
|
163
|
+
presents the content clearly. Test the narrowest realistic width and longest realistic values.
|
|
164
|
+
Clip decorative overflow deliberately, clamp supporting prose, and prevent horizontal page scroll
|
|
165
|
+
and accidental inner page scrolling.
|
|
253
166
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
multi-step flows usually indicate that the content should become a view.
|
|
167
|
+
A small Widget has one primary element and at most two supporting groups. Larger footprints may
|
|
168
|
+
carry more when hierarchy remains clear. Prefer live information over labels that repeat context.
|
|
169
|
+
Limit controls to the immediate task: filters, toggles, refresh actions, and links are appropriate.
|
|
170
|
+
Keep feedback on the control and leave the Widget surface unchanged on hover. Tabs, wizards,
|
|
171
|
+
multi-step workflows, and deep navigation belong in a View.
|
|
260
172
|
|
|
261
173
|
## Views
|
|
262
174
|
|
|
263
|
-
Views are full app screens for denser information and sustained work. They own
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
One view represents one screen. Cross-screen navigation belongs to the workspace. Internal tabs,
|
|
268
|
-
filters, or a master-detail split may organize the current task without introducing a separate
|
|
269
|
-
client-side routing system.
|
|
175
|
+
Views are full app screens for denser information and sustained work. They own page hierarchy,
|
|
176
|
+
layout, spacing, chrome, and scrolling. A View must remain complete and usable at the available
|
|
177
|
+
width, including when chat shares the workspace.
|
|
270
178
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
179
|
+
One View represents one screen. Cross-screen navigation belongs to the workspace. Internal tabs,
|
|
180
|
+
filters, and master-detail layouts may organize the current task without adding a client-side
|
|
181
|
+
router.
|
|
274
182
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
183
|
+
Let content choose the frame. Most Views need clear page context, a primary work area, and an
|
|
184
|
+
obvious place for the main action. A title with an optional subtitle or action is a useful default;
|
|
185
|
+
a canvas, map, or immersive visualization may establish context another way.
|
|
278
186
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
187
|
+
Use consistent page padding such as 24 or 32 px. Constrain prose, forms, and narrow task flows to a
|
|
188
|
+
readable maximum width. Let tables, boards, maps, and visual workspaces use more of the frame when
|
|
189
|
+
the task benefits.
|
|
282
190
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
191
|
+
Prefer one main page scroller. Use bounded internal scrolling only where independent position helps,
|
|
192
|
+
such as a sticky table body, timeline, or board. Never create horizontal page scroll. Views may use
|
|
193
|
+
more sections, controls, and information layers than Widgets while keeping one primary work area;
|
|
194
|
+
do not stretch a Widget-like card to fill the page.
|
|
286
195
|
|
|
287
196
|
## Final review
|
|
288
197
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
Before finishing an applet, confirm:
|
|
294
|
-
|
|
295
|
-
- The first reading and every visible element have a clear purpose.
|
|
296
|
-
- Color, texture, type, spacing, and expression support the content and remain readable.
|
|
297
|
-
- Surfaces mark real boundaries, and unboxed page content shares clear alignment axes.
|
|
298
|
-
- States remain stable, and the layout handles realistic content and deliberate overflow.
|
|
299
|
-
- Controls are necessary, complete, and accessible.
|
|
300
|
-
- The widget or view follows its frame, sizing, and scrolling rules and feels related to the
|
|
301
|
-
workspace.
|
|
198
|
+
Remove elements and wrappers that do not improve understanding, action, or state recognition, then
|
|
199
|
+
realign what remains. Confirm the first reading is clear; the visual system stays readable and
|
|
200
|
+
purposeful; realistic content and reachable states fit without overflow or jumps; controls are
|
|
201
|
+
necessary and accessible; and the applet follows its Widget or View contract.
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { WorkspaceTabId } from '@/lib/types'
|
|
2
|
-
|
|
3
|
-
export function canAnnotateWorkspaceContent(
|
|
4
|
-
activeTab: WorkspaceTabId,
|
|
5
|
-
widgetControlsIdle: boolean,
|
|
6
|
-
hasBuiltView: boolean
|
|
7
|
-
): boolean {
|
|
8
|
-
if (!widgetControlsIdle) return false
|
|
9
|
-
return activeTab === 'widgets' || (activeTab.startsWith('view:') && hasBuiltView)
|
|
10
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
|
2
|
-
|
|
3
|
-
import { jsonRequest, requestVoid } from '@/client/api/http'
|
|
4
|
-
import { workspaceKeys } from '@/client/api/workspace-keys'
|
|
5
|
-
import type { WorkspaceLayoutResponse } from '@/client/features/workspace/api'
|
|
6
|
-
|
|
7
|
-
export type SaveWidgetThumbnailsInput = {
|
|
8
|
-
// Fingerprint of the grid state the set was captured from — see
|
|
9
|
-
// widgetThumbnailsKey().
|
|
10
|
-
key: string
|
|
11
|
-
// Widget id → WebP data URL. Merged server-side, never pruned.
|
|
12
|
-
thumbnails: Record<string, string>
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Persist captured widget thumbnails. Separate from the layout PUT so grid and
|
|
16
|
-
// theme saves never carry the base64 map; the server merges the entries into
|
|
17
|
-
// `.workspace.json` (PUT /api/workspaces/:id/thumbnails).
|
|
18
|
-
//
|
|
19
|
-
// The local layout cache gets the new key in onMutate, deliberately WITHOUT a
|
|
20
|
-
// rollback on error: a failed save must read as fresh locally, or the capture
|
|
21
|
-
// hook would re-run a full pass every SETTLE_MS until the server recovers.
|
|
22
|
-
// Worst case the thumbnails are re-captured after a reload.
|
|
23
|
-
export function useSaveWidgetThumbnails(workspaceId: string) {
|
|
24
|
-
const queryClient = useQueryClient()
|
|
25
|
-
return useMutation<void, Error, SaveWidgetThumbnailsInput>({
|
|
26
|
-
mutationFn: ({ key, thumbnails }) =>
|
|
27
|
-
requestVoid(
|
|
28
|
-
`/api/workspaces/${workspaceId}/thumbnails`,
|
|
29
|
-
jsonRequest('PUT', { key, thumbnails }),
|
|
30
|
-
'Failed to save thumbnails'
|
|
31
|
-
),
|
|
32
|
-
onMutate: ({ key }) => {
|
|
33
|
-
// The timestamp too — without it the cached layout keeps the old age
|
|
34
|
-
// and the capture hook would immediately re-run the pass. The server
|
|
35
|
-
// stamps its own clock on disk; this local echo holds until a refetch.
|
|
36
|
-
queryClient.setQueryData<WorkspaceLayoutResponse>(workspaceKeys.layout(workspaceId), prev =>
|
|
37
|
-
prev ? { ...prev, widgetThumbnails: { key, at: new Date().toISOString() } } : prev
|
|
38
|
-
)
|
|
39
|
-
},
|
|
40
|
-
onSuccess: () => {
|
|
41
|
-
// The home card's preview is served from what this PUT just wrote; its
|
|
42
|
-
// query has a staleTime, so without an explicit invalidation a quick
|
|
43
|
-
// hop back to the home screen would keep showing the pre-capture state.
|
|
44
|
-
queryClient.invalidateQueries({ queryKey: workspaceKeys.preview(workspaceId) })
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
}
|