figme-mcp 1.1.2 → 1.2.1
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 +226 -223
- package/dist/mcp/create.js +3 -0
- package/dist/mcp/tools/context.d.ts +10 -0
- package/dist/mcp/tools/context.js +27 -0
- package/dist/mcp/tools/find.js +36 -6
- package/dist/mcp/tools/image.js +3 -2
- package/dist/mcp/tools/instance.js +6 -3
- package/dist/mcp/tools/node.js +8 -4
- package/dist/mcp/tools/render.js +2 -1
- package/dist/mcp/tools/style.js +5 -3
- package/dist/mcp/tools/text.js +29 -6
- package/dist/mcp/tools/tree.js +25 -11
- package/dist/model/bindings.d.ts +48 -0
- package/dist/model/bindings.js +129 -0
- package/dist/model/components.d.ts +8 -1
- package/dist/model/components.js +75 -30
- package/dist/model/index.d.ts +7 -0
- package/dist/model/index.js +19 -0
- package/dist/model/instance.d.ts +51 -4
- package/dist/model/instance.js +181 -5
- package/dist/model/scene.d.ts +50 -0
- package/dist/model/scene.js +192 -0
- package/dist/model/styles.d.ts +56 -0
- package/dist/model/styles.js +90 -0
- package/dist/model/summarize.d.ts +52 -5
- package/dist/model/summarize.js +255 -46
- package/dist/model/text.d.ts +5 -1
- package/dist/model/text.js +14 -4
- package/dist/model/tree.d.ts +12 -3
- package/dist/model/tree.js +24 -7
- package/dist/model/variables.d.ts +29 -1
- package/dist/model/variables.js +76 -1
- package/dist/render/export.d.ts +25 -0
- package/dist/render/export.js +118 -20
- package/dist/render/index.js +27 -4
- package/dist/render/instance.d.ts +1 -1
- package/dist/render/instance.js +1 -1
- package/dist/render/report.d.ts +1 -1
- package/dist/render/report.js +2 -0
- package/dist/render/style.d.ts +10 -15
- package/dist/render/style.js +7 -43
- package/package.json +3 -3
package/dist/render/instance.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { num, obj } from '../model/access.js';
|
|
2
2
|
import { overrideIdentity } from '../model/tree.js';
|
|
3
3
|
import { mergeNode } from '../model/instance.js';
|
|
4
|
-
export { applyProps, descend, mergeNode, resolveInstance, } from '../model/instance.js';
|
|
4
|
+
export { applyProps, descend, mergeNode, resolveInstance, showLayer, swapAppearance, } from '../model/instance.js';
|
|
5
5
|
/**
|
|
6
6
|
* Fields that describe how a node paints ITSELF. When an instance carries one of these it has
|
|
7
7
|
* already been resolved for this instance; otherwise the symbol root's (overridden) value wins.
|
package/dist/render/report.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export interface RenderReport {
|
|
|
38
38
|
* Appendix D. Parameterised keys are formed with the helpers below so a typo cannot silently
|
|
39
39
|
* create a new feature that the coverage matrix will never recognise.
|
|
40
40
|
*/
|
|
41
|
-
export declare const FEATURES: readonly ['image-missing', 'image-crop', 'image-rotation', 'image-filters', 'gradient-singular', 'emoji', 'glyph-rotation', 'text-without-outlines', 'text-property-without-outlines', 'text-stroke', 'text-decoration', 'text-truncation', 'stroke-dashed', 'stroke-without-geometry', 'vector-without-geometry', 'geometry:corrupt', 'geometry:synthesised', 'mask-hidden', 'oversize', 'svg-rejected', 'instance-unresolved', 'instance-recursive', 'instance-property', 'instance-swap', 'node-failed'];
|
|
41
|
+
export declare const FEATURES: readonly ['image-missing', 'image-crop', 'image-rotation', 'image-filters', 'gradient-singular', 'emoji', 'glyph-rotation', 'text-without-outlines', 'text-property-without-outlines', 'text-stroke', 'text-decoration', 'text-truncation', 'stroke-dashed', 'stroke-without-geometry', 'vector-without-geometry', 'geometry:corrupt', 'geometry:synthesised', 'mask-hidden', 'oversize', 'svg-rejected', 'instance-unresolved', 'instance-recursive', 'instance-property', 'instance-swap', 'variable-binding', 'variable-unresolved', 'node-failed'];
|
|
42
42
|
/** Prefixes of the parameterised keys built by `feat` below. */
|
|
43
43
|
export declare const FEATURE_PREFIXES: readonly ['node-type:', 'paint:', 'effect:', 'blend:', 'mask:', 'stroke-align:', 'image-mode:', 'image-format:'];
|
|
44
44
|
/** True when `feature` is part of the frozen vocabulary; used to guard against typos. */
|
package/dist/render/report.js
CHANGED
package/dist/render/style.d.ts
CHANGED
|
@@ -2,30 +2,25 @@
|
|
|
2
2
|
* Colour and effect styles (plan F19).
|
|
3
3
|
*
|
|
4
4
|
* A node that references a local style — `styleIdForFill`, `styleIdForStrokeFill`,
|
|
5
|
-
* `styleIdForEffect` — draws the STYLE's current paints or effects
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* missing altogether (3 905 override records and 265 text-run entries carry only the reference).
|
|
9
|
-
* Measured on the sample's card icon: Figma's export is #333333, the "Black" style, while the
|
|
10
|
-
* override's cached paint says #F18D00.
|
|
5
|
+
* `styleIdForEffect` — draws the STYLE's current paints or effects, not the copy cached beside
|
|
6
|
+
* the reference. Measured on the sample's card icon: Figma's export is #333333, the "Black"
|
|
7
|
+
* style, while the override's cached paint says #F18D00.
|
|
11
8
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* The resolution itself lives in `model/styles.ts`, shared with the inspection tools so a colour
|
|
10
|
+
* never differs between the picture and the numbers; it is re-exported here for the exporter.
|
|
11
|
+
* The exporter resolves colour and effect styles only: text styles change no pixel, because the
|
|
12
|
+
* glyph outlines are baked (F5).
|
|
14
13
|
*/
|
|
15
14
|
import type { KiwiObject } from '../fig/kiwi.js';
|
|
16
15
|
import type { NodeChange } from '../fig/parse.js';
|
|
17
16
|
import type { FileIndex } from '../model/index.js';
|
|
18
|
-
|
|
19
|
-
export declare function stylePaints(index: FileIndex, ref: unknown): KiwiObject[] | undefined;
|
|
20
|
-
/** The effects of a local effect style, or undefined when the reference cannot be followed. */
|
|
21
|
-
export declare function styleEffects(index: FileIndex, ref: unknown): KiwiObject[] | undefined;
|
|
22
|
-
/** The node with every style reference it carries resolved to the style's live value. */
|
|
23
|
-
export declare function applyStyles(index: FileIndex, node: NodeChange): NodeChange;
|
|
17
|
+
export { applyStyles, styleEffects, stylePaints } from '../model/styles.js';
|
|
24
18
|
/**
|
|
25
19
|
* §4.7.5 — a `Path.styleID`, or the run style of a glyph, selects an entry of the node's
|
|
26
20
|
* `styleOverrideTable`, which carries only the fields that differ from the node's own. An entry
|
|
27
21
|
* may name a colour style instead of carrying paints, so the style is followed first. Returns
|
|
28
22
|
* undefined when nothing overrides the field, and the caller falls back to the node's paints.
|
|
23
|
+
* `bind`, when given, reads the colours the chosen paints bind to variables (F29).
|
|
29
24
|
*/
|
|
30
|
-
export declare function runPaints(index: FileIndex, node: NodeChange, styleID: number | undefined, field: 'fillPaints' | 'strokePaints'): KiwiObject[] | undefined;
|
|
25
|
+
export declare function runPaints(index: FileIndex, node: NodeChange, styleID: number | undefined, field: 'fillPaints' | 'strokePaints', bind?: (paints: KiwiObject[]) => KiwiObject[]): KiwiObject[] | undefined;
|
|
31
26
|
//# sourceMappingURL=style.d.ts.map
|
package/dist/render/style.js
CHANGED
|
@@ -1,50 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
if (!ref || typeof ref !== 'object')
|
|
5
|
-
return undefined;
|
|
6
|
-
const r = ref;
|
|
7
|
-
const local = guidKey(obj(r, 'guid'));
|
|
8
|
-
const t = index.resolveAssetRef(r) ?? (local ? index.node(local) : undefined);
|
|
9
|
-
return t && str(t.node, 'styleType') === styleType ? t : undefined;
|
|
10
|
-
}
|
|
11
|
-
/** The paints of a local colour style, or undefined when the reference cannot be followed. */
|
|
12
|
-
export function stylePaints(index, ref) {
|
|
13
|
-
const t = styleNode(index, ref, 'FILL');
|
|
14
|
-
if (!t || !Array.isArray(t.node['fillPaints']))
|
|
15
|
-
return undefined;
|
|
16
|
-
return objArr(t.node, 'fillPaints');
|
|
17
|
-
}
|
|
18
|
-
/** The effects of a local effect style, or undefined when the reference cannot be followed. */
|
|
19
|
-
export function styleEffects(index, ref) {
|
|
20
|
-
const t = styleNode(index, ref, 'EFFECT');
|
|
21
|
-
if (!t || !Array.isArray(t.node['effects']))
|
|
22
|
-
return undefined;
|
|
23
|
-
return objArr(t.node, 'effects');
|
|
24
|
-
}
|
|
25
|
-
/** The node with every style reference it carries resolved to the style's live value. */
|
|
26
|
-
export function applyStyles(index, node) {
|
|
27
|
-
const fill = stylePaints(index, node['styleIdForFill']);
|
|
28
|
-
const stroke = stylePaints(index, node['styleIdForStrokeFill']);
|
|
29
|
-
const effects = styleEffects(index, node['styleIdForEffect']);
|
|
30
|
-
if (!fill && !stroke && !effects)
|
|
31
|
-
return node;
|
|
32
|
-
const out = { ...node };
|
|
33
|
-
if (fill)
|
|
34
|
-
out['fillPaints'] = fill;
|
|
35
|
-
if (stroke)
|
|
36
|
-
out['strokePaints'] = stroke;
|
|
37
|
-
if (effects)
|
|
38
|
-
out['effects'] = effects;
|
|
39
|
-
return out;
|
|
40
|
-
}
|
|
1
|
+
import { num, obj, objArr } from '../model/access.js';
|
|
2
|
+
import { stylePaints } from '../model/styles.js';
|
|
3
|
+
export { applyStyles, styleEffects, stylePaints } from '../model/styles.js';
|
|
41
4
|
/**
|
|
42
5
|
* §4.7.5 — a `Path.styleID`, or the run style of a glyph, selects an entry of the node's
|
|
43
6
|
* `styleOverrideTable`, which carries only the fields that differ from the node's own. An entry
|
|
44
7
|
* may name a colour style instead of carrying paints, so the style is followed first. Returns
|
|
45
8
|
* undefined when nothing overrides the field, and the caller falls back to the node's paints.
|
|
9
|
+
* `bind`, when given, reads the colours the chosen paints bind to variables (F29).
|
|
46
10
|
*/
|
|
47
|
-
export function runPaints(index, node, styleID, field) {
|
|
11
|
+
export function runPaints(index, node, styleID, field, bind = (paints) => paints) {
|
|
48
12
|
if (!styleID)
|
|
49
13
|
return undefined;
|
|
50
14
|
const styleField = field === 'fillPaints' ? 'styleIdForFill' : 'styleIdForStrokeFill';
|
|
@@ -58,9 +22,9 @@ export function runPaints(index, node, styleID, field) {
|
|
|
58
22
|
continue;
|
|
59
23
|
const styled = stylePaints(index, override[styleField]);
|
|
60
24
|
if (styled)
|
|
61
|
-
return styled;
|
|
25
|
+
return bind(styled);
|
|
62
26
|
if (Array.isArray(override[field]))
|
|
63
|
-
return objArr(override, field);
|
|
27
|
+
return bind(objArr(override, field));
|
|
64
28
|
}
|
|
65
29
|
}
|
|
66
30
|
return undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "figme-mcp",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"mcpName": "io.github.ntson9p/figme-mcp",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "MCP server that reads local Figma .fig files, fully offline",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"visual:update": "node scripts/visual.mjs --update"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
53
|
-
"zod": "^4.
|
|
52
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
53
|
+
"zod": "^4.6.7"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/node": "^26.4.0",
|