transitions-refine 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.
Files changed (32) hide show
  1. package/.agents/skills/refine-live/SKILL.md +205 -0
  2. package/.agents/skills/transitions-dev/01-card-resize.md +53 -0
  3. package/.agents/skills/transitions-dev/02-number-pop-in.md +119 -0
  4. package/.agents/skills/transitions-dev/03-notification-badge.md +110 -0
  5. package/.agents/skills/transitions-dev/04-text-states-swap.md +97 -0
  6. package/.agents/skills/transitions-dev/05-menu-dropdown.md +105 -0
  7. package/.agents/skills/transitions-dev/06-modal.md +94 -0
  8. package/.agents/skills/transitions-dev/07-panel-reveal.md +81 -0
  9. package/.agents/skills/transitions-dev/08-page-side-by-side.md +100 -0
  10. package/.agents/skills/transitions-dev/09-icon-swap.md +78 -0
  11. package/.agents/skills/transitions-dev/10-success-check.md +169 -0
  12. package/.agents/skills/transitions-dev/11-avatar-group-hover.md +200 -0
  13. package/.agents/skills/transitions-dev/12-error-state-shake.md +202 -0
  14. package/.agents/skills/transitions-dev/13-input-clear-dissolve.md +276 -0
  15. package/.agents/skills/transitions-dev/14-skeleton-reveal.md +149 -0
  16. package/.agents/skills/transitions-dev/15-shimmer-text.md +95 -0
  17. package/.agents/skills/transitions-dev/16-tabs-sliding.md +146 -0
  18. package/.agents/skills/transitions-dev/17-tooltip.md +103 -0
  19. package/.agents/skills/transitions-dev/18-texts-reveal.md +110 -0
  20. package/.agents/skills/transitions-dev/19-card-tilt.md +170 -0
  21. package/.agents/skills/transitions-dev/20-plus-menu-morph.md +167 -0
  22. package/.agents/skills/transitions-dev/21-accordion.md +124 -0
  23. package/.agents/skills/transitions-dev/SKILL.md +225 -0
  24. package/.agents/skills/transitions-dev/_root.css +204 -0
  25. package/README.md +89 -0
  26. package/bin/cli.mjs +264 -0
  27. package/demo.html +2531 -0
  28. package/package.json +37 -0
  29. package/server/inject.mjs +116 -0
  30. package/server/motion-tokens.mjs +106 -0
  31. package/server/refine-agent.mjs +86 -0
  32. package/server/relay.mjs +421 -0
@@ -0,0 +1,225 @@
1
+ ---
2
+ name: transitions-dev
3
+ description: Production-ready CSS transitions for web apps. Use when implementing notification badges, dropdowns, modals, panel reveals, page transitions, card resizes, number pop-ins, text swaps, icon swaps, success checks, avatar group hovers, error state shakes, search/input clear, skeleton loaders, shimmer text, sliding tabs, tooltips, staggered text reveals, card hover tilt, plus-to-menu morph, or accordions. Triggers on "add a transition", "animate the dropdown", "make the modal open smoothly", "swap icon", "page slide", "stagger animation", "open / close transition", "make it animate", "fade between", "success animation", "form error", "shake on invalid", "hover lift", "avatar stack hover", "clear the search", "skeleton loader", "loading shimmer", "shimmer text", "sliding tabs", "segmented control", "tooltip", "reveal text", "tilt card", "3D hover tilt", "cursor glare", "plus to menu", "FAB morph", "accordion", "collapsible", "expand / collapse", "disclosure". Also "motion tokens", "scan for ad-hoc transitions", "replace hardcoded durations with motion tokens", "tokenize my animations", and the commands transitions reveal, transitions review, transitions apply, transitions refine.
4
+ ---
5
+
6
+ # Transitions.dev
7
+
8
+ Twenty-one portable CSS transitions, each namespaced under `t-*` selectors with semantic CSS custom properties. Drop-in: paste the snippet, wire the documented HTML hooks, done. No framework dependencies, no demo-specific markup, and every snippet ships a `prefers-reduced-motion` guard.
9
+
10
+ ## Quick reference
11
+
12
+ | Transition | When to use | Reference |
13
+ | --- | --- | --- |
14
+ | **Card resize** | Tween a container's width or height when its layout state changes. | [01-card-resize.md](./01-card-resize.md) |
15
+ | **Number pop-in** | Re-enter each digit with a blurred slide when a number updates. | [02-number-pop-in.md](./02-number-pop-in.md) |
16
+ | **Notification badge** | Slide a small badge onto a trigger and pop the dot. | [03-notification-badge.md](./03-notification-badge.md) |
17
+ | **Text states swap** | Swap text in place with a blurred up-and-down transition. | [04-text-states-swap.md](./04-text-states-swap.md) |
18
+ | **Menu dropdown** | Open an origin-aware dropdown that grows from its trigger. | [05-menu-dropdown.md](./05-menu-dropdown.md) |
19
+ | **Modal open / close** | Scale-up modal dialog with a softer scale-down on close. | [06-modal.md](./06-modal.md) |
20
+ | **Panel reveal** | Slide a panel into a region with a cross-blur. | [07-panel-reveal.md](./07-panel-reveal.md) |
21
+ | **Page side-by-side** | Slide between two side-by-side pages (list ↔ detail, step 1 ↔ step 2). | [08-page-side-by-side.md](./08-page-side-by-side.md) |
22
+ | **Icon swap** | Cross-fade two icons in the same slot with blur and scale. | [09-icon-swap.md](./09-icon-swap.md) |
23
+ | **Success check** | Compose fade + rotate + Y-bob + path stroke-draw to celebrate a completed action. | [10-success-check.md](./10-success-check.md) |
24
+ | **Avatar group hover** | Distance-falloff lift on a row of items with a bouncy spring on return. | [11-avatar-group-hover.md](./11-avatar-group-hover.md) |
25
+ | **Error state shake** | Per-segment cubic-bezier shake with auto-reverting border + message. | [12-error-state-shake.md](./12-error-state-shake.md) |
26
+ | **Input clear with dissolve** | Fly-out + per-word streak when a text field is cleared. | [13-input-clear-dissolve.md](./13-input-clear-dissolve.md) |
27
+ | **Skeleton loader and reveal** | Pulse a placeholder, then cross-fade + cross-blur to the loaded content. | [14-skeleton-reveal.md](./14-skeleton-reveal.md) |
28
+ | **Shimmer text** | Sweep a highlight band across muted text on a loop (pure CSS). | [15-shimmer-text.md](./15-shimmer-text.md) |
29
+ | **Tabs sliding** | Slide the active pill between tabs in a segmented control. | [16-tabs-sliding.md](./16-tabs-sliding.md) |
30
+ | **Tooltip open/close** | Delayed fade+scale in, instant out (pure CSS). | [17-tooltip.md](./17-tooltip.md) |
31
+ | **Texts reveal** | Staggered blurred rise for stacked text lines, quiet fade out. | [18-texts-reveal.md](./18-texts-reveal.md) |
32
+ | **Card hover tilt** | Tilt a card in 3D toward the pointer with a cursor-tracked glare. | [19-card-tilt.md](./19-card-tilt.md) |
33
+ | **Plus to menu morph** | Morph a circular trigger into the menu / panel it opens. | [20-plus-menu-morph.md](./20-plus-menu-morph.md) |
34
+ | **Accordion expand** | Grow / shrink a panel via grid-rows with a chevron flip. | [21-accordion.md](./21-accordion.md) |
35
+
36
+ ## Decision rules
37
+
38
+ When the user asks for a transition, match against the visible UI element first, then the verb:
39
+
40
+ - **Trigger + small dot floating on top** → notification badge.
41
+ - **Trigger + surface that grows from it** → dropdown (anchored, origin-aware) or modal (centered, no anchor).
42
+ - **Surface that slides into a region of the page** → panel reveal.
43
+ - **Two screens, list ↔ detail or step 1 ↔ step 2** → page side-by-side.
44
+ - **Element changes width or height** → card resize.
45
+ - **Element's text content changes in place** → text states swap.
46
+ - **Two icons in the same slot** → icon swap.
47
+ - **A number updates** → number pop-in.
48
+ - **Confirmation / success / "done" moment** (checkmark, payment processed, file uploaded) → success check.
49
+ - **Hovering an item in a horizontal stack** (avatars, chips, segmented buttons, tag pills) → avatar group hover.
50
+ - **Form validation error / "this is wrong" feedback** (invalid field, wrong PIN, duplicate name) → error state shake.
51
+ - **Clearing a text field** (search box × button, filter reset) → input clear with dissolve.
52
+ - **Placeholder that loads then swaps to real content** (list row, card, profile header) → skeleton loader and reveal.
53
+ - **In-progress / "thinking" text that should feel alive** (loading label, streaming status) → shimmer text.
54
+ - **Small horizontal set of mutually-exclusive options with a moving highlight** (view switcher, segmented control, filter tabs) → tabs sliding.
55
+ - **Hover/focus hint that appears over a trigger** (icon tooltip, info bubble) → tooltip open / close.
56
+ - **Stacked headline + supporting line entering with rhythm** (hero copy, empty state, onboarding step) → texts reveal.
57
+ - **Card / tile that should react in 3D to the pointer on hover** (product card, cover art, membership card, with or without a light glare) → card hover tilt.
58
+ - **Circular trigger that becomes the surface it opens** (+ FAB grows into a menu / panel, compose button expands) → plus → menu morph. If the surface is a *separate* popover that merely grows from the trigger, use menu dropdown instead.
59
+ - **Header with a collapsible body that grows / shrinks in height** (settings group, FAQ, filter section, "show more", disclosure) → accordion expand.
60
+ - **No clear match** → fall back to `transitions reveal` and let the user pick. Don't guess.
61
+
62
+ If two transitions could fit, prefer the lower-overhead one (card resize over panel reveal, dropdown over modal, success check over a full modal celebration) unless the design clearly calls for the heavier surface. The success check is animation-only — if you also need to swap from a spinner to the check, pair it with **icon swap**.
63
+
64
+ ## Commands
65
+
66
+ The skill exposes four namespaced verbs the agent should recognise in addition to direct transition requests. Every command starts with `transitions` so the invocation never collides with verbs from other skills installed in the same project.
67
+
68
+ ### transitions reveal — list every transition
69
+
70
+ **Trigger phrases:** `transitions reveal`, "reveal the transitions", "list all transitions", "what transitions are in this skill", "show the transitions catalog".
71
+
72
+ **Behaviour:** print the twenty-one transitions as a numbered plain-text list — name, one-line summary, and the matching reference filename. Reuse the rows in `## Quick reference` above; do not invent new copy. No project access.
73
+
74
+ ### transitions review — audit the project for fit
75
+
76
+ **Trigger phrases:** `transitions review`, "review my project", "audit my animations", "where would transitions.dev help", "find places to use this skill".
77
+
78
+ **Behaviour:**
79
+
80
+ 1. Search the workspace for indicators: `transition:` declarations, `@keyframes`, hardcoded `ms` / `s` durations in style files, components matching the decision-rule patterns (modals, dropdowns, badges, search inputs, skeletons, tabs, tooltips, …).
81
+ 2. For each hit, match against the decision rules and pick the single best-fit transition.
82
+ 3. Output a numbered list grouped by file:
83
+ - `path/to/Component.tsx:L42` — looks like a dropdown opening, suggest **menu-dropdown** (`05-menu-dropdown.md`).
84
+ - Skip ad-hoc transitions that already use a `t-*` class.
85
+ 4. Do not edit anything. End with: "Run `transitions apply` on any line to install the suggested transition."
86
+
87
+ ### transitions apply — install the best-fit transition
88
+
89
+ **Trigger phrases:** `transitions apply`, "apply a transition here", "add the right transition", "install transitions-dev here", "fix the animation on this element".
90
+
91
+ **Behaviour:**
92
+
93
+ 1. Read context: the currently-open file, the element nearest the cursor, surrounding CSS / JSX. If the user named a transition explicitly (e.g. `transitions apply menu-dropdown`), use it.
94
+ 2. Run the decision rules from `## Decision rules` on that context and pick **one** transition. If two could fit, prefer the lower-overhead one (same tie-breaker the existing rules use).
95
+ 3. Surface a one-line proposal: "I'd apply **menu-dropdown** here because the element opens from a trigger and is anchored. Confirm to install?".
96
+ 4. On confirmation, follow the existing five-step procedure in `## Output format` verbatim (root block, snippet, hooks, reduced-motion guard, JS orchestration if needed).
97
+ 5. If the agent can't pick a single transition with confidence, fall back to `transitions reveal` and ask the user to choose.
98
+
99
+ ### transitions refine — replace ad-hoc motion with the motion tokens
100
+
101
+ **Trigger phrases:** `transitions refine`, "refine my transitions", "scan for ad-hoc transitions", "replace hardcoded durations with motion tokens", "tokenize my animations", "tune the durations / easing", "audit my custom keyframes", "make the timing consistent", "align to the motion tokens".
102
+
103
+ **Behaviour:**
104
+
105
+ 1. **Scan the whole project** (not just dedicated stylesheets — also inline `style=` / CSS-in-JS, styled-components, `<style>` blocks, Tailwind arbitrary values like `duration-[300ms]`) for ad-hoc motion: `transition` / `animation` shorthands and longhands, custom `@keyframes` blocks, hardcoded durations (`…ms` / `…s`), easing (`cubic-bezier(...)` or keywords), translate distances (`px`), `scale(...)`, and `blur(...)`.
106
+ 2. For each value, infer **what the motion does** (modal close, dropdown open, tooltip, badge appear, text reveal, page slide, shake, …) from the surrounding selectors / component plus the `## Decision rules`. For a `@keyframes` block, read the `animation` that drives it and judge the keyframes' own duration/easing.
107
+ 3. **The key decision point is usage, not the raw number.** Look the inferred usage up in `## Motion tokens` and suggest the token whose documented usage matches — only when the usages line up. A 300ms modal close maps to `--duration-quick` because both are "modal close", even though the numbers differ. If a value's usage matches **no** token's usage, list it as `no matching token usage` and leave it untouched — never force a swap just because a number is close.
108
+ 4. Output a numbered list grouped by file, showing only values that should change, each as `path/to/Component.css:L42` — `modal close: 300ms → var(--duration-quick) (150ms)`, `ease → var(--ease-smooth-out)`. For keyframe-driven motion, suggest the token for the driving `animation`'s duration/easing.
109
+ 5. Do not edit anything. End with: "Confirm any line to apply the change, or run `transitions apply` to install a full transition instead."
110
+
111
+ ## Motion tokens
112
+
113
+ The shared motion scale behind the twenty-one transitions — the same tokens the [transitions.dev](https://transitions.dev) Motion tokens tab exposes. They ship at the top of [`_root.css`](./_root.css), so once it's imported you can reference any of them as `var(--…)` (e.g. `transition: transform var(--duration-fast) var(--ease-smooth-out)`).
114
+
115
+ `transitions refine` maps each existing value to a usage below, then suggests the token to reference. Match on **usage**, not on the raw number — a 300ms modal close still maps to `--duration-quick` (150ms).
116
+
117
+ **Durations**
118
+
119
+ | Token | Value | Usage |
120
+ | --- | --- | --- |
121
+ | `--duration-stagger` | `40ms` | per-item stagger offset |
122
+ | `--duration-micro` | `80ms` | tooltip/path delay, shake segment, large stagger |
123
+ | `--duration-quick` | `150ms` | modal/dropdown close, text swap, tooltip appear |
124
+ | `--duration-fast` | `250ms` | icon swap, dropdown/modal open, tabs sliding, page slide |
125
+ | `--duration-medium` | `350ms` | panel close, toast close |
126
+ | `--duration-slow` | `400ms` | panel open, skeleton content reveal, input clear |
127
+ | `--duration-very-slow` | `500ms` | emphasis moments, badge appear, text reveal, success check |
128
+
129
+ **Easings**
130
+
131
+ | Token | Value | Usage |
132
+ | --- | --- | --- |
133
+ | `--ease-smooth-out` | `cubic-bezier(0.22, 1, 0.36, 1)` | modal/dropdown/panel open + close, page slide, resize, position change |
134
+ | `--ease-in-out` | `ease-in-out` | icon swap, text swap, text reveal, skeleton reveal |
135
+ | `--ease-out` | `ease-out` | tooltip open / close |
136
+ | `--ease-linear` | `linear` | shimmer, skeleton pulse, spinner |
137
+ | `--ease-bounce` | `cubic-bezier(0.34, 1.36, 0.64, 1)` | badge pop open |
138
+ | `--ease-bounce-strong` | `cubic-bezier(0.34, 3.85, 0.64, 1)` | bouncy hover-out (avatar return) |
139
+
140
+ **Distances**
141
+
142
+ | Token | Value | Usage |
143
+ | --- | --- | --- |
144
+ | `--distance-micro` | `4px` | text swap |
145
+ | `--distance-small` | `6px` | error shake (small segment) |
146
+ | `--distance-base` | `8px` | badge diagonal reveal, page slide, error shake (large segment) |
147
+ | `--distance-medium` | `12px` | text reveal |
148
+ | `--distance-large` | `30px` | check badge appear |
149
+
150
+ **Scales**
151
+
152
+ | Token | Value | Usage |
153
+ | --- | --- | --- |
154
+ | `--scale-large` | `0.96` | modal open / close |
155
+ | `--scale-medium` | `0.97` | dropdown open |
156
+ | `--scale-small` | `0.98` | tooltip open |
157
+ | `--scale-tiny` | `0.99` | dropdown close |
158
+
159
+ **Blur**
160
+
161
+ | Token | Value | Usage |
162
+ | --- | --- | --- |
163
+ | `--blur-small` | `2px` | panel reveal, icon swap, text swap, skeleton reveal, number pop-in |
164
+ | `--blur-medium` | `3px` | page slide, text reveal |
165
+ | `--blur-large` | `8px` | success check open |
166
+
167
+ ## Universal install
168
+
169
+ Copy [`_root.css`](./_root.css) into your project **once** and import it (or paste its `:root` block into your global stylesheet). It leads with the shared **motion-token scale** (`--duration-*`, `--ease-*`, `--distance-*`, `--scale-*`, `--blur-*` — see `## Motion tokens`), followed by the semantic tunable variables for **all twenty-one** transitions. Every snippet reads from these names — `--resize-*`, `--badge-*`, `--dropdown-*`, `--clear-*`, `--shimmer-*`, `--tabs-*`, `--tt-*`, `--stagger-*`, `--tilt-*`, `--morph-*`, `--acc-*`, and the rest.
170
+
171
+ Each reference file also restates just the variables that snippet needs, so you can install a single transition without pulling the whole block. Don't duplicate the block — if `_root.css` is already imported, skip re-pasting any per-snippet `:root`.
172
+
173
+ The `--pX-*` source tokens used by the live demo at [transitions.dev](https://transitions.dev) are intentionally **not** exported. Tunable values are renamed to semantic names so the user owns the design vocabulary. A few transitions (input clear, shimmer text, tabs, tooltip) carry **color** tokens that differ by theme — each reference file documents the `html[data-theme="dark"]` overrides.
174
+
175
+ ## Output format
176
+
177
+ When inserting a transition into the user's project:
178
+
179
+ 1. **Install the variables from `_root.css`** into the user's global stylesheet, but only if they aren't already there — or just the per-snippet `:root` block from the reference file if installing a single transition. If the universal block is already imported, do **not** duplicate it.
180
+ 2. **Paste the chosen transition's CSS verbatim** from the relevant reference file. Do not rewrite selectors, do not collapse the transition into shorthand, do not strip `will-change`. The snippets are tuned and tested.
181
+ 3. **Wire the documented HTML hooks** — class names (`.t-dropdown`, `.t-modal`, `.t-success-check`, `.t-avatar`, `.t-clear`, `.t-skel`, `.t-shimmer`, `.t-tabs`, `.t-tt`, `.t-stagger`, `.t-tilt`, `.t-morph`, `.t-acc`, …) and state attributes (`data-open`, `data-state`, `data-page`, `data-origin`, `aria-selected`, `aria-expanded`, `.is-open`, `.is-closing`, `.is-error`, `.is-shaking`, `.has-value`, `.is-clearing`, `.is-pulsing`, `.is-revealed`, `.is-shown`, `.is-hiding`, `.is-hover`, `.is-tilting`).
182
+ 4. **Preserve the `@media (prefers-reduced-motion: reduce)` block.** Every snippet ships one. Removing it makes the component fail accessibility audits.
183
+ 5. **For transitions that need JS** (dropdown, modal, text swap, number pop-in, page slide, success check, avatar group hover, error state shake, input clear, skeleton reveal, tabs sliding, texts reveal, card hover tilt, plus → menu morph, accordion expand), copy the small orchestration snippet from the reference file and adapt the selectors to the user's DOM. Keep the timing reads (`getComputedStyle(...)getPropertyValue("--…")`) so durations stay in sync with the `:root` values. Shimmer text and tooltip are **pure CSS** — no JS needed.
184
+
185
+ Keep the diff small: only edit the files needed to introduce the transition. Don't rename the user's existing variables, don't reformat unrelated CSS, don't pull in a motion library.
186
+
187
+ ## Common mistakes to avoid
188
+
189
+ - **Stripping the close-state class cleanup** on dropdown/modal — without the `setTimeout` that removes `.is-closing`, the next open jumps from the closing scale instead of the resting pre-open scale.
190
+ - **Forgetting the reflow** in the text swap, number pop-in, success check replay, and error state shake — `void el.offsetWidth` (or `offsetHeight`) between class/attribute removal and re-addition is what guarantees the animation replays.
191
+ - **Animating a single container** instead of the inner pieces — for the badge, animate the dot, not the trigger; for page slide, animate the page sections, not the container.
192
+ - **Replacing `transition: …` with `transition: all`** — every snippet enumerates exact properties on purpose so unrelated style changes don't ride in for free.
193
+ - **Hardcoding the success check's `stroke-dasharray`** — the snippet ships `20` as a placeholder. Replace it with `path.getTotalLength()` rounded up by 1 for *your* path, otherwise the stroke pre-reveals or over-draws.
194
+ - **Setting `transition-timing-function` in CSS** for the avatar group hover — it has to be set inline in JS *before* the `--shift` / `--scale-active` writes so the bouncy ease-out only applies on `mouseleave`.
195
+ - **Mixing `.is-error` and `.is-shaking` into one class** for the error state shake — keeping them orthogonal is what allows the shake to replay (remove → reflow → re-add) without flickering the whole error treatment.
196
+ - **Leaving the input clear glow on `mix-blend-mode: multiply` in dark mode** — flip to `screen`, bump `--glow-opacity` to ~0.85, and paint white gradients in JS.
197
+ - **Forgetting to write the tabs pill's first position without a transition** — on first paint and resize, set `transform` + `width` with `transition: none` (then reflow + restore) or the pill animates in from `translateX(0)` / `width: 0`.
198
+ - **Tracking the pointer on the tilting element itself** for card hover tilt — bind `pointermove` to the flat outer `.t-tilt` wrapper, not `.t-tilt-card`, or the rotating edges slip under the cursor and the hover flickers.
199
+ - **Padding on the accordion grid track** — put padding on `.t-acc-panel-inner`, never on `.t-acc-panel`; padding on the `0fr` track leaves a residual height strip so the panel never fully closes.
200
+ - **Morphing the accordion chevron's `d` path** — CSS `d:` path interpolation is Chromium-only, so it never animates on mobile Safari / Firefox. Flip the chevron vertically (`transform: scaleY(-1)`) instead — it passes through a flat line at the midpoint just like the path morph and works everywhere. Keep the path symmetric about its viewBox centre and add `vector-effect: non-scaling-stroke` so the stroke stays constant through the flip. This is what the snippet ships.
201
+
202
+ ## Reference files
203
+
204
+ - [01-card-resize.md](./01-card-resize.md) — Card resize
205
+ - [02-number-pop-in.md](./02-number-pop-in.md) — Number pop-in
206
+ - [03-notification-badge.md](./03-notification-badge.md) — Notification badge
207
+ - [04-text-states-swap.md](./04-text-states-swap.md) — Text states swap
208
+ - [05-menu-dropdown.md](./05-menu-dropdown.md) — Menu dropdown
209
+ - [06-modal.md](./06-modal.md) — Modal open / close
210
+ - [07-panel-reveal.md](./07-panel-reveal.md) — Panel reveal
211
+ - [08-page-side-by-side.md](./08-page-side-by-side.md) — Page side-by-side
212
+ - [09-icon-swap.md](./09-icon-swap.md) — Icon swap
213
+ - [10-success-check.md](./10-success-check.md) — Success check
214
+ - [11-avatar-group-hover.md](./11-avatar-group-hover.md) — Avatar group hover
215
+ - [12-error-state-shake.md](./12-error-state-shake.md) — Error state shake
216
+ - [13-input-clear-dissolve.md](./13-input-clear-dissolve.md) — Input clear with dissolve
217
+ - [14-skeleton-reveal.md](./14-skeleton-reveal.md) — Skeleton loader and reveal
218
+ - [15-shimmer-text.md](./15-shimmer-text.md) — Shimmer text
219
+ - [16-tabs-sliding.md](./16-tabs-sliding.md) — Tabs sliding
220
+ - [17-tooltip.md](./17-tooltip.md) — Tooltip open/close
221
+ - [18-texts-reveal.md](./18-texts-reveal.md) — Texts reveal
222
+ - [19-card-tilt.md](./19-card-tilt.md) — Card hover tilt
223
+ - [20-plus-menu-morph.md](./20-plus-menu-morph.md) — Plus to menu morph
224
+ - [21-accordion.md](./21-accordion.md) — Accordion expand
225
+ - [_root.css](./_root.css) — the universal install block on its own, ready to import directly.
@@ -0,0 +1,204 @@
1
+ /* transitions-dev — copy this :root block into your project once.
2
+ Every transition snippet reads from these semantic names. */
3
+ :root {
4
+ /* ── Motion tokens — shared scale ──────────────────────────────
5
+ Reference these with var(--…) anywhere in your project. The
6
+ transitions below ship literal values so each snippet works on
7
+ its own; `transitions refine` maps hardcoded values back to
8
+ these tokens. */
9
+ /* Durations */
10
+ --duration-stagger: 40ms; /* per-item stagger offset */
11
+ --duration-micro: 80ms; /* tooltip/path delay, shake segment, large stagger */
12
+ --duration-quick: 150ms; /* modal/dropdown close, text swap, tooltip appear */
13
+ --duration-fast: 250ms; /* icon swap, dropdown/modal open, tabs sliding, page slide */
14
+ --duration-medium: 350ms; /* panel close, toast close */
15
+ --duration-slow: 400ms; /* panel open, skeleton content reveal, input clear */
16
+ --duration-very-slow: 500ms; /* emphasis moments, badge appear, text reveal, success check */
17
+ /* Easings */
18
+ --ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1); /* modal/dropdown/panel open + close, page slide, resize, position change */
19
+ --ease-in-out: ease-in-out; /* icon swap, text swap, text reveal, skeleton reveal */
20
+ --ease-out: ease-out; /* tooltip open / close */
21
+ --ease-linear: linear; /* shimmer, skeleton pulse, spinner */
22
+ --ease-bounce: cubic-bezier(0.34, 1.36, 0.64, 1); /* badge pop open */
23
+ --ease-bounce-strong: cubic-bezier(0.34, 3.85, 0.64, 1); /* bouncy hover-out (avatar return) */
24
+ /* Distances */
25
+ --distance-micro: 4px; /* text swap */
26
+ --distance-small: 6px; /* error shake (small segment) */
27
+ --distance-base: 8px; /* badge diagonal reveal, page slide, error shake (large segment) */
28
+ --distance-medium: 12px; /* text reveal */
29
+ --distance-large: 30px; /* check badge appear */
30
+ /* Scales */
31
+ --scale-large: 0.96; /* modal open / close */
32
+ --scale-medium: 0.97; /* dropdown open */
33
+ --scale-small: 0.98; /* tooltip open */
34
+ --scale-tiny: 0.99; /* dropdown close */
35
+ /* Blur */
36
+ --blur-small: 2px; /* panel reveal, icon swap, text swap, skeleton reveal, number pop-in */
37
+ --blur-medium: 3px; /* page slide, text reveal */
38
+ --blur-large: 8px; /* success check open */
39
+
40
+ /* Card resize */
41
+ --resize-dur: 300ms;
42
+ --resize-ease: cubic-bezier(0.22, 1, 0.36, 1);
43
+ /* Number pop-in */
44
+ --digit-dur: 500ms;
45
+ --digit-distance: 8px;
46
+ --digit-stagger: 70ms;
47
+ --digit-blur: 2px;
48
+ --digit-ease: cubic-bezier(0.34, 1.45, 0.64, 1);
49
+ --digit-dir-x: 0;
50
+ --digit-dir-y: 1;
51
+ /* Notification badge */
52
+ --badge-slide-dur: 260ms;
53
+ --badge-pop-dur: 500ms;
54
+ --badge-pop-close-dur: 180ms;
55
+ --badge-fade-dur: 400ms;
56
+ --badge-fade-close-dur: 180ms;
57
+ --badge-blur: 2px;
58
+ --badge-offset-x: -8.2px;
59
+ --badge-offset-y: 12.4px;
60
+ --badge-slide-ease: cubic-bezier(0.22, 1, 0.36, 1);
61
+ --badge-pop-ease: cubic-bezier(0.34, 1.36, 0.64, 1);
62
+ --badge-close-ease: cubic-bezier(0.4, 0, 0.2, 1);
63
+ /* Text states swap */
64
+ --text-swap-dur: 150ms;
65
+ --text-swap-translate-y: 4px;
66
+ --text-swap-blur: 2px;
67
+ --text-swap-ease: ease-in-out;
68
+ /* Menu dropdown */
69
+ --dropdown-open-dur: 250ms;
70
+ --dropdown-close-dur: 150ms;
71
+ --dropdown-pre-scale: 0.97;
72
+ --dropdown-closing-scale: 0.99;
73
+ --dropdown-ease: cubic-bezier(0.22, 1, 0.36, 1);
74
+ /* Modal open / close */
75
+ --modal-open-dur: 250ms;
76
+ --modal-close-dur: 150ms;
77
+ --modal-scale: 0.96;
78
+ --modal-scale-close: 0.96;
79
+ --modal-ease: cubic-bezier(0.22, 1, 0.36, 1);
80
+ /* Panel reveal */
81
+ --panel-open-dur: 400ms;
82
+ --panel-close-dur: 350ms;
83
+ --panel-translate-y: 100px;
84
+ --panel-blur: 2px;
85
+ --panel-ease: cubic-bezier(0.22, 1, 0.36, 1);
86
+ /* Page side-by-side */
87
+ --page-slide-dur: 250ms;
88
+ --page-fade-dur: 250ms;
89
+ --page-slide-distance: 8px;
90
+ --page-blur: 3px;
91
+ --page-stagger: 0ms;
92
+ --page-exit-enabled: 1;
93
+ --page-slide-ease: cubic-bezier(0.22, 1, 0.36, 1);
94
+ --page-fade-ease: cubic-bezier(0.22, 1, 0.36, 1);
95
+ /* Icon swap */
96
+ --icon-swap-dur: 250ms;
97
+ --icon-swap-blur: 2px;
98
+ --icon-swap-start-scale: 0.25;
99
+ --icon-swap-ease: ease-in-out;
100
+ /* Success check */
101
+ --check-opacity-dur: 500ms;
102
+ --check-rotate-dur: 500ms;
103
+ --check-rotate-from: 80deg;
104
+ --check-bob-dur: 500ms;
105
+ --check-y-amount: 40px;
106
+ --check-blur-dur: 500ms;
107
+ --check-blur-from: 10px;
108
+ --check-path-dur: 500ms;
109
+ --check-path-delay: 80ms;
110
+ --check-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
111
+ --check-ease-opacity: cubic-bezier(0.22, 1, 0.36, 1);
112
+ --check-ease-rotate: cubic-bezier(0.22, 1, 0.36, 1);
113
+ --check-ease-bob: cubic-bezier(0.34, 1.35, 0.64, 1);
114
+ --check-ease-path: cubic-bezier(0.22, 1, 0.36, 1);
115
+ /* Avatar group hover */
116
+ --avatar-lift: -4px;
117
+ --avatar-dur: 320ms;
118
+ --avatar-scale: 1.05;
119
+ --avatar-falloff: 0.45;
120
+ --avatar-ease-in: cubic-bezier(0.22, 1, 0.36, 1);
121
+ --avatar-ease-out: cubic-bezier(0.34, 3.85, 0.64, 1);
122
+ /* Error state shake */
123
+ --shake-distance: 6px;
124
+ --shake-overshoot: 4px;
125
+ --shake-dur-a: 80ms;
126
+ --shake-dur-b: 60ms;
127
+ --shake-ease: cubic-bezier(0.22, 1, 0.36, 1);
128
+ --revert-hold: 3000ms;
129
+ --revert-dur: 280ms;
130
+ /* Input clear with dissolve */
131
+ --clear-dur: 1000ms;
132
+ --clear-out-dur: 400ms;
133
+ --clear-in-dur: 400ms;
134
+ --clear-out-fly: 12px;
135
+ --clear-in-fly: 12px;
136
+ --clear-out-ease: cubic-bezier(0.22, 1, 0.36, 1);
137
+ --clear-in-ease: cubic-bezier(0.22, 1, 0.36, 1);
138
+ --clear-blur: 2px;
139
+ --glow-delay: 50ms;
140
+ --glow-peak-at: 0.15;
141
+ --glow-opacity: 0.42;
142
+ --glow-spread: 1.5;
143
+ /* Skeleton loader and reveal */
144
+ --pulse-dur: 1000ms;
145
+ --pulse-count: 1;
146
+ --pulse-min: 0.5;
147
+ --reveal-dur: 400ms;
148
+ --reveal-blur: 2px;
149
+ --reveal-ease: ease-in-out;
150
+ /* Shimmer text */
151
+ --shimmer-dur: 2000ms;
152
+ --shimmer-base: #7c7c7c;
153
+ --shimmer-highlight: #0d0d0d;
154
+ --shimmer-band: 400%;
155
+ --shimmer-ease: linear;
156
+ /* Tabs sliding */
157
+ --tabs-dur: 250ms;
158
+ --tabs-ease: cubic-bezier(0.22, 1, 0.36, 1);
159
+ --tabs-text-muted: rgba(15, 15, 15, 0.8);
160
+ --tabs-text-active: #0f0f0f;
161
+ --tabs-bar-bg: #f1f1f1;
162
+ --tabs-pill-bg: #ffffff;
163
+ /* Tooltip open/close */
164
+ --tt-in-dur: 150ms;
165
+ --tt-out-dur: 50ms;
166
+ --tt-scale: 0.98;
167
+ --tt-delay: 80ms;
168
+ --tt-in-ease: ease-out;
169
+ --tt-out-ease: ease-out;
170
+ --tt-bg: #ffffff;
171
+ --tt-fg: #2f2f2f;
172
+ /* Texts reveal */
173
+ --stagger-dur: 500ms;
174
+ --stagger-distance: 12px;
175
+ --stagger-stagger: 40ms;
176
+ --stagger-blur: 3px;
177
+ --stagger-ease: cubic-bezier(0.22, 1, 0.36, 1);
178
+ /* Card hover tilt */
179
+ --tilt-perspective: 1000px;
180
+ --tilt-return: 1000ms;
181
+ --tilt-return-ease: cubic-bezier(0.22, 1, 0.36, 1);
182
+ --tilt-follow: 400ms;
183
+ --tilt-follow-ease: cubic-bezier(0.22, 1, 0.36, 1);
184
+ --tilt-glare-opacity: 0.32;
185
+ --tilt-glare-fade: 300ms;
186
+ --tilt-glare-ease: cubic-bezier(0.22, 1, 0.36, 1);
187
+ /* Plus to menu morph */
188
+ --morph-open-dur: 350ms;
189
+ --morph-close-dur: 250ms;
190
+ --morph-ease: cubic-bezier(0.34, 1.25, 0.64, 1);
191
+ --morph-close-ease: cubic-bezier(0.22, 1, 0.36, 1);
192
+ --morph-r-closed: 40px;
193
+ --morph-r-open: 20px;
194
+ --morph-fade-dur: 200ms;
195
+ --morph-slide: 40px;
196
+ --morph-rotate: 45deg;
197
+ --morph-scale: 0.97;
198
+ --morph-blur: 2px;
199
+ /* Accordion expand */
200
+ --acc-expand: 250ms;
201
+ --acc-collapse: 250ms;
202
+ --acc-chevron: 250ms;
203
+ --acc-ease: cubic-bezier(0.22, 1, 0.36, 1);
204
+ }
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # transitions-refine
2
+
3
+ A live, agent-driven **Refine** panel for CSS and [Motion](https://motion.dev) transitions. One command injects a docked timeline + Refine panel onto your running app — no `npm install`, no source edits of your own — and every "Refine" click asks a coding agent to review the selected transition against the [transitions.dev](https://transitions.dev) motion tokens and suggest token-aligned values (or a whole-transition replacement from the library).
4
+
5
+ The feedback shows up **in a panel that slides in from the right** — not in your chat — and you pick which suggestions to apply. Applied suggestions are **live overrides** (instant preview, reversible) — the same path as dragging the timeline bars.
6
+
7
+ Inspired by the [impeccable.style](https://impeccable.style/live-mode/) "live" pattern: the browser drops a job in a tiny local relay, and the relay answers it with **one agent run per click**. No standing loop, nothing to start per click — you just keep the relay running.
8
+
9
+ ```
10
+ [Refine click] → POST /jobs → relay ──one run──► answer
11
+ [right panel] ← GET /jobs/:id ← relay ◄── suggestions
12
+ ```
13
+
14
+ ## Use it
15
+
16
+ ```bash
17
+ # inject the panel + start the relay (deterministic suggestions work immediately)
18
+ npx transitions-refine live
19
+
20
+ # remove the injected <script> tag again
21
+ npx transitions-refine stop
22
+ ```
23
+
24
+ `live` sets everything up with no install and no edits of your own:
25
+
26
+ 1. injects one `<script type="module" src=".../inject.js">` into your page (it looks for `index.html`, `public/index.html`, … or pass `--page <path>`),
27
+ 2. drops the `refine-live` + `transitions-dev` skills into `.agents/skills/` (so the agent makes token-aware picks),
28
+ 3. starts the local relay (which serves the panel at `/inject.js`).
29
+
30
+ Open your app — the panel is now on the page. Press Ctrl-C to stop the relay and remove the injected tag.
31
+
32
+ ## LLM quality (recommended)
33
+
34
+ The default answerer snaps each value to the nearest motion token. For *usage-aware* picks (a 300 ms modal close → `Quick` 150 ms, a dropdown open → `Fast` 250 ms), back the panel with an LLM. Two ways:
35
+
36
+ ```bash
37
+ # A) persistent: install/wire the Cursor CLI so the relay answers LLM jobs itself,
38
+ # per click, with no /refine live loop to keep alive (one-time CLI install)
39
+ npx transitions-refine live --llm
40
+ ```
41
+
42
+ After `--llm`, make sure the CLI is authenticated once: run `cursor-agent` to log in, or set `CURSOR_API_KEY`.
43
+
44
+ ```
45
+ # B) in-IDE agent: run this in your editor to become the answerer yourself
46
+ /refine live
47
+ ```
48
+
49
+ You can also point the relay at any one-shot agent CLI via `REFINE_AGENT_CMD` (the relay feeds it the prompt on stdin and reads a JSON result from stdout):
50
+
51
+ ```bash
52
+ REFINE_AGENT_CMD='cursor-agent -p' npm run relay # or: codex exec - | claude -p
53
+ ```
54
+
55
+ The CLI must have the `transitions-dev` skill available (the prompt tells it to read the skill).
56
+
57
+ ## Refine modes
58
+
59
+ - **Small refinements** — keeps the transition, suggests motion-token tweaks (duration/easing), and may add a whole-transition replacement when one clearly fits better.
60
+ - **Replace transition** — only whole-transition replacements from the transitions.dev library (no token tweaks). This path needs the agent; the deterministic answerer will tell you to switch to the LLM.
61
+
62
+ ## Pieces
63
+
64
+ | Piece | File | Role |
65
+ |-------|------|------|
66
+ | CLI | `bin/cli.mjs` | inject the panel, drop skills, optionally install the Cursor CLI, start the relay |
67
+ | Relay (answers jobs) | `server/relay.mjs` | job queue + CORS + one-run-per-job dispatch; serves `/inject.js` |
68
+ | Injected UI | `server/inject.mjs` + `demo.html` | builds the browser module (timeline + Refine panel) with absolute esm.sh imports |
69
+ | Motion tokens | `server/motion-tokens.mjs` | token table + the nearest-token deterministic fallback |
70
+ | External poller (optional) | `server/refine-agent.mjs` | standing no-LLM poller for `REFINE_AUTO=0` mode |
71
+ | Skill (live agent) | `.agents/skills/refine-live/` | turns `/refine live` into the relay's answerer |
72
+
73
+ ## Knobs
74
+
75
+ | Env / global | Default | Purpose |
76
+ |--------------|---------|---------|
77
+ | `REFINE_RELAY_PORT` | `7331` | relay port |
78
+ | `REFINE_AGENT_CMD` | — | one-shot LLM CLI the relay spawns per job |
79
+ | `REFINE_AGENT_TIMEOUT_MS` | `120000` | per-run timeout |
80
+ | `REFINE_AUTO=0` | — | disable auto-answer and wait for an external poller |
81
+ | `window.REFINE_RELAY_URL` | injected origin | browser override for the relay URL |
82
+
83
+ Endpoints: `POST /jobs`, `GET /jobs/:id` (browser). In `REFINE_AUTO=0` mode an external poller also uses `GET /jobs/next` and `POST /jobs/:id/{status,result,error}`.
84
+
85
+ Writing a value back to your source is a separate, explicit step (treat it like a normal edit / `transitions apply`).
86
+
87
+ ## License
88
+
89
+ MIT