@blackbelt-technology/frontend-mockup-loop 0.5.4
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/.pi/skills/frontend-mockup-loop/SKILL.md +208 -0
- package/README.md +104 -0
- package/package.json +60 -0
- package/presets-data/apple-hig/contract.tokens.json +31 -0
- package/presets-data/apple-hig/rubric.json +13 -0
- package/presets-data/apple-hig/rules.md +44 -0
- package/presets-data/fluent-2/contract.tokens.json +31 -0
- package/presets-data/fluent-2/rubric.json +13 -0
- package/presets-data/material-3/contract.tokens.json +34 -0
- package/presets-data/material-3/rubric.json +13 -0
- package/presets-data/mui/contract.tokens.json +32 -0
- package/presets-data/mui/rubric.json +13 -0
- package/presets-data/shadcn/contract.tokens.json +31 -0
- package/presets-data/shadcn/rubric.json +13 -0
- package/references/ux-best-practices.md +256 -0
- package/src/extension.ts +518 -0
- package/src/presets/contract.ts +116 -0
- package/src/presets/registry.ts +154 -0
- package/src/presets/validators.ts +265 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: frontend-mockup-loop
|
|
3
|
+
description: Plan, build, and iterate UX-friendly frontend mockups via a ground→contract→mockup→test→fix→learn loop, acting as an expert UX designer who grounds every decision in externally documented public design rules (Nielsen heuristics, Laws of UX, WCAG, GOV.UK/USWDS/Material). Uses the bundled serve_mockup, score_mockup, and init_ui_contract tools plus a ui-contract.md design control plane to keep screens consistent. Works in any React/Tailwind/shadcn (or plain HTML) project. Use when designing new screens, adapting existing UI, enforcing cross-screen consistency, or doing a UX review. Triggers: "design a screen", "mockup this UI", "wireframe", "make the UI consistent", "adapt the existing design", "improve this layout", "UX review", "is this good UX".
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
author: blackbelt-technology
|
|
7
|
+
version: "0.2"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# frontend-mockup-loop
|
|
11
|
+
|
|
12
|
+
A disciplined loop for designing frontend surfaces. It exists to defeat
|
|
13
|
+
**distributional convergence**: an undirected agent regresses to the
|
|
14
|
+
statistical mean of its training data — generic Inter font, a purple gradient,
|
|
15
|
+
a centered hero. "Make it look better" just returns the average again.
|
|
16
|
+
|
|
17
|
+
The fix the whole agentic-design field converged on, and what this loop
|
|
18
|
+
enforces every time:
|
|
19
|
+
|
|
20
|
+
1. **deliberate direction** from a real reference (GROUND),
|
|
21
|
+
2. a **consistent token system** (the ui-contract),
|
|
22
|
+
3. a **screenshot feedback loop** (eyes on output).
|
|
23
|
+
|
|
24
|
+
This skill is paired with an extension that registers five tools:
|
|
25
|
+
`serve_mockup`, `score_mockup`, `init_ui_contract`, `list_design_systems`,
|
|
26
|
+
`validate_mockup`.
|
|
27
|
+
|
|
28
|
+
## Select a design system (optional)
|
|
29
|
+
|
|
30
|
+
The loop runs design-system **agnostic** by default (generic anti-slop rubric).
|
|
31
|
+
To target a specific system, pick a preset and pass its id to the tools'
|
|
32
|
+
`system` param. v1 presets (`list_design_systems` enumerates them):
|
|
33
|
+
|
|
34
|
+
| id | system | platform | substrate |
|
|
35
|
+
|---|---|---|---|
|
|
36
|
+
| `shadcn` | shadcn/ui + Tailwind | web | HTML + Tailwind |
|
|
37
|
+
| `mui` | Material UI | web | HTML |
|
|
38
|
+
| `material-3` | Material Design 3 | web | HTML |
|
|
39
|
+
| `fluent-2` | Fluent 2 | web | HTML |
|
|
40
|
+
| `apple-hig` | Apple HIG | iOS | HTML approximation → SwiftUI on promote |
|
|
41
|
+
|
|
42
|
+
With a system selected: `init_ui_contract{system}` writes that system's DTCG
|
|
43
|
+
token contract (from a bundled, offline snapshot; `refresh:true` re-fetches
|
|
44
|
+
upstream), `score_mockup{system}` swaps in the system's boolean rubric, and
|
|
45
|
+
`validate_mockup{system,dir}` runs the gated pipeline.
|
|
46
|
+
|
|
47
|
+
### Gate vs advisory
|
|
48
|
+
|
|
49
|
+
Validation is layered. **Gates** block `pass`; **advisory** layers only score
|
|
50
|
+
and drive the fix loop (LLM visual scores skew positive — never hard-block):
|
|
51
|
+
|
|
52
|
+
- **L1 token-lint** — static; HARD GATE when a linter applies (off-token color
|
|
53
|
+
literals fail shadcn/material-3).
|
|
54
|
+
- **L2 a11y floor** — rendered axe + WCAG contrast; HARD GATE, every system.
|
|
55
|
+
- **L3 named-system auditor** — `hig-doctor` / `material3-mcp` etc., advisory,
|
|
56
|
+
shelled out only if installed (absent → skipped + noted, never errors).
|
|
57
|
+
- **L4 vision rubric** — per-preset boolean checks; `score = pass/N` computed in
|
|
58
|
+
code, advisory.
|
|
59
|
+
|
|
60
|
+
`validate_mockup` returns `{ gates, advisory, pass }`; `pass` is gate-only.
|
|
61
|
+
|
|
62
|
+
### Apple HIG in a browser-first loop
|
|
63
|
+
|
|
64
|
+
Apple publishes no token JSON, so `apple-hig` ships a hand-authored rule pack
|
|
65
|
+
(`presets-data/apple-hig/rules.md`). Render an **HTML approximation** of the iOS
|
|
66
|
+
screen so `serve_mockup` can serve it and `hig-doctor` (if installed) can audit
|
|
67
|
+
it — no SwiftUI/Xcode required in-loop:
|
|
68
|
+
|
|
69
|
+
- SF Pro stack: `font-family: -apple-system, "SF Pro Text", system-ui`.
|
|
70
|
+
- 44×44pt minimum tap targets; 8pt spacing grid.
|
|
71
|
+
- Safe areas: `padding: env(safe-area-inset-top) … env(safe-area-inset-bottom)`.
|
|
72
|
+
- Bottom tab bar, **≤5 items**; iOS semantic colors (label, systemBackground,
|
|
73
|
+
systemBlue), no hardcoded brand hex on system chrome.
|
|
74
|
+
|
|
75
|
+
On **PROMOTE**, optionally emit real SwiftUI — validated on source by
|
|
76
|
+
`hig-doctor` / `orchard-hig` (no live browser preview; real-device fidelity
|
|
77
|
+
needs macOS/Xcode). SwiftUI is never required for the in-loop preview.
|
|
78
|
+
|
|
79
|
+
## Act as an expert UX designer
|
|
80
|
+
|
|
81
|
+
**Rule: ground every UX decision in an externally documented, public-facing
|
|
82
|
+
design rule — never invent one.** When you make a call, you must be able to name
|
|
83
|
+
the rule and cite its public source. "I think it looks better" is not a reason;
|
|
84
|
+
"Hick's Law — reduce the choices here (lawsofux.com/hicks-law)" is.
|
|
85
|
+
|
|
86
|
+
The full citable rule corpus lives in
|
|
87
|
+
[`references/ux-best-practices.md`](../../../references/ux-best-practices.md):
|
|
88
|
+
Nielsen's 10 heuristics, Laws of UX, Gestalt, cognitive load, per-component
|
|
89
|
+
pattern rules, the 5-step expert evaluation protocol, and a 22-item checkable
|
|
90
|
+
rubric seed. **Read it before designing or reviewing.**
|
|
91
|
+
|
|
92
|
+
**Source order (adapt, don't copy):** the selected design system's documented
|
|
93
|
+
guidance first → then the universal sources, in licensing-safe order (USWDS is
|
|
94
|
+
CC0; GOV.UK is OGL; NN/g + Laws of UX cite-with-attribution; Material/Carbon are
|
|
95
|
+
Apache-2.0). Adapt the *principle* to this product; never copy proprietary
|
|
96
|
+
assets/text (Apple HIG, Refactoring UI, Mobbin).
|
|
97
|
+
|
|
98
|
+
## When to Use
|
|
99
|
+
|
|
100
|
+
Designing or refining any frontend surface — new screens, redesigns, or a
|
|
101
|
+
consistency pass across existing screens. Skip for trivial one-class tweaks.
|
|
102
|
+
Not for backend/protocol work.
|
|
103
|
+
|
|
104
|
+
## Procedure
|
|
105
|
+
|
|
106
|
+
### 1. GROUND — adapt what ships + what's documented, don't invent
|
|
107
|
+
Two grounds, both external:
|
|
108
|
+
- **The real UI** — open the running app and READ the authoritative component
|
|
109
|
+
source. Capture the EXACT tokens already in use: class names, CSS custom
|
|
110
|
+
properties (`--background`, `--primary`, `--radius`), spacing, dark + light.
|
|
111
|
+
- **The documented rules** — open `references/ux-best-practices.md` and the
|
|
112
|
+
selected design system's public guidance. Identify the specific patterns and
|
|
113
|
+
laws that govern this surface (e.g. a form → NN/g web-form-design + GOV.UK
|
|
114
|
+
error-summary; a nav → Hick's Law + hamburger-menu guidance).
|
|
115
|
+
|
|
116
|
+
Designing without either ground produces a parallel style that looks "off" and a
|
|
117
|
+
UX that violates well-known rules — the opposite of adapting documented design.
|
|
118
|
+
|
|
119
|
+
### 2. CONTRACT — the consistency control plane
|
|
120
|
+
Read or scaffold `ui-contract.md` (run `init_ui_contract`). It is the single
|
|
121
|
+
source of truth for cross-screen properties: color ramps, spacing scale, type
|
|
122
|
+
scale, radius, elevation, motion, component invariants. **Every value
|
|
123
|
+
references a design token — never a raw hex or px literal.** If a surface needs
|
|
124
|
+
a token that doesn't exist, add it to the theme layer first, then cite it in
|
|
125
|
+
the contract. This file is what stops screens from drifting apart.
|
|
126
|
+
|
|
127
|
+
### 3. MOCKUP — diverge in HTML, serve it live
|
|
128
|
+
Build standalone HTML/Tailwind mockups grounded in steps 1–2. Serve them with
|
|
129
|
+
`serve_mockup` and hand back the clickable **local + LAN URL** (the LAN URL
|
|
130
|
+
opens on a phone) — **not a screenshot** — so the human reacts to a real page.
|
|
131
|
+
Render dark AND light.
|
|
132
|
+
|
|
133
|
+
### 4. TEST — run the expert-UX evaluation protocol
|
|
134
|
+
Run `score_mockup` to capture full-page screenshots at mobile/tablet/desktop
|
|
135
|
+
widths, then apply the **5-step protocol** from `references/ux-best-practices.md`:
|
|
136
|
+
1. **Accessibility floor (hard gate)** — contrast 4.5:1, target size, focus
|
|
137
|
+
visible, color-not-sole-channel, reduced-motion.
|
|
138
|
+
2. **Heuristic boolean rubric** — the 22-item rubric seed (Nielsen + Laws of UX
|
|
139
|
+
+ component rules) scored yes/no; for a user flow, the cognitive-walkthrough
|
|
140
|
+
4 questions per step.
|
|
141
|
+
3. **PURE friction** — rate each task step green/yellow/red; worst step wins.
|
|
142
|
+
4. **Severity 0–4** per defect (Nielsen scale).
|
|
143
|
+
5. **Prioritized fix list** — accessibility-gate first, then severity.
|
|
144
|
+
|
|
145
|
+
**Score = passed / N, derived in code** — never a subjective "looks good" and
|
|
146
|
+
never a free-form float (LLM visual scores skew positive). Each failed check
|
|
147
|
+
cites the rule it violates.
|
|
148
|
+
|
|
149
|
+
### 5. FIX — one criterion at a time
|
|
150
|
+
Apply the top failing item, re-serve, re-score. Loop 3–5 until every rubric
|
|
151
|
+
line passes in both themes at all three breakpoints.
|
|
152
|
+
|
|
153
|
+
### 6. PROMOTE — close the apply-gap
|
|
154
|
+
Translate the approved HTML direction into real React/shadcn components.
|
|
155
|
+
Do this in an ISOLATED environment (temp workspace, non-production ports),
|
|
156
|
+
never against a live server. Map the mockup's tokens 1:1 so shipped code
|
|
157
|
+
matches the approved mockup with zero drift.
|
|
158
|
+
|
|
159
|
+
### 7. LEARN — compound across runs
|
|
160
|
+
Record durable taste decisions so the next run starts smarter: stable rules →
|
|
161
|
+
agent memory; repo design rules → patch `ui-contract.md`; one-off rationale →
|
|
162
|
+
the change's notes.
|
|
163
|
+
|
|
164
|
+
## Tools (bundled by the extension)
|
|
165
|
+
|
|
166
|
+
- `serve_mockup{dir, port?, stop?}` — Node static server on 0.0.0.0; returns
|
|
167
|
+
local + LAN URLs. Zero external deps.
|
|
168
|
+
- `score_mockup{url, widths?, outDir?, system?}` — Playwright breakpoint screenshots +
|
|
169
|
+
scoring rubric. Falls back to install guidance if Playwright is absent
|
|
170
|
+
(`npm i -D playwright && npx playwright install chromium`).
|
|
171
|
+
- `init_ui_contract{path?, force?, system?, refresh?}` — scaffold the
|
|
172
|
+
token-referencing contract. With `system`, write that preset's DTCG contract
|
|
173
|
+
(offline snapshot; `refresh` re-fetches upstream first). No `system` →
|
|
174
|
+
generic blank template (unchanged).
|
|
175
|
+
- `list_design_systems{}` — enumerate the preset registry (id, label, platform,
|
|
176
|
+
substrate, validators).
|
|
177
|
+
- `validate_mockup{system, url?, dir?}` — run L1+L2 (gates) + L3+L4 (advisory);
|
|
178
|
+
returns `{ gates, advisory, pass }`. Pass `dir` so L1/L2 can scan the source.
|
|
179
|
+
|
|
180
|
+
## Pitfalls
|
|
181
|
+
|
|
182
|
+
- Do NOT verify against a live/production server — isolate the env so mockup
|
|
183
|
+
edits actually load.
|
|
184
|
+
- Do NOT put raw hex/px in the contract or mockups; reference tokens, else
|
|
185
|
+
consistency erodes the moment a theme changes.
|
|
186
|
+
- Do NOT skip GROUND — parallel styling looks "off" next to shipped screens.
|
|
187
|
+
- Do NOT hand back screenshots for HUMAN review when a live URL is possible.
|
|
188
|
+
Screenshots are for the AGENT's scoring step; live URLs are for the human.
|
|
189
|
+
- Do NOT let "make it nicer" be the instruction to yourself — score against the
|
|
190
|
+
named rubric.
|
|
191
|
+
- Do NOT invent a UX rule or justify a decision by taste alone — cite an
|
|
192
|
+
external documented public source (see `references/ux-best-practices.md`).
|
|
193
|
+
- Do NOT block "pass" on advisory taste while a WCAG-AA or severity-4 defect
|
|
194
|
+
remains — the accessibility floor is the hard gate.
|
|
195
|
+
|
|
196
|
+
## Verification
|
|
197
|
+
|
|
198
|
+
- `ui-contract.md` exists; every value references a token; the new surface's
|
|
199
|
+
tokens appear in it.
|
|
200
|
+
- A live mockup URL (local + LAN) was handed back and renders in BOTH themes at
|
|
201
|
+
mobile/tablet/desktop.
|
|
202
|
+
- A written rubric passes — not a subjective "looks good".
|
|
203
|
+
- Every UX decision traces to a cited external rule (heuristic / law / pattern /
|
|
204
|
+
WCAG criterion), not taste.
|
|
205
|
+
- The accessibility floor passes (no WCAG-AA or severity-4 defect open).
|
|
206
|
+
- If promoted: components were verified in an isolated env; production was left
|
|
207
|
+
untouched.
|
|
208
|
+
- Durable learnings were recorded so the loop compounds.
|
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# @blackbelt-technology/frontend-mockup-loop
|
|
2
|
+
|
|
3
|
+
A pi package — **extension + skill** — for a disciplined frontend design loop:
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
GROUND → CONTRACT → MOCKUP → TEST → FIX → PROMOTE → LEARN
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
It exists to defeat *distributional convergence*: an undirected agent regresses
|
|
10
|
+
to the statistical mean (generic Inter font, purple gradient, centered hero).
|
|
11
|
+
The fix — deliberate direction, a consistent token system, and a screenshot
|
|
12
|
+
feedback loop — is what this loop enforces.
|
|
13
|
+
|
|
14
|
+
Generic: works in any React/Tailwind/shadcn (or plain HTML) project.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pi install npm:@blackbelt-technology/frontend-mockup-loop
|
|
20
|
+
# or try without installing:
|
|
21
|
+
pi -e npm:@blackbelt-technology/frontend-mockup-loop
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This registers:
|
|
25
|
+
|
|
26
|
+
- **Skill** `frontend-mockup-loop` — the 7-step workflow (load via
|
|
27
|
+
`/skill:frontend-mockup-loop`).
|
|
28
|
+
- **Tools** the agent can call:
|
|
29
|
+
| Tool | Purpose |
|
|
30
|
+
|------|---------|
|
|
31
|
+
| `serve_mockup` | Serve a mockup dir over HTTP on `0.0.0.0`; returns clickable **local + LAN** URLs (LAN works on a phone). Zero deps. |
|
|
32
|
+
| `score_mockup` | Capture full-page screenshots at mobile/tablet/desktop widths via Playwright; returns paths + a scoring rubric. With `system`, uses that preset's boolean rubric. |
|
|
33
|
+
| `init_ui_contract` | Scaffold a token-referencing `ui-contract.md` consistency control plane. With `system`, write that preset's DTCG token contract. |
|
|
34
|
+
| `list_design_systems` | Enumerate the selectable design-system presets. |
|
|
35
|
+
| `validate_mockup` | Run the layered validation pipeline for a system (L1+L2 gates, L3+L4 advisory); returns `{ gates, advisory, pass }`. |
|
|
36
|
+
- **Command** `/mockup-loop` — print the loop and point at the skill.
|
|
37
|
+
|
|
38
|
+
## Selectable design systems
|
|
39
|
+
|
|
40
|
+
The loop runs design-system **agnostic** by default. Pass `--system <id>` (the
|
|
41
|
+
tools' `system` param) to target a specific system. v1 presets:
|
|
42
|
+
|
|
43
|
+
| id | system | platform | substrate |
|
|
44
|
+
|---|---|---|---|
|
|
45
|
+
| `shadcn` | shadcn/ui + Tailwind | web | HTML + Tailwind |
|
|
46
|
+
| `mui` | Material UI | web | HTML |
|
|
47
|
+
| `material-3` | Material Design 3 | web | HTML |
|
|
48
|
+
| `fluent-2` | Fluent 2 | web | HTML |
|
|
49
|
+
| `apple-hig` | Apple HIG | iOS | HTML approximation → SwiftUI on promote |
|
|
50
|
+
|
|
51
|
+
- `init_ui_contract{system:"shadcn"}` writes the shadcn DTCG contract from a
|
|
52
|
+
**bundled offline snapshot** (`presets-data/<id>/`); no `system` still writes
|
|
53
|
+
the generic blank template (back-compat).
|
|
54
|
+
- `validate_mockup{system,dir}` gates on L1 (token-lint) + L2 (axe + WCAG
|
|
55
|
+
contrast) and scores on L3 (named-system auditor) + L4 (boolean rubric).
|
|
56
|
+
- Apple HIG ships a hand-authored rule pack (`presets-data/apple-hig/rules.md`);
|
|
57
|
+
rendered as an HTML approximation in-loop, SwiftUI emitted only on PROMOTE.
|
|
58
|
+
|
|
59
|
+
### Dependency posture
|
|
60
|
+
|
|
61
|
+
- **Bundled** (hard deps): `@axe-core/playwright` + `eslint-plugin-tailwindcss`
|
|
62
|
+
(shadcn L1). WCAG contrast math is inline (no extra dep).
|
|
63
|
+
- **Optional** (shelled out only if installed, else skipped + noted):
|
|
64
|
+
`hig-doctor`, `material3-mcp`, MUI/Fluent eslint plugins, `lumo`.
|
|
65
|
+
- `score_mockup` uses Playwright if present — enable breakpoint capture with
|
|
66
|
+
`npm i -D playwright && npx playwright install chromium`; without it,
|
|
67
|
+
`score_mockup` returns the rubric plus manual-capture guidance.
|
|
68
|
+
|
|
69
|
+
### Refreshing snapshots
|
|
70
|
+
|
|
71
|
+
Bundled token snapshots (`presets-data/<id>/contract.tokens.json`) are versioned
|
|
72
|
+
with the package and lag upstream. `init_ui_contract{system,refresh:true}`
|
|
73
|
+
re-fetches the upstream source before writing. Upstream sources per preset:
|
|
74
|
+
|
|
75
|
+
| preset | upstream source |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `shadcn` | shadcn CSS variables (default theme) → DTCG |
|
|
78
|
+
| `mui` | `@mui/material` `createTheme()` defaults → DTCG |
|
|
79
|
+
| `material-3` | Material 3 `--md-sys-*` baseline tokens → DTCG |
|
|
80
|
+
| `fluent-2` | `@fluentui/tokens` `webLightTheme` → DTCG |
|
|
81
|
+
| `apple-hig` | hand-authored rule pack (no upstream token JSON) |
|
|
82
|
+
|
|
83
|
+
## Expert UX designer mode
|
|
84
|
+
|
|
85
|
+
The skill acts as an expert UX designer: **every decision is grounded in an
|
|
86
|
+
externally documented, public-facing design rule** (Nielsen's 10 heuristics,
|
|
87
|
+
Laws of UX, Gestalt, WCAG 2.2, GOV.UK/USWDS/Material patterns) — never invented.
|
|
88
|
+
The full citable rule corpus is bundled at
|
|
89
|
+
[`references/ux-best-practices.md`](references/ux-best-practices.md): the source
|
|
90
|
+
hierarchy (licensing-safe), universal laws, per-component pattern rules, the
|
|
91
|
+
5-step expert evaluation protocol, and a 22-item checkable rubric seed used by
|
|
92
|
+
`score_mockup` / `validate_mockup`.
|
|
93
|
+
|
|
94
|
+
## The design contract
|
|
95
|
+
|
|
96
|
+
`ui-contract.md` is the single source of truth for cross-screen consistency:
|
|
97
|
+
color ramps, spacing/type scales, radius, elevation, motion, component
|
|
98
|
+
invariants — **every value references a design token, never a raw hex/px**.
|
|
99
|
+
`init_ui_contract` scaffolds it; you fill it from the real tokens captured in
|
|
100
|
+
the GROUND step.
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@blackbelt-technology/frontend-mockup-loop",
|
|
3
|
+
"version": "0.5.4",
|
|
4
|
+
"description": "Pi extension + skill for a ground→contract→mockup→test→fix→learn frontend design loop. Ships a live mockup server tool, a Playwright breakpoint-screenshot tool, and a design-contract scaffolder. Works in any React/Tailwind/shadcn project.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/BlackBeltTechnology/pi-agent-dashboard",
|
|
9
|
+
"directory": "packages/mockup-loop"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"pi-package",
|
|
17
|
+
"pi-extension",
|
|
18
|
+
"pi-skill",
|
|
19
|
+
"frontend",
|
|
20
|
+
"mockup",
|
|
21
|
+
"wireframe",
|
|
22
|
+
"design-system",
|
|
23
|
+
"ux",
|
|
24
|
+
"accessibility",
|
|
25
|
+
"ui"
|
|
26
|
+
],
|
|
27
|
+
"pi": {
|
|
28
|
+
"extensions": [
|
|
29
|
+
"src/extension.ts"
|
|
30
|
+
],
|
|
31
|
+
"skills": [
|
|
32
|
+
".pi/skills/frontend-mockup-loop"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"src/",
|
|
37
|
+
"!src/__tests__",
|
|
38
|
+
"presets-data/",
|
|
39
|
+
".pi/skills/",
|
|
40
|
+
"references/",
|
|
41
|
+
"README.md"
|
|
42
|
+
],
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@axe-core/playwright": "^4.10.0",
|
|
45
|
+
"eslint-plugin-tailwindcss": "^3.17.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
49
|
+
"typebox": "*"
|
|
50
|
+
},
|
|
51
|
+
"peerDependenciesMeta": {
|
|
52
|
+
"@earendil-works/pi-coding-agent": {
|
|
53
|
+
"optional": true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
58
|
+
"typebox": "*"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$description": "Apple Human Interface Guidelines — hand-authored rule pack in DTCG-shaped envelope. Apple publishes no machine-readable token JSON; semantic colors resolve at OS runtime. Values below approximate iOS light-mode system semantics for an HTML preview. See rules.md for the full rule pack.",
|
|
3
|
+
"color": {
|
|
4
|
+
"label": { "$type": "color", "$value": "rgba(0, 0, 0, 1)" },
|
|
5
|
+
"secondary-label": { "$type": "color", "$value": "rgba(60, 60, 67, 0.6)" },
|
|
6
|
+
"tertiary-label": { "$type": "color", "$value": "rgba(60, 60, 67, 0.3)" },
|
|
7
|
+
"system-background": { "$type": "color", "$value": "#ffffff" },
|
|
8
|
+
"secondary-system-background": { "$type": "color", "$value": "#f2f2f7" },
|
|
9
|
+
"separator": { "$type": "color", "$value": "rgba(60, 60, 67, 0.29)" },
|
|
10
|
+
"system-blue": { "$type": "color", "$value": "#007aff" },
|
|
11
|
+
"system-green": { "$type": "color", "$value": "#34c759" },
|
|
12
|
+
"system-red": { "$type": "color", "$value": "#ff3b30" }
|
|
13
|
+
},
|
|
14
|
+
"typography": {
|
|
15
|
+
"font-family": { "$type": "fontFamily", "$value": "-apple-system, \"SF Pro Text\", \"SF Pro Display\", system-ui, sans-serif" },
|
|
16
|
+
"body": { "$type": "dimension", "$value": "17px" },
|
|
17
|
+
"headline": { "$type": "dimension", "$value": "17px" },
|
|
18
|
+
"title-3": { "$type": "dimension", "$value": "20px" },
|
|
19
|
+
"caption-1": { "$type": "dimension", "$value": "12px" }
|
|
20
|
+
},
|
|
21
|
+
"spacing": {
|
|
22
|
+
"1": { "$type": "dimension", "$value": "4px" },
|
|
23
|
+
"2": { "$type": "dimension", "$value": "8px" },
|
|
24
|
+
"3": { "$type": "dimension", "$value": "16px" },
|
|
25
|
+
"4": { "$type": "dimension", "$value": "20px" },
|
|
26
|
+
"5": { "$type": "dimension", "$value": "24px" }
|
|
27
|
+
},
|
|
28
|
+
"sizing": {
|
|
29
|
+
"min-touch-target": { "$type": "dimension", "$value": "44px" }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"system": "apple-hig",
|
|
3
|
+
"label": "Apple HIG boolean rubric",
|
|
4
|
+
"checks": [
|
|
5
|
+
{ "id": "touch-44", "text": "All tap targets are at least 44x44pt." },
|
|
6
|
+
{ "id": "tab-bar-5", "text": "Bottom tab bar has 5 or fewer items." },
|
|
7
|
+
{ "id": "dynamic-type", "text": "Text uses relative/Dynamic-Type-friendly sizing, not fixed unscalable px." },
|
|
8
|
+
{ "id": "safe-areas", "text": "Layout respects safe-area insets (env(safe-area-inset-*))." },
|
|
9
|
+
{ "id": "semantic-colors", "text": "Colors use iOS semantic system colors (label, systemBackground, systemBlue), no hardcoded brand hex for system chrome." },
|
|
10
|
+
{ "id": "sf-pro", "text": "Type uses the SF Pro / -apple-system font stack." },
|
|
11
|
+
{ "id": "spacing-grid", "text": "Spacing aligns to the 8pt grid." }
|
|
12
|
+
]
|
|
13
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Apple HIG rule pack
|
|
2
|
+
|
|
3
|
+
Apple publishes no machine-readable token JSON — semantic colors and Dynamic
|
|
4
|
+
Type styles resolve at OS runtime. This rule pack encodes the checkable subset
|
|
5
|
+
for an HTML approximation of an iOS screen (servable by `serve_mockup`,
|
|
6
|
+
auditable by `hig-doctor` if installed). SwiftUI is emitted only on PROMOTE.
|
|
7
|
+
|
|
8
|
+
## Semantic colors
|
|
9
|
+
|
|
10
|
+
Use iOS semantic system colors, never hardcoded brand hex for system chrome:
|
|
11
|
+
|
|
12
|
+
- `label` / `secondaryLabel` / `tertiaryLabel` for text.
|
|
13
|
+
- `systemBackground` / `secondarySystemBackground` for surfaces.
|
|
14
|
+
- `separator` for hairlines.
|
|
15
|
+
- `systemBlue` (tint), `systemGreen`, `systemRed` for actions/status.
|
|
16
|
+
|
|
17
|
+
In HTML, map these to CSS variables and reference them — no raw hex on chrome.
|
|
18
|
+
|
|
19
|
+
## Typography — Dynamic Type
|
|
20
|
+
|
|
21
|
+
- Font stack: `-apple-system, "SF Pro Text", "SF Pro Display", system-ui`.
|
|
22
|
+
- Body text 17px baseline; honor Dynamic Type with relative sizing (rem/em or
|
|
23
|
+
`font: -apple-system-body`), not fixed unscalable px.
|
|
24
|
+
- Text styles: largeTitle, title1–3, headline, body, callout, subhead,
|
|
25
|
+
footnote, caption1–2.
|
|
26
|
+
|
|
27
|
+
## Layout
|
|
28
|
+
|
|
29
|
+
- **Touch targets**: minimum 44×44pt for every interactive element.
|
|
30
|
+
- **8pt grid**: spacing aligns to multiples of 8 (4 allowed for fine tuning).
|
|
31
|
+
- **Safe areas**: respect `env(safe-area-inset-top/bottom/left/right)`; content
|
|
32
|
+
never sits under the status bar, home indicator, or notch.
|
|
33
|
+
|
|
34
|
+
## Navigation
|
|
35
|
+
|
|
36
|
+
- **Tab bar**: bottom, 5 items maximum. More → use a "More" tab.
|
|
37
|
+
- Standard bars: navigation bar (top), tab bar (bottom), toolbar.
|
|
38
|
+
|
|
39
|
+
## Validation
|
|
40
|
+
|
|
41
|
+
- `hig-doctor` (if installed) audits the HTML/CSS against these rules — L3
|
|
42
|
+
advisory layer.
|
|
43
|
+
- The L4 boolean rubric (`rubric.json`) covers the same checks for the vision
|
|
44
|
+
judge; `score = passCount / N`.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$description": "Fluent 2 (Fluent UI) web light theme normalized to DTCG. Source: @fluentui/tokens webLightTheme (global + alias tokens). Refresh: regenerate from @fluentui/tokens.",
|
|
3
|
+
"color": {
|
|
4
|
+
"brand-background": { "$type": "color", "$value": "#0f6cbd" },
|
|
5
|
+
"brand-background-hover": { "$type": "color", "$value": "#115ea3" },
|
|
6
|
+
"neutral-foreground-1": { "$type": "color", "$value": "#242424" },
|
|
7
|
+
"neutral-foreground-2": { "$type": "color", "$value": "#424242" },
|
|
8
|
+
"neutral-background-1": { "$type": "color", "$value": "#ffffff" },
|
|
9
|
+
"neutral-background-2": { "$type": "color", "$value": "#fafafa" },
|
|
10
|
+
"neutral-stroke-1": { "$type": "color", "$value": "#d1d1d1" },
|
|
11
|
+
"status-danger-background": { "$type": "color", "$value": "#c50f1f" },
|
|
12
|
+
"status-success-background": { "$type": "color", "$value": "#0e700e" }
|
|
13
|
+
},
|
|
14
|
+
"borderRadius": {
|
|
15
|
+
"small": { "$type": "dimension", "$value": "2px" },
|
|
16
|
+
"medium": { "$type": "dimension", "$value": "4px" },
|
|
17
|
+
"large": { "$type": "dimension", "$value": "6px" },
|
|
18
|
+
"xlarge": { "$type": "dimension", "$value": "8px" }
|
|
19
|
+
},
|
|
20
|
+
"spacing": {
|
|
21
|
+
"xs": { "$type": "dimension", "$value": "4px" },
|
|
22
|
+
"s": { "$type": "dimension", "$value": "8px" },
|
|
23
|
+
"m": { "$type": "dimension", "$value": "12px" },
|
|
24
|
+
"l": { "$type": "dimension", "$value": "16px" },
|
|
25
|
+
"xl": { "$type": "dimension", "$value": "20px" },
|
|
26
|
+
"xxl": { "$type": "dimension", "$value": "24px" }
|
|
27
|
+
},
|
|
28
|
+
"typography": {
|
|
29
|
+
"font-family-base": { "$type": "fontFamily", "$value": "\"Segoe UI\", \"Segoe UI Web (West European)\", -apple-system, sans-serif" }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"system": "fluent-2",
|
|
3
|
+
"label": "Fluent 2 boolean rubric",
|
|
4
|
+
"checks": [
|
|
5
|
+
{ "id": "tokens", "text": "Colors map to Fluent alias tokens (brand/neutral/status), no off-token hex." },
|
|
6
|
+
{ "id": "segoe", "text": "Type uses the Segoe UI font stack." },
|
|
7
|
+
{ "id": "radius", "text": "Corner rounding uses the Fluent border-radius scale (2/4/6/8)." },
|
|
8
|
+
{ "id": "spacing", "text": "Spacing uses the Fluent spacing ramp (4/8/12/16/20/24)." },
|
|
9
|
+
{ "id": "depth", "text": "Surfaces use Fluent depth/shadow ramps, not arbitrary shadows." },
|
|
10
|
+
{ "id": "touch-target", "text": "Interactive targets are at least 44px." },
|
|
11
|
+
{ "id": "contrast", "text": "Foreground tokens meet WCAG AA against their background tokens." }
|
|
12
|
+
]
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$description": "Material Design 3 system tokens normalized to DTCG. Source: M3 --md-sys-* baseline (light) color roles + 8dp spacing grid. Refresh: regenerate from the Material 3 baseline token set.",
|
|
3
|
+
"color": {
|
|
4
|
+
"primary": { "$type": "color", "$value": "#6750a4" },
|
|
5
|
+
"on-primary": { "$type": "color", "$value": "#ffffff" },
|
|
6
|
+
"primary-container": { "$type": "color", "$value": "#eaddff" },
|
|
7
|
+
"on-primary-container": { "$type": "color", "$value": "#21005d" },
|
|
8
|
+
"secondary": { "$type": "color", "$value": "#625b71" },
|
|
9
|
+
"on-secondary": { "$type": "color", "$value": "#ffffff" },
|
|
10
|
+
"tertiary": { "$type": "color", "$value": "#7d5260" },
|
|
11
|
+
"error": { "$type": "color", "$value": "#b3261e" },
|
|
12
|
+
"surface": { "$type": "color", "$value": "#fef7ff" },
|
|
13
|
+
"on-surface": { "$type": "color", "$value": "#1d1b20" },
|
|
14
|
+
"surface-variant": { "$type": "color", "$value": "#e7e0ec" },
|
|
15
|
+
"on-surface-variant": { "$type": "color", "$value": "#49454f" },
|
|
16
|
+
"outline": { "$type": "color", "$value": "#79747e" }
|
|
17
|
+
},
|
|
18
|
+
"shape": {
|
|
19
|
+
"corner-small": { "$type": "dimension", "$value": "8px" },
|
|
20
|
+
"corner-medium": { "$type": "dimension", "$value": "12px" },
|
|
21
|
+
"corner-large": { "$type": "dimension", "$value": "16px" }
|
|
22
|
+
},
|
|
23
|
+
"spacing": {
|
|
24
|
+
"1": { "$type": "dimension", "$value": "4px" },
|
|
25
|
+
"2": { "$type": "dimension", "$value": "8px" },
|
|
26
|
+
"3": { "$type": "dimension", "$value": "16px" },
|
|
27
|
+
"4": { "$type": "dimension", "$value": "24px" },
|
|
28
|
+
"5": { "$type": "dimension", "$value": "32px" },
|
|
29
|
+
"6": { "$type": "dimension", "$value": "48px" }
|
|
30
|
+
},
|
|
31
|
+
"sizing": {
|
|
32
|
+
"min-touch-target": { "$type": "dimension", "$value": "48px" }
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"system": "material-3",
|
|
3
|
+
"label": "Material Design 3 boolean rubric",
|
|
4
|
+
"checks": [
|
|
5
|
+
{ "id": "sys-color", "text": "Colors map to M3 system color roles (primary, surface, on-surface, etc.), no raw hex outside the token set." },
|
|
6
|
+
{ "id": "8dp-grid", "text": "Spacing aligns to the 8dp grid (4dp allowed for fine adjustments)." },
|
|
7
|
+
{ "id": "corner-shape", "text": "Corner rounding uses M3 shape scale (small 8 / medium 12 / large 16)." },
|
|
8
|
+
{ "id": "touch-target-48", "text": "Touch targets are at least 48dp." },
|
|
9
|
+
{ "id": "tonal-elevation", "text": "Elevation expressed via M3 tonal/surface tints, not arbitrary drop shadows." },
|
|
10
|
+
{ "id": "state-layers", "text": "Interactive components show M3 state layers (hover/focus/pressed)." },
|
|
11
|
+
{ "id": "contrast", "text": "On-color roles meet WCAG AA against their container." }
|
|
12
|
+
]
|
|
13
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$description": "Material UI (MUI) default light theme normalized to DTCG. Source: @mui/material createTheme() defaults. Refresh: regenerate from the MUI default theme object (palette, spacing unit 8, shape.borderRadius 4).",
|
|
3
|
+
"color": {
|
|
4
|
+
"primary-main": { "$type": "color", "$value": "#1976d2" },
|
|
5
|
+
"primary-contrast": { "$type": "color", "$value": "#ffffff" },
|
|
6
|
+
"secondary-main": { "$type": "color", "$value": "#9c27b0" },
|
|
7
|
+
"error-main": { "$type": "color", "$value": "#d32f2f" },
|
|
8
|
+
"warning-main": { "$type": "color", "$value": "#ed6c02" },
|
|
9
|
+
"info-main": { "$type": "color", "$value": "#0288d1" },
|
|
10
|
+
"success-main": { "$type": "color", "$value": "#2e7d32" },
|
|
11
|
+
"text-primary": { "$type": "color", "$value": "rgba(0, 0, 0, 0.87)" },
|
|
12
|
+
"text-secondary": { "$type": "color", "$value": "rgba(0, 0, 0, 0.6)" },
|
|
13
|
+
"background-default": { "$type": "color", "$value": "#ffffff" },
|
|
14
|
+
"background-paper": { "$type": "color", "$value": "#ffffff" },
|
|
15
|
+
"divider": { "$type": "color", "$value": "rgba(0, 0, 0, 0.12)" }
|
|
16
|
+
},
|
|
17
|
+
"shape": {
|
|
18
|
+
"border-radius": { "$type": "dimension", "$value": "4px" }
|
|
19
|
+
},
|
|
20
|
+
"spacing": {
|
|
21
|
+
"unit": { "$type": "dimension", "$value": "8px" },
|
|
22
|
+
"1": { "$type": "dimension", "$value": "8px" },
|
|
23
|
+
"2": { "$type": "dimension", "$value": "16px" },
|
|
24
|
+
"3": { "$type": "dimension", "$value": "24px" },
|
|
25
|
+
"4": { "$type": "dimension", "$value": "32px" },
|
|
26
|
+
"5": { "$type": "dimension", "$value": "40px" },
|
|
27
|
+
"6": { "$type": "dimension", "$value": "48px" }
|
|
28
|
+
},
|
|
29
|
+
"typography": {
|
|
30
|
+
"font-family": { "$type": "fontFamily", "$value": "\"Roboto\", \"Helvetica\", \"Arial\", sans-serif" }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"system": "mui",
|
|
3
|
+
"label": "Material UI boolean rubric",
|
|
4
|
+
"checks": [
|
|
5
|
+
{ "id": "palette", "text": "Colors come from the MUI palette (primary/secondary/error/etc.), no off-palette hex." },
|
|
6
|
+
{ "id": "spacing-8", "text": "Spacing is a multiple of the 8px spacing unit." },
|
|
7
|
+
{ "id": "border-radius", "text": "Surfaces use the 4px theme.shape.borderRadius (or a consistent multiple)." },
|
|
8
|
+
{ "id": "elevation", "text": "Paper/Card surfaces use MUI elevation shadows, not arbitrary shadows." },
|
|
9
|
+
{ "id": "typography", "text": "Type uses the Roboto-based MUI typography scale." },
|
|
10
|
+
{ "id": "touch-target", "text": "Interactive targets are at least 48px (MUI default min)." },
|
|
11
|
+
{ "id": "contrast", "text": "Text meets WCAG AA contrast against its surface." }
|
|
12
|
+
]
|
|
13
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$description": "shadcn/ui default theme — CSS custom properties normalized to DTCG. Source: ui.shadcn.com default (neutral) theme. Refresh: regenerate from the shadcn CSS variables block.",
|
|
3
|
+
"color": {
|
|
4
|
+
"background": { "$type": "color", "$value": "hsl(0 0% 100%)" },
|
|
5
|
+
"foreground": { "$type": "color", "$value": "hsl(0 0% 3.9%)" },
|
|
6
|
+
"card": { "$type": "color", "$value": "hsl(0 0% 100%)" },
|
|
7
|
+
"card-foreground": { "$type": "color", "$value": "hsl(0 0% 3.9%)" },
|
|
8
|
+
"primary": { "$type": "color", "$value": "hsl(0 0% 9%)" },
|
|
9
|
+
"primary-foreground": { "$type": "color", "$value": "hsl(0 0% 98%)" },
|
|
10
|
+
"secondary": { "$type": "color", "$value": "hsl(0 0% 96.1%)" },
|
|
11
|
+
"secondary-foreground": { "$type": "color", "$value": "hsl(0 0% 9%)" },
|
|
12
|
+
"muted": { "$type": "color", "$value": "hsl(0 0% 96.1%)" },
|
|
13
|
+
"muted-foreground": { "$type": "color", "$value": "hsl(0 0% 45.1%)" },
|
|
14
|
+
"accent": { "$type": "color", "$value": "hsl(0 0% 96.1%)" },
|
|
15
|
+
"destructive": { "$type": "color", "$value": "hsl(0 84.2% 60.2%)" },
|
|
16
|
+
"border": { "$type": "color", "$value": "hsl(0 0% 89.8%)" },
|
|
17
|
+
"input": { "$type": "color", "$value": "hsl(0 0% 89.8%)" },
|
|
18
|
+
"ring": { "$type": "color", "$value": "hsl(0 0% 3.9%)" }
|
|
19
|
+
},
|
|
20
|
+
"radius": {
|
|
21
|
+
"base": { "$type": "dimension", "$value": "0.5rem" }
|
|
22
|
+
},
|
|
23
|
+
"spacing": {
|
|
24
|
+
"1": { "$type": "dimension", "$value": "4px" },
|
|
25
|
+
"2": { "$type": "dimension", "$value": "8px" },
|
|
26
|
+
"3": { "$type": "dimension", "$value": "12px" },
|
|
27
|
+
"4": { "$type": "dimension", "$value": "16px" },
|
|
28
|
+
"6": { "$type": "dimension", "$value": "24px" },
|
|
29
|
+
"8": { "$type": "dimension", "$value": "32px" }
|
|
30
|
+
}
|
|
31
|
+
}
|