pi-design-deck 0.1.1 → 0.3.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.
Files changed (31) hide show
  1. package/README.md +54 -13
  2. package/deck-schema.ts +30 -0
  3. package/deck-server.ts +76 -19
  4. package/export-html.ts +329 -0
  5. package/form/css/controls.css +171 -0
  6. package/form/css/layout.css +56 -0
  7. package/form/css/preview.css +60 -6
  8. package/form/deck.html +2 -0
  9. package/form/js/deck-core.js +60 -2
  10. package/form/js/deck-interact.js +63 -19
  11. package/form/js/deck-render.js +95 -6
  12. package/form/js/deck-session.js +140 -27
  13. package/generate-prompts.ts +18 -12
  14. package/index.ts +364 -66
  15. package/package.json +2 -1
  16. package/prompts/deck-discover.md +3 -1
  17. package/prompts/deck-plan.md +3 -1
  18. package/prompts/deck.md +3 -1
  19. package/skills/design-deck/SKILL.md +44 -8
  20. package/skills/design-deck/references/component-gallery/INDEX.md +88 -0
  21. package/skills/design-deck/references/component-gallery/LOOKUP.md +592 -0
  22. package/skills/design-deck/references/component-gallery/components/INDEX.md +106 -0
  23. package/skills/design-deck/references/component-gallery/components/actions.md +354 -0
  24. package/skills/design-deck/references/component-gallery/components/data-display.md +812 -0
  25. package/skills/design-deck/references/component-gallery/components/feedback.md +513 -0
  26. package/skills/design-deck/references/component-gallery/components/inputs.md +921 -0
  27. package/skills/design-deck/references/component-gallery/components/layout.md +167 -0
  28. package/skills/design-deck/references/component-gallery/components/navigation.md +350 -0
  29. package/skills/design-deck/references/component-gallery/components/overlays.md +208 -0
  30. package/skills/design-deck/references/component-gallery/components/utilities.md +29 -0
  31. package/skills/design-deck/references/component-gallery/components.md +1383 -0
package/prompts/deck.md CHANGED
@@ -1,7 +1,9 @@
1
1
  ---
2
2
  description: Present visual design options via design deck
3
3
  ---
4
- Load the `design-deck` skill for the full format reference. Analyze the current codebase and context, and present concrete visual options using `design_deck`.
4
+ Load the `design-deck` skill for the full format reference. If presenting UI component options (tabs, trees, buttons, accordions, etc.), also read the relevant file from the skill's `references/component-gallery/` directory — it has visual vocabulary across design systems plus guidance on when to use distinct systems vs variations of the same approach.
5
+
6
+ Analyze the current codebase and context, and present concrete visual options using `design_deck`.
5
7
 
6
8
  Read relevant files aggressively first so you understand the real constraints before generating options. If there's a plan or PRD, read it in full along with every codebase file it references — understand the actual state of the code, not just what the document assumes. Then identify the key design and architecture decisions and present options for each.
7
9
 
@@ -3,6 +3,8 @@ name: design-deck
3
3
  description: Present visual options for architecture, UI, and code decisions with high-fidelity side-by-side previews. For comparing approaches visually — code diffs, diagrams, UI mockups, images — not for gathering structured input (use interview for that). Supports previewBlocks (code, mermaid, image, html), previewHtml, generate-more loops, and plan/PRD-driven flows.
4
4
  ---
5
5
 
6
+ > **`design_deck` is a direct tool — call it directly, not via MCP.**
7
+
6
8
  # Design Deck Workflow
7
9
 
8
10
  Use this skill when the task requires presenting multiple visual directions and collecting explicit user choices. Load this skill before building any deck to get the full format reference.
@@ -201,6 +203,40 @@ surf gemini "isometric database cluster, dark theme, blue nodes" \
201
203
  **Combine images with other blocks:**
202
204
  An image showing the visual direction paired with a code block showing the implementation approach, or a mermaid diagram showing data flow alongside a generated image showing the UI that flow produces.
203
205
 
206
+ ### Component Gallery Reference
207
+
208
+ When generating UI component options (tabs, accordions, tree views, buttons, etc.), read `./references/component-gallery/components.md` for best practices, common layouts, and aliases for 60 UI components.
209
+
210
+ The reference enables three things:
211
+ - **Discovery** — list, find, and suggest components for a use case ("I need expandable content" → accordion, disclosure, details)
212
+ - **Cross-referencing** — connect related terms (collapse = accordion = disclosure = expander; notification = alert = banner)
213
+ - **Design vocabulary** — know what design systems look like (Blueprint = dense, dark-native; Ant = clean, blue primary)
214
+
215
+ The `INDEX.md` provides a design system vocabulary table (Ant Design, Blueprint, Carbon, Material, etc.) and guidance on when to use distinct systems vs variations.
216
+
217
+ **Decide based on context:**
218
+ - **Distinct systems** (Blueprint vs Ant vs 98.css) when exploring the design space with no established aesthetic
219
+ - **Variations within a system** when the project already has a design direction or the user specifies a style
220
+
221
+ See `./references/component-gallery/INDEX.md` for the decision table and examples.
222
+
223
+ **Proactively browse real examples:** When you need visual inspiration for a component, fetch the component.gallery page directly:
224
+
225
+ - https://component.gallery/components/tabs/ — 80+ real tab implementations
226
+ - https://component.gallery/components/accordion/ — 100+ accordion examples
227
+ - https://component.gallery/components/button/ — 120+ button styles
228
+
229
+ Each page shows real screenshots from Ant Design, Blueprint, Carbon, Material, Shopify Polaris, and 90+ other design systems. Useful when you need concrete visual references — not required for every deck.
230
+
231
+ **When user vocabulary is unclear or ambiguous:** Read `./references/component-gallery/LOOKUP.md` to resolve user terms to canonical component names. The lookup file provides:
232
+
233
+ 1. **Alias Index** — Direct mappings like `collapse → Accordion`, `snackbar → Toast`
234
+ 2. **Disambiguation** — Rules for ambiguous terms like `dropdown` (Select? Combobox? Dropdown menu?) or `popup` (Modal? Popover? Tooltip?)
235
+ 3. **Intent Clusters** — When users describe what they're trying to do ("I need users to pick from options"), maps constraints to components
236
+ 4. **Clarification Templates** — Suggested questions when disambiguation is needed
237
+
238
+ Use the lookup before generating options if the user's component vocabulary seems imprecise or you're unsure which component they mean.
239
+
204
240
  ### For Mixed Previews
205
241
 
206
242
  Many slides benefit from combining block types — a mermaid diagram showing structure alongside a code block showing usage, or an HTML mockup with a code block showing the component API.
@@ -220,27 +256,27 @@ Use these selections as the implementation contract for the final build.
220
256
 
221
257
  ## Generate-More Loop
222
258
 
223
- When the user clicks generate-more, `design_deck` returns a result instructing which slide needs another option and listing existing option labels.
259
+ When the user clicks generate-more, `design_deck` returns a result instructing which slide needs options and how many, along with the existing option labels.
224
260
 
225
- Generate one new option that is meaningfully distinct from the listed options.
261
+ Generate the requested number of new options, each meaningfully distinct from the existing ones.
226
262
 
227
- Re-invoke:
263
+ Re-invoke with all options in a single call:
228
264
 
229
- `design_deck({ action: "add-option", slideId: "...", option: "{...json string...}" })`
265
+ `design_deck({ action: "add-options", slideId: "...", options: "[{...}, {...}]" })`
230
266
 
231
- The `add-option` call pushes the new option into the live deck and blocks again for the next user action.
267
+ The `add-options` call pushes all options into the live deck and blocks for the next user action. Use `add-options` (plural) for generate-more requests — it takes an array and handles blocking automatically.
232
268
 
233
269
  ### Model Override
234
270
 
235
271
  The deck shows a model dropdown below the header (when 2+ models are available). Users can pick which model generates new options and optionally save it as the default.
236
272
 
237
- When the generate-more result includes a model instruction (e.g. "Generate using model X via deck_generate"), use the built-in `deck_generate` tool to generate the option with that model:
273
+ When the generate-more result includes a model instruction (e.g. "Generate using model X via deck_generate"), use the built-in `deck_generate` tool to generate the options with that model:
238
274
 
239
275
  ```
240
- deck_generate({ model: "google/gemini-3.1-pro", task: "Generate a JSON deck option..." })
276
+ deck_generate({ model: "google/gemini-3.1-pro", task: "Generate JSON deck options..." })
241
277
  ```
242
278
 
243
- Parse the output as the option JSON and pass it to `add-option`.
279
+ Parse the output as the options JSON array and pass it to `add-options`.
244
280
 
245
281
  The default model can also be set in `~/.pi/agent/settings.json`:
246
282
 
@@ -0,0 +1,88 @@
1
+ # Component Gallery Reference
2
+
3
+ Production-grade UI component knowledge — 2,676 real-world examples from 60 components across 100+ design systems, plus best practices and layout patterns.
4
+
5
+ ## File Structure
6
+
7
+ | File | Purpose |
8
+ |------|---------|
9
+ | `components.md` | Best practices, common layouts, and aliases for all 60 components |
10
+ | `LOOKUP.md` | Vocabulary resolution — maps user terms to canonical component names |
11
+ | `components/INDEX.md` | Browsable index of all design system implementations |
12
+ | `components/{category}.md` | Design system examples with URLs and preview images |
13
+
14
+ ## When to Read What
15
+
16
+ | Situation | Read |
17
+ |-----------|------|
18
+ | Building deck options for a UI component | `components.md` for best practices |
19
+ | User's term is ambiguous ("dropdown", "popup") | `LOOKUP.md` to resolve vocabulary |
20
+ | Need concrete visual references from real design systems | `components/{category}.md` |
21
+ | Want to see how Blueprint/Ant/Carbon implements X | `components/{category}.md` for URLs |
22
+
23
+ ## Categories
24
+
25
+ - **[Actions](components/actions.md)** (294 examples) — Button, Button group, Dropdown menu, Link, Segmented control
26
+ - **[Navigation](components/navigation.md)** (281 examples) — Breadcrumbs, Navigation, Pagination, Skip link, Stepper, Tabs
27
+ - **[Inputs](components/inputs.md)** (726 examples) — Checkbox, Combobox, Datepicker, Select, Slider, Text input, Toggle, etc.
28
+ - **[Data Display](components/data-display.md)** (663 examples) — Accordion, Avatar, Badge, Card, Table, Tree view, etc.
29
+ - **[Feedback](components/feedback.md)** (420 examples) — Alert, Progress bar, Skeleton, Spinner, Toast, Tooltip
30
+ - **[Overlays](components/overlays.md)** (170 examples) — Drawer, Modal, Popover
31
+ - **[Layout](components/layout.md)** (111 examples) — Footer, Header, Hero, Separator, Stack
32
+ - **[Utilities](components/utilities.md)** (11 examples) — Visually hidden
33
+
34
+ ## Design System Visual Languages
35
+
36
+ Use this table as vocabulary for generating distinct options:
37
+
38
+ | Design System | Visual Language | Good For |
39
+ |---------------|-----------------|----------|
40
+ | **98.css** | Windows 95 retro, beveled borders, system fonts | Nostalgic, developer tools |
41
+ | **Ant Design** | Clean lines, blue primary, minimal chrome | Modern web apps, dashboards |
42
+ | **Blueprint** | Dense, utilitarian, dark-mode native, monospace | Developer tools, data-dense UIs |
43
+ | **Carbon** | IBM enterprise, subtle depth, structured grid | Enterprise apps, B2B |
44
+ | **Material** | Elevation shadows, ripple effects, bold color | Consumer apps, mobile-first |
45
+ | **Chakra** | Composable, accessible defaults, clean aesthetic | React apps, rapid prototyping |
46
+ | **Radix** | Unstyled primitives, accessibility-first | Custom design systems |
47
+ | **shadcn/ui** | Tailwind-based, copy-paste components | Next.js apps, modern stacks |
48
+ | **Spectrum** | Adobe polish, refined interactions | Creative tools |
49
+ | **Shoelace** | Web components, themeable | Framework-agnostic projects |
50
+
51
+ ## When to Use Distinct Systems vs Variations
52
+
53
+ | Context | Approach |
54
+ |---------|----------|
55
+ | Exploring the design space | **Distinct systems** — Blueprint vs Ant vs 98.css |
56
+ | Project has established aesthetic | **Variations within that system** |
57
+ | User specifies a style | **Variations of that style** |
58
+ | Early exploration, no constraints | **Distinct systems** — maximize range |
59
+
60
+ ## Using the Design System Examples
61
+
62
+ Each entry in `components/{category}.md` includes:
63
+
64
+ ```
65
+ - [ComponentName](url) — DesignSystem · Tech · Features · [preview](imageUrl)
66
+ ```
67
+
68
+ **Example from inputs.md:**
69
+ ```
70
+ - [Checkbox](https://ant.design/components/checkbox) — Ant Design · React — Code examples, Open source · [preview](https://component.gallery/_astro/...)
71
+ ```
72
+
73
+ Use the URLs to:
74
+ - Reference actual documentation when generating options
75
+ - View preview images for visual inspiration
76
+ - Note the tech stack (React, Vue, Web Components) for context
77
+
78
+ ## Workflow
79
+
80
+ 1. **Resolve vocabulary** — Check `LOOKUP.md` if the user's term is ambiguous
81
+ 2. **Read best practices** — `components.md` for the component's patterns and layouts
82
+ 3. **Browse implementations** — `components/{category}.md` for real examples
83
+ 4. **Generate distinct options** — Apply different design system vocabularies
84
+
85
+ ## Attribution
86
+
87
+ - Component knowledge from [ui-design-brain](https://github.com/carmahhawwari/ui-design-brain) by [@Carmahhawwari](https://x.com/Carmahhawwari)
88
+ - Design system examples from [component.gallery](https://component.gallery) by [Iain Bean](https://iainbean.com)