@directededges/specs-from-figma 0.22.0 → 0.23.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.
Files changed (126) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +2 -2
  3. package/dist/Adapters/RestApi/NodeIndexer.d.ts +0 -118
  4. package/dist/Adapters/RestApi/RestBaseNode.d.ts +0 -271
  5. package/dist/Adapters/RestApi/RestComponentNode.d.ts +0 -30
  6. package/dist/Adapters/RestApi/RestInstanceNode.d.ts +0 -50
  7. package/dist/Adapters/RestApi/RestLibraryFile.d.ts +0 -51
  8. package/dist/Adapters/RestApi/RestTextNode.d.ts +0 -41
  9. package/dist/Component/Anatomy/Anatomy.d.ts +0 -97
  10. package/dist/Component/Anatomy/AnatomyElement.d.ts +0 -24
  11. package/dist/Component/Children/Children.d.ts +0 -96
  12. package/dist/Component/Color/Color.d.ts +0 -63
  13. package/dist/Component/Component.d.ts +0 -71
  14. package/dist/Component/Effects/Blur.d.ts +0 -41
  15. package/dist/Component/Effects/Effects.d.ts +0 -51
  16. package/dist/Component/Effects/EffectsProcessor.d.ts +0 -15
  17. package/dist/Component/Effects/Shadow.d.ts +0 -51
  18. package/dist/Component/Effects/index.d.ts +0 -4
  19. package/dist/Component/Elements/BaseElement.d.ts +0 -87
  20. package/dist/Component/Elements/ElementFactory.d.ts +0 -7
  21. package/dist/Component/Elements/ElementFactoryRegistry.d.ts +0 -21
  22. package/dist/Component/Elements/Elements.d.ts +0 -86
  23. package/dist/Component/Elements/Primitives/ComponentElement.d.ts +0 -8
  24. package/dist/Component/Elements/Primitives/EllipseElement.d.ts +0 -8
  25. package/dist/Component/Elements/Primitives/FrameElement.d.ts +0 -8
  26. package/dist/Component/Elements/Primitives/GlyphElement.d.ts +0 -21
  27. package/dist/Component/Elements/Primitives/InstanceElement.d.ts +0 -24
  28. package/dist/Component/Elements/Primitives/LineElement.d.ts +0 -8
  29. package/dist/Component/Elements/Primitives/PolygonElement.d.ts +0 -8
  30. package/dist/Component/Elements/Primitives/RectangleElement.d.ts +0 -8
  31. package/dist/Component/Elements/Primitives/SlotElement.d.ts +0 -8
  32. package/dist/Component/Elements/Primitives/StarElement.d.ts +0 -8
  33. package/dist/Component/Elements/Primitives/TextElement.d.ts +0 -8
  34. package/dist/Component/Elements/Primitives/VectorElement.d.ts +0 -8
  35. package/dist/Component/Elements/index.d.ts +0 -12
  36. package/dist/Component/Gradient/Gradient.d.ts +0 -73
  37. package/dist/Component/Gradient/GradientProcessor.d.ts +0 -18
  38. package/dist/Component/Gradient/index.d.ts +0 -2
  39. package/dist/Component/InstanceExamples/InstanceExample.d.ts +0 -35
  40. package/dist/Component/InstanceExamples/InstanceExamples.d.ts +0 -49
  41. package/dist/Component/Layout/Layout.d.ts +0 -26
  42. package/dist/Component/Layout/types.d.ts +0 -61
  43. package/dist/Component/Metadata/Metadata.d.ts +0 -13
  44. package/dist/Component/Metadata/constants.d.ts +0 -8
  45. package/dist/Component/Nodes/types.d.ts +0 -4
  46. package/dist/Component/PropConfigurations/PropConfiguration.d.ts +0 -15
  47. package/dist/Component/PropConfigurations/PropConfigurations.d.ts +0 -55
  48. package/dist/Component/Props/CodeOnlyProps/BooleanCodeOnlyProp.d.ts +0 -11
  49. package/dist/Component/Props/CodeOnlyProps/CodeOnlyProps.d.ts +0 -36
  50. package/dist/Component/Props/CodeOnlyProps/InstanceCodeOnlyProp.d.ts +0 -19
  51. package/dist/Component/Props/CodeOnlyProps/TextCodeOnlyProp.d.ts +0 -18
  52. package/dist/Component/Props/CodeOnlyProps/index.d.ts +0 -4
  53. package/dist/Component/Props/PropBinding.d.ts +0 -69
  54. package/dist/Component/Props/PropPair.d.ts +0 -16
  55. package/dist/Component/Props/PropPairings.d.ts +0 -89
  56. package/dist/Component/Props/Props.d.ts +0 -93
  57. package/dist/Component/Props/SlotConstraints.d.ts +0 -37
  58. package/dist/Component/SlotContent/SlotCandidate.d.ts +0 -42
  59. package/dist/Component/SlotContent/SlotContent.d.ts +0 -84
  60. package/dist/Component/SlotContent/SlotDetector.d.ts +0 -85
  61. package/dist/Component/SlotContent/SlotItem.d.ts +0 -44
  62. package/dist/Component/SlotContent/SlotRegistry.d.ts +0 -61
  63. package/dist/Component/Styles/Composites/BiaxialComposite.d.ts +0 -64
  64. package/dist/Component/Styles/Composites/QuadComposite.d.ts +0 -80
  65. package/dist/Component/Styles/Composites/index.d.ts +0 -4
  66. package/dist/Component/Styles/Primitives/AspectRatioStyle.d.ts +0 -34
  67. package/dist/Component/Styles/Primitives/BooleanStyle.d.ts +0 -6
  68. package/dist/Component/Styles/Primitives/ColorStyle.d.ts +0 -29
  69. package/dist/Component/Styles/Primitives/ConditionalStyle.d.ts +0 -30
  70. package/dist/Component/Styles/Primitives/CornerStyle.d.ts +0 -12
  71. package/dist/Component/Styles/Primitives/EffectsStyle.d.ts +0 -13
  72. package/dist/Component/Styles/Primitives/IconFillStyle.d.ts +0 -40
  73. package/dist/Component/Styles/Primitives/MixedStyle.d.ts +0 -5
  74. package/dist/Component/Styles/Primitives/NumberStyle.d.ts +0 -7
  75. package/dist/Component/Styles/Primitives/PaddingStyle.d.ts +0 -13
  76. package/dist/Component/Styles/Primitives/StringStyle.d.ts +0 -5
  77. package/dist/Component/Styles/Primitives/StrokeStyle.d.ts +0 -12
  78. package/dist/Component/Styles/Primitives/TypographyStyle.d.ts +0 -21
  79. package/dist/Component/Styles/Primitives/index.d.ts +0 -13
  80. package/dist/Component/Styles/Primitives/mapping.d.ts +0 -85
  81. package/dist/Component/Styles/References/FigmaStyleReference.d.ts +0 -45
  82. package/dist/Component/Styles/References/FigmaVariableReference.d.ts +0 -61
  83. package/dist/Component/Styles/References/index.d.ts +0 -24
  84. package/dist/Component/Styles/Style.d.ts +0 -88
  85. package/dist/Component/Styles/Styles.d.ts +0 -108
  86. package/dist/Component/Styles/StylesProcessor.d.ts +0 -96
  87. package/dist/Component/Styles/defaults.d.ts +0 -2
  88. package/dist/Component/Styles/figmaKeyMap.d.ts +0 -12
  89. package/dist/Component/Styles/keys.d.ts +0 -20
  90. package/dist/Component/Subcomponents/Subcomponent.d.ts +0 -20
  91. package/dist/Component/Subcomponents/Subcomponents.d.ts +0 -83
  92. package/dist/Component/Typography/FontStyle.d.ts +0 -6
  93. package/dist/Component/Typography/LetterSpacingStyle.d.ts +0 -4
  94. package/dist/Component/Typography/LineHeightStyle.d.ts +0 -4
  95. package/dist/Component/Typography/Typography.d.ts +0 -105
  96. package/dist/Component/Typography/TypographyProcessor.d.ts +0 -33
  97. package/dist/Component/Typography/constants.d.ts +0 -20
  98. package/dist/Component/Typography/defaults.d.ts +0 -30
  99. package/dist/Component/Typography/keys.d.ts +0 -12
  100. package/dist/Component/Variants/Differencer.d.ts +0 -47
  101. package/dist/Component/Variants/Variant.d.ts +0 -55
  102. package/dist/Component/Variants/Variants.d.ts +0 -91
  103. package/dist/Components/Components.d.ts +0 -68
  104. package/dist/Config/types.Settings.d.ts +0 -30
  105. package/dist/Constants/ApiMappings.d.ts +0 -31
  106. package/dist/Constants/BindingKeys.d.ts +0 -2
  107. package/dist/Constants/DevSettings.d.ts +0 -4
  108. package/dist/Constants/Nodes.d.ts +0 -1
  109. package/dist/License/LicenseManager.d.ts +0 -43
  110. package/dist/License/ProxyClient.d.ts +0 -25
  111. package/dist/License/constants.d.ts +0 -41
  112. package/dist/License/types.d.ts +0 -83
  113. package/dist/Progress/PhaseConfiguration.d.ts +0 -20
  114. package/dist/Progress/Progress.d.ts +0 -107
  115. package/dist/Progress/ProgressCoordinator.d.ts +0 -33
  116. package/dist/Runtime/Context/interfaces.d.ts +0 -73
  117. package/dist/Runtime/Foundations/FigmaPluginFoundations.d.ts +0 -37
  118. package/dist/Runtime/Foundations/FigmaRESTFoundations.d.ts +0 -72
  119. package/dist/Runtime/Foundations/FigmaRESTMaps.d.ts +0 -55
  120. package/dist/Runtime/Foundations/interfaces.d.ts +0 -72
  121. package/dist/Runtime/Nodes/FigmaPluginNodes.d.ts +0 -45
  122. package/dist/Runtime/Nodes/FigmaRestNodes.d.ts +0 -43
  123. package/dist/Runtime/Nodes/NodeAccess.d.ts +0 -23
  124. package/dist/Runtime/Nodes/interfaces.d.ts +0 -60
  125. package/dist/Utilities/Utilities.d.ts +0 -44
  126. package/dist/Utilities/types.ReferenceValue.d.ts +0 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@directededges/specs-from-figma",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "Core data transformation model for Specs design specification tools",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -31,7 +31,7 @@
31
31
  "prepublishOnly": "npm run build"
32
32
  },
33
33
  "dependencies": {
34
- "@directededges/specs-schema": "^0.24.0",
34
+ "@directededges/specs-schema": "^0.25.0",
35
35
  "fs-extra": "^11.3.3",
36
36
  "yaml": "^2.8.0"
37
37
  },
@@ -1,118 +0,0 @@
1
- /**
2
- * NodeIndexer - Efficient node lookup and indexing for REST API data
3
- *
4
- * Purpose: Provide O(1) lookups for nodes, components, parents, and relationships
5
- * Status: Enhanced from inline PoC parent mapping (2026-01-10)
6
- *
7
- * Features:
8
- * - ID-based node lookup
9
- * - Parent relationship tracking
10
- * - Component indexing by ID and name
11
- * - Type-based node filtering
12
- *
13
- * Phase 1 Enhancements:
14
- * - T009: Component name lookup for instanceOf resolution
15
- * - T015: Main component lookup for dimension inheritance
16
- */
17
- /**
18
- * Minimal interface for REST API node data
19
- * This is the raw JSON structure from Figma REST API
20
- */
21
- interface RestApiNode {
22
- id: string;
23
- name: string;
24
- type: string;
25
- children?: RestApiNode[];
26
- componentPropertyDefinitions?: Record<string, unknown>;
27
- [key: string]: unknown;
28
- }
29
- export declare class NodeIndexer {
30
- private nodeById;
31
- private parentById;
32
- private componentById;
33
- private componentByName;
34
- private nodesByType;
35
- private componentNameById;
36
- private componentSetIdById;
37
- private root;
38
- constructor(rootNode: RestApiNode, components?: Record<string, RestApiNode>, componentSets?: Record<string, RestApiNode>);
39
- /**
40
- * Recursively index all nodes in the tree
41
- */
42
- private indexTree;
43
- /**
44
- * Get node by ID
45
- */
46
- getById(id: string): RestApiNode | null;
47
- /**
48
- * Get parent of node by ID
49
- */
50
- getParent(id: string): RestApiNode | null;
51
- /**
52
- * Get component by ID
53
- */
54
- getComponentById(id: string): RestApiNode | null;
55
- /**
56
- * Get component by name
57
- */
58
- getComponentByName(name: string): RestApiNode | null;
59
- /**
60
- * Get component name by ID
61
- * Returns null if component not found
62
- *
63
- * Phase 1 T009: Used to resolve instanceOf for RestInstanceNode
64
- * Returns COMPONENT_SET name if the component is part of a set,
65
- * otherwise returns the COMPONENT name
66
- */
67
- getComponentName(componentId: string): string | null;
68
- /**
69
- * Get component property definitions by ID
70
- * Returns empty object if component not found
71
- *
72
- * Phase 1 T015: Used for dimension inheritance
73
- */
74
- getComponentPropertyDefinitions(componentId: string): Record<string, unknown>;
75
- /**
76
- * Get the component set ID for a variant component
77
- * Returns null if the component has no parent set
78
- */
79
- getComponentSetId(componentId: string): string | null;
80
- /** The indexed document root node. */
81
- getRoot(): RestApiNode;
82
- /** All page nodes in the document. REST API pages are type CANVAS; PAGE is included for plugin-shaped data. */
83
- getPages(): RestApiNode[];
84
- /**
85
- * Boundary-respecting recursive walk for example/subcomponent discovery.
86
- *
87
- * Starting from a containment root (a PAGE, SECTION, FRAME, or GROUP), descend
88
- * through SECTION/FRAME/GROUP containers collecting nodes whose type matches.
89
- * The walk STOPS at COMPONENT, COMPONENT_SET, and INSTANCE boundaries — it
90
- * never descends into them — so instances nested inside other instances,
91
- * components, or sets are NOT returned. The boundary node itself is collected
92
- * if its own type matches, but its children are not traversed.
93
- *
94
- * Each result carries its immediate-parent node so callers can filter on
95
- * `parentName`.
96
- */
97
- walkBoundary(roots: RestApiNode[], types: string[]): Array<{
98
- node: RestApiNode;
99
- parent: RestApiNode | null;
100
- }>;
101
- /**
102
- * Find nodes by type(s)
103
- */
104
- findAllByType(...types: string[]): RestApiNode[];
105
- /**
106
- * Find node by name or ID, optionally filtered by type(s)
107
- */
108
- findByNameOrId(nameOrId: string, ...types: string[]): RestApiNode | null;
109
- /**
110
- * Get statistics about indexed data
111
- */
112
- getStats(): {
113
- totalNodes: number;
114
- components: number;
115
- types: Record<string, number>;
116
- };
117
- }
118
- export {};
@@ -1,271 +0,0 @@
1
- /**
2
- * RestBaseNode - Base adapter implementing Figma Plugin API BaseNode interface for REST API data
3
- *
4
- * Purpose: Wrap REST API JSON nodes to provide Plugin API-compatible interface
5
- * Status: Production migration from validated PoC (2026-01-10)
6
- *
7
- * This adapter allows existing Model classes to work with Figma REST API data
8
- * without modification by implementing the minimal Plugin API surface needed.
9
- *
10
- * Type Safety: Uses official @figma/rest-api-spec types for improved autocomplete,
11
- * linting, and compatibility with Figma's REST API schema.
12
- */
13
- import type { Paint as FigmaRestPaint, VariableAlias as FigmaRestVariableAlias, Rectangle as FigmaRestRectangle, TypeStyle as FigmaRestTypeStyle, Vector as FigmaRestVector, Transform as FigmaRestTransform, IsLayerTrait as FigmaRestIsLayerTrait, StrokeWeights as FigmaRestStrokeWeights, HasFramePropertiesTrait as FigmaRestHasFramePropertiesTrait, MinimalStrokesTrait as FigmaRestMinimalStrokesTrait, HasGeometryTrait as FigmaRestHasGeometryTrait } from '@figma/rest-api-spec';
14
- import type { NodeIndexer } from './NodeIndexer';
15
- /**
16
- * Minimal interface for REST API node data
17
- * This is the raw JSON structure from Figma REST API
18
- */
19
- type VariableBinding = FigmaRestVariableAlias;
20
- type FigmaRestBoundVariables = NonNullable<FigmaRestIsLayerTrait['boundVariables']>;
21
- /**
22
- * Extended BoundVariables type combining official REST API spec with Plugin API mappings
23
- *
24
- * Official REST API bindings (from FigmaRestBoundVariables):
25
- * - size: { x, y } → Transformed to width/height in boundVariables getter
26
- * - rectangleCornerRadii: { RECTANGLE_TOP_LEFT_CORNER_RADIUS, ... } → Transformed to topLeftRadius, etc.
27
- *
28
- * Plugin API custom properties added during transformation (see boundVariables getter):
29
- * - width, height (from size.x, size.y)
30
- * - topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius (from rectangleCornerRadii)
31
- *
32
- * The boundVariables getter performs these transformations to match Plugin API expectations.
33
- */
34
- type BoundVariables = FigmaRestBoundVariables & {
35
- width?: VariableBinding;
36
- height?: VariableBinding;
37
- [key: string]: unknown;
38
- };
39
- interface RestNodeStyles {
40
- text?: string;
41
- effect?: string;
42
- fill?: string;
43
- stroke?: string;
44
- grid?: string;
45
- }
46
- export interface RestApiNodeData {
47
- id: string;
48
- name: string;
49
- type: string;
50
- children?: RestApiNodeData[];
51
- absoluteBoundingBox?: FigmaRestRectangle;
52
- size?: FigmaRestVector;
53
- relativeTransform?: FigmaRestTransform;
54
- fills?: FigmaRestPaint[];
55
- strokes?: FigmaRestPaint[];
56
- effects?: FigmaRestPaint[];
57
- styles?: RestNodeStyles;
58
- boundVariables?: BoundVariables;
59
- visible?: boolean;
60
- layoutMode?: NonNullable<FigmaRestHasFramePropertiesTrait['layoutMode']>;
61
- primaryAxisSizingMode?: NonNullable<FigmaRestHasFramePropertiesTrait['primaryAxisSizingMode']>;
62
- counterAxisSizingMode?: NonNullable<FigmaRestHasFramePropertiesTrait['counterAxisSizingMode']>;
63
- primaryAxisAlignItems?: NonNullable<FigmaRestHasFramePropertiesTrait['primaryAxisAlignItems']>;
64
- counterAxisAlignItems?: NonNullable<FigmaRestHasFramePropertiesTrait['counterAxisAlignItems']>;
65
- paddingLeft?: number;
66
- paddingRight?: number;
67
- paddingTop?: number;
68
- paddingBottom?: number;
69
- itemSpacing?: number;
70
- layoutWrap?: NonNullable<FigmaRestHasFramePropertiesTrait['layoutWrap']>;
71
- layoutPositioning?: string;
72
- layoutSizingHorizontal?: string;
73
- layoutSizingVertical?: string;
74
- itemReverseZIndex?: boolean;
75
- counterAxisAlignContent?: NonNullable<FigmaRestHasFramePropertiesTrait['counterAxisAlignContent']>;
76
- counterAxisSpacing?: number;
77
- constraints?: {
78
- horizontal: string;
79
- vertical: string;
80
- };
81
- minWidth?: number;
82
- maxWidth?: number;
83
- minHeight?: number;
84
- maxHeight?: number;
85
- rotation?: number;
86
- opacity?: number;
87
- clipContent?: boolean;
88
- locked?: boolean;
89
- strokeWeight?: number;
90
- strokeAlign?: NonNullable<FigmaRestMinimalStrokesTrait['strokeAlign']>;
91
- strokeCap?: NonNullable<FigmaRestHasGeometryTrait['strokeCap']>;
92
- strokeJoin?: NonNullable<FigmaRestMinimalStrokesTrait['strokeJoin']>;
93
- individualStrokeWeights?: FigmaRestStrokeWeights;
94
- cornerRadius?: number;
95
- rectangleCornerRadii?: number[];
96
- characters?: string;
97
- componentPropertyReferences?: {
98
- [key: string]: string;
99
- };
100
- [key: string]: unknown;
101
- }
102
- /**
103
- * Base adapter class for all REST API nodes
104
- * Implements core BaseNode interface properties and methods
105
- */
106
- export declare class RestBaseNode {
107
- protected _data: RestApiNodeData;
108
- protected _parent: RestBaseNode | null;
109
- protected _indexer: NodeIndexer | null;
110
- protected _childrenCache: RestBaseNode[] | null;
111
- constructor(data: RestApiNodeData, parent?: RestBaseNode | null);
112
- /**
113
- * Set the indexer for this node and propagate to children
114
- * Called by RestApiFileDocument after tree construction
115
- */
116
- setIndexer(indexer: NodeIndexer): void;
117
- get id(): string;
118
- get name(): string;
119
- get type(): string;
120
- get parent(): RestBaseNode | null;
121
- get removed(): boolean;
122
- get styles(): RestNodeStyles | undefined;
123
- get style(): FigmaRestTypeStyle | undefined;
124
- /**
125
- * Find first child matching callback
126
- * Returns null if no match or node has no children
127
- */
128
- findChild(callback: (node: RestBaseNode) => boolean): RestBaseNode | null;
129
- /**
130
- * Find all children matching callback (or all if no callback)
131
- * Returns empty array if no matches or node has no children
132
- */
133
- findAll(callback?: (node: RestBaseNode) => boolean): RestBaseNode[];
134
- /**
135
- * Factory method to wrap child data in appropriate adapter class
136
- *
137
- * Base implementation routes INSTANCE types to RestInstanceNode.
138
- * Child classes (RestComponentNode) can override this for additional routing.
139
- */
140
- protected wrapChild(childData: RestApiNodeData): RestBaseNode;
141
- /**
142
- * Set plugin data - no-op in REST mode (data is read-only)
143
- */
144
- setPluginData(_key: string, _value: string): void;
145
- /**
146
- * Get plugin data - returns empty string (REST data doesn't include plugin data)
147
- */
148
- getPluginData(_key: string): string;
149
- get fills(): readonly FigmaRestPaint[];
150
- get strokes(): readonly FigmaRestPaint[];
151
- get effects(): readonly FigmaRestPaint[];
152
- /**
153
- * Extract boundVariables from fills/strokes/effects
154
- * In REST API, boundVariables are nested inside each paint object, not at node level
155
- * This getter reconstructs the Plugin API format: { fills: [{id, type}], strokes: [...], ... }
156
- *
157
- * Note: Only SolidPaint has boundVariables in the official Figma REST API spec
158
- */
159
- get boundVariables(): BoundVariables | undefined;
160
- get fillStyleId(): string | typeof figma.mixed;
161
- get strokeStyleId(): string;
162
- get textStyleId(): string | typeof figma.mixed;
163
- get effectStyleId(): string;
164
- get gridStyleId(): string;
165
- get layoutMode(): NonNullable<FigmaRestHasFramePropertiesTrait['layoutMode']>;
166
- get primaryAxisSizingMode(): NonNullable<FigmaRestHasFramePropertiesTrait['primaryAxisSizingMode']>;
167
- get counterAxisSizingMode(): NonNullable<FigmaRestHasFramePropertiesTrait['counterAxisSizingMode']>;
168
- get primaryAxisAlignItems(): NonNullable<FigmaRestHasFramePropertiesTrait['primaryAxisAlignItems']>;
169
- get counterAxisAlignItems(): NonNullable<FigmaRestHasFramePropertiesTrait['counterAxisAlignItems']>;
170
- get paddingLeft(): number;
171
- get paddingRight(): number;
172
- get paddingTop(): number;
173
- get paddingBottom(): number;
174
- get itemSpacing(): number;
175
- get layoutWrap(): NonNullable<FigmaRestHasFramePropertiesTrait['layoutWrap']>;
176
- get layoutPositioning(): string;
177
- get layoutSizingHorizontal(): string;
178
- get layoutSizingVertical(): string;
179
- get itemReverseZIndex(): boolean;
180
- get counterAxisAlignContent(): NonNullable<FigmaRestHasFramePropertiesTrait['counterAxisAlignContent']>;
181
- get counterAxisSpacing(): number;
182
- /**
183
- * Normalizes REST API constraint enum names to Plugin API equivalents.
184
- * REST uses directional names (LEFT, RIGHT, TOP, BOTTOM, LEFT_RIGHT, TOP_BOTTOM);
185
- * Plugin API uses abstract names (MIN, MAX, STRETCH). CENTER and SCALE are identical.
186
- */
187
- get constraints(): {
188
- horizontal: string;
189
- vertical: string;
190
- };
191
- get minWidth(): number | null;
192
- get maxWidth(): number | null;
193
- get minHeight(): number | null;
194
- get maxHeight(): number | null;
195
- get clipContent(): boolean;
196
- get locked(): boolean;
197
- get opacity(): number;
198
- get cornerSmoothing(): number;
199
- get rotation(): number;
200
- get strokeWeight(): number;
201
- get strokeAlign(): NonNullable<FigmaRestMinimalStrokesTrait['strokeAlign']>;
202
- get strokeCap(): NonNullable<FigmaRestHasGeometryTrait['strokeCap']>;
203
- get strokeJoin(): NonNullable<FigmaRestMinimalStrokesTrait['strokeJoin']>;
204
- get strokeTopWeight(): number;
205
- get strokeBottomWeight(): number;
206
- get strokeLeftWeight(): number;
207
- get strokeRightWeight(): number;
208
- get cornerRadius(): number | typeof figma.mixed;
209
- get topLeftRadius(): number;
210
- get topRightRadius(): number;
211
- get bottomRightRadius(): number;
212
- get bottomLeftRadius(): number;
213
- get textAlignHorizontal(): string;
214
- get textAlignVertical(): string;
215
- get characters(): string;
216
- get characterStyleOverrides(): number[] | undefined;
217
- get styleOverrideTable(): Record<string, Record<string, unknown>> | undefined;
218
- get componentPropertyReferences(): {
219
- [key: string]: string;
220
- } | null;
221
- get width(): number;
222
- get height(): number;
223
- get x(): number;
224
- get y(): number;
225
- get absoluteBoundingBox(): RestApiNodeData['absoluteBoundingBox'] | null;
226
- get visible(): boolean;
227
- /**
228
- * Get main component asynchronously
229
- * Base implementation returns null - only RestInstanceNode has actual implementation
230
- */
231
- getMainComponentAsync(): Promise<RestBaseNode | null>;
232
- /**
233
- * Get children as wrapped adapter instances
234
- * Cached for performance - only built once
235
- *
236
- * CRITICAL: This getter is required for Anatomy.traverse() to work correctly.
237
- * Without it, traverse() sees raw JSON children instead of wrapped adapter nodes,
238
- * causing shallow anatomy extraction (only 2 elements instead of 14).
239
- */
240
- get children(): RestBaseNode[];
241
- /**
242
- * Build children array from raw data, wrapping each in appropriate adapter
243
- */
244
- protected _buildChildren(): RestBaseNode[];
245
- /**
246
- * Adapt a REST API paint to Plugin API format.
247
- * - Defaults `visible` to true
248
- * - Converts `gradientHandlePositions` → `gradientTransform` for gradient paints
249
- */
250
- private static adaptPaint;
251
- /**
252
- * Convert REST API `gradientHandlePositions` (3 vectors: start, end, width)
253
- * to Plugin API `gradientTransform` (2×3 affine matrix).
254
- *
255
- * REST handle positions use Y-down screen coordinates; the Plugin API
256
- * `gradientTransform` uses Y-up.
257
- *
258
- * LINEAR gradients: p0=start, p1=end, p2=perpendicular width handle.
259
- * Gradient-space mapping: p0→(0,0.5), p1→(1,0.5), p2→(0,0)
260
- * a = p1.x−p0.x b = 2·(p0.x−p2.x) tx = p2.x
261
- * c = p1.y−p0.y d = 2·(p0.y−p2.y) ty = p2.y
262
- *
263
- * RADIAL/ANGULAR gradients: p0=center, p1=horiz radius, p2=vert radius.
264
- * Gradient-space mapping: p0→(0,0), p1→(1,0), p2→(0,1)
265
- * a = p1.x−p0.x b = p2.x−p0.x tx = p0.x
266
- * c = p1.y−p0.y d = p2.y−p0.y ty = p0.y
267
- */
268
- private static handlePositionsToTransform;
269
- toString(): string;
270
- }
271
- export {};
@@ -1,30 +0,0 @@
1
- /**
2
- * RestComponentNode - Adapter for COMPONENT and COMPONENT_SET nodes
3
- *
4
- * Purpose: Extends RestBaseNode to add component-specific properties
5
- * Status: Production migration from validated PoC (2026-01-10)
6
- *
7
- * Key Features:
8
- * - Property-definition-based default variant resolution
9
- * - Component property definitions exposure
10
- * - Children caching for performance
11
- */
12
- import { RestBaseNode, type RestApiNodeData } from './RestBaseNode';
13
- export declare class RestComponentNode extends RestBaseNode {
14
- get componentPropertyDefinitions(): Record<string, unknown>;
15
- /**
16
- * For COMPONENT_SET, returns the default variant child.
17
- *
18
- * Resolves the default by building the expected child name from
19
- * componentPropertyDefinitions VARIANT entries and their defaultValues
20
- * (e.g. "Appearance=On surface, Size=M"). Falls back to first child
21
- * if no property-based match is found.
22
- */
23
- get defaultVariant(): RestComponentNode | null;
24
- _buildChildren(): RestBaseNode[];
25
- /**
26
- * Override wrapChild to route by type
27
- * Ensures children get wrapped in appropriate adapter classes
28
- */
29
- protected wrapChild(childData: RestApiNodeData): RestBaseNode;
30
- }
@@ -1,50 +0,0 @@
1
- /**
2
- * RestInstanceNode - Adapter for INSTANCE nodes
3
- *
4
- * Purpose: Extends RestBaseNode to add instance-specific properties
5
- * Status: Production migration from validated PoC (2026-01-10)
6
- *
7
- * Key Features:
8
- * - Component ID resolution
9
- * - Component properties exposure
10
- * - Main component lookup (requires indexer - Phase 1)
11
- * - Component property references (Phase 1 enhancement)
12
- */
13
- import { RestBaseNode, type RestApiNodeData } from './RestBaseNode';
14
- export declare class RestInstanceNode extends RestBaseNode {
15
- get componentId(): string;
16
- get componentProperties(): Record<string, unknown>;
17
- /**
18
- * Component property references (binding information)
19
- * Maps property IDs to bound node IDs for instance property bindings
20
- *
21
- * TODO: Phase 1 Task T012 - Extract from REST data and map to Plugin API format
22
- */
23
- get componentPropertyReferences(): {
24
- [key: string]: string;
25
- };
26
- /**
27
- * Get main component asynchronously
28
- *
29
- * Uses NodeIndexer to look up component by componentId
30
- * Returns null if indexer not set or component not found
31
- */
32
- getMainComponentAsync(): Promise<RestBaseNode | null>;
33
- /**
34
- * Get instanceOf name (the component this is an instance of)
35
- * Used by Model classes to display instance relationships
36
- *
37
- * Phase 1 T010: Uses indexer to resolve component name
38
- */
39
- get instanceOf(): string | null;
40
- /**
41
- * Synchronous main component getter (legacy support)
42
- * Delegates to async method - may return Promise in REST mode
43
- */
44
- get mainComponent(): Promise<RestBaseNode | null>;
45
- _buildChildren(): RestBaseNode[];
46
- /**
47
- * Override wrapChild to route by type
48
- */
49
- protected wrapChild(childData: RestApiNodeData): RestBaseNode;
50
- }
@@ -1,51 +0,0 @@
1
- /**
2
- * RestLibraryFile - Wrapper for Figma REST API JSON library data
3
- *
4
- * Purpose: Provide validated access to component library JSON structure
5
- * Scope: Internal to specs-from-figma, not exported in public API
6
- *
7
- * Features:
8
- * - Basic schema validation
9
- * - Component lookup by name or ID
10
- * - Node indexing for O(1) lookups
11
- * - Component wrapping in adapter classes
12
- *
13
- * Note: File I/O removed - CLI/Plugin passes pre-loaded JSON
14
- */
15
- import { RestComponentNode } from '../RestApi/RestComponentNode.js';
16
- import { NodeIndexer } from '../RestApi/NodeIndexer.js';
17
- export interface RestApiFileData {
18
- document: any;
19
- components?: Record<string, any>;
20
- componentSets?: Record<string, any>;
21
- styles?: Record<string, any>;
22
- variables?: Record<string, any>;
23
- schemaVersion?: number;
24
- name?: string;
25
- }
26
- /**
27
- * Represents a Figma REST API library file (internal to transformer)
28
- */
29
- export declare class RestLibraryFile {
30
- private _data;
31
- private _indexer;
32
- constructor(data: RestApiFileData);
33
- /**
34
- * Validate required structure
35
- */
36
- private validate;
37
- /**
38
- * Get or create the node indexer
39
- * Indexer provides O(1) lookups for components, parents, etc.
40
- */
41
- getIndexer(): NodeIndexer;
42
- /**
43
- * Find a component by name or ID
44
- * Returns null if not found
45
- */
46
- findComponent(nameOrId: string): RestComponentNode | null;
47
- /**
48
- * Find all components in the file
49
- */
50
- findAllComponents(): RestComponentNode[];
51
- }
@@ -1,41 +0,0 @@
1
- /**
2
- * REST API text nodes have typography properties nested under style.*
3
- * Unlike Plugin API where they're at the top level (node.fontSize, node.fontName, etc.)
4
- * Also includes styles object for text style and effect style references
5
- */
6
- export interface RESTTextStyleOverride {
7
- fontFamily?: string;
8
- fontStyle?: string;
9
- fontSize?: number;
10
- letterSpacing?: number;
11
- lineHeightUnit?: string;
12
- lineHeightPercentFontSize?: number;
13
- lineHeightPx?: number;
14
- }
15
- export interface RESTTextNode extends TextNode {
16
- style?: {
17
- fontSize?: number;
18
- fontFamily?: string;
19
- fontStyle?: string;
20
- letterSpacing?: number;
21
- lineHeightUnit?: string;
22
- lineHeightPercentFontSize?: number;
23
- lineHeightPx?: number;
24
- textCase?: string;
25
- textDecoration?: string;
26
- leadingTrim?: string;
27
- paragraphIndent?: number;
28
- paragraphSpacing?: number;
29
- listSpacing?: number;
30
- hangingPunctuation?: boolean;
31
- hangingList?: boolean;
32
- };
33
- styles?: {
34
- text?: string;
35
- effect?: string;
36
- fill?: string;
37
- stroke?: string;
38
- };
39
- characterStyleOverrides?: number[];
40
- styleOverrideTable?: Record<string, RESTTextStyleOverride>;
41
- }
@@ -1,97 +0,0 @@
1
- import { ResolvedConfig } from '@directededges/specs-schema';
2
- import { FigmaElementNode, FigmaContainerNode } from '../Nodes/types.js';
3
- import type { LayoutTree } from '../Layout/types.js';
4
- import type { Anatomy as AnovaAnatomy } from '@directededges/specs-schema';
5
- import { ProcessingContext } from '../../Runtime/Context/interfaces.js';
6
- import { Variant } from '../Variants/Variant.js';
7
- import { AnatomyElement } from './AnatomyElement.js';
8
- import type { Elements } from '../Elements/Elements.js';
9
- export type AnatomyItems = Record<string, AnatomyElement>;
10
- export declare class Anatomy {
11
- private _items;
12
- private config;
13
- constructor(config: ResolvedConfig);
14
- /**
15
- * Get the anatomy element name for a node.
16
- * Root nodes (when isRoot is true) are named 'root', all others use their Figma name.
17
- */
18
- static getAnatomyElementName(node: FigmaElementNode, isRoot?: boolean): string;
19
- addNewElementsFromVariant(variant: Variant): void;
20
- /**
21
- * Populate anatomy from a slot content Elements set (no variant context).
22
- * All elements keep their Figma names — none is renamed to 'root'.
23
- */
24
- addFromElements(elements: Elements): void;
25
- add(elementNode: FigmaElementNode, elementName: string, variant: Variant | null): void;
26
- resolveInstanceNames(context?: ProcessingContext): Promise<void>;
27
- data(subcomponentRefs?: Map<string, string>): AnovaAnatomy;
28
- get(name: string): AnatomyElement | undefined;
29
- has(name: string): boolean;
30
- /**
31
- * Returns an iterator over [name, element] entries.
32
- * @example
33
- * for (const [name, element] of anatomy.entries()) {
34
- * console.log(name, element);
35
- * }
36
- */
37
- entries(): IterableIterator<[string, AnatomyElement]>;
38
- /**
39
- * Returns an iterator over anatomy element values.
40
- * @example
41
- * for (const element of anatomy.values()) {
42
- * await element.postProcess();
43
- * }
44
- */
45
- values(): IterableIterator<AnatomyElement>;
46
- /**
47
- * Returns an iterator over anatomy element names.
48
- * @example
49
- * for (const name of anatomy.keys()) {
50
- * console.log(name);
51
- * }
52
- */
53
- keys(): IterableIterator<string>;
54
- /**
55
- * Makes Anatomy directly iterable (defaults to entries).
56
- * @example
57
- * for (const [name, element] of anatomy) {
58
- * console.log(name, element);
59
- * }
60
- */
61
- [Symbol.iterator](): IterableIterator<[string, AnatomyElement]>;
62
- /**
63
- * Returns the number of anatomy elements in the collection.
64
- */
65
- get size(): number;
66
- /**
67
- * Checks if the collection is empty.
68
- * @example
69
- * if (anatomy.isEmpty()) {
70
- * return;
71
- * }
72
- */
73
- isEmpty(): boolean;
74
- /**
75
- * Detect the code-only props container among direct children of a root node.
76
- * Returns the first matching container and the set of matching child names
77
- * for anatomy exclusion during traverse().
78
- */
79
- static exclusions(rootNode: FigmaElementNode, pattern?: string): {
80
- container?: FigmaElementNode;
81
- excludeNames?: Set<string>;
82
- };
83
- static traverse(componentNode: FigmaContainerNode, excludeRootChildren?: Set<string>): {
84
- nodes: FigmaElementNode[];
85
- tree: LayoutTree;
86
- };
87
- /**
88
- * Traverse the children of a slot node as a slot content space.
89
- * Unlike traverse(), no node is renamed to 'root' — all nodes keep their Figma names.
90
- * Traversal stops at INSTANCE children (each instance's slots are their own spaces).
91
- * Returns collected nodes and a synthetic LayoutTree whose root holds the slot's content children.
92
- */
93
- static traverseSlotContent(slotNode: FigmaContainerNode): {
94
- nodes: FigmaElementNode[];
95
- tree: LayoutTree;
96
- };
97
- }