@sakaniui/mcp 0.18.2 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/sakaniui-mcp.mjs +16 -3
- package/data/AGENTS.md +14 -0
- package/data/CHANGELOG.md +16 -0
- package/data/dist/emoji-index.json +1 -1
- package/data/dist/icon-index.json +1 -1
- package/data/dist/manifest.json +1041 -255
- package/data/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ Any MCP client (Cursor, Windsurf, Claude Desktop, ...), or a `.mcp.json` in your
|
|
|
35
35
|
and in Claude Code: `claude mcp add sakaniui -- cmd /c npx -y @sakaniui/mcp`.
|
|
36
36
|
|
|
37
37
|
Needs Node.js 18 or later. Check it is connected in your editor's MCP list (in Claude Code: `/mcp`): `sakaniui` should
|
|
38
|
-
show
|
|
38
|
+
show 11 tools.
|
|
39
39
|
|
|
40
40
|
## Tools
|
|
41
41
|
|
|
@@ -71,7 +71,7 @@ npx -y @sakaniui/mcp --doctor
|
|
|
71
71
|
| Times out on the first start | The first run downloads about 200 kB. Run `npx -y @sakaniui/mcp --version` once in a terminal to warm the cache, then restart the editor. |
|
|
72
72
|
| Behind a company proxy or private npm registry | The machine must reach `registry.npmjs.org` (check `npm config get registry`) and `@sakaniui/*` packages must be allowed. |
|
|
73
73
|
| Odd `npx` errors, or an old version keeps running | Delete the `_npx` folder inside your npm cache (find it with `npm config get cache`), then restart the editor. |
|
|
74
|
-
| Added it but no tools appear | Restart the editor. In Claude Code run `/mcp` and look for `sakaniui` with
|
|
74
|
+
| Added it but no tools appear | Restart the editor. In Claude Code run `/mcp` and look for `sakaniui` with 11 tools. |
|
|
75
75
|
| `Failed to connect` after typing the command by hand | Check the package name for a full-width `@` or stray characters; copy the command from here instead. |
|
|
76
76
|
|
|
77
77
|
## Matches your version
|
package/bin/sakaniui-mcp.mjs
CHANGED
|
@@ -727,7 +727,7 @@ const tools = {
|
|
|
727
727
|
},
|
|
728
728
|
},
|
|
729
729
|
get_tokens: {
|
|
730
|
-
description: 'Design tokens (CSS custom properties). Pass a group (color, space, radius, shadow, font, motion, glass, surface, liquid, ...) and/or a substring to filter. Only these tokens exist.',
|
|
730
|
+
description: 'Design tokens (CSS custom properties). Pass a group (color, space, radius, shadow, font, motion, glass, surface, liquid, ...) and/or a substring to filter. Only these tokens exist. A token that changes in dark mode (the .dark class) lists { light, dark }, each with its resolved value; the others have one value for both themes.',
|
|
731
731
|
inputSchema: { type: 'object', properties: { group: { type: 'string' }, query: { type: 'string' } } },
|
|
732
732
|
run(args) {
|
|
733
733
|
const g = strArg(args, 'group'); const q = strArg(args, 'query');
|
|
@@ -735,11 +735,24 @@ const tools = {
|
|
|
735
735
|
const groups = manifest.tokens.groups;
|
|
736
736
|
if (g.value && !has(groups, g.value)) return fail(`Unknown token group "${g.value}". Groups: ${Object.keys(groups).join(', ')}`);
|
|
737
737
|
const needle = q.value?.toLowerCase();
|
|
738
|
+
const dark = manifest.tokens.dark ?? {};
|
|
739
|
+
const light = Object.assign({}, ...Object.values(groups));
|
|
740
|
+
// follow var() chains to the real value, in the light or the dark theme, so "var(--color-neutral-500)" also shows #78716A
|
|
741
|
+
const resolve = (name, mode) => {
|
|
742
|
+
let v = mode === 'dark' && name in dark ? dark[name] : light[name];
|
|
743
|
+
for (let i = 0; i < 8 && typeof v === 'string'; i++) {
|
|
744
|
+
const m = v.match(/^var\((--[a-z0-9-]+)\)$/i); if (!m) break;
|
|
745
|
+
v = mode === 'dark' && m[1] in dark ? dark[m[1]] : light[m[1]];
|
|
746
|
+
}
|
|
747
|
+
return v;
|
|
748
|
+
};
|
|
749
|
+
const show = (name, raw, mode) => { const r = resolve(name, mode); return r && r !== raw && !String(r).startsWith('var(') ? `${raw} (${r})` : raw; };
|
|
738
750
|
const out = {};
|
|
739
751
|
for (const [name, toks] of Object.entries(groups)) {
|
|
740
752
|
if (g.value && name !== g.value) continue;
|
|
741
|
-
const sel = Object.entries(toks).filter(([k, v]) => !needle || k.includes(needle) || String(v).toLowerCase().includes(needle));
|
|
742
|
-
|
|
753
|
+
const sel = Object.entries(toks).filter(([k, v]) => !needle || k.includes(needle) || String(v).toLowerCase().includes(needle) || String(dark[k] ?? '').toLowerCase().includes(needle));
|
|
754
|
+
// a token that is different in dark (its own .dark value, or a var() of one that is) shows both values; the rest stay a plain string
|
|
755
|
+
if (sel.length) out[name] = Object.fromEntries(sel.map(([k, v]) => [k, k in dark || resolve(k, 'light') !== resolve(k, 'dark') ? { light: show(k, v, 'light'), dark: show(k, dark[k] ?? v, 'dark') } : v]));
|
|
743
756
|
}
|
|
744
757
|
return text(Object.keys(out).length ? out : `No tokens match. Groups: ${Object.keys(groups).join(', ')}`);
|
|
745
758
|
},
|
package/data/AGENTS.md
CHANGED
|
@@ -102,6 +102,10 @@ colour. Do not guess names (`--fg-muted`, `--bg-canvas`, `--spacing-4` and `--sp
|
|
|
102
102
|
- **Radius** — `--radius-{none,2xs,xs,sm,md,lg,xl,2xl,3xl,full}` (`md` = 8px is the default control radius).
|
|
103
103
|
- **Shadow** — `--shadow-{xs,sm,md,lg,xl,2xl}`. **Font** — `--font-sans`, `--font-mono`.
|
|
104
104
|
**Motion** — `--transition-{fast,base,hover,slow}`.
|
|
105
|
+
- **Light and dark values:** `get_tokens` lists `{ light, dark }` for every token that is different in dark mode, each with
|
|
106
|
+
its resolved colour. Do not assume a token keeps its light value in dark: `--color-fg-muted` and `--color-fg-subtle` swap
|
|
107
|
+
(muted is the lighter grey in dark, so it stays readable), `--color-border-focus` and `--color-brand-fg` lighten, and the
|
|
108
|
+
chart colours are one set in both. Use the token by name and the theme picks the value.
|
|
105
109
|
- Full, resolved list for light and dark: https://www.sakaniui.com/docs/tokens
|
|
106
110
|
|
|
107
111
|
## 3. When nothing fits
|
|
@@ -275,6 +279,16 @@ lists its other names under `aliases` in `manifest.json`, and `search_components
|
|
|
275
279
|
Change `center` and the globe turns to face the new place; `zoom` scales it; `renderMarkerCard` puts your own card
|
|
276
280
|
on the hovered or selected marker (`cardPlacement="side"` puts it beside the marker). `markerScale={1}` keeps the
|
|
277
281
|
markers at design size on a small globe.
|
|
282
|
+
**RegionMap** — a choropleth: regions (states, countries, territories) shaded by a number, for "how does this vary by
|
|
283
|
+
place". `regions` + `viewBox` are the shapes (outlines ship per country and are imported on their own so an app only carries
|
|
284
|
+
the ones it uses: `import { UK_REGIONS, UK_REGIONS_VIEWBOX } from '@sakaniui/react/regions/uk'`, likewise `/us` US_STATES,
|
|
285
|
+
`/es` ES_REGIONS (autonomous communities), `/de` DE_REGIONS (Länder), `/ca` CA_REGIONS (provinces), `/au` AU_REGIONS (states and
|
|
286
|
+
territories); any SVG paths work), `values` is `{ [regionId]: number }` and `scale` is `{ breaks, diverging? }` (4 breaks = 5 bins; `diverging` paints
|
|
287
|
+
bins below zero orange, for growth or change). Hover shows a card (`renderTooltip`); click, Enter or Space selects a region
|
|
288
|
+
and the view eases to it (`selected` / `defaultSelected` / `onSelectedChange`; Escape or a second click goes back out).
|
|
289
|
+
Put `RegionMapLegend` (same `scale`, optional `caption`) under it. It has no tiles, streets or search: for places by
|
|
290
|
+
coordinates use Map or MapGlobe. `RegionMapBlock` is the full "Revenue by state" card (metric tabs, area select, ranked
|
|
291
|
+
list that becomes a region's detail); copy it and swap `sample.ts`.
|
|
278
292
|
**Flag** — a country flag (`country="JP"`, an ISO alpha-2 code; 16px beside text, 32px beside a heading). Not an emoji:
|
|
279
293
|
it is the Figma flag artwork, so use it instead of a flag emoji. Only the flags the library uses are imported; any other
|
|
280
294
|
code draws a neutral placeholder. Put the country's name in text beside it.
|
package/data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@sakaniui/react` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.19.0
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **`RegionMap`, `RegionMapLegend` and `RegionMapBlock`.** A choropleth for "how does this vary by place": regions shaded by a value, a hover card with the rank, and click-to-zoom into one region (the view eases to it; Escape or a second click goes back out; reduced motion jumps). Plain SVG, no map library, no new dependency. The shapes are data (`regions` + `viewBox`), so it is not tied to one country: outlines ship per country, each importable on its own so an app only carries the ones it uses: `@sakaniui/react/regions/us` (the 50 states and DC), `/uk` (the 12 statistical regions), `/es` (the 17 autonomous communities and Ceuta and Melilla, with the Canary Islands as an inset), `/de` (the 16 Länder), `/ca` (13 provinces and territories) and `/au` (6 states and 2 territories), 6 to 45 KB each, from Natural Earth and US Census boundaries (public domain), and any SVG paths work. `scale` takes `breaks` (4 breaks make 5 bins) and `diverging` for growth-style data (orange below zero, blue above). Keyboard: one tab stop, arrows move between regions, Enter or Space selects. `RegionMapBlock` is the full "Revenue by state" card (Blocks / Application / Region Map): a metric switch, a find-a-state search, the headline figure, the map and legend, and a ranked list (highest or lowest, or all) that becomes, once a region is zoomed, its first two metrics as compact cards (name and rank on top, the figure, then a green, red or grey pill: "+16.6 pts", "39% below", "On average"), the rest of the metrics as one line of help text under them ("Penetration 10.3%, 25th of 51, in line with the average") and the regions next to it in the ranking. The map, legend and list are linked: pointing at a region outlines it everywhere and marks its band on the legend; pointing at a legend band (or clicking it to hold it) fades every region outside it. `RegionMap` gains `onHoverChange`, `hovered` and `dimExcept`; `RegionMapLegend` gains `activeBin`, `lockedBin`, `markBin`, `onBinHover`, `onBinClick` and `noData`. The list plays a load animation: each bar grows from the left while its figure counts up from zero, row by row (on first load, when the metric changes, and when you come back from a zoom). `animate={false}` turns it off, and reduced motion skips it. The map colours are seven new tokens, `--color-map-bin-0` to `--color-map-bin-4` (the chart blue stepping from 25% to 100% over `--color-bg-muted`) and `--color-map-neg-0`, `--color-map-neg-1` (the chart orange, for values below zero), declared in light and dark and mirrored in Figma as Semantic `map/*`. Nothing existing changes.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **`Combobox` shows a pointer cursor, not a text cursor.** The field is a button that opens a list, but a stray `cursor: text` made it look like a box you could type into. It now shows the pointer, and the value is no longer selectable text. No prop or layout changes.
|
|
14
|
+
|
|
15
|
+
## 0.18.3
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- **`get_tokens` (MCP) shows the dark value.** The manifest kept only the first (light) definition of each token, so an agent asking for `--color-fg-muted` saw `neutral-500` and had no way to know that dark mode swaps it with `--color-fg-subtle`. The manifest now carries the `.dark` overrides (`tokens.dark`), and `get_tokens` lists `{ light, dark }` for every token that differs in dark, each resolved to its colour (for example `var(--color-neutral-500) (#78716A)`). 56 tokens show both values; the rest are one string as before. The existing `tokens.groups` of the manifest is unchanged, and the build verifies that every dark token is a listed token. AGENTS.md says not to assume a token keeps its light value in dark.
|
|
20
|
+
|
|
5
21
|
## 0.18.2
|
|
6
22
|
|
|
7
23
|
### Fixed
|