inkbridge 0.1.0-beta.15 → 0.1.0-beta.17
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 +64 -0
- package/bin/inkbridge.mjs +33 -3
- package/code.js +40 -17695
- package/package.json +13 -3
- package/scanner/aspect-percent-position-regression.ts +237 -0
- package/scanner/aspect-ratio-regression.ts +90 -0
- package/scanner/bundle-size-regression.ts +50 -0
- package/scanner/cli.ts +7 -3
- package/scanner/component-scanner.ts +200 -117
- package/scanner/inline-flex-regression.ts +235 -0
- package/scanner/jsx-text-regression.ts +178 -0
- package/scanner/percent-position-regression.ts +105 -0
- package/scanner/state-classification-regression.ts +17 -6
- package/scanner/svg-fill-parent-regression.ts +98 -0
- package/scanner/svg-group-inheritance-regression.ts +166 -0
- package/scanner/svg-marker-inline-regression.ts +211 -0
- package/scanner/svg-marker-regression.ts +116 -0
- package/scanner/tailwind-parser.ts +2 -2
- package/scanner/types.ts +12 -2
- package/src/cache/frame-cache.ts +5 -3
- package/src/components/component-defs.ts +24 -9
- package/src/components/component-gen.ts +28 -26
- package/src/components/component-instance.ts +32 -30
- package/src/components/component-library.ts +9 -17
- package/src/components/component-lookup.ts +8 -5
- package/src/components/index.ts +1 -0
- package/src/components/scanner-types.ts +39 -0
- package/src/components/symbol-instance-policy.ts +13 -12
- package/src/design-system/cva-inference.ts +187 -0
- package/src/design-system/cva-master.ts +407 -0
- package/src/design-system/cva-utils.ts +29 -0
- package/src/design-system/design-system.ts +22 -22
- package/src/design-system/frame-stabilizers.ts +191 -0
- package/src/design-system/frame-utils.ts +46 -0
- package/src/design-system/generated-node.ts +7 -7
- package/src/design-system/icon-rendering.ts +229 -0
- package/src/design-system/master-shared.ts +133 -0
- package/src/design-system/node-helpers.ts +223 -0
- package/src/design-system/node-variants.ts +157 -0
- package/src/design-system/non-cva-master.ts +104 -0
- package/src/design-system/portal-handling.ts +138 -0
- package/src/design-system/preview-builder.ts +66 -63
- package/src/design-system/render-context.ts +15 -5
- package/src/design-system/responsive-resolver.ts +180 -0
- package/src/design-system/selectable-state.ts +157 -0
- package/src/design-system/state-master.ts +245 -0
- package/src/design-system/state-utils.ts +15 -0
- package/src/design-system/story-builder-context.ts +7 -4
- package/src/design-system/story-builder.ts +352 -2044
- package/src/design-system/story-frames.ts +378 -0
- package/src/design-system/story-instance.ts +333 -0
- package/src/design-system/story-tree-search.ts +110 -0
- package/src/design-system/symbol-fallback.ts +89 -0
- package/src/design-system/symbol-source.ts +147 -0
- package/src/design-system/table-helpers.ts +56 -0
- package/src/design-system/tag-predicates.ts +99 -0
- package/src/design-system/theme-context.ts +52 -0
- package/src/design-system/typography.ts +100 -0
- package/src/design-system/ui-builder.ts +509 -1571
- package/src/effects/clip-path-decorative.ts +6 -7
- package/src/effects/icon-builder.ts +539 -88
- package/src/github/github.ts +7 -8
- package/src/layout/deferred-layout.ts +501 -145
- package/src/layout/layout-parser.ts +91 -23
- package/src/layout/layout-utils.ts +12 -11
- package/src/layout/ring-utils.ts +10 -12
- package/src/layout/size-utils.ts +5 -5
- package/src/layout/width-solver.ts +3 -9
- package/src/main.ts +69 -61
- package/src/plugin/config.ts +8 -8
- package/src/plugin/dev-server.ts +1 -1
- package/src/plugin/packs/pack-provider.ts +6 -6
- package/src/plugin/packs/packs.ts +15 -13
- package/src/render-engine-version.ts +1 -1
- package/src/tailwind/class-utils.ts +18 -6
- package/src/tailwind/jsx-utils.ts +15 -14
- package/src/tailwind/node-ir.ts +5 -4
- package/src/tailwind/state-analyzer.ts +4 -1
- package/src/tailwind/tailwind.ts +199 -51
- package/src/tailwind/utility-resolver.ts +15 -4
- package/src/text/font-style-resolver.ts +0 -2
- package/src/text/inline-text.ts +6 -6
- package/src/text/text-builder.ts +16 -3
- package/src/tokens/change-detection.ts +12 -12
- package/src/tokens/color-resolver.ts +1 -6
- package/src/tokens/colors.ts +8 -5
- package/src/tokens/tokens.ts +18 -13
- package/src/tokens/variables.ts +112 -100
- package/ui.html +11 -6
package/README.md
CHANGED
|
@@ -131,6 +131,70 @@ The scanner re-reads this file on every scan — no server restart needed.
|
|
|
131
131
|
|
|
132
132
|
---
|
|
133
133
|
|
|
134
|
+
## Supported styling
|
|
135
|
+
|
|
136
|
+
Inkbridge reads styling from **Tailwind class names** (`className="…"`).
|
|
137
|
+
The Figma renderer is built to handle the breadth of Tailwind utilities:
|
|
138
|
+
flex / grid layouts, responsive variants (`sm:`, `md:`, `lg:`, …),
|
|
139
|
+
arbitrary values (`left-[18.33%]`, `aspect-5/3`), color / spacing
|
|
140
|
+
tokens, and SVG attribute inheritance.
|
|
141
|
+
|
|
142
|
+
### What's not supported yet
|
|
143
|
+
|
|
144
|
+
- **Inline `style={{ … }}` props.** Currently ignored by the renderer.
|
|
145
|
+
If you set `style={{ color: '#0a0', padding: 8 }}` on an element, the
|
|
146
|
+
Figma rendering will use whatever the Tailwind class list says — your
|
|
147
|
+
inline overrides won't be applied. Use Tailwind utilities or arbitrary
|
|
148
|
+
values instead (`text-[#0a0] p-2`). A consumer-side ESLint rule
|
|
149
|
+
(`react/forbid-dom-props` + `react/forbid-component-props`) is
|
|
150
|
+
recommended to catch this — see "Recommended lint rules" below.
|
|
151
|
+
|
|
152
|
+
- **CSS variables in arbitrary classes** (`text-[var(--accent)]`) —
|
|
153
|
+
not yet resolved through the scanner's token map; the literal CSS
|
|
154
|
+
variable name reaches Figma and renders as black. Use a Tailwind
|
|
155
|
+
token alias (`text-accent`) instead.
|
|
156
|
+
|
|
157
|
+
- **`<g transform="…">`** — the transform isn't composed onto child
|
|
158
|
+
positions yet, so paths inside a transformed group render at their
|
|
159
|
+
pre-transform coordinates.
|
|
160
|
+
|
|
161
|
+
- **`clip-path` / `mask` on `<g>`** — clipping is honored at the
|
|
162
|
+
element level (`overflow-hidden`, `clip-path-decorative-*`) but not
|
|
163
|
+
via SVG `<g clip-path="url(…)">`.
|
|
164
|
+
|
|
165
|
+
These are tracked as universality enhancements. File an issue if one
|
|
166
|
+
blocks you and we'll prioritize.
|
|
167
|
+
|
|
168
|
+
### Recommended lint rules
|
|
169
|
+
|
|
170
|
+
Until inline-style support lands, add these rules to your project's
|
|
171
|
+
ESLint config so you don't accidentally rely on patterns the plugin
|
|
172
|
+
ignores:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"rules": {
|
|
177
|
+
"react/forbid-dom-props": ["error", {
|
|
178
|
+
"forbid": [{
|
|
179
|
+
"propName": "style",
|
|
180
|
+
"message": "Inkbridge ignores inline styles — use Tailwind classes (or arbitrary values like text-[#0a0]) so Figma rendering matches the browser."
|
|
181
|
+
}]
|
|
182
|
+
}],
|
|
183
|
+
"react/forbid-component-props": ["error", {
|
|
184
|
+
"forbid": [{
|
|
185
|
+
"propName": "style",
|
|
186
|
+
"message": "Inkbridge ignores inline styles — use Tailwind classes (or arbitrary values like text-[#0a0]) so Figma rendering matches the browser."
|
|
187
|
+
}]
|
|
188
|
+
}]
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Skip this rule on any component where Figma rendering doesn't matter
|
|
194
|
+
(e.g. animation-only effects).
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
134
198
|
## Troubleshooting
|
|
135
199
|
|
|
136
200
|
### "Dev server not reachable"
|
package/bin/inkbridge.mjs
CHANGED
|
@@ -106,13 +106,35 @@ async function postinstall() {
|
|
|
106
106
|
const pkg = JSON.parse(await readFile(join(PACKAGE_DIR, "package.json"), "utf8"));
|
|
107
107
|
const manifestPath = join(PROJECT_ROOT, "node_modules/inkbridge/manifest.json");
|
|
108
108
|
|
|
109
|
+
// If setup has already run, the scanner route file exists. Re-installs and
|
|
110
|
+
// version bumps shouldn't shout "RUN SETUP" again — that's misleading.
|
|
111
|
+
const scanRouteExists = existsSync(
|
|
112
|
+
join(PROJECT_ROOT, "src/app/api/inkbridge/scan-components/route.ts")
|
|
113
|
+
);
|
|
114
|
+
|
|
109
115
|
console.log("");
|
|
110
116
|
console.log(` ✓ inkbridge v${pkg.version} installed`);
|
|
117
|
+
|
|
118
|
+
if (scanRouteExists) {
|
|
119
|
+
console.log("");
|
|
120
|
+
console.log(" Setup already done. Run `pnpm inkbridge:dev` and open the plugin in Figma.");
|
|
121
|
+
console.log("");
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// First install — the next step is non-obvious and easy to miss in a long
|
|
126
|
+
// install log. Make it loud.
|
|
111
127
|
console.log("");
|
|
112
|
-
console.log("
|
|
113
|
-
console.log("
|
|
128
|
+
console.log(" ┌─────────────────────────────────────────────────────────────┐");
|
|
129
|
+
console.log(" │ ⚠ One more step — wire up the scanner API routes: │");
|
|
130
|
+
console.log(" │ │");
|
|
131
|
+
console.log(" │ pnpm exec inkbridge setup │");
|
|
132
|
+
console.log(" │ │");
|
|
133
|
+
console.log(" │ Without this the plugin will show \"Dev server not │");
|
|
134
|
+
console.log(" │ running\" because the routes it calls don't exist yet. │");
|
|
135
|
+
console.log(" └─────────────────────────────────────────────────────────────┘");
|
|
114
136
|
console.log("");
|
|
115
|
-
console.log("
|
|
137
|
+
console.log(" After setup, load the plugin in Figma Desktop:");
|
|
116
138
|
console.log(" Plugins → Development → Import plugin from manifest");
|
|
117
139
|
console.log(` ${manifestPath}`);
|
|
118
140
|
console.log("");
|
|
@@ -196,6 +218,14 @@ async function setup() {
|
|
|
196
218
|
// 6. Print manifest path
|
|
197
219
|
const manifestPath = resolve(PROJECT_ROOT, "node_modules/inkbridge/manifest.json");
|
|
198
220
|
console.log("");
|
|
221
|
+
console.log(" About the routes:");
|
|
222
|
+
console.log(" src/app/api/inkbridge/scan-components/route.ts");
|
|
223
|
+
console.log(" runs the scanner and returns your component definitions");
|
|
224
|
+
console.log(" (the plugin calls this every time you click Generate).");
|
|
225
|
+
console.log(" src/app/api/inkbridge/patch-tokens/route.ts");
|
|
226
|
+
console.log(" writes Figma-edited tokens back to your CSS source on Push.");
|
|
227
|
+
console.log(" Don't move or delete these — the plugin won't work without them.");
|
|
228
|
+
console.log("");
|
|
199
229
|
console.log(" Setup complete. Load the plugin in Figma Desktop:");
|
|
200
230
|
console.log(" Plugins → Development → Import plugin from manifest");
|
|
201
231
|
console.log(` ${manifestPath}`);
|