figma-lupa 0.2.1 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figma-lupa",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Read-only Figma CLI, MCP server and plugin for pixel-faithful design-to-code with a small context footprint.",
5
5
  "type": "module",
6
6
  "license": "GPL-3.0-or-later",
@@ -1118,7 +1118,7 @@
1118
1118
  t: "hello",
1119
1119
  role: "plugin",
1120
1120
  protocol: PROTOCOL_VERSION,
1121
- pluginVersion: "0.2.1",
1121
+ pluginVersion: "0.3.0",
1122
1122
  fileKey: fileKey(),
1123
1123
  editorType: figma.editorType
1124
1124
  }, state());
@@ -17,11 +17,11 @@ The target is a Figma URL (in quotes, because it contains `&`), node ids like `1
17
17
 
18
18
  1. From the project's root, run `lupa design [target] -d <the project's asset folder> --screenshot` and read the whole output before writing code. The format is described at the end of this file.
19
19
  - When the task names several frames or components (a screen and its component set, say), pass every link in this one call. Components and tokens they share are then printed once.
20
- - Lupa scans the project (CSS, SCSS and Less variables, SVG files, component files and classes) and marks what it already has. `→ var(--x)` after a colour token, a raw colour or a font is the project's variable for that value, and `→ .t-body` after a typography token is the project's text style class. `// project has: …` under a component says where the project defines it. A `src:` outside your asset folder is the project's own icon with the same drawing, so Lupa wrote no copy.
21
- - `-d` writes the other icons as SVG and the images as their original files. Each `svg` and `img` layer names its file in `src:`, so use that path where the layer is. You don't need to open the files. Add `--current-color` for monochrome icons that should inherit the text colour, and follow the project's icon conventions (sprite, components).
20
+ - Lupa scans the project (CSS, SCSS and Less variables, Tailwind v4 `@theme` or v3 `tailwind.config`, SVG files, icon libraries, React and Phoenix components and CSS classes) and marks what it already has. `→ var(--x)` after a colour token, a raw colour or a font is the project's variable for that value, and `→ .t-body` after a typography token is the project's text style class. `// project has: …` under a component says where the project defines it, with its props when Lupa reads them: `<Button variant="default*|outline" size="sm|lg"> (src/components/ui/button.tsx)` or `<.button variant="primary*|ghost"> <:actions>` (Phoenix). Use that component and map the Figma variants onto those props. A `src:` outside your asset folder is the project's own icon with the same drawing, so Lupa wrote no copy. A `src:` like `<PlusIcon /> (components/icons/plus.tsx)` is the project's own icon component, and one like `<ChevronDown /> from lucide-react` or `<.icon name="hero-x-mark" />` is the same icon in an icon library the project uses (Lucide, Heroicons): use it as written, with the layer's size and colour.
21
+ - `-d` writes the other icons as SVG and the images as their original files. Each `svg` and `img` layer names its file in `src:`, so use that path where the layer is. You don't need to open the files. Add `--current-color` for monochrome icons that should inherit the text colour, and follow the project's icon conventions (sprite, components). If the project keeps its icons as components rather than files, point `-d` at a scratch folder outside the project and turn the icons you need into components, so no unused SVG files are left behind.
22
22
  - Open the `image:` file under `## screenshot` to see the intent: hierarchy, alignment, what is decorative.
23
23
  - `## components` holds the components used more than once. If the codebase already has one, use it and map its props. Otherwise build it once. `--components names` gives a smaller output when the codebase already has most of them.
24
- 2. Look up only what has no `→`: colours, fonts and text styles in the project's Tailwind config, theme object (styled-components, MUI, Chakra…) or tokens file, which Lupa doesn't read. See **Colours** below.
24
+ 2. Look up only what has no `→`: colours, fonts and text styles in the project's theme object (styled-components, MUI, Chakra…) or tokens file, which Lupa doesn't read. See **Colours** below.
25
25
  - `… +N layers not shown → get_design #id` means part of the tree was cut. Run `lupa design <id> -d <same folder>` before building that part. Don't guess its contents.
26
26
 
27
27
  ## 2. Build
@@ -74,6 +74,6 @@ get_design format — one line per layer, children indented:
74
74
  "+N more like ↑" / "+N more alternating like the 2 above" = siblings with the same structure as the layer(s) just printed; the lines under it give each one's id and its own texts/images.
75
75
  "… +N layers not shown → get_design #id" = cut by the token budget; fetch that subtree when you need it.
76
76
  // lines = designer notes, prototype interactions, component props, exports.
77
- Codebase: "→ var(--x)" after a colour or font = the project's own variable for that value; "→ .class" after a typography token = its text style class. "// project has: …" = where the project defines that component. A src: outside the assets folder = the project's own icon with the same drawing.
77
+ Codebase: "→ var(--x)" after a colour or font = the project's own variable for that value; "→ .class" after a typography token = its text style class. Tailwind theme (v4 @theme or v3 tailwind.config): "→ *-grey-200" = that colour's utilities (bg-grey-200, text-grey-200, border-grey-200…), "→ font-sans" = the font utility, "→ text-sm font-medium leading-[20px]" = utility classes for a typography token. "// project has: …" = where the project defines that component, with its props when Lupa can read them (<Button variant="default*|outline"> for React cva/tv variants or string-union props, <.button variant="primary"> <:actions> for Phoenix attrs and slots; * = default). A src: outside the assets folder = the project's own icon with the same drawing; src:<PlusIcon /> (components/icons/plus.tsx) = the project's own icon component; src:<ChevronDown /> from lucide-react or src:<.icon name="hero-x-mark" /> = that icon from the project's icon library (no file written).
78
78
  Reproduce exact values (sizes, spacing, colours, type). Before writing any colour, $token or raw (#hex, rgba), look for the codebase's own token with that name or value (Tailwind theme, CSS variables, theme object) and use it; hardcode only when none matches.
79
79
  ```