@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.
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/Adapters/RestApi/NodeIndexer.d.ts +0 -118
- package/dist/Adapters/RestApi/RestBaseNode.d.ts +0 -271
- package/dist/Adapters/RestApi/RestComponentNode.d.ts +0 -30
- package/dist/Adapters/RestApi/RestInstanceNode.d.ts +0 -50
- package/dist/Adapters/RestApi/RestLibraryFile.d.ts +0 -51
- package/dist/Adapters/RestApi/RestTextNode.d.ts +0 -41
- package/dist/Component/Anatomy/Anatomy.d.ts +0 -97
- package/dist/Component/Anatomy/AnatomyElement.d.ts +0 -24
- package/dist/Component/Children/Children.d.ts +0 -96
- package/dist/Component/Color/Color.d.ts +0 -63
- package/dist/Component/Component.d.ts +0 -71
- package/dist/Component/Effects/Blur.d.ts +0 -41
- package/dist/Component/Effects/Effects.d.ts +0 -51
- package/dist/Component/Effects/EffectsProcessor.d.ts +0 -15
- package/dist/Component/Effects/Shadow.d.ts +0 -51
- package/dist/Component/Effects/index.d.ts +0 -4
- package/dist/Component/Elements/BaseElement.d.ts +0 -87
- package/dist/Component/Elements/ElementFactory.d.ts +0 -7
- package/dist/Component/Elements/ElementFactoryRegistry.d.ts +0 -21
- package/dist/Component/Elements/Elements.d.ts +0 -86
- package/dist/Component/Elements/Primitives/ComponentElement.d.ts +0 -8
- package/dist/Component/Elements/Primitives/EllipseElement.d.ts +0 -8
- package/dist/Component/Elements/Primitives/FrameElement.d.ts +0 -8
- package/dist/Component/Elements/Primitives/GlyphElement.d.ts +0 -21
- package/dist/Component/Elements/Primitives/InstanceElement.d.ts +0 -24
- package/dist/Component/Elements/Primitives/LineElement.d.ts +0 -8
- package/dist/Component/Elements/Primitives/PolygonElement.d.ts +0 -8
- package/dist/Component/Elements/Primitives/RectangleElement.d.ts +0 -8
- package/dist/Component/Elements/Primitives/SlotElement.d.ts +0 -8
- package/dist/Component/Elements/Primitives/StarElement.d.ts +0 -8
- package/dist/Component/Elements/Primitives/TextElement.d.ts +0 -8
- package/dist/Component/Elements/Primitives/VectorElement.d.ts +0 -8
- package/dist/Component/Elements/index.d.ts +0 -12
- package/dist/Component/Gradient/Gradient.d.ts +0 -73
- package/dist/Component/Gradient/GradientProcessor.d.ts +0 -18
- package/dist/Component/Gradient/index.d.ts +0 -2
- package/dist/Component/InstanceExamples/InstanceExample.d.ts +0 -35
- package/dist/Component/InstanceExamples/InstanceExamples.d.ts +0 -49
- package/dist/Component/Layout/Layout.d.ts +0 -26
- package/dist/Component/Layout/types.d.ts +0 -61
- package/dist/Component/Metadata/Metadata.d.ts +0 -13
- package/dist/Component/Metadata/constants.d.ts +0 -8
- package/dist/Component/Nodes/types.d.ts +0 -4
- package/dist/Component/PropConfigurations/PropConfiguration.d.ts +0 -15
- package/dist/Component/PropConfigurations/PropConfigurations.d.ts +0 -55
- package/dist/Component/Props/CodeOnlyProps/BooleanCodeOnlyProp.d.ts +0 -11
- package/dist/Component/Props/CodeOnlyProps/CodeOnlyProps.d.ts +0 -36
- package/dist/Component/Props/CodeOnlyProps/InstanceCodeOnlyProp.d.ts +0 -19
- package/dist/Component/Props/CodeOnlyProps/TextCodeOnlyProp.d.ts +0 -18
- package/dist/Component/Props/CodeOnlyProps/index.d.ts +0 -4
- package/dist/Component/Props/PropBinding.d.ts +0 -69
- package/dist/Component/Props/PropPair.d.ts +0 -16
- package/dist/Component/Props/PropPairings.d.ts +0 -89
- package/dist/Component/Props/Props.d.ts +0 -93
- package/dist/Component/Props/SlotConstraints.d.ts +0 -37
- package/dist/Component/SlotContent/SlotCandidate.d.ts +0 -42
- package/dist/Component/SlotContent/SlotContent.d.ts +0 -84
- package/dist/Component/SlotContent/SlotDetector.d.ts +0 -85
- package/dist/Component/SlotContent/SlotItem.d.ts +0 -44
- package/dist/Component/SlotContent/SlotRegistry.d.ts +0 -61
- package/dist/Component/Styles/Composites/BiaxialComposite.d.ts +0 -64
- package/dist/Component/Styles/Composites/QuadComposite.d.ts +0 -80
- package/dist/Component/Styles/Composites/index.d.ts +0 -4
- package/dist/Component/Styles/Primitives/AspectRatioStyle.d.ts +0 -34
- package/dist/Component/Styles/Primitives/BooleanStyle.d.ts +0 -6
- package/dist/Component/Styles/Primitives/ColorStyle.d.ts +0 -29
- package/dist/Component/Styles/Primitives/ConditionalStyle.d.ts +0 -30
- package/dist/Component/Styles/Primitives/CornerStyle.d.ts +0 -12
- package/dist/Component/Styles/Primitives/EffectsStyle.d.ts +0 -13
- package/dist/Component/Styles/Primitives/IconFillStyle.d.ts +0 -40
- package/dist/Component/Styles/Primitives/MixedStyle.d.ts +0 -5
- package/dist/Component/Styles/Primitives/NumberStyle.d.ts +0 -7
- package/dist/Component/Styles/Primitives/PaddingStyle.d.ts +0 -13
- package/dist/Component/Styles/Primitives/StringStyle.d.ts +0 -5
- package/dist/Component/Styles/Primitives/StrokeStyle.d.ts +0 -12
- package/dist/Component/Styles/Primitives/TypographyStyle.d.ts +0 -21
- package/dist/Component/Styles/Primitives/index.d.ts +0 -13
- package/dist/Component/Styles/Primitives/mapping.d.ts +0 -85
- package/dist/Component/Styles/References/FigmaStyleReference.d.ts +0 -45
- package/dist/Component/Styles/References/FigmaVariableReference.d.ts +0 -61
- package/dist/Component/Styles/References/index.d.ts +0 -24
- package/dist/Component/Styles/Style.d.ts +0 -88
- package/dist/Component/Styles/Styles.d.ts +0 -108
- package/dist/Component/Styles/StylesProcessor.d.ts +0 -96
- package/dist/Component/Styles/defaults.d.ts +0 -2
- package/dist/Component/Styles/figmaKeyMap.d.ts +0 -12
- package/dist/Component/Styles/keys.d.ts +0 -20
- package/dist/Component/Subcomponents/Subcomponent.d.ts +0 -20
- package/dist/Component/Subcomponents/Subcomponents.d.ts +0 -83
- package/dist/Component/Typography/FontStyle.d.ts +0 -6
- package/dist/Component/Typography/LetterSpacingStyle.d.ts +0 -4
- package/dist/Component/Typography/LineHeightStyle.d.ts +0 -4
- package/dist/Component/Typography/Typography.d.ts +0 -105
- package/dist/Component/Typography/TypographyProcessor.d.ts +0 -33
- package/dist/Component/Typography/constants.d.ts +0 -20
- package/dist/Component/Typography/defaults.d.ts +0 -30
- package/dist/Component/Typography/keys.d.ts +0 -12
- package/dist/Component/Variants/Differencer.d.ts +0 -47
- package/dist/Component/Variants/Variant.d.ts +0 -55
- package/dist/Component/Variants/Variants.d.ts +0 -91
- package/dist/Components/Components.d.ts +0 -68
- package/dist/Config/types.Settings.d.ts +0 -30
- package/dist/Constants/ApiMappings.d.ts +0 -31
- package/dist/Constants/BindingKeys.d.ts +0 -2
- package/dist/Constants/DevSettings.d.ts +0 -4
- package/dist/Constants/Nodes.d.ts +0 -1
- package/dist/License/LicenseManager.d.ts +0 -43
- package/dist/License/ProxyClient.d.ts +0 -25
- package/dist/License/constants.d.ts +0 -41
- package/dist/License/types.d.ts +0 -83
- package/dist/Progress/PhaseConfiguration.d.ts +0 -20
- package/dist/Progress/Progress.d.ts +0 -107
- package/dist/Progress/ProgressCoordinator.d.ts +0 -33
- package/dist/Runtime/Context/interfaces.d.ts +0 -73
- package/dist/Runtime/Foundations/FigmaPluginFoundations.d.ts +0 -37
- package/dist/Runtime/Foundations/FigmaRESTFoundations.d.ts +0 -72
- package/dist/Runtime/Foundations/FigmaRESTMaps.d.ts +0 -55
- package/dist/Runtime/Foundations/interfaces.d.ts +0 -72
- package/dist/Runtime/Nodes/FigmaPluginNodes.d.ts +0 -45
- package/dist/Runtime/Nodes/FigmaRestNodes.d.ts +0 -43
- package/dist/Runtime/Nodes/NodeAccess.d.ts +0 -23
- package/dist/Runtime/Nodes/interfaces.d.ts +0 -60
- package/dist/Utilities/Utilities.d.ts +0 -44
- package/dist/Utilities/types.ReferenceValue.d.ts +0 -16
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ProgressCallback, ChunkInfo } from './Progress.js';
|
|
2
|
-
import { PhaseConfiguration } from './PhaseConfiguration.js';
|
|
3
|
-
/**
|
|
4
|
-
* ProgressCoordinator wraps progress callback logic to keep Model/Output classes clean
|
|
5
|
-
* Provides simple helper methods for notifying progress phases
|
|
6
|
-
*/
|
|
7
|
-
export declare class ProgressCoordinator {
|
|
8
|
-
private callback?;
|
|
9
|
-
private config;
|
|
10
|
-
private currentStep;
|
|
11
|
-
private currentPhase;
|
|
12
|
-
constructor(config: PhaseConfiguration, callback?: ProgressCallback);
|
|
13
|
-
/**
|
|
14
|
-
* Notify that a phase has started
|
|
15
|
-
* Only increments step counter for new phases, not for chunks within a phase
|
|
16
|
-
* @param phase - Phase name from PHASE_NAMES
|
|
17
|
-
* @param chunkInfo - Optional chunk range for variant-heavy phases
|
|
18
|
-
*/
|
|
19
|
-
notifyPhase(phase: string, chunkInfo?: ChunkInfo): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Process items in chunks if they exceed threshold, automatically managing progress notifications
|
|
22
|
-
* Handles threshold detection and chunk range calculation internally
|
|
23
|
-
* @param items - Array of items to process
|
|
24
|
-
* @param phase - Phase name for progress display
|
|
25
|
-
* @param processor - Async function to process each chunk
|
|
26
|
-
*/
|
|
27
|
-
forEachChunk<T>(items: T[], phase: string, processor: (chunk: T[]) => Promise<void>): Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Get current step number (useful for manual progress management)
|
|
30
|
-
* @returns Current step count
|
|
31
|
-
*/
|
|
32
|
-
getCurrentStep(): number;
|
|
33
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ProcessingContext - Container for runtime services needed by Model
|
|
3
|
-
*
|
|
4
|
-
* Purpose: Internal context object for component processing
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* - Created by Component factory methods
|
|
8
|
-
* - Passed to processing pipeline
|
|
9
|
-
* - Contains runtime environment info and data loaders
|
|
10
|
-
*/
|
|
11
|
-
import type { FigmaFoundations } from '../Foundations/interfaces.js';
|
|
12
|
-
import type { FigmaNodes } from '../Nodes/interfaces.js';
|
|
13
|
-
import type { LicenseResult } from '../../License/types.js';
|
|
14
|
-
/**
|
|
15
|
-
* Runtime environment type
|
|
16
|
-
*/
|
|
17
|
-
export type RuntimeEnvironment = 'PLUGIN' | 'REST';
|
|
18
|
-
/**
|
|
19
|
-
* Context object containing runtime services for Model processing
|
|
20
|
-
*/
|
|
21
|
-
export interface ProcessingContext {
|
|
22
|
-
/**
|
|
23
|
-
* Accessing styles and variables
|
|
24
|
-
*/
|
|
25
|
-
foundations?: FigmaFoundations;
|
|
26
|
-
/**
|
|
27
|
-
* Node resolver for looking up nodes by ID
|
|
28
|
-
*/
|
|
29
|
-
nodes?: FigmaNodes;
|
|
30
|
-
/**
|
|
31
|
-
* Runtime environment - determines API structure
|
|
32
|
-
* PLUGIN: Figma Plugin API (node.fontSize, node.fontName, etc.)
|
|
33
|
-
* REST: Figma REST API (node.style.fontSize, node.style.fontFamily, etc.)
|
|
34
|
-
*/
|
|
35
|
-
runtime?: RuntimeEnvironment;
|
|
36
|
-
/**
|
|
37
|
-
* Author name for metadata attribution
|
|
38
|
-
* Falls back to figma.currentUser.name in Plugin, or "Unknown" if not provided
|
|
39
|
-
*/
|
|
40
|
-
author?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Resolved license outcome. Set once by the factory method before _process().
|
|
43
|
-
* Used throughout the pipeline to gate premium detection and output.
|
|
44
|
-
* Absent means free-tier (tier 0).
|
|
45
|
-
*/
|
|
46
|
-
license?: LicenseResult;
|
|
47
|
-
/**
|
|
48
|
-
* Generator identity stamped into metadata.generator.
|
|
49
|
-
* Set by REST callers (CLI, etc.) to identify themselves.
|
|
50
|
-
* When absent, Metadata falls back to the plugin identity constants.
|
|
51
|
-
*/
|
|
52
|
-
generator?: {
|
|
53
|
-
name: string;
|
|
54
|
-
version: string;
|
|
55
|
-
url: string;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/** PRO tier — public ecommerce (Tier 1) */
|
|
59
|
-
export declare const PRO = 1;
|
|
60
|
-
/** @internal ENTERPRISE tier (Tier 2) */
|
|
61
|
-
export declare const ENTERPRISE = 2;
|
|
62
|
-
/** @internal PARTNER tier (Tier 3) */
|
|
63
|
-
export declare const PARTNER = 3;
|
|
64
|
-
/**
|
|
65
|
-
* Null-safe tier check for license gating.
|
|
66
|
-
* Returns true when the context's license tier meets or exceeds the required tier.
|
|
67
|
-
* When context or license is absent, tier defaults to 0 (FREE).
|
|
68
|
-
*
|
|
69
|
-
* @param context - Processing context (may be undefined)
|
|
70
|
-
* @param requiredTier - Minimum tier needed (use PRO, ENTERPRISE, or PARTNER constants)
|
|
71
|
-
* @returns true if entitled
|
|
72
|
-
*/
|
|
73
|
-
export declare function entitled(context: ProcessingContext | undefined, requiredTier: number): boolean;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FigmaPluginFoundations - FigmaFoundations implementation for the Figma Plugin runtime.
|
|
3
|
-
*
|
|
4
|
-
* Purpose: Provides foundation data access (styles, variables, collections) using
|
|
5
|
-
* the figma.* global APIs. Lives here next to the FigmaFoundations interface and
|
|
6
|
-
* the REST adapter so both runtime implementations stay in lockstep; `figma.*` is
|
|
7
|
-
* referenced only inside methods, so bundling this into the CLI/REST build is
|
|
8
|
-
* inert (it is never instantiated there).
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* const loader = new FigmaPluginFoundations();
|
|
12
|
-
* const style = await loader.getStyle('styleId');
|
|
13
|
-
* const variable = await loader.getVariable('variableId');
|
|
14
|
-
*/
|
|
15
|
-
import type { VariableDefinition, VariableCollection, StyleDefinition, CodeSyntaxPlatform, FigmaFoundations } from './interfaces.js';
|
|
16
|
-
export declare class FigmaPluginFoundations implements FigmaFoundations {
|
|
17
|
-
/**
|
|
18
|
-
* Get style by ID
|
|
19
|
-
*/
|
|
20
|
-
getStyle(styleId: string): Promise<StyleDefinition | null>;
|
|
21
|
-
/**
|
|
22
|
-
* Get variable by ID
|
|
23
|
-
*/
|
|
24
|
-
getVariable(variableId: string): Promise<VariableDefinition | null>;
|
|
25
|
-
/**
|
|
26
|
-
* Get variable collection by ID
|
|
27
|
-
*/
|
|
28
|
-
getCollection(collectionId: string): Promise<VariableCollection | null>;
|
|
29
|
-
/**
|
|
30
|
-
* Get variable name with optional platform-specific code syntax
|
|
31
|
-
*/
|
|
32
|
-
getVariableName(variableId: string, platform?: CodeSyntaxPlatform | 'DEFAULT'): Promise<string | null>;
|
|
33
|
-
/**
|
|
34
|
-
* Get collection name for a variable
|
|
35
|
-
*/
|
|
36
|
-
getCollectionName(variableId: string): Promise<string | null>;
|
|
37
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FigmaRESTDataResolver - REST API implementation of DataLoader interface
|
|
3
|
-
*
|
|
4
|
-
* Purpose: Provides DataLoader interface for pre-loaded REST API data
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* // Consumer builds Maps from their data sources
|
|
8
|
-
* const variableMap = new Map<string, VariableDefinition>();
|
|
9
|
-
* const collectionMap = new Map<string, VariableCollection>();
|
|
10
|
-
* const styleMap = new Map<string, StyleDefinition>();
|
|
11
|
-
*
|
|
12
|
-
* // Pass to constructor
|
|
13
|
-
* const dataLoader = new FigmaRESTDataResolver(variableMap, collectionMap, styleMap);
|
|
14
|
-
*
|
|
15
|
-
* // Use in ProcessingContext
|
|
16
|
-
* await component.process(undefined, { dataLoader, ... });
|
|
17
|
-
*
|
|
18
|
-
* Note: Data loading/parsing is the consumer's responsibility (CLI/MCP).
|
|
19
|
-
* This class only provides runtime lookup via DataLoader interface.
|
|
20
|
-
*/
|
|
21
|
-
import type { FigmaFoundations, VariableDefinition, VariableCollection, StyleDefinition, CodeSyntaxPlatform } from './interfaces.js';
|
|
22
|
-
export type VariableValue = boolean | number | string | RGB | VariableAlias;
|
|
23
|
-
export interface RGB {
|
|
24
|
-
r: number;
|
|
25
|
-
g: number;
|
|
26
|
-
b: number;
|
|
27
|
-
a?: number;
|
|
28
|
-
}
|
|
29
|
-
export interface VariableAlias {
|
|
30
|
-
type: 'VARIABLE_ALIAS';
|
|
31
|
-
id: string;
|
|
32
|
-
}
|
|
33
|
-
export declare class FigmaRESTDataResolver implements FigmaFoundations {
|
|
34
|
-
private variableMap;
|
|
35
|
-
private collectionMap;
|
|
36
|
-
private styleMap;
|
|
37
|
-
constructor(variableMap: Map<string, VariableDefinition>, collectionMap: Map<string, VariableCollection>, styleMap: Map<string, StyleDefinition>);
|
|
38
|
-
/**
|
|
39
|
-
* Get variable name with optional platform-specific code syntax
|
|
40
|
-
*/
|
|
41
|
-
getVariableName(variableId: string, platform?: CodeSyntaxPlatform | 'DEFAULT'): Promise<string | null>;
|
|
42
|
-
/**
|
|
43
|
-
* Get collection name for a variable
|
|
44
|
-
*/
|
|
45
|
-
getCollectionName(variableId: string): Promise<string | null>;
|
|
46
|
-
/**
|
|
47
|
-
* Get style by ID
|
|
48
|
-
*/
|
|
49
|
-
getStyle(styleId: string): Promise<StyleDefinition | null>;
|
|
50
|
-
/**
|
|
51
|
-
* Get variable by ID
|
|
52
|
-
*/
|
|
53
|
-
getVariable(variableId: string): Promise<VariableDefinition | null>;
|
|
54
|
-
/**
|
|
55
|
-
* Get collection by ID
|
|
56
|
-
*/
|
|
57
|
-
getCollection(collectionId: string): Promise<VariableCollection | null>;
|
|
58
|
-
/**
|
|
59
|
-
* Convert RGB color to hex string
|
|
60
|
-
*/
|
|
61
|
-
static rgbToHex(color: RGB): string;
|
|
62
|
-
/**
|
|
63
|
-
* Populate variable style object with name and collection info
|
|
64
|
-
* Equivalent to Utilities.variableLookup() for REST API
|
|
65
|
-
*/
|
|
66
|
-
populateVariableStyle(variableStyle: {
|
|
67
|
-
id: string;
|
|
68
|
-
name?: string;
|
|
69
|
-
collectionName?: string;
|
|
70
|
-
collectionId?: string;
|
|
71
|
-
}, codeSyntaxPlatform?: CodeSyntaxPlatform | 'DEFAULT', includeCollectionName?: boolean): Promise<void>;
|
|
72
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for external data structures
|
|
3
|
-
*
|
|
4
|
-
* These types define the shape of Maps passed from CLI/external environments
|
|
5
|
-
* to the transformer for styles, variables, and collections data.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Map type for styles data
|
|
11
|
-
* Matches DataLoader interface definition
|
|
12
|
-
*/
|
|
13
|
-
export type StylesMap = Map<string, {
|
|
14
|
-
id: string;
|
|
15
|
-
name: string;
|
|
16
|
-
type: 'FILL' | 'STROKE' | 'TEXT' | 'EFFECT' | 'GRID' | 'PAINT';
|
|
17
|
-
description?: string;
|
|
18
|
-
[key: string]: unknown;
|
|
19
|
-
}>;
|
|
20
|
-
/**
|
|
21
|
-
* Map type for variables data
|
|
22
|
-
* Matches DataLoader interface definition
|
|
23
|
-
*/
|
|
24
|
-
export type VariablesMap = Map<string, {
|
|
25
|
-
id: string;
|
|
26
|
-
name: string;
|
|
27
|
-
key: string;
|
|
28
|
-
variableCollectionId: string;
|
|
29
|
-
resolvedType: 'BOOLEAN' | 'FLOAT' | 'STRING' | 'COLOR';
|
|
30
|
-
valuesByMode: Record<string, unknown>;
|
|
31
|
-
remote: boolean;
|
|
32
|
-
description?: string;
|
|
33
|
-
scopes?: string[];
|
|
34
|
-
codeSyntax?: {
|
|
35
|
-
WEB?: string;
|
|
36
|
-
ANDROID?: string;
|
|
37
|
-
iOS?: string;
|
|
38
|
-
};
|
|
39
|
-
}>;
|
|
40
|
-
/**
|
|
41
|
-
* Map type for variable collections data
|
|
42
|
-
* Matches DataLoader interface definition
|
|
43
|
-
*/
|
|
44
|
-
export type CollectionsMap = Map<string, {
|
|
45
|
-
id: string;
|
|
46
|
-
name: string;
|
|
47
|
-
key: string;
|
|
48
|
-
modes: Array<{
|
|
49
|
-
modeId: string;
|
|
50
|
-
name: string;
|
|
51
|
-
}>;
|
|
52
|
-
defaultModeId: string;
|
|
53
|
-
variableIds: string[];
|
|
54
|
-
remote: boolean;
|
|
55
|
-
}>;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DataLoader - Interface for loading Figma data (styles, variables, collections)
|
|
3
|
-
*
|
|
4
|
-
* Purpose: Abstract data access to support both Plugin API and REST API sources
|
|
5
|
-
*
|
|
6
|
-
* Implementations:
|
|
7
|
-
* - PluginApiDataLoader: Uses figma.* global APIs in plugin environment
|
|
8
|
-
* - FigmaRESTDataResolver: Uses pre-loaded REST API JSON data
|
|
9
|
-
*/
|
|
10
|
-
export interface VariableDefinition {
|
|
11
|
-
id: string;
|
|
12
|
-
name: string;
|
|
13
|
-
key: string;
|
|
14
|
-
variableCollectionId: string;
|
|
15
|
-
resolvedType: 'BOOLEAN' | 'FLOAT' | 'STRING' | 'COLOR';
|
|
16
|
-
valuesByMode: Record<string, unknown>;
|
|
17
|
-
remote: boolean;
|
|
18
|
-
description?: string;
|
|
19
|
-
scopes?: string[];
|
|
20
|
-
codeSyntax?: {
|
|
21
|
-
WEB?: string;
|
|
22
|
-
ANDROID?: string;
|
|
23
|
-
iOS?: string;
|
|
24
|
-
};
|
|
25
|
-
$custom?: Record<string, unknown>;
|
|
26
|
-
}
|
|
27
|
-
export interface VariableCollection {
|
|
28
|
-
id: string;
|
|
29
|
-
name: string;
|
|
30
|
-
key: string;
|
|
31
|
-
modes: Array<{
|
|
32
|
-
modeId: string;
|
|
33
|
-
name: string;
|
|
34
|
-
}>;
|
|
35
|
-
defaultModeId: string;
|
|
36
|
-
variableIds: string[];
|
|
37
|
-
remote: boolean;
|
|
38
|
-
}
|
|
39
|
-
export interface StyleDefinition {
|
|
40
|
-
id: string;
|
|
41
|
-
name: string;
|
|
42
|
-
type: 'FILL' | 'STROKE' | 'TEXT' | 'EFFECT' | 'GRID' | 'PAINT';
|
|
43
|
-
description?: string;
|
|
44
|
-
$custom?: Record<string, unknown>;
|
|
45
|
-
[key: string]: unknown;
|
|
46
|
-
}
|
|
47
|
-
export type CodeSyntaxPlatform = 'WEB' | 'ANDROID' | 'iOS';
|
|
48
|
-
/**
|
|
49
|
-
* Data loader interface for accessing Figma styles and variables
|
|
50
|
-
*/
|
|
51
|
-
export interface FigmaFoundations {
|
|
52
|
-
/**
|
|
53
|
-
* Get style by ID
|
|
54
|
-
*/
|
|
55
|
-
getStyle(styleId: string): Promise<StyleDefinition | null>;
|
|
56
|
-
/**
|
|
57
|
-
* Get variable by ID
|
|
58
|
-
*/
|
|
59
|
-
getVariable(variableId: string): Promise<VariableDefinition | null>;
|
|
60
|
-
/**
|
|
61
|
-
* Get variable collection by ID
|
|
62
|
-
*/
|
|
63
|
-
getCollection(collectionId: string): Promise<VariableCollection | null>;
|
|
64
|
-
/**
|
|
65
|
-
* Get variable name with optional platform-specific code syntax
|
|
66
|
-
*/
|
|
67
|
-
getVariableName(variableId: string, platform: CodeSyntaxPlatform | 'DEFAULT'): Promise<string | null>;
|
|
68
|
-
/**
|
|
69
|
-
* Get collection name for a variable
|
|
70
|
-
*/
|
|
71
|
-
getCollectionName(variableId: string): Promise<string | null>;
|
|
72
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FigmaPluginNodes - FigmaNodes implementation for the Figma Plugin runtime.
|
|
3
|
-
*
|
|
4
|
-
* Purpose: Provides node lookup using the figma.* global APIs.
|
|
5
|
-
* Usage: Plugin runtime only — instantiated by the plugin and passed via
|
|
6
|
-
* ProcessingContext. Lives here (next to the FigmaNodes interface and the REST
|
|
7
|
-
* adapter) so both runtime implementations of the contract stay in lockstep;
|
|
8
|
-
* `figma.*` is referenced only inside methods, so bundling this into the CLI/REST
|
|
9
|
-
* build is inert (it is never instantiated there).
|
|
10
|
-
*/
|
|
11
|
-
import type { FigmaNodes, PageScanResult } from './interfaces.js';
|
|
12
|
-
export declare class FigmaPluginNodes implements FigmaNodes {
|
|
13
|
-
/**
|
|
14
|
-
* Get node by ID using Plugin API
|
|
15
|
-
*/
|
|
16
|
-
getNodeById(id: string): Promise<SceneNode | null>;
|
|
17
|
-
/**
|
|
18
|
-
* Get component name for instance swap property
|
|
19
|
-
* Returns component-set name if applicable, else component name, else null
|
|
20
|
-
*/
|
|
21
|
-
getComponentNameForInstanceSwap(componentId: string): Promise<string | null>;
|
|
22
|
-
/**
|
|
23
|
-
* Get all sibling nodes on the same page that match the specified types.
|
|
24
|
-
* Traverses up to the page, then walks the page subtree collecting matching
|
|
25
|
-
* nodes. Descends into organizational containers (SECTION, FRAME, GROUP) so
|
|
26
|
-
* components nested inside them are found, but stops at any COMPONENT/
|
|
27
|
-
* COMPONENT_SET (never descends into a set's variants or a component's
|
|
28
|
-
* internals).
|
|
29
|
-
*/
|
|
30
|
-
getPageSiblings(nodeId: string, types: string[]): Promise<PageScanResult[]>;
|
|
31
|
-
/**
|
|
32
|
-
* FILE-scope discovery (ADR-050) is not supported in the Figma plugin runtime:
|
|
33
|
-
* the plugin always uses PAGE scope (see SpecsController, which hard-codes
|
|
34
|
-
* `instanceExamples.scope = 'PAGE'`). This method exists only to satisfy the
|
|
35
|
-
* shared {@link FigmaNodes} interface — FILE scope is implemented by the REST
|
|
36
|
-
* runtime (FigmaRestNodes). It throws if ever invoked so that a future
|
|
37
|
-
* FILE-scope wiring fails loudly rather than silently returning nothing.
|
|
38
|
-
*/
|
|
39
|
-
getAllPagesNodes(_types: string[]): Promise<PageScanResult[]>;
|
|
40
|
-
/**
|
|
41
|
-
* Recursive boundary walk shared by getPageSiblings and getAllPagesNodes.
|
|
42
|
-
* Descends SECTION/FRAME/GROUP; stops at COMPONENT/COMPONENT_SET/INSTANCE.
|
|
43
|
-
*/
|
|
44
|
-
private _collectFromPage;
|
|
45
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FigmaRestNodes - FigmaNodes implementation for REST API data
|
|
3
|
-
*
|
|
4
|
-
* Purpose: Provides node lookup using NodeIndexer for offline/CLI processing
|
|
5
|
-
* Usage: CLI runtime only - instantiate with NodeIndexer and pass via ProcessingContext
|
|
6
|
-
*/
|
|
7
|
-
import type { FigmaNodes, PageScanResult } from './interfaces.js';
|
|
8
|
-
import type { NodeIndexer } from '../../Adapters/RestApi/NodeIndexer.js';
|
|
9
|
-
export declare class FigmaRestNodes implements FigmaNodes {
|
|
10
|
-
private indexer;
|
|
11
|
-
constructor(indexer: NodeIndexer);
|
|
12
|
-
/**
|
|
13
|
-
* Get node by ID
|
|
14
|
-
* Note: Returns null for REST mode since we don't have access to live Figma SceneNodes.
|
|
15
|
-
* Use specific methods like getComponentNameForInstanceSwap instead.
|
|
16
|
-
*/
|
|
17
|
-
getNodeById(_id: string): Promise<SceneNode | null>;
|
|
18
|
-
/**
|
|
19
|
-
* Get component name for instance swap property
|
|
20
|
-
* Returns component-set name if applicable, else component name, else null
|
|
21
|
-
*
|
|
22
|
-
* Delegates to NodeIndexer.getComponentName which checks both tree-indexed
|
|
23
|
-
* components AND the REST API components/componentSets dictionaries.
|
|
24
|
-
*/
|
|
25
|
-
getComponentNameForInstanceSwap(componentId: string): Promise<string | null>;
|
|
26
|
-
/**
|
|
27
|
-
* Get all nodes on the same page that match the specified types, found via a
|
|
28
|
-
* boundary-respecting recursive walk (descend SECTION/FRAME/GROUP, stop at
|
|
29
|
-
* COMPONENT/COMPONENT_SET/INSTANCE). Components nested inside organizational
|
|
30
|
-
* containers are found (subcomponent detection); a set's variants and a
|
|
31
|
-
* component's internals are not. Used for PAGE-scope discovery.
|
|
32
|
-
*/
|
|
33
|
-
getPageSiblings(nodeId: string, types: string[]): Promise<PageScanResult[]>;
|
|
34
|
-
/**
|
|
35
|
-
* Get all nodes across every page in the file that match the given types,
|
|
36
|
-
* found via the same boundary-respecting recursive walk applied to every page.
|
|
37
|
-
* Does NOT use findAllByType (which would return deeply-nested matches inside
|
|
38
|
-
* components/instances). Used for FILE-scope discovery (ADR-050).
|
|
39
|
-
*/
|
|
40
|
-
getAllPagesNodes(types: string[]): Promise<PageScanResult[]>;
|
|
41
|
-
/** Wrap a raw indexed node, attaching its immediate-parent name. */
|
|
42
|
-
private wrap;
|
|
43
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cross-runtime node access helpers.
|
|
3
|
-
*
|
|
4
|
-
* Engine traversal walks raw node trees whose *shape* differs by runtime:
|
|
5
|
-
* REST data is plain JSON; the Figma plugin hands over live SceneNodes. Most
|
|
6
|
-
* properties (`type`, `children`) are shape-consistent, but a few are not —
|
|
7
|
-
* and reading those directly is how plane-2 divergence bugs slip in (they
|
|
8
|
-
* typecheck against the REST shape and fail silently in the plugin). Route the
|
|
9
|
-
* divergent reads through here so the cross-runtime handling lives in one
|
|
10
|
-
* tested place. See DirectedEdges/specs#116.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Resolve an INSTANCE node's main-component id, cross-runtime.
|
|
14
|
-
*
|
|
15
|
-
* REST nodes carry `componentId` synchronously; live plugin InstanceNodes do
|
|
16
|
-
* not — they expose `getMainComponentAsync()`. Engine code that needs an
|
|
17
|
-
* instance's component identity MUST use this rather than reading `.componentId`
|
|
18
|
-
* directly, or plugin-runtime traversal silently fails to identify instances
|
|
19
|
-
* (the bug that broke nested slot-content capture in the plugin).
|
|
20
|
-
*
|
|
21
|
-
* @returns the component id, or `undefined` if it can't be resolved.
|
|
22
|
-
*/
|
|
23
|
-
export declare function resolveComponentId(node: unknown): Promise<string | undefined>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NodeResolver - Interface for resolving Figma nodes by ID
|
|
3
|
-
*
|
|
4
|
-
* Purpose: Abstract node lookup to support both Plugin API and REST API sources
|
|
5
|
-
*
|
|
6
|
-
* Implementations:
|
|
7
|
-
* - PluginNodeResolver: Uses figma.getNodeByIdAsync() in plugin environment
|
|
8
|
-
* - RestNodeResolver: Uses NodeIndexer for REST API data
|
|
9
|
-
*/
|
|
10
|
-
import type { FigmaElementNode } from '../../Component/Nodes/types.js';
|
|
11
|
-
/**
|
|
12
|
-
* A node surfaced by a page/file scan.
|
|
13
|
-
* - `node`: the runtime's processing-shaped node. For INSTANCE results this exposes
|
|
14
|
-
* both `componentProperties` and `getMainComponentAsync` (REST: RestInstanceNode;
|
|
15
|
-
* plugin: InstanceNode), so callers need no separate raw node.
|
|
16
|
-
* - `mainComponentId`: for INSTANCE nodes, the id of the component it is an instance of
|
|
17
|
-
* (REST: `componentId`; plugin: resolved `mainComponent` id). Null for non-instances.
|
|
18
|
-
*/
|
|
19
|
-
export interface PageScanResult {
|
|
20
|
-
id: string;
|
|
21
|
-
name: string;
|
|
22
|
-
type: string;
|
|
23
|
-
parentName: string | null;
|
|
24
|
-
node: FigmaElementNode;
|
|
25
|
-
mainComponentId: string | null;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Node resolver interface for looking up nodes by ID
|
|
29
|
-
*/
|
|
30
|
-
export interface FigmaNodes {
|
|
31
|
-
/**
|
|
32
|
-
* Get node by ID
|
|
33
|
-
* @param id - Node ID to look up
|
|
34
|
-
* @returns Node if found, null otherwise
|
|
35
|
-
*/
|
|
36
|
-
getNodeById(id: string): Promise<SceneNode | null>;
|
|
37
|
-
/**
|
|
38
|
-
* Get component name for instance swap property
|
|
39
|
-
* @param componentId - Component ID to look up
|
|
40
|
-
* @returns Component name (or component-set name if applicable), null if not found
|
|
41
|
-
*/
|
|
42
|
-
getComponentNameForInstanceSwap(componentId: string): Promise<string | null>;
|
|
43
|
-
/**
|
|
44
|
-
* Get all sibling nodes on the same page that match the specified types.
|
|
45
|
-
* Used for page-level subcomponent discovery and PAGE-scope instance example detection.
|
|
46
|
-
* @param nodeId - The node whose page to scan
|
|
47
|
-
* @param types - Node types to filter (e.g. ['COMPONENT', 'COMPONENT_SET'])
|
|
48
|
-
* @returns Array of matching nodes (see {@link PageScanResult})
|
|
49
|
-
*/
|
|
50
|
-
getPageSiblings(nodeId: string, types: string[]): Promise<PageScanResult[]>;
|
|
51
|
-
/**
|
|
52
|
-
* Get all nodes across every page in the file that match the specified types.
|
|
53
|
-
* Used for FILE-scope instance example detection (ADR-050).
|
|
54
|
-
* Runtime-agnostic: REST scans the indexed document; the plugin must implement
|
|
55
|
-
* this by iterating all pages.
|
|
56
|
-
* @param types - Node types to filter (e.g. ['INSTANCE', 'FRAME'])
|
|
57
|
-
* @returns Array of matching nodes (see {@link PageScanResult})
|
|
58
|
-
*/
|
|
59
|
-
getAllPagesNodes(types: string[]): Promise<PageScanResult[]>;
|
|
60
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ResolvedConfig } from '@directededges/specs-schema';
|
|
2
|
-
type FormatKeys = ResolvedConfig['format']['keys'];
|
|
3
|
-
import { SpecableNode } from '../Component/Nodes/types.js';
|
|
4
|
-
export type FigmaVariantProp = {
|
|
5
|
-
name: string;
|
|
6
|
-
defaultValue: string;
|
|
7
|
-
options: string[];
|
|
8
|
-
};
|
|
9
|
-
export declare class Utilities {
|
|
10
|
-
private static readonly UNSAFE_CHARS_REGEX;
|
|
11
|
-
private static readonly WORD_SEPARATOR_REGEX;
|
|
12
|
-
private static readonly NON_ALPHANUMERIC_REGEX;
|
|
13
|
-
/**
|
|
14
|
-
* Converts a string to various naming formats commonly used in development
|
|
15
|
-
* @param str - The input string to convert
|
|
16
|
-
* @param format - The desired output format
|
|
17
|
-
* @returns The converted string
|
|
18
|
-
*/
|
|
19
|
-
static formatKey(str: string, format?: FormatKeys): string;
|
|
20
|
-
static variantProps(node: SpecableNode): FigmaVariantProp[];
|
|
21
|
-
/**
|
|
22
|
-
* Match a name against a glyph pattern containing {i} placeholder.
|
|
23
|
-
* Returns the extracted portion if matched, or null if no match.
|
|
24
|
-
*/
|
|
25
|
-
/** Normalize ` / ` separator spacing and collapse repeated whitespace in a layer/component name. */
|
|
26
|
-
static normalizeName(value: string): string;
|
|
27
|
-
/** Return `base`, or `base__2`, `base__3`, … until `isTaken` reports the key free. */
|
|
28
|
-
static disambiguateKey(base: string, isTaken: (key: string) => boolean): string;
|
|
29
|
-
/**
|
|
30
|
-
* Deterministic, runtime-agnostic string hash (cyrb53) returning a hex digest.
|
|
31
|
-
*
|
|
32
|
-
* Used for content-equality fingerprints (e.g. slot-content de-dup). Does NOT
|
|
33
|
-
* depend on `node:crypto`, which is unavailable in the Figma plugin sandbox —
|
|
34
|
-
* the plugin bundles the engine from source and stubs `node:crypto`, so a
|
|
35
|
-
* crypto-based hash silently collapses to a constant there. This pure-JS hash
|
|
36
|
-
* produces distinct digests in every runtime. Not cryptographically secure;
|
|
37
|
-
* only used for equality bucketing of small, bounded value sets.
|
|
38
|
-
*/
|
|
39
|
-
static hashString(input: string): string;
|
|
40
|
-
static glyphPatternMatch(name: string, pattern: string): string | null;
|
|
41
|
-
static propertiesException(component: InstanceNode | SpecableNode): boolean;
|
|
42
|
-
static getPropertyDefinitions(component: InstanceNode | SpecableNode): Promise<ComponentPropertyDefinitions | 'exception'>;
|
|
43
|
-
}
|
|
44
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON Reference value pointing to a prop configuration.
|
|
3
|
-
* Used when a property is bound to a component property.
|
|
4
|
-
*/
|
|
5
|
-
export interface ReferenceValue {
|
|
6
|
-
"$ref": string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Type guard to check if a value is a ReferenceValue
|
|
10
|
-
*/
|
|
11
|
-
export declare function isReferenceValue(value: unknown): value is ReferenceValue;
|
|
12
|
-
/**
|
|
13
|
-
* Keys for properties that can be bound to component props.
|
|
14
|
-
* Maps to Element properties: children, instanceOf, visible (in styles), text
|
|
15
|
-
*/
|
|
16
|
-
export type BindingKey = 'children' | 'instanceOf' | 'visible' | 'text';
|