moi-computer 0.9.1-next.0 → 0.9.1-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/client/api/app-config.ts +51 -0
  2. package/client/api/workspace-keys.ts +1 -0
  3. package/client/app/routes/WorkspaceRoute.tsx +4 -2
  4. package/client/components/ui/button.tsx +1 -1
  5. package/client/features/applets/api.ts +38 -0
  6. package/client/features/applets/applet-thumbnail.ts +208 -0
  7. package/client/features/chat/ChatEmptyState.tsx +5 -3
  8. package/client/features/chat/ChatPanel.tsx +2 -8
  9. package/client/features/chat/ChatSelector.tsx +29 -10
  10. package/client/features/chat/MarkdownContent.tsx +2 -2
  11. package/client/features/home/HomePage.tsx +13 -0
  12. package/client/features/home/WorkspacePreview.tsx +51 -33
  13. package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +9 -0
  14. package/client/features/home/workspace-setup/InstallMoiDialog.tsx +245 -0
  15. package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +1 -1
  16. package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +1 -1
  17. package/client/features/views/ViewBuilder.tsx +18 -4
  18. package/client/features/views/ViewManager.tsx +18 -2
  19. package/client/features/widgets/WidgetFrame.tsx +1 -1
  20. package/client/features/widgets/WidgetGrid.tsx +1 -1
  21. package/client/features/widgets/Widgets.tsx +16 -15
  22. package/client/features/workspace/CustomizePanel.tsx +29 -8
  23. package/client/features/workspace/WorkspaceScreen.tsx +8 -14
  24. package/client/index.tsx +6 -1
  25. package/client/runtime/useWorkspaceEvents.ts +17 -0
  26. package/client/runtime/workspace-theme.ts +36 -6
  27. package/dist/chunk-87q78504.js +1 -0
  28. package/dist/chunk-8s41nd3g.js +1 -0
  29. package/dist/{chunk-pp62fnxh.js → chunk-b959mdkj.js} +1 -1
  30. package/dist/chunk-cagtq45k.js +1 -0
  31. package/dist/chunk-ek6zde7t.js +10 -0
  32. package/dist/chunk-n8tq2494.js +82 -0
  33. package/dist/chunk-v82nefjq.css +1 -0
  34. package/dist/{chunk-sxc24vfp.js → chunk-zbeq02yc.js} +1 -1
  35. package/dist/chunk-zbt8emsw.js +2 -0
  36. package/dist/{chunk-6w6j9g4b.js → chunk-zcyvyebg.js} +2 -2
  37. package/dist/chunk-zfz3b4xg.js +2 -0
  38. package/dist/index.html +1 -1
  39. package/lib/themes.ts +4 -4
  40. package/lib/types.ts +60 -41
  41. package/package.json +1 -1
  42. package/server/api.ts +69 -31
  43. package/server/app-config.ts +144 -0
  44. package/server/applets.ts +17 -0
  45. package/server/cli.ts +47 -11
  46. package/server/layout.ts +40 -45
  47. package/server/moi-scaffold.ts +37 -1
  48. package/server/session-config.ts +3 -13
  49. package/server/thumbnails.ts +197 -0
  50. package/server/views.ts +10 -1
  51. package/server/widgets.ts +4 -18
  52. package/workspace/.claude/skills/moi-workspace/SKILL.md +13 -1
  53. package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +153 -253
  54. package/client/features/drawings/annotation-availability.ts +0 -10
  55. package/client/features/widgets/api.ts +0 -47
  56. package/client/features/widgets/useWidgetThumbnails.ts +0 -107
  57. package/client/features/widgets/widget-snapshot.ts +0 -71
  58. package/dist/chunk-3becmq75.js +0 -81
  59. package/dist/chunk-8ew39cvq.js +0 -10
  60. package/dist/chunk-c8gtrjwp.js +0 -1
  61. package/dist/chunk-v964b5g7.js +0 -1
  62. package/dist/chunk-zx33ts9d.css +0 -1
@@ -1,301 +1,201 @@
1
1
  # moi applet design
2
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 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
- ### Textures
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
- | Texture | Tailwind class | Character |
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
- Textures add an effect without setting `background-color`; the base color remains visible through
114
- them. Match the frequency of the background to the density of the content:
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
- | Content and layout | Root treatment |
117
- | --- | --- |
118
- | Dense content placed directly on the root, such as tables, long lists, forms, detailed charts, or multi-column dashboards | Plain `bg-background`, `texture-gradient-linear`, or `texture-inset-shadow` |
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
- Never place `texture-checker`, `texture-grid`, or `texture-noise` directly behind dense open content.
124
- Do not add cards or solid wrappers only to make a busy texture readable; choose a quieter root
125
- treatment instead. A texture should become easy to ignore while reading.
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
- Do not apply a texture to a card, panel, control, or text region, and do not stack textures or add
128
- tuning variables.
23
+ ## Shared system
129
24
 
130
- Check nearby widgets and views before choosing one. Give unrelated applets different textures so
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
- ## Typography and hierarchy
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
- Inherit the workspace font. Use sentence case for headings, labels, actions, and navigation. Use
137
- regular weight for most text and medium for emphasis. Other weights are reserved for owner
138
- hand-tuning.
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
- Use a small, consistent type scale. `text-sm` (14 px) is the default for UI text. Use smaller text
141
- only for genuinely compact metadata and larger text only for clear headings or one meaningful
142
- display value. Do not create many label styles with slightly different sizes.
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
- Keep text contrast clear and follow the foreground pairing for the chosen surface. Avoid several
145
- near-identical text styles that make hierarchy hard to read.
80
+ ### Textures
146
81
 
147
- Reserve `font-mono` for code, command text, and truly code-like identifiers. Do not use monospace for
148
- numeric UI values, measurements, percentages, timers, timestamps, prices, counts, or labels. Numbers
149
- inherit the workspace's default font; add `tabular-nums` when stable digit widths or alignment help.
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
- Build hierarchy with a visible size gap. Give the main value, message, or task the strongest
154
- emphasis, keep supporting content quieter, and make tertiary metadata easy to ignore. A widget may
155
- use a large hero value when its footprint supports it. If two elements compete for attention, reduce
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
- Use a 4 px spacing rhythm. As a guide:
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
- - 4–8 px keeps tightly related items together.
161
- - 12–16 px separates groups within a region.
162
- - 24 px or more marks a section change in larger widgets and views.
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
- Prefer spacing over dividers. Keep repeated rows, chart labels, status markers, counters, and
165
- trailing actions in stable lanes so changing values do not shift the layout.
100
+ ### Type, spacing, and shape
166
101
 
167
- ## Shape and radius
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
- Use the shared shadcn radius scale and keep its default radius on standard controls. Ordinary cards,
170
- fields, list rows, and repeated sections should use `rounded-lg` or `rounded-xl`. Reserve
171
- `rounded-2xl` and `rounded-3xl` for one expressive focal surface, and use `rounded-full` only for
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
- ## Interaction and motion
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
- Widgets may include compact controls such as filters, toggles, refresh actions, and links. Keep
178
- interaction feedback on the control that performs the action. The widget surface stays unchanged on
179
- hover. Multi-step workflows and deep navigation belong in a view.
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
- Controls must be obvious, keyboard-operable, and large enough to use comfortably. Give them a
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
- Use short, interruptible motion for meaningful state changes and control feedback. Respect
187
- reduced-motion preferences and animate transform and opacity where possible. Do not loop decorative
188
- motion or animate frequently updating numbers. Audio and video must be user-initiated.
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
- ## States
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 every state the applet can actually reach. Static applets do not need invented async states.
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:** show a skeleton that mirrors the final layout and preserves its surface. Use a spinner
196
- only for a compact inline action or work with no meaningful content shape.
197
- - **Error:** explain the problem in one human sentence and provide a retry or clear recovery action.
198
- - **Empty:** show a short explanation and a useful next step. Never leave a data region blank.
199
- - **Refreshing:** keep current data visible and show progress on the refresh action. Do not replace
200
- useful content with the initial loading state.
201
- - **Stale:** show a quiet timestamp or status near the affected data and keep it current.
202
- - **Disabled:** preserve the label and structure while making the unavailable state clear without
203
- relying on color alone.
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 state layouts stable so loading, success, empty, and error do not cause avoidable jumps. Errors
206
- and empty states should still fit the configured widget height or the view's normal content frame.
207
- When a primary region uses a surface, loading, populated, empty, success, and error states keep that
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 alongside other widgets. They should reveal their main
213
- meaning within a quick scan. Larger widgets may add supporting charts, lists, metadata, filters, and
214
- direct actions while keeping one clear first reading.
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
- ### Grid and sizing
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 dashboard grid has four columns, 160 px rows, 8 px gaps, and a maximum width of 640 px. A widget
229
- may span one to four rows and columns. Width shrinks with the workspace; height stays fixed by the
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 the longest realistic values.
249
- Clip decorative overflow deliberately, clamp supporting prose, and keep the widget itself from
250
- creating horizontal page scroll or an accidental inner page scroller.
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
- Give the eye one primary element and no more than two supporting groups in a small widget. Larger
255
- footprints may carry more information when spacing and alignment preserve the first reading. Prefer
256
- live information over labels that repeat obvious context.
257
-
258
- Keep controls limited to the immediate task. A compact mode switch can work; tabs, wizards, and
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 their page hierarchy,
264
- content layout, spacing, chrome, and scrolling. A view should feel complete at the available size and
265
- remain usable when the chat shares the workspace.
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
- Let the content choose the frame. Most views need clear page context, a primary work area, and an
272
- obvious place for the main action. A header with a title and optional subtitle or action is a useful
273
- default. A canvas, map, or immersive data surface may establish context another way.
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
- Use generous, consistent page padding such as 24 or 32 px for normal views. Constrain prose, forms,
276
- and narrow task flows to a readable maximum width. Let tables, boards, maps, and visual workspaces use
277
- more of the frame when that improves the task.
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
- Prefer one main page scroller. Use bounded internal scrolling only for regions that benefit from
280
- independent position, such as a sticky table body, timeline, or board. The page itself must not
281
- create horizontal scroll.
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
- Views and widgets share the same color, type, motion, and state vocabulary. Views may use more
284
- sections, controls, and information layers while preserving a clear primary work area. Avoid
285
- stretching a widget-like card to fill the page.
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
- After implementation, do a removal pass from top to bottom. For every visible element and wrapper,
290
- ask what it helps the user understand, do, or recognize as a state. Remove it when the screen stays
291
- clear without it, then realign the remaining content.
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
- }