phation 0.1.0 → 0.1.1
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/README.md +69 -101
- package/package.json +13 -3
- package/server.json +36 -0
- package/animate/testset/eval.mjs +0 -24
- package/animate/testset/expected.json +0 -23
- package/animate/testset/holdout/commerce-delete-item-button.tsx +0 -38
- package/animate/testset/holdout/commerce-gallery.tsx +0 -96
- package/animate/testset/holdout/commerce-tile.tsx +0 -50
- package/animate/testset/holdout/shadcn-button-group-demo.tsx +0 -114
- package/animate/testset/holdout/shadcn-card-demo.tsx +0 -63
- package/animate/testset/holdout/shadcn-command-dialog.tsx +0 -87
- package/animate/testset/holdout/shadcn-drawer-dialog.tsx +0 -90
- package/animate/testset/holdout/shadcn-field-switch.tsx +0 -24
- package/animate/testset/holdout/shadcn-hover-card-demo.tsx +0 -40
- package/animate/testset/holdout/shadcn-mode-toggle.tsx +0 -40
- package/animate/testset/holdout/shadcn-toggle-group-demo.tsx +0 -22
- package/animate/testset/holdout.json +0 -14
- package/animate/testset/holdout2/chatbot-artifact-close-button.tsx +0 -30
- package/animate/testset/holdout2/chatbot-message-actions.tsx +0 -211
- package/animate/testset/holdout2/chatbot-sidebar-history-item.tsx +0 -132
- package/animate/testset/holdout2/chatbot-sidebar-toggle.tsx +0 -35
- package/animate/testset/holdout2/chatbot-suggested-actions.tsx +0 -82
- package/animate/testset/holdout2/chatbot-weather.tsx +0 -434
- package/animate/testset/holdout2/site-code-tabs.tsx +0 -26
- package/animate/testset/holdout2/site-copy-button.tsx +0 -121
- package/animate/testset/holdout2/site-github-link.tsx +0 -38
- package/animate/testset/holdout2/site-mobile-nav.tsx +0 -220
- package/animate/testset/holdout2/site-mode-switcher.tsx +0 -97
- package/animate/testset/holdout2/site-page-nav.tsx +0 -15
- package/animate/testset/holdout2.json +0 -15
- package/animate/testset/screens/commerce-cart-add-to-cart.tsx +0 -94
- package/animate/testset/screens/commerce-cart-modal.tsx +0 -256
- package/animate/testset/screens/commerce-navbar-mobile-menu.tsx +0 -104
- package/animate/testset/screens/commerce-product-variant-selector.tsx +0 -106
- package/animate/testset/screens/shadcn-accordion-demo.tsx +0 -61
- package/animate/testset/screens/shadcn-alert-dialog-demo.tsx +0 -35
- package/animate/testset/screens/shadcn-card-with-form.tsx +0 -59
- package/animate/testset/screens/shadcn-collapsible-demo.tsx +0 -46
- package/animate/testset/screens/shadcn-dialog-demo.tsx +0 -50
- package/animate/testset/screens/shadcn-drawer-demo.tsx +0 -136
- package/animate/testset/screens/shadcn-login-form.tsx +0 -71
- package/animate/testset/screens/shadcn-nav-main.tsx +0 -73
- package/animate/testset/screens/shadcn-section-cards.tsx +0 -102
- package/animate/testset/screens/shadcn-sheet-demo.tsx +0 -47
- package/animate/testset/screens/shadcn-switch-demo.tsx +0 -11
- package/animate/testset/screens/shadcn-tabs-demo.tsx +0 -80
- package/animate/testset/screens/taxonomy-main-nav.tsx +0 -61
- package/animate/testset/screens/taxonomy-post-item.tsx +0 -42
- package/animate/testset/screens/taxonomy-pricing.tsx +0 -69
- package/animate/testset/screens/taxonomy-user-account-nav.tsx +0 -65
package/README.md
CHANGED
|
@@ -1,100 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/pnhathuy09/phation/main/media/before-after.gif" alt="The same prompt, run by a default agent (41/100) and by an agent with Phation (100/100)" width="860">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
Phation
|
|
5
|
+
<h1 align="center">Phation</h1>
|
|
6
|
+
<p align="center"><b>Give your AI taste in motion.</b><br>
|
|
7
|
+
Ready-made interactions and motion rules for your coding agent, so the motion it writes is right the first time, not the fifth.</p>
|
|
8
|
+
<p align="center"><a href="https://phation.app">phation.app</a> · <a href="https://github.com/pnhathuy09/phation">GitHub</a> · <a href="#mcp-tools">MCP tools</a> · <a href="#the-phation-standard">Standard</a></p>
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# Claude Code
|
|
9
|
-
claude mcp add phation -- npx -y phation mcp
|
|
10
|
-
# Cursor / Windsurf / VS Code: { "command": "npx", "args": ["-y", "phation", "mcp"] }
|
|
11
|
-
# No agent
|
|
12
|
-
npx phation search "price counter"
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Free and Pro
|
|
16
|
-
|
|
17
|
-
| Free | Pro (https://phation.app/pricing) |
|
|
18
|
-
|---|---|
|
|
19
|
-
| `list`, `search`, `show`: every motion's spec and MOTION values | `add`: the component source written into your project |
|
|
20
|
-
| `standard`, `init`: the Phation Standard rules for your agent | `get_motion` with `code: true` |
|
|
21
|
-
| | `audit`, `animate` |
|
|
22
|
-
|
|
23
|
-
Pro uses the license key from your Polar receipt email:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npx phation login <license-key> # saved to ~/.config/phation/license.json
|
|
27
|
-
# or, for CI / an agent config: PHATION_KEY=<license-key>
|
|
28
|
-
npx phation whoami
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
The package ships no component source. With a key, `add` fetches it from phation.app/api/source and the demo media from phation.app.
|
|
32
|
-
|
|
33
|
-
## Tools (MCP)
|
|
34
|
-
|
|
35
|
-
| Tool | What it does |
|
|
36
|
-
|---|---|
|
|
37
|
-
| `search_motions` | Find entries by what they should do or feel like ("calm bottom sheet", "make the price feel alive") |
|
|
38
|
-
| `list_motions` | Every entry, optionally for one category |
|
|
39
|
-
| `get_motion` | Spec, `MOTION` values, dependencies and media of one entry (~200 tokens). `code: true` adds the full source |
|
|
40
|
-
| `add_motion` | Copy the component (and its images) into the project. Never overwrites unless `force`. `from` = a Studio share link: its tuned values are written into the file's `MOTION` object |
|
|
41
|
-
| `animate_ui` | Animate the user's own screens: names each part of a .jsx/.tsx file or folder (button, card, sheet, modal, tabs, toggle, list, number…), maps it to a recipe under one Feel. Plan by default; `apply: true` writes `<file>.animated.tsx` (`write: true` in place) with one `MOTION` object, `data-phation` hooks and `<MotionConfig reducedMotion="user">`, then lists the `audit_motion` actions. CLI: `phation animate <path> [--feel] [--only] [--role 12=button] [--apply] [--write]` |
|
|
42
|
-
|
|
43
|
-
The server also sends instructions: search → `add_motion` (the file is written to disk, never retyped) → edit only `MOTION`, copy and styles → `audit_motion`.
|
|
44
|
-
|
|
45
|
-
## Token budget
|
|
10
|
+
<p align="center"><a href="https://glama.ai/mcp/servers/pnhathuy09/phation"><img src="https://glama.ai/mcp/servers/pnhathuy09/phation/badges/score.svg" alt="pnhathuy09/phation MCP server"></a></p>
|
|
46
11
|
|
|
47
|
-
|
|
12
|
+
---
|
|
48
13
|
|
|
49
|
-
|
|
50
|
-
|---|---|---|
|
|
51
|
-
| Rules loaded every session (AGENTS.md block) | 3.3k | 0.8k (core only; full standard in `.phation/STANDARD.md`, read by section) |
|
|
52
|
-
| Server instructions + tool schemas | 1.9k | 1.5k |
|
|
53
|
-
| `search_motions` | 0.7k | 0.2k (one line + one sentence per hit, 4 hits) |
|
|
54
|
-
| `get_motion` | 1.8k (full source) | 0.2k (spec + `MOTION`; `code: true` for the source) |
|
|
55
|
-
| `get_standard` (no section) | 3.2k (everything) | 0.6k (core; a section or `all` on request) |
|
|
56
|
-
| `audit_motion` | report + raw JSON | report only (`json: true` adds it) |
|
|
57
|
-
| `animate_ui` plan (new, 2026-11-18) | n/a | ~16 tokens a part (13-part cart screen: ~210); apply returns the changed lines only |
|
|
58
|
-
| Code the model types | ~1.5k (whole file) | ~0.1k (`add_motion` writes the file; only `MOTION` is edited) |
|
|
59
|
-
| **Task total** (without the extra `get_standard` call) | **~9.8k** | **~2.8k** |
|
|
60
|
-
|
|
61
|
-
Re-measure after changing outputs: the script lives in the session scratchpad (`tok.mjs`, MCP client over stdio); keep these numbers in sync with the landing's "Why" section.
|
|
14
|
+
Ask an agent to "animate the add-to-cart flow" and you usually get hard cuts, linear easing, numbers that swap instead of roll, and nothing for reduced motion. Phation gives the agent two things:
|
|
62
15
|
|
|
63
|
-
|
|
16
|
+
- **The Phation Standard**: a short set of motion rules (springs, curves, durations, stagger, accessibility) that the agent loads in every session.
|
|
17
|
+
- **A library of real interactions** it can search, read and drop into your project: React + Motion components with their exact spring and timing values.
|
|
64
18
|
|
|
65
|
-
|
|
19
|
+
It runs as an **MCP server** for Claude Code, Cursor, Codex, Windsurf and VS Code, and as a **CLI**.
|
|
66
20
|
|
|
67
|
-
##
|
|
21
|
+
## Install
|
|
68
22
|
|
|
69
23
|
```bash
|
|
70
|
-
cd motion-library/mcp && npm install
|
|
71
|
-
|
|
72
24
|
# Claude Code
|
|
73
|
-
claude mcp add phation --
|
|
74
|
-
|
|
75
|
-
# Cursor / Windsurf / VS Code: same command in the tool's MCP config
|
|
76
|
-
# { "command": "node", "args": ["<absolute path>/mcp/bin/server.mjs"] }
|
|
77
|
-
|
|
78
|
-
# CLI
|
|
79
|
-
node bin/cli.mjs search tactile quantity stepper
|
|
80
|
-
node bin/cli.mjs add digit-roll # run from the target project
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Once published, the landing-page snippets work as written: `npx -y phation mcp` for the server, `npx phation add <slug>` for the CLI.
|
|
84
|
-
|
|
85
|
-
Studio share links: tune an entry in the Studio, press Share, then `npx phation add --from "<link>"` (the slug comes from the link). Only the changed values travel in the link (`?digit=s420_32_1&stagger=60`; codec in `share.mjs`, shared with the site). The file gets a `// tuned in Phation Studio: <link>` line above `MOTION`.
|
|
25
|
+
claude mcp add phation -- npx -y phation mcp
|
|
86
26
|
|
|
87
|
-
|
|
27
|
+
# Cursor · Windsurf · VS Code (MCP config)
|
|
28
|
+
{ "command": "npx", "args": ["-y", "phation", "mcp"] }
|
|
88
29
|
|
|
89
|
-
|
|
90
|
-
|
|
30
|
+
# Without an agent
|
|
31
|
+
npx phation search "price counter"
|
|
91
32
|
```
|
|
92
33
|
|
|
93
|
-
|
|
34
|
+
Node 18 or newer.
|
|
94
35
|
|
|
95
|
-
## Phation Standard
|
|
36
|
+
## The Phation Standard
|
|
96
37
|
|
|
97
|
-
|
|
38
|
+
Install the rules once per project. Every animation your agent writes then uses the same curves, springs, durations and accessibility handling.
|
|
98
39
|
|
|
99
40
|
```bash
|
|
100
41
|
npx phation init claude # .claude/skills/phation/SKILL.md + a pointer block in CLAUDE.md
|
|
@@ -103,41 +44,68 @@ npx phation init codex # a marked section in AGENTS.md (your own content is
|
|
|
103
44
|
npx phation init windsurf # .windsurf/rules/phation.md
|
|
104
45
|
npx phation init vscode # .github/instructions/phation.instructions.md
|
|
105
46
|
npx phation init all
|
|
47
|
+
|
|
106
48
|
npx phation standard springs # print one section
|
|
107
49
|
```
|
|
108
50
|
|
|
109
|
-
Re-running `init` updates only Phation's own files and the block between the `phation:start` / `phation:end` markers.
|
|
51
|
+
Re-running `init` updates only Phation's own files and the block between the `phation:start` / `phation:end` markers. The rules are in [`data/standard`](https://github.com/pnhathuy09/phation/tree/main/data/standard).
|
|
52
|
+
|
|
53
|
+
A taste of what is inside: one spring family for the whole product.
|
|
54
|
+
|
|
55
|
+
| Spring | Stiffness · damping | Use for |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| snap | 420 · 32 | Controls |
|
|
58
|
+
| pop | 400 · 20 | Things appearing |
|
|
59
|
+
| soft | 170 · 22 | Surfaces |
|
|
60
|
+
| follow | 420 · 34 | The pointer |
|
|
61
|
+
| bounce | 160 · 14 | Celebrations |
|
|
110
62
|
|
|
111
|
-
|
|
112
|
-
- the tools `get_standard` (whole text or one section) and `install_standard`;
|
|
113
|
-
- the resource `phation://standard`;
|
|
114
|
-
- the prompt `motion_review`.
|
|
63
|
+
## MCP tools
|
|
115
64
|
|
|
116
|
-
|
|
65
|
+
| Tool | What it does |
|
|
66
|
+
|---|---|
|
|
67
|
+
| `get_standard` | The Phation Standard: the core rules, or one section |
|
|
68
|
+
| `install_standard` | Writes the rules into the project for the agent you use |
|
|
69
|
+
| `search_motions` | Finds interactions by what they should do or feel like ("calm bottom sheet", "make the price feel alive") |
|
|
70
|
+
| `list_motions` | Every interaction, optionally for one category |
|
|
71
|
+
| `get_motion` | Spec, `MOTION` values, dependencies and media of one interaction (about 200 tokens) |
|
|
72
|
+
| `add_motion` | Writes the component into your project · Pro |
|
|
73
|
+
| `animate_ui` | Animates your own screens: maps each part of a .jsx/.tsx file to a motion recipe under one Feel · Pro |
|
|
74
|
+
| `audit_motion` | Records a page frame by frame and scores its motion: layout jumps, low contrast, missing reduced motion · Pro |
|
|
117
75
|
|
|
118
|
-
|
|
76
|
+
Outputs are kept small on purpose: a typical "add a rolling price to the cart" task costs about 2.8k tokens end to end.
|
|
119
77
|
|
|
120
|
-
|
|
78
|
+
## CLI
|
|
121
79
|
|
|
122
80
|
```bash
|
|
123
|
-
npx phation
|
|
124
|
-
npx phation
|
|
125
|
-
npx phation
|
|
81
|
+
npx phation list [category] # browse
|
|
82
|
+
npx phation search <words> # find by intent
|
|
83
|
+
npx phation show <slug> # spec + MOTION values
|
|
84
|
+
npx phation init <agent> # install the Standard
|
|
85
|
+
npx phation add <slug> # Pro: write the component into src/motion
|
|
86
|
+
npx phation add --from "<studio link>" # Pro: with the values you tuned in the Studio
|
|
87
|
+
npx phation audit <url> [--do click:#buy] # Pro: score the motion of a page
|
|
88
|
+
npx phation animate <file|folder> # Pro: plan motion for your own screens
|
|
126
89
|
```
|
|
127
90
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
It runs the page three times (timing, trace, and again with `prefers-reduced-motion: reduce`) and reports, with the time, the element and the fix:
|
|
91
|
+
## Free and Pro
|
|
131
92
|
|
|
132
|
-
|
|
|
93
|
+
| Free | Pro |
|
|
133
94
|
|---|---|
|
|
134
|
-
|
|
|
95
|
+
| The Phation Standard and `init` for every agent | `add`: component source written into your project |
|
|
96
|
+
| `list`, `search`, `show`: specs and `MOTION` values | `audit` and `animate` |
|
|
97
|
+
| Explore and tune every interaction live at [phation.app](https://phation.app) | |
|
|
135
98
|
|
|
136
|
-
|
|
99
|
+
This repository contains the CLI, the MCP server and the Standard. **It ships no component source**: with a license, `add` fetches it from phation.app. Plans are at [phation.app/pricing](https://phation.app/pricing).
|
|
137
100
|
|
|
138
|
-
|
|
101
|
+
```bash
|
|
102
|
+
npx phation login <license-key> # saved to ~/.config/phation/license.json
|
|
103
|
+
# or, for CI and agent configs: PHATION_KEY=<license-key>
|
|
104
|
+
npx phation whoami
|
|
105
|
+
```
|
|
139
106
|
|
|
107
|
+
## License
|
|
140
108
|
|
|
141
|
-
|
|
109
|
+
The CLI, the MCP server and the Phation Standard may be installed and used freely; the Standard's text may be used in your own projects. Component source is covered by the Pro license. See [LICENSE.md](https://github.com/pnhathuy09/phation/blob/main/LICENSE.md), [phation.app/license](https://phation.app/license) and [phation.app/terms](https://phation.app/terms).
|
|
142
110
|
|
|
143
|
-
|
|
111
|
+
Made by [Pham Huy](https://phamhuyds.com).
|
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phation",
|
|
3
|
-
"
|
|
3
|
+
"mcpName": "io.github.pnhathuy09/phation",
|
|
4
|
+
"version": "0.1.1",
|
|
4
5
|
"description": "Phation: production-ready interactions for React + Motion, as an MCP server and a CLI.",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
7
8
|
"homepage": "https://phation.app",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/pnhathuy09/phation.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/pnhathuy09/phation/issues"
|
|
15
|
+
},
|
|
8
16
|
"bin": {
|
|
9
17
|
"phation-mcp": "bin/server.mjs",
|
|
10
18
|
"phation": "bin/cli.mjs"
|
|
@@ -16,9 +24,11 @@
|
|
|
16
24
|
"audit.mjs",
|
|
17
25
|
"data/entries.json",
|
|
18
26
|
"data/standard",
|
|
19
|
-
"animate",
|
|
20
27
|
"LICENSE.md",
|
|
21
|
-
"README.md"
|
|
28
|
+
"README.md",
|
|
29
|
+
"animate/*.mjs",
|
|
30
|
+
"animate/core",
|
|
31
|
+
"server.json"
|
|
22
32
|
],
|
|
23
33
|
"engines": {
|
|
24
34
|
"node": ">=18"
|
package/server.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.pnhathuy09/phation",
|
|
4
|
+
"title": "Phation",
|
|
5
|
+
"description": "Motion rules and ready-made React + Motion interactions so your agent's animations feel right.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/pnhathuy09/phation",
|
|
8
|
+
"source": "github"
|
|
9
|
+
},
|
|
10
|
+
"websiteUrl": "https://phation.app",
|
|
11
|
+
"version": "0.1.1",
|
|
12
|
+
"packages": [
|
|
13
|
+
{
|
|
14
|
+
"registryType": "npm",
|
|
15
|
+
"identifier": "phation",
|
|
16
|
+
"version": "0.1.1",
|
|
17
|
+
"transport": {
|
|
18
|
+
"type": "stdio"
|
|
19
|
+
},
|
|
20
|
+
"packageArguments": [
|
|
21
|
+
{
|
|
22
|
+
"type": "positional",
|
|
23
|
+
"value": "mcp"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"environmentVariables": [
|
|
27
|
+
{
|
|
28
|
+
"name": "PHATION_KEY",
|
|
29
|
+
"description": "Phation Pro license key (optional; enables add_motion, audit_motion and animate_ui)",
|
|
30
|
+
"isRequired": false,
|
|
31
|
+
"isSecret": true
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
package/animate/testset/eval.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Detection accuracy on the test set (ANIMATE_SPEC.md §04 "Done when": ≥ 85 % correct roles).
|
|
2
|
-
// node animate/testset/eval.mjs [--holdout] [--v] (--holdout: screens labelled before the rules saw them)
|
|
3
|
-
// correct = a detected (line, role) that is in the labels · wrong = detected but not labelled · missed = labelled, not found.
|
|
4
|
-
// accuracy = correct / (correct + wrong + missed)
|
|
5
|
-
import fs from 'fs'
|
|
6
|
-
import path from 'path'
|
|
7
|
-
import { fileURLToPath } from 'url'
|
|
8
|
-
import { detect } from '../detect.mjs'
|
|
9
|
-
const HERE = path.dirname(fileURLToPath(import.meta.url))
|
|
10
|
-
const set = process.argv.includes('--holdout2') ? ['holdout2.json', 'holdout2'] : process.argv.includes('--holdout') ? ['holdout.json', 'holdout'] : ['expected.json', 'screens']
|
|
11
|
-
const want = JSON.parse(fs.readFileSync(path.join(HERE, set[0]), 'utf8'))
|
|
12
|
-
const verbose = process.argv.includes('--v')
|
|
13
|
-
let c = 0, w = 0, m = 0
|
|
14
|
-
for (const f of Object.keys(want).filter(k => !k.startsWith('_'))) {
|
|
15
|
-
const { parts } = detect(fs.readFileSync(path.join(HERE, set[1], f), 'utf8'))
|
|
16
|
-
const got = new Set(parts.map(p => `${p.line}:${p.role}`))
|
|
17
|
-
const exp = new Set(Object.entries(want[f]).flatMap(([l, rs]) => rs.map(r => `${l}:${r}`)))
|
|
18
|
-
const ok = [...got].filter(x => exp.has(x)), bad = [...got].filter(x => !exp.has(x)), miss = [...exp].filter(x => !got.has(x))
|
|
19
|
-
c += ok.length; w += bad.length; m += miss.length
|
|
20
|
-
if (verbose || bad.length || miss.length) console.log(`${f.padEnd(40)} ${ok.length} ok${bad.length ? ` · wrong ${bad.join(' ')}` : ''}${miss.length ? ` · missed ${miss.join(' ')}` : ''}`)
|
|
21
|
-
}
|
|
22
|
-
const acc = c / (c + w + m)
|
|
23
|
-
console.log(`\n${c} correct · ${w} wrong · ${m} missed → accuracy ${(acc * 100).toFixed(1)} % (precision ${(c / (c + w) * 100).toFixed(1)} %, recall ${(c / (c + m) * 100).toFixed(1)} %)`)
|
|
24
|
-
process.exit(acc >= 0.85 ? 0 : 1)
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_about": "Hand labels for the 20 test screens (real code: shadcn examples/blocks, vercel/commerce, shadcn/taxonomy; fetched 2026-11-18). line → roles a motion designer would treat as parts. Labelled by Claude for Huy; review before trusting the score.",
|
|
3
|
-
"commerce-cart-add-to-cart.tsx": { "24": ["button"], "32": ["button"], "46": ["button"], "85": ["button"] },
|
|
4
|
-
"commerce-cart-modal.tsx": { "52": ["icon-button"], "77": ["sheet"], "80": ["icon-button"], "120": ["list"], "126": ["icon-button"], "166": ["number"], "174": ["icon-button"], "181": ["number"], "184": ["icon-button"], "199": ["number"], "211": ["number"], "219": ["button"], "248": ["button"] },
|
|
5
|
-
"commerce-navbar-mobile-menu.tsx": { "35": ["icon-button"], "64": ["sheet"], "66": ["icon-button"], "82": ["list"] },
|
|
6
|
-
"commerce-product-variant-selector.tsx": { "81": ["button", "list"] },
|
|
7
|
-
"shadcn-accordion-demo.tsx": { "17": ["button"], "18": ["accordion"], "31": ["button"], "32": ["accordion"], "45": ["button"], "46": ["accordion"] },
|
|
8
|
-
"shadcn-alert-dialog-demo.tsx": { "18": ["button"], "20": ["modal"] },
|
|
9
|
-
"shadcn-card-with-form.tsx": { "24": ["card"], "34": ["input"], "39": ["input"], "54": ["button"], "55": ["button"] },
|
|
10
|
-
"shadcn-collapsible-demo.tsx": { "27": ["icon-button"], "36": ["accordion"] },
|
|
11
|
-
"shadcn-dialog-demo.tsx": { "20": ["button"], "22": ["modal"], "33": ["input"], "37": ["input"], "42": ["button"], "44": ["button"] },
|
|
12
|
-
"shadcn-drawer-demo.tsx": { "71": ["button"], "73": ["sheet"], "81": ["icon-button"], "93": ["number"], "99": ["icon-button"], "127": ["button"], "129": ["button"] },
|
|
13
|
-
"shadcn-login-form.tsx": { "25": ["card"], "37": ["input"], "54": ["input"], "57": ["button"], "58": ["button"] },
|
|
14
|
-
"shadcn-nav-main.tsx": { "40": ["list"], "48": ["button"], "54": ["accordion"], "57": ["list"], "58": ["button"] },
|
|
15
|
-
"shadcn-section-cards.tsx": { "16": ["card"], "38": ["card"], "60": ["card"], "80": ["card"] },
|
|
16
|
-
"shadcn-sheet-demo.tsx": { "19": ["button"], "21": ["sheet"], "31": ["input"], "35": ["input"], "39": ["button"], "41": ["button"] },
|
|
17
|
-
"shadcn-switch-demo.tsx": { "7": ["toggle"] },
|
|
18
|
-
"shadcn-tabs-demo.tsx": { "25": ["tabs"], "30": ["card"], "41": ["input"], "45": ["input"], "49": ["button"], "54": ["card"], "65": ["input"], "69": ["input"], "73": ["button"] },
|
|
19
|
-
"taxonomy-main-nav.tsx": { "33": ["nav-link", "list"], "49": ["button"], "57": ["sheet"] },
|
|
20
|
-
"taxonomy-post-item.tsx": {},
|
|
21
|
-
"taxonomy-pricing.tsx": { "22": ["card"], "56": ["button"] },
|
|
22
|
-
"taxonomy-user-account-nav.tsx": { "23": ["icon-button"] }
|
|
23
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { XMarkIcon } from "@heroicons/react/24/outline";
|
|
4
|
-
import { removeItem } from "components/cart/actions";
|
|
5
|
-
import type { CartItem } from "lib/shopify/types";
|
|
6
|
-
import { useActionState } from "react";
|
|
7
|
-
|
|
8
|
-
export function DeleteItemButton({
|
|
9
|
-
item,
|
|
10
|
-
optimisticUpdate,
|
|
11
|
-
}: {
|
|
12
|
-
item: CartItem;
|
|
13
|
-
optimisticUpdate: any;
|
|
14
|
-
}) {
|
|
15
|
-
const [message, formAction] = useActionState(removeItem, null);
|
|
16
|
-
const merchandiseId = item.merchandise.id;
|
|
17
|
-
const removeItemAction = formAction.bind(null, merchandiseId);
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<form
|
|
21
|
-
action={async () => {
|
|
22
|
-
optimisticUpdate(merchandiseId, "delete");
|
|
23
|
-
removeItemAction();
|
|
24
|
-
}}
|
|
25
|
-
>
|
|
26
|
-
<button
|
|
27
|
-
type="submit"
|
|
28
|
-
aria-label="Remove cart item"
|
|
29
|
-
className="flex h-[24px] w-[24px] items-center justify-center rounded-full bg-neutral-500"
|
|
30
|
-
>
|
|
31
|
-
<XMarkIcon className="mx-[1px] h-4 w-4 text-white dark:text-black" />
|
|
32
|
-
</button>
|
|
33
|
-
<p aria-live="polite" className="sr-only" role="status">
|
|
34
|
-
{message}
|
|
35
|
-
</p>
|
|
36
|
-
</form>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { ArrowLeftIcon, ArrowRightIcon } from "@heroicons/react/24/outline";
|
|
4
|
-
import { GridTileImage } from "components/grid/tile";
|
|
5
|
-
import Image from "next/image";
|
|
6
|
-
import { useRouter, useSearchParams } from "next/navigation";
|
|
7
|
-
|
|
8
|
-
export function Gallery({
|
|
9
|
-
images,
|
|
10
|
-
}: {
|
|
11
|
-
images: { src: string; altText: string }[];
|
|
12
|
-
}) {
|
|
13
|
-
const router = useRouter();
|
|
14
|
-
const searchParams = useSearchParams();
|
|
15
|
-
const imageIndex = searchParams.has("image")
|
|
16
|
-
? parseInt(searchParams.get("image")!)
|
|
17
|
-
: 0;
|
|
18
|
-
|
|
19
|
-
const updateImage = (index: string) => {
|
|
20
|
-
const params = new URLSearchParams(searchParams.toString());
|
|
21
|
-
params.set("image", index);
|
|
22
|
-
router.replace(`?${params.toString()}`, { scroll: false });
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const nextImageIndex = imageIndex + 1 < images.length ? imageIndex + 1 : 0;
|
|
26
|
-
const previousImageIndex =
|
|
27
|
-
imageIndex === 0 ? images.length - 1 : imageIndex - 1;
|
|
28
|
-
|
|
29
|
-
const buttonClassName =
|
|
30
|
-
"h-full px-6 transition-all ease-in-out hover:scale-110 hover:text-black dark:hover:text-white flex items-center justify-center";
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<form>
|
|
34
|
-
<div className="relative aspect-square h-full max-h-[550px] w-full overflow-hidden">
|
|
35
|
-
{images[imageIndex] && (
|
|
36
|
-
<Image
|
|
37
|
-
className="h-full w-full object-contain"
|
|
38
|
-
fill
|
|
39
|
-
sizes="(min-width: 1024px) 66vw, 100vw"
|
|
40
|
-
alt={images[imageIndex]?.altText as string}
|
|
41
|
-
src={images[imageIndex]?.src as string}
|
|
42
|
-
priority={true}
|
|
43
|
-
/>
|
|
44
|
-
)}
|
|
45
|
-
|
|
46
|
-
{images.length > 1 ? (
|
|
47
|
-
<div className="absolute bottom-[15%] flex w-full justify-center">
|
|
48
|
-
<div className="mx-auto flex h-11 items-center rounded-full border border-white bg-neutral-50/80 text-neutral-500 backdrop-blur-sm dark:border-black dark:bg-neutral-900/80">
|
|
49
|
-
<button
|
|
50
|
-
formAction={() => updateImage(previousImageIndex.toString())}
|
|
51
|
-
aria-label="Previous product image"
|
|
52
|
-
className={buttonClassName}
|
|
53
|
-
>
|
|
54
|
-
<ArrowLeftIcon className="h-5" />
|
|
55
|
-
</button>
|
|
56
|
-
<div className="mx-1 h-6 w-px bg-neutral-500"></div>
|
|
57
|
-
<button
|
|
58
|
-
formAction={() => updateImage(nextImageIndex.toString())}
|
|
59
|
-
aria-label="Next product image"
|
|
60
|
-
className={buttonClassName}
|
|
61
|
-
>
|
|
62
|
-
<ArrowRightIcon className="h-5" />
|
|
63
|
-
</button>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
) : null}
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
{images.length > 1 ? (
|
|
70
|
-
<ul className="my-12 flex items-center flex-wrap justify-center gap-2 overflow-auto py-1 lg:mb-0">
|
|
71
|
-
{images.map((image, index) => {
|
|
72
|
-
const isActive = index === imageIndex;
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<li key={image.src} className="h-20 w-20">
|
|
76
|
-
<button
|
|
77
|
-
formAction={() => updateImage(index.toString())}
|
|
78
|
-
aria-label="Select product image"
|
|
79
|
-
className="h-full w-full"
|
|
80
|
-
>
|
|
81
|
-
<GridTileImage
|
|
82
|
-
alt={image.altText}
|
|
83
|
-
src={image.src}
|
|
84
|
-
width={80}
|
|
85
|
-
height={80}
|
|
86
|
-
active={isActive}
|
|
87
|
-
/>
|
|
88
|
-
</button>
|
|
89
|
-
</li>
|
|
90
|
-
);
|
|
91
|
-
})}
|
|
92
|
-
</ul>
|
|
93
|
-
) : null}
|
|
94
|
-
</form>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import Image from "next/image";
|
|
3
|
-
import Label from "../label";
|
|
4
|
-
|
|
5
|
-
export function GridTileImage({
|
|
6
|
-
isInteractive = true,
|
|
7
|
-
active,
|
|
8
|
-
label,
|
|
9
|
-
...props
|
|
10
|
-
}: {
|
|
11
|
-
isInteractive?: boolean;
|
|
12
|
-
active?: boolean;
|
|
13
|
-
label?: {
|
|
14
|
-
title: string;
|
|
15
|
-
amount: string;
|
|
16
|
-
currencyCode: string;
|
|
17
|
-
position?: "bottom" | "center";
|
|
18
|
-
};
|
|
19
|
-
} & React.ComponentProps<typeof Image>) {
|
|
20
|
-
return (
|
|
21
|
-
<div
|
|
22
|
-
className={clsx(
|
|
23
|
-
"group flex h-full w-full items-center justify-center overflow-hidden rounded-lg border bg-white hover:border-blue-600 dark:bg-black",
|
|
24
|
-
{
|
|
25
|
-
relative: label,
|
|
26
|
-
"border-2 border-blue-600": active,
|
|
27
|
-
"border-neutral-200 dark:border-neutral-800": !active,
|
|
28
|
-
},
|
|
29
|
-
)}
|
|
30
|
-
>
|
|
31
|
-
{props.src ? (
|
|
32
|
-
<Image
|
|
33
|
-
className={clsx("relative h-full w-full object-contain", {
|
|
34
|
-
"transition duration-300 ease-in-out group-hover:scale-105":
|
|
35
|
-
isInteractive,
|
|
36
|
-
})}
|
|
37
|
-
{...props}
|
|
38
|
-
/>
|
|
39
|
-
) : null}
|
|
40
|
-
{label ? (
|
|
41
|
-
<Label
|
|
42
|
-
title={label.title}
|
|
43
|
-
amount={label.amount}
|
|
44
|
-
currencyCode={label.currencyCode}
|
|
45
|
-
position={label.position}
|
|
46
|
-
/>
|
|
47
|
-
) : null}
|
|
48
|
-
</div>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import {
|
|
5
|
-
ArchiveIcon,
|
|
6
|
-
ArrowLeftIcon,
|
|
7
|
-
CalendarPlusIcon,
|
|
8
|
-
ClockIcon,
|
|
9
|
-
ListFilterIcon,
|
|
10
|
-
MailCheckIcon,
|
|
11
|
-
MoreHorizontalIcon,
|
|
12
|
-
TagIcon,
|
|
13
|
-
Trash2Icon,
|
|
14
|
-
} from "lucide-react"
|
|
15
|
-
|
|
16
|
-
import { Button } from "@/registry/new-york-v4/ui/button"
|
|
17
|
-
import { ButtonGroup } from "@/registry/new-york-v4/ui/button-group"
|
|
18
|
-
import {
|
|
19
|
-
DropdownMenu,
|
|
20
|
-
DropdownMenuContent,
|
|
21
|
-
DropdownMenuGroup,
|
|
22
|
-
DropdownMenuItem,
|
|
23
|
-
DropdownMenuRadioGroup,
|
|
24
|
-
DropdownMenuRadioItem,
|
|
25
|
-
DropdownMenuSeparator,
|
|
26
|
-
DropdownMenuSub,
|
|
27
|
-
DropdownMenuSubContent,
|
|
28
|
-
DropdownMenuSubTrigger,
|
|
29
|
-
DropdownMenuTrigger,
|
|
30
|
-
} from "@/registry/new-york-v4/ui/dropdown-menu"
|
|
31
|
-
|
|
32
|
-
export default function ButtonGroupDemo() {
|
|
33
|
-
const [label, setLabel] = React.useState("personal")
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<ButtonGroup>
|
|
37
|
-
<ButtonGroup className="hidden sm:flex">
|
|
38
|
-
<Button variant="outline" size="icon" aria-label="Go Back">
|
|
39
|
-
<ArrowLeftIcon />
|
|
40
|
-
</Button>
|
|
41
|
-
</ButtonGroup>
|
|
42
|
-
<ButtonGroup>
|
|
43
|
-
<Button variant="outline">Archive</Button>
|
|
44
|
-
<Button variant="outline">Report</Button>
|
|
45
|
-
</ButtonGroup>
|
|
46
|
-
<ButtonGroup>
|
|
47
|
-
<Button variant="outline">Snooze</Button>
|
|
48
|
-
<DropdownMenu>
|
|
49
|
-
<DropdownMenuTrigger asChild>
|
|
50
|
-
<Button variant="outline" size="icon" aria-label="More Options">
|
|
51
|
-
<MoreHorizontalIcon />
|
|
52
|
-
</Button>
|
|
53
|
-
</DropdownMenuTrigger>
|
|
54
|
-
<DropdownMenuContent align="end" className="w-52">
|
|
55
|
-
<DropdownMenuGroup>
|
|
56
|
-
<DropdownMenuItem>
|
|
57
|
-
<MailCheckIcon />
|
|
58
|
-
Mark as Read
|
|
59
|
-
</DropdownMenuItem>
|
|
60
|
-
<DropdownMenuItem>
|
|
61
|
-
<ArchiveIcon />
|
|
62
|
-
Archive
|
|
63
|
-
</DropdownMenuItem>
|
|
64
|
-
</DropdownMenuGroup>
|
|
65
|
-
<DropdownMenuSeparator />
|
|
66
|
-
<DropdownMenuGroup>
|
|
67
|
-
<DropdownMenuItem>
|
|
68
|
-
<ClockIcon />
|
|
69
|
-
Snooze
|
|
70
|
-
</DropdownMenuItem>
|
|
71
|
-
<DropdownMenuItem>
|
|
72
|
-
<CalendarPlusIcon />
|
|
73
|
-
Add to Calendar
|
|
74
|
-
</DropdownMenuItem>
|
|
75
|
-
<DropdownMenuItem>
|
|
76
|
-
<ListFilterIcon />
|
|
77
|
-
Add to List
|
|
78
|
-
</DropdownMenuItem>
|
|
79
|
-
<DropdownMenuSub>
|
|
80
|
-
<DropdownMenuSubTrigger>
|
|
81
|
-
<TagIcon />
|
|
82
|
-
Label As...
|
|
83
|
-
</DropdownMenuSubTrigger>
|
|
84
|
-
<DropdownMenuSubContent>
|
|
85
|
-
<DropdownMenuRadioGroup
|
|
86
|
-
value={label}
|
|
87
|
-
onValueChange={setLabel}
|
|
88
|
-
>
|
|
89
|
-
<DropdownMenuRadioItem value="personal">
|
|
90
|
-
Personal
|
|
91
|
-
</DropdownMenuRadioItem>
|
|
92
|
-
<DropdownMenuRadioItem value="work">
|
|
93
|
-
Work
|
|
94
|
-
</DropdownMenuRadioItem>
|
|
95
|
-
<DropdownMenuRadioItem value="other">
|
|
96
|
-
Other
|
|
97
|
-
</DropdownMenuRadioItem>
|
|
98
|
-
</DropdownMenuRadioGroup>
|
|
99
|
-
</DropdownMenuSubContent>
|
|
100
|
-
</DropdownMenuSub>
|
|
101
|
-
</DropdownMenuGroup>
|
|
102
|
-
<DropdownMenuSeparator />
|
|
103
|
-
<DropdownMenuGroup>
|
|
104
|
-
<DropdownMenuItem variant="destructive">
|
|
105
|
-
<Trash2Icon />
|
|
106
|
-
Trash
|
|
107
|
-
</DropdownMenuItem>
|
|
108
|
-
</DropdownMenuGroup>
|
|
109
|
-
</DropdownMenuContent>
|
|
110
|
-
</DropdownMenu>
|
|
111
|
-
</ButtonGroup>
|
|
112
|
-
</ButtonGroup>
|
|
113
|
-
)
|
|
114
|
-
}
|