@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,92 @@
|
|
|
1
|
+
# Real-world examples: unsection.com screenshot set
|
|
2
|
+
|
|
3
|
+
78 section screenshots (Freehand, RIPE, Habitat, TwelveLabs, Clarasight, a Scania case study, and
|
|
4
|
+
Taste) reviewed and mapped against this library. Most already had a home in the existing
|
|
5
|
+
compositions; three gaps became new entries: **F8 Comparison Split**, **F9 Ecosystem / Integration
|
|
6
|
+
Diagram**, and **C5 Newsletter Capture Banner**. This file is the lookup — which real-world pattern
|
|
7
|
+
maps to which composition ID — kept separate from the compositions themselves so the compositions
|
|
8
|
+
stay generic and don't accumulate a growing pile of site-specific examples over time.
|
|
9
|
+
|
|
10
|
+
`NEW` entries below are chrome (nav slivers, a mega-menu footer) that already map cleanly to ST1 /
|
|
11
|
+
ST3 and needed no new composition.
|
|
12
|
+
|
|
13
|
+
| Pattern | Composition | Notes |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| Freehand centered hero | H2 | Headline + photo + CTA, centered variant |
|
|
16
|
+
| RIPE wordmark hero with email capture | H5 + C5 | RIPE wordmark hero with inline email capture |
|
|
17
|
+
| Plain text statement hero | H2 | Plain text statement, no visual |
|
|
18
|
+
| Headline + 3-image use-case row | F1 | Headline + 3-image use-case row |
|
|
19
|
+
| Habitat hero + product photo grid | H2 | Habitat hero + product photo grid below |
|
|
20
|
+
| Abstract dark smoke hero | H4 | Abstract dark smoke bg, minimal text |
|
|
21
|
+
| Stat claim + node diagram + mini table | S2 | Stat claim + node diagram + mini table |
|
|
22
|
+
| HABITAT giant wordmark | H5 | HABITAT giant wordmark |
|
|
23
|
+
| Dark gradient statement + CTA | H4 | Dark gradient statement + CTA |
|
|
24
|
+
| Hero + orbiting avatar illustration | H2 | Hero + orbiting avatar illustration |
|
|
25
|
+
| Full-bleed sky photo statement | H4 | Full-bleed sky photo, centered statement |
|
|
26
|
+
| Dark hero + photo strip | H2 | Dark hero + photo strip below |
|
|
27
|
+
| Testimonial + press logos combined | T1 + T3 | "What the industry is saying" + press logos, combined |
|
|
28
|
+
| Process steps + CTA banner | F7 + C1 | "How We Build" 3-step process + CTA banner |
|
|
29
|
+
| Plain statement + CTA on cream | H5 | Plain statement + CTA, cream bg |
|
|
30
|
+
| Text + video thumbnail w/ play | H2 | Text + video thumbnail w/ play button |
|
|
31
|
+
| TASTE nav bar sliver | ST1 | Nav bar sliver only ("TASTE") |
|
|
32
|
+
| Colorful avatar grid "Join Us" | G5 | "Join Us" colorful avatar grid |
|
|
33
|
+
| Single testimonial + photo, dark | T1 | Single testimonial + photo, dark card |
|
|
34
|
+
| Dark green hero + supporting cards | H4 | Dark green hero + supporting cards |
|
|
35
|
+
| "Swipe Yes Or No" icon teaser | G1 | One-off icon teaser — kept as free-form G1 use rather than a new ID |
|
|
36
|
+
| FAQ accordion (Freehand) | Q2 | FAQ accordion |
|
|
37
|
+
| Pink bg photo moodboard | X1 | Pink bg photo moodboard |
|
|
38
|
+
| "Company behind the platform" cards | F1 | "The company behind the platform" 3-col cards |
|
|
39
|
+
| Newsletter signup band | C5 | Newsletter signup band |
|
|
40
|
+
| Award/press badge credibility row | T3 | Award/press badge credibility row |
|
|
41
|
+
| "Secure by design" + abstract visual | H2 | "Secure by design" claim + abstract visual |
|
|
42
|
+
| Habitat nav bar sliver | ST1 | Nav bar sliver only (Habitat) |
|
|
43
|
+
| 3-card contact-reason options | F1 | 3-card contact-reason options |
|
|
44
|
+
| Mega-menu footer, dark, multi-column | ST3 | Mega-menu footer, dark, multi-column nav |
|
|
45
|
+
| Scattered device/app icons around statement | F9 | Scattered device/app icons around statement |
|
|
46
|
+
| Expandable services list rows | F7 | Expandable services list rows |
|
|
47
|
+
| "Research and Blog" mini article row | F4 | "Research and Blog" mini article row |
|
|
48
|
+
| Photo + text split, sticker badges | H2 | Photo + text split, sticker badges |
|
|
49
|
+
| Dark CTA band + 3 bullets | C1 | Dark CTA band + 3 bullets |
|
|
50
|
+
| Corner-framed photos + center headline | H3 | Corner-framed photos + big center headline |
|
|
51
|
+
| 3-col numbered/icon steps | F7 | 3-col numbered/icon steps |
|
|
52
|
+
| Hero + 3D icon, logo wall below | H2 + T3 | Hero + 3D icon, logo wall below |
|
|
53
|
+
| Diagonal filmstrip thumbnails | X4 | Diagonal filmstrip thumbnails (TwelveLabs) |
|
|
54
|
+
| World map + address list | F1 | No dedicated map composition exists; treated as a custom media variant of F1 |
|
|
55
|
+
| Vertical stacked photo column | X1 | Vertical stacked photo column |
|
|
56
|
+
| Mixed-size resource/insights grid | G2 | Mixed-size resource/insights grid |
|
|
57
|
+
| Stacked photo + headline, mobile-style | H2 | Stacked photo + headline, mobile-style |
|
|
58
|
+
| "$260M recovered" stat showcase | S2 | "$260M recovered" 3-stat showcase |
|
|
59
|
+
| "Follow Us" social photo grid | X1 | "Follow Us" social photo grid |
|
|
60
|
+
| Logo constellation around central icon | F9 | Logo constellation around central icon |
|
|
61
|
+
| Abstract teal gradient, fragment text | H4 | Abstract teal gradient, fragment text |
|
|
62
|
+
| Leadership team photo grid | G5 | Leadership team photo grid |
|
|
63
|
+
| Text + 4-image row | F1 | Text + 4-image row |
|
|
64
|
+
| "Energy behind the aesthetic" photo grid | X1 | "Energy behind the aesthetic" photo grid |
|
|
65
|
+
| Bio text + testimonial photo card | T1 | Bio text + testimonial photo card |
|
|
66
|
+
| Dark hero + isometric illustration | H2 | Dark hero + isometric illustration |
|
|
67
|
+
| Partnership contact form + illustration | C4 | Partnership contact form + illustration |
|
|
68
|
+
| Sticky-note testimonial over photo | T1 | Sticky-note testimonial over photo |
|
|
69
|
+
| Hero + 4 tilted colored service cards | H2 + F1 | Hero + 4 tilted colored service cards |
|
|
70
|
+
| Full black minimal abstract hero | H4 | Full black minimal abstract hero |
|
|
71
|
+
| Dark hero + edge-peeking testimonial cards | H4 + T2 | Dark hero + edge-peeking testimonial cards |
|
|
72
|
+
| "Be real" statement + colorful photo cards | X1 | "Be real" statement + colorful photo cards |
|
|
73
|
+
| "Our Work" client/portfolio card row | G4 | "Our Work" client/portfolio card row |
|
|
74
|
+
| "Why freight spend leaks" dark hero | H2 | "Why freight spend leaks" dark hero |
|
|
75
|
+
| "Three ways to partner" cards + logo row | F1 + T3 | "Three ways to partner" cards + logo row |
|
|
76
|
+
| Full blog grid w/ search | G2 | Full blog grid w/ search |
|
|
77
|
+
| 1:1 session cards w/ time labels | F1 | 1:1 session cards w/ time labels |
|
|
78
|
+
| Bullet list + photo split | H2 | Bullet list + photo split |
|
|
79
|
+
| Fanned app-icon stack hero | X4 | Fanned app-icon stack hero (Taste) |
|
|
80
|
+
| 3 small dashboard/use-case cards | F1 | 3 small dashboard/use-case cards |
|
|
81
|
+
| FAQ accordion (Clarasight) | Q2 | FAQ accordion (Clarasight) |
|
|
82
|
+
| Traditional vs. Clarasight comparison split | F8 | Traditional vs. Clarasight comparison split |
|
|
83
|
+
| Scania case study split | G4 | Scania case study split |
|
|
84
|
+
| Security/compliance badge row | T3 | Security/compliance badge row |
|
|
85
|
+
| Mega-menu footer (Clarasight) | ST3 | Mega-menu footer (Clarasight) |
|
|
86
|
+
| "Stack connected" scattered icon diagram | F9 | "Stack connected" scattered icon diagram |
|
|
87
|
+
| Minimal floating product-UI screenshot | H1 | Minimal floating product-UI screenshot |
|
|
88
|
+
| Scania testimonial, plain card | T1 | Scania testimonial, plain card |
|
|
89
|
+
| "Who we're guided by" compact team row | G5 | "Who we're guided by" compact team row |
|
|
90
|
+
| Free/Developer/Enterprise pricing table | P1 | Free/Developer/Enterprise pricing table |
|
|
91
|
+
| "Industry trusted" logo wall | T3 | "Industry trusted" logo wall |
|
|
92
|
+
| Enterprise contact form + trust logos | C4 | Enterprise contact form + trust logos |
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Visual review: look at the rendered page before you say it is done
|
|
2
|
+
|
|
3
|
+
`check_page`, `validate_code` and `audit_source` prove the page follows the rules. They cannot see it. A page can pass every gate and still feel flat, dim or empty. This step is the only one that judges the result, so it is required for every page and for any section you rework.
|
|
4
|
+
|
|
5
|
+
Contents: 1 Capture · 2 Rubric · 3 Measure · 4 Fix loop · 5 No browser
|
|
6
|
+
|
|
7
|
+
## 1. Capture
|
|
8
|
+
|
|
9
|
+
Run the dev server, open the page in a real browser (built-in browser, Claude in Chrome or Playwright) and screenshot at 375, 768 and 1280 wide. Scroll the whole page with real scrolling, not by jumping, so reveal and scroll-linked motion actually run. Look at each section as a viewer would, one viewport at a time.
|
|
10
|
+
|
|
11
|
+
## 2. Rubric
|
|
12
|
+
|
|
13
|
+
Score each viewport. Any "no" is a defect to fix, not a note.
|
|
14
|
+
|
|
15
|
+
| Check | Pass when |
|
|
16
|
+
|---|---|
|
|
17
|
+
| Focal point | One clear thing wins the eye in every viewport |
|
|
18
|
+
| Hierarchy | Headline, support text, action and meta read as four distinct levels |
|
|
19
|
+
| Depth | Surfaces differ by role (page, card, raised, inset). Identical gray cards everywhere is a defect |
|
|
20
|
+
| Bold moment | The moment named in the plan is built and visible, not just planned |
|
|
21
|
+
| Real UI | Product visuals look like a real product: believable data, layered, no placeholder boxes |
|
|
22
|
+
| Dead space | No card or frame stretched around content that does not fill it; no gap taller than about one viewport between related items |
|
|
23
|
+
| Rhythm | Section heights and densities alternate; no three similar sections in a row |
|
|
24
|
+
| Motion | Scroll through once. Reveals fire, nothing stays hidden, the signature scene (if any) works and reduced motion shows the final state |
|
|
25
|
+
| Copy | Specific to the product, no filler, no invented proof |
|
|
26
|
+
| Mobile | No horizontal scroll, tap targets at least 24px (Shavin controls reach 44px on touch by themselves), nothing clipped (a wide table scrolls inside its own region) |
|
|
27
|
+
|
|
28
|
+
Content-sized UI (cards, panels, product mockups) is never forced into a fixed aspect ratio. Fix the height to the tallest state and centre the others, or let each keep its natural height.
|
|
29
|
+
|
|
30
|
+
## 3. Measure
|
|
31
|
+
|
|
32
|
+
Do not judge contrast by eye. In the page console, compute the contrast of body text, descriptions and meta against their real backgrounds. Text that carries meaning needs at least 4.5:1 (3:1 for 24px and up). If a token pair fails, use the next token up for that text and report the token.
|
|
33
|
+
|
|
34
|
+
## 4. Fix loop
|
|
35
|
+
|
|
36
|
+
Fix the defects, re-screenshot the same viewports, and repeat up to three times. Then report what you checked, what you fixed and what remains. Never say "polished" without having looked.
|
|
37
|
+
|
|
38
|
+
## 5. No browser
|
|
39
|
+
|
|
40
|
+
If no browser is available, say the page was not visually reviewed and list what the rubric would check. Do not claim it passed.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Render ```wf blocks into perfectly aligned box-drawing wireframes, in place.
|
|
3
|
+
|
|
4
|
+
Why this exists: hand-drawn ASCII wireframes drift out of alignment, and a model
|
|
5
|
+
reads misaligned boxes as ambiguous structure. Write the wireframe in the tiny DSL
|
|
6
|
+
below, run this script, and the block is replaced by an aligned plain code fence.
|
|
7
|
+
|
|
8
|
+
DSL (one row per line):
|
|
9
|
+
Some text single full-width cell, centered
|
|
10
|
+
<Some text single cell, left-aligned
|
|
11
|
+
a | b | c three equal cells
|
|
12
|
+
{7:5} a | b two cells, weighted 7:5 (weights apply to that row only)
|
|
13
|
+
. spacer row (continues the previous row's column dividers)
|
|
14
|
+
--- horizontal rule across the whole box (junctions computed)
|
|
15
|
+
|
|
16
|
+
Usage:
|
|
17
|
+
python render_wireframes.py references/compositions/*.md
|
|
18
|
+
"""
|
|
19
|
+
import re
|
|
20
|
+
import sys
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
INNER = 47 # inner width in characters (outer = 49)
|
|
24
|
+
BLOCK = re.compile(r"```wf\n(.*?)\n```", re.DOTALL)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def parse_row(line):
|
|
28
|
+
weights = None
|
|
29
|
+
m = re.match(r"^\{([\d:]+)\}\s*(.*)$", line)
|
|
30
|
+
if m:
|
|
31
|
+
weights = [int(x) for x in m.group(1).split(":")]
|
|
32
|
+
line = m.group(2)
|
|
33
|
+
cells = [c.strip() for c in line.split("|")]
|
|
34
|
+
if weights is None:
|
|
35
|
+
weights = [1] * len(cells)
|
|
36
|
+
if len(weights) != len(cells):
|
|
37
|
+
raise ValueError(f"weights {weights} do not match {len(cells)} cells in: {line!r}")
|
|
38
|
+
return cells, weights
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def widths_for(weights):
|
|
42
|
+
n = len(weights)
|
|
43
|
+
avail = INNER - (n - 1)
|
|
44
|
+
total = sum(weights)
|
|
45
|
+
ws = [avail * w // total for w in weights]
|
|
46
|
+
ws[-1] += avail - sum(ws)
|
|
47
|
+
return ws
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def dividers(ws):
|
|
51
|
+
pos, acc = set(), 0
|
|
52
|
+
for i, w in enumerate(ws[:-1]):
|
|
53
|
+
acc += w
|
|
54
|
+
pos.add(acc + i + 1)
|
|
55
|
+
return pos
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def cell_text(text, width):
|
|
59
|
+
left = text.startswith("<")
|
|
60
|
+
if left:
|
|
61
|
+
text = " " + text[1:].strip()
|
|
62
|
+
if len(text) > width:
|
|
63
|
+
print(f" warning: truncating {text!r} to {width} chars", file=sys.stderr)
|
|
64
|
+
text = text[: width - 1] + "…"
|
|
65
|
+
return text.ljust(width) if left else text.center(width)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def border(kind, divs):
|
|
69
|
+
left, mid, right = {"top": ("┌", "┬", "┐"), "bottom": ("└", "┴", "┘")}[kind]
|
|
70
|
+
return left + "".join(mid if p in divs else "─" for p in range(1, INNER + 1)) + right
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def rule(above, below):
|
|
74
|
+
out = "├"
|
|
75
|
+
for p in range(1, INNER + 1):
|
|
76
|
+
a, b = p in above, p in below
|
|
77
|
+
out += "┼" if a and b else "┴" if a else "┬" if b else "─"
|
|
78
|
+
return out + "┤"
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def render(source):
|
|
82
|
+
items = [] # ("row", cells, ws) | ("rule",)
|
|
83
|
+
last_ws = [INNER]
|
|
84
|
+
for raw in source.splitlines():
|
|
85
|
+
line = raw.rstrip()
|
|
86
|
+
if not line.strip():
|
|
87
|
+
continue
|
|
88
|
+
if line.strip() == "---":
|
|
89
|
+
items.append(("rule",))
|
|
90
|
+
elif line.strip() == ".":
|
|
91
|
+
items.append(("row", [""] * len(last_ws), last_ws))
|
|
92
|
+
else:
|
|
93
|
+
cells, weights = parse_row(line.strip())
|
|
94
|
+
ws = widths_for(weights)
|
|
95
|
+
last_ws = ws
|
|
96
|
+
items.append(("row", cells, ws))
|
|
97
|
+
|
|
98
|
+
rows = [i for i in items if i[0] == "row"]
|
|
99
|
+
if not rows:
|
|
100
|
+
raise ValueError("wireframe has no rows")
|
|
101
|
+
|
|
102
|
+
def divs_near(idx, step):
|
|
103
|
+
j = idx + step
|
|
104
|
+
while 0 <= j < len(items):
|
|
105
|
+
if items[j][0] == "row":
|
|
106
|
+
return dividers(items[j][2])
|
|
107
|
+
j += step
|
|
108
|
+
return set()
|
|
109
|
+
|
|
110
|
+
lines = [border("top", dividers(rows[0][2]))]
|
|
111
|
+
for idx, it in enumerate(items):
|
|
112
|
+
if it[0] == "rule":
|
|
113
|
+
lines.append(rule(divs_near(idx, -1), divs_near(idx, +1)))
|
|
114
|
+
else:
|
|
115
|
+
_, cells, ws = it
|
|
116
|
+
lines.append("│" + "│".join(cell_text(c, w) for c, w in zip(cells, ws)) + "│")
|
|
117
|
+
lines.append(border("bottom", dividers(rows[-1][2])))
|
|
118
|
+
return "\n".join(lines)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def main(paths):
|
|
122
|
+
total = 0
|
|
123
|
+
for p in map(Path, paths):
|
|
124
|
+
text = p.read_text(encoding="utf-8")
|
|
125
|
+
count = len(BLOCK.findall(text))
|
|
126
|
+
if not count:
|
|
127
|
+
continue
|
|
128
|
+
new = BLOCK.sub(lambda m: "```\n" + render(m.group(1)) + "\n```", text)
|
|
129
|
+
p.write_text(new, encoding="utf-8")
|
|
130
|
+
total += count
|
|
131
|
+
print(f"{p}: rendered {count} wireframe(s)")
|
|
132
|
+
print(f"done: {total} wireframe(s) rendered")
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
if __name__ == "__main__":
|
|
136
|
+
if len(sys.argv) < 2:
|
|
137
|
+
sys.exit(__doc__)
|
|
138
|
+
main(sys.argv[1:])
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Validate the layout-compositions library.
|
|
3
|
+
|
|
4
|
+
Catches the failure modes found in the v1 catalogue:
|
|
5
|
+
* compositions missing required metadata / labelled sections
|
|
6
|
+
* misaligned ASCII wireframes
|
|
7
|
+
* compositions missing from the selection guide (v1 omitted all of Pricing)
|
|
8
|
+
* page recipes that reference compositions that do not exist
|
|
9
|
+
* the bare-string grid bug (columns="3" gives 3 columns on mobile)
|
|
10
|
+
|
|
11
|
+
Usage: python scripts/validate_library.py [path/to/skill-root]
|
|
12
|
+
Exit code 1 if any error is found.
|
|
13
|
+
"""
|
|
14
|
+
import re
|
|
15
|
+
import sys
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
ROOT = Path(sys.argv[1]).resolve() if len(sys.argv) > 1 else Path(__file__).resolve().parent.parent
|
|
19
|
+
REFS = ROOT / "references"
|
|
20
|
+
COMP_DIR = REFS / "compositions"
|
|
21
|
+
|
|
22
|
+
REQUIRED_KEYS = ["id", "name", "family", "job", "density", "styles", "treatments",
|
|
23
|
+
"media", "items", "slots", "motion"]
|
|
24
|
+
ENUMS = {
|
|
25
|
+
"job": {"attention", "orientation", "understanding", "credibility", "desire", "action", "reference"},
|
|
26
|
+
"density": {"low", "medium", "high"},
|
|
27
|
+
"styles": {"structural", "marketing", "editorial", "hybrid", "documentation", "expressive"},
|
|
28
|
+
"treatments": {"carded", "ruled", "flat", "full-bleed", "open"},
|
|
29
|
+
"media": {"none", "product-ui", "code", "photo", "mesh", "illustration", "video", "data", "logos"},
|
|
30
|
+
"motion": {"tier0", "tier1", "choreography-ok"},
|
|
31
|
+
}
|
|
32
|
+
LIST_KEYS = {"styles", "treatments", "media", "slots"}
|
|
33
|
+
REQUIRED_LABELS = ["**Best for:**", "**Avoid when:**", "**Grid:**", "**Contract:**", "**Watch:**"]
|
|
34
|
+
ID_RE = re.compile(r"^[A-Z]{1,2}\d+$")
|
|
35
|
+
HEADING_RE = re.compile(r"^### ([A-Z]{1,2}\d+) · (.+)$", re.M)
|
|
36
|
+
ID_TOKEN = re.compile(r"\b(?:ST|[HFSTCPQGEDX])\d+\b")
|
|
37
|
+
BARE_GRID = re.compile(r'columns="\d+"')
|
|
38
|
+
|
|
39
|
+
errors, warnings = [], []
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def fenced_blocks(text):
|
|
43
|
+
"""Return [(lang, content)] for every ``` fenced block, pairing fences line by line."""
|
|
44
|
+
blocks, lang, buf, inside = [], "", [], False
|
|
45
|
+
for line in text.splitlines():
|
|
46
|
+
if line.startswith("```"):
|
|
47
|
+
if inside:
|
|
48
|
+
blocks.append((lang, "\n".join(buf)))
|
|
49
|
+
lang, buf, inside = "", [], False
|
|
50
|
+
else:
|
|
51
|
+
lang, buf, inside = line[3:].strip(), [], True
|
|
52
|
+
elif inside:
|
|
53
|
+
buf.append(line)
|
|
54
|
+
return blocks
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def err(msg):
|
|
58
|
+
errors.append(msg)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def parse_yaml_block(block):
|
|
62
|
+
data = {}
|
|
63
|
+
for line in block.splitlines():
|
|
64
|
+
line = line.split(" #")[0].rstrip()
|
|
65
|
+
if not line.strip() or ":" not in line:
|
|
66
|
+
continue
|
|
67
|
+
key, _, val = line.partition(":")
|
|
68
|
+
key, val = key.strip(), val.strip()
|
|
69
|
+
if key in LIST_KEYS:
|
|
70
|
+
if not (val.startswith("[") and val.endswith("]")):
|
|
71
|
+
err(f"key '{key}' must be a [list], got: {val}")
|
|
72
|
+
data[key] = []
|
|
73
|
+
else:
|
|
74
|
+
data[key] = [v.strip() for v in val[1:-1].split(",") if v.strip()]
|
|
75
|
+
else:
|
|
76
|
+
data[key] = val.strip('"')
|
|
77
|
+
return data
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def check_wireframes(section, comp_id):
|
|
81
|
+
boxes = [c for lang, c in fenced_blocks(section) if lang == "" and "┌" in c]
|
|
82
|
+
if not boxes:
|
|
83
|
+
err(f"{comp_id}: no wireframe (plain ``` block with a box)")
|
|
84
|
+
return
|
|
85
|
+
for box in boxes:
|
|
86
|
+
lines = box.splitlines()
|
|
87
|
+
widths = {len(l) for l in lines}
|
|
88
|
+
if len(widths) != 1:
|
|
89
|
+
err(f"{comp_id}: wireframe lines have unequal widths {sorted(widths)} (run render_wireframes.py)")
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def main():
|
|
93
|
+
if not COMP_DIR.is_dir():
|
|
94
|
+
sys.exit(f"compositions dir not found: {COMP_DIR}")
|
|
95
|
+
|
|
96
|
+
all_ids, families = {}, {}
|
|
97
|
+
for md in sorted(COMP_DIR.glob("*.md")):
|
|
98
|
+
text = md.read_text(encoding="utf-8")
|
|
99
|
+
if "```wf" in text:
|
|
100
|
+
err(f"{md.name}: contains unrendered ```wf block (run render_wireframes.py)")
|
|
101
|
+
matches = list(HEADING_RE.finditer(text))
|
|
102
|
+
for i, m in enumerate(matches):
|
|
103
|
+
cid = m.group(1)
|
|
104
|
+
end = matches[i + 1].start() if i + 1 < len(matches) else len(text)
|
|
105
|
+
section = text[m.start():end]
|
|
106
|
+
if not ID_RE.match(cid):
|
|
107
|
+
err(f"{md.name}: bad id {cid}")
|
|
108
|
+
if cid in all_ids:
|
|
109
|
+
err(f"{cid}: duplicate id (also in {all_ids[cid]})")
|
|
110
|
+
all_ids[cid] = md.name
|
|
111
|
+
yaml_blocks = [c for lang, c in fenced_blocks(section) if lang == "yaml"]
|
|
112
|
+
if not yaml_blocks:
|
|
113
|
+
err(f"{cid}: missing yaml metadata block")
|
|
114
|
+
continue
|
|
115
|
+
data = parse_yaml_block(yaml_blocks[0])
|
|
116
|
+
for k in REQUIRED_KEYS:
|
|
117
|
+
if k not in data:
|
|
118
|
+
err(f"{cid}: metadata missing '{k}'")
|
|
119
|
+
if data.get("id") != cid:
|
|
120
|
+
err(f"{cid}: heading id != metadata id ({data.get('id')})")
|
|
121
|
+
if data.get("family") != md.stem:
|
|
122
|
+
err(f"{cid}: family '{data.get('family')}' != file '{md.stem}'")
|
|
123
|
+
for k, allowed in ENUMS.items():
|
|
124
|
+
vals = data.get(k, [])
|
|
125
|
+
vals = vals if isinstance(vals, list) else [vals]
|
|
126
|
+
bad = [v for v in vals if v not in allowed]
|
|
127
|
+
if bad:
|
|
128
|
+
err(f"{cid}: invalid {k} value(s) {bad}")
|
|
129
|
+
for label in REQUIRED_LABELS:
|
|
130
|
+
if label not in section:
|
|
131
|
+
err(f"{cid}: missing {label}")
|
|
132
|
+
check_wireframes(section, cid)
|
|
133
|
+
families.setdefault(md.stem, []).append(cid)
|
|
134
|
+
|
|
135
|
+
# selection guide must mention every composition
|
|
136
|
+
sg = (REFS / "selection-guide.md").read_text(encoding="utf-8")
|
|
137
|
+
for cid in all_ids:
|
|
138
|
+
if not re.search(rf"\b{cid}\b", sg):
|
|
139
|
+
err(f"{cid}: not mentioned in selection-guide.md")
|
|
140
|
+
|
|
141
|
+
# recipes must only reference real compositions
|
|
142
|
+
rc = (REFS / "page-recipes.md").read_text(encoding="utf-8")
|
|
143
|
+
for token in sorted(set(ID_TOKEN.findall(rc))):
|
|
144
|
+
if token not in all_ids:
|
|
145
|
+
err(f"page-recipes.md references unknown composition {token}")
|
|
146
|
+
|
|
147
|
+
# bare-string grid bug anywhere in references
|
|
148
|
+
for md in REFS.rglob("*.md"):
|
|
149
|
+
for n, line in enumerate(md.read_text(encoding="utf-8").splitlines(), 1):
|
|
150
|
+
if BARE_GRID.search(line) and "stack=" not in line: # stack="auto" is the fix, so a line that sets it is fine
|
|
151
|
+
err(f"{md.relative_to(ROOT)}:{n}: bare-string grid columns (use a responsive object)")
|
|
152
|
+
|
|
153
|
+
print(f"compositions: {len(all_ids)} across {len(families)} families")
|
|
154
|
+
for fam, ids in families.items():
|
|
155
|
+
print(f" {fam:<14} {len(ids):>2} {', '.join(ids)}")
|
|
156
|
+
if errors:
|
|
157
|
+
print(f"\n{len(errors)} error(s):")
|
|
158
|
+
for e in errors:
|
|
159
|
+
print(" ✗", e)
|
|
160
|
+
sys.exit(1)
|
|
161
|
+
print("\nOK — no errors")
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
if __name__ == "__main__":
|
|
165
|
+
main()
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: layout-motion
|
|
3
|
+
description: >
|
|
4
|
+
Clean, smooth, restrained motion for web layouts (Tier 1) — motion tokens (durations, easings,
|
|
5
|
+
distances, stagger), scroll reveals, hover and press states, tab and accordion transitions,
|
|
6
|
+
count-ups, marquees with pause controls, sticky-header effects, scroll-spy and light parallax,
|
|
7
|
+
all with reduced-motion fallbacks. Use whenever the user wants to add animation, transitions,
|
|
8
|
+
reveals, hover effects, micro-interactions, count-up numbers, marquees or "smooth, subtle,
|
|
9
|
+
polished motion" to a page, section or component, including "make this feel more
|
|
10
|
+
premium/alive", and whenever a layout-compositions page needs motion. Not for pinned scenes,
|
|
11
|
+
scroll-scrubbed timelines, page transitions, WebGL or cursor choreography — use
|
|
12
|
+
layout-choreography for those.
|
|
13
|
+
sections:
|
|
14
|
+
- id: tokens
|
|
15
|
+
file: references/tokens.md
|
|
16
|
+
description: "Motion tokens — durations, distances, stagger, reduced-motion safety net (~1K tokens)"
|
|
17
|
+
- id: presets
|
|
18
|
+
file: references/presets.md
|
|
19
|
+
description: "11 tier-1 motion presets with code and reduced-motion paths (~2.5K tokens)"
|
|
20
|
+
- id: composition-motion-map
|
|
21
|
+
file: references/composition-motion-map.md
|
|
22
|
+
description: "Which preset per composition ID, with escalation markers (~1K tokens)"
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
- **Token-efficient usage:** This skill is modular. For specific rules, call:
|
|
26
|
+
> - `get_skill({ name: "layout-motion", section: "tokens" })` — motion token reference
|
|
27
|
+
> - `get_skill({ name: "layout-motion", section: "presets" })` — 11 tier-1 preset recipes
|
|
28
|
+
> - `get_skill({ name: "layout-motion", section: "composition-motion-map" })` — which preset per composition
|
|
29
|
+
>
|
|
30
|
+
> **Core motion tokens:** Already defined in `@shavin/ui` `global.css` (`--dur-*`, `--dist-*`, `--stagger`).
|
|
31
|
+
> See also `visual-compositor/motion-and-physics.md` for the canonical token reference and The Frequency Law.
|
|
32
|
+
|
|
33
|
+
# Layout Motion (Tier 1)
|
|
34
|
+
|
|
35
|
+
Tier 1 is motion that supports a layout without changing it: entrances, state changes, and small moments of emphasis. It is what most "clean, smooth" sites actually need. It sits on top of the static layout (Tier 0) and below choreography (Tier 2).
|
|
36
|
+
|
|
37
|
+
## Principles
|
|
38
|
+
|
|
39
|
+
1. **Motion answers something.** It shows what changed (a tab switched, a panel opened, a number arrived) or draws attention to one important thing. Decorative motion everywhere reads as generic.
|
|
40
|
+
2. **One orchestrated moment beats many effects.** A single page-load sequence or one reveal is stronger than fade-up on every section and a hover-lift on every card.
|
|
41
|
+
3. **Content never depends on it.** Everything is visible and correct with JS off and with `prefers-reduced-motion: reduce`.
|
|
42
|
+
4. **Cheap properties only.** Animate `transform` and `opacity`. Never animate width, height, top or left on the main thread if a transform will do.
|
|
43
|
+
5. **Consistent vocabulary.** Use the tokens (`references/tokens.md`) so speed and easing feel like one system.
|
|
44
|
+
|
|
45
|
+
## Workflow
|
|
46
|
+
|
|
47
|
+
1. Read the composition's `slots` and `motion` metadata (from `layout-compositions`). If `motion: tier0`, add nothing unless the user insists.
|
|
48
|
+
2. Look up the composition in `references/composition-motion-map.md` and pick from its suggested presets. Fewer is better.
|
|
49
|
+
3. The token block is already installed in `@shavin/ui` `global.css` (`--dur-*`, `--dist-*`, `--stagger`). Reference tokens, don't re-declare.
|
|
50
|
+
4. Implement each chosen preset from `references/presets.md`, attaching to `data-slot` / `data-reveal` attributes, not by restructuring markup.
|
|
51
|
+
5. Add the reduced-motion path for each preset (the presets show how). The token safety net in `global.css` already zeros durations/distances under `prefers-reduced-motion: reduce`.
|
|
52
|
+
6. Run the checks below.
|
|
53
|
+
|
|
54
|
+
## Rules of thumb
|
|
55
|
+
|
|
56
|
+
| Thing | Guideline |
|
|
57
|
+
|---|---|
|
|
58
|
+
| Hover / press feedback | 100–160ms, `--ease-standard` |
|
|
59
|
+
| State change (tabs, toggles) | 160–240ms |
|
|
60
|
+
| Entrance | 400–600ms, `--ease-out`, travel ≤ 24px |
|
|
61
|
+
| Exit | ~65% of the entrance duration, `--ease-in` |
|
|
62
|
+
| Stagger | 40–80ms per item, total ≤ 400ms; cap at ~8 items |
|
|
63
|
+
| Auto-moving content | Must be pausable if it runs over 5s (WCAG 2.2.2) |
|
|
64
|
+
| Simultaneous animations | Keep few; budget by what the eye can follow |
|
|
65
|
+
|
|
66
|
+
- Don't put entrance animation on the LCP element (usually hero media or headline): opacity-0 elements can delay LCP. Animate supporting elements or use `transform` only.
|
|
67
|
+
- Gate hover effects behind `@media (hover: hover)` so touch devices don't get sticky states.
|
|
68
|
+
- Trigger reveals once (unobserve after firing). Re-triggering on every scroll is noisy.
|
|
69
|
+
- Above-the-fold elements shouldn't wait for a scroll trigger.
|
|
70
|
+
|
|
71
|
+
## When to escalate to `layout-choreography`
|
|
72
|
+
|
|
73
|
+
Switch when the request involves any of: pinned sections, scroll-scrubbed timelines, sequenced multi-element timelines, page transitions, horizontal scroll driven by vertical scroll, text split-and-stagger sequences, image mask reveals, WebGL/canvas scenes, cursor-following effects, or smooth-scroll libraries. Those need scene specs, fallbacks and performance budgets.
|
|
74
|
+
|
|
75
|
+
## Checks before delivering
|
|
76
|
+
|
|
77
|
+
- [ ] Works with JS disabled (content visible) and with reduced motion (no movement, no hidden content).
|
|
78
|
+
- [ ] No layout shift from animated elements (space reserved; `tabular-nums` on counters).
|
|
79
|
+
- [ ] No animation on the LCP element's opacity.
|
|
80
|
+
- [ ] Marquees/tickers have a pause control and stop on focus-within.
|
|
81
|
+
- [ ] Hover effects also appear on `:focus-visible`.
|
|
82
|
+
- [ ] Only `transform`/`opacity` animated (or `grid-template-rows` for the accordion technique).
|
|
83
|
+
- [ ] Total motion is restrained: name the one moment that is meant to stand out.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Composition → motion map
|
|
2
|
+
|
|
3
|
+
Suggested Tier 1 presets per composition. Numbers refer to sections in `presets.md`. "None" is a valid and often best answer. Pick one or two per page section, not all of them.
|
|
4
|
+
|
|
5
|
+
`◆` marks compositions whose metadata allows a choreography scene on top (see `layout-choreography`).
|
|
6
|
+
|
|
7
|
+
| ID | Suggested presets | Notes |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| ST1 | 8 sticky state; menu open/close at `--dur-base` | Never animate header height |
|
|
10
|
+
| ST2 | none | Dismiss can fade out at `--dur-fast` |
|
|
11
|
+
| ST3 | none | |
|
|
12
|
+
| ST4 | 1 reveal (wordmark, once) | Static wordmark must fit before it animates |
|
|
13
|
+
| ST5 | none | |
|
|
14
|
+
| ST6 | sidebar collapse at `--dur-base` | Animate width via transform/clip, or snap |
|
|
15
|
+
| H1 | 2 load sequence | Keep media (LCP) visible |
|
|
16
|
+
| H2 | 2 load sequence | Media may rise once via transform only |
|
|
17
|
+
| H3 ◆ | 2 load sequence; 10 light parallax on the visual | |
|
|
18
|
+
| H4 ◆ | none, or slow media drift ≤ 24px; scroll cue can bob | Reduced motion: poster only |
|
|
19
|
+
| H5 ◆ | 2 load sequence per line | Split-text sequences → choreography |
|
|
20
|
+
| F1 | 1 reveal with stagger (once) | |
|
|
21
|
+
| F2 | 1 reveal with stagger; 3 hover on linked cells | |
|
|
22
|
+
| F3 | 1 reveal per row (once) | |
|
|
23
|
+
| F4 | native smooth scroll on buttons | No autoplay |
|
|
24
|
+
| F5 | 5 tab crossfade | |
|
|
25
|
+
| F6 ◆ | 9 scroll-spy + crossfade of the pinned visual | Scrubbed transitions → choreography |
|
|
26
|
+
| F7 | 1 reveal with stagger | |
|
|
27
|
+
| F8 | 1 reveal, both panels together (never stagger A before B) | |
|
|
28
|
+
| F9 | 1 reveal (once); optional very slow icon drift | Keep drift subtle — this is ambient, not a focal point |
|
|
29
|
+
| S1 | none | |
|
|
30
|
+
| S2 | 1 reveal (once) | |
|
|
31
|
+
| S3 | 6 count-up | |
|
|
32
|
+
| T1 | 1 reveal (once) | |
|
|
33
|
+
| T2 | 1 reveal with stagger | |
|
|
34
|
+
| T3 | none | |
|
|
35
|
+
| T4 | 7 marquee with pause | |
|
|
36
|
+
| C1 | 1 reveal (once) | |
|
|
37
|
+
| C2 | copy-button feedback at `--dur-fast` | |
|
|
38
|
+
| C3 | static glow; at most a very slow drift | Reduced motion: static |
|
|
39
|
+
| C4 | field/validation state transitions at `--dur-fast` | |
|
|
40
|
+
| C5 | 1 reveal (once); submit/success state at `--dur-fast` | Announce success/error with a live region |
|
|
41
|
+
| P1 | price toggle crossfade at `--dur-base` | Announce with a live region |
|
|
42
|
+
| P2 | none | |
|
|
43
|
+
| P3 | none | |
|
|
44
|
+
| Q1 | 5 panel crossfade | |
|
|
45
|
+
| Q2 | 4 accordion height | |
|
|
46
|
+
| G1 | 1 reveal with stagger (first screenful only) | |
|
|
47
|
+
| G2 | 11 filter fade | |
|
|
48
|
+
| G3 | 7 marquee rows with pause | |
|
|
49
|
+
| G4 | 3 hover on linked items | |
|
|
50
|
+
| G5 | none | |
|
|
51
|
+
| E1 | none; optional reading-progress bar | |
|
|
52
|
+
| E2 | note highlight on hover/focus at `--dur-fast` | |
|
|
53
|
+
| E3 | none | |
|
|
54
|
+
| E4 | row hover at `--dur-fast` | |
|
|
55
|
+
| D1 | 9 scroll-spy on the TOC | Keep docs calm |
|
|
56
|
+
| D2 | tab switch instant or `--dur-fast` | |
|
|
57
|
+
| D3 | none | |
|
|
58
|
+
| D4 | search focus state at `--dur-fast` | |
|
|
59
|
+
| X1 ◆ | 1 reveal (once), staggered by element role; 10 parallax on one element | |
|
|
60
|
+
| X2 ◆ | line-by-line reveal (2) | Split-text/masked → choreography |
|
|
61
|
+
| X3 ◆ | crossfade of scroller items | Pinned scenes → choreography |
|
|
62
|
+
| X4 ◆ | progress bar update; button smooth scroll | Scroll-jacked horizontal → choreography |
|
|
63
|
+
| X5 ◆ | hover preview fade at `--dur-fast`; cursor-follow → choreography | Also on focus |
|
|
64
|
+
|
|
65
|
+
## Combining across a page
|
|
66
|
+
|
|
67
|
+
- Choose the single most important moment (usually the hero) for the richest motion; keep the rest to reveal-once or none.
|
|
68
|
+
- Adjacent sections shouldn't all reveal identically. If every section fades up, the effect is invisible.
|
|
69
|
+
- Sections that carry dense reading material (docs, articles) get almost no motion.
|