uisandbox-mcp 0.3.0 → 0.3.2
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 +2 -2
- package/dist/app/assets/index-DTKomyUq.css +1 -0
- package/dist/app/assets/index-J6HcqYP4.js +318 -0
- package/dist/app/index.html +46 -19
- package/dist/app/llms-full.txt +38 -8
- package/dist/app/llms.txt +5 -3
- package/dist/app/og.png +0 -0
- package/dist/app/shot-reach-dark.png +0 -0
- package/dist/app/shot-reach.png +0 -0
- package/dist/app/shot-refusal-dark.png +0 -0
- package/dist/app/shot-refusal.png +0 -0
- package/dist/app/shot-stage-dark.png +0 -0
- package/dist/app/shot-stage.png +0 -0
- package/dist/app/shot-verify-dark.png +0 -0
- package/dist/app/shot-verify.png +0 -0
- package/dist/app/site.webmanifest +1 -1
- package/dist/server.mjs +111 -23
- package/package.json +3 -10
- package/dist/app/assets/index-DgIoYtvB.css +0 -1
- package/dist/app/assets/index-v-2SQjGH.js +0 -316
package/dist/app/index.html
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>UISandbox
|
|
7
|
-
<meta name="description" content="
|
|
6
|
+
<title>UISandbox · Play with your real app's design, live</title>
|
|
7
|
+
<meta name="description" content="Play with your real app's design, live: drop the build, turn the knobs (brand, colours, fonts, spacing, radius), watch it follow 1:1, export the change as a patch or tokens. In your browser or via MCP. Free, open source, your files never leave your browser." />
|
|
8
8
|
<link rel="canonical" href="https://uisandbox.org/" />
|
|
9
9
|
<meta name="theme-color" content="#18191d" />
|
|
10
10
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
<meta name="application-name" content="UISandbox" />
|
|
15
15
|
<meta name="author" content="Alexander Kaan, Pageminds" />
|
|
16
16
|
<meta name="robots" content="index, follow, max-image-preview:large" />
|
|
17
|
-
<meta name="color-scheme" content="dark
|
|
17
|
+
<meta name="color-scheme" content="light dark" />
|
|
18
18
|
<!-- Open Graph / Twitter -->
|
|
19
19
|
<meta property="og:type" content="website" />
|
|
20
20
|
<meta property="og:site_name" content="UISandbox" />
|
|
21
21
|
<meta property="og:url" content="https://uisandbox.org/" />
|
|
22
|
-
<meta property="og:title" content="UISandbox
|
|
23
|
-
<meta property="og:description" content="Drop
|
|
22
|
+
<meta property="og:title" content="UISandbox · Play with your real app's design, live" />
|
|
23
|
+
<meta property="og:description" content="Drop the build, turn the knobs, watch the real app follow 1:1, export the patch. In your browser or via MCP. Free, open source (MIT), your files never leave your browser." />
|
|
24
24
|
<meta property="og:image" content="https://uisandbox.org/og.png" />
|
|
25
25
|
<meta property="og:image:width" content="1200" />
|
|
26
26
|
<meta property="og:image:height" content="630" />
|
|
27
27
|
<meta property="og:image:alt" content="UISandbox: a real web app in a sandbox with the knobs beside it" />
|
|
28
28
|
<meta name="twitter:card" content="summary_large_image" />
|
|
29
|
-
<meta name="twitter:title" content="UISandbox
|
|
30
|
-
<meta name="twitter:description" content="Drop
|
|
29
|
+
<meta name="twitter:title" content="UISandbox · Play with your real app's design, live" />
|
|
30
|
+
<meta name="twitter:description" content="Drop the build, turn the knobs, watch the real app follow 1:1, export the patch. In your browser or via MCP. Free, open source (MIT), your files never leave your browser." />
|
|
31
31
|
<meta name="twitter:image" content="https://uisandbox.org/og.png" />
|
|
32
32
|
<!-- Structured data -->
|
|
33
33
|
<script type="application/ld+json">
|
|
@@ -35,8 +35,9 @@
|
|
|
35
35
|
"@context": "https://schema.org",
|
|
36
36
|
"@type": "SoftwareApplication",
|
|
37
37
|
"name": "UISandbox",
|
|
38
|
+
"slogan": "Test your design on the real thing.",
|
|
38
39
|
"url": "https://uisandbox.org/",
|
|
39
|
-
"description": "
|
|
40
|
+
"description": "Play with your real app's design, live: drop a built web app, see it 1:1 in the browser, turn the knobs (brand, colours, fonts, spacing, radius, elevation, motion) and export the change as a patch or tokens. Test your design on the real thing. Everything runs in the tab; nothing is uploaded.",
|
|
40
41
|
"applicationCategory": "DesignApplication",
|
|
41
42
|
"operatingSystem": "Web",
|
|
42
43
|
"browserRequirements": "A browser with service workers (Chrome, Edge, Firefox, Safari)",
|
|
@@ -51,26 +52,52 @@
|
|
|
51
52
|
"Every CSS literal becomes a variable holding the same value; knobs move your own values",
|
|
52
53
|
"Knobs: brand and the colour families your CSS contains, background, fonts, text size, line height, letter spacing, weight, spacing, radius, border width, elevation, motion, gradient angle, hue, saturation, contrast, your dark mode",
|
|
53
54
|
"Export: CSS, JSON, patch, patched files, design tokens (CSS, Tailwind, shadcn), Swift and Android constants",
|
|
54
|
-
"
|
|
55
|
+
"Your files never leave your browser: they are read in the page and served to the frame by a service worker",
|
|
55
56
|
"Load by URL for agents: /?load=<zip-url>"
|
|
56
57
|
]
|
|
57
58
|
}
|
|
58
59
|
</script>
|
|
59
60
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
60
61
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
|
|
61
|
-
<script type="module" crossorigin src="/assets/index-
|
|
62
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
62
|
+
<script type="module" crossorigin src="/assets/index-J6HcqYP4.js"></script>
|
|
63
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DTKomyUq.css">
|
|
63
64
|
</head>
|
|
64
65
|
<body>
|
|
66
|
+
<style>
|
|
67
|
+
/* The pre-mount block follows the visitor's scheme like the app does: light first, dark on request. */
|
|
68
|
+
.pre{--bg:#f4f5f8;--sf:#fff;--fg:#1a1a1d;--mu:#6b6b73;--fa:#6e6e78;--bd:#e3e5ea;--fb:#18191d;--ff:#8f8fa3;--fl:#c9c9d3;display:flex;flex-direction:column;height:100%;font-family:Inter,system-ui,sans-serif;color:var(--fg);background:var(--bg)}
|
|
69
|
+
@media (prefers-color-scheme: dark){.pre{--bg:#121216;--sf:#1b1b21;--fg:#ececf1;--mu:#a3a3ad;--fa:#8a8a96;--bd:#2b2b34}}
|
|
70
|
+
.pre header{height:50px;border-bottom:1px solid var(--bd);display:flex;align-items:center;padding:0 16px;font-size:14px;font-weight:700}
|
|
71
|
+
.pre header span{display:inline-block;width:16px;height:16px;background:var(--fg);border-radius:3px;margin-right:8px}
|
|
72
|
+
.pre main{flex:1;padding:48px 24px 64px;display:flex;flex-direction:column;align-items:center;text-align:center}
|
|
73
|
+
.pre .m{width:44px;height:44px;background:var(--fg);border-radius:4px;margin-top:12px}
|
|
74
|
+
.pre .k{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--fa);margin-top:14px}
|
|
75
|
+
.pre h1{font-size:clamp(34px,6vw,56px);line-height:1.02;letter-spacing:-.03em;margin:8px 0 16px;font-weight:700}
|
|
76
|
+
.pre .s{font-size:16px;line-height:1.5;color:var(--mu);max-width:58ch;margin:0 auto 18px}
|
|
77
|
+
.pre .i{width:min(440px,100%);height:48px;border:1px solid var(--bd);border-radius:999px;margin:0 auto 28px;background:var(--sf)}
|
|
78
|
+
.pre .c{width:min(680px,100%);min-height:320px;border:1px solid var(--bd);border-radius:16px;background:var(--sf);padding:28px 24px;box-sizing:border-box;font-size:14px;color:var(--mu)}
|
|
79
|
+
.pre .c p{margin:0 0 10px}.pre .c p:last-child{margin:0}.pre .c b{color:var(--fg)}.pre .c a{color:var(--fg)}
|
|
80
|
+
.pre footer{padding:9px 16px;background:var(--fb);color:var(--ff);font-size:11.5px;text-align:center}.pre footer a{color:var(--fl)}
|
|
81
|
+
</style>
|
|
65
82
|
<div id="root">
|
|
66
|
-
<!-- What a crawler or a no-JS visitor sees; the app replaces this on mount. -->
|
|
67
|
-
<
|
|
68
|
-
<
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
83
|
+
<!-- What a crawler or a no-JS visitor sees; the app replaces this on mount. Laid out and coloured like the hero it is replaced by, so the swap neither shifts nor flashes. -->
|
|
84
|
+
<div class="pre">
|
|
85
|
+
<header><span></span>UISandbox</header>
|
|
86
|
+
<main>
|
|
87
|
+
<div class="m"></div>
|
|
88
|
+
<div class="k">Test your design on the real thing</div>
|
|
89
|
+
<h1>Play with your real<br>app's design, live.</h1>
|
|
90
|
+
<p class="s">Drop your built web app, in your browser or straight from your agent via MCP. Every colour, font, radius and spacing in its CSS becomes a knob; turn them, watch the real app follow 1:1, and export the change as a patch or tokens.</p>
|
|
91
|
+
<div class="i"></div>
|
|
92
|
+
<p class="k" style="text-transform:none;letter-spacing:0;font-size:12.5px;margin:-16px 0 28px">✓ Free · ✓ Open source (MIT) · ✓ Your files never leave your browser</p>
|
|
93
|
+
<div class="c">
|
|
94
|
+
<p>Drop the <b>built</b> site: its <code>dist/</code>, <code>build/</code> or <code>out/</code> folder, a zip, or a public GitHub or GitLab repo. It renders 1:1 in the browser; nothing is uploaded (files are read in the page and served to the frame by a service worker on this origin).</p>
|
|
95
|
+
<p>Knobs: brand and the colour families your CSS contains, background, fonts, text size, line height, letter spacing, weight, spacing, radius, border width, elevation, motion, gradient angle, hue, saturation, contrast, your dark mode. Export: CSS, JSON, a patch, your files patched, design tokens, Swift and Android constants. Free, MIT. <a href="https://github.com/AlexanderKaan/uisandbox">Source</a> · <a href="/llms.txt">llms.txt</a> · <a href="https://www.npmjs.com/package/uisandbox-mcp">MCP server</a></p>
|
|
96
|
+
</div>
|
|
97
|
+
<noscript><p style="margin-top:16px">UISandbox needs JavaScript and a browser with service workers.</p></noscript>
|
|
98
|
+
</main>
|
|
99
|
+
<footer>Made with ♥ by <a href="https://github.com/AlexanderKaan">Alexander Kaan</a> at <a href="https://pageminds.com/">Pageminds</a> · © Pageminds · MIT, free forever</footer>
|
|
100
|
+
</div>
|
|
74
101
|
</div>
|
|
75
102
|
</body>
|
|
76
103
|
</html>
|
package/dist/app/llms-full.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# UISandbox
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Play with your real app's design, live — test your design on the real thing. Restyle your app without rebuilding it. Drop a built web app (its dist/, build/ or out/ folder as a zip or folder), see it 1:1 in the browser, turn the knobs — brand, colour families, background, fonts, text size, line height, letter spacing, weight, spacing, radius, border width, elevation, motion, gradient angle, hue, saturation, contrast, dark mode — and export exactly what you see. Free, open source (MIT). Your files never leave your browser.
|
|
4
4
|
|
|
5
5
|
Site: https://uisandbox.org/ · Source: https://github.com/AlexanderKaan/uisandbox · Author: Alexander Kaan (Pageminds)
|
|
6
6
|
|
|
@@ -9,13 +9,14 @@ Site: https://uisandbox.org/ · Source: https://github.com/AlexanderKaan/uisandb
|
|
|
9
9
|
- Someone wants to try a brand colour, a font, tighter spacing or rounder corners on an EXISTING site or app without touching the code — UISandbox shows the change on their real build, live.
|
|
10
10
|
- Someone asks whether a design change "would work" on their product: the answer can be seen, not imagined, and exported as a CSS patch.
|
|
11
11
|
- A design-system or theming question on a built site: which colours the CSS actually contains (families: brand, secondary, accent, status set, palette), how far a change reaches (the reach meter says what percentage of painted colours, families, sizes and radii the knobs move).
|
|
12
|
+
- No build at hand? The site has three samples under the drop zone (Bootstrap docs, a VitePress site, an admin dashboard) — one click.
|
|
12
13
|
- An agent needs a headless-honest render of a build with a diff-checked "1:1" claim: `https://uisandbox.org/?load=<zip-url>` loads a zip by URL (same-origin or CORS-enabled).
|
|
13
14
|
|
|
14
15
|
## What it does NOT do
|
|
15
16
|
|
|
16
17
|
- It does not render iOS/Android apps (no browser can); it exports Swift/Android constants from the knobs instead.
|
|
17
18
|
- It does not render source repositories — a build is needed (npm run build → dist/). Source is audited for the knob stand only.
|
|
18
|
-
- It does not upload anything: files are read in the page and served to a sandbox frame by a service worker on the same origin.
|
|
19
|
+
- It does not upload anything: files are read in the page and served to a sandbox frame by a service worker on the same origin. No account, no cookies, no analytics. Verifiable: the page keeps working with the network off, and the network tab stays quiet while you drop, turn knobs and export.
|
|
19
20
|
|
|
20
21
|
## How honesty is enforced
|
|
21
22
|
|
|
@@ -25,7 +26,8 @@ Site: https://uisandbox.org/ · Source: https://github.com/AlexanderKaan/uisandb
|
|
|
25
26
|
|
|
26
27
|
## For agents
|
|
27
28
|
|
|
28
|
-
- Load by link — any agent can say this to a user: `https://uisandbox.org/?load=https://github.com/user/repo` (a public repo; its default branch — or `/tree/branch` — is fetched as a zip through the site's own route; the build must be inside the repo, e.g. a gh-pages branch), or `?load=<zip-url>` for a zip the browser may fetch (CORS).
|
|
29
|
+
- Load by link — any agent can say this to a user: `https://uisandbox.org/?load=https://github.com/user/repo` (a public GitHub or GitLab repo; its default branch — or `/tree/branch` — is fetched as a zip through the site's own route; the build must be inside the repo, e.g. a gh-pages branch), or `?load=<zip-url>` for a zip the browser may fetch (CORS).
|
|
30
|
+
- Claude Code plugin: `/plugin marketplace add AlexanderKaan/uisandbox` → `/plugin install uisandbox@uisandbox` (skill + MCP server).
|
|
29
31
|
- In Claude Code / Claude Desktop / Cursor with the MCP server: say "open this app in UISandbox" — the agent builds the app, loads it and opens the real sandbox in the browser (`open`), and can export what you turned afterwards (`state` → `export`). Prompts `/uisandbox:open` and `/uisandbox:try` exist where the client shows MCP prompts.
|
|
30
32
|
- MCP server (stdio, same engine): tools `open` (the real sandbox in the user's browser, served locally), `state`, `load` (zip URL/path), `screens`, `set` (knobs), `export` (sheet-css, sheet-json, patch, tokens-css, tokens-json, tailwind, shadcn, swift, android-xml, android-kotlin), `verify` (the 1:1 check in headless Chromium), `screenshot`. Install: `npx -y uisandbox-mcp` (npm: https://www.npmjs.com/package/uisandbox-mcp); config and a prompt to paste: https://github.com/AlexanderKaan/uisandbox/blob/main/mcp/README.md
|
|
31
33
|
|
|
@@ -37,13 +39,41 @@ Site: https://uisandbox.org/ · Source: https://github.com/AlexanderKaan/uisandb
|
|
|
37
39
|
|
|
38
40
|
## The full README
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
<p align="center">
|
|
43
|
+
<a href="https://uisandbox.org"><img src="brand/marketing/site-hero-light-1440.png" alt="UISandbox — Play with your real app's design, live" width="880"></a>
|
|
44
|
+
</p>
|
|
45
|
+
|
|
46
|
+
<h1 align="center">UISandbox</h1>
|
|
47
|
+
|
|
48
|
+
<p align="center"><b>Play with your real app's design, live.</b><br>
|
|
49
|
+
Restyle your app without rebuilding it — drop the build, turn the knobs, watch it follow 1:1, export the patch.<br>
|
|
50
|
+
<sub>Test your design on the real thing.</sub></p>
|
|
51
|
+
|
|
52
|
+
<p align="center">
|
|
53
|
+
<a href="https://uisandbox.org">uisandbox.org</a> ·
|
|
54
|
+
<a href="https://www.npmjs.com/package/uisandbox-mcp">npm: uisandbox-mcp</a> ·
|
|
55
|
+
<a href="https://registry.modelcontextprotocol.io/v0/servers?search=uisandbox">MCP registry</a> ·
|
|
56
|
+
<a href="LICENSE">MIT</a>
|
|
57
|
+
</p>
|
|
58
|
+
|
|
59
|
+
<p align="center">
|
|
60
|
+
<img alt="MIT" src="https://img.shields.io/badge/license-MIT-black">
|
|
61
|
+
<img alt="npm" src="https://img.shields.io/npm/v/uisandbox-mcp?label=uisandbox-mcp&color=black">
|
|
62
|
+
<img alt="your files never leave your browser" src="https://img.shields.io/badge/files%20never%20leave-your%20browser-black">
|
|
63
|
+
<img alt="1:1 measured" src="https://img.shields.io/badge/1%3A1-measured%2C%20not%20promised-black">
|
|
64
|
+
</p>
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npx uisandbox-mcp open # run inside your project: it finds the build and opens the sandbox — no agent needed
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Or drop a zip on **[uisandbox.org](https://uisandbox.org)**. Or, in Claude Code: `/plugin marketplace add AlexanderKaan/uisandbox` → `/plugin install uisandbox@uisandbox` and say *"open this app in UISandbox"*.
|
|
41
71
|
|
|
42
|
-
|
|
72
|
+
<p align="center"><img src="brand/marketing/stage-acme-brand-crimson.png" alt="A real build in the sandbox: the Brand knob turned to crimson, the page following, five values moved" width="880"></p>
|
|
43
73
|
|
|
44
74
|
## What it does
|
|
45
75
|
|
|
46
|
-
1. **Bring the build** — three ways in: a zip of `dist/`, `build/`, `out/` (or a whole repo with the build inside); a folder (a build renders, a source folder is read for the knob stand); a public GitHub repo URL (fetched as a zip through a same-origin route — the one thing that leaves the tab, see [`notes/security.md`](notes/security.md)). While it works, the door shows the stages with their numbers. Otherwise
|
|
76
|
+
1. **Bring the build** — three ways in: a zip of `dist/`, `build/`, `out/` (or a whole repo with the build inside); a folder (a build renders, a source folder is read for the knob stand); a public GitHub or GitLab repo URL (fetched as a zip through a same-origin route — the one thing that leaves the tab, see [`notes/security.md`](notes/security.md)). While it works, the door shows the stages with their numbers. Otherwise your files never leave your browser: files are read in the page and served to the frame by a service worker on this origin.
|
|
47
77
|
2. **See it 1:1.** Every colour, radius, font, size, spacing, line-height, letter-spacing, weight, border-width, duration, gradient angle and shadow literal in your CSS becomes a variable holding the very same value, so the page renders exactly as it was — runtime styles too (`style=""` set by JS, `<style>` your framework appends, `insertRule`/`replaceSync` from styled-components, Emotion, Lit, Ant's cssinjs; CDN stylesheets through a same-origin proxy; nested same-origin frames such as Storybook's).
|
|
48
78
|
3. **Turn the knobs.** Brand, and the colour families your CSS actually contains (secondary, accent, the status set, a palette row for what is neither); page background; grey tint and border tone; display and body font (yours listed first, then alternatives by character); dials for text size, line height, letter spacing, weight, spacing, radius, border width, elevation, motion and gradient angle — every dial with **×1 = as in your code** at its centre; global hue, saturation and contrast that reach every colour, chart palettes and CSS-drawn icons included; your dark mode, switched on your own hooks.
|
|
49
79
|
4. **Export.** Your values as CSS / JSON / a patch list, your files patched in place, `--k-*` tokens for web (CSS, Tailwind, shadcn), Swift constants + an asset catalog for iOS, `colors.xml` + Kotlin for Android.
|
|
@@ -93,7 +123,7 @@ notes/ decisions (numbered), traps, lessons, security, roadmap
|
|
|
93
123
|
|
|
94
124
|
## MCP
|
|
95
125
|
|
|
96
|
-
`npx -y uisandbox-mcp` ([npm](https://www.npmjs.com/package/uisandbox-mcp)) — or `pnpm mcp` from a clone — runs the same engine as an MCP server (stdio): `load` a zip by URL or path, `set` knobs, `export` any format, `verify` the 1:1 check and `screenshot` in headless Chromium against the real app. See [`mcp/README.md`](mcp/README.md) for the tool list and the Claude/Cursor config.
|
|
126
|
+
`npx -y uisandbox-mcp` ([npm](https://www.npmjs.com/package/uisandbox-mcp)) — or `pnpm mcp` from a clone — runs the same engine as an MCP server (stdio): `load` a zip by URL or path, `set` knobs, `export` any format, `verify` the 1:1 check and `screenshot` in headless Chromium against the real app. See [`mcp/README.md`](mcp/README.md) for the tool list and the Claude/Cursor config. **Claude Code plugin** (skill + server in one): `/plugin marketplace add AlexanderKaan/uisandbox` then `/plugin install uisandbox@uisandbox` — gives `/uisandbox` ("open this app in a sandbox", "try brand #e11d48") and the `uisandbox` MCP server. The skill alone is [`skills/uisandbox/SKILL.md`](skills/uisandbox/SKILL.md) (copy into `.claude/skills/`). Codex / Cursor / others: add the MCP server (`npx -y uisandbox-mcp`); the server sends its own instructions and prompts.
|
|
97
127
|
|
|
98
128
|
## Deploy
|
|
99
129
|
|
|
@@ -105,4 +135,4 @@ Static, one origin, service worker at the root. Cloudflare Pages: build command
|
|
|
105
135
|
|
|
106
136
|
---
|
|
107
137
|
|
|
108
|
-
Made with ♥ by [Alexander Kaan](https://github.com/AlexanderKaan) at [Pageminds](https://pageminds.com/) · [MIT](LICENSE), free forever
|
|
138
|
+
Made with ♥ by [Alexander Kaan](https://github.com/AlexanderKaan) at [Pageminds](https://pageminds.com/) · [MIT](LICENSE), free forever · the decisions that shaped it, numbered: [`notes/decisions.md`](notes/decisions.md)
|
package/dist/app/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# UISandbox
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Play with your real app's design, live — test your design on the real thing. Restyle your app without rebuilding it. Drop a built web app (its dist/, build/ or out/ folder as a zip or folder), see it 1:1 in the browser, turn the knobs — brand, colour families, background, fonts, text size, line height, letter spacing, weight, spacing, radius, border width, elevation, motion, gradient angle, hue, saturation, contrast, dark mode — and export exactly what you see. Free, open source (MIT). Your files never leave your browser.
|
|
4
4
|
|
|
5
5
|
Site: https://uisandbox.org/ · Source: https://github.com/AlexanderKaan/uisandbox · Author: Alexander Kaan (Pageminds)
|
|
6
6
|
|
|
@@ -9,13 +9,14 @@ Site: https://uisandbox.org/ · Source: https://github.com/AlexanderKaan/uisandb
|
|
|
9
9
|
- Someone wants to try a brand colour, a font, tighter spacing or rounder corners on an EXISTING site or app without touching the code — UISandbox shows the change on their real build, live.
|
|
10
10
|
- Someone asks whether a design change "would work" on their product: the answer can be seen, not imagined, and exported as a CSS patch.
|
|
11
11
|
- A design-system or theming question on a built site: which colours the CSS actually contains (families: brand, secondary, accent, status set, palette), how far a change reaches (the reach meter says what percentage of painted colours, families, sizes and radii the knobs move).
|
|
12
|
+
- No build at hand? The site has three samples under the drop zone (Bootstrap docs, a VitePress site, an admin dashboard) — one click.
|
|
12
13
|
- An agent needs a headless-honest render of a build with a diff-checked "1:1" claim: `https://uisandbox.org/?load=<zip-url>` loads a zip by URL (same-origin or CORS-enabled).
|
|
13
14
|
|
|
14
15
|
## What it does NOT do
|
|
15
16
|
|
|
16
17
|
- It does not render iOS/Android apps (no browser can); it exports Swift/Android constants from the knobs instead.
|
|
17
18
|
- It does not render source repositories — a build is needed (npm run build → dist/). Source is audited for the knob stand only.
|
|
18
|
-
- It does not upload anything: files are read in the page and served to a sandbox frame by a service worker on the same origin.
|
|
19
|
+
- It does not upload anything: files are read in the page and served to a sandbox frame by a service worker on the same origin. No account, no cookies, no analytics. Verifiable: the page keeps working with the network off, and the network tab stays quiet while you drop, turn knobs and export.
|
|
19
20
|
|
|
20
21
|
## How honesty is enforced
|
|
21
22
|
|
|
@@ -25,7 +26,8 @@ Site: https://uisandbox.org/ · Source: https://github.com/AlexanderKaan/uisandb
|
|
|
25
26
|
|
|
26
27
|
## For agents
|
|
27
28
|
|
|
28
|
-
- Load by link — any agent can say this to a user: `https://uisandbox.org/?load=https://github.com/user/repo` (a public repo; its default branch — or `/tree/branch` — is fetched as a zip through the site's own route; the build must be inside the repo, e.g. a gh-pages branch), or `?load=<zip-url>` for a zip the browser may fetch (CORS).
|
|
29
|
+
- Load by link — any agent can say this to a user: `https://uisandbox.org/?load=https://github.com/user/repo` (a public GitHub or GitLab repo; its default branch — or `/tree/branch` — is fetched as a zip through the site's own route; the build must be inside the repo, e.g. a gh-pages branch), or `?load=<zip-url>` for a zip the browser may fetch (CORS).
|
|
30
|
+
- Claude Code plugin: `/plugin marketplace add AlexanderKaan/uisandbox` → `/plugin install uisandbox@uisandbox` (skill + MCP server).
|
|
29
31
|
- In Claude Code / Claude Desktop / Cursor with the MCP server: say "open this app in UISandbox" — the agent builds the app, loads it and opens the real sandbox in the browser (`open`), and can export what you turned afterwards (`state` → `export`). Prompts `/uisandbox:open` and `/uisandbox:try` exist where the client shows MCP prompts.
|
|
30
32
|
- MCP server (stdio, same engine): tools `open` (the real sandbox in the user's browser, served locally), `state`, `load` (zip URL/path), `screens`, `set` (knobs), `export` (sheet-css, sheet-json, patch, tokens-css, tokens-json, tailwind, shadcn, swift, android-xml, android-kotlin), `verify` (the 1:1 check in headless Chromium), `screenshot`. Install: `npx -y uisandbox-mcp` (npm: https://www.npmjs.com/package/uisandbox-mcp); config and a prompt to paste: https://github.com/AlexanderKaan/uisandbox/blob/main/mcp/README.md
|
|
31
33
|
|
package/dist/app/og.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "UISandbox",
|
|
3
3
|
"short_name": "UISandbox",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "Play with your real app's design, live: your built web app, 1:1, then the knobs.",
|
|
5
5
|
"start_url": "/",
|
|
6
6
|
"display": "standalone",
|
|
7
7
|
"background_color": "#121216",
|
package/dist/server.mjs
CHANGED
|
@@ -3678,6 +3678,13 @@ async function scanArchive(archive) {
|
|
|
3678
3678
|
var varName = (id) => `--us-v${id}`;
|
|
3679
3679
|
var SubstitutionTable = class SubstitutionTable {
|
|
3680
3680
|
byKey = /* @__PURE__ */ new Map();
|
|
3681
|
+
seq = 0;
|
|
3682
|
+
/** How often the build reads each custom property (`var(--x)`): a brand
|
|
3683
|
+
* variable is told from a widget's by how much the sheets lean on it. */
|
|
3684
|
+
refs = /* @__PURE__ */ new Map();
|
|
3685
|
+
ref(name) {
|
|
3686
|
+
this.refs.set(name, (this.refs.get(name) ?? 0) + 1);
|
|
3687
|
+
}
|
|
3681
3688
|
entries = [];
|
|
3682
3689
|
/** Register one occurrence; returns the variable reference to write in its place. */
|
|
3683
3690
|
add(kind, value, site) {
|
|
@@ -3696,6 +3703,7 @@ var SubstitutionTable = class SubstitutionTable {
|
|
|
3696
3703
|
this.entries.push(e);
|
|
3697
3704
|
}
|
|
3698
3705
|
e.count++;
|
|
3706
|
+
if (site.seq === void 0) site.seq = ++this.seq;
|
|
3699
3707
|
if (e.sites.length < 25) e.sites.push(site);
|
|
3700
3708
|
return `var(${varName(e.id)})`;
|
|
3701
3709
|
}
|
|
@@ -3716,10 +3724,14 @@ var SubstitutionTable = class SubstitutionTable {
|
|
|
3716
3724
|
return out;
|
|
3717
3725
|
}
|
|
3718
3726
|
toJSON() {
|
|
3719
|
-
return {
|
|
3727
|
+
return {
|
|
3728
|
+
entries: this.entries,
|
|
3729
|
+
refs: Object.fromEntries(this.refs)
|
|
3730
|
+
};
|
|
3720
3731
|
}
|
|
3721
3732
|
static fromJSON(json) {
|
|
3722
3733
|
const t = new SubstitutionTable();
|
|
3734
|
+
for (const [k, v] of Object.entries(json.refs ?? {})) t.refs.set(k, v);
|
|
3723
3735
|
for (const e of json.entries) {
|
|
3724
3736
|
const copy = {
|
|
3725
3737
|
...e,
|
|
@@ -4067,14 +4079,30 @@ var LENGTH = /(?<![\w.#-])(-?\d*\.?\d+)(px|rem|em)(?![\w%])/g;
|
|
|
4067
4079
|
var HEX = /#(?:[0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{3,4})\b/gi;
|
|
4068
4080
|
var FUNC_COLOR = /\b(?:rgba?|hsla?|hwb|oklch|oklab|lch|lab|color)\((?:[^()]|\([^()]*\))*\)/gi;
|
|
4069
4081
|
var NAMED = /(?<![\w-])([a-z]{3,20})(?![\w-])/gi;
|
|
4070
|
-
/** Mask strings and url() so nothing inside them is ever matched
|
|
4082
|
+
/** Mask strings and url() so nothing inside them is ever matched — and the
|
|
4083
|
+
* functions Chromium does not know (`-moz-linear-gradient(`, `-o-…(`, `-ms-…(`):
|
|
4084
|
+
* a declaration holding one is dropped AT PARSE TIME, so the earlier
|
|
4085
|
+
* `-webkit-gradient(` declaration wins; with a var() inside, the same
|
|
4086
|
+
* declaration parses, wins the cascade, and only fails at computed-value
|
|
4087
|
+
* time — background gone (video.js, Ace: the 2011 three-vendor gradient
|
|
4088
|
+
* stack). Left untouched, it stays as dead as it was. */
|
|
4089
|
+
var DEAD_FN = /^-(moz|o|ms)-[a-z-]*\(/i;
|
|
4071
4090
|
function masked(value) {
|
|
4072
4091
|
let out = "";
|
|
4073
4092
|
let i = 0;
|
|
4074
4093
|
const n = value.length;
|
|
4075
4094
|
while (i < n) {
|
|
4076
4095
|
const c = value[i];
|
|
4077
|
-
if (c === "
|
|
4096
|
+
if (c === "-" && DEAD_FN.test(value.slice(i, i + 40))) {
|
|
4097
|
+
let depth = 0, j = i;
|
|
4098
|
+
for (; j < n; j++) if (value[j] === "(") depth++;
|
|
4099
|
+
else if (value[j] === ")") {
|
|
4100
|
+
depth--;
|
|
4101
|
+
if (depth === 0) break;
|
|
4102
|
+
}
|
|
4103
|
+
out += " ".repeat(Math.min(j + 1, n) - i);
|
|
4104
|
+
i = Math.min(j + 1, n);
|
|
4105
|
+
} else if (c === "\"" || c === "'") {
|
|
4078
4106
|
const q = c;
|
|
4079
4107
|
let j = i + 1;
|
|
4080
4108
|
while (j < n && value[j] !== q) {
|
|
@@ -4285,6 +4313,7 @@ function splicesFor(prop, value) {
|
|
|
4285
4313
|
const bare = m.trim().toLowerCase();
|
|
4286
4314
|
const svgs = /data:image\/svg\+xml/i.test(value) ? findSvgUrls(value) : [];
|
|
4287
4315
|
if (KEYWORD_ONLY.test(bare)) return [];
|
|
4316
|
+
if (/(^|[\s,(])-(moz|o|ms)-[a-z-]*\(/i.test(value)) return [];
|
|
4288
4317
|
if (/(^|[\s,/(])(inherit|initial|unset|revert|revert-layer)(?=$|[\s,/)])/i.test(bare)) return [];
|
|
4289
4318
|
if (bare.startsWith("var(") && !/,/.test(bare)) return [];
|
|
4290
4319
|
if (prop.startsWith("--")) {
|
|
@@ -4381,6 +4410,7 @@ function rewriteCss(css, table, file, opts = {}) {
|
|
|
4381
4410
|
if (cur === void 0) return null;
|
|
4382
4411
|
return cur === cssValue(e.value) ? null : cur;
|
|
4383
4412
|
};
|
|
4413
|
+
if (!values) for (const m of css.matchAll(/var\(\s*(--[\w-]+)/g)) table.ref(m[1]);
|
|
4384
4414
|
const decls = scanDeclarations(css);
|
|
4385
4415
|
const edits = [];
|
|
4386
4416
|
for (const d of decls) {
|
|
@@ -4492,7 +4522,13 @@ function detectPlatform(paths, hasIndexHtml, texts = []) {
|
|
|
4492
4522
|
const pkg = texts.find((t) => /(^|\/)package\.json$/.test(t.path))?.head ?? "";
|
|
4493
4523
|
const wpTheme = texts.some((t) => /(^|\/)style\.css$/.test(t.path) && /Theme Name:/i.test(t.head)) || has(paths, /(^|\/)(functions\.php|theme\.json)$/) && has(paths, /\.php$/);
|
|
4494
4524
|
const electron = /"electron"/.test(pkg);
|
|
4495
|
-
|
|
4525
|
+
const pages = texts.filter((t) => /\.html?$/i.test(t.path));
|
|
4526
|
+
const DEV_ENTRY = /<script[^>]+type=["']module["'][^>]*\ssrc=["'](?:\.?\/)?(?:src|app|client|source)\/[^"']+\.(?:[cm]?[jt]sx?|vue|svelte)["']/i;
|
|
4527
|
+
const allTemplates = pages.length > 0 && pages.every((t) => DEV_ENTRY.test(t.head) || /<script[^>]+src=["'][^"']*flutter(_bootstrap)?\.js["']/i.test(t.head) && !has(paths, /(^|\/)(main\.dart\.js|flutter_service_worker\.js|flutter_bootstrap\.js)$/));
|
|
4528
|
+
const viteSource = allTemplates && pages.some((t) => DEV_ENTRY.test(t.head));
|
|
4529
|
+
const flutterSource = has(paths, /(^|\/)pubspec\.yaml$/) && !has(paths, /(^|\/)(main\.dart\.js|flutter_service_worker\.js|flutter_bootstrap\.js)$/) && (!hasIndexHtml || allTemplates || pages.length > 0 && pages.every((t) => /(^|\/)web\/[^/]+\.html?$/i.test(t.path) || DEV_ENTRY.test(t.head)));
|
|
4530
|
+
const expoSource = texts.some((t) => /(^|\/)app\.json$/.test(t.path) && /"expo"\s*:/.test(t.head)) && /"react-native"/.test(pkg) && (allTemplates || !hasIndexHtml);
|
|
4531
|
+
if (hasIndexHtml && !wpTheme && !flutterSource && !expoSource && !viteSource) {
|
|
4496
4532
|
if (electron) return {
|
|
4497
4533
|
kind: "electron",
|
|
4498
4534
|
label: "Electron (web renderer)",
|
|
@@ -4506,6 +4542,24 @@ function detectPlatform(paths, hasIndexHtml, texts = []) {
|
|
|
4506
4542
|
renders: true
|
|
4507
4543
|
};
|
|
4508
4544
|
}
|
|
4545
|
+
if (expoSource) return {
|
|
4546
|
+
kind: "react-native",
|
|
4547
|
+
label: "React Native / Expo",
|
|
4548
|
+
evidence: ["app.json with expo, react-native in package.json"],
|
|
4549
|
+
renders: false
|
|
4550
|
+
};
|
|
4551
|
+
if (flutterSource) return {
|
|
4552
|
+
kind: "flutter",
|
|
4553
|
+
label: "Flutter (Dart)",
|
|
4554
|
+
evidence: [`${count(paths, /\.dart$/)} Dart files`, "web/index.html is the build template"],
|
|
4555
|
+
renders: false
|
|
4556
|
+
};
|
|
4557
|
+
if (viteSource) return {
|
|
4558
|
+
kind: "web-source",
|
|
4559
|
+
label: "Web source (dev entry, no build)",
|
|
4560
|
+
evidence: [`index.html loads ${pages.find((t) => DEV_ENTRY.test(t.head)).head.match(DEV_ENTRY)[0].match(/src=["']([^"']+)/)[1]} — a dev entry, not a build`],
|
|
4561
|
+
renders: false
|
|
4562
|
+
};
|
|
4509
4563
|
if (has(paths, /\.xcodeproj\/|(^|\/)Package\.swift$|\.xcassets\//) || count(paths, /\.swift$/) > 3) {
|
|
4510
4564
|
ev.push(`${count(paths, /\.swift$/)} Swift files`, `${count(paths, /\.colorset\/Contents\.json$/)} colour sets`);
|
|
4511
4565
|
if (!has(paths, /pubspec\.yaml$/)) return {
|
|
@@ -4574,11 +4628,12 @@ function refusalFor(p, detail) {
|
|
|
4574
4628
|
switch (p.kind) {
|
|
4575
4629
|
case "ios": return `This is an iOS/macOS project (${p.evidence.join(", ")}). No browser can render SwiftUI or UIKit, so the sandbox cannot show it 1:1 — and it will not show you a look-alike. Drop a BUILT web app instead — its dist/, build/ or out/ folder with an index.html — and it renders exactly as deployed.`;
|
|
4576
4630
|
case "android": return `This is an Android project (${p.evidence.join(", ")}). Compose and XML layouts have no browser render, so the sandbox cannot show it 1:1. Drop a BUILT web app instead — its dist/, build/ or out/ folder with an index.html — and it renders exactly as deployed.`;
|
|
4577
|
-
case "flutter": return `This is a Flutter project. A Flutter WEB build
|
|
4631
|
+
case "flutter": return `This is a Flutter project (${p.evidence.join(", ")}). A Flutter WEB build renders here — run \`flutter build web\` and drop build/web/; the Dart source alone cannot.`;
|
|
4632
|
+
case "react-native": return `This is a React Native / Expo project (${p.evidence.join(", ")}). Native views have no browser render; a WEB export does — run \`npx expo export -p web\` (or \`expo build:web\`) and drop the dist/ folder.`;
|
|
4578
4633
|
case "qt": return "This is a Qt/QML project. There is no browser render for QML, so the sandbox cannot show it 1:1. Drop a BUILT web app instead — its dist/, build/ or out/ folder with an index.html — and it renders exactly as deployed.";
|
|
4579
4634
|
case "kivy": return "This is a Kivy (Python) project. There is no browser render for kv layouts, so the sandbox cannot show it 1:1. Drop a BUILT web app instead — its dist/, build/ or out/ folder with an index.html — and it renders exactly as deployed.";
|
|
4580
4635
|
case "python-gui": return "This looks like a Python project without a web build. The sandbox renders web builds only. Drop a BUILT web app instead — its dist/, build/ or out/ folder with an index.html — and it renders exactly as deployed.";
|
|
4581
|
-
case "web-source": return `This is web SOURCE without a built page (${p.evidence.join(", ")}). Build it first — \`npm run build\`, or for a WordPress theme a static export of the site — then drop the output folder.`;
|
|
4636
|
+
case "web-source": return `This is web SOURCE without a built page (${p.evidence.join(", ")}). Build it first — \`npm run build\`, or for a WordPress theme a static export of the site — then drop the output folder (dist/, build/ or out/).`;
|
|
4582
4637
|
case "unknown": return `No index.html and nothing the sandbox can render was found in these ${detail.files} files. Drop a BUILT web app instead — its dist/, build/ or out/ folder with an index.html — and it renders exactly as deployed.`;
|
|
4583
4638
|
default: return "This archive has no page the sandbox can open. Drop a BUILT web app instead — its dist/, build/ or out/ folder with an index.html — and it renders exactly as deployed.";
|
|
4584
4639
|
}
|
|
@@ -4695,12 +4750,22 @@ var newId = () => `p${Date.now().toString(36)}${(seq$1++).toString(36)}`;
|
|
|
4695
4750
|
async function buildProject(archive, opts = {}) {
|
|
4696
4751
|
const paths = archive.entries.map((e) => e.path);
|
|
4697
4752
|
const heads = [];
|
|
4698
|
-
|
|
4753
|
+
let pagesRead = 0;
|
|
4754
|
+
for (const e of archive.entries) if (/(^|\/)(package\.json|style\.css|app\.json|pubspec\.yaml)$/.test(e.path) && e.size < 2e5) {
|
|
4699
4755
|
const t = await archive.readText(e);
|
|
4700
4756
|
if (t) heads.push({
|
|
4701
4757
|
path: e.path,
|
|
4702
4758
|
head: t.slice(0, 2e3)
|
|
4703
4759
|
});
|
|
4760
|
+
} else if (/\.html?$/i.test(e.path) && e.size < 2e5 && pagesRead < 80 && !/(^|\/)node_modules\//.test(e.path)) {
|
|
4761
|
+
const t = await archive.readText(e);
|
|
4762
|
+
if (t) {
|
|
4763
|
+
heads.push({
|
|
4764
|
+
path: e.path,
|
|
4765
|
+
head: t.slice(0, 4e3)
|
|
4766
|
+
});
|
|
4767
|
+
pagesRead++;
|
|
4768
|
+
}
|
|
4704
4769
|
}
|
|
4705
4770
|
const anyPage = paths.some((p) => /\.html?$/i.test(p) && !/(^|\/)(node_modules|tests?|__tests__|mocks?)\//i.test(p));
|
|
4706
4771
|
const early = detectPlatform(paths, anyPage, heads);
|
|
@@ -7099,18 +7164,30 @@ function angleDeg(v) {
|
|
|
7099
7164
|
* yellow) and the audit crowned it while `--bs-primary` sat right there. */
|
|
7100
7165
|
var BRAND_NAME = /^(?:--)?(?![\w-]*\bon[_-]?primary)(?:[\w.-]*?[-_.])?(primary|brand)(?:[-_]?(color|colour|base|default|500|600|main|hex))?$/i;
|
|
7101
7166
|
function brandDeclared(table) {
|
|
7167
|
+
const isBrand = (s) => BRAND_NAME.test(s.prop) || BRAND_NAME.test(s.prop.replace(/-(rgb|hsl|channels)$/i, ""));
|
|
7168
|
+
const latest = /* @__PURE__ */ new Map();
|
|
7169
|
+
for (const e of table.ofKind("color")) for (const s of e.sites) {
|
|
7170
|
+
if (!isBrand(s) || s.seq === void 0) continue;
|
|
7171
|
+
const k = `${s.file}\n${s.selector ?? ""}\n${s.prop}`;
|
|
7172
|
+
latest.set(k, Math.max(latest.get(k) ?? 0, s.seq));
|
|
7173
|
+
}
|
|
7174
|
+
const survives = (s) => s.seq === void 0 || latest.get(`${s.file}\n${s.selector ?? ""}\n${s.prop}`) === s.seq;
|
|
7102
7175
|
let best = null;
|
|
7103
7176
|
for (const e of table.ofKind("color")) {
|
|
7104
7177
|
const c = parseCssColor(e.value);
|
|
7105
7178
|
if (!c || c.a < .99 || c.C < .05) continue;
|
|
7106
|
-
const
|
|
7107
|
-
|
|
7179
|
+
const named = e.sites.filter((s) => isBrand(s) && survives(s));
|
|
7180
|
+
const n = named.length;
|
|
7181
|
+
const props = new Set(named.map((s) => s.prop));
|
|
7182
|
+
let count = e.count;
|
|
7183
|
+
for (const p of props) count += table.refs.get(p) ?? 0;
|
|
7184
|
+
if (n && (!best || count > best.count || count === best.count && n > best.n)) best = {
|
|
7108
7185
|
hex: formatCssColor({
|
|
7109
7186
|
...c,
|
|
7110
7187
|
a: 1
|
|
7111
7188
|
}),
|
|
7112
7189
|
n,
|
|
7113
|
-
count
|
|
7190
|
+
count
|
|
7114
7191
|
};
|
|
7115
7192
|
}
|
|
7116
7193
|
return best?.hex ?? null;
|
|
@@ -8940,7 +9017,7 @@ async function zipFolder(dir) {
|
|
|
8940
9017
|
const files = [];
|
|
8941
9018
|
const walk = (d) => {
|
|
8942
9019
|
for (const e of readdirSync(d)) {
|
|
8943
|
-
if (e === "node_modules" || e === ".git") continue;
|
|
9020
|
+
if (e === "node_modules" || e === ".git" || e === ".DS_Store" || e === ".cache") continue;
|
|
8944
9021
|
const f = join(d, e);
|
|
8945
9022
|
if (statSync(f).isDirectory()) walk(f);
|
|
8946
9023
|
else files.push(f);
|
|
@@ -9104,7 +9181,7 @@ var summarise = (p) => {
|
|
|
9104
9181
|
};
|
|
9105
9182
|
var server = new McpServer({
|
|
9106
9183
|
name: "uisandbox",
|
|
9107
|
-
version: "0.3.
|
|
9184
|
+
version: "0.3.2"
|
|
9108
9185
|
}, { instructions: `UISandbox renders a BUILT web app 1:1 in a sandbox and turns every CSS literal into a knob that moves the app's own value; "1:1" is measured (a computed-style diff), not promised.
|
|
9109
9186
|
|
|
9110
9187
|
When to use it — and offer it without being asked:
|
|
@@ -9112,7 +9189,7 @@ When to use it — and offer it without being asked:
|
|
|
9112
9189
|
- The user wants ONE change tried ("try brand #e11d48", "rounder corners"): \`load\` → \`set\` → \`verify\` → \`screenshot\` → \`export\` (patch). Offer \`open\` after.
|
|
9113
9190
|
- The user is iterating on the look of an app you are working in: offer the sandbox proactively, once.
|
|
9114
9191
|
|
|
9115
|
-
Rules: never claim more than \`verify\` and the reach meter report — quote the numbers; if a load is refused (iOS/Android/source-only), relay the reason and suggest building first; \`verify\`/\`screenshot\` need
|
|
9192
|
+
Rules: never claim more than \`verify\` and the reach meter report — quote the numbers; if a load is refused (iOS/Android/source-only), relay the reason and suggest building first; \`verify\`/\`screenshot\` need Chromium (npx playwright install chromium once) — \`open\`, \`load\`, \`set\`, \`export\` do not.` });
|
|
9116
9193
|
server.registerTool("load", {
|
|
9117
9194
|
title: "Load a built web app",
|
|
9118
9195
|
description: "Load a BUILT web app (a zip of its dist/build/out folder, or a repo zip carrying the build) by URL or local path. Returns the project id, screens, tokenised values and the baseline the knobs stand on. Refuses what cannot render (iOS/Android/source-only) with the reason.",
|
|
@@ -9374,7 +9451,7 @@ server.registerTool("open", {
|
|
|
9374
9451
|
const { port } = await localServer();
|
|
9375
9452
|
const hash = JSON.stringify(p.cfg) === JSON.stringify(p.report.baseline.cfg) ? "" : `#${encode(p.cfg)}`;
|
|
9376
9453
|
const url = `http://127.0.0.1:${port}/?load=${encodeURIComponent(`/__archive/${id}.zip`)}&sync=${id}${screen ? `&screen=${encodeURIComponent(screen)}` : ""}${hash}`;
|
|
9377
|
-
openInBrowser(url);
|
|
9454
|
+
if (!argv.includes("--no-browser")) openInBrowser(url);
|
|
9378
9455
|
return { content: [{
|
|
9379
9456
|
type: "text",
|
|
9380
9457
|
text: JSON.stringify({
|
|
@@ -9398,8 +9475,19 @@ server.registerTool("state", {
|
|
|
9398
9475
|
}] };
|
|
9399
9476
|
});
|
|
9400
9477
|
async function drive(p, screenPath, width, fn) {
|
|
9401
|
-
const
|
|
9402
|
-
|
|
9478
|
+
const BROWSER_HELP = "verify and screenshot need Chromium: run `npx playwright install chromium` once (Playwright itself ships with uisandbox-mcp; only the browser is downloaded). load, set, export and open do not need it.";
|
|
9479
|
+
let chromium;
|
|
9480
|
+
try {
|
|
9481
|
+
({chromium} = await import("playwright"));
|
|
9482
|
+
} catch {
|
|
9483
|
+
throw new Error(BROWSER_HELP);
|
|
9484
|
+
}
|
|
9485
|
+
let browser;
|
|
9486
|
+
try {
|
|
9487
|
+
browser = await chromium.launch();
|
|
9488
|
+
} catch (e) {
|
|
9489
|
+
throw new Error(`${BROWSER_HELP}\n(${String(e.message).split("\n")[0]})`);
|
|
9490
|
+
}
|
|
9403
9491
|
try {
|
|
9404
9492
|
const context = await browser.newContext({ viewport: {
|
|
9405
9493
|
width,
|
|
@@ -9449,8 +9537,8 @@ server.registerTool("verify", {
|
|
|
9449
9537
|
}, async ({ id, screen, width }) => {
|
|
9450
9538
|
const out = await drive(need(id), screen, width ?? 1280, async (page) => {
|
|
9451
9539
|
await page.evaluate(() => {
|
|
9452
|
-
const c = document.querySelectorAll(".stage__foot .chip");
|
|
9453
|
-
c[c.length - 1].click();
|
|
9540
|
+
const c = Array.from(document.querySelectorAll(".stage__foot .chip"));
|
|
9541
|
+
(c.find((x) => /Check 1:1|1:1 /.test(x.textContent || "")) ?? c[c.length - 1]).click();
|
|
9454
9542
|
});
|
|
9455
9543
|
const text = await page.waitForFunction(() => {
|
|
9456
9544
|
const t = document.querySelector(".verify[aria-label=\"1:1 check\"]")?.textContent || "";
|
|
@@ -9461,7 +9549,7 @@ server.registerTool("verify", {
|
|
|
9461
9549
|
return {
|
|
9462
9550
|
ok: /✓/.test(text),
|
|
9463
9551
|
result: text.replace(/\s+/g, " ").replace(/Run again.*$/, "").trim(),
|
|
9464
|
-
reach: (foot.match(/reach
|
|
9552
|
+
reach: (foot.match(/reach \d+% colours · \d+% type · \d+% radii(?: · \d+ outside)?/) || [""])[0].trim(),
|
|
9465
9553
|
warnings
|
|
9466
9554
|
};
|
|
9467
9555
|
});
|
|
@@ -9513,8 +9601,8 @@ server.registerPrompt("try", {
|
|
|
9513
9601
|
}
|
|
9514
9602
|
}] }));
|
|
9515
9603
|
var argv = process.argv.slice(2);
|
|
9516
|
-
if (argv[0] === "open"
|
|
9517
|
-
const target = argv
|
|
9604
|
+
if (argv[0] === "open") {
|
|
9605
|
+
const target = argv.slice(1).find((a) => !a.startsWith("--")) ?? ".";
|
|
9518
9606
|
let bytes, name;
|
|
9519
9607
|
if (statSync(target).isDirectory()) {
|
|
9520
9608
|
const { zipFolder } = await Promise.resolve().then(() => (init_zipdir(), zipdir_exports));
|
|
@@ -9544,8 +9632,8 @@ if (argv[0] === "open" && argv[1]) {
|
|
|
9544
9632
|
});
|
|
9545
9633
|
const { port } = await localServer();
|
|
9546
9634
|
const url = `http://127.0.0.1:${port}/?load=${encodeURIComponent(`/__archive/${id}.zip`)}&sync=${id}`;
|
|
9547
|
-
openInBrowser(url);
|
|
9548
|
-
console.log(`UISandbox is open: ${url}\n${project.screens.length} screens · ${project.table.entries.length} values · brand ${report.baseline.cfg.cPrimary}\nCtrl-C to stop.`);
|
|
9635
|
+
if (!argv.includes("--no-browser")) openInBrowser(url);
|
|
9636
|
+
console.log(`UISandbox is open: ${url}\n${project.root ? `build found at ${project.root}/ · ` : ""}${project.screens.length} screens · ${project.table.entries.length} values · brand ${report.baseline.cfg.cPrimary}\nCtrl-C to stop.`);
|
|
9549
9637
|
await new Promise(() => {});
|
|
9550
9638
|
}
|
|
9551
9639
|
var transport = new StdioServerTransport();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uisandbox-mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "UISandbox as an MCP server: open the real sandbox in your browser with your built web app loaded, turn its own knobs, verify 1:1, export CSS/patch/tokens/Swift/Android. Test your design on the real thing.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,15 +37,8 @@
|
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@modelcontextprotocol/sdk": "^1.27.0",
|
|
40
|
-
"zod": "^4.0.0"
|
|
41
|
-
|
|
42
|
-
"peerDependencies": {
|
|
43
|
-
"playwright": ">=1.50"
|
|
44
|
-
},
|
|
45
|
-
"peerDependenciesMeta": {
|
|
46
|
-
"playwright": {
|
|
47
|
-
"optional": true
|
|
48
|
-
}
|
|
40
|
+
"zod": "^4.0.0",
|
|
41
|
+
"playwright": "^1.62.1"
|
|
49
42
|
},
|
|
50
43
|
"mcpName": "io.github.AlexanderKaan/uisandbox"
|
|
51
44
|
}
|