@shavin/skills 0.0.0-stage → 0.1.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/AGENTS.md +193 -0
- package/CHANGELOG.md +27 -0
- package/LICENSE +21 -0
- package/README.md +48 -2
- package/bin/hex-policy.mjs +157 -0
- package/bin/install.mjs +219 -0
- package/bin/lint-tokens.mjs +178 -0
- package/build.mjs +540 -0
- package/commands/add-composition.md +14 -0
- package/commands/apply-theme.md +59 -0
- package/commands/audit-layout.md +15 -0
- package/commands/audit-ui.md +42 -0
- package/commands/compose-page.md +16 -0
- package/commands/create-block.md +79 -0
- package/commands/create-primitive.md +40 -0
- package/commands/create-screen.md +45 -0
- package/commands/create-theme.md +41 -0
- package/cursor/shavin.mdc +14 -0
- package/package.json +66 -4
- package/posix-path.mjs +7 -0
- package/skills/core-rules.md +294 -0
- package/skills/layout-choreography/SKILL.md +102 -0
- package/skills/layout-choreography/references/fallbacks-and-accessibility.md +76 -0
- package/skills/layout-choreography/references/scenes.md +113 -0
- package/skills/layout-choreography/references/shavin-timelines.md +100 -0
- package/skills/layout-choreography/references/tech-and-performance.md +147 -0
- package/skills/layout-compositions/SKILL.md +149 -0
- package/skills/layout-compositions/references/adapters/shavin-ui.md +122 -0
- package/skills/layout-compositions/references/adapters/tailwind-html.md +100 -0
- package/skills/layout-compositions/references/component-language.md +105 -0
- package/skills/layout-compositions/references/compositions/conversion.md +286 -0
- package/skills/layout-compositions/references/compositions/documentation.md +125 -0
- package/skills/layout-compositions/references/compositions/editorial.md +126 -0
- package/skills/layout-compositions/references/compositions/expressive.md +151 -0
- package/skills/layout-compositions/references/compositions/features.md +262 -0
- package/skills/layout-compositions/references/compositions/gallery.md +172 -0
- package/skills/layout-compositions/references/compositions/hero.md +184 -0
- package/skills/layout-compositions/references/compositions/proof.md +194 -0
- package/skills/layout-compositions/references/compositions/structural.md +173 -0
- package/skills/layout-compositions/references/distinctiveness.md +65 -0
- package/skills/layout-compositions/references/foundations.md +119 -0
- package/skills/layout-compositions/references/metadata-schema.md +64 -0
- package/skills/layout-compositions/references/page-recipes.md +143 -0
- package/skills/layout-compositions/references/selection-guide.md +207 -0
- package/skills/layout-compositions/references/treatments.md +60 -0
- package/skills/layout-compositions/references/unsection-source-examples.md +92 -0
- package/skills/layout-compositions/references/visual-review.md +40 -0
- package/skills/layout-compositions/scripts/render_wireframes.py +138 -0
- package/skills/layout-compositions/scripts/validate_library.py +165 -0
- package/skills/layout-motion/SKILL.md +83 -0
- package/skills/layout-motion/references/composition-motion-map.md +69 -0
- package/skills/layout-motion/references/presets.md +209 -0
- package/skills/layout-motion/references/tokens.md +100 -0
- package/skills/shavin-app/SKILL.md +242 -0
- package/skills/shavin-app/patterns.md +35 -0
- package/skills/shavin-studio/SKILL.md +97 -0
- package/skills/shavin-webpage/SKILL.md +210 -0
- package/skills/shavin-webpage/editorial-craft.md +117 -0
- package/skills/shavin-webpage/page-architecture.md +137 -0
- package/skills/shavin-webpage/style-recipes.md +107 -0
- package/skills/visual-compositor/SKILL.md +200 -0
- package/skills/visual-compositor/anti-patterns.md +109 -0
- package/skills/visual-compositor/audit-checklist.md +162 -0
- package/skills/visual-compositor/cognitive-layer.md +287 -0
- package/skills/visual-compositor/composition-motion-map.md +167 -0
- package/skills/visual-compositor/concentric-laws.md +147 -0
- package/skills/visual-compositor/docs-mode.md +32 -0
- package/skills/visual-compositor/editorial-mode.md +48 -0
- package/skills/visual-compositor/font-pairings.md +224 -0
- package/skills/visual-compositor/graphics-and-assets.md +128 -0
- package/skills/visual-compositor/interface-polish.md +125 -0
- package/skills/visual-compositor/layout-restraint.md +80 -0
- package/skills/visual-compositor/motion-and-physics.md +257 -0
- package/skills/visual-compositor/page-motion-presets.md +246 -0
- package/skills/visual-compositor/references/EDITORIAL_EXPRESSIVE.md +163 -0
- package/skills/visual-compositor/spacing-core.md +386 -0
- package/skills/visual-compositor/spacing-dense.md +63 -0
- package/skills/visual-compositor/spacing-marketing.md +192 -0
- package/skills/visual-compositor/typography-rules.md +114 -0
- package/token-budget.json +86 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Tier 1 presets
|
|
2
|
+
|
|
3
|
+
Each preset is small, attaches to attributes rather than restructuring markup, and includes its reduced-motion path. Tokens come from `tokens.md`. Adapt syntax to the stack (React, Vue, plain JS); the mechanics are the same.
|
|
4
|
+
|
|
5
|
+
Contents: 1 Reveal on view · 2 Page-load sequence · 3 Hover and press · 4 Accordion height · 5 Tab crossfade · 6 Count-up · 7 Marquee with pause · 8 Sticky header state · 9 Scroll-spy · 10 Light parallax · 11 Filter fade
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Reveal on view
|
|
10
|
+
|
|
11
|
+
Content is visible by default; the hidden starting state exists only when JS has run and motion is allowed.
|
|
12
|
+
|
|
13
|
+
```css
|
|
14
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
15
|
+
.js [data-reveal] {
|
|
16
|
+
opacity: 0;
|
|
17
|
+
transform: translateY(var(--dist-md));
|
|
18
|
+
transition:
|
|
19
|
+
opacity var(--dur-enter) var(--ease-out),
|
|
20
|
+
transform var(--dur-enter) var(--ease-out);
|
|
21
|
+
transition-delay: calc(var(--i, 0) * var(--stagger));
|
|
22
|
+
}
|
|
23
|
+
.js [data-reveal][data-inview="true"] { opacity: 1; transform: none; }
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
const io = new IntersectionObserver((entries) => {
|
|
29
|
+
for (const e of entries) {
|
|
30
|
+
if (e.isIntersecting) { e.target.dataset.inview = "true"; io.unobserve(e.target); }
|
|
31
|
+
}
|
|
32
|
+
}, { rootMargin: "0px 0px -10% 0px", threshold: 0.1 });
|
|
33
|
+
document.querySelectorAll("[data-reveal]").forEach((el) => io.observe(el));
|
|
34
|
+
document.documentElement.classList.add("js"); // add only after the observer is set up
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Stagger by setting `style="--i: 0"`, `--i: 1`, … on siblings (cap at ~8). Don't put `data-reveal` on above-the-fold content or the LCP element.
|
|
38
|
+
|
|
39
|
+
## 2. Page-load sequence (the one orchestrated moment)
|
|
40
|
+
|
|
41
|
+
Use for a hero. Total ≤ 800ms. Keep the LCP element visible: animate its `transform` or animate the supporting text, not its opacity from 0.
|
|
42
|
+
|
|
43
|
+
```css
|
|
44
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
45
|
+
[data-slot="overline"], [data-slot="sub"], [data-slot="cta"] {
|
|
46
|
+
animation: rise var(--dur-enter) var(--ease-out) both;
|
|
47
|
+
}
|
|
48
|
+
[data-slot="sub"] { animation-delay: 80ms; }
|
|
49
|
+
[data-slot="cta"] { animation-delay: 160ms; }
|
|
50
|
+
}
|
|
51
|
+
@keyframes rise { from { opacity: 0; transform: translateY(var(--dist-md)); } }
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 3. Hover and press
|
|
55
|
+
|
|
56
|
+
```css
|
|
57
|
+
.interactive {
|
|
58
|
+
transition: transform var(--dur-fast) var(--ease-standard),
|
|
59
|
+
background-color var(--dur-fast) var(--ease-standard);
|
|
60
|
+
}
|
|
61
|
+
@media (hover: hover) { .interactive:hover { transform: translateY(-2px); } }
|
|
62
|
+
.interactive:focus-visible { transform: translateY(-2px); } /* same cue for keyboard */
|
|
63
|
+
.interactive:active { transform: scale(0.98); }
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Apply to a few things that are actually interactive, not to every card.
|
|
67
|
+
|
|
68
|
+
## 4. Accordion height
|
|
69
|
+
|
|
70
|
+
Animate `grid-template-rows` instead of height:
|
|
71
|
+
|
|
72
|
+
```css
|
|
73
|
+
.acc-panel { display: grid; grid-template-rows: 0fr;
|
|
74
|
+
transition: grid-template-rows var(--dur-base) var(--ease-standard); }
|
|
75
|
+
.acc-panel[data-open="true"] { grid-template-rows: 1fr; }
|
|
76
|
+
.acc-panel > div { overflow: hidden; }
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Keep `aria-expanded` on the trigger in sync. Under reduced motion the tokens collapse to 0ms so it snaps open. Collapsed content should be non-focusable (`inert` or `hidden` when closed).
|
|
80
|
+
|
|
81
|
+
## 5. Tab crossfade
|
|
82
|
+
|
|
83
|
+
Stack all panels in one grid cell so the container keeps the tallest height (no layout shift):
|
|
84
|
+
|
|
85
|
+
```css
|
|
86
|
+
.tab-panels { display: grid; }
|
|
87
|
+
.tab-panels > [role="tabpanel"] {
|
|
88
|
+
grid-area: 1 / 1;
|
|
89
|
+
opacity: 0; visibility: hidden;
|
|
90
|
+
transition: opacity var(--dur-base) var(--ease-standard), visibility 0s linear var(--dur-base);
|
|
91
|
+
}
|
|
92
|
+
.tab-panels > [role="tabpanel"][data-active="true"] {
|
|
93
|
+
opacity: 1; visibility: visible; transition-delay: 0s;
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 6. Count-up (S3)
|
|
98
|
+
|
|
99
|
+
The final value is already in the DOM as real text. The animation only replays it.
|
|
100
|
+
|
|
101
|
+
```html
|
|
102
|
+
<span class="stat" data-slot="value">
|
|
103
|
+
<span aria-hidden="true" data-count-to="1200000">1,200,000</span>
|
|
104
|
+
<span class="sr-only">1,200,000</span>
|
|
105
|
+
</span>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
const reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
110
|
+
const fmt = new Intl.NumberFormat();
|
|
111
|
+
function countUp(el, ms = 1200) {
|
|
112
|
+
const to = Number(el.dataset.countTo), t0 = performance.now();
|
|
113
|
+
const tick = (t) => {
|
|
114
|
+
const p = Math.min((t - t0) / ms, 1);
|
|
115
|
+
el.textContent = fmt.format(Math.round(to * (1 - Math.pow(1 - p, 3))));
|
|
116
|
+
if (p < 1) requestAnimationFrame(tick);
|
|
117
|
+
};
|
|
118
|
+
requestAnimationFrame(tick);
|
|
119
|
+
}
|
|
120
|
+
if (!reduce) {
|
|
121
|
+
const io = new IntersectionObserver((es) => es.forEach((e) => {
|
|
122
|
+
if (e.isIntersecting) { countUp(e.target); io.unobserve(e.target); }
|
|
123
|
+
}), { threshold: 0.6 });
|
|
124
|
+
document.querySelectorAll("[data-count-to]").forEach((el) => io.observe(el));
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Use `tabular-nums` and a `min-width` (in `ch`) so digits don't move the layout. Skip years, versions and ratings.
|
|
129
|
+
|
|
130
|
+
## 7. Marquee with pause (T4, G3)
|
|
131
|
+
|
|
132
|
+
```html
|
|
133
|
+
<div class="marquee" data-paused="false" role="group" aria-label="Customers">
|
|
134
|
+
<ul class="track">…logos…</ul>
|
|
135
|
+
<ul class="track" aria-hidden="true">…same logos…</ul>
|
|
136
|
+
</div>
|
|
137
|
+
<button type="button" aria-pressed="false" data-marquee-toggle>Pause</button>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
```css
|
|
141
|
+
.marquee { --gap: 3rem; display: flex; gap: var(--gap); overflow: hidden;
|
|
142
|
+
mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent); }
|
|
143
|
+
.track { display: flex; flex: none; gap: var(--gap); min-width: 100%;
|
|
144
|
+
justify-content: space-around; animation: marquee 40s linear infinite; }
|
|
145
|
+
@keyframes marquee { to { transform: translateX(calc(-100% - var(--gap))); } }
|
|
146
|
+
.marquee:hover .track, .marquee:focus-within .track,
|
|
147
|
+
.marquee[data-paused="true"] .track { animation-play-state: paused; }
|
|
148
|
+
|
|
149
|
+
@media (prefers-reduced-motion: reduce) {
|
|
150
|
+
.marquee { flex-wrap: wrap; overflow: visible; mask-image: none; }
|
|
151
|
+
.track { animation: none; flex-wrap: wrap; }
|
|
152
|
+
.track[aria-hidden="true"], [data-marquee-toggle] { display: none; }
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The toggle button flips `data-paused` and `aria-pressed`. Pausing on hover alone doesn't satisfy WCAG 2.2.2.
|
|
157
|
+
|
|
158
|
+
## 8. Sticky header state (ST1)
|
|
159
|
+
|
|
160
|
+
Toggle a data attribute from an `IntersectionObserver` on a sentinel element at the top of the page; style the change with a short transition.
|
|
161
|
+
|
|
162
|
+
```js
|
|
163
|
+
const sentinel = document.querySelector("[data-header-sentinel]");
|
|
164
|
+
new IntersectionObserver(([e]) => {
|
|
165
|
+
document.querySelector("header").dataset.stuck = String(!e.isIntersecting);
|
|
166
|
+
}).observe(sentinel);
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
```css
|
|
170
|
+
header { transition: background-color var(--dur-base) var(--ease-standard),
|
|
171
|
+
box-shadow var(--dur-base) var(--ease-standard); }
|
|
172
|
+
header[data-stuck="true"] { background: var(--canvas); box-shadow: 0 1px 0 var(--hairline); }
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Don't change the header's height on scroll (causes reflow); change colour/shadow instead.
|
|
176
|
+
|
|
177
|
+
## 9. Scroll-spy (D1 TOC, F6 steps)
|
|
178
|
+
|
|
179
|
+
```js
|
|
180
|
+
const links = new Map([...document.querySelectorAll("[data-toc] a")].map(a => [a.hash.slice(1), a]));
|
|
181
|
+
const io = new IntersectionObserver((entries) => {
|
|
182
|
+
entries.forEach((e) => {
|
|
183
|
+
if (e.isIntersecting) {
|
|
184
|
+
links.forEach((a) => a.removeAttribute("aria-current"));
|
|
185
|
+
links.get(e.target.id)?.setAttribute("aria-current", "true");
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}, { rootMargin: "-20% 0px -70% 0px" });
|
|
189
|
+
links.forEach((_, id) => { const h = document.getElementById(id); if (h) io.observe(h); });
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## 10. Light parallax
|
|
193
|
+
|
|
194
|
+
Progressive enhancement with CSS scroll-driven animations where supported (check current browser support before relying on it):
|
|
195
|
+
|
|
196
|
+
```css
|
|
197
|
+
@supports (animation-timeline: view()) {
|
|
198
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
199
|
+
[data-parallax] { animation: drift linear both; animation-timeline: view(); }
|
|
200
|
+
@keyframes drift { from { transform: translateY(24px); } to { transform: translateY(-24px); } }
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Limit travel to ±24–40px. Anything bigger or scripted belongs in `layout-choreography`.
|
|
206
|
+
|
|
207
|
+
## 11. Filter fade (G2)
|
|
208
|
+
|
|
209
|
+
Fade the result set with a 120–160ms opacity transition on the container when the filter changes, then swap content and fade back in. Announce the count in a live region. Don't animate layout positions of individual cards at this tier.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Motion tokens
|
|
2
|
+
|
|
3
|
+
`@shavin/ui` already defines a two-tier motion token system in `global.css`, mirroring the color/radius architecture. This file documents the tokens for reference; do not re-declare them.
|
|
4
|
+
|
|
5
|
+
## Foundation tokens (defined in `:root` of `global.css`)
|
|
6
|
+
|
|
7
|
+
```css
|
|
8
|
+
:root {
|
|
9
|
+
/* durations */
|
|
10
|
+
--dur-instant: 100ms;
|
|
11
|
+
--dur-fast: 160ms; /* hover, press */
|
|
12
|
+
--dur-base: 240ms; /* state changes: tabs, toggles, menus */
|
|
13
|
+
--dur-slow: 360ms; /* larger surface changes */
|
|
14
|
+
--dur-enter: 560ms; /* entrances and reveals */
|
|
15
|
+
|
|
16
|
+
/* easings */
|
|
17
|
+
--ease-standard: cubic-bezier(0.2, 0, 0, 1);
|
|
18
|
+
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
|
|
19
|
+
--ease-in: cubic-bezier(0.4, 0, 1, 1);
|
|
20
|
+
--ease-overshoot: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
21
|
+
|
|
22
|
+
/* distances */
|
|
23
|
+
--dist-xs: 4px;
|
|
24
|
+
--dist-sm: 8px;
|
|
25
|
+
--dist-md: 12px; /* default entrance travel */
|
|
26
|
+
--dist-lg: 24px; /* maximum entrance travel */
|
|
27
|
+
|
|
28
|
+
/* stagger */
|
|
29
|
+
--stagger: 60ms;
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Semantic aliases
|
|
34
|
+
|
|
35
|
+
```css
|
|
36
|
+
:root {
|
|
37
|
+
--dur-tooltip: var(--dur-fast);
|
|
38
|
+
--dur-popover: var(--dur-fast);
|
|
39
|
+
--dur-drawer: var(--dur-base);
|
|
40
|
+
--dur-modal: var(--dur-base);
|
|
41
|
+
--dur-accordion: var(--dur-base);
|
|
42
|
+
|
|
43
|
+
--dist-tooltip: var(--dist-xs);
|
|
44
|
+
--dist-popover: var(--dist-sm);
|
|
45
|
+
--dist-drawer: var(--dist-lg);
|
|
46
|
+
--dist-modal: var(--dist-md);
|
|
47
|
+
--dist-accordion: var(--dist-sm);
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Reduced-motion safety net
|
|
52
|
+
|
|
53
|
+
A single `@media (prefers-reduced-motion: reduce)` block in `global.css` zeros all motion tokens:
|
|
54
|
+
|
|
55
|
+
```css
|
|
56
|
+
@media (prefers-reduced-motion: reduce) {
|
|
57
|
+
:root {
|
|
58
|
+
--dur-instant: 0ms; --dur-fast: 0ms; --dur-base: 0ms;
|
|
59
|
+
--dur-slow: 0ms; --dur-enter: 0ms; --stagger: 0ms;
|
|
60
|
+
--dist-xs: 0px; --dist-sm: 0px; --dist-md: 0px; --dist-lg: 0px;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Zeroing the tokens under reduced motion is a safety net, not a substitute for designing the reduced path: presets that add or remove content (marquees, count-ups, sticky effects) still need their own fallback (see `presets.md`).
|
|
66
|
+
|
|
67
|
+
## Tailwind preset exposure
|
|
68
|
+
|
|
69
|
+
The `@shavin/ui` Tailwind preset exposes duration tokens as `transitionDuration` utilities:
|
|
70
|
+
|
|
71
|
+
| Utility | Token |
|
|
72
|
+
|---|---|
|
|
73
|
+
| `duration-instant` | `var(--dur-instant)` |
|
|
74
|
+
| `duration-fast` | `var(--dur-fast)` |
|
|
75
|
+
| `duration-base` | `var(--dur-base)` |
|
|
76
|
+
| `duration-slow` | `var(--dur-slow)` |
|
|
77
|
+
| `duration-enter` | `var(--dur-enter)` |
|
|
78
|
+
|
|
79
|
+
Use: `transition-transform duration-fast ease-standard`.
|
|
80
|
+
|
|
81
|
+
## Choosing values
|
|
82
|
+
|
|
83
|
+
| Situation | Duration | Easing | Travel |
|
|
84
|
+
|---|---|---|---|
|
|
85
|
+
| Button hover / press | fast | standard | scale 0.98 on press only |
|
|
86
|
+
| Tab panel change | base | standard | opacity only |
|
|
87
|
+
| Menu / sheet open | base | out | ≤ 16px or slide from edge |
|
|
88
|
+
| Menu / sheet close | ~0.65 × base | in | same axis |
|
|
89
|
+
| Section reveal | enter | out | md (12px) |
|
|
90
|
+
| Card grid reveal | enter | out | md, stagger 60ms |
|
|
91
|
+
| Number count-up | 1000–1200ms | out (cubic) | n/a |
|
|
92
|
+
| Marquee | 30–60s per loop | linear | n/a |
|
|
93
|
+
|
|
94
|
+
## Rules
|
|
95
|
+
|
|
96
|
+
- Don't invent one-off durations. If a new duration is truly needed, add a token.
|
|
97
|
+
- Exits are faster than entrances.
|
|
98
|
+
- Long travel (> 24px) looks like a slide, not a reveal. Use choreography if that's the intent.
|
|
99
|
+
- Everything scaled by the tokens collapses to instant under reduced motion.
|
|
100
|
+
- The canonical motion reference is `visual-compositor/motion-and-physics.md` — see it for The Frequency Law, Rauno split & stagger patterns, and the full animation utilities table.
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: shavin-app
|
|
3
|
+
description: >
|
|
4
|
+
Guides the architecture, layout partitioning, interaction patterns, state management,
|
|
5
|
+
and implementation of SaaS web applications, dashboards, AI chat tools, admin consoles,
|
|
6
|
+
and complex product interfaces using @shavin/ui as the base design system engine, powered by
|
|
7
|
+
cognitive design principles and Vercel Web Interface Guidelines. Covers forms, settings, auth,
|
|
8
|
+
onboarding, data tables and the six-state rule.
|
|
9
|
+
sections:
|
|
10
|
+
- id: philosophy
|
|
11
|
+
description: "Applications as decision-support tools"
|
|
12
|
+
- id: primitives
|
|
13
|
+
description: "@shavin/ui application primitive hierarchy"
|
|
14
|
+
- id: density
|
|
15
|
+
description: "Product density standard (14px token base)"
|
|
16
|
+
- id: state
|
|
17
|
+
description: "Six-state rule (first-time, empty, loading, error, success, disabled) and interaction quality"
|
|
18
|
+
- id: layouts
|
|
19
|
+
description: "Standard application layout architectures"
|
|
20
|
+
- id: copy
|
|
21
|
+
description: "Anti-slop microcopy standards"
|
|
22
|
+
- id: patterns
|
|
23
|
+
file: patterns.md
|
|
24
|
+
description: "Worked patterns: data table, settings, auth, onboarding (~2K tokens)"
|
|
25
|
+
- id: checklist
|
|
26
|
+
description: "Pre-flight verification checklist"
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
# shavin-app Skill
|
|
30
|
+
|
|
31
|
+
- Targeted sections: `get_skill({ name: "shavin-app", section: "density" | "state" | "layouts" | "patterns" | "checklist" })`.
|
|
32
|
+
- Core rules (tokens, radius, typography, fg vs fg-subtle vs fg-muted) are in `.agents/skills/core-rules.md` and are not injected. Read it when you need the full detail.
|
|
33
|
+
- Live specs: `get_components({ name })` and `get_tokens()`. Without MCP, read `node_modules/@shavin/ui/components.json` and run `npx shavin-lint-tokens <path>` instead of `validate_code`.
|
|
34
|
+
- Every UI element is a `@shavin/ui` component (no raw `button`/`input`/`table`/`dialog`, no hand-styled div imitations, no other UI library). These rules apply on every UI-writing turn, including small follow-ups.
|
|
35
|
+
|
|
36
|
+
You are an **Application Product Architect & Engineer** using the **Shavin Design System (`@shavin/ui`)**. Your purpose is to architect, partition, and implement dense, reliable, highly interactive, and accessible SaaS web applications, AI chat tools, administrative consoles, and workspace dashboards.
|
|
37
|
+
|
|
38
|
+
This skill synthesizes **`@shavin/ui` application primitives** with cognitive design laws and **Vercel Web Interface Guidelines** to eliminate AI UI slop, guarantee six-state coverage, and deliver product interfaces that feel fast, predictable, and human-considered.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 1. Core Philosophy: Applications as Decision-Support Tools
|
|
43
|
+
|
|
44
|
+
> **Law 4:** Attention is finite. Every screen has a budget. If every metric is highlighted in bright colors, nothing is important.
|
|
45
|
+
> **Law 5:** Consistency enables prediction. The same action must always behave the same way.
|
|
46
|
+
> **Law 10:** Good design reduces interpretation. If users have to guess where they are or what a button does, the interface has failed.
|
|
47
|
+
|
|
48
|
+
Web applications are tools for decision-making and task execution. Every application screen must satisfy three fundamental user questions within 3 seconds:
|
|
49
|
+
1. **Where am I?** (Active navigation indicator, page breadcrumbs, clear header title)
|
|
50
|
+
2. **What is the primary action?** (Single dominant primary CTA)
|
|
51
|
+
3. **How do I undo / return?** (Clear back navigation, Escape key handlers, cancel affordances)
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 2. Base Engine: `@shavin/ui` Application Hierarchy
|
|
56
|
+
|
|
57
|
+
Always compose applications using native `@shavin/ui` application primitives:
|
|
58
|
+
|
|
59
|
+
| Category | `@shavin/ui` primitives to use |
|
|
60
|
+
|---|---|
|
|
61
|
+
| **App chrome & layout** | `AppFrame`, `Sidebar`, `SidebarHeader`, `SidebarBody`, `SidebarFooter`, `SidebarSection`, `SidebarNavItem`, `SidebarTrigger`, `TopBar`, `ActionBar`, `BottomNav`, `Breadcrumbs`, `Container`, `Section`, `Grid`, `Flex`, `Box`, `Card`, `CardList`, `CardRow`, `Separator`, `ScrollArea` |
|
|
62
|
+
| **Overlays** | `Dialog`, `AlertDialog`, `Drawer`, `Popover`, `ContextMenu`, `Menu`, `MenuItem`, `Tooltip`, `HoverCard` |
|
|
63
|
+
| **Inputs & forms** | `TextField`, `TextArea`, `Select`, `Dropdown`, `Combobox`, `Checkbox`, `Switch`, `RadioGroup`, `Slider`, `ColorPicker`, `IconPicker`, `DatePicker`, `TimePicker`, `Button`, `IconButton` |
|
|
64
|
+
| **Data & workspaces** | `Table`, `TableHeader`, `TableBody`, `TableRow`, `TableColumnHeaderCell`, `TableCell`, `Pagination`, `DataList`, `DataListItem`, `StatCard`, `Row`, `RowDragHandle`, `Stepper`, `Tabs`, `SegmentedControl`, `Badge`, `Avatar`, `Progress`, `LineChart`, `BarChart`, `Sparkline`, `DonutChart`, `Heatmap`, `FunnelChart` |
|
|
65
|
+
| **Feedback** | `Callout`, `Toast` (`ToastProvider` + `useToast()`), `Skeleton`, `SkeletonMimic`, `Spinner`, `Murmur` |
|
|
66
|
+
| **Content** | `Heading`, `Text`, `Icon`, `Link`, `CodeBlock`, `Kbd`, `Backdrop` |
|
|
67
|
+
| **AI surfaces** | `ChatBubble`, `Reasoning`, `ToolCall`, `FileOutput`, `VoiceInput`, `Murmur` |
|
|
68
|
+
|
|
69
|
+
Not in the library: `Header`, `Footer`, `DocSection`, a generic `Chart`. Compose from the primitives above; confirm any other name with `get_components`.
|
|
70
|
+
|
|
71
|
+
---|---|
|
|
72
|
+
| **App Chrome & Layout** | `<AppFrame>`, `<Sidebar>`, `<SidebarBody>`, `<SidebarFooter>`, `<SidebarSection>`, `<SidebarNavItem>`, `<SidebarTrigger>`, `<TopBar>`, `<ActionBar>`, `<BottomNav>`, `<Container>`, `<Grid>`, `<Flex>` |
|
|
73
|
+
| **Overlays & Modals** | `<Dialog>`, `<AlertDialog>`, `<Popover>`, `<ContextMenu>`, `<Menu>`, `<Tooltip>` |
|
|
74
|
+
| **Inputs & Form Controls** | `<TextField>`, `<TextArea>`, `<Select>`, `<Dropdown>`, `<Combobox>`, `<Checkbox>`, `<Switch>`, `<RadioGroup>`, `<Slider>`, `<ColorPicker>`, `<IconPicker>`, `<DatePicker>`, `<TimePicker>` |
|
|
75
|
+
| **Data & Workspaces** | `<Table>`, `<TableHeader>`, `<TableBody>`, `<TableRow>`, `<TableColumnHeaderCell>`, `<TableCell>`, `<DataList>`, `<DataListItem>`, `<StatCard>`, `<CardRow>`, `<Row>`, `<RowDragHandle>`, `<Stepper>`, `<Tabs>`, `<SegmentedControl>`, `<ChatBubble>`, `<Murmur>`, `<Reasoning>`, `<ToolCall>`, `<FileOutput>`, `<VoiceInput>`, `<Toast>`, `<Skeleton>`, `<Spinner>`, `<Progress>` |
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 3. Product Density Standard (14px Token Base) & Font Protocol
|
|
80
|
+
|
|
81
|
+
Unlike marketing websites (which use 16px body text), `@shavin/ui` applications enforce an **application density baseline**:
|
|
82
|
+
- Default body font size: `0.875rem` (**14px**, `text-sm`) with `1.25rem` line-height.
|
|
83
|
+
- `<Text>` primitive defaults to `size="sm"` (`14px`).
|
|
84
|
+
- Form labels, table cells, sidebar links, and data rows default to `text-sm` density for maximum productivity without visual clutter.
|
|
85
|
+
|
|
86
|
+
- Font loading, typography hierarchy, concentric radius and token compliance: see `.agents/skills/core-rules.md` (not injected).
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 4. Mandatory State & Interaction Quality Standards
|
|
91
|
+
|
|
92
|
+
### A. The Six-State Rule
|
|
93
|
+
|
|
94
|
+
Every surface (list, table, form, settings page, auth screen, onboarding, chat, dialog) implements all six states, not only data surfaces. Build each branch, not just the happy path. **These are the default: build them without being asked.** A request such as "build a dashboard" or "add a settings page" already includes them; the user will not list them.
|
|
95
|
+
|
|
96
|
+
1. **First-time**: the user has never used it. `<EmptyState kind="first-time" title description action={<Button>…</Button>} />`: what it is and the first action. Onboarding flows use `Stepper`.
|
|
97
|
+
2. **Empty**: had items, none now: `EmptyState kind="empty"` with the `Button` that adds one. A filter or search matched nothing: `EmptyState kind="no-results"` echoing the filter, with "Clear filters". Never blank space, never "No data". `variant="bordered"` keeps a region (table body, drop zone) visible.
|
|
98
|
+
3. **Loading**: `Skeleton` / `SkeletonMimic` with the real layout's dimensions (a `loading.tsx` per data route in Next). Content is never a spinner. An action in progress: `<Button loading loadingLabel="Saving…">` (keeps its width, stays focusable). Long jobs: `useToast().promise`.
|
|
99
|
+
4. **Error**: page or region: `Callout color="danger"` with a title, what happened, and a retry `Button`. Field errors: `TextField errorMessage`, or `FormField error` around `TextArea` / `Select` / `Combobox` / pickers / groups. On a failed submit of 3+ fields: `FormErrorSummary errors={[{ id, message }]}` at the top (it takes focus and links to each field), and keep each field's error. Distinct messages per cause (wrong password vs unknown email vs network).
|
|
100
|
+
5. **Success**: `const { success } = useToast()` for "Changes saved" (`init` mounts `ToastProvider` inside `ThemeProvider`; `shavin doctor` checks it). A finished flow (onboarding, checkout): `EmptyState kind="success" focusOnMount`. An inline `Callout color="success"` when the user must keep reading it. A toast never carries the only copy of an error.
|
|
101
|
+
6. **Disabled**: `Button disabledReason="…"` / `IconButton disabledReason="…"` (stays focusable, reason in a Tooltip and as its description); a field: `FormField disabled hint="Available on the Pro plan"`. Never a silently dead control.
|
|
102
|
+
|
|
103
|
+
Submit buttons stay enabled until the request starts, then show `loading`. Other controls (cancel, siblings, steps not yet reachable) may be disabled with a reason.
|
|
104
|
+
|
|
105
|
+
**Site-level states (every app and site).** Next app router: `app/not-found.tsx` (404: `Heading`, one line of `Text`, a `Button` home) and `app/error.tsx` plus `app/global-error.tsx` (error boundary: `Callout color="danger"`, what happened, a retry `Button` calling `reset()`). Pages router: `pages/404.tsx` and `pages/_error.tsx`. Vite: a catch-all not-found route and an error boundary component around the app. `check_page` fails a project without them.
|
|
106
|
+
|
|
107
|
+
**Interaction states.** Hover, pressed, focus-visible and active come with the components (`Button`, `Link`, `Tabs`, `Menu`, `Checkbox`…): that is why nothing interactive is built by hand. Never remove a focus ring (`outline-none` without a `focus-visible` replacement), and give every custom `asChild` element the component's states.
|
|
108
|
+
|
|
109
|
+
### A2. Destructive Actions
|
|
110
|
+
Delete, revoke, leave and reset go through `<AlertDialog intent="danger" title description confirmLabel onConfirm open onOpenChange />` (Cancel focused by default). Name the object and the consequence in `description`.
|
|
111
|
+
|
|
112
|
+
### B. Vercel Web Interface & Ergonomic Guidelines
|
|
113
|
+
1. **Hit Targets**: Controls reach 44px on touch automatically (24px AA floor); `size` is visual only. Opt out: `touchTargets="compact"` or `hitArea`. Stand-alone links use `<Link standalone>`; no hand-rolled `min-h-11`.
|
|
114
|
+
2. **Form Ergonomics**:
|
|
115
|
+
- Mobile input zoom is handled by the primitives: `TextField`, `TextArea`, `Select` and `Combobox` render 16px below `md` and 14px from `md` up. Do not add `text-base`/`text-sm` via `className` on them.
|
|
116
|
+
- `Flex`, `Stack` style layout primitives default to `gap="3"` (12px), including `direction="column"`. A name + description pair (title over subtitle) must set `gap="0"` or `gap="1"` explicitly; otherwise the two lines float apart.
|
|
117
|
+
- Controls that share a row or toolbar must use the same `size` (heights match Button: sm 32px, md 40px, lg 48px). Never size them with `className` (no `h-*`, `py-*` or text-size overrides). Example: `<TextField size="md" />` beside `<Select size="md" />` beside `<Button size="md">`.
|
|
118
|
+
- Never block paste in `<input>` or `<textarea>` (allow 2FA codes & passwords).
|
|
119
|
+
- `Enter` submits single inputs; `⌘/Ctrl+Enter` submits `<textarea>`.
|
|
120
|
+
- Do not disable the submit button while the user fills the form; keep it enabled until the request starts, then show `<Spinner>` while preserving button width (see the six-state rule for other disabled controls).
|
|
121
|
+
3. **Concentric Radius:** controls `--radius-lg`, containers `--radius-panel`; nested `R_inner = max(floor, R_outer - P)`, `floor = min(radius-lg, radius-panel / 2)` (use `rounded-panel-inner`).
|
|
122
|
+
4. **Compositor Animation Rule**:
|
|
123
|
+
- Animate compositor-only properties (`transform`, `opacity`); do not hand-animate layout geometry (`width`, `height`, `top`, `left`). Height animation inside `Accordion` is fine: the component owns it.
|
|
124
|
+
- Never use `transition: all` — list transition properties explicitly (`transition-colors`, `transition-transform`).
|
|
125
|
+
5. **URL & Navigation Synchronization**:
|
|
126
|
+
- Active tabs, search filters, pagination steps, and drawer states MUST sync to URL search params (`useSearchParams`) to support deep-linking and browser back/forward history.
|
|
127
|
+
- Navigation links must use `<a>` or `<Link>` (never `<div onClick>`).
|
|
128
|
+
6. **Overlay & Dialog Hygiene**:
|
|
129
|
+
- Apply `overscroll-behavior: contain` on popovers/drawers to prevent canvas scroll bleed.
|
|
130
|
+
- Use horizontal ellipsis (`…`) for menu actions opening follow-up dialogs ("Rename…", "Export…") and pending states ("Loading…").
|
|
131
|
+
- **Modals are not all one shape.** Choose `<Dialog layout>` from the moment: `default` (title row + close, hairlines) for forms and settings; `centered` (centred title, no hairlines, centred footer; `footerAlign="stretch"` on mobile) for invites, success and short decisions; `bare` + `divided={false}` for pickers and composers that lead with their content. Never stack header/body/footer hairlines on every modal, and use `AlertDialog` for destructive confirms.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 5. Standard Application Layout Architectures
|
|
136
|
+
|
|
137
|
+
### Pattern A: Workspace Dashboard Shell
|
|
138
|
+
`AppFrame` is the responsive shell. It measures its own width: wide, the `Sidebar` sits in flow; below 768px the same `Sidebar` becomes a slide-in drawer and `<SidebarTrigger />` in the `TopBar` appears by itself. Write the navigation once.
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
<AppFrame
|
|
142
|
+
routeKey={pathname}
|
|
143
|
+
sidebar={
|
|
144
|
+
<Sidebar width="w-60">
|
|
145
|
+
<SidebarHeader><Heading as="p" size="sm" tracking="tight">Acme</Heading></SidebarHeader>
|
|
146
|
+
<SidebarBody>
|
|
147
|
+
<SidebarSection title="Workspace">
|
|
148
|
+
<SidebarNavItem icon={<Icon name="layout-dashboard" size="sm" />} label="Overview" active />
|
|
149
|
+
<SidebarNavItem icon={<Icon name="table" size="sm" />} label="Data Grid" />
|
|
150
|
+
</SidebarSection>
|
|
151
|
+
</SidebarBody>
|
|
152
|
+
</Sidebar>
|
|
153
|
+
}
|
|
154
|
+
>
|
|
155
|
+
<TopBar className="gap-2"><SidebarTrigger /><Text as="span" size="sm" weight="medium">Overview</Text></TopBar>
|
|
156
|
+
<Flex direction="column" gap="6" className="min-h-0 flex-1 overflow-y-auto p-6">
|
|
157
|
+
<Heading as="h1" size="xl">Overview</Heading>
|
|
158
|
+
{status === "error" ? (
|
|
159
|
+
<Callout color="danger" title="Could not load metrics">
|
|
160
|
+
<Flex direction="column" gap="3">
|
|
161
|
+
<Text>The metrics service timed out.</Text>
|
|
162
|
+
<Button variant="outline" onClick={refetch}>Retry</Button>
|
|
163
|
+
</Flex>
|
|
164
|
+
</Callout>
|
|
165
|
+
) : status === "loading" ? (
|
|
166
|
+
<Grid columns="auto" minWidth="sm" gap="4">
|
|
167
|
+
<Skeleton className="h-24" /><Skeleton className="h-24" /><Skeleton className="h-24" />
|
|
168
|
+
</Grid>
|
|
169
|
+
) : stats.length === 0 ? (
|
|
170
|
+
<Flex direction="column" align="center" gap="3">
|
|
171
|
+
<Icon name="chart-column" size="lg" color="subtle" />
|
|
172
|
+
<Text color="subtle">No orders yet. Metrics appear after the first order.</Text>
|
|
173
|
+
<Button onClick={openNewOrder}>Create order</Button>
|
|
174
|
+
</Flex>
|
|
175
|
+
) : (
|
|
176
|
+
<Grid columns="auto" minWidth="sm" gap="4">
|
|
177
|
+
{stats.map((s) => <StatCard key={s.label} label={s.label} value={s.value} sub={s.sub} alert={s.alert} />)}
|
|
178
|
+
</Grid>
|
|
179
|
+
)}
|
|
180
|
+
</Flex>
|
|
181
|
+
</AppFrame>
|
|
182
|
+
```
|
|
183
|
+
- Never hand-write `hidden md:block` / `md:hidden` sidebar wrappers, a hamburger `IconButton`, a `navOpen` state, or a second `Drawer` copy of the navigation. `AppFrame` + `SidebarTrigger` do it.
|
|
184
|
+
- Inside an `AppFrame`, show or hide a detail with the frame, not the window: `className="shavin-frame-compact-only"` (e.g. a TopBar logo while the nav is a drawer) or `"shavin-frame-wide-only"` (e.g. a breadcrumb parent).
|
|
185
|
+
- Pass `routeKey={usePathname()}` (or your router's equivalent) so the drawer closes after navigation.
|
|
186
|
+
- Content that sits in rows of cards or stats uses `Grid columns="auto" minWidth="..."` (wraps by itself, adapts when the sidebar opens or closes). Use a numeric `columns` only when the design needs exactly N columns.
|
|
187
|
+
|
|
188
|
+
### Pattern B: Settings & Configuration Panel
|
|
189
|
+
See section 6 (settings pattern).
|
|
190
|
+
|
|
191
|
+
### Pattern C: AI Chat / Messaging Surface
|
|
192
|
+
- Transcript container with auto-scroll.
|
|
193
|
+
- One primitive for every turn: `<ChatBubble role="user|assistant|system">`. User turns: `role="user" hideAvatar` (bubble). Human-to-human chat can keep `variant="incoming|outgoing|system"`.
|
|
194
|
+
- Assistant turns: `<ChatBubble role="assistant" status="submitted|streaming|ready|stopped|error">` (flat; `submitted` shows a Murmur orb, `streaming` a caret, `stopped` a label, `error` a Retry row via `onRetry`). Status mirrors AI SDK chat status. Compose inside it, in order: `<Reasoning status="thinking|done" duration>` first, then `<ToolCall status="needs-approval|running|done|error|denied" onApprove onDeny>`, then the answer text and `<CodeBlock code language />` (copy button is built in), then `<FileOutput name kind status href />`. Use `<Murmur state="thinking|working|listening|idle" />` for any AI-activity indicator (not Spinner).
|
|
195
|
+
- Decorative backgrounds (sign-in panels, heroes): `<Backdrop variant="mesh|aurora|grid|dots" />` inside a `relative overflow-hidden` parent, content `relative` above it. Never hand-roll gradient blobs. For a mesh behind a Section/Box/Card prefer `bgOverlays="mesh-*"` (Gradient Backgrounds).
|
|
196
|
+
- Charts: one component per chart, no generic `<Chart>`. `<LineChart type="line|area" curve="smooth|linear|step" data={[{label, value}]}>` for one trend (add `series` and `stacked` for several metrics), `<Sparkline type="line|area|bar">` for a tiny trend in a card or cell, `<BarChart orientation="vertical|horizontal" mode="grouped|stacked" series>` for comparisons and rankings, `<Heatmap rows columns values>` for cohort/activity grids, `<FunnelChart orientation="horizontal|vertical">`, `<DonutChart>` for shares. Data is raw numbers per series key; format with `yFormat`. Never draw bars or heat cells by hand.
|
|
197
|
+
- Ratings: `<Rating readOnly value showValue count>` for stars (never hand-build stars; fractions fill partly, `precision="half"` to collect), `<NpsScale>` for the 0 to 10 recommend question (`calculateNps`), `<SentimentRating variant="thumbs|faces">`, `<RatingSummary counts>` for average plus 5 to 1 bars.
|
|
198
|
+
- Permissions: never run a tool that reads private data or changes something before `onApprove` fires. Let the user pick `once` or `always`, store `always` per tool in your own settings, and offer a way to revoke it.
|
|
199
|
+
- Input row: `<TextArea>` + `<IconButton>` for send, and `<VoiceInput state level elapsed transcript>` for dictation. VoiceInput is the visual state only; own the microphone and speech-to-text in your app, and never start recording without a click.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## 6. Worked Patterns
|
|
206
|
+
|
|
207
|
+
Data table, settings, auth and onboarding patterns (components, key props and all six states each) live in `patterns.md`: `get_skill({ name: "shavin-app", section: "patterns" })`, or read `.agents/skills/shavin-app/patterns.md`. Load it for any screen of those kinds.
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## 7. Anti-Copy Slop & Authentic Microcopy Standards
|
|
212
|
+
|
|
213
|
+
AI models frequently default to generic placeholder labels or corporate marketing clichés. Every screen built with `@shavin/ui` must use **realistic, concrete, domain-specific microcopy**:
|
|
214
|
+
|
|
215
|
+
### Forbidden Copywriting Patterns (Slop):
|
|
216
|
+
- ❌ **Vacuous Tech Clichés:** *"Empower your workflow"*, *"Revolutionize your efficiency"*, *"Seamless intelligence"*, *"Unleash next-gen capabilities"*.
|
|
217
|
+
- ❌ **Binary Contrast Tropes:** *"It's not just a dashboard. It's your command center."*, *"Don't just track data. Own it."*
|
|
218
|
+
- ❌ **Throat-Clearing Openers:** *"In today's fast-paced digital ecosystem..."*, *"What nobody tells you about..."*
|
|
219
|
+
- ❌ **Lazy Placeholder Labels:** `"Card Title"`, `"Card Description"`, `"Option 1, 2, 3"`, `"Lorem ipsum"`, `"John Doe"`, `"user@example.com"`.
|
|
220
|
+
|
|
221
|
+
### Required Authentic Microcopy:
|
|
222
|
+
- ✅ **Domain-Specific Telemetry:** Use realistic metrics (`p99: 42ms`, `99.98% SLA`, `14.2 GB / 20 GB allocated`, `2,840 req/s`).
|
|
223
|
+
- ✅ **Authentic Security & Permissions:** Use real RBAC terms (`viewer`, `billing_admin`, `org_owner`, `sk_live_51M...`).
|
|
224
|
+
- ✅ **Specific Action-Oriented Buttons:** Use precise labels (*"Generate API Key"*, *"Deploy to Production"*, *"Invite Teammate"*) instead of vague buttons (*"Submit"*, *"Click Here"*).
|
|
225
|
+
- ✅ **Contextual Incident Callouts:** *"Cluster degraded — 2 of 5 replicas unhealthy in us-east-1"* instead of *"Warning: An error occurred"*.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 8. Pre-Flight Verification Checklist
|
|
230
|
+
|
|
231
|
+
Before releasing any application screen or feature component, verify:
|
|
232
|
+
|
|
233
|
+
- [ ] **Orientation:** Is the current location clear via active `SidebarNavItem` and `Breadcrumbs`?
|
|
234
|
+
- [ ] **Density Baseline:** Are body texts and data tables operating at 14px (`text-sm` / `size="sm"`)?
|
|
235
|
+
- [ ] **Content Realism:** Is copy free of AI marketing clichés and lazy placeholder text?
|
|
236
|
+
- [ ] **Six-State Coverage:** First-time, empty, loading, error, success and disabled all built on this surface (not only the happy path)?
|
|
237
|
+
- [ ] **Ergonomics & Zoom:** Mobile inputs 16px (primitives do this); custom: `hit-area-touch`?
|
|
238
|
+
- [ ] **Destructive Action Safety:** Do delete/destructive actions prompt with `<AlertDialog intent="danger">` (Cancel focused by default)?
|
|
239
|
+
- [ ] **Concentric Radius:** Do nested surfaces use `rounded-panel-inner` to satisfy $R_{\text{inner}} = \max(\text{floor}, R_{\text{outer}} - P)$ (floor = `min(radius-lg, radius-panel / 2)`)?
|
|
240
|
+
- [ ] **Compositor Animation:** Hand-written transitions limited to `transform` and `opacity`, no `transition: all`?
|
|
241
|
+
- [ ] **Token Compliance:** Are all colors (`text-fg`, `bg-surface`, `border-hairline`) using semantic Shavin tokens?
|
|
242
|
+
- [ ] **Validation:** `validate_code` / `check_page` run on every UI turn; typecheck and build pass with 0 errors?
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# shavin-app: worked patterns
|
|
2
|
+
|
|
3
|
+
Each pattern implements all six states. Props below are verified; confirm others with `get_components`.
|
|
4
|
+
|
|
5
|
+
### Data table screen
|
|
6
|
+
- Shell: `Heading as="h1"` + toolbar `Flex` with `TextField type="search" leadingIcon` (debounced), `Select` filters, primary `Button` ("Invite teammate"). Search, filters, sort and page sync to URL search params.
|
|
7
|
+
- Table: `Table > TableHeader > TableRow > TableColumnHeaderCell` / `TableBody > TableRow > TableCell`. Sortable header: put a `Button variant="ghost"` inside `TableColumnHeaderCell` and set `aria-sort="ascending|descending|none"` on the cell (Table has no sort prop).
|
|
8
|
+
- Bulk select: `Checkbox` per row plus a header `Checkbox checked="indeterminate"` when partial; with a selection show a bulk bar (count `Text` + `Button tone="danger"` that opens `AlertDialog intent="danger"`).
|
|
9
|
+
- Row actions: `Menu trigger={<IconButton aria-label="Row actions" variant="ghost">...</IconButton>}` with `MenuItem` and `MenuItem variant="danger"`.
|
|
10
|
+
- Pagination: `<Pagination page totalPages onPageChange />` below the table.
|
|
11
|
+
- States: first-time = `EmptyState kind="first-time"` + primary `Button`; filters match nothing = `EmptyState kind="no-results"` + "Clear filters" `Button`; loading = 5 `Skeleton` rows with row height; error = `Callout color="danger"` + Retry; success = toast after a bulk action; disabled = bulk actions with `disabledReason="Select rows first"`.
|
|
12
|
+
- Mobile: below `md`, render rows as `Card`s in a `Flex direction="column" gap="3"` (name, status `Badge`, `Menu`) using `shavin-frame-compact-only` / `shavin-frame-wide-only` or `Table` inside its built-in horizontal scroll; never shrink columns to unreadable widths.
|
|
13
|
+
|
|
14
|
+
### Settings page
|
|
15
|
+
- `Container size="md"`, one `Section`/`Card` per group with `Heading as="h2" size="md"` + `Text color="subtle"` description. Fields in `Flex direction="column" gap="4"`: `TextField label hint`, `Select options`, `Switch label`, `RadioGroup`.
|
|
16
|
+
- One page-level Save: `Button` (not one per card). Track dirty state; when dirty show `ActionBar` or a sticky footer with Save + Discard, and warn on navigation (`beforeunload` plus a router guard `AlertDialog`).
|
|
17
|
+
- Saving: `<Button type="submit" loading={saving} loadingLabel="Saving…">`, then `success("Settings saved")`. Failure: `Callout color="danger"` at the top for a network error; field errors via `TextField errorMessage` / `FormField error` plus `FormErrorSummary` on submit.
|
|
18
|
+
- Danger zone last, in its own `Card` with `Heading` "Delete workspace", `Text color="subtle"` consequence, `Button tone="danger" variant="outline"` -> `AlertDialog intent="danger" confirmLabel="Delete workspace"`; optionally require typing the name in a `TextField`.
|
|
19
|
+
- States: first-time = defaults pre-filled with hints; loading = `Skeleton` per field row; disabled = read-only for non-admins: `disabled` fields + `Text` "Only org owners can change this".
|
|
20
|
+
|
|
21
|
+
### Auth (sign-in / sign-up)
|
|
22
|
+
- `data-composition="none"`. Single centred column: `Container size="xs"`, `Heading as="h1"`, `Text color="subtle"`, `Flex direction="column" gap="4"`: `TextField type="email" label autoComplete="email"`, `TextField type="password" label showHidePassword autoComplete="current-password"`, full-width `Button`.
|
|
23
|
+
- Never block paste. `Enter` submits. Optional `Backdrop variant="mesh"` in a `relative overflow-hidden` parent for a side panel.
|
|
24
|
+
- Errors distinct and specific: "No account for this email", "Password is incorrect", "Too many attempts, retry in 30s" via `errorMessage` on the right field; network failure as `Callout color="danger"` + retry. Focus the first invalid field.
|
|
25
|
+
- Submit: stays enabled until the request starts, then `Spinner` replaces the label inside the same `Button` so the width does not change.
|
|
26
|
+
- Success: redirect, no toast. Disabled: SSO or sign-up closed shows a `Text` reason. Secondary links with `Link` ("Forgot password?").
|
|
27
|
+
|
|
28
|
+
### Onboarding
|
|
29
|
+
- `Stepper steps current` (0-based; `variant="pills"` on mobile) above one step panel; `Button` Back / Continue (Continue primary, Back `variant="ghost"`).
|
|
30
|
+
- Validate per step before advancing: `TextField invalid errorMessage`, focus the first invalid field. Continue stays enabled; show errors on press.
|
|
31
|
+
- Skip: `Button variant="ghost"` "Skip for now" on optional steps; say what is lost in `Text color="subtle"`.
|
|
32
|
+
- Persist progress after each step (server or storage) and sync the step to the URL so refresh and Back work; resume where the user left.
|
|
33
|
+
- Done screen: `EmptyState kind="success" size="lg" focusOnMount` with one primary `Button` into the app. Saving a step shows `loading` on Continue; a failed save shows `Callout color="danger"` + retry.
|
|
34
|
+
|
|
35
|
+
---
|