@parity-app/cli 0.0.0-stage → 0.0.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 (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +65 -2
  3. package/dist/bin.mjs +831 -0
  4. package/dist/client-DsTLQ2lT.mjs +286 -0
  5. package/dist/in-app.json +10 -0
  6. package/dist/index.d.mts +160 -0
  7. package/dist/index.mjs +1 -0
  8. package/dist/libraries/aria.lib.par +14516 -0
  9. package/dist/libraries/baseui.lib.par +8298 -0
  10. package/dist/libraries/buildkit-baseui.edits.json +3 -0
  11. package/dist/libraries/chakra.lib.par +539186 -0
  12. package/dist/libraries/fluent-icons.lib.par +2674 -0
  13. package/dist/libraries/fluent.lib.par +33703 -0
  14. package/dist/libraries/heroicons.lib.par +33 -0
  15. package/dist/libraries/hugeicons.lib.par +708 -0
  16. package/dist/libraries/lucide.lib.par +2123 -0
  17. package/dist/libraries/luma.lib.par +16362 -0
  18. package/dist/libraries/lyra.lib.par +16362 -0
  19. package/dist/libraries/maia.lib.par +16362 -0
  20. package/dist/libraries/mantine.lib.par +32935 -0
  21. package/dist/libraries/mira.lib.par +16362 -0
  22. package/dist/libraries/mui.lib.par +9817 -0
  23. package/dist/libraries/nova.lib.par +16363 -0
  24. package/dist/libraries/phosphor.lib.par +3060 -0
  25. package/dist/libraries/radix.lib.par +6890 -0
  26. package/dist/libraries/rhea.lib.par +16362 -0
  27. package/dist/libraries/sera.lib.par +16362 -0
  28. package/dist/libraries/tabler.lib.par +5325 -0
  29. package/dist/libraries/vega.lib.par +16362 -0
  30. package/dist/published-BtL8RM6W.mjs +1 -0
  31. package/dist/published-CdXoUgfD.mjs +200 -0
  32. package/dist/src-C8DCd2a1.mjs +1 -0
  33. package/dist/src-CSeISXoZ.mjs +1298 -0
  34. package/dist/src-WcAfq6g1.mjs +2 -0
  35. package/dist/src-rlZNC2MU.mjs +4690 -0
  36. package/dist/src-uPmBVSsB.mjs +53 -0
  37. package/package.json +50 -3
  38. package/skills/SKILL.md +96 -0
  39. package/skills/document.md +166 -0
  40. package/skills/execute.md +276 -0
  41. package/skills/guide/checking.md +56 -0
  42. package/skills/guide/components.md +48 -0
  43. package/skills/guide/design-system.md +52 -0
  44. package/skills/guide/mobile.md +32 -0
  45. package/skills/guide/states-and-modes.md +55 -0
  46. package/skills/guide/web-app.md +43 -0
@@ -0,0 +1,56 @@
1
+ # Checking a design
2
+
3
+ Parity renders every frame offscreen at its real width, with the project's real components, so checks see what the app
4
+ would show. Run them after every change you make, and before you tell the person you're done.
5
+
6
+ ## Screenshots
7
+
8
+ `screenshot`, or `Screenshot` in a snippet, returns the images. Look at them: text that wraps badly, a button pushed off
9
+ the edge, a skeleton that doesn't match what it stands for, colours that disappear in dark mode. `scale: 2` helps with
10
+ small details.
11
+
12
+ ## Layout problems
13
+
14
+ `find_problems`, or `Problems` in a snippet, lists what's wrong in each frame without looking at it:
15
+
16
+ - **Render errors.** A component threw. Usually a prop with the wrong type, or a part used outside its parent (a
17
+ `TabsTrigger` without `Tabs`). `parity components` lists the components failing anywhere on the canvas, with why.
18
+ - **Overflow.** Content wider than the frame, usually a row that needs to wrap or stack on mobile.
19
+ - **Clipping.** A node cut off by a parent with `overflow: hidden` or a fixed size.
20
+ - **Unknown components.** A name that isn't in `Components()`; it draws as a placeholder.
21
+
22
+ `Measure` gives every node's box in one frame, for checking alignment or sizes by numbers.
23
+
24
+ ## Accessibility
25
+
26
+ `check_accessibility`, or `Accessibility` in a snippet, runs axe-core against WCAG 2.2 AA in each frame and reports each
27
+ rule broken on the layers that break it, worst first. Fix what it finds within the design system:
28
+
29
+ | Finding | Fix in the design |
30
+ | -------------------------- | --------------------------------------------------------------------------------- |
31
+ | Text contrast too low | A stronger token: `foreground` instead of `muted-foreground`, or a darker variant |
32
+ | Button or link has no name | Visible text, or an `aria-label` prop on an icon-only button |
33
+ | Form field has no label | A `Label` with `htmlFor` matching the field's `id`, or an `aria-label` |
34
+ | Image has no alt text | `alt` that says what it shows, or `alt: ""` when it's decoration |
35
+ | ARIA reference to nothing | Add what it points at, such as the `TabsContent` for each `TabsTrigger` |
36
+ | Heading level skipped | Text tags that go down one level at a time: `h1`, then `h2` |
37
+ | Target too small | A bigger size variant, or more room around small controls |
38
+
39
+ Automated checks find some problems, not all. A clean result doesn't make a design accessible; say so when you report.
40
+
41
+ ## The console
42
+
43
+ `get_console` returns what the project's own components wrote to the console: errors, warnings and logs, from the
44
+ person's canvas and from your offscreen renders. React warnings about props, keys and nesting show up here, often before
45
+ they show on screen. `clear: true` empties it, so the next read shows only what's new.
46
+
47
+ React's warnings keep their `%s` placeholders, with the values that fill them listed after the message.
48
+
49
+ ## Trying it
50
+
51
+ Checks can't click. The person can: the Interact tool (I, or the pointing hand in the toolbar) hands their mouse and
52
+ keyboard to the real components, so tabs switch, menus open and fields take typing. Escape steps out of a component, and
53
+ a second Escape stops interacting; the design goes back to how it was. When behaviour matters (a menu, a dialog,
54
+ keyboard order), ask them to try it, and read `get_console` afterwards for errors it caused.
55
+
56
+ The Accessibility tab also shows the tab order on the canvas, numbered in the order the Tab key visits.
@@ -0,0 +1,48 @@
1
+ # Components
2
+
3
+ Two kinds of component show on the canvas, and they work differently.
4
+
5
+ **The project's components** are its code: `Button`, `Card`, `Tabs`, and library ones such as `nova/Accordion`. A
6
+ `component` node places one. You can't change what they look like from Parity, only choose their props and what goes in
7
+ their slots. `Components()` lists them.
8
+
9
+ **Component designs** are designs with `kind: "component"`: a stat card, a member row, a sidebar. They're made of the
10
+ project's components and layouts, and screens place them as `instance` nodes. Change the component design and every
11
+ instance follows.
12
+
13
+ ## Choosing a component
14
+
15
+ - Look before you build. `Components()` usually has what a screen needs; shadcn-style projects split a card into `Card`,
16
+ `CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, `CardFooter` and `CardAction`.
17
+ - Read its props with `Props("Badge")`. Variants and sizes come with their options; use those values exactly. A prop the
18
+ component doesn't declare comes back as a warning.
19
+ - Compose the parts the way the library intends: `Tabs` holds a `TabsList` of `TabsTrigger`s and one `TabsContent` per
20
+ trigger; `Table` holds `TableHeader` and `TableBody`, each with `TableRow`s of cells.
21
+ - Put children where they go. `slots.children` is what goes between the component's tags. Other slots, when a component
22
+ takes nodes as props, are named after the prop.
23
+
24
+ ## Icons
25
+
26
+ Icons are components named after their library, as in `lucide/Search` or `lucide/ChevronRight`. Size them with the
27
+ `size` prop (in pixels, 16 in most controls). Put an icon inside a button's `children` slot next to its text, or alone
28
+ with an `aria-label` prop when the button has no text.
29
+
30
+ ## Component designs and instances
31
+
32
+ Make a component design when something repeats with the same structure: rows in a list, cards in a grid, items in a
33
+ feed. Let `FindRepeats` find the candidates and `ExtractComponent` do the work: it makes the component design, works out
34
+ its params from what differs, and replaces each occurrence with an instance carrying its own values.
35
+
36
+ - Give params names that say what they are (`name`, `email`, `role`), not where they are.
37
+ - An instance's values are its `args`. Change them with `Update(instance, { args: { role: "Admin" } })`.
38
+ - A component design can have states too, such as a row that's loading. An instance's `state` picks which one it shows.
39
+ - A component design can have variants: choices each instance makes, like a size or a tone. Each option patches the
40
+ design the way a state does, and an instance picks one in its `args`: `Update(row, { args: { density: "compact" } })`.
41
+ - An instance can override what's inside it, such as one copy's title or a hidden badge. `Get` shows these as the
42
+ instance's `overrides`. People make them on the canvas; `execute` can't edit overrides or add variants yet, so to
43
+ change one copy, give the component design a param for it.
44
+ - A component design that needs a parent to render properly, such as a table row, is drawn inside that parent on its own
45
+ board. Rows extracted from a table get this automatically.
46
+ - Place a new instance with `Insert(parent, { type: "instance", design: "member-row", args: { … } })`.
47
+
48
+ Keep component designs in their own area of the canvas, away from screens, as `ExtractComponent` does.
@@ -0,0 +1,52 @@
1
+ # Designing with the project's system
2
+
3
+ The project already decided its colours, type, spacing and components. Your job is to compose them well, not to style
4
+ around them. A design that only uses the system's pieces is one the code can build without new CSS.
5
+
6
+ ## Spacing
7
+
8
+ Spacing is a scale of steps (`4` is 1rem in a default Tailwind project). Use a few steps consistently:
9
+
10
+ | Between | Steps |
11
+ | -------------------------------------------- | ------- |
12
+ | An icon and its label, a label and its field | 1 to 2 |
13
+ | Items in a list or fields in a form | 3 to 4 |
14
+ | Groups within a section | 6 |
15
+ | Sections of a page | 8 to 12 |
16
+ | A page's edge, desktop | 8 |
17
+ | A page's edge, mobile | 4 to 5 |
18
+
19
+ Space shows what belongs together: less inside a group than between groups. Let cards and other components keep their
20
+ own padding; add gaps between them, not padding around them.
21
+
22
+ ## Type
23
+
24
+ Use the type scale tokens (`text-sm`, `text-base`, `text-lg`, `text-2xl`) and weights 400 to 700. A page needs about
25
+ three sizes: its title, section titles and body. Secondary text uses `muted-foreground`, not a smaller size alone. Pick
26
+ the `tag` for meaning: one `h1` per screen, then `h2` for sections.
27
+
28
+ ## Colour
29
+
30
+ Semantic tokens carry meaning and follow the theme:
31
+
32
+ - `background` and `foreground` for the page; `card` and `card-foreground` for raised surfaces.
33
+ - `muted` and `muted-foreground` for quiet surfaces and secondary text.
34
+ - `primary` for the one main action on a screen, through a component's default variant rather than a raw background.
35
+ - `destructive` for actions that delete or can't be undone.
36
+ - `border` for dividers and outlines.
37
+
38
+ Palette colours (`color-emerald-500`) don't change with the theme, so keep them for data, such as chart series and
39
+ status dots, and check them in dark mode.
40
+
41
+ ## Composing
42
+
43
+ - Start from the page's structure: a header with the title and its actions, then the content, then anything secondary.
44
+ - Group with the components meant for it. A `Card` frames one subject; a `Table` shows records with the same fields; a
45
+ list of rows suits items people scan and act on; `Tabs` split one subject into views.
46
+ - One primary button per view. Other actions use `outline`, `secondary` or `ghost` variants, and destructive ones the
47
+ `destructive` variant, usually behind a confirmation.
48
+ - Align to one edge. Text and controls in a column share a left edge; actions sit together, at the end of a row or the
49
+ bottom of a form.
50
+ - Show status with the system's pieces: `Badge` for a status or count, `Skeleton` for loading, `Empty` for nothing yet.
51
+ - Fill designs with believable data: real names, dates, amounts and lengths. Include a long one; it finds layout
52
+ problems a short one hides.
@@ -0,0 +1,32 @@
1
+ # Phones and small viewports
2
+
3
+ In Parity a phone layout is the same design in a mobile viewport, patched where it needs to differ. Show a mobile mode
4
+ beside the main frame (`UpdateDesign(design, { showModes: ["mobile-light"] })`) and fix what breaks there.
5
+
6
+ ## What usually changes
7
+
8
+ | On desktop | On a phone |
9
+ | ------------------------------------ | -------------------------------------------------- |
10
+ | A sidebar | Hidden, with navigation in a top bar or a menu |
11
+ | Rows of cards or columns of a grid | One column: `columns: 1`, or `direction: "column"` |
12
+ | A header row with actions at the end | Title above, actions below or in a menu |
13
+ | Page padding of 8 steps | 4 to 5 steps |
14
+ | A wide table | Fewer columns, or each row as a stacked card |
15
+ | Side-by-side form fields | Stacked, full width |
16
+
17
+ Patch these with `Responsive(node, "mobile", patch)`. Hiding a column in a table means hiding its header cell and the
18
+ matching cell in the row component design.
19
+
20
+ ## Touch
21
+
22
+ - Controls need room for a finger. WCAG asks for targets of at least 24 by 24 pixels; phones are easier at about 44. Use
23
+ the components' default or large sizes, and keep small controls apart.
24
+ - Put the main action where a thumb reaches it: full width at the bottom of a form, or at the bottom of the screen.
25
+ - Nothing can depend on hover. Anything a hover shows on desktop needs another way in.
26
+
27
+ ## Content
28
+
29
+ - Text wraps more. Check long names, emails and numbers in every state; `lines: 1` keeps a single line with an ellipsis
30
+ where wrapping would break a row.
31
+ - Lead with less. A phone shows the first few items; put the most important ones first.
32
+ - Check the mobile frame with `find_problems`: overflow there usually means a row that needs to stack.
@@ -0,0 +1,55 @@
1
+ # States and modes
2
+
3
+ A design shows on the canvas as a grid of frames: its states down, and the modes it shows across. Both multiply what you
4
+ have to check, and both are cheap to add, so use them instead of copying designs.
5
+
6
+ ## States
7
+
8
+ A state is one situation the design can be in. Most screens need some of these:
9
+
10
+ | State | What changes |
11
+ | -------------- | ---------------------------------------------------------------------------- |
12
+ | Loading | Content swaps for skeletons of the same size, so nothing jumps when it loads |
13
+ | Empty | The list or table hides; an empty state says why and offers the next step |
14
+ | Error | A message near what failed, saying what happened and what to do |
15
+ | Partly filled | One item, a long name, a missing photo: the cases real data brings |
16
+ | Disabled, busy | A submit button that's disabled or shows progress while saving |
17
+ | Permissions | What a viewer sees compared with an admin |
18
+
19
+ Build states from the base design. Put what only some states need (skeletons, an empty state, an error message) into the
20
+ base with `hidden: true`, then show and hide things per state with `AddState(design, { name, changes })`. A state stores
21
+ only its changes, so editing the base updates every state.
22
+
23
+ Name states for the situation ("No members yet", "Invite failed"), not the change ("Table hidden").
24
+
25
+ ## Modes
26
+
27
+ Modes are the project's, shared by every design. Each mode picks one option of each variable:
28
+
29
+ - **Viewport:** a width, and a device. Desktop, tablet and mobile are typical.
30
+ - **Theme:** a class on the frame, such as `dark`, that switches the project's tokens.
31
+ - **Locale:** `lang` and `dir` attributes, for languages and right-to-left scripts.
32
+
33
+ `GetModes()` lists them. A design shows its main mode and, beside it, any others you choose with
34
+ `UpdateDesign(design, { showModes: ["desktop-dark", "mobile-light"] })`. Show the modes that matter for the design: a
35
+ dashboard in desktop and mobile, a component in light and dark.
36
+
37
+ ## Viewports and responsive patches
38
+
39
+ One design covers every viewport. Patch the differences with `Responsive(node, viewport, patch)` on the nodes that
40
+ change:
41
+
42
+ ```js
43
+ Responsive("dashboard/Sidebar", "mobile", { hidden: true })
44
+ Responsive("dashboard/Stats", "tablet", { style: { columns: 2 } })
45
+ Responsive("dashboard/Stats", "mobile", { style: { columns: 1 } })
46
+ Responsive("dashboard/Content", "mobile", { style: { padding: [5, 4] } })
47
+ ```
48
+
49
+ The viewport is the viewport option's id, not the mode's. A frame is as wide as its viewport and as tall as its content,
50
+ unless the design sets a size for that viewport.
51
+
52
+ ## Checking them all
53
+
54
+ After a change, screenshot every frame the design shows: `Screenshot(design, { state: "all", mode: "shown" })`. Check
55
+ dark mode for colours that only worked on white, mobile for rows that don't fit, and each state for a layout that jumps.
@@ -0,0 +1,43 @@
1
+ # Web app screens
2
+
3
+ A web app is used, not read. People come to a screen to do something: check a number, find a record, change a setting.
4
+ Design each screen around that job.
5
+
6
+ ## Before you design
7
+
8
+ Answer three questions, from the request or by asking:
9
+
10
+ 1. **Who uses this screen, and what do they come to do?** The main task gets the most space and the first look.
11
+ 2. **What data does it show?** Real fields, typical amounts, and the extremes: none, one, thousands, a very long name.
12
+ 3. **What can go wrong?** Loading, empty, errors, no permission. Each is a state of the design.
13
+
14
+ ## Layout
15
+
16
+ - **App shell.** Navigation in a sidebar or top bar, then the page. Make the shell a component design (`app-sidebar`,
17
+ `app-top-bar`) and place it as an instance on every screen, so it stays the same everywhere.
18
+ - **Page header.** The page's title, a line saying what it's for when that isn't obvious, and its main actions at the
19
+ end of the same row.
20
+ - **Content.** Lead with what the person came for. On a dashboard that's a few key numbers, then what changed, then
21
+ detail. On a list, the list, with search and filters above it.
22
+ - **Width.** Forms and reading text work best narrow (a `maxWidth` around 160 steps); tables and dashboards use the
23
+ room.
24
+
25
+ ## Common screens
26
+
27
+ - **Dashboard.** A row of stat cards (a component design), then a chart or a table of what needs attention. Every number
28
+ says what it is and, where it helps, how it changed.
29
+ - **List and table.** A header with the count and the main action, search and filters, the table, and pagination or a
30
+ "load more". Row actions sit at the end of the row. Plan the empty state and the filtered-to-nothing state, which are
31
+ different.
32
+ - **Detail.** The record's name and status at the top, its main facts in a card, then related lists in tabs.
33
+ - **Settings.** Sections with a title and a line of explanation on one side and the fields on the other, or stacked on
34
+ mobile. Save per section, and show when it saved.
35
+ - **Forms.** One column. Labels above fields, help text under them, errors under the field they're about, in
36
+ `destructive`. The primary button at the end; disable it or show progress while it saves.
37
+ - **Sign in and onboarding.** One task per screen, centred, narrow, with the product's name or logo above it.
38
+
39
+ ## Behaviour
40
+
41
+ Designs are static, but they should show behaviour as states: a menu open, a dialog over the page, a toast after saving,
42
+ a row being edited. When you're unsure whether something works, ask the person to try it with the Interact tool; it uses
43
+ the real components.