@directededges/specs-from-figma 0.22.0 → 0.24.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,47 +0,0 @@
|
|
|
1
|
-
import { Variant } from './Variant.js';
|
|
2
|
-
import { Elements } from '../Elements/Elements.js';
|
|
3
|
-
import { BaseElement } from '../Elements/BaseElement.js';
|
|
4
|
-
import type { ProcessingContext } from '../../Runtime/Context/interfaces.js';
|
|
5
|
-
/**
|
|
6
|
-
* Utility class for establishing element parity between variants during the difference operation.
|
|
7
|
-
* Ensures that baseline and current variants have matching element sets before comparison.
|
|
8
|
-
*/
|
|
9
|
-
export declare class Differencer {
|
|
10
|
-
constructor();
|
|
11
|
-
/**
|
|
12
|
-
* Ensures the baseline variant has all elements present in the current variant.
|
|
13
|
-
* For any element in the current variant missing from the baseline, adds a fallback
|
|
14
|
-
* element to the baseline to enable proper comparison.
|
|
15
|
-
*
|
|
16
|
-
* @param baseVariantFull - The baseline variant's full element collection to modify
|
|
17
|
-
* @param currentVariant - The current variant being differenced
|
|
18
|
-
* @param layeredMatches - Array of layeredMatches to search for fallback elements (DEFAULT is [0])
|
|
19
|
-
* @param context - Processing context for license-aware evaluation
|
|
20
|
-
* @returns Promise that resolves when all missing elements have been added
|
|
21
|
-
*/
|
|
22
|
-
static establishBaselineParity(baseVariantFull: Elements, currentVariant: Variant, layeredMatches: Variant[], context?: ProcessingContext): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Finds a fallback element for baseline parity by searching layeredMatches.
|
|
25
|
-
* Instead of traversing baseline chain, searches through all provided layeredMatches.
|
|
26
|
-
* If not found in any layeredMatch, adds to default variant (layeredMatches[0]).
|
|
27
|
-
*
|
|
28
|
-
* @param currentVariant - The current variant needing the fallback element
|
|
29
|
-
* @param elementName - The name of the element to find
|
|
30
|
-
* @param layeredMatches - Array of layeredMatches to search (DEFAULT is [0])
|
|
31
|
-
* @param context - Processing context for license-aware evaluation
|
|
32
|
-
* @returns Promise resolving to the fallback BaseElement
|
|
33
|
-
*/
|
|
34
|
-
static baseFallbackElement(currentVariant: Variant, elementName: string, layeredMatches: Variant[], context?: ProcessingContext): Promise<BaseElement>;
|
|
35
|
-
/**
|
|
36
|
-
* Adds an element to the default variant's element collection.
|
|
37
|
-
* Used when an element doesn't exist in any baseline variant and must be
|
|
38
|
-
* added to the default variant to maintain parity.
|
|
39
|
-
*
|
|
40
|
-
* @param variant - The variant containing the element to add
|
|
41
|
-
* @param elementName - The name of the element to add to default
|
|
42
|
-
* @param defaultVariant - The default variant to receive the new element
|
|
43
|
-
* @param context - Processing context for license-aware evaluation
|
|
44
|
-
* @returns Promise resolving to the newly created BaseElement
|
|
45
|
-
*/
|
|
46
|
-
static addElementToDefault(variant: Variant, elementName: string, defaultVariant: Variant, context?: ProcessingContext): Promise<BaseElement>;
|
|
47
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Elements } from '../Elements/Elements.js';
|
|
2
|
-
import type { Children } from '../Children/Children.js';
|
|
3
|
-
import type { ResolvedConfig, Variant as AnovaVariant } from '@directededges/specs-schema';
|
|
4
|
-
import { FigmaVariantProp } from '../../Utilities/Utilities.js';
|
|
5
|
-
import { Layout } from '../Layout/Layout.js';
|
|
6
|
-
import type { FigmaElementNode } from '../Nodes/types.js';
|
|
7
|
-
import type { ProcessingContext } from '../../Runtime/Context/interfaces.js';
|
|
8
|
-
import { PropPairings } from '../Props/PropPairings.js';
|
|
9
|
-
import type { PropPairCandidate } from '../Props/PropPair.js';
|
|
10
|
-
export type VariantBaseline = 'DEFAULT' | Variant;
|
|
11
|
-
export type VariantConfiguration = Record<string, string | number | boolean>;
|
|
12
|
-
export declare class Variant {
|
|
13
|
-
name: string;
|
|
14
|
-
node: ComponentNode | FrameNode | null;
|
|
15
|
-
default: boolean;
|
|
16
|
-
configuration: VariantConfiguration;
|
|
17
|
-
invalid: boolean;
|
|
18
|
-
invalidBySimplerVariant: boolean;
|
|
19
|
-
layeredMatches: Variant[];
|
|
20
|
-
full: Elements;
|
|
21
|
-
layered: Elements;
|
|
22
|
-
layout?: Layout;
|
|
23
|
-
layeredLayout?: Layout;
|
|
24
|
-
bindingPairCandidates: PropPairCandidate[];
|
|
25
|
-
config: ResolvedConfig;
|
|
26
|
-
codeOnlyContainer?: FigmaElementNode;
|
|
27
|
-
constructor(name: string, node: ComponentNode | FrameNode | null, isDefault: boolean, variantProps: FigmaVariantProp[] | undefined, config: ResolvedConfig);
|
|
28
|
-
evaluate(context?: ProcessingContext, pairings?: PropPairings): Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* Relates raw Figma properties into semantic spec properties.
|
|
31
|
-
* Runs after evaluate() and before layer().
|
|
32
|
-
*/
|
|
33
|
-
postEvaluate(): void;
|
|
34
|
-
/**
|
|
35
|
-
* Calculate layered differences by accumulating all layeredMatches.
|
|
36
|
-
*/
|
|
37
|
-
layer(context?: ProcessingContext): Promise<void>;
|
|
38
|
-
postProcess(context?: ProcessingContext): Promise<void>;
|
|
39
|
-
data(subcomponentRefs?: Map<string, string>): AnovaVariant | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Get the appropriate elements based on DETAILS setting
|
|
42
|
-
*/
|
|
43
|
-
get elementDetails(): Elements;
|
|
44
|
-
/**
|
|
45
|
-
* Get the appropriate layout based on DETAILS setting
|
|
46
|
-
*/
|
|
47
|
-
get layoutDetails(): Layout | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* Return the Children instance for a named slot element, or undefined.
|
|
50
|
-
* Used by the SlotContent collaborator to call setExample() on `full` before
|
|
51
|
-
* layer() runs, so variant differencing captures example-reference differences.
|
|
52
|
-
*/
|
|
53
|
-
getSlotChildren(elementName: string): Children | undefined;
|
|
54
|
-
private nonDefaultConfigurations;
|
|
55
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Anatomy } from "../Anatomy/Anatomy.js";
|
|
2
|
-
import { Variant, VariantConfiguration } from "./Variant.js";
|
|
3
|
-
import { ResolvedConfig, Variants as AnovaVariants } from '@directededges/specs-schema';
|
|
4
|
-
import { SpecableNode } from "../Nodes/types.js";
|
|
5
|
-
import { ProgressCoordinator } from '../../Progress/ProgressCoordinator.js';
|
|
6
|
-
import { type ProcessingContext } from '../../Runtime/Context/interfaces.js';
|
|
7
|
-
import { PropPairings } from '../Props/PropPairings.js';
|
|
8
|
-
export declare class Variants {
|
|
9
|
-
private _items;
|
|
10
|
-
_invalidVariants: VariantConfiguration[];
|
|
11
|
-
pairings: PropPairings;
|
|
12
|
-
private _node;
|
|
13
|
-
private _variantProps;
|
|
14
|
-
private _anatomy;
|
|
15
|
-
private config;
|
|
16
|
-
constructor(node: SpecableNode, anatomy: Anatomy, config: ResolvedConfig);
|
|
17
|
-
process(coordinator?: ProgressCoordinator, context?: ProcessingContext): Promise<void>;
|
|
18
|
-
private initialize;
|
|
19
|
-
/**
|
|
20
|
-
* Populate layeredMatches array for each variant.
|
|
21
|
-
* Layered matches are ALL variants with matching subset configurations (not just N-1).
|
|
22
|
-
* This enables CSS cascade-style layering where each variant accumulates
|
|
23
|
-
* all matching layers before comparing.
|
|
24
|
-
*/
|
|
25
|
-
private setLayeredMatches;
|
|
26
|
-
private evaluate;
|
|
27
|
-
/**
|
|
28
|
-
* Relates raw Figma properties into semantic spec properties for all variants.
|
|
29
|
-
* Runs after evaluate() and before layer() so computed values
|
|
30
|
-
* are available for variant differencing.
|
|
31
|
-
*/
|
|
32
|
-
private postEvaluate;
|
|
33
|
-
/**
|
|
34
|
-
* Calculate layered differences for all variants.
|
|
35
|
-
* For each variant (in sorted order), accumulates all layeredMatches' .layered
|
|
36
|
-
* differences, then compares current variant to determine incremental changes.
|
|
37
|
-
*
|
|
38
|
-
* Processing order is critical: variants are sorted by config count, so all
|
|
39
|
-
* layeredMatches are processed before the current variant.
|
|
40
|
-
*/
|
|
41
|
-
layer(coordinator?: ProgressCoordinator, context?: ProcessingContext): Promise<void>;
|
|
42
|
-
resolve(context?: ProcessingContext): Promise<void>;
|
|
43
|
-
data(subcomponentRefs?: Map<string, string>): AnovaVariants;
|
|
44
|
-
/**
|
|
45
|
-
* Get the default variant (first variant, baseline === 'DEFAULT')
|
|
46
|
-
*/
|
|
47
|
-
getDefault(): Variant | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* Returns an iterator over variants.
|
|
50
|
-
* @example
|
|
51
|
-
* for (const variant of variants.entries()) {
|
|
52
|
-
* await variant.process();
|
|
53
|
-
* }
|
|
54
|
-
*/
|
|
55
|
-
entries(): IterableIterator<Variant>;
|
|
56
|
-
/**
|
|
57
|
-
* Returns an iterator over variants (alias for entries).
|
|
58
|
-
* @example
|
|
59
|
-
* for (const variant of variants.values()) {
|
|
60
|
-
* console.log(variant.name);
|
|
61
|
-
* }
|
|
62
|
-
*/
|
|
63
|
-
values(): IterableIterator<Variant>;
|
|
64
|
-
/**
|
|
65
|
-
* Makes Variants directly iterable.
|
|
66
|
-
* @example
|
|
67
|
-
* for (const variant of variants) {
|
|
68
|
-
* console.log(variant.name);
|
|
69
|
-
* }
|
|
70
|
-
*/
|
|
71
|
-
[Symbol.iterator](): IterableIterator<Variant>;
|
|
72
|
-
/**
|
|
73
|
-
* Returns the number of variants in the collection.
|
|
74
|
-
*/
|
|
75
|
-
get size(): number;
|
|
76
|
-
/**
|
|
77
|
-
* Checks if the collection is empty.
|
|
78
|
-
* @example
|
|
79
|
-
* if (variants.isEmpty()) {
|
|
80
|
-
* return;
|
|
81
|
-
* }
|
|
82
|
-
*/
|
|
83
|
-
isEmpty(): boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Generate all possible variant names from variant properties.
|
|
86
|
-
* Returns an ordered array of variant names, respecting VARIANT_DEPTH setting.
|
|
87
|
-
*/
|
|
88
|
-
private generateVariantNames;
|
|
89
|
-
private completeConfiguration;
|
|
90
|
-
private invalidCombinations;
|
|
91
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Components — Sole public entry point for REST/CLI runtime
|
|
3
|
-
*
|
|
4
|
-
* `Components.fromRestApi(ids, json, config, foundations, onProgress, license?)`
|
|
5
|
-
*
|
|
6
|
-
* Returns `ComponentsData[]` — a union of success and error entries.
|
|
7
|
-
* License is validated once per invocation. `Component` is internal.
|
|
8
|
-
*
|
|
9
|
-
* @example REST/CLI usage
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const results = await Components.fromRestApi(
|
|
12
|
-
* ['btn-primary', 'btn-secondary'],
|
|
13
|
-
* figmaFileJson,
|
|
14
|
-
* config,
|
|
15
|
-
* { styles, variables, collections },
|
|
16
|
-
* (event) => console.log(`${event.index + 1}/${event.total}: ${event.component}`),
|
|
17
|
-
* { key: 'lic_xxx' },
|
|
18
|
-
* );
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
import type { ResolvedConfig, Component as AnovaComponent } from '@directededges/specs-schema';
|
|
22
|
-
import type { StylesMap, VariablesMap, CollectionsMap } from '../Runtime/Foundations/FigmaRESTMaps.js';
|
|
23
|
-
import type { RestLicenseInput } from '../License/types.js';
|
|
24
|
-
/** Component output data — success or error per component */
|
|
25
|
-
export type ComponentsData = {
|
|
26
|
-
name: string;
|
|
27
|
-
component: AnovaComponent;
|
|
28
|
-
} | {
|
|
29
|
-
name: string;
|
|
30
|
-
error: string;
|
|
31
|
-
};
|
|
32
|
-
/** Progress event emitted for each component */
|
|
33
|
-
export type ProgressEvent = {
|
|
34
|
-
component: string;
|
|
35
|
-
index: number;
|
|
36
|
-
total: number;
|
|
37
|
-
status: 'processing' | 'success' | 'error';
|
|
38
|
-
error?: string;
|
|
39
|
-
};
|
|
40
|
-
/** Foundations data for REST processing */
|
|
41
|
-
export interface RestFoundations {
|
|
42
|
-
styles: StylesMap;
|
|
43
|
-
variables: VariablesMap;
|
|
44
|
-
collections: CollectionsMap;
|
|
45
|
-
author?: string;
|
|
46
|
-
generator?: {
|
|
47
|
-
name: string;
|
|
48
|
-
version: string;
|
|
49
|
-
url: string;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
export declare class Components {
|
|
53
|
-
/**
|
|
54
|
-
* Process one or more components from REST API JSON data.
|
|
55
|
-
*
|
|
56
|
-
* License is validated once per batch call. All components share the same
|
|
57
|
-
* ProcessingContext with the resolved license result.
|
|
58
|
-
*
|
|
59
|
-
* @param componentIds - Array of component names or IDs to extract
|
|
60
|
-
* @param figmaFileJson - Raw REST API JSON data
|
|
61
|
-
* @param config - Component configuration
|
|
62
|
-
* @param foundations - Required: styles, variables, collections Maps
|
|
63
|
-
* @param onProgress - Progress callback, fired per component
|
|
64
|
-
* @param license - Optional license key for premium features
|
|
65
|
-
* @returns Array of ComponentsData (success or error per component)
|
|
66
|
-
*/
|
|
67
|
-
static fromRestApi(componentIds: string[], figmaFileJson: unknown, config: ResolvedConfig, foundations: RestFoundations, onProgress: (event: ProgressEvent) => void, license?: RestLicenseInput): Promise<ComponentsData[]>;
|
|
68
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export type Settings = {
|
|
2
|
-
DATA_VARIANT_NAMES: boolean;
|
|
3
|
-
DATA_EMPTY_VARIANTS: boolean;
|
|
4
|
-
DATA_INVALID_VARIANT: boolean;
|
|
5
|
-
DATA_INVALID_COMBINATIONS: boolean;
|
|
6
|
-
DATA_LAYOUT: 'LAYOUT' | 'PARENT_CHILDREN' | 'BOTH';
|
|
7
|
-
DATA_STYLES_VARIABLE_FORMAT: 'NAME_WITH_COLLECTION' | 'NAME' | 'OBJECT';
|
|
8
|
-
DETAILS: 'FULL' | 'LAYERED';
|
|
9
|
-
OUTPUT: boolean;
|
|
10
|
-
OUTPUT_REPLACE: boolean;
|
|
11
|
-
OUTPUT_DATA: boolean;
|
|
12
|
-
OUTPUT_STYLING: boolean;
|
|
13
|
-
OUTPUT_ANATOMY: boolean;
|
|
14
|
-
OUTPUT_LAYOUT: boolean;
|
|
15
|
-
OUTPUT_PROPS: boolean;
|
|
16
|
-
OUTPUT_MODES: boolean;
|
|
17
|
-
ANATOMY_CONTENT: 'CANVAS' | 'DEV_MODE';
|
|
18
|
-
ANATOMY_EXPOSE_BOOLEAN_PROP_LAYERS: boolean;
|
|
19
|
-
FORMAT_OUTPUT: 'YAML' | 'JSON';
|
|
20
|
-
FORMAT_KEYS: 'SAFE' | 'CAMEL' | 'SNAKE' | 'KEBAB' | 'PASCAL' | 'TRAIN';
|
|
21
|
-
FORMAT_COLOR: 'HEX' | 'HSLA';
|
|
22
|
-
FORMAT_CUSTOM_COLORS: boolean;
|
|
23
|
-
FORMAT_CUSTOM_SPACING: boolean;
|
|
24
|
-
FORMAT_CUSTOM_TEXT_STYLES: boolean;
|
|
25
|
-
SIMPLIFY_STYLES?: boolean;
|
|
26
|
-
SIMPLIFY_VARIABLES?: boolean;
|
|
27
|
-
SUBCOMPONENTS: boolean;
|
|
28
|
-
SUBCOMPONENT_NAME_PATTERN: string;
|
|
29
|
-
VARIANT_DEPTH: 1 | 2 | 3 | 9999;
|
|
30
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* API-specific property mappings for REST API vs Plugin API
|
|
3
|
-
*
|
|
4
|
-
* The Figma REST API and Plugin API have different node structures:
|
|
5
|
-
* - REST API: Typography properties in node.style.* (fontSize, fontFamily, etc.)
|
|
6
|
-
* - Plugin API: Typography properties at top level (node.fontSize, node.fontName.*, etc.)
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Properties that exist in node.style.* for REST API TEXT nodes
|
|
10
|
-
* These are accessed directly from node.style[key] in REST API
|
|
11
|
-
*/
|
|
12
|
-
export declare const REST_TEXT_PROPERTIES: readonly ["fontSize", "letterSpacing", "textCase", "textDecoration", "leadingTrim", "paragraphIndent", "paragraphSpacing", "listSpacing", "hangingPunctuation", "hangingList"];
|
|
13
|
-
/**
|
|
14
|
-
* Properties that exist in node.style.* for REST API but need special handling
|
|
15
|
-
*/
|
|
16
|
-
export declare const REST_FONT_PROPERTIES: readonly ["fontFamily", "fontStyle"];
|
|
17
|
-
/**
|
|
18
|
-
* Mapping from our style keys to Plugin API node.fontName properties
|
|
19
|
-
* Used to access node.fontName[FONT_NAME_MEMBER_MAP[key]] in Plugin API
|
|
20
|
-
*/
|
|
21
|
-
export declare const FONT_NAME_MEMBER_MAP: Record<string, string>;
|
|
22
|
-
/**
|
|
23
|
-
* Line height properties in REST API node.style.*
|
|
24
|
-
*/
|
|
25
|
-
export declare const REST_LINE_HEIGHT_PROPERTIES: {
|
|
26
|
-
readonly unit: "lineHeightUnit";
|
|
27
|
-
readonly percentFontSize: "lineHeightPercentFontSize";
|
|
28
|
-
readonly px: "lineHeightPx";
|
|
29
|
-
};
|
|
30
|
-
export type RestTextProperty = typeof REST_TEXT_PROPERTIES[number];
|
|
31
|
-
export type RestFontProperty = typeof REST_FONT_PROPERTIES[number];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const FIGMA_ELEMENT_NODE_TYPES: readonly ["COMPONENT", "FRAME", "INSTANCE", "TEXT", "VECTOR", "LINE", "STAR", "POLYGON", "RECTANGLE", "ELLIPSE", "SLOT"];
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LicenseManager — resolves license input to a LicenseResult for use in
|
|
3
|
-
* the component processing pipeline.
|
|
4
|
-
*
|
|
5
|
-
* Two paths:
|
|
6
|
-
* - Plugin: receives a pre-resolved LicenseState from the Plugin UI thread.
|
|
7
|
-
* No network calls are made from the transformer.
|
|
8
|
-
* - REST/CLI: sends the raw key to specs-license-proxy and maps the
|
|
9
|
-
* proxy's verdict to a LicenseState.
|
|
10
|
-
*
|
|
11
|
-
* Runtime enforcement (CP-09): the `runtime` parameter — set by the factory
|
|
12
|
-
* method, not the caller — determines which input path is used. REST always
|
|
13
|
-
* validates via the proxy, even if the input object has a `state` field.
|
|
14
|
-
*/
|
|
15
|
-
import type { LicenseState, LicenseRuntime, LicenseInput, LicenseResult } from './types.js';
|
|
16
|
-
/**
|
|
17
|
-
* Resolve license input to a LicenseResult.
|
|
18
|
-
*
|
|
19
|
-
* Runtime enforcement (CP-09): the `runtime` parameter determines which input
|
|
20
|
-
* path is accepted. Only the plugin runtime reads `input.state`; the REST path
|
|
21
|
-
* always validates via the proxy regardless of what fields the input carries.
|
|
22
|
-
*
|
|
23
|
-
* Plugin path (`PluginLicenseInput`): reads `input.state` directly — no network call.
|
|
24
|
-
* REST/CLI path (`RestLicenseInput`): calls the license proxy.
|
|
25
|
-
* Absent input: returns free-tier result with status 'none'.
|
|
26
|
-
*
|
|
27
|
-
* @throws Never — all error paths are mapped to a LicenseResult carrying the
|
|
28
|
-
* appropriate LicenseState (error, invalid, network-error, etc.).
|
|
29
|
-
*/
|
|
30
|
-
export declare function resolve(input: LicenseInput | undefined, runtime: LicenseRuntime): Promise<LicenseResult>;
|
|
31
|
-
/**
|
|
32
|
-
* Mask a license key for use in non-secure contexts (debug descriptions, etc.).
|
|
33
|
-
* Never call this to produce serialised component output — only descriptions.
|
|
34
|
-
*
|
|
35
|
-
* @example maskKey('abcdefxyz') → '***xyz'
|
|
36
|
-
*/
|
|
37
|
-
export declare function maskKey(key: string): string;
|
|
38
|
-
/**
|
|
39
|
-
* Return a neutral, factual description for a given LicenseState.
|
|
40
|
-
* The transformer MUST NOT include user-facing advice or resolution steps.
|
|
41
|
-
* That is the responsibility of the calling environment (CLI, Plugin).
|
|
42
|
-
*/
|
|
43
|
-
export declare function descriptionFor(state: LicenseState, maskedKey?: string): string;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ProxyClient — calls the specs-license-proxy Cloudflare Worker.
|
|
3
|
-
*
|
|
4
|
-
* The proxy owns all license logic (key validation, tier resolution,
|
|
5
|
-
* meter checks, credit consumption). This module sends a minimal
|
|
6
|
-
* request and returns the proxy's verdict.
|
|
7
|
-
*
|
|
8
|
-
* Only executed on the REST/CLI path (never in the Plugin sandbox).
|
|
9
|
-
*/
|
|
10
|
-
import type { LicenseRuntime } from './types.js';
|
|
11
|
-
export interface ProxyResponse {
|
|
12
|
-
/** Numeric tier: 0 = unauthorized (fail loud), 1 = PRO, 3 = PARTNER */
|
|
13
|
-
response: number;
|
|
14
|
-
/** Machine-readable status code */
|
|
15
|
-
status: string;
|
|
16
|
-
/** User-facing message */
|
|
17
|
-
detail: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* POST `{ key, runtime }` to the proxy and return its verdict.
|
|
21
|
-
*
|
|
22
|
-
* - On fetch failure: throws (LicenseManager catches as network-error).
|
|
23
|
-
* - On non-JSON / unexpected HTTP: returns `{ response: 0, status: "network-error", detail }`.
|
|
24
|
-
*/
|
|
25
|
-
export declare function callProxy(key: string, runtime: LicenseRuntime): Promise<ProxyResponse>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Licensing constants for specs-from-figma
|
|
3
|
-
*
|
|
4
|
-
* All validation logic now lives in specs-license-proxy (Cloudflare Worker).
|
|
5
|
-
* This module retains tier constants and the LICENSING config object.
|
|
6
|
-
*/
|
|
7
|
-
/** Public license levels */
|
|
8
|
-
export declare const FREE: "FREE";
|
|
9
|
-
export declare const PRO: "PRO";
|
|
10
|
-
/**
|
|
11
|
-
* @internal Enterprise level — not exported from package.
|
|
12
|
-
* Encoded to resist casual code inspection in standard build.
|
|
13
|
-
*/
|
|
14
|
-
export declare const _E: string;
|
|
15
|
-
/**
|
|
16
|
-
* @internal Partner level — not exported from package.
|
|
17
|
-
* Encoded to resist casual code inspection in standard build.
|
|
18
|
-
*/
|
|
19
|
-
export declare const _P: string;
|
|
20
|
-
/** Tier numbers — higher tiers include all lower-tier entitlements */
|
|
21
|
-
export declare const TIERS: Record<string, number>;
|
|
22
|
-
/**
|
|
23
|
-
* Derive tier number from level string.
|
|
24
|
-
* Returns 0 (FREE) for any unrecognised level.
|
|
25
|
-
*/
|
|
26
|
-
export declare function tierForLevel(level: string): number;
|
|
27
|
-
export declare const LICENSING: {
|
|
28
|
-
/**
|
|
29
|
-
* Polar environment. Set POLAR_ENV=SANDBOX to target the sandbox for testing.
|
|
30
|
-
* Defaults to PRODUCTION.
|
|
31
|
-
*
|
|
32
|
-
* Lazy getter: `process.env` is only read when a REST/CLI validation call is
|
|
33
|
-
* actually made — never at module load time, so this is safe to bundle into
|
|
34
|
-
* the Figma plugin (where `process` is undefined).
|
|
35
|
-
*/
|
|
36
|
-
readonly ENVIRONMENT: "SANDBOX" | "PRODUCTION";
|
|
37
|
-
/** Proxy URL for license validation (all logic lives in the proxy) */
|
|
38
|
-
readonly PROXY_URL: string;
|
|
39
|
-
/** User-facing store URL */
|
|
40
|
-
readonly STORE_URL: string;
|
|
41
|
-
};
|
package/dist/License/types.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* License types for specs-from-figma
|
|
3
|
-
*
|
|
4
|
-
* These types define the contract for license validation and gating.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Discriminated union of all possible license states.
|
|
8
|
-
* Mirrors the POC canonical set + `unlocked` for compile-time enterprise builds.
|
|
9
|
-
*/
|
|
10
|
-
export type LicenseState = {
|
|
11
|
-
status: 'none';
|
|
12
|
-
} | {
|
|
13
|
-
status: 'validating';
|
|
14
|
-
} | {
|
|
15
|
-
status: 'active';
|
|
16
|
-
expiresAt: string | null;
|
|
17
|
-
organizationName?: string;
|
|
18
|
-
} | {
|
|
19
|
-
status: 'usage-limit-reached';
|
|
20
|
-
usageCount: number;
|
|
21
|
-
usageLimit: number;
|
|
22
|
-
} | {
|
|
23
|
-
status: 'invalid';
|
|
24
|
-
} | {
|
|
25
|
-
status: 'wrong-runtime';
|
|
26
|
-
} | {
|
|
27
|
-
status: 'expired';
|
|
28
|
-
expiresAt: string;
|
|
29
|
-
} | {
|
|
30
|
-
status: 'removed';
|
|
31
|
-
} | {
|
|
32
|
-
status: 'network-error';
|
|
33
|
-
} | {
|
|
34
|
-
status: 'error';
|
|
35
|
-
message: string;
|
|
36
|
-
} | {
|
|
37
|
-
status: 'unlocked';
|
|
38
|
-
};
|
|
39
|
-
export type LicenseStatusCode = LicenseState['status'];
|
|
40
|
-
/**
|
|
41
|
-
* Which calling environment is invoking the transformer.
|
|
42
|
-
* Sent to the license proxy to determine runtime-specific entitlements.
|
|
43
|
-
*/
|
|
44
|
-
export type LicenseRuntime = 'plugin' | 'cli';
|
|
45
|
-
/**
|
|
46
|
-
* Plugin path: the Plugin UI thread has already validated externally.
|
|
47
|
-
* The transformer receives the pre-resolved state and does not make network calls.
|
|
48
|
-
*/
|
|
49
|
-
export type PluginLicenseInput = {
|
|
50
|
-
state: LicenseState;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* REST/CLI path: the transformer validates the key via the license proxy.
|
|
54
|
-
* The caller passes the raw key; runtime is supplied by the factory method.
|
|
55
|
-
*/
|
|
56
|
-
export type RestLicenseInput = {
|
|
57
|
-
key: string;
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Dual-path union.
|
|
61
|
-
* - `fromPlugin()` accepts `PluginLicenseInput`
|
|
62
|
-
* - `fromRestApi()` / `Components.fromRestApi()` accept `RestLicenseInput`
|
|
63
|
-
*/
|
|
64
|
-
export type LicenseInput = PluginLicenseInput | RestLicenseInput;
|
|
65
|
-
/**
|
|
66
|
-
* Resolved outcome threaded through ProcessingContext for every processing call.
|
|
67
|
-
* `tier` is the numeric gate used by `entitled()` throughout the pipeline.
|
|
68
|
-
* `level` is the human-readable string stamped into `generator.license.level` output.
|
|
69
|
-
*/
|
|
70
|
-
export type LicenseResult = {
|
|
71
|
-
/** The resolved machine-readable state */
|
|
72
|
-
state: LicenseState;
|
|
73
|
-
/** true only when status === 'active' AND the license covers the calling runtime's benefit */
|
|
74
|
-
isLicensed: boolean;
|
|
75
|
-
/** Neutral factual description — the transformer's responsibility only; callers add their own UX copy */
|
|
76
|
-
description: string;
|
|
77
|
-
/** Masked key (`***xyz`), present on error states where key context aids debugging */
|
|
78
|
-
maskedKey?: string;
|
|
79
|
-
/** Human-readable license level: "FREE", "PRO", "ENTERPRISE", "PARTNER" */
|
|
80
|
-
level: string;
|
|
81
|
-
/** Numeric tier for gating: 0=FREE, 1=PRO, 2=ENTERPRISE, 3=PARTNER. Derived from level. */
|
|
82
|
-
tier: number;
|
|
83
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Settings } from '../Config/types.Settings.js';
|
|
2
|
-
/**
|
|
3
|
-
* Phase configuration for progress tracking
|
|
4
|
-
* Determines which phases are active based on settings
|
|
5
|
-
*/
|
|
6
|
-
export interface PhaseConfiguration {
|
|
7
|
-
/** Ordered list of phase names that will be executed */
|
|
8
|
-
phases: string[];
|
|
9
|
-
/** Total number of steps for progress display */
|
|
10
|
-
totalSteps: number;
|
|
11
|
-
/** Set of phase names that support chunking */
|
|
12
|
-
chunkablePhases: Set<string>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Build phase configuration based on enabled output settings
|
|
16
|
-
* Calculates total step count dynamically
|
|
17
|
-
* @param settings - Plugin settings with output section flags
|
|
18
|
-
* @returns Phase configuration object
|
|
19
|
-
*/
|
|
20
|
-
export declare function buildPhaseConfiguration(settings: Settings): PhaseConfiguration;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Progress tracking types for component processing
|
|
3
|
-
* @module UI/Types/Progress
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Progress state for UI display
|
|
7
|
-
* Immutable snapshot of current processing phase
|
|
8
|
-
*/
|
|
9
|
-
export interface ProgressState {
|
|
10
|
-
/**
|
|
11
|
-
* Human-readable phase name (e.g., "Evaluating variants", "Outputting Props")
|
|
12
|
-
* Must match console output phase names for consistency
|
|
13
|
-
*/
|
|
14
|
-
phase: string;
|
|
15
|
-
/**
|
|
16
|
-
* Current step number (1-indexed for display)
|
|
17
|
-
* e.g., 2 means "Step 2 of 8"
|
|
18
|
-
*/
|
|
19
|
-
currentStep: number;
|
|
20
|
-
/**
|
|
21
|
-
* Total number of steps for this processing run
|
|
22
|
-
* Calculated dynamically based on enabled output sections
|
|
23
|
-
* Range: 3-9 depending on settings
|
|
24
|
-
*/
|
|
25
|
-
totalSteps: number;
|
|
26
|
-
/**
|
|
27
|
-
* Optional chunk information for variant-heavy phases
|
|
28
|
-
* Only present when processing >10 variants in evaluate/layer phases
|
|
29
|
-
*/
|
|
30
|
-
chunkInfo?: ChunkInfo;
|
|
31
|
-
/**
|
|
32
|
-
* Optional percentage completion (0-100)
|
|
33
|
-
* Future enhancement (P3) - requires timing estimates
|
|
34
|
-
* When present, UI may display "42%" instead of "Step 2 of 8"
|
|
35
|
-
*/
|
|
36
|
-
percentage?: number;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Chunk progress information
|
|
40
|
-
* Used when processing >10 variants in evaluate or layer phases
|
|
41
|
-
*/
|
|
42
|
-
export interface ChunkInfo {
|
|
43
|
-
/**
|
|
44
|
-
* Start index of chunk (1-indexed for display)
|
|
45
|
-
* e.g., 1, 11, 21 for successive chunks
|
|
46
|
-
*/
|
|
47
|
-
start: number;
|
|
48
|
-
/**
|
|
49
|
-
* End index of chunk (1-indexed, inclusive)
|
|
50
|
-
* e.g., 10, 20, 30 for successive chunks
|
|
51
|
-
*/
|
|
52
|
-
end: number;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Timing data for a completed processing phase
|
|
56
|
-
* Collected by TimingCollector for console.table() output
|
|
57
|
-
*/
|
|
58
|
-
export interface TimingEntry {
|
|
59
|
-
/**
|
|
60
|
-
* Phase name (must match ProgressState.phase)
|
|
61
|
-
* e.g., "Setting up variants", "Evaluating variants"
|
|
62
|
-
*/
|
|
63
|
-
phase: string;
|
|
64
|
-
/**
|
|
65
|
-
* Start timestamp from performance.now()
|
|
66
|
-
*/
|
|
67
|
-
startTime: number;
|
|
68
|
-
/**
|
|
69
|
-
* End timestamp from performance.now()
|
|
70
|
-
* Undefined if phase is still in progress
|
|
71
|
-
*/
|
|
72
|
-
endTime?: number;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Callback function invoked when progress state changes
|
|
76
|
-
*/
|
|
77
|
-
export type ProgressCallback = (state: ProgressState) => void;
|
|
78
|
-
/**
|
|
79
|
-
* Human-readable phase names
|
|
80
|
-
* Used for both UI display and console output
|
|
81
|
-
*/
|
|
82
|
-
export declare const PHASE_NAMES: {
|
|
83
|
-
readonly SETUP_VARIANTS: "Setting up variants";
|
|
84
|
-
readonly EVALUATE_VARIANTS: "Evaluating variants";
|
|
85
|
-
readonly LAYER_VARIANTS: "Layering variants";
|
|
86
|
-
readonly OUTPUT_DATA: "Outputting data";
|
|
87
|
-
readonly OUTPUT_ANATOMY: "Outputting Anatomy";
|
|
88
|
-
readonly OUTPUT_PROPS: "Outputting Props";
|
|
89
|
-
readonly OUTPUT_LAYOUT: "Outputting Layout";
|
|
90
|
-
readonly OUTPUT_STYLING: "Outputting Styling";
|
|
91
|
-
readonly OUTPUT_MODES: "Outputting Modes";
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Variant count threshold for chunking
|
|
95
|
-
* When variant count > CHUNK_THRESHOLD, display chunk progress
|
|
96
|
-
*/
|
|
97
|
-
export declare const CHUNK_THRESHOLD = 10;
|
|
98
|
-
/**
|
|
99
|
-
* Chunk size for splitting variant processing
|
|
100
|
-
* Each chunk processes CHUNK_SIZE variants before progress update
|
|
101
|
-
*/
|
|
102
|
-
export declare const CHUNK_SIZE = 10;
|
|
103
|
-
/**
|
|
104
|
-
* Minimum display time per phase (milliseconds)
|
|
105
|
-
* UI will delay transitions to ensure each phase visible for at least this duration
|
|
106
|
-
*/
|
|
107
|
-
export declare const MIN_PHASE_DISPLAY_MS = 100;
|