@dexhq/canvas 0.13.0 → 0.14.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/CHANGELOG.md +17 -0
- package/README.md +16 -15
- package/app/canvas/frame-node.tsx +34 -17
- package/app/canvas/tool-cursors.ts +16 -16
- package/app/i18n/locales/en/messages.po +26 -4
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +26 -4
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/{sets/lucide.tsx → glyphs.tsx} +3 -5
- package/app/icons/index.tsx +3 -3
- package/app/icons/types.ts +3 -10
- package/app/index.html +3 -3
- package/app/pages/canvas-settings.tsx +35 -0
- package/app/shell/about.tsx +5 -4
- package/app/shell/feedback-details.ts +0 -3
- package/app/shell/instructions-editor.tsx +1 -1
- package/app/shell/presence-style.ts +59 -0
- package/app/shell/presence.tsx +6 -3
- package/app/shell/settings-sections.ts +12 -0
- package/app/shell/sidebar.tsx +1 -1
- package/app/studio-ui.d.ts +0 -9
- package/app/ui/prompt-editor.tsx +1 -1
- package/dist/cli/commands/create.d.mts +26 -14
- package/dist/cli/commands/create.mjs +13 -7
- package/dist/cli/commands/dev.mjs +2 -3
- package/dist/cli/commands/init.d.mts +11 -6
- package/dist/cli/help.d.mts +1 -1
- package/dist/cli/help.mjs +3 -3
- package/dist/cli/main.d.mts +22 -12
- package/dist/config/index.d.mts +6 -5
- package/dist/config/project-files.d.mts +0 -3
- package/dist/config/project-files.mjs +0 -3
- package/dist/config/schema.d.mts +0 -5
- package/dist/config/schema.mjs +0 -5
- package/dist/content/content.mjs +0 -3
- package/dist/content/snapshot-client.mjs +1 -1
- package/dist/paste/paste.mjs +1 -1
- package/dist/server/brief.mjs +3 -3
- package/dist/server/channel.d.mts +6 -0
- package/dist/server/channel.mjs +16 -1
- package/dist/server/claimed-presence.d.mts +17 -0
- package/dist/server/claimed-presence.mjs +50 -0
- package/dist/server/dev-server.mjs +9 -0
- package/dist/server/file-errors.d.mts +7 -2
- package/dist/server/file-errors.mjs +31 -8
- package/dist/server/requests.mjs +1 -1
- package/dist/server/studio-for.mjs +1 -1
- package/dist/server/vite.mjs +26 -29
- package/dist/server/web-app.mjs +3 -3
- package/dist/setup/apply.mjs +8 -14
- package/dist/setup/create.mjs +51 -19
- package/dist/setup/desktop-app.mjs +1 -1
- package/dist/setup/detect.d.mts +14 -5
- package/dist/setup/detect.mjs +56 -8
- package/dist/setup/doctor.mjs +1 -3
- package/dist/setup/existing-setup.d.mts +1 -3
- package/dist/setup/existing-setup.mjs +10 -11
- package/dist/setup/own-app.d.mts +1 -2
- package/dist/setup/own-app.mjs +4 -5
- package/dist/setup/plan.d.mts +8 -6
- package/dist/setup/plan.mjs +64 -48
- package/dist/setup/project.d.mts +0 -16
- package/dist/setup/project.mjs +8 -52
- package/dist/setup/prompts.d.mts +5 -5
- package/dist/setup/prompts.mjs +28 -61
- package/dist/setup/questions.d.mts +12 -4
- package/dist/setup/questions.mjs +10 -25
- package/dist/setup/starters.mjs +19 -8
- package/dist/setup/workspace-setup.d.mts +1 -2
- package/dist/setup/workspace-setup.mjs +4 -6
- package/dist/setup/write.d.mts +15 -5
- package/dist/setup/write.mjs +35 -9
- package/dist/shared/server-page.mjs +6 -0
- package/extension/dist/feedback.js +1 -1
- package/extension/dist/manifest.json +1 -1
- package/package.json +2 -19
- package/src/cli/commands/create.ts +17 -9
- package/src/cli/commands/dev.ts +0 -3
- package/src/cli/help.ts +3 -3
- package/src/config/index.ts +6 -5
- package/src/config/project-files.ts +0 -5
- package/src/config/schema.ts +0 -1
- package/src/content/content.ts +0 -3
- package/src/content/snapshot-client.ts +1 -1
- package/src/server/brief.ts +8 -3
- package/src/server/channel.ts +27 -0
- package/src/server/claimed-presence.ts +77 -0
- package/src/server/dev-server.ts +13 -0
- package/src/server/file-errors.ts +47 -13
- package/src/server/studio-for.ts +1 -1
- package/src/server/vite.ts +37 -40
- package/src/server/web-app.ts +3 -3
- package/src/setup/apply.ts +10 -16
- package/src/setup/create.ts +52 -20
- package/src/setup/desktop-app.ts +1 -1
- package/src/setup/detect.ts +56 -10
- package/src/setup/doctor.ts +4 -4
- package/src/setup/existing-setup.ts +10 -12
- package/src/setup/own-app.ts +2 -5
- package/src/setup/plan.ts +93 -84
- package/src/setup/project.ts +16 -110
- package/src/setup/prompts.ts +44 -127
- package/src/setup/questions.ts +27 -29
- package/src/setup/starters.ts +27 -9
- package/src/setup/workspace-setup.ts +8 -18
- package/src/setup/write.ts +52 -9
- package/src/shared/server-page.ts +9 -0
- package/templates/methods/review.md +2 -2
- package/templates/rules/canvas-frames.md +104 -0
- package/templates/rules/canvas.md +8 -142
- package/templates/rules/prototypes.md +1 -1
- package/templates/rules/snapshots.md +52 -0
- package/templates/starters/standalone/README.md +7 -7
- package/templates/starters/standalone/components.json +1 -1
- package/templates/starters/standalone/package.json +1 -2
- package/templates/starters/turborepo/README.md +6 -6
- package/templates/starters/turborepo/apps/web/components.json +1 -1
- package/templates/starters/turborepo/apps/web/package.json +1 -2
- package/templates/starters/turborepo/apps/web/src/app.tsx +4 -5
- package/templates/starters/turborepo/packages/ui/components.json +1 -1
- package/templates/starters/turborepo/packages/ui/package.json +1 -2
- package/templates/starters/vite/README.md +7 -6
- package/templates/starters/vite/components.json +1 -1
- package/templates/starters/vite/package.json +1 -2
- package/templates/starters/vite/src/app.tsx +3 -4
- package/templates/starters/vite/src/components/ui/accordion.tsx +71 -0
- package/templates/starters/vite/src/components/ui/attachment.tsx +1 -1
- package/templates/starters/vite/src/components/ui/badge.tsx +2 -2
- package/templates/starters/vite/src/components/ui/button.tsx +17 -12
- package/templates/starters/vite/src/components/ui/card.tsx +1 -1
- package/templates/starters/vite/src/components/ui/checkbox.tsx +28 -0
- package/templates/starters/vite/src/components/ui/dialog.tsx +5 -5
- package/templates/starters/vite/src/components/ui/dropdown-menu.tsx +17 -14
- package/templates/starters/vite/src/components/ui/field.tsx +3 -1
- package/templates/starters/vite/src/components/ui/input-group.tsx +5 -3
- package/templates/starters/vite/src/components/ui/input.tsx +1 -1
- package/templates/starters/vite/src/components/ui/label.tsx +2 -0
- package/templates/starters/vite/src/components/ui/native-select.tsx +3 -4
- package/templates/starters/vite/src/components/ui/popover.tsx +1 -1
- package/templates/starters/vite/src/components/ui/separator.tsx +2 -0
- package/templates/starters/vite/src/components/ui/spinner.tsx +3 -7
- package/templates/starters/vite/src/components/ui/switch.tsx +1 -1
- package/templates/starters/vite/src/components/ui/textarea.tsx +1 -1
- package/templates/starters/vite/src/components/ui/toggle.tsx +4 -2
- package/templates/starters/vite/src/index.css +533 -111
- package/app/icons/sets/hugeicons.tsx +0 -259
- package/app/icons/sets/phosphor.tsx +0 -251
- package/dist/server/icon-set.d.mts +0 -15
- package/dist/server/icon-set.mjs +0 -31
- package/dist/shared/icon-sets.d.mts +0 -9
- package/dist/shared/icon-sets.mjs +0 -21
- package/src/server/icon-set.ts +0 -56
- package/src/shared/icon-sets.ts +0 -23
- /package/app/public/{sudio-192.png → dex-192.png} +0 -0
- /package/app/public/{sudio-512.png → dex-512.png} +0 -0
- /package/app/public/{apple-touch-icon.png → dex-apple-touch-icon.png} +0 -0
- /package/app/public/{favicon-32.png → dex-icon-32.png} +0 -0
- /package/app/public/{favicon.svg → dex-icon.svg} +0 -0
- /package/app/public/{sudio-maskable-512.png → dex-maskable-512.png} +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
when: A frame that is a doc, spec, note, slide or sketch; devices, grids, picks; dashed-cell requests; wireframes; Play
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Frames that are not views
|
|
6
|
+
|
|
7
|
+
What a frame in `canvas.json` can be besides a view, and the requests people
|
|
8
|
+
make by drawing on the canvas. `rules/canvas.md` has the grid they sit in.
|
|
9
|
+
|
|
10
|
+
- Documents (`doc`) can sit in a row beside the views they discuss. They are
|
|
11
|
+
not steps: its play page skips them.
|
|
12
|
+
- A frame with a `spec` is a spec, edited in place on the canvas: `spec` is
|
|
13
|
+
its markdown file, from the file's folder: one a person placed (D),
|
|
14
|
+
`people/<person>/specs/<name>.md`. Where one is placed is what it is
|
|
15
|
+
for: in a section, it is that section's spec, to follow for work in that section;
|
|
16
|
+
outside any section, it is the file spec, for the whole file. Several outside
|
|
17
|
+
any section are read as a page is, left to right and top to bottom. Change a
|
|
18
|
+
spec of the person you work for by editing its file, and suggest changes
|
|
19
|
+
to anyone else's (`comment` with `spec`, `quote` and `replace`);
|
|
20
|
+
never write a spec frame, which people place. Its file keeps its name for
|
|
21
|
+
good (threads point at it); people rename its title. A paragraph kept
|
|
22
|
+
twice between warning notes ("Two versions of this were written at the
|
|
23
|
+
same time") is two people's at once: leave it for them to choose, unless
|
|
24
|
+
asked.
|
|
25
|
+
Like documents, specs are not steps: Play skips them.
|
|
26
|
+
- A `spec` frame whose file is in `people/<person>/slides/` is a slide: a
|
|
27
|
+
1920×1080 page (its `size` when resized) that presents part of the file,
|
|
28
|
+
placed with ⇧D. It is not a spec: it is a step of its section, and Play
|
|
29
|
+
presents a section of slides as a deck. Its file is markdown as a spec's
|
|
30
|
+
is. Its first frame embed, `` on a line
|
|
31
|
+
of its own, fills two thirds of the slide, live, and everything else (a
|
|
32
|
+
heading, a few short points, any other embed) sits in the third beside it.
|
|
33
|
+
`"layout": "centred"` on the frame puts that frame in the middle instead,
|
|
34
|
+
the words under it. A frame someone moved or scaled on the slide keeps its
|
|
35
|
+
place in its embed's title, ``
|
|
36
|
+
(its top left corner and width in the slide's pixels; its height follows
|
|
37
|
+
the frame's shape). Words someone put on the slide with the Text tool sit
|
|
38
|
+
between `<!-- text x=96 y=96 w=600 -->` and `<!-- /text -->`, each on a
|
|
39
|
+
line of its own (their top left corner and width; their height is their
|
|
40
|
+
words'). Keep those places when you change the slide, and change only the
|
|
41
|
+
words inside a box; leave places out of what you add. Asked to make or
|
|
42
|
+
change a slide of the person you work for, write its file: one frame, a
|
|
43
|
+
heading and a few words, not a page of text. Name a frame by the `uid` `prototype` gives it. As with a
|
|
44
|
+
spec, never write a slide frame yourself; people place them.
|
|
45
|
+
- A `spec` frame whose file is in `people/<person>/notes/` is a note: what
|
|
46
|
+
people wrote on the canvas for each other, placed with the Text tool. It is
|
|
47
|
+
not a request and Dex does not send it to you; read it when it helps you
|
|
48
|
+
understand a section. Leave others' notes as they are.
|
|
49
|
+
- A frame with a `sketch` was drawn on the canvas. `prototype` gives
|
|
50
|
+
its boxes as text (the first of them, for a large one). Leave it as it is,
|
|
51
|
+
and never write or copy one. Any other
|
|
52
|
+
frame with no `view`, `doc` or `spec` is a mistake, and `dex check` names it.
|
|
53
|
+
- People pick the frames they prefer ("Pick" beside a frame's name), each
|
|
54
|
+
person's in their own `people/<person>/annotations.json`. `prototype`
|
|
55
|
+
gives each person's picks in the order they picked them. Read them as the
|
|
56
|
+
directions they favour: build on a pick before the rest. Never write
|
|
57
|
+
anyone's picks.
|
|
58
|
+
- `size` gives a frame a team device's size, one that is no viewport's,
|
|
59
|
+
or any other. The team's devices are
|
|
60
|
+
in `devices.json` at the studio's root (with none, Dex's own: the three
|
|
61
|
+
viewports): each `{ "name", "width", "height", "kind": "touch" | "desktop",
|
|
62
|
+
"guide", "default" }`, one of them the default a new frame starts at. People
|
|
63
|
+
edit them from a frame's Device menu; leave the file alone unless asked.
|
|
64
|
+
- `grids` and `guides` give a frame a grid of its own, shown in place of its
|
|
65
|
+
device's layout guide when the grid is on. A frame's device is the one of
|
|
66
|
+
its size, else the nearest narrower; its `guide` names one of
|
|
67
|
+
`devices.json`'s `guides`, each `{ "id", "name", "grids" }`. A grid is `{ "kind": "columns" | "rows" |
|
|
68
|
+
"grid", "count", "size", "gutter", "offset", "align": "stretch" | "start" |
|
|
69
|
+
"center" | "end", "color" }` in pixels, as Figma's layout grids are; a
|
|
70
|
+
guide is `{ "axis": "x" | "y", "offset" }`. Frames pasted from Figma bring
|
|
71
|
+
theirs. Leave them alone unless asked.
|
|
72
|
+
|
|
73
|
+
## Requests from the canvas
|
|
74
|
+
|
|
75
|
+
People can click a dashed cell and ask for a new view there. That arrives as a
|
|
76
|
+
thread whose target has `kind: "view"`, with its section id (`section`), row (or none,
|
|
77
|
+
for a new row at the end) and step. While it is open, the cell shows the request.
|
|
78
|
+
Build the view, add a frame for it to `canvas.json` in exactly that cell, then
|
|
79
|
+
resolve the thread (see `methods/review.md`).
|
|
80
|
+
|
|
81
|
+
## Wireframes
|
|
82
|
+
|
|
83
|
+
People can also draw a wireframe: boxes of kinds of UI (navigation, table,
|
|
84
|
+
button and so on) on a blank page in an empty cell, or over an existing frame.
|
|
85
|
+
It arrives as a thread with a `sketch` (boxes in CSS pixels on the page) and,
|
|
86
|
+
from `threads` and `watch`, a `wireframe`: the same boxes as text,
|
|
87
|
+
in reading order, with boxes inside others indented under them. A box's label
|
|
88
|
+
is its text; commas separate items, such as tabs or table columns.
|
|
89
|
+
|
|
90
|
+
Build what it describes from the design system's components. Boxes give the
|
|
91
|
+
layout and the kind of UI, not exact sizes or styling: follow the design
|
|
92
|
+
system's spacing and type, and never draw grey boxes into the view. On a
|
|
93
|
+
`view` target, build the new view as above; on a `frame` target, change that
|
|
94
|
+
frame's view.
|
|
95
|
+
|
|
96
|
+
## Playing and sharing a section
|
|
97
|
+
|
|
98
|
+
A section with a view has Play and Share (a link to play it) beside its name,
|
|
99
|
+
and each frame can play from its step: a page
|
|
100
|
+
at `/files/<slug>/play/<section>?row=<row>&step=<n>` that steps
|
|
101
|
+
through one row, filling the screen, as designed (`&size=actual`) or at a
|
|
102
|
+
device's width (`&viewport=mobile`). People send the link to have someone test the
|
|
103
|
+
journey; it works on the deployed Dex. A view's primary action can move the
|
|
104
|
+
section along with `useFlow().next()` from `@studio/kit/use-flow`.
|
|
@@ -120,10 +120,6 @@ archive", in the file's menu), put them back or move their own to the trash.
|
|
|
120
120
|
|
|
121
121
|
- Every frame has an `id` unique within its row, and exactly one of `view`,
|
|
122
122
|
`doc` or `spec`.
|
|
123
|
-
- A `spec` frame whose file is in `people/<person>/notes/` is a note: what
|
|
124
|
-
people wrote on the canvas for each other, placed with the Text tool. It is
|
|
125
|
-
not a request and Dex does not send it to you; read it when it helps you
|
|
126
|
-
understand a section. Leave others' notes as they are.
|
|
127
123
|
- `step` is the frame's column. Leave it out when the frame simply follows the
|
|
128
124
|
one before it.
|
|
129
125
|
- `"under": true` stacks a frame directly below the frame before it in its
|
|
@@ -139,12 +135,7 @@ archive", in the file's menu), put them back or move their own to the trash.
|
|
|
139
135
|
apart (a state, a device, an option) in its frames' names: "Pay, card
|
|
140
136
|
declined". `npx dex check` flags a row with one.
|
|
141
137
|
- `viewport` is `desktop` (1280×800, default), `tablet` (768×1024) or `mobile`
|
|
142
|
-
(375×812). `size` (`{ "width", "height" }`) gives a frame a size of its own
|
|
143
|
-
a team device's that is no viewport's, or any other. The team's devices are
|
|
144
|
-
in `devices.json` at the studio's root (with none, Dex's own: the three
|
|
145
|
-
viewports): each `{ "name", "width", "height", "kind": "touch" | "desktop",
|
|
146
|
-
"guide", "default" }`, one of them the default a new frame starts at. People
|
|
147
|
-
edit them from a frame's Device menu; leave the file alone unless asked.
|
|
138
|
+
(375×812). `size` (`{ "width", "height" }`) gives a frame a size of its own.
|
|
148
139
|
- `params` become the view's query string. A view declares the options it
|
|
149
140
|
offers with `useViewControl` (see `rules/prototypes.md`).
|
|
150
141
|
- `uid` is which frame it is, for good: picks follow it. Dex gives it.
|
|
@@ -152,141 +143,16 @@ archive", in the file's menu), put them back or move their own to the trash.
|
|
|
152
143
|
Dex gives it one. Moving a frame, keep its `uid`: a frame written without
|
|
153
144
|
one is a new frame, and its picks stay behind. Keep a canvas.json's
|
|
154
145
|
top-level `"frameUids": true` as it is: it says its frames have uids.
|
|
155
|
-
- `grids` and `guides` give a frame a grid of its own, shown in place of its
|
|
156
|
-
device's layout guide when the grid is on. A frame's device is the one of
|
|
157
|
-
its size, else the nearest narrower; its `guide` names one of
|
|
158
|
-
`devices.json`'s `guides`, each `{ "id", "name", "grids" }`. A grid is `{ "kind": "columns" | "rows" |
|
|
159
|
-
"grid", "count", "size", "gutter", "offset", "align": "stretch" | "start" |
|
|
160
|
-
"center" | "end", "color" }` in pixels, as Figma's layout grids are; a
|
|
161
|
-
guide is `{ "axis": "x" | "y", "offset" }`. Frames pasted from Figma bring
|
|
162
|
-
theirs. Leave them alone unless asked.
|
|
163
|
-
- Documents (`doc`) can sit in a row beside the views they discuss. They are
|
|
164
|
-
not steps: its play page skips them.
|
|
165
|
-
- A frame with a `spec` is a spec, edited in place on the canvas: `spec` is
|
|
166
|
-
its markdown file, from the file's folder: one a person placed (D),
|
|
167
|
-
`people/<person>/specs/<name>.md`. Where one is placed is what it is
|
|
168
|
-
for: in a section, it is that section's spec, to follow for work in that section;
|
|
169
|
-
outside any section, it is the file spec, for the whole file. Several outside
|
|
170
|
-
any section are read as a page is, left to right and top to bottom. Change a
|
|
171
|
-
spec of the person you work for by editing its file, and suggest changes
|
|
172
|
-
to anyone else's (`comment` with `spec`, `quote` and `replace`);
|
|
173
|
-
never write a spec frame, which people place. Its file keeps its name for
|
|
174
|
-
good (threads point at it); people rename its title. A paragraph kept
|
|
175
|
-
twice between warning notes ("Two versions of this were written at the
|
|
176
|
-
same time") is two people's at once: leave it for them to choose, unless
|
|
177
|
-
asked.
|
|
178
|
-
Like documents, specs are not steps: Play skips them.
|
|
179
|
-
- A `spec` frame whose file is in `people/<person>/slides/` is a slide: a
|
|
180
|
-
1920×1080 page (its `size` when resized) that presents part of the file,
|
|
181
|
-
placed with ⇧D. It is not a spec: it is a step of its section, and Play
|
|
182
|
-
presents a section of slides as a deck. Its file is markdown as a spec's
|
|
183
|
-
is. Its first frame embed, `` on a line
|
|
184
|
-
of its own, fills two thirds of the slide, live, and everything else (a
|
|
185
|
-
heading, a few short points, any other embed) sits in the third beside it.
|
|
186
|
-
`"layout": "centred"` on the frame puts that frame in the middle instead,
|
|
187
|
-
the words under it. A frame someone moved or scaled on the slide keeps its
|
|
188
|
-
place in its embed's title, ``
|
|
189
|
-
(its top left corner and width in the slide's pixels; its height follows
|
|
190
|
-
the frame's shape). Words someone put on the slide with the Text tool sit
|
|
191
|
-
between `<!-- text x=96 y=96 w=600 -->` and `<!-- /text -->`, each on a
|
|
192
|
-
line of its own (their top left corner and width; their height is their
|
|
193
|
-
words'). Keep those places when you change the slide, and change only the
|
|
194
|
-
words inside a box; leave places out of what you add. Asked to make or
|
|
195
|
-
change a slide of the person you work for, write its file: one frame, a
|
|
196
|
-
heading and a few words, not a page of text. Name a frame by the `uid` `prototype` gives it. As with a
|
|
197
|
-
spec, never write a slide frame yourself; people place them.
|
|
198
|
-
- A frame with a `sketch` was drawn on the canvas. `prototype` gives
|
|
199
|
-
its boxes as text (the first of them, for a large one). Leave it as it is,
|
|
200
|
-
and never write or copy one. Any other
|
|
201
|
-
frame with no `view`, `doc` or `spec` is a mistake, and `dex check` names it.
|
|
202
|
-
- People pick the frames they prefer ("Pick" beside a frame's name), each
|
|
203
|
-
person's in their own `people/<person>/annotations.json`. `prototype`
|
|
204
|
-
gives each person's picks in the order they picked them. Read them as the
|
|
205
|
-
directions they favour: build on a pick before the rest. Never write
|
|
206
|
-
anyone's picks.
|
|
207
146
|
- Older canvases may have `flow`, `x` and `y`. They are ignored; leave them out
|
|
208
147
|
of anything you write.
|
|
209
148
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
## Wireframes
|
|
219
|
-
|
|
220
|
-
People can also draw a wireframe: boxes of kinds of UI (navigation, table,
|
|
221
|
-
button and so on) on a blank page in an empty cell, or over an existing frame.
|
|
222
|
-
It arrives as a thread with a `sketch` (boxes in CSS pixels on the page) and,
|
|
223
|
-
from `threads` and `watch`, a `wireframe`: the same boxes as text,
|
|
224
|
-
in reading order, with boxes inside others indented under them. A box's label
|
|
225
|
-
is its text; commas separate items, such as tabs or table columns.
|
|
226
|
-
|
|
227
|
-
Build what it describes from the design system's components. Boxes give the
|
|
228
|
-
layout and the kind of UI, not exact sizes or styling: follow the design
|
|
229
|
-
system's spacing and type, and never draw grey boxes into the view. On a
|
|
230
|
-
`view` target, build the new view as above; on a `frame` target, change that
|
|
231
|
-
frame's view.
|
|
232
|
-
|
|
233
|
-
## Snapshots
|
|
234
|
-
|
|
235
|
-
People copy elements from other pages (any site, localhost, pages behind a
|
|
236
|
-
login) with the Dex Snapshot extension, or frames in Figma, and paste them
|
|
237
|
-
onto the canvas. Each becomes a view named
|
|
238
|
-
`snapshot-<site>-<what>` with its own CSS file beside it, and a frame sized to
|
|
239
|
-
the element, in the cell the person pasted on (else the canvas's Snapshots
|
|
240
|
-
section). From a page, its layout keeps the page's own widths (percentages,
|
|
241
|
-
auto, grid fractions), so it reflows in a resized frame. From Figma, it keeps
|
|
242
|
-
Figma's: fixed sizes in pixels, auto layout as flexbox, so it lays out as the
|
|
243
|
-
frame did in Figma. It stands alone: links have no `href`, iframes are empty
|
|
244
|
-
boxes and forms are `div`s, so nothing navigates away. Keep it that way when you change
|
|
245
|
-
it; add behaviour with React state, not links to other pages. Buttons that
|
|
246
|
-
opened part of the page (`aria-expanded`) already do, with an `open` state in
|
|
247
|
-
the view; a closed part is `hidden`. Its animations' keyframes are named after
|
|
248
|
-
its root class. The frame's `snapshot` says where it came from.
|
|
249
|
-
|
|
250
|
-
An image pasted or dropped on the canvas, such as a screenshot, is a snapshot
|
|
251
|
-
too: one `<img>` showing its file in `images/`, on a frame the image's size,
|
|
252
|
-
whose `snapshot` has no `url`. A snapshot that is one image names its file
|
|
253
|
-
as `snapshot.image` (`images/….png`, in the prototype's folder). Its code
|
|
254
|
-
holds none of the design, so to rebuild or build from it, read that image.
|
|
255
|
-
A screenshot from a Retina screen is twice the size of what it shows: when
|
|
256
|
-
its text looks twice the design system's, build at half.
|
|
257
|
-
|
|
258
|
-
A snapshot is a reference to iterate on, not built from the design system:
|
|
259
|
-
|
|
260
|
-
- Change its markup and CSS directly when asked to try something on it. Keep
|
|
261
|
-
its styles in its CSS file, scoped under its root class.
|
|
262
|
-
- Never swap in design-system components unless asked. "Rebuild with our
|
|
263
|
-
components" (or with a kit of your own) asks for exactly that: build a new
|
|
264
|
-
view that matches its layout and content, in a row below it, and leave
|
|
265
|
-
the snapshot and its CSS file as they are.
|
|
266
|
-
- A rebuild keeps the snapshot's sizes. Where its CSS gives a fixed width or
|
|
267
|
-
height (Figma's columns, cards, panels), the rebuild gives the same one;
|
|
268
|
-
only what filled its parent or shrank to its content in the snapshot does
|
|
269
|
-
so in the rebuild. A row of fixed columns rebuilt as a flex row with a gap
|
|
270
|
-
squeezes each column to its text. Compare the rebuild with the snapshot
|
|
271
|
-
above it before calling it done.
|
|
272
|
-
- Do not tidy its CSS for its own sake; it records how the original looked.
|
|
273
|
-
- From Figma, elements that were component instances say which component in
|
|
274
|
-
`data-figma-component` (for example `Button (Size=Large)`). When rebuilding,
|
|
275
|
-
use the design system's component of that name. Images come with the
|
|
276
|
-
paste, fetched from Figma. One it could not fetch stays a link to Figma's
|
|
277
|
-
servers, which stops working within days; one Figma's clipboard had no
|
|
278
|
-
link for is grey. The paste counts both as missing: copy those again in
|
|
279
|
-
Figma and paste, rather than keep a link or a grey box as the design.
|
|
280
|
-
|
|
281
|
-
## Playing and sharing a section
|
|
282
|
-
|
|
283
|
-
A section with a view has Play and Share (a link to play it) beside its name,
|
|
284
|
-
and each frame can play from its step: a page
|
|
285
|
-
at `/files/<slug>/play/<section>?row=<row>&step=<n>` that steps
|
|
286
|
-
through one row, filling the screen, as designed (`&size=actual`) or at a
|
|
287
|
-
device's width (`&viewport=mobile`). People send the link to have someone test the
|
|
288
|
-
journey; it works on the deployed Dex. A view's primary action can move the
|
|
289
|
-
section along with `useFlow().next()` from `@studio/kit/use-flow`.
|
|
149
|
+
A frame can be more than a view: a document, a spec, a note, a slide or a
|
|
150
|
+
sketch, and it can carry a device, a grid or people's picks. Read
|
|
151
|
+
`rules/canvas-frames.md` before you change one of those, or when a thread
|
|
152
|
+
asks for a view in a dashed cell or sends a wireframe. A frame with a
|
|
153
|
+
`snapshot` was pasted from elsewhere: read `rules/snapshots.md` before you
|
|
154
|
+
change or rebuild it. Any other frame with no `view`, `doc` or `spec` is a
|
|
155
|
+
mistake, and `dex check` names it.
|
|
290
156
|
|
|
291
157
|
## How to organise it
|
|
292
158
|
|
|
@@ -37,7 +37,7 @@ files/<slug>/
|
|
|
37
37
|
canvas.json their sections on the canvas (see rules/canvas.md)
|
|
38
38
|
data.ts their mock data, in the shape production uses
|
|
39
39
|
views/*.tsx one screen each, default export, no props
|
|
40
|
-
specs/*.md specs they placed on the canvas (rules/canvas.md)
|
|
40
|
+
specs/*.md specs they placed on the canvas (rules/canvas-frames.md)
|
|
41
41
|
docs/*.md critiques, briefs, handoff notes; the first # heading is the title; the team's
|
|
42
42
|
images/ images views show, named for what they hold
|
|
43
43
|
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
when: A snapshot: a view pasted onto the canvas from a page, Figma or an image, or rebuilding one with the design system
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Snapshots
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
People copy elements from other pages (any site, localhost, pages behind a
|
|
9
|
+
login) with the Dex Snapshot extension, or frames in Figma, and paste them
|
|
10
|
+
onto the canvas. Each becomes a view named
|
|
11
|
+
`snapshot-<site>-<what>` with its own CSS file beside it, and a frame sized to
|
|
12
|
+
the element, in the cell the person pasted on (else the canvas's Snapshots
|
|
13
|
+
section). From a page, its layout keeps the page's own widths (percentages,
|
|
14
|
+
auto, grid fractions), so it reflows in a resized frame. From Figma, it keeps
|
|
15
|
+
Figma's: fixed sizes in pixels, auto layout as flexbox, so it lays out as the
|
|
16
|
+
frame did in Figma. It stands alone: links have no `href`, iframes are empty
|
|
17
|
+
boxes and forms are `div`s, so nothing navigates away. Keep it that way when you change
|
|
18
|
+
it; add behaviour with React state, not links to other pages. Buttons that
|
|
19
|
+
opened part of the page (`aria-expanded`) already do, with an `open` state in
|
|
20
|
+
the view; a closed part is `hidden`. Its animations' keyframes are named after
|
|
21
|
+
its root class. The frame's `snapshot` says where it came from.
|
|
22
|
+
|
|
23
|
+
An image pasted or dropped on the canvas, such as a screenshot, is a snapshot
|
|
24
|
+
too: one `<img>` showing its file in `images/`, on a frame the image's size,
|
|
25
|
+
whose `snapshot` has no `url`. A snapshot that is one image names its file
|
|
26
|
+
as `snapshot.image` (`images/….png`, in the prototype's folder). Its code
|
|
27
|
+
holds none of the design, so to rebuild or build from it, read that image.
|
|
28
|
+
A screenshot from a Retina screen is twice the size of what it shows: when
|
|
29
|
+
its text looks twice the design system's, build at half.
|
|
30
|
+
|
|
31
|
+
A snapshot is a reference to iterate on, not built from the design system:
|
|
32
|
+
|
|
33
|
+
- Change its markup and CSS directly when asked to try something on it. Keep
|
|
34
|
+
its styles in its CSS file, scoped under its root class.
|
|
35
|
+
- Never swap in design-system components unless asked. "Rebuild with our
|
|
36
|
+
components" (or with a kit of your own) asks for exactly that: build a new
|
|
37
|
+
view that matches its layout and content, in a row below it, and leave
|
|
38
|
+
the snapshot and its CSS file as they are.
|
|
39
|
+
- A rebuild keeps the snapshot's sizes. Where its CSS gives a fixed width or
|
|
40
|
+
height (Figma's columns, cards, panels), the rebuild gives the same one;
|
|
41
|
+
only what filled its parent or shrank to its content in the snapshot does
|
|
42
|
+
so in the rebuild. A row of fixed columns rebuilt as a flex row with a gap
|
|
43
|
+
squeezes each column to its text. Compare the rebuild with the snapshot
|
|
44
|
+
above it before calling it done.
|
|
45
|
+
- Do not tidy its CSS for its own sake; it records how the original looked.
|
|
46
|
+
- From Figma, elements that were component instances say which component in
|
|
47
|
+
`data-figma-component` (for example `Button (Size=Large)`). When rebuilding,
|
|
48
|
+
use the design system's component of that name. Images come with the
|
|
49
|
+
paste, fetched from Figma. One it could not fetch stays a link to Figma's
|
|
50
|
+
servers, which stops working within days; one Figma's clipboard had no
|
|
51
|
+
link for is grey. The paste counts both as missing: copy those again in
|
|
52
|
+
Figma and paste, rather than keep a link or a grey box as the design.
|
|
@@ -4,15 +4,15 @@ A standalone studio: Dex on its own, with no app beside it, for
|
|
|
4
4
|
design teams without an app repository.
|
|
5
5
|
|
|
6
6
|
```sh
|
|
7
|
-
__PM__ run
|
|
7
|
+
__PM__ run dex # Dex: files on your components
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
Your components are in `src/components/ui`: shadcn on Base UI
|
|
11
|
-
|
|
12
|
-
with
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
Your components are in `src/components/ui`: shadcn on Base UI in
|
|
11
|
+
the look of Dex's own interface: Inter, Lucide icons, round controls and a visible
|
|
12
|
+
focus outline, with the tokens in `src/index.css`. Add more with
|
|
13
|
+
`npx shadcn@latest add <name>` (`components.json`), or replace them with your own. The studio
|
|
14
|
+
found them, and its agents build files with them. Dex's own interface keeps
|
|
15
|
+
its own buttons, menus and icons, whatever your components look like.
|
|
16
16
|
|
|
17
17
|
If your design system is a published package, install it and point
|
|
18
18
|
`designSystem` in `dex.config.ts` at it.
|
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@base-ui/react": "^1.9.0",
|
|
8
8
|
"@fontsource-variable/inter": "^5.3.0",
|
|
9
|
-
"@hugeicons/core-free-icons": "^4.3.5",
|
|
10
|
-
"@hugeicons/react": "^1.1.10",
|
|
11
9
|
"class-variance-authority": "^0.7.1",
|
|
12
10
|
"cn": "^0.4.0",
|
|
11
|
+
"lucide-react": "^0.525.0",
|
|
13
12
|
"react": "^19.1.0",
|
|
14
13
|
"react-dom": "^19.1.0",
|
|
15
14
|
"shadcn": "^4.21.4",
|
|
@@ -4,19 +4,19 @@ A Turborepo with Dex: an app, a shared design system package and the
|
|
|
4
4
|
studio as an app of its own, the shape most product teams have.
|
|
5
5
|
|
|
6
6
|
```sh
|
|
7
|
-
__PM__ run dev # every app: the web app and
|
|
8
|
-
__PM__ run
|
|
7
|
+
__PM__ run dev # every app: the web app and Dex
|
|
8
|
+
__PM__ run dex # Dex only: files on @workspace/ui
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
| Folder | What |
|
|
12
12
|
| --- | --- |
|
|
13
13
|
| `apps/web` | Your product: Vite and React, built from `@workspace/ui`. |
|
|
14
|
-
| `packages/ui` | The design system, `@workspace/ui`: shadcn on Base UI
|
|
14
|
+
| `packages/ui` | The design system, `@workspace/ui`: shadcn on Base UI in the look of Dex's own interface (Inter, Lucide icons), with the tokens in `src/styles/globals.css`. |
|
|
15
15
|
| `apps/studio` | Dex. It depends on `@workspace/ui` as `apps/web` does, and its agents build files with those components. |
|
|
16
16
|
|
|
17
17
|
Add components to the shared package with `npx shadcn@latest add <name>` from
|
|
18
|
-
`apps/web` (its `components.json` sends them to `packages/ui`).
|
|
19
|
-
buttons, menus and
|
|
20
|
-
|
|
18
|
+
`apps/web` (its `components.json` sends them to `packages/ui`). Dex's own
|
|
19
|
+
interface keeps its own buttons, menus and icons, whatever your components look
|
|
20
|
+
like.
|
|
21
21
|
|
|
22
22
|
Dex files and guidelines for agents (`DESIGN.md`) are in `apps/studio`.
|
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
"typecheck": "tsc --noEmit"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@hugeicons/core-free-icons": "^4.3.5",
|
|
14
|
-
"@hugeicons/react": "^1.1.10",
|
|
15
13
|
"@workspace/ui": "workspace:*",
|
|
14
|
+
"lucide-react": "^0.525.0",
|
|
16
15
|
"react": "^19.1.0",
|
|
17
16
|
"react-dom": "^19.1.0"
|
|
18
17
|
},
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ArrowRight01Icon } from "@hugeicons/core-free-icons";
|
|
2
|
-
import { HugeiconsIcon } from "@hugeicons/react";
|
|
3
1
|
import { Badge } from "@workspace/ui/components/badge";
|
|
4
2
|
import { Button } from "@workspace/ui/components/button";
|
|
5
3
|
import {
|
|
@@ -10,6 +8,7 @@ import {
|
|
|
10
8
|
CardHeader,
|
|
11
9
|
CardTitle,
|
|
12
10
|
} from "@workspace/ui/components/card";
|
|
11
|
+
import { ArrowRightIcon } from "lucide-react";
|
|
13
12
|
|
|
14
13
|
export function App() {
|
|
15
14
|
return (
|
|
@@ -28,14 +27,14 @@ export function App() {
|
|
|
28
27
|
</CardHeader>
|
|
29
28
|
<CardContent>
|
|
30
29
|
<p className="text-muted-foreground">
|
|
31
|
-
Prototype it in
|
|
32
|
-
|
|
30
|
+
Prototype it in Dex, apps/studio: run <code>__PM__ run dex</code>{" "}
|
|
31
|
+
from the repository's root.
|
|
33
32
|
</p>
|
|
34
33
|
</CardContent>
|
|
35
34
|
<CardFooter>
|
|
36
35
|
<Button>
|
|
37
36
|
Get going
|
|
38
|
-
<
|
|
37
|
+
<ArrowRightIcon data-icon="inline-end" />
|
|
39
38
|
</Button>
|
|
40
39
|
</CardFooter>
|
|
41
40
|
</Card>
|
|
@@ -15,10 +15,9 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@base-ui/react": "^1.9.0",
|
|
17
17
|
"@fontsource-variable/inter": "^5.3.0",
|
|
18
|
-
"@hugeicons/core-free-icons": "^4.3.5",
|
|
19
|
-
"@hugeicons/react": "^1.1.10",
|
|
20
18
|
"class-variance-authority": "^0.7.1",
|
|
21
19
|
"cn": "^0.4.0",
|
|
20
|
+
"lucide-react": "^0.525.0",
|
|
22
21
|
"react": "^19.1.0",
|
|
23
22
|
"react-dom": "^19.1.0",
|
|
24
23
|
"shadcn": "^4.21.4",
|
|
@@ -5,14 +5,15 @@ set up.
|
|
|
5
5
|
|
|
6
6
|
```sh
|
|
7
7
|
__PM__ run dev # your app
|
|
8
|
-
__PM__ run
|
|
8
|
+
__PM__ run dex # Dex: files on your components
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
Your components are in `src/components/ui`: shadcn on Base UI
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
Your components are in `src/components/ui`: shadcn on Base UI in
|
|
12
|
+
the look of Dex's own interface: Inter, Lucide icons, round controls and a visible
|
|
13
|
+
focus outline, with the tokens in `src/index.css`. Add more with
|
|
14
|
+
`npx shadcn@latest add <name>` (`components.json`). The studio found them, and its agents build
|
|
15
|
+
files with them. Dex's own interface keeps its own buttons, menus and icons,
|
|
16
|
+
whatever your components look like.
|
|
16
17
|
|
|
17
18
|
Studio settings are in `dex.config.ts`; Dex files and guidelines for
|
|
18
19
|
agents (`DESIGN.md`) are in `studio/`.
|
|
@@ -11,10 +11,9 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@base-ui/react": "^1.9.0",
|
|
13
13
|
"@fontsource-variable/inter": "^5.3.0",
|
|
14
|
-
"@hugeicons/core-free-icons": "^4.3.5",
|
|
15
|
-
"@hugeicons/react": "^1.1.10",
|
|
16
14
|
"class-variance-authority": "^0.7.1",
|
|
17
15
|
"cn": "^0.4.0",
|
|
16
|
+
"lucide-react": "^0.525.0",
|
|
18
17
|
"react": "^19.1.0",
|
|
19
18
|
"react-dom": "^19.1.0",
|
|
20
19
|
"shadcn": "^4.21.4",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { HugeiconsIcon } from "@hugeicons/react";
|
|
1
|
+
import { ArrowRightIcon } from "lucide-react";
|
|
3
2
|
import { Badge } from "@/components/ui/badge";
|
|
4
3
|
import { Button } from "@/components/ui/button";
|
|
5
4
|
import {
|
|
@@ -28,13 +27,13 @@ export function App() {
|
|
|
28
27
|
</CardHeader>
|
|
29
28
|
<CardContent>
|
|
30
29
|
<p className="text-muted-foreground">
|
|
31
|
-
Prototype it in
|
|
30
|
+
Prototype it in Dex: run <code>__PM__ run dex</code>.
|
|
32
31
|
</p>
|
|
33
32
|
</CardContent>
|
|
34
33
|
<CardFooter>
|
|
35
34
|
<Button>
|
|
36
35
|
Get going
|
|
37
|
-
<
|
|
36
|
+
<ArrowRightIcon data-icon="inline-end" />
|
|
38
37
|
</Button>
|
|
39
38
|
</CardFooter>
|
|
40
39
|
</Card>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Accordion as AccordionPrimitive } from "@base-ui/react/accordion"
|
|
2
|
+
import { cn } from "cn"
|
|
3
|
+
import { ChevronDownIcon, ChevronUpIcon } from "lucide-react"
|
|
4
|
+
|
|
5
|
+
function Accordion({ className, ...props }: AccordionPrimitive.Root.Props) {
|
|
6
|
+
return (
|
|
7
|
+
<AccordionPrimitive.Root
|
|
8
|
+
data-slot="accordion"
|
|
9
|
+
className={cn("flex w-full flex-col", className)}
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function AccordionItem({ className, ...props }: AccordionPrimitive.Item.Props) {
|
|
16
|
+
return (
|
|
17
|
+
<AccordionPrimitive.Item
|
|
18
|
+
data-slot="accordion-item"
|
|
19
|
+
className={cn("not-last:border-b", className)}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function AccordionTrigger({
|
|
26
|
+
className,
|
|
27
|
+
children,
|
|
28
|
+
...props
|
|
29
|
+
}: AccordionPrimitive.Trigger.Props) {
|
|
30
|
+
return (
|
|
31
|
+
<AccordionPrimitive.Header className="flex">
|
|
32
|
+
<AccordionPrimitive.Trigger
|
|
33
|
+
data-slot="accordion-trigger"
|
|
34
|
+
className={cn(
|
|
35
|
+
"studio-focus group/accordion-trigger relative flex flex-1 items-start justify-between rounded-md border border-transparent py-4 text-left text-sm font-medium transition-colors outline-none hover:underline focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",
|
|
36
|
+
className
|
|
37
|
+
)}
|
|
38
|
+
{...props}
|
|
39
|
+
>
|
|
40
|
+
{children}
|
|
41
|
+
<ChevronDownIcon data-slot="accordion-trigger-icon" className="pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden" />
|
|
42
|
+
<ChevronUpIcon data-slot="accordion-trigger-icon" className="pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline" />
|
|
43
|
+
</AccordionPrimitive.Trigger>
|
|
44
|
+
</AccordionPrimitive.Header>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function AccordionContent({
|
|
49
|
+
className,
|
|
50
|
+
children,
|
|
51
|
+
...props
|
|
52
|
+
}: AccordionPrimitive.Panel.Props) {
|
|
53
|
+
return (
|
|
54
|
+
<AccordionPrimitive.Panel
|
|
55
|
+
data-slot="accordion-content"
|
|
56
|
+
className="overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up"
|
|
57
|
+
{...props}
|
|
58
|
+
>
|
|
59
|
+
<div
|
|
60
|
+
className={cn(
|
|
61
|
+
"h-(--accordion-panel-height) pt-0 pb-4 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",
|
|
62
|
+
className
|
|
63
|
+
)}
|
|
64
|
+
>
|
|
65
|
+
{children}
|
|
66
|
+
</div>
|
|
67
|
+
</AccordionPrimitive.Panel>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|