@sloppy-ai/skill 0.0.0-stage → 1.4.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/SKILL.md +95 -0
- package/package.json +23 -4
- package/references/annotations.md +76 -0
- package/references/backgrounds.md +30 -0
- package/references/bento.md +63 -0
- package/references/brands.md +32 -0
- package/references/choreography.md +32 -0
- package/references/craft.md +160 -0
- package/references/framing.md +106 -0
- package/references/kit.md +185 -0
- package/references/looks.md +66 -0
- package/references/motion.md +185 -0
- package/references/products.md +26 -0
- package/references/rehearse.md +117 -0
- package/references/review.md +26 -0
- package/references/teaching.md +111 -0
- package/references/verify.md +84 -0
- package/skill.json +17 -0
- package/README.md +0 -3
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Framing
|
|
2
|
+
|
|
3
|
+
How the screen sits in its space decides whether it reads as a product shot or a screenshot in a box. Decide the framing before building the screen: a crop needs nothing past the crop, and it sets how big the type must be. SKILL.md has the summary; the numbers are here.
|
|
4
|
+
|
|
5
|
+
## The rules
|
|
6
|
+
|
|
7
|
+
1. **One hero object, at most one or two satellites** (a receipt, a phone, a detail card) that carry the point (`examples/static-card`).
|
|
8
|
+
2. **Keep what identifies the product:** a title, the real chrome, the rows that give the action a reason. Logo and nav are not required; crop around the story.
|
|
9
|
+
3. **The medium picks the first layout:** corner bleed for a hero beside copy, pinned bottom bleed for a card or tile, a phone pinned from the top. If it doesn't hold, try a second from the table below.
|
|
10
|
+
4. **Crop only filler.** The payoff, the action, what the cursor touches and every real word stay whole; a list, diff or terminal may run one line off a bled bottom edge. A placeholder action the crop would slice is removed, not sliced; if the story does not fit, change the stage size or the layout. A button, chip or shadow sliced by the stage edge is the usual fault.
|
|
11
|
+
5. **Crop 10 to 40% of the hero off stage.** The window or phone fills at least two thirds of the stage's width and runs off an edge. Labeled controls stay whole. Shapes that read when cut (a card, a slider track, a row of avatars) run off by a third or more.
|
|
12
|
+
6. **The stage masks everything** (`overflow: hidden`); one rounded corner per edge. Fades are for sliding tracks, stacks and charts, and for one crop: a window fading out at its foot.
|
|
13
|
+
7. **Satellites straddle the hero's edge, about half outside,** never fully inside or floating apart; fully outside, tie it back with a 1px leader ending in a dot.
|
|
14
|
+
8. **Distinct depth:** `--ss-shadow-satellite` on a satellite sitting on the hero, `--ss-shadow-ground` for a lone surface; a hairline on light edges; the shadow on the outlined shape, never a wrapper (`examples/story`).
|
|
15
|
+
9. **Start flat and frontal; earn a tilt** by comparing with the straight version at final size. Depth from shadow, z-order, scale and opacity; perspective only when asked.
|
|
16
|
+
10. **One gutter, measured in the final crop after any wrapper.** The gutter is the hero's inset from the stage edge (the layout table gives it per layout); every other edge distance in the frame matches it. The exception is a satellite straddling in the wider column; a phone counts as a satellite.
|
|
17
|
+
11. **A full gutter or well past, on every edge.** Crossing by under 24px or stopping a few pixels short is a mistake. Content near a container's bottom follows the same rule.
|
|
18
|
+
12. **A window keeps its device's shape:** whole, 1.25:1 or wider; bled, what shows is at least square. Fix by crop or layout, never by squashing.
|
|
19
|
+
13. **What the story opens stays in frame,** a gutter from every edge on every frame; place the trigger so the overlay has room.
|
|
20
|
+
14. **On a colored stage the hero is inset 8 to 20% from the sides** and runs off the bottom, so the ground frames it on three sides.
|
|
21
|
+
15. **No dead corners at rest or anywhere in the loop.** Fix crop or layout first; a satellite only with a role; a reserved column is filled from frame one.
|
|
22
|
+
16. **Anchored UI (popover, menu, toast) is not a satellite;** it sits where the product would put it.
|
|
23
|
+
17. **Two satellites are two kinds, not a stack.** A second satellite differs from the first in size and kind: a card and a small system object (a notification at its true size, a chip, a receipt), never two cards of one width on one edge, which read as a pile. A system banner sits where the system puts it, small, with the system's shadow, not a card's. Where the second object only points at something, use an annotation with a connector instead (`references/annotations.md`), as Stripe does; film flags `framing: twin satellites`.
|
|
24
|
+
18. **A satellite covers chrome, not content:** straddle where the window has a sidebar, header or margin (`examples/static-card`).
|
|
25
|
+
19. **Related surfaces get different jobs and weights;** the result sits in the hero's quiet margin, never hiding settings, trigger or payoff.
|
|
26
|
+
20. **A small illustration may need more air than the app itself.**
|
|
27
|
+
|
|
28
|
+
The layouts are recipes, not a requirement to crop every product; a whole window with even gutters is valid when its contents read and the brief asks.
|
|
29
|
+
|
|
30
|
+
## The layouts
|
|
31
|
+
|
|
32
|
+
| Layout | Hero | Satellite | Use for |
|
|
33
|
+
|---|---|---|---|
|
|
34
|
+
| **Pinned, bottom bleed** | Inset 8 to 12% left, right and top; 15 to 35% past the bottom; centered | Optional, straddling a side | Feature cards and bento tiles, their first composition (`examples/static-card`) |
|
|
35
|
+
| **Corner bleed** | Inset 10% top and left; 15 to 35% past right and bottom | Straddling the left or bottom edge | Heroes beside copy, their first composition (`examples/hero-demo`) |
|
|
36
|
+
| **Stage with gutters** | Inset 8 to 20% each side on a colored stage; off the bottom | Straddling one side, hero stays centered | Brand moments (`examples/raycast`) |
|
|
37
|
+
| **Satellite focus** | Cropped hard, mostly context | Large, 30 to 40% of hero width, straddling, carries the story | One small thing: a notification, a receipt, a diff (`examples/share`) |
|
|
38
|
+
| **Wide hero** | A 900 to 1100px window at 1:1, inset top, off the bottom and often both sides; realistic fidelity | A card or thread on its lower edge | Homepage heroes at full width (`examples/linear`) |
|
|
39
|
+
| **Row of windows** | Three or four at the same height, the outer ones off both sides | None | Agents, tabs or sessions side by side (`examples/window-row`) |
|
|
40
|
+
| **Device pair** | Desktop inset top and left, about 75 to 80% wide, off the bottom | Phone straddling the right edge, about a third outside, top in the upper half, present from frame one; `LockScreen stack="top"` if its bottom is cropped (`examples/device-pair`) | Cross-device stories |
|
|
41
|
+
| **Many of one** | A grid of one small thing at one size, off every edge | None; one tile in focus by depth (hero shadow, accent ring), the only one with words | Previews, deploys, templates, sessions: scale shown as repetition (`examples/many-of-one`) |
|
|
42
|
+
| **Fade crop** | A window inset top and sides, fading out over its last third | Optional | When a stage edge would cut the window at an arbitrary line (`examples/fade-crop`) |
|
|
43
|
+
| **Close-up** | The whole window scaled 1.3 to 1.6x, chrome and all, inset top and sides, off the bottom; the subject row whole across | None | A feature card about one control: a setting, a field, a button (`examples/close-up`) |
|
|
44
|
+
| **Panel over product** | The product inset top and left, off the bottom; its focal control whole | A settings panel straddling the product's right edge over its margin, never over the form; one leader, in neutral ink, from the panel's edge to the thing it changed, through empty ground | A setting and its effect: branding, theme, a toggle that changes the page (`examples/panel-annotation`) |
|
|
45
|
+
| **Overlapping windows** | A window inset top, off the bottom, its words clear of the stage edges | A smaller chromeless card in front whose edge lands on a structural line of the window (its sidebar edge), covering only filler | Two views of one event: the buyer's card over the merchant's dashboard (`examples/overlap`) |
|
|
46
|
+
| **Stacked cards** | Two components at one width and left edge, 12px apart, centered; the lower one off the bottom | None | A setting over the detail it drives: a plan over its usage (`examples/stacked-cards`) |
|
|
47
|
+
| **Opposite corners** | Copy bottom-left at the tile's inset; the product in a panel hung off the top-right corner, its words clear of the cut | None | Bento tiles with a line of copy (`examples/opposite-corners`) |
|
|
48
|
+
| **Tilted stack** | Three same-size cards in one cell, -6, 4 and -2 degrees, offset 12 to 20px; the straightest on top, the only one with words | None | Paper: receipts, tickets, cards gathered. The one place tilt earns its keep (`examples/tilted-stack`) |
|
|
49
|
+
| **Corner chip** | A window inset top-left, off the bottom | A small pill centered on the window's corner, half outside, over chrome only | One live fact about the whole product: people online, a status (`examples/corner-chip`) |
|
|
50
|
+
| **Monochrome row** | Three windows at one height, whole across, grayscale, faded at the foot by a mask | None | Customers or integrations, where their brand colors would fight (`examples/monochrome`) |
|
|
51
|
+
|
|
52
|
+
## Recipes
|
|
53
|
+
|
|
54
|
+
Position the hero with plain CSS inside the `Stage` render. Reserve a wider column so the satellite straddles the hero edge evenly: gutter plus half its width (`examples/static-card`).
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
<Stage width={656} height={340} initial={{}} className="my-well">
|
|
58
|
+
{() => (<>
|
|
59
|
+
<Window url="dashboard.northwind.co" className="hero" style={{ position: 'absolute', left: 129, top: 24, width: 720, height: 420 }} />
|
|
60
|
+
<div className="satellite" style={{ position: 'absolute', left: 24, top: 150, width: 210 }} />
|
|
61
|
+
</>)}
|
|
62
|
+
</Stage>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```css
|
|
66
|
+
.my-well .ss-stage { overflow: hidden; background: var(--ss-well); border-radius: 12px; }
|
|
67
|
+
.my-well .hero { box-shadow: var(--ss-shadow-hero); }
|
|
68
|
+
.my-well .satellite { box-shadow: var(--ss-shadow-satellite); border-radius: 10px; background: var(--ss-surface); }
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The shadow tokens in `kit/stage.css` (loaded by `kit/stageshow.css`), set by every theme:
|
|
72
|
+
|
|
73
|
+
- `--ss-shadow-hero`: the one shadow for a page's hero windows (`examples/gmail`).
|
|
74
|
+
- `--ss-shadow-window`: what `Window` draws by default; quieter, for a window that is not the hero.
|
|
75
|
+
- `--ss-shadow-satellite`: tighter on purpose, because it falls on a white window where a wide blur smears (`examples/payout-flow`).
|
|
76
|
+
- `--ss-shadow-ground`: a hairline and a long faint fall, for a small window or card on the ground (`examples/looks`).
|
|
77
|
+
- `--ss-shadow-float` for popovers, `-card` for small raised cards, `-lift` for a carried thing.
|
|
78
|
+
|
|
79
|
+
Fades are for moving or stacked content: a 32px edge mask on a track, or the last 25 to 30% of a stack or chart. Use `.ss-fade-b` and `.ss-fade-r`; their length is `--ss-fade` (64px by default, so set `--ss-fade: 32px` for a track).
|
|
80
|
+
|
|
81
|
+
A window can fade out instead of running off, at its foot only: the top and sides stay whole and hard-edged, the fade covers the last third and only filler is under it. Fade with a mask, never a color overlay, so the window dissolves into whatever it sits on. Never fade a side, never fade the focal content, never fade more than one window in a scene (`examples/fade-crop`).
|
|
82
|
+
|
|
83
|
+
## Small formats and the page
|
|
84
|
+
|
|
85
|
+
- **The page is the ground.** "White page" means a transparent stage: no plate (a backdrop or tinted field the window floats on) and no panel behind the device on a white or dark page. A hero's window bleeds or fills; whole and centered with air on four sides, it floats.
|
|
86
|
+
- **Unframed is the developer's call.** Asked for no framing, set `unframed` on the Stage and drop the ground: the window, card or phone sits whole, centered, with an even margin at least as deep as its shadow, so the shadow is never cut. Nothing bleeds, so nothing needs a crop rule; everything else in this file still holds, and so do restraint, story and motion. Never choose it on your own: a floating window is the fault this file exists to fix.
|
|
87
|
+
- **`compact` is a second design, not a squeeze.** Every demo that can sit in a phone column ships one at the column's width: 358 in a 390 viewport, switched on below the host width where the wide design stops fitting (`compact={{ below: 560, width: 358, height: 320 }}` for a wide scene; the height follows the design). Switch composition on `layout`: crop closer, drop or stack a satellite, keep action and payoff whole. A card that already fits at 358 needs none.
|
|
88
|
+
- **Small formats crop harder:** a 400px card holds a third of a dashboard at full size, not all of it at a third.
|
|
89
|
+
- **The stage is the shot.** The tile is cut to the stage's shape and the stage fills it edge to edge; never a stage boxed in another ground.
|
|
90
|
+
- **Size the design for the slot.** A lone card in a 680px column wants 500 to 560 wide, so its text reads at 15 to 20px.
|
|
91
|
+
- **A lone phone in a column of figures keeps the column's width,** centered at design size on the stage's own ground.
|
|
92
|
+
- **Moving a window keeps the bleed.** After any move or resize, recheck what the crop cuts and what overlaps, remove sliced placeholder actions, re-shoot the whole loop.
|
|
93
|
+
|
|
94
|
+
## Phones
|
|
95
|
+
|
|
96
|
+
- **A satellite phone starts at 40% of the window's visible width** and at least 220px wide; let it run off the bottom rather than shrink.
|
|
97
|
+
- **Notifications stay at true iOS proportion** (Live Activities excepted); a phone so small its notification needs enlarging is too small (`examples/phones`).
|
|
98
|
+
- **A phone cropped at the top loses its status bar and nav bar together.** The crop falls inside the content below the nav, never between the island and the nav.
|
|
99
|
+
- **In a 400px host a phone is cropped:** pinned a gutter from one edge, off the other, screen 1:1, stage a little taller than wide; never whole (`examples/phone-touch`).
|
|
100
|
+
- **A banner is native width and never cut.** A notification spans the screen minus 18pt each side, at the phone's own scale; nothing narrows it. A phone cropped at a side is composed so the banner shows whole (crop where no banner sits, or show the phone's full width) and film flags a cut banner as `cut by the crop`.
|
|
101
|
+
|
|
102
|
+
## Checks
|
|
103
|
+
|
|
104
|
+
`film.mjs` prints `framing:` and `cut by the crop:` on every shot; clear them on the still before motion work (`rehearse.md`, What to watch), or say why a line is deliberate. Boxes in flight are judged where they settle. Under a `Camera` the wide shot is judged as usual, moving frames skipped, and a settled zoom judged against the camera's own crop with its focus clear of the feather.
|
|
105
|
+
|
|
106
|
+
Is the hero's top-left visible? Is a bleed a deliberate crop, not a sliver? Does each satellite connect to its hero with clear depth? Is a faded window faded only at its foot, over filler, with a mask? Is the phone readable at the host's real width, and does a wide scene have its `compact` design (Small formats and the page, above)?
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# The kit, piece by piece
|
|
2
|
+
|
|
3
|
+
The reference for every part in `kit/`. SKILL.md has the map; read the entries for the parts a demo uses.
|
|
4
|
+
|
|
5
|
+
The kit is four tiers, and they are not equal:
|
|
6
|
+
|
|
7
|
+
- **The stage** (`stage.tsx`, `cursors.tsx`): the canvas, the script, the cursor, measuring and playback. Every demo is built on it.
|
|
8
|
+
- **Frames** (`window.tsx`, `phone.tsx`, `ios.tsx`, `messages.tsx`): windows, devices and system surfaces drawn from real geometry. Never draw these by hand: no hand-built window, phone, bubble, notification, status bar or home indicator.
|
|
9
|
+
- **Motion** (`motion/`): behaviors that have to hold up frame by frame. They bring motion, not a look; style what's inside them as the product does.
|
|
10
|
+
- **Small parts** (`parts/`, `controls/`, `code.tsx`, `chart.tsx`): quiet starting points. Restyle them to the product, or build the product's own when they don't match it.
|
|
11
|
+
|
|
12
|
+
## Specimen sheets
|
|
13
|
+
|
|
14
|
+
Catalogs of how each part behaves, one per tile, not compositions to copy. Use the scenes in SKILL.md for composition ideas, and look at any reference at the intended width before borrowing from it.
|
|
15
|
+
|
|
16
|
+
- `examples/controls/`: Field, Segmented, Toggle, Tabs, Code, Chart, a card dragged between columns with `Slot`, `Scroll`, a `Camera` push-in, and the `arrow` cursor with ripple clicks.
|
|
17
|
+
- `examples/glass/`: the glass theme on a window, a chip and a popover.
|
|
18
|
+
- `examples/brand-marks/`: the bundled payment and app artwork on light and dark surfaces; sources and licenses are in `kit/brands/SOURCES.md`.
|
|
19
|
+
- `examples/buttons/`: every Button variant and size, label and icon changes beside neighbors, a button in a narrow row.
|
|
20
|
+
- `examples/cards/`: Card padding and nested radius, a flush sectioned card, a sunken group, Divider in a card and a toolbar, Kbd in a field and a menu.
|
|
21
|
+
- `examples/kit-extras/`: Chip, Swap, Avatar rings, Meter tones, Menu hover, Expand, solid glyphs, BrandMark.
|
|
22
|
+
- `examples/parts/`: the newer parts (States, Check pending, Meter, Stream, Connector arrows, Popover and Menu, the satellite lock screen).
|
|
23
|
+
- `examples/looks/`: nine style studies: three invitation identities, then console, finance, canvas, conversation, research and a dimensional transfer receipt.
|
|
24
|
+
- `examples/chrome/` and `examples/phones/`: every window chrome and phone frame in the kit.
|
|
25
|
+
|
|
26
|
+
## The stage
|
|
27
|
+
|
|
28
|
+
### `Stage`
|
|
29
|
+
|
|
30
|
+
The canvas.
|
|
31
|
+
|
|
32
|
+
- **Size.** Design size and scale-to-fit. `compact`: a second design for narrow containers (the composition rule is in `framing.md`, Small formats and the page). A host wrapper marked `data-ss-wide` scales the wide design only for a slot sized by height, never for an ordinary tile, which draws 1:1.
|
|
33
|
+
- **Scene state** (`initial`), changed by the script's `Act` (below).
|
|
34
|
+
- **Children** are `(state, rect, layout) => JSX`. `rect(name)` measures any `data-target`, re-measured after transitions settle. `layout` is `'wide'` or `'compact'`: read it here, not with `useLook()`.
|
|
35
|
+
- **Playback.** `play`: `loop`, `once`, `hover`. Hover settles back with a glide when the pointer leaves. The stage stops and resets unfinished playback offscreen, restarts it on reentry, and preserves a completed once scene. Under reduced motion it shows `poster`.
|
|
36
|
+
- **The look.** `theme`, `palette`, `fidelity`; `tokens={{ ... }}` for one stage (see Look tokens); `accent`; `greys="cool"` swaps the warm canvas and well for cool ones, for macOS or a blue ground (light theme only).
|
|
37
|
+
- **`ground`**: what the scene sits on. `orbs` is a pale tile lit by a few soft color orbs, so glass has color to take; pass two or three colors to choose them. Leave it out for the plain ground.
|
|
38
|
+
- **`fill`**: grows past the design size to fill the container, up to 2×, for a hero or a docs plate; a host wrapper marked `data-ss-fill` does the same. `speed` plays the script faster (above 1) or slower.
|
|
39
|
+
- **`keys`**: where keycaps show: `bottom` (the default), `top`, `bottom-left` or `bottom-right`. Keep them clear of anything open, a menu reaching the bottom of a short stage included; film flags an overlap. Takes `{ wide, compact }` too.
|
|
40
|
+
- **`hover`**: targets for stills.
|
|
41
|
+
- **`specimen`** marks a sheet of parts (the kit's chrome, controls, phones sheets): film's composition checks (framing, voids, ladders, insets) stand down.
|
|
42
|
+
- **`unframed`**: for a developer who asks for no framing (`framing.md`, Small formats and the page). Leave out `ground` and keep the product whole with room for its shadow; film's bleed and floating checks stand down.
|
|
43
|
+
- **The cursor**: see below.
|
|
44
|
+
|
|
45
|
+
### `Act`
|
|
46
|
+
|
|
47
|
+
What a script gets.
|
|
48
|
+
|
|
49
|
+
- **Scene:** `set`, `put`, `snap(patch, scope?)` (no transitions, stage-wide or in one target), `wait`.
|
|
50
|
+
- **Pointer:** `move(to, { duration, path, onMove })` (`path` as drag's; `onMove(at, from, t)` gets each point, for a scrubbed readout), `click` (`{ double: true }`; `{ right: true }` for a context menu), `cursor`, `center`, `place` (at once, with no travel: only behind a cut), `enter(to)` (arrives from past the nearest frame edge, already moving).
|
|
51
|
+
- **`drag`**: dips, closes the open hand into `grab` at the bottom of the press and opens on release; over text or a canvas it selects and keeps its kind. `duration` sets its length. `{ cursor: 'preserve' }` retains the current kind through a product-specific drag such as arrow-based event creation or a resize edge. `{ path: (progress, from, to) => point }` supplies a constrained path in stage coordinates, with eased 0 to 1 progress and endpoints matching the current cursor and target.
|
|
52
|
+
- **Keys and text:** `type` (35ms per character by default); `key` (shows keycaps, resolves as the key comes up so the app can react).
|
|
53
|
+
- **Timing:** `stagger(items, fn, gap = 60)`; `mark(name)` for filming a beat. Start a move without awaiting it to run it alongside other beats.
|
|
54
|
+
- **Measuring:** `rect(name, { layout })`; `caret(name, at)` (the character a text selection reaches with the pointer at `at`; call it in a drag's `onMove` so the highlight tracks the I-beam).
|
|
55
|
+
- **Moves** travel in a shallow arc, timed by distance. Hovered targets and every target around them get `data-hover`; pressed get `data-pressed`. Targets can aim inside an element: `{ at: 'apply', x: 0.8, y: 0.6 }`.
|
|
56
|
+
|
|
57
|
+
### The cursor
|
|
58
|
+
|
|
59
|
+
`cursor={{ at, kind, style }}`; `at` can be `{ wide, compact }` when the compact design needs a different rest point.
|
|
60
|
+
|
|
61
|
+
- **Styles:** `real` (macOS cursors), `large` (1.5×), `circle` (the iPad's glass pointer), `touch` (a finger on a phone: a dot only where it taps or drags, nothing between), `arrow` (a solid rounded arrowhead, as illustrated demos draw it; an I-beam only over text). Never the macOS arrow on a phone.
|
|
62
|
+
- **Kinds** come from `data-cursor` on elements (`pointer`, `ibeam`, `crosshair`, `hand`, `open`, `grab`, `wait`, `resize-ns`, `resize-ew`, `resize-nwse`, `resize-nesw`), switching as the cursor crosses their edge.
|
|
63
|
+
- **`ripple: true`** sends a soft ring out from each click, for small stages or when clicks must read at a glance.
|
|
64
|
+
- **`idle`** (ms, 4000 by default, `false` to keep it on) fades a cursor that has rested that long after acting; `still: true` keeps it in the reduced-motion poster.
|
|
65
|
+
- Leave it out of stills unless pointing is the story.
|
|
66
|
+
|
|
67
|
+
### Timing
|
|
68
|
+
|
|
69
|
+
- **`EASE`** holds the kit's named curves as bezier arrays: `house` (moves inside a shot), `through` (into a cut), `settle` (out of a cut), `enter` (a cursor arriving already moving), `trip` (one long cursor trip), `camera` (the push-in). `easeCss('settle')` writes one as a CSS `cubic-bezier()`; `bezier('house')` turns one into a function of time 0 to 1, for motion you drive by hand.
|
|
70
|
+
- **`clock.now()`** is the stage's time. It is `performance.now()` in a live page and the stepped time when the playground pauses, steps or records, so time anything a script measures with it, never `Date.now()`.
|
|
71
|
+
|
|
72
|
+
## Frames
|
|
73
|
+
|
|
74
|
+
### `Window`
|
|
75
|
+
|
|
76
|
+
Chrome, chosen by props. See `examples/chrome/`.
|
|
77
|
+
|
|
78
|
+
- **Browser:** `url`, plus `nav` (back and forward), `tabs` and `urlShape="pill"`.
|
|
79
|
+
- **App:** `title`, centered in a plain bar. With a `toolbar` it moves left, 14px after the lights, as a unified toolbar; `lead` (the left toolbar slot) follows it and the toolbar sits on the right. `body` takes props for the content column.
|
|
80
|
+
- **Sidebar app:** `sidebar` runs full height and holds the traffic lights, the way Mail, Notes, Linear and Slack look. `sidebarWidth` sets its width (180 by default). Beside a `sidebar`, the title is the content column's heading at the column's 16px inset: pad the content 16px too, so the heading and the first row line up.
|
|
81
|
+
- **Grounds:** a plain or browser window's body is the canvas (a quiet gray); a sidebar window's content column is the surface (white, the sidebar on canvas). For a white page in a plain window, give its content `background: var(--ss-surface)`; keep one window's content one color.
|
|
82
|
+
- **The lights** sit in the same spot in every kind, as far from the left edge as their center is from the top, in every combination. `lights`: `color`, `grey` (glass's default) or `white` (glass, card or hairline over a strong color).
|
|
83
|
+
- **`chrome="glass"`**: a frosted browser for a colorful ground.
|
|
84
|
+
- **`chrome="terminal"`**: a dark terminal, one surface, `title` dim and centered (`northwind — zsh`). Fill it with `<Prompt path="~/app">command</Prompt>` lines, plain divs for output (classes `ok`, `err`, `dim` for status color, sparingly) and a `<Caret />` on the last prompt. Never hand-style a light window as a terminal. Its colors are tokens: `--ss-term-path`, `--ss-term-sigil`, `--ss-term-ok`, `--ss-term-err`, `--ss-term-dim` (and `--ss-term-bg`); set them on the window or the stage to match an accent.
|
|
85
|
+
- **`chrome="card"`**: one white card, pale dots, a wide pale address bar and a long soft shadow (a payments site's checkout browser).
|
|
86
|
+
- **`chrome="hairline"`**: a small quiet frame over a 1px rule with the address as bare text, for a window that is a detail, not the subject.
|
|
87
|
+
- **`receded`** fades it to 40% when something comes forward.
|
|
88
|
+
- **macOS 26 (Tahoe), each opt-in:** `sidebarStyle="floating"` (the sidebar as a rounded panel inset 8px, on a 24-radius window), `lightsSize="large"` (12px lights, 8px apart), `barSize="tall"` (a 64px icon-and-label toolbar: no fill or rule, 32px controls at the top with labels under them, lights and title level with them).
|
|
89
|
+
- **Several kinds passed:** a `chrome` other than the native one wins over everything (terminal, glass, card and hairline ignore `sidebar`, `tabs`, `nav` and `lead`); otherwise `sidebar` wins, then `tabs`; a `url` beside a `sidebar` puts the address in the content column's bar.
|
|
90
|
+
|
|
91
|
+
### `Phone`, `LockScreen`, `Notification`
|
|
92
|
+
|
|
93
|
+
A phone from real geometry at any `width`, its screen laid out in true points. The framing and sizing rules are in `framing.md`, Phones.
|
|
94
|
+
|
|
95
|
+
- **`frame`:** `photo` (optional caller-owned bezel through `--ss-phone-photo-light` / `--ss-phone-photo-dark`; no photograph ships; falls back to `pro` without one), `pro`, `silver`, `bezel`, `android`, `soft` (the pale, even-banded marketing-page phone, no island), `clay`, `outline`, `bare`.
|
|
96
|
+
- **Screen:** `wallpaper` (the screen is white by default, black with `dark`), `island`, `status`. `WALLPAPER` is the default lock screen ground, a soft blue to lilac gradient after the iPhone's own; pass it as the Phone's `wallpaper` with `dark`.
|
|
97
|
+
- **Size it for its text:** draw a phone that shows app text at 340 wide or more (about 0.85 of true size), and let it run off the stage rather than shrink it to fit. A bar on the screen sizes to its content with real padding under its last line, never a fixed height its text can overrun.
|
|
98
|
+
- **`LockScreen`** stacks notifications at the bottom as iOS does (iOS 16 and later). `size="satellite"` for a phone beside a window (no controls, notifications under the clock); `clock={false}` drops the date and clock. `stack="top"` puts notifications under the clock, for a phone the stage's bottom edge crops.
|
|
99
|
+
- **`Notification`:** always true iOS size (only Live Activities differ) and, as a banner, native width (the screen minus 18pt each side); the phone is sized and cropped around it, never the other way (`framing.md`, Phones). Bodies wrap to three lines. On an unlocked phone (in an app, on the home screen) pass `banner` and it drops in at the top under the island, over the app.
|
|
100
|
+
|
|
101
|
+
### `Thread`, `Bubble`, `Stamp`, `Receipt`, `Keyboard`
|
|
102
|
+
|
|
103
|
+
Messages, from the kit only.
|
|
104
|
+
|
|
105
|
+
- **`Thread`** pins a conversation to its bottom, glides older messages up when one arrives and puts tails on the last bubble of each run. `app` is `imessage` (true iOS bubbles), `sms` or `chat` (AI apps: a quiet bubble for the person, plain text for the reply, pair it with `Stream`).
|
|
106
|
+
- **`Bubble from="me" | "them"`** rises in from its tail corner. `avatar` puts a small `Avatar` beside a received bubble for a group chat. With `source` (the composer text's selector or target) it forms out of the input as iMessage sends: clear the field in the same update. With `typing` it holds the dots and grows into the message when typing ends, one object, never a swap. `tapback={{ emoji, show }}` adds a reaction (its motion is in `motion.md`, Phones in motion).
|
|
107
|
+
- **`Receipt`** rolls Delivered to Read and folds away with `show={false}`; keep it mounted.
|
|
108
|
+
- **`Keyboard`**: the iOS 27 keyboard at true points, full width under the composer. Pass `typed` and it pops each key and follows auto-capitals; `shift` forces shift on or off, `pressed` holds one key down (a letter, or `shift`, `delete`, `return`, `space`, `123`); `suggestions`, `dark`. Leave it out by default: most message demos read better without it. Show it only when typing is the story.
|
|
109
|
+
|
|
110
|
+
## Motion parts
|
|
111
|
+
|
|
112
|
+
### `Collapse`, `Fly`, `Toast`, `Spinner`
|
|
113
|
+
|
|
114
|
+
- **`Collapse`**: a height that opens and closes so what follows moves with it. `reveal="drop"` for a card or message, which arrives whole instead of being uncovered by the edge; `from="below"` for a chat message landing at the foot of a feed; `solid` for a surface unlike the ground (a dark log panel on a light window), which would otherwise fade through gray. On close the content dims then dissolves across the whole of the height's travel, never an empty box.
|
|
115
|
+
- **`Fly`**: an element carried along a soft arc from the source element's own `rect()` to the landing element's own `rect()`, never a slot or wrapper around it (a slot's rect makes it snap size on landing). `.ss-fly[data-go]` styles it in flight, to settle into its resting look before it lands. It is hidden until `go`, so it never doubles what it leaves, unless `held` shows it waiting at `from` (the thing being carried, or a chip budding off a value).
|
|
116
|
+
- **The handoff:** hide the source in the set that turns `go` on; when it lands, show the real element and hide the flyer in one set (unmount it), then `snap({ go: false })` while it is hidden, ready for the next loop.
|
|
117
|
+
- **The value-chip recipe:** `from` is the value's own text rect; the chip's child is drawn transparent, its words exactly over the value's (same size and weight, green, with the + in the padding to its left), and the value fades under it. With `held` it buds in where it sits, then on `go` its surface fades in during the flight (a keyframe on `.ss-fly[data-go]`), and the check or the rolling total comes only after it leaves.
|
|
118
|
+
- **`Toast`**: a confirmation that rises in (`--ss-toast-rise` sets how far).
|
|
119
|
+
- **`Spinner`**: a pending arc.
|
|
120
|
+
|
|
121
|
+
## Parts
|
|
122
|
+
|
|
123
|
+
| Piece | Use it for |
|
|
124
|
+
|---|---|
|
|
125
|
+
| `Row` | One row of a list: `lead` (an `Avatar`, a tile), `title`, `subtitle`, `meta` (a time, a count), `preview` (placeholder lines under the subtitle, as bar widths), `unread` (a dot hanging in the margin left of the lead, so the row never moves; give the list a few px of padding for it. A product that reserves a dot column on every row, as Mail and Messages do, pads the whole list instead, and Gmail puts the dot by the time; follow the product, never pad only the unread rows), `selected`, `pad`. The anatomy is fixed: lead and dot centered on the title and subtitle, title 4 to 6px above its subtitle; children (a `Toggle`, a chevron, a badge) trail at the end of the title line, and extra preview lines go inside `subtitle`. A title with no subtitle is a one-line row: the title plus the row's padding, no second line reserved. A `Bar` in any slot keeps the line's pitch. Inside a `Phone` it takes iOS sizes (17pt name, 15pt lines, 10pt dot) on its own; never restyle its `.ss-row__*` parts. |
|
|
126
|
+
| `Pin` | A comment pin: one rounded square with a single square corner (`corner`: `bl`, `br`, `tl`, `tr`), face and rim the same shape, an initial or `src`, `tone` accent or ink, `selected` for the open one. Place its square corner on the thing the comment is about. Never a disc with a corner stuck on. |
|
|
127
|
+
| `Avatar`, `Check`, `Icon` | Initials avatars (`Facepile` overlaps several, each cut out of the next: `names`, `size`, `overlap`; `plain`, or no `name`, for a plain disc in any fidelity: filler assignees and faces behind the one that matters; a named avatar takes a muted opaque color of its own by default (`tone="person"`), as Mail and Messages draw monograms; `tone="ink"` for a gray disc, `accent` for the person the story is about, `success` for a green disc, `ios` for the gray-blue gradient monogram with two initials that Contacts, Mail and Messages draw for a contact with no photo); a status check (`pending` turns an arc in the ring, `on` grows a solid disc and draws the tick: one mark from pending to done, never a spinner stacked over a check); a few line icons (including a card's `chip` and `contactless` arcs) and `Icon filled` system glyphs. Beyond these, the product's real icon pack or a set chosen on purpose, in one opaque color (`craft.md`, Icons and logos). Avatar `ring` marks a person's status, eased between states: `pending` (a quiet ring), `waiting` (the quiet ring with an accent arc going round: asked, not yet answered), `confirmed`, `declined`. |
|
|
128
|
+
| `Connector`, `Count`, `Roll`, `Meter` | Story pieces: a line that draws between two points and ends on a dot; a number whose changed digits roll from the old figure to the new one, last digit first (`duration`, `stagger`; it jumps inside a snap or offscreen); text that animates only the changed part; a usage bar that fills (`Meter tone` for its color). `Count` uses tabular digits but reserves no width for extra digits or punctuation: give it a stable slot when its neighbors must stay still. A unit the format writes after the figure (21°, 240ms, 12 min) sits in its own box, `.ss-count__unit`, a hair from the digits or a word space when the format has one; `--ss-count-unit-gap` widens the hair, and the class is where a smaller degree sign is styled. `Roll` measures and eases the changed span's width and moves what follows with it; `variant="fade"` for control labels. `delay` holds the old text before it rolls, so a total can change a beat after the edit that feeds it. When the whole control should keep its largest footprint, use `States` instead. |
|
|
129
|
+
| `Connector` extras | Endpoint dots default to a 3px radius, an accent fill (the line and dot both use `--ss-accent`), a 2px white rim and a subtle shadow: a starting treatment, so restyle them, or drop them with `dots="none"` (`both` puts one at each end), when something else explains the relationship better. `arrow` for direction (a request out, a response back), `label` for a word on the line ("POST", "200 OK") or a number for a step marker, `labelAt` (0 to 1 from `from`). Labels arrive after the line draws. `route="step"` (across, then down or up halfway, then across again) for several lines into one target: they merge into one level run before it. With `h` they would arrive from above and below and knot at its edge. Leave room between the columns, about 80px, so the bends and the merge don't crowd the target. `route="curve"` is the same level-out, level-in path as one soft S, for a looser diagram; labels and arrows follow the curve. |
|
|
130
|
+
| `States`, `Stream`, `Popover`, `Menu` | `States`: a control's states (label, spinner, done) stacked in one place and crossfaded, the box holding the largest (for an icon and label in a full-width button, stack each state's whole group in one cell and crossfade, so nothing slides sideways (`examples/form-error`); `Swap` is for a label whose box must resize in a line of text); `align` sets the alignment; each state keeps the line box a plain label would have, so a `Roll` or `Count` inside one shows whole, and a small line under a name sets its own line-height. `Stream`: text written word by word with every word already in its final place (no reflow), `mark` for changed words that join into runs. `Popover`: a floating surface that scales a touch from `origin` (a `PopoverOrigin`: `'top left'` by default, or a side such as `'bottom'` or `'right center'`), the side nearest its trigger, while its contents fade, never resizing as it opens; restyle it with `--ss-popover-bg` and `--ss-popover-shadow`, not `background` and `box-shadow`. It has 4px of padding by default (set your own on its class). Closing, it freezes its children and position as they were open until it has faded, so a reset never shows; the flip side is that a change made in the same set as `show: false` won't show either. To change what is inside before it closes (a row ticked, then the menu goes), make the change in one set, then close it in the next. `Menu`: its rows with a `value` highlight (the row's index), fixed `--ss-row` height; `targets` makes items highlight under the cursor. A filtering palette (rows that leave as you type) is not a Menu: build the list as rows in a `Collapse` each (`open` while it matches), so the rows below close up, and keep the highlight on the first match. |
|
|
131
|
+
| `Field`, `Segmented`, `Toggle`, `Tabs`, `Badge` | Form controls with their motion done: a text field (label, focus ring that never moves the text, placeholder that leaves on the first character, a caret solid while typing and blinking at rest, `password`, `status` valid or error, `chip` to commit the typed text as a filter chip where it was typed, with `remove` for its ×; put `data-target` on `box`), a segmented control and tabs whose highlight slides (`items`, `value` as the selected index, `targets` to name each item for the cursor), a switch, a status pill (`tone` neutral, accent, success, danger or warning; `dot`, or `icon` for a glyph beside the label, like a tick on Matched). Use these rather than building inputs by hand. |
|
|
132
|
+
| `Button` | A push button: `variant` primary, secondary (default), tertiary, ghost or danger; `size` small 24px, medium 28px (default) or large 32px; `icon` before the label, `trailingIcon` after it. Its padding never squeezes in a row (`flex: none`), the side with a glyph pads a little tighter, and the label centers on its letters. A text label that changes (Resolve to Resolved) crossfades and eases the width, so neighbors move with it; an `icon` added later grows its slot open. The cursor's click presses it. Put `data-target` on it. Never hand-build a button. |
|
|
133
|
+
| `Draft` | A comment being written that becomes the posted comment in place: `value` (the typed words, from `act.type`), `full` (the finished text, whose height it holds so the card never grows a line mid-typing), `editing`, `placeholder`. Put it in the comment's column (under the name); while editing, the box's edges sit on that column and the words are padded inside; on post the ring fades and the padding eases away. Restyle with `--ss-draft-ring`, `--ss-draft-radius`, `--ss-draft-pad-y`, `--ss-draft-pad-x`. Never hand-build a comment box. |
|
|
134
|
+
| `Card`, `Divider`, `Kbd` | `Card`: a surface whose padding is one value on every side (`pad` small 12, medium 16, large 20), children spaced by `gap` rather than margins, `tone` surface or sunken (a gray group inside a surface), `lift` for a soft shadow over the ground, `flush` for a sectioned card (each direct child padded by `pad`, a full-width hairline between them: a thread with its header and footer, a list of files, a settings group); a rounded box inside takes `border-radius: var(--ss-card-inner)` so the curves stay parallel. Build comment, receipt and settings cards from it. `Divider`: a hairline, `vertical` between toolbar buttons, `inset` in px. `Kbd`: a shortcut, `keys={['⌘', 'K']}` as keycaps, `plain` for flat gray text beside a menu item. |
|
|
135
|
+
| `Code`, `Chart` | `Code`: real code lines with numbers, quiet syntax color and diff lines (`{ text, kind: 'add' \| 'del' }`); `count` streams lines in without reflow; long lines fade at the edge. `Chart`: a smooth line with a soft area and an end dot, or `kind="bars"`; it draws in on `show` and eases between datasets when `data` changes. `chartPoints(props)` gives where it draws each point (a bar's top center) from the same props, for a tooltip, marker or hairline on a point: never repeat the chart's maths. |
|
|
136
|
+
| `Slot` | A gap in a list that opens and closes (`open`, `height`, `gap`), for moving a card between lists or columns (the dashed mark is drawn at the slot's full height and only fades; never animate a dashed border's size): the source's slot closes as the card lifts, the destination's opens (`dashed`) as it travels, and the card lands in it. Aim the drop at where the card will sit once the slot is open (measure the column, not the opening slot). Columns must be fixed widths (`minmax(0, 1fr)`) or they shift as the card changes column. |
|
|
137
|
+
| `Scroll` | A scrolling area: `<Scroll name="list">` and `a.scroll('list', 'row-5')` (or a px offset). The cursor moves over the area first and holds still while the content moves; macOS's overlay scrollbar shows while it scrolls and fades after (`bar="always"` keeps it, `bar="none"` hides it); edges soften only once scrolled. Scrolling craft is in `motion.md`. |
|
|
138
|
+
| `Camera` | Pushes in on part of the scene and back out: wrap the scene, set `focus` to `a.rect(name, { layout: true })` or null. The view feathers its edges while zoomed. When and how to push in is in `motion.md`, Scrolling and the camera. |
|
|
139
|
+
| `Follow`, `cellOf` | `Follow` springs an overlay onto a rect and keeps momentum when retargeted (selection rings, highlights). `cellOf` gives sticky cell borders for drags (`motion.md`, Drags and selection). |
|
|
140
|
+
| `Tooltip` | A small dark label centered under (or over, `side="above"`) a target rect, `gap` from it, fading in with `show`. Pass `at={rect('archive')}`; restyle its corner and color to the product's. |
|
|
141
|
+
| `Chip`, `Swap`, `Expand` | `Chip`: a filter chip with a remove x (`remove` names it for the cursor) that opens and closes its own width, `gap` the row's gap. `Swap id={step}`: replaced text, keyed on what changed, that crossfades while its box eases to the new size, so lines around it move instead of snapping. `Expand`: the iOS card-to-screen open as one element, clipped from `from` (a measured rect); with `face` (what the tapped thing looked like, a notification or an icon) it's an app launch: the window takes the app's surface (`--ss-expand-bg`) as it grows, the face fades early and the app's content fades in with the growth. Works inside a Phone: closed, it still draws its face at `from`, so keep it in a layer hidden until the launch. Put that layer at z-index 1, under the status bar and island, and set the Phone's `dark` to false as the app covers the top, so the status bar reads over it. |
|
|
142
|
+
| `BrandMark` | A real product mark from the local registry via `brand` (Visa, Mastercard, PayPal, Notion, Gmail and other common integrations), or a custom `name` and `src`. `size` sets the height, wide payment marks keep a wider footprint, `tile={false}` removes the tile, and `surface` overrides the automatic light or dark artwork. See `brands.md` and `examples/brand-marks/`. |
|
|
143
|
+
| `Bar`, `Text` | A placeholder line (`tone` 1 to 5). A line (numeric `w` over three times `h`) gives way in a row too narrow for it and never runs past its container; where it fits it is exactly `w`. An icon slot or dot keeps its size; `shrink` overrides either way. `Text` is real text, one line unless you pass `wrap`, that becomes a placeholder line in minimal fidelity (its width estimated from the text and a numeric `style.fontSize`; set `w` to be exact). `Text filler` is the other way round: words that show only at realistic fidelity and are a bar at standard and minimal, so filler rows are written once and the stage's fidelity decides. |
|
|
144
|
+
| `inset`, `box`, `between`, `contains` | Rect helpers for placing overlays from measured targets. A `Rect` is `{ x, y, width, height }`, including values from `rect()`; use `width` and `height`, not `w` and `h`. |
|
|
145
|
+
| Look tokens | Shape (`--ss-radius-sm`, `-md`, `-lg`, `-window`, `-pill`) and density (`--ss-control`, `--ss-row`) beside the color and type tokens; every rounded part reads them. Set a look with a class over `.ss-stage` or `Stage tokens={{ ... }}`. See `references/looks.md`. |
|
|
146
|
+
| `stageshow.css` | Every style at once (each component also imports its own). All kit CSS is in `@layer stageshow`, so a demo's own unlayered CSS always wins: restyle a part with a plain class, never `!important`. A few unlayered guards keep host CSS out of a stage: host element rules roll back to browser defaults, and a universal reset (Tailwind preflight) is handed back to the kit. A host rule with a class (`.article p`) still reaches in; exclude stages with `:not(:where(.ss-stage *))`. Tokens (five inks, surfaces, lines, text, one accent plus `--ss-accent-2` for gradients, status colors with `-soft` fills and `-text` shades, the well, `--ss-raised`, window, hero, satellite, ground and lift shadows; `Stage greys="cool"` swaps the warm canvas and well for cool ones), the looks, edge fades (`.ss-fade-b`, `-r`, `-br` with `--ss-fade`), the cursor, chrome, phones and keycaps. |
|
|
147
|
+
|
|
148
|
+
## Layout and CSS scope
|
|
149
|
+
|
|
150
|
+
In render code use the third `layout` argument; in a script use `a.layout`.
|
|
151
|
+
Both are `'wide'` or `'compact'`. Do not infer layout from a child element's
|
|
152
|
+
measured width: that element can be narrow in either composition.
|
|
153
|
+
|
|
154
|
+
`<Stage className="demo">` puts the class on the outer `.ss-fit` wrapper.
|
|
155
|
+
The inner `.ss-stage` owns `data-layout` and the design dimensions:
|
|
156
|
+
|
|
157
|
+
```css
|
|
158
|
+
.demo .ss-stage { background: #f5f5f5; }
|
|
159
|
+
.demo .ss-stage[data-layout="compact"] .card { width: 300px; }
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`.demo[data-layout="compact"]` matches nothing. Scope the scene's other
|
|
163
|
+
selectors under `.demo` too. Measure the host width before choosing the
|
|
164
|
+
compact design size; the example dimensions are not defaults.
|
|
165
|
+
|
|
166
|
+
## Explicit replay
|
|
167
|
+
|
|
168
|
+
`Stage` has no imperative replay handle. Put a real, accessible Replay button
|
|
169
|
+
in the host and remount the demo at that story boundary:
|
|
170
|
+
|
|
171
|
+
```tsx
|
|
172
|
+
const [run, setRun] = useState(0)
|
|
173
|
+
return <>
|
|
174
|
+
<button onClick={() => setRun(n => n + 1)}>Replay</button>
|
|
175
|
+
<InviteDemo key={run} />
|
|
176
|
+
</>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
The click explains the return to the starting picture. Keep the wrapper's size
|
|
180
|
+
fixed; for a soft restart, hide the scene before changing the key and reveal
|
|
181
|
+
the fresh one after. A keyed replay is deliberate: never use changing keys for
|
|
182
|
+
ordinary state changes, text changes or variant switches, which should keep
|
|
183
|
+
the moving object's identity. Set `play="once"` for a scene that waits for
|
|
184
|
+
Replay after its payoff, with a meaningful `poster` so reduced motion shows
|
|
185
|
+
the same complete still.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Looks
|
|
2
|
+
|
|
3
|
+
A look is a set of design tokens: color, type, shape and density. The kit's parts read them, so one look restyles every window, field, menu and badge at once while the motion, framing and craft rules stay the same. Use the product's own look whenever there is one: a demo in the product's real colors, radii and type reads as the product, not as a generic mock.
|
|
4
|
+
|
|
5
|
+
## The built-in looks
|
|
6
|
+
|
|
7
|
+
`Stage` takes `theme` (`light`, `dark`, `blueprint`, `glass`), `palette` (`accent`, `mono`) and `fidelity`. They are the starting point. A custom look sits on top of one of them, usually `light` or `dark`.
|
|
8
|
+
|
|
9
|
+
## The tokens
|
|
10
|
+
|
|
11
|
+
| Group | Tokens | Default |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Surfaces | `--ss-canvas`, `--ss-surface`, `--ss-chrome`, `--ss-well`, `--ss-raised` | warm grays, white |
|
|
14
|
+
| Lines | `--ss-line`, `--ss-line-faint` | translucent black |
|
|
15
|
+
| Text | `--ss-text-strong`, `--ss-text`, `--ss-text-faint` | three grays |
|
|
16
|
+
| Icons | `--ss-icon`, `--ss-icon-faint` | opaque grays |
|
|
17
|
+
| Accent | `--ss-accent`, `--ss-accent-2`, `--ss-accent-soft`, `--ss-accent-text` | blue |
|
|
18
|
+
| Status | `--ss-success`, `--ss-danger`, `--ss-warning`, each with `-soft` and `-text` | green, red, amber |
|
|
19
|
+
| Type | `--ss-font`, `--ss-mono` | the system stacks |
|
|
20
|
+
| Shape | `--ss-radius-sm` (6), `--ss-radius-md` (8), `--ss-radius-lg` (10), `--ss-radius-window` (12), `--ss-radius-pill` (999) | px |
|
|
21
|
+
| Density | `--ss-control` (34, a text field), `--ss-row` (26, a menu row or segment) | px |
|
|
22
|
+
| Shadows | `--ss-shadow-hero`, `-satellite`, `-ground`, `-window`, `-float`, `-lift`, `-card` | see `framing.md` |
|
|
23
|
+
|
|
24
|
+
The placeholder inks (`--ss-ink-1` to `-5`) are the kit's, not the product's. Leave them unless the product's grays are a different temperature; then pick `Stage greys="cool"` or set the inks from the same gray family.
|
|
25
|
+
|
|
26
|
+
## Defining a look
|
|
27
|
+
|
|
28
|
+
As a stylesheet, which can also carry a dark variant:
|
|
29
|
+
|
|
30
|
+
```css
|
|
31
|
+
.look-acme .ss-stage {
|
|
32
|
+
--ss-accent: #5b5bd6;
|
|
33
|
+
--ss-font: "Inter", system-ui, sans-serif;
|
|
34
|
+
--ss-radius-md: 6px;
|
|
35
|
+
--ss-control: 32px;
|
|
36
|
+
}
|
|
37
|
+
.look-acme .ss-stage[data-theme="dark"] { --ss-surface: #18181b; }
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
<Stage className="look-acme" theme="light" ...>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or as values, for one stage: `<Stage tokens={{ '--ss-accent': '#5b5bd6', '--ss-radius-md': '6px' }}>`. Keep a product's look in one file next to its demos and use it on every stage of that product. `examples/looks/` has nine studies. Three invitation variants isolate token choices, including Radix Themes' public tokens (`radix.css`). `studies.tsx` adds a dark console, a financial overview, a creative canvas, a conversation and a research notebook, which change product anatomy, density and hierarchy as well as color. `skeuomorphic.tsx` adds a dimensional transfer receipt: layered paper, a translucent raised frame, coherent lighting and precise edge shadows. Skeuomorphic can mean restrained material depth in software UI, not an imitation appliance; keep the information clear and the physical cues behind it. These are examples, not a closed set: the brief may call for a language none of them use. Borrow the decisions, not an unrelated product's layout. For backgrounds and whole-grid relationships, read `backgrounds.md` and `bento.md`.
|
|
45
|
+
|
|
46
|
+
## From a codebase
|
|
47
|
+
|
|
48
|
+
When the product's code is at hand, its look is already written down. Read it before building anything:
|
|
49
|
+
|
|
50
|
+
1. **Find the tokens.** CSS custom properties (`:root { --color-primary ... }`), a Tailwind config (`theme.extend.colors`, `borderRadius`, `fontFamily`), theme files (`theme.ts`, a tokens JSON), or a component library's provider. Failing that, read the computed styles of the real components: a button, an input, a menu, a card.
|
|
51
|
+
2. **Map them.** The primary color to `--ss-accent`; the page and card backgrounds to `--ss-canvas` and `--ss-surface`; the text scale to the three text tokens; borders to `--ss-line`; the font stack to `--ss-font`; the radius scale to the shape tokens (the product's button or input radius to `-md`, its menu item to `-sm`, its popover or card to `-lg`); its input height to `--ss-control`, its menu row to `--ss-row`.
|
|
52
|
+
3. **Write the look file** and use it by default for every stage of that product.
|
|
53
|
+
|
|
54
|
+
Follow what the developer asks for. By default the demo is its own code, styled to match: the kit's small parts restyled with the product's tokens. When they ask for the demo to use their own components (their buttons, rows, avatars, design system), import those inside the stage instead of the kit's small parts. The stage, frames, cursor and motion parts still do their jobs around them: mark what the cursor touches with `data-target` and measure it with `rect()` as usual. Real components bring real density, so the restraint rules still apply: words where they carry meaning, quiet filler elsewhere. If a component fetches data or needs app context, give it fixed props or a small wrapper; a demo never calls a live service.
|
|
55
|
+
|
|
56
|
+
## From a public site
|
|
57
|
+
|
|
58
|
+
When the product is someone else's, approximate it from its public site: open it, read the computed styles of a button, an input, a menu and a card, and map them the same way. Take the values, not the assets: no unlicensed fonts or images. Use the kit's local brand marks where they fit (`brands.md`), or the project's own artwork under its terms.
|
|
59
|
+
|
|
60
|
+
## What a look doesn't change
|
|
61
|
+
|
|
62
|
+
A look sets visual tokens. The scene still takes on the product's own motion and interaction habits: the kit's timing and framing are defaults. Keep real interaction timing where it helps recognition, then give the audience reading time. Causality, continuous identity, legibility and reduced motion hold whatever the style. A small illustration may need more air than the app itself.
|
|
63
|
+
|
|
64
|
+
## Check it
|
|
65
|
+
|
|
66
|
+
Put a still of the demo next to a screenshot of the real product at the same scale. The accent, the grays' temperature, the radii and the type should match at a glance; if a control looks foreign, read its real computed styles again rather than nudging by eye.
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Motion
|
|
2
|
+
|
|
3
|
+
The rules for everything that moves: the story, the loop, pace, text that changes, things that arrive and leave, the cursor, drags, scrolling and the camera. The still frame is in `craft.md`; each kit part's props are in `kit.md`.
|
|
4
|
+
|
|
5
|
+
## Index
|
|
6
|
+
|
|
7
|
+
1. [Story](#story): the shape, the beats, the payoff, satellites
|
|
8
|
+
2. [Loops](#loops): caused resets, data never rewinds, the seam, exits, conveyors
|
|
9
|
+
3. [Pace and easing](#pace-and-easing): two curves, fast feedback, overlap, stagger
|
|
10
|
+
4. [Changing text and values](#changing-text-and-values): change only what changed, footprints, numbers, chips
|
|
11
|
+
5. [Things that appear, travel and leave](#things-that-appear-travel-and-leave): nothing pops, whole arrivals, flights, handoffs, landings
|
|
12
|
+
6. [The cursor](#the-cursor): its kind, never over the label, every move explained, keys
|
|
13
|
+
7. [Drags and selection](#drags-and-selection): pickup, held cards, the grab offset, slots, I-beam selections
|
|
14
|
+
8. [Scrolling and the camera](#scrolling-and-the-camera)
|
|
15
|
+
9. [Phones in motion](#phones-in-motion): touch, swipes, the Dynamic Island, reactions
|
|
16
|
+
10. [Recipes](#recipes): page swaps, stepped demos, replay, annotations, motion on a page
|
|
17
|
+
|
|
18
|
+
## Story
|
|
19
|
+
|
|
20
|
+
Pick the shape from what the product is valued for; a demo forced into the wrong shape gets busier, not better.
|
|
21
|
+
|
|
22
|
+
- **How it feels to use:** the gesture is the story; a cursor does one satisfying thing and the result appears under its hand (`examples/hero-demo`).
|
|
23
|
+
- **A flow in an app:** a few screens told as one continuous object with the payoff on the last; no bolted-on second device (`examples/phone-touch`).
|
|
24
|
+
- **What the system does:** the consequence lands somewhere else; make the link visible (a value on a connector, a card flying into a list); usually no cursor (`examples/subscriptions`).
|
|
25
|
+
- **Beauty decides.** The calmer, fuller, better-framed version beats the one with more story (`examples/payout-flow`).
|
|
26
|
+
- **A hero loop is 10 to 16 seconds;** a repeat is a short beat, never the whole flow twice (`examples/subscriptions`).
|
|
27
|
+
- **Three to five beats building to a payoff;** one gesture and a response can be enough; add beats only when they clarify.
|
|
28
|
+
- **Open on a finished screen that works as a still.** The first real content is on screen before the beat. A thread opens with a real message, not bars (`examples/messages`).
|
|
29
|
+
- **A short history sits at the top of its pane** under the header, never pinned to the bottom with a void above; size the pane to what it holds.
|
|
30
|
+
- **The cursor rests on empty surface between beats,** near its next move, never on an unused control, never an I-beam over a button.
|
|
31
|
+
- **A satellite arrives at the beat it pays off,** carrying its payload, or is present from the first frame in a reserved column; never an empty parked object.
|
|
32
|
+
- **The payoff is visible at the shown size:** a panel, a window coming forward, a clear state change. A 16px avatar at the edge is not a payoff (`examples/hero-demo`).
|
|
33
|
+
- **A button whose label or icon changes changes on itself.** Put the new words in the same kit `Button` (`{done ? 'Resolved' : 'Resolve'}`, an `icon` that arrives) and it crossfades the label and eases its width so neighbors move with it. Never swap in a second button or a lookalike row for its new state.
|
|
34
|
+
- **A draft becomes the posted comment in place.** Use the kit's `Draft` (`<Draft value={s.draft} full={COMMENT} editing={typing} />`) in the column the comment's words belong to: it puts the typing box's edges on that column, holds the finished comment's height from the first keystroke, takes its typing shape at once and eases only on post. Posting adds no line: a time or "Just now" goes on the name's line and fades in, since a new line under the name shifts the name and pushes the comment down while its box is closing. Don't move it while typing to line the typed words up with the name (a margin shift on the editing state): the box's edge is what lines up, and the words sit inset by its padding. Don't hand-build the box: drawn by hand, its ring hangs past the column, runs into the name above, or drops a line's height in one frame.
|
|
35
|
+
- **The payoff arrives full.** A panel or card opens with its content; with `Collapse`, put the first lines in before `open`. Never a blank surface for a quarter second.
|
|
36
|
+
- **Things connect.** A `Connector` draws on over about a second after both ends are placed, routes around cards, and ends on a dot (`examples/story`).
|
|
37
|
+
- **A small label with a leader line can name what just happened** (`examples/hero-demo`); the full rules are in `annotations.md`.
|
|
38
|
+
- **Motion without hierarchy:** cover each moving element in turn; if the story gets clearer without it, cut it.
|
|
39
|
+
- **The poster is the frame most people see:** a thumbnail, reduced motion, a screenshot. Set `poster` to the beat that tells the story on its own (the row mid-swipe with Archive showing, the card over its new column), and let the result stay on screen after the action instead of tidying it away. Cover the motion and ask what happened; if the poster can't answer, choose another beat. A poster is never caught mid-change: a digit mid-roll, a label mid-morph or a surface mid-fade reads as a glitch when it holds still, so choose the frame after it lands.
|
|
40
|
+
|
|
41
|
+
## Loops
|
|
42
|
+
|
|
43
|
+
- **A reset removes what the loop added as one thing.** A reply and its reaction leave together, never reaction then message; a list that grew loses its new rows in one motion. The fewest steps that return the frame, with a seen cause where one exists.
|
|
44
|
+
- **A loop keeps a complete product picture:** open on context and return to it; a header over a blanked list is not an anchor. Film the seam at 60ms.
|
|
45
|
+
- **Every reset has a cause or is invisible,** in order: a seen cause (undo with its keycaps, clear, close), an exit around an anchor, a snap while hidden (`act.snap`). See `examples/subscriptions` and `examples/story`.
|
|
46
|
+
- **A loop never plays a navigation backwards.** An app opened from a notification doesn't shrink back into it, and a pushed screen doesn't slide back in reverse; no product does that. Undo the state in place, in a quick reverse stagger (the last change first, about 70ms apart), so the screen rewinds to its opening frame as one motion, or cut while something covers it. Don't lock the phone or go home to reset a story that happens inside one app: a black screen on a white page reads as the demo ending, not looping. A lock is the reset only for a lock-screen story.
|
|
47
|
+
- **Data never rewinds in view.** Snap it back hidden (off camera, under a closed panel, behind the exit) or bring the next loop's data in as new.
|
|
48
|
+
- **No dead air at the seam:** within about a second of the exit ending, the next action has begun.
|
|
49
|
+
- **Exiting around an anchor:** what the story added leaves in one reverse stagger, everything moving within half a second, 40 to 80ms apart, while product content stays. Never everything at once.
|
|
50
|
+
- **A story that accumulates runs as a conveyor:** exit the built batch, bring a fresh one in from the crop, reset unseen.
|
|
51
|
+
- **The payoff holds for 2s** before the exit (`examples/payout-flow`); nothing on screen sits still for more than three seconds.
|
|
52
|
+
- **A second scene earns its length** by adding something new (a different outcome, surface or side); repeating the beat doubles the loop for nothing (`examples/subscriptions`).
|
|
53
|
+
- **A looping video starts on a calm frame,** never mid fast motion.
|
|
54
|
+
|
|
55
|
+
## Pace and easing
|
|
56
|
+
|
|
57
|
+
- **Unhurried, on two curves.** Travel: `cubic-bezier(0.45, 0, 0.1, 1)`. Arrival from nowhere: `cubic-bezier(0.25, 0.8, 0.25, 1)` over 0.8 to 1s. Judge distance and overlap, not duration (`examples/payout-flow`).
|
|
58
|
+
- **Travel has a departure, clear travel and a soft arrival;** length alone does not make it fluid.
|
|
59
|
+
- **Choose durations and easings together by job;** one easing everywhere flattens the hierarchy; an accumulating number may take longer than its transfer (`choreography.md`).
|
|
60
|
+
- **UI feedback stays as quick as the real product;** only storytelling motion slows down. Feedback starts on the input; a presentation delay feels unresponsive.
|
|
61
|
+
- **Related responses overlap.** A changed setting leads its label, then its dependents, while the frame holds; a confirmation still follows its cause (`examples/choreography`).
|
|
62
|
+
- **Related updates can each take a different time;** the result still follows its cause.
|
|
63
|
+
- **Stagger groups in reading order 40 to 80ms apart** within a scene (`act.stagger` default 60); 80 to 120ms between tiles of a grid. One object enters whole; holds are beats too (`examples/calendar`).
|
|
64
|
+
- **Introducing a composition:** a small front-loaded movement can settle longer than its busy part; don't scale readable text much.
|
|
65
|
+
- **A small expressive icon may overshoot** while its card and text settle without bounce; keep the accent local; give the final state time to read.
|
|
66
|
+
- **Color changes between distant hues take about 200ms** (they pass through mud however done); let the label carry the slower motion.
|
|
67
|
+
- **Holding a result means stop:** a useful still needs no new pulse or repeated count.
|
|
68
|
+
|
|
69
|
+
## Changing text and values
|
|
70
|
+
|
|
71
|
+
- **Inspect the glyphs, not only the box.** Text can shimmer as a layer finishes; keep its transform layer through cleanup, never `will-change` over the whole scene.
|
|
72
|
+
- **Settle geometry before chasing a text shift.** Compare the last moving frame with the first settled one (`lands on a transform`, `steps in its box`).
|
|
73
|
+
- **Other text shifts:** a released measured width, a transform losing its layer, a late-loading font; inspect at real size.
|
|
74
|
+
- **A status word that changes (Queued, Running, Passed) rolls with `Roll`,** never two hand-built spans crossfading in place (they overlap mid-fade and read as a smudge). When several rows change at once, as a loop resets, cascade them about 60ms apart with `delay`: a column rolling in unison reads as flicker.
|
|
75
|
+
- **Every change moves.** Text that turns into a pill, a menu replaced by another in one frame, a number that jumps: a submenu slides, text rolls, a surface morphs.
|
|
76
|
+
- **Change only what changed.** `Roll` animates the changed span and moves what follows by its measured width; pick the anchor on purpose (`examples/story`).
|
|
77
|
+
- **Decide a control's footprint before its label transition:** `States` holds the largest, `Roll variant="fade"` resizes; never roll unchanged words (`examples/parts`).
|
|
78
|
+
- **Button states share one slot.** Keep the button mounted, variants in one grid cell, each icon-and-label variant default-centered; check shortest, longest and pending (`examples/hero-demo`).
|
|
79
|
+
- **Added content opens its space with its neighbor:** the icon's width and gap open together while the label travels; both close on removal (`examples/annotations`).
|
|
80
|
+
- **A right-pinned value changes against that edge** (`Roll align="end"`); a status icon beside it keeps a fixed slot (`examples/payout-flow`).
|
|
81
|
+
- **Numbers roll with `Count`,** last digit first, unchanged digits still; no per-frame lerp blur; give it a slot; hold the completed value (`examples/subscriptions`).
|
|
82
|
+
- **Typed text becomes a chip in place** (`Field chip`): the words stay, the surface grows around them, the x opens beside.
|
|
83
|
+
- **Result follows press feedback:** a small press and surface response before the result; change state after `a.click` completes.
|
|
84
|
+
- **An object keeps its identity when it changes** (a plus becoming a close): rotate the same strokes; replacing the icon skips the relationship.
|
|
85
|
+
- **A spinner turns before it is visible** and keeps turning through its fade out.
|
|
86
|
+
|
|
87
|
+
## Things that appear, travel and leave
|
|
88
|
+
|
|
89
|
+
- **A thing that grows as it travels takes the long settle.** A thumbnail becoming a card swells on a soft start and a long deceleration (the kit's `Fly` curves, 600ms or more); a quick ease-in-out lurches.
|
|
90
|
+
- **Nothing pops.** Everything has an entrance and stays mounted until its exit finishes; `Bubble` and `Fly` hand off at the same geometry.
|
|
91
|
+
- **No holes or blank frames.** What replaces something arrives as it leaves; reopening rows fade content in as their height finishes (`Collapse`) (`examples/subscriptions`).
|
|
92
|
+
- **Neighbors make room continuously** as the newcomer arrives; its fade rides with its travel, not before.
|
|
93
|
+
- **A new row carries the rows below it:** animate the containing track so the line below moves with its height, or reserve the space.
|
|
94
|
+
- **A resizing surface moves size, position and content as one transition,** never stretching its text, and retargets from its current geometry when interrupted (`examples/choreography`).
|
|
95
|
+
- **Replacing content keeps the container, alignment and reading interval,** masking only the moving slot.
|
|
96
|
+
- **Keep header, outer surface and action positions steady** while variable content changes inside; old and new content stay in tracks.
|
|
97
|
+
- **Solid things do not fade through.** Windows, phones and cards arrive by moving, opaque or nearly; a half-transparent phone is a ghost.
|
|
98
|
+
- **Cards, toasts, pills and reactions arrive whole from just above** (`Collapse reveal="drop"`), never uncovered by a hard edge; clip only rows of text.
|
|
99
|
+
- **Content arrives after its container:** a pin's number appears once its circle is nearly full size.
|
|
100
|
+
- **A popup fits before its first frame:** sized and scrolled before showing; it never corrects its size while opening (`examples/parts`).
|
|
101
|
+
- **An open surface holds its anchor.** A popover, palette, menu or sheet is pinned by the edge it opened from. Reserve height for the longest list (`anchor drift`, `examples/linear`).
|
|
102
|
+
- **Overlays close where they were:** keep `{ open, at }` apart, never a nullable `menu` point.
|
|
103
|
+
- **A zone becoming something else takes its new size** (a drop zone into an upload card); the fixed-footprint rule is for optional content inside a surface.
|
|
104
|
+
- **A value chip grows from the value's own words,** gains fill and lift as it departs, and wears one of its two looks, never a third color. The recipe is in `kit.md` (`examples/subscriptions`).
|
|
105
|
+
- **A dashed edge never changes size:** draw it at final size on its own layer and only fade it (`dashed edge resizes`, `examples/controls`).
|
|
106
|
+
- **Border style does not transition:** keep the solid hairline and fade a dashed `::before` layer out over it.
|
|
107
|
+
- **Switching versions morphs in place** or crossfades with the plate's height eased; never a flash or hard swap.
|
|
108
|
+
- **A released marquee fades;** it never sits still then vanishes.
|
|
109
|
+
- **A moving edge never slices text.** `Collapse` fades before and after the height moves; otherwise sequence fade and movement, or mask locally without softening the whole interface (`hard edge`).
|
|
110
|
+
- **One object, one trip, ending in its final place:** open the room (`Collapse`), measure the slot, then `Fly`; never land then re-lay out around it (`examples/subscriptions`).
|
|
111
|
+
- **After motion nothing moves.** A handoff is the same size, place and look on the swap frame. Measure the landing element itself, never its padded wrapper (`handoff shift`, `settle snap`, `fly size`).
|
|
112
|
+
- **A flight's ends are fixed at take-off** (`Fly` holds its rects when `go` turns true); a moving start retargets every frame and jumps.
|
|
113
|
+
- **A flyer changes to its resting look during the last third** (`.ss-fly[data-go]` with a delayed transition); never swap looks on the landing frame.
|
|
114
|
+
- **Landings are soft:** decelerate over the last third, back to size before arrival, no bounce, no ring pulse.
|
|
115
|
+
- **A selection ring or highlight moving between items uses `Follow`,** so it keeps momentum when retargeted; re-keying its entrance restarts it (`examples/figma`).
|
|
116
|
+
- **Look at every motion finding** (`appears, then moves`, `near-empty frames`, `lands on a transform`, `steps in its box`). Fix the real ones, name the intentional, never cut good motion to quiet a detector.
|
|
117
|
+
|
|
118
|
+
## The cursor
|
|
119
|
+
|
|
120
|
+
- **No cursor means no stand-in.** Never walk a focus ring, halo or spotlight between controls; states and timing carry a system story (`examples/cursors`).
|
|
121
|
+
|
|
122
|
+
## Open-Source Motion, Scroll, 3D & Lottie Discipline (`MOT-02`..`MOT-05`)
|
|
123
|
+
|
|
124
|
+
Sloppy enforces runtime craft discipline across 21 permissive (`MIT` / `Apache-2.0`) animation, scroll, SVG, 3D/WebGL, and Lottie ecosystems (excluding copyleft/Commons-Clause editor or bundle tools such as `@theatre/studio`):
|
|
125
|
+
|
|
126
|
+
- **Core Animation** (`motion`, `animejs`, `@react-spring/web`, `@formkit/auto-animate`, `@tweenjs/tween.js`, `@theatre/core`, `@motion-canvas/core`): Honor `useReducedMotion()` / `<MotionConfig reducedMotion="user">` (`MOT-03`), replace `repeat: Infinity` / `loop: true` on non-loader UI with caused transitions (`MOT-02`), and animate compositor-only properties (`x`, `y`, `scale`, `opacity`) instead of `width`, `height`, `top`, `left`, `margin`, or `padding` (`MOT-04`).
|
|
127
|
+
- **Scroll & Parallax** (`lenis`, `aos`, `rellax`, `lax.js`, `atropos`): Guard wheel smoothers with `prefers-reduced-motion` (`MOT-03`), initialize `AOS` with `once: true`, destroy scroll instances on unmount (`MOT-05`), and keep parallax subtle.
|
|
128
|
+
- **Text & SVG** (`splitting`, `vivus`): Preserve semantic heading labels, split only short headlines, and keep SVG draws finite (`MOT-02`).
|
|
129
|
+
- **3D & WebGL** (`three`, `@react-three/fiber`, `pixi.js`): Dispose geometries/materials/renderers on unmount, cap R3F `<Canvas dpr={[1, 2]} frameloop="demand">`, and pause loops when hidden or under reduced motion (`MOT-05`).
|
|
130
|
+
- **Lottie & Interactive** (`lottie-web`, `@lottiefiles/dotlottie-web`, `@rive-app/*`): Bind playback to user/state machines instead of blind loops (`MOT-02`) and always call `.destroy()` / cleanup (`MOT-05`).
|
|
131
|
+
- **Animated UI** (`magicui`): Restrict ambient beams/grids/particles to single focal regions under neutral palettes.
|
|
132
|
+
- **The elements decide the cursor's kind** via `data-cursor` (`ibeam`, `hand`, `open`, `crosshair`, `resize-ns` or `resize-ew` on an edge that drags, `resize-nwse` or `resize-nesw` on a corner, with `drag(..., { cursor: 'preserve' })` so it doesn't close to a fist), switching mid-path as it crosses the edge, never after arriving (`examples/cursors`, `examples/cursor-resize`).
|
|
133
|
+
- **`drag()` closes and reopens the hand itself;** a drag over text stays an I-beam; `{ cursor: 'preserve' }` keeps the arrow for arrow-based creation (`examples/google-calendar`).
|
|
134
|
+
- **Native app buttons keep the arrow,** and a button inside a marked area is the arrow again unmarked; `cursor()` is only for kinds nothing implies (`wait`).
|
|
135
|
+
- **The I-beam and crosshair turn white with a dark edge on a dark stage;** the glass circle narrows into a bar over text.
|
|
136
|
+
- **The cursor never covers the words it clicks.** Aim inside the target but off its text (`x: 0.85, y: 0.6`). Rest off a changed label; park in a menu row's empty space (`covers`).
|
|
137
|
+
- **A state the click sets fades in, quickly.** A tool picked in a toolbar, a selected row, an active filter: its fill and color ease in over about 150ms and back out the same, never switch on in one frame. A set of options where one is chosen and the choice moves is a `Segmented` or `Tabs`, whose highlight slides.
|
|
138
|
+
- **The cursor stays where the press happened** while the result changes size; never pin it to a moving button edge.
|
|
139
|
+
- **A cursor changes style by morphing,** never popping (`examples/cursor-morph`).
|
|
140
|
+
- **Every move travels to the next action,** follows a held object or clears the way; the Stage fades a resting cursor after 4s.
|
|
141
|
+
- **Keyboard stories show the keys** with `act.key('cmd+k')`; the cursor can rest or leave (`examples/raycast`).
|
|
142
|
+
|
|
143
|
+
## Drags and selection
|
|
144
|
+
|
|
145
|
+
- **A pointer drag is one motion.** With a mouse the row follows the pointer the whole way and leaves on release; the short drag then throw is a finger's flick and reads as two motions under an arrow.
|
|
146
|
+
- **A drag starts where the thing is.** A file from outside enters already held with a fixed grab offset. Never a pickup at an empty point or a changing grip (`examples/freeform-drag`).
|
|
147
|
+
- **A text selection reads left to right** from a word boundary; dragging back from the end reads as a correction (`examples/google-docs`).
|
|
148
|
+
- **A text selection stays under the I-beam every frame:** drive it from `a.drag` with `a.caret(name, at)` in the drag's `onMove` and render from the character count. A highlight grown by time or a word count runs ahead of the cursor on one line and behind it on the next; `--gate` fails on `selection drift`. Never clamp it or hit-test with `caretRangeFromPoint` (`examples/google-docs`).
|
|
149
|
+
- **Pickup belongs to the press:** set `lifted` and the first carried position inside `onMove`, never before `drag()`; a long press shows press, hold, lift (`examples/calendar`).
|
|
150
|
+
- **A carried card is held, not slid:** scale 1.03, deeper shadow, a degree or two of tilt, following the hand's arc. The whole card tilts, words and all: a surface tilting under level text reads as a bug. Keep its text from hopping as it lands with a layer it holds throughout (`will-change: transform`), not by leaving the text out of the tilt. It settles flat on drop, with no selection outline in the air (`examples/controls`).
|
|
151
|
+
- **Constrained controls follow their mechanism:** give `drag` a `{ path }` so a knob turns on a circle; check the hand's radius all the way round (`examples/annotations`).
|
|
152
|
+
- **The grab offset is where the hand took hold:** derive it from the pickup fractions, share the `transform-origin`, keep stage translation outside the lifted transform (`examples/freeform-drag`).
|
|
153
|
+
- **A held item rides with the cursor exactly** from `onMove` on both axes with no transition; `Fly` is only for flights the cursor is not carrying.
|
|
154
|
+
- **Drop targets never travel:** the slot appears in a cell and jumps to the next, hides over the card's own cell; `cellOf` for sticky borders (`examples/freeform-drag`).
|
|
155
|
+
- **Moving a card between lists uses `Slot`:** source closes on lift, destination opens in flight, drop aims at the open slot, then the real card swaps in (`examples/controls`).
|
|
156
|
+
|
|
157
|
+
## Scrolling and the camera
|
|
158
|
+
|
|
159
|
+
- **Nothing scrolls unless the pointer is on it:** `a.scroll` moves the cursor in and holds it; scroll back before the loop ends, never at the seam (`examples/controls`).
|
|
160
|
+
- **Scrolling starts with whole rows;** fade only the edges hiding content once scrolled, and clear the fade at the end.
|
|
161
|
+
- **The camera needs a reason.** Push in only when the payoff would be too small to read at the shown size; cut any zoom nobody would miss.
|
|
162
|
+
- **Frame the wide shot as a good still before any push-in;** the zoom never rescues a weak frame.
|
|
163
|
+
- **A push-in frames the stage's shape:** `Camera` fits the focus to the aspect, so widen the focus to the content column rather than accept leftovers (`examples/calendar`).
|
|
164
|
+
- **One push-in per story,** in and back out; edges feather while zoomed; the cursor holds still while the view moves (`examples/controls`).
|
|
165
|
+
- **Inside an overlay, wrap only the region that zooms** in `Camera`, with `pad={0}` when the region is already the frame.
|
|
166
|
+
|
|
167
|
+
## Phones in motion
|
|
168
|
+
|
|
169
|
+
- **Act where people do.** A notification is tapped to open its app, and the reply, the accept or the purchase happens in the app. Its long-press actions are a shortcut few people use, so a story told through them reads as invented.
|
|
170
|
+
- **Touch on a phone uses `cursor={{ style: 'touch' }}`,** never the macOS arrow. In-app responses are UIKit-quick, `cubic-bezier(0.3, 0.75, 0.1, 1)` over 0.5s; `Expand` does card-to-screen (`examples/phone-touch`).
|
|
171
|
+
- **A swiped row stays in its list:** the action is the row's own back, the same height and edge to edge, revealed as the row slides off it, not a separate rounded card beside it with a gap. The list clips both, so the row never paints over a neighboring pane, and its text is cut only by that edge. Check the frame at the furthest point of the swipe at full size: it is the one people screenshot (`examples/swipe`).
|
|
172
|
+
- **A swipe is a flick:** a third of the screen in about a quarter second, lifting while moving. The page is thrown on over 0.5s with `cubic-bezier(0.25, 1, 0.5, 1)` (`examples/phone-touch`).
|
|
173
|
+
- **A reaction is `Bubble tapback`:** a white circle on the bubble's bottom corner, growing from the edge as the room opens on the same clock. It fades before the room closes.
|
|
174
|
+
- **Dynamic Island:** animate the black shape's box and radius together, never by stretching its contents; content lives on a separate unfiltered layer and fades into place (`examples/dynamic-island`).
|
|
175
|
+
- **Island timing:** 500ms underdamped growth, 380ms shrink delayed 120ms for content to clear, a press squeeze to 0.965.
|
|
176
|
+
- **Island filters** (blur 2.6, alpha matrix 9 -4) belong to that geometry; filter only the black shapes. Keep the dormant circle inside the pill and inspect the contour at contact, separation and rest.
|
|
177
|
+
|
|
178
|
+
## Recipes
|
|
179
|
+
|
|
180
|
+
- **A page swap inside one window** keeps the chrome and crossfades only the body (200ms, an 8px rise); tabs move with it; never slide whole pages sideways.
|
|
181
|
+
- **A stepped demo keeps its object across steps;** swapping a Stage's script is a cut. An outside-switched variant gets one stable `play="once"` script; verify skip, reverse and mid-play change.
|
|
182
|
+
- **Replay remounts at the story boundary** with a key; never changing keys for ordinary state, text or variant changes (`kit.md`, Explicit replay).
|
|
183
|
+
- **A look sets tokens only;** the scene keeps the product's own motion habits and real timing (`looks.md`).
|
|
184
|
+
- **Annotations** (leaders, connectors, flows, moving targets) have their own rules in `annotations.md`; `choreography.md` walks one content change end to end.
|
|
185
|
+
- **Motion on a page of demos or in a grid has one place to lead** (`bento.md`, rule 11).
|