inkbridge 0.1.0-beta.1 → 0.1.0-beta.10
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 +13 -3
- package/bin/{inkhouse.mjs → inkbridge.mjs} +16 -16
- package/code.js +2573 -430
- package/manifest.json +1 -0
- package/package.json +10 -9
- package/scanner/cli.ts +226 -4
- package/scanner/component-scanner.ts +95 -0
- package/scanner/css-token-reader-regression.ts +3 -2
- package/scanner/css-token-reader.ts +30 -28
- package/scanner/types.ts +14 -0
- package/src/token-source.ts +1 -1
- package/ui.html +289 -29
- package/src/blob-placement.ts +0 -111
- package/src/change-detection.ts +0 -204
- package/src/class-utils.ts +0 -105
- package/src/clip-path-decorative.ts +0 -194
- package/src/color-resolver.ts +0 -98
- package/src/colors.ts +0 -196
- package/src/component-defs.ts +0 -54
- package/src/component-gen.ts +0 -561
- package/src/component-lookup.ts +0 -82
- package/src/config.ts +0 -115
- package/src/design-system.ts +0 -59
- package/src/dev-server.ts +0 -173
- package/src/figma-globals.d.ts +0 -3
- package/src/font-style-resolver.ts +0 -171
- package/src/github.ts +0 -1465
- package/src/icon-builder.ts +0 -607
- package/src/image-cache.ts +0 -22
- package/src/inline-text.ts +0 -271
- package/src/layout-parser.ts +0 -667
- package/src/layout-utils.ts +0 -155
- package/src/main.ts +0 -687
- package/src/node-ir.ts +0 -595
- package/src/pack-provider.ts +0 -148
- package/src/packs.ts +0 -126
- package/src/radial-gradient.ts +0 -84
- package/src/render-context.ts +0 -138
- package/src/responsive-analyzer.ts +0 -139
- package/src/state-analyzer.ts +0 -143
- package/src/story-builder.ts +0 -1706
- package/src/story-layout.ts +0 -38
- package/src/tailwind.ts +0 -2379
- package/src/text-builder.ts +0 -116
- package/src/text-line.ts +0 -42
- package/src/tokens.ts +0 -717
- package/src/transform-math.ts +0 -44
- package/src/ui-builder.ts +0 -1996
- package/src/utility-resolver.ts +0 -125
- package/src/variables.ts +0 -1042
- package/src/width-solver.ts +0 -466
package/README.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
<img src="https://inkbridge.ink/inkbridge-logo.png" alt="Inkbridge" width="80" />
|
|
2
|
+
|
|
1
3
|
# Inkbridge
|
|
2
4
|
|
|
3
|
-
Generates native Figma frames from your Tailwind React components and syncs design tokens back to your codebase via GitHub PRs.
|
|
5
|
+
Generates native Figma frames and reusable Figma component instances from your Tailwind React components, and syncs design tokens back to your codebase via GitHub PRs.
|
|
4
6
|
|
|
5
7
|
## What it does
|
|
6
8
|
|
|
7
9
|
| Feature | Description |
|
|
8
10
|
|---|---|
|
|
9
|
-
| **Generate Design System Page** | Scans your Storybook stories and builds a pixel-accurate Figma page from your Tailwind classes |
|
|
11
|
+
| **Generate Design System Page** | Scans your Storybook stories and builds a pixel-accurate Figma page from your Tailwind classes, including reusable component instances for symbol candidates (CVA and non-CVA) |
|
|
10
12
|
| **Push to Code** | Creates a GitHub PR from Figma token changes. Source can be CSS-first (`auto`/`css`) or DTCG (`dtcg`). |
|
|
11
13
|
| **Detect & Sync Changes** | Detects class-level changes in Figma frames and proposes them as a GitHub PR |
|
|
12
14
|
| **Dev Mode codegen** | Shows Tailwind class names for any selected node in Figma Dev Mode |
|
|
@@ -63,10 +65,18 @@ The plugin auto-discovers your server on ports `4000`, `3000`, and `5173`.
|
|
|
63
65
|
1. Start dev server: `pnpm figma:dev`
|
|
64
66
|
2. Open any Figma file
|
|
65
67
|
3. **Plugins → Development → Inkbridge → Generate Design System Page**
|
|
66
|
-
4. The plugin scans your Storybook stories and builds a "Design System" page
|
|
68
|
+
4. The plugin scans your Storybook stories and builds a "Design System" page with token tables, themed columns, grouped component sections, and responsive/state preview blocks where relevant
|
|
67
69
|
|
|
68
70
|
Component data is always scanned live on every run — never stale. Re-run at any time to pick up changes.
|
|
69
71
|
|
|
72
|
+
For symbol candidates, the generated page renders real Figma component instances instead of only flattened frames:
|
|
73
|
+
|
|
74
|
+
- CVA components (for example `Button`) render as variant-aware instances.
|
|
75
|
+
- Non-CVA reusable components (for example `Card` compounds) can render as instances too.
|
|
76
|
+
- For compound instances, story text is applied by slot-aware overrides (for example title/description/content) when possible.
|
|
77
|
+
|
|
78
|
+
When a story instance uses non-default style/behavior props (for example `className`, `disabled`, `aria-invalid`, or unknown props), rendering falls back to direct frames for visual correctness.
|
|
79
|
+
|
|
70
80
|
### Manual scan
|
|
71
81
|
|
|
72
82
|
```bash
|
|
@@ -39,17 +39,17 @@ function detectStorybookPaths(root) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// ---------------------------------------------------------------------------
|
|
42
|
-
// postinstall — called automatically after `pnpm add -D
|
|
42
|
+
// postinstall — called automatically after `pnpm add -D inkbridge`
|
|
43
43
|
// ---------------------------------------------------------------------------
|
|
44
44
|
async function postinstall() {
|
|
45
45
|
const pkg = JSON.parse(await readFile(join(PACKAGE_DIR, "package.json"), "utf8"));
|
|
46
|
-
const manifestPath = join(PROJECT_ROOT, "node_modules/
|
|
46
|
+
const manifestPath = join(PROJECT_ROOT, "node_modules/inkbridge/manifest.json");
|
|
47
47
|
|
|
48
48
|
console.log("");
|
|
49
|
-
console.log(` ✓
|
|
49
|
+
console.log(` ✓ inkbridge v${pkg.version} installed`);
|
|
50
50
|
console.log("");
|
|
51
51
|
console.log(" Next: run setup to wire up the scanner endpoint and scripts:");
|
|
52
|
-
console.log(" pnpm exec
|
|
52
|
+
console.log(" pnpm exec inkbridge setup");
|
|
53
53
|
console.log("");
|
|
54
54
|
console.log(" Then load the plugin in Figma Desktop:");
|
|
55
55
|
console.log(" Plugins → Development → Import plugin from manifest");
|
|
@@ -67,10 +67,10 @@ async function setup() {
|
|
|
67
67
|
const patchRouteSrc = join(PACKAGE_DIR, "templates/patch-tokens-route.ts");
|
|
68
68
|
const pkgPath = join(PROJECT_ROOT, "package.json");
|
|
69
69
|
|
|
70
|
-
// 1. Create
|
|
71
|
-
const
|
|
72
|
-
if (existsSync(
|
|
73
|
-
console.log(" ~
|
|
70
|
+
// 1. Create inkbridge.config.json
|
|
71
|
+
const inkbridgeCfgPath = join(PROJECT_ROOT, "inkbridge.config.json");
|
|
72
|
+
if (existsSync(inkbridgeCfgPath)) {
|
|
73
|
+
console.log(" ~ inkbridge.config.json already exists, skipping");
|
|
74
74
|
} else {
|
|
75
75
|
const detectedPaths = detectStorybookPaths(PROJECT_ROOT);
|
|
76
76
|
const componentPaths = detectedPaths.length > 0 ? detectedPaths : ["src"];
|
|
@@ -79,11 +79,11 @@ async function setup() {
|
|
|
79
79
|
exclude: [],
|
|
80
80
|
onlyWithStories: true,
|
|
81
81
|
};
|
|
82
|
-
await writeFile(
|
|
82
|
+
await writeFile(inkbridgeCfgPath, JSON.stringify(cfg, null, 2) + "\n", "utf8");
|
|
83
83
|
if (detectedPaths.length > 0) {
|
|
84
|
-
console.log(` ✓ created
|
|
84
|
+
console.log(` ✓ created inkbridge.config.json (detected paths: ${detectedPaths.join(", ")})`);
|
|
85
85
|
} else {
|
|
86
|
-
console.log(" ✓ created
|
|
86
|
+
console.log(" ✓ created inkbridge.config.json (defaulting to src/ — edit to customise)");
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -112,7 +112,7 @@ async function setup() {
|
|
|
112
112
|
pkg.scripts = pkg.scripts || {};
|
|
113
113
|
const toAdd = {
|
|
114
114
|
"figma:dev": "next dev",
|
|
115
|
-
"figma:scan": "tsx node_modules/
|
|
115
|
+
"figma:scan": "tsx node_modules/inkbridge/scanner/cli.ts",
|
|
116
116
|
};
|
|
117
117
|
const added = [];
|
|
118
118
|
for (const [k, v] of Object.entries(toAdd)) {
|
|
@@ -130,7 +130,7 @@ async function setup() {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
// 5. Print manifest path
|
|
133
|
-
const manifestPath = resolve(PROJECT_ROOT, "node_modules/
|
|
133
|
+
const manifestPath = resolve(PROJECT_ROOT, "node_modules/inkbridge/manifest.json");
|
|
134
134
|
console.log("");
|
|
135
135
|
console.log(" Setup complete. Load the plugin in Figma Desktop:");
|
|
136
136
|
console.log(" Plugins → Development → Import plugin from manifest");
|
|
@@ -146,7 +146,7 @@ async function setup() {
|
|
|
146
146
|
// path — print manifest path (useful reference)
|
|
147
147
|
// ---------------------------------------------------------------------------
|
|
148
148
|
function printPath() {
|
|
149
|
-
const manifestPath = resolve(PROJECT_ROOT, "node_modules/
|
|
149
|
+
const manifestPath = resolve(PROJECT_ROOT, "node_modules/inkbridge/manifest.json");
|
|
150
150
|
console.log(manifestPath);
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -165,7 +165,7 @@ switch (command) {
|
|
|
165
165
|
break;
|
|
166
166
|
default:
|
|
167
167
|
console.log("Usage:");
|
|
168
|
-
console.log("
|
|
169
|
-
console.log("
|
|
168
|
+
console.log(" inkbridge setup Wire up scanner/token-patch routes + scripts (run once after install)");
|
|
169
|
+
console.log(" inkbridge path Print the manifest.json path for Figma Desktop");
|
|
170
170
|
break;
|
|
171
171
|
}
|