jfs-components 0.1.32 → 0.1.33
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/CHANGELOG.md +16 -0
- package/D2C.md +118 -0
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +40095 -1
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/module/design-tokens/Coin Variables-variables-full.json +40095 -1
- package/lib/module/icons/registry.js +1 -1
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/package.json +7 -1
- package/scripts/extract-figma-modes.js +359 -0
- package/src/design-tokens/Coin Variables-variables-full.json +40095 -1
- package/src/icons/registry.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ All notable changes to this project are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
6
|
|
|
7
|
+
## [0.1.33] - 2026-07-20
|
|
8
|
+
|
|
9
|
+
- **Use [`D2C.md`](./D2C.md) for Design-to-Code.** This is the playbook we want agents and consumers to follow when implementing a Figma screen with `jfs-components`. It ships in the npm package (see `package.json` `files`) so it is available at `node_modules/jfs-components/D2C.md` after install. The workflow is mandatory end-to-end: Figma MCP (`get_design_context` + `get_screenshot`) → mode extraction via `npx jfs-extract-modes` (REST API; Dev seat / file-read token is enough) → build with exact modes → visual QA against the Figma screenshot. Point Cursor rules / agent instructions at this file rather than inventing a parallel D2C process.
|
|
10
|
+
- Packages `D2C.md` alongside the `jfs-extract-modes` CLI so the guide and the tool travel together in every release.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## [0.1.32] - 2026-07-20
|
|
15
|
+
|
|
16
|
+
- Added `jfs-extract-modes` — a CLI shipped with the npm package (`bin` + `scripts/extract-figma-modes.js`) that extracts explicit Figma variable modes per layer via the **Figma REST API** only (one `GET /v1/files/:key` call). No Plugin API, so it works with a **Dev seat** (or any token with file read access) — you do not need an edit / full design seat. After installing `jfs-components`, run `npx jfs-extract-modes <figma-url>` (or `npm run extract-modes` in this repo) with `FIGMA_ACCESS_TOKEN` set. Optional `--add-keys` patches collection keys into the packaged variables JSON for library maintainers.
|
|
17
|
+
- Packaged `Coin Variables-variables-full.json` updated with collection keys so mode resolution is collection-key exact for consumers.
|
|
18
|
+
- `ValueBackMetric` — new optional `onPress` / `disabled` props make the whole card pressable (`Pressable` + `accessibilityRole="button"`), independent of the bottom link’s `onLinkPress`.
|
|
19
|
+
- Regenerated `figma-modes.generated.ts` (adds `HelloJioInput` modes) and icon registry timestamp.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
7
23
|
## [0.1.31] - 2026-07-15
|
|
8
24
|
|
|
9
25
|
- Added `CategoryCard` — compact category rail tile (`categoryCard/*` tokens) with image (or `imageSlot`), optional overlapping `Badge`, fixed 60dp width (overridable via `width`), and `active` / `disabled` press states. Label truncation mirrors `Text` via `disableTruncation` / `singleLine`.
|
package/D2C.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# D2C — Design to Code (jfs-components)
|
|
2
|
+
|
|
3
|
+
You are implementing a screen from a Figma design using the `jfs-components`
|
|
4
|
+
library. The user has pasted a Figma link. Follow this workflow exactly, in
|
|
5
|
+
order. Do not skip steps and do not improvise substitutes for them.
|
|
6
|
+
|
|
7
|
+
## Step 1 — Pull the design through the Figma MCP
|
|
8
|
+
|
|
9
|
+
Extract `fileKey` and `nodeId` from the pasted URL
|
|
10
|
+
(`https://www.figma.com/design/<fileKey>/...?node-id=<a>-<b>` → nodeId is
|
|
11
|
+
`<a>:<b>`).
|
|
12
|
+
|
|
13
|
+
1. Call `get_design_context` for the node. This gives you the component
|
|
14
|
+
structure, layout, props, variants, text content, and Code Connect hints.
|
|
15
|
+
2. Call `get_screenshot` for the same node and keep the image. This is the
|
|
16
|
+
visual ground truth you will QA against in Step 4.
|
|
17
|
+
|
|
18
|
+
The Figma MCP gives you almost everything — except one thing: the **variable
|
|
19
|
+
modes explicitly set on each layer**. Those are invisible to the MCP and they
|
|
20
|
+
change how components render (size, emphasis, appearance, color mode, etc.).
|
|
21
|
+
That is what Step 2 is for.
|
|
22
|
+
|
|
23
|
+
## Step 2 — Extract the modes (mandatory, never skip)
|
|
24
|
+
|
|
25
|
+
Run the mode extractor that ships with this package. It needs a Figma personal
|
|
26
|
+
access token with plain file-read access (a view-only / Dev seat token works;
|
|
27
|
+
no Enterprise scopes, no edit access):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
export FIGMA_ACCESS_TOKEN=figd_...
|
|
31
|
+
npx jfs-extract-modes "<the pasted Figma URL>" --out modes.json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If `npx` cannot find the bin (e.g. unusual monorepo setup), call the script by
|
|
35
|
+
its path inside the installed package:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
node node_modules/jfs-components/scripts/extract-figma-modes.js "<figma-url>" --out modes.json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The output is a flat list — one entry per layer that has explicit modes:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"modes": [
|
|
46
|
+
{ "layer": "Icon Button", "nodeId": "1:10638",
|
|
47
|
+
"path": "CC / Unsub > AppBar > Slot 2 > Icon Button",
|
|
48
|
+
"modes": { "Button / Size": "S", "Emphasis": "Low", "AppearanceBrand": "Neutral" } }
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Rules for using it:
|
|
54
|
+
|
|
55
|
+
- Children inherit ancestor modes unless they set their own. To get the
|
|
56
|
+
effective modes of any layer, merge every entry whose `path` is a prefix of
|
|
57
|
+
that layer's path, top-down.
|
|
58
|
+
- Correlate entries with the Figma MCP structure by layer name and position;
|
|
59
|
+
use `nodeId` when two layers share a name.
|
|
60
|
+
- If the output contains an `unresolved` array, STOP and report it to the user
|
|
61
|
+
before building. It means the packaged variables JSON is out of date and the
|
|
62
|
+
screen cannot be built faithfully. Do not guess missing modes.
|
|
63
|
+
|
|
64
|
+
## Step 3 — Build the screen
|
|
65
|
+
|
|
66
|
+
Implement with `jfs-components` components, mapping Figma component names to
|
|
67
|
+
library exports.
|
|
68
|
+
|
|
69
|
+
**Modes are non-negotiable.** Apply every extracted mode exactly as given —
|
|
70
|
+
collection name → mode name, on exactly the layer (or subtree) the extractor
|
|
71
|
+
reported. There is zero tolerance for inconsistency here:
|
|
72
|
+
|
|
73
|
+
- Do not substitute a "close enough" mode (`Emphasis: Medium` is not
|
|
74
|
+
`Emphasis: Low`).
|
|
75
|
+
- Do not drop modes that seem redundant — if the design sets
|
|
76
|
+
`AppearanceBrand: Neutral` on one Icon Button and `Appearance: Primary` on
|
|
77
|
+
another, those are different and intentional.
|
|
78
|
+
- Do not apply a child's modes to its parent or vice versa.
|
|
79
|
+
|
|
80
|
+
For everything else (spacing, order, text, icons, variants, props), follow the
|
|
81
|
+
Figma MCP output one-to-one. Reuse existing screens in the consuming app as
|
|
82
|
+
convention references for file placement, navigation registration, and asset
|
|
83
|
+
handling.
|
|
84
|
+
|
|
85
|
+
## Step 4 — QA against the design (mandatory, never skip)
|
|
86
|
+
|
|
87
|
+
After the screen compiles and renders, you MUST verify it visually against the
|
|
88
|
+
Step 1 screenshot:
|
|
89
|
+
|
|
90
|
+
- **Native app:** use the mobile MCP — launch the app, navigate to the new
|
|
91
|
+
screen, and take a screenshot (`mobile_take_screenshot`).
|
|
92
|
+
- **Web deployment:** use the browser tooling — navigate to the deployed/dev
|
|
93
|
+
URL and take a screenshot.
|
|
94
|
+
|
|
95
|
+
Compare your screenshot with the Figma screenshot side by side. Check:
|
|
96
|
+
|
|
97
|
+
1. Component sizes and emphasis levels (these are where wrong modes show up)
|
|
98
|
+
2. Colors / appearance (brand vs neutral vs secondary treatments)
|
|
99
|
+
3. Spacing, padding, and gaps
|
|
100
|
+
4. Text content and truncation
|
|
101
|
+
5. Icon choices and visibility (some layers in the design are hidden)
|
|
102
|
+
|
|
103
|
+
If there is ANY visible difference, fix it and re-screenshot. Repeat until the
|
|
104
|
+
implementation matches the design. Typical root causes, in order of
|
|
105
|
+
likelihood: a mode applied to the wrong layer, a missing mode (falling back to
|
|
106
|
+
the collection default), a wrong variant, a wrong icon.
|
|
107
|
+
|
|
108
|
+
## Summary contract
|
|
109
|
+
|
|
110
|
+
| Step | Tool | Skippable? |
|
|
111
|
+
|---|---|---|
|
|
112
|
+
| Design context + screenshot | Figma MCP | No |
|
|
113
|
+
| Mode extraction | `npx jfs-extract-modes` | No |
|
|
114
|
+
| Build | jfs-components | — |
|
|
115
|
+
| Visual QA loop | Mobile MCP or browser | No |
|
|
116
|
+
|
|
117
|
+
Report back to the user with: the screen file(s) created, the modes applied per
|
|
118
|
+
layer, and the final QA screenshot comparison.
|