@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,88 +0,0 @@
|
|
|
1
|
-
import { Style as AnovaStyle } from "@directededges/specs-schema";
|
|
2
|
-
import { AspectRatioValue } from "@directededges/specs-schema";
|
|
3
|
-
import { ConditionalStyle } from './Primitives/ConditionalStyle.js';
|
|
4
|
-
import { FigmaElementNode } from '../Nodes/types.js';
|
|
5
|
-
import { StyleKey } from "./keys.js";
|
|
6
|
-
import { ResolvedConfig } from '@directededges/specs-schema';
|
|
7
|
-
import type { FigmaFoundations } from '../../Runtime/Foundations/interfaces.js';
|
|
8
|
-
import { type ProcessingContext } from '../../Runtime/Context/interfaces.js';
|
|
9
|
-
import { PropBinding } from '../Props/PropBinding.js';
|
|
10
|
-
import { Color } from '../Color/Color.js';
|
|
11
|
-
import { Gradient } from "../Gradient/Gradient.js";
|
|
12
|
-
import { Effects } from '../Effects/Effects.js';
|
|
13
|
-
import { Typography } from '../Typography/Typography.js';
|
|
14
|
-
import { QuadComposite, BiaxialComposite } from './Composites/index.js';
|
|
15
|
-
import { FigmaVariableReference, FigmaStyleReference, RawStyle } from './References/index.js';
|
|
16
|
-
export type { RawStyle };
|
|
17
|
-
export { FigmaVariableReference, FigmaStyleReference };
|
|
18
|
-
export type StyleValue = FigmaVariableReference | FigmaStyleReference | PropBinding | ConditionalStyle | RawStyle | Color | Effects | AspectRatioValue | Gradient | Typography | QuadComposite | BiaxialComposite | null;
|
|
19
|
-
export type StyleType = 'VARIABLE' | 'STYLE' | 'REFERENCE' | 'RAW';
|
|
20
|
-
export declare class Style {
|
|
21
|
-
readonly key: StyleKey;
|
|
22
|
-
type: StyleType;
|
|
23
|
-
value: StyleValue;
|
|
24
|
-
readonly colorValue?: RGB;
|
|
25
|
-
private static _context?;
|
|
26
|
-
static classifyValue(value: unknown): 'VARIABLE' | 'STYLE' | 'RAW';
|
|
27
|
-
constructor(node: FigmaElementNode, key: StyleKey, context?: ProcessingContext);
|
|
28
|
-
/**
|
|
29
|
-
* Compare this Style against a baseline and return the diff.
|
|
30
|
-
* Returns null if values are identical; a Style with diff value if different.
|
|
31
|
-
* For composites (Sides/Corners), returns a sparse diff with only changed fields.
|
|
32
|
-
* For all other types, returns a full clone.
|
|
33
|
-
*/
|
|
34
|
-
difference(base: Style): Style | null;
|
|
35
|
-
data(config: ResolvedConfig): AnovaStyle;
|
|
36
|
-
/**
|
|
37
|
-
* Return a raw, decision-friendly value for this style (without using `.data()`).
|
|
38
|
-
*
|
|
39
|
-
* - VARIABLE: returns the captured `rawValue` (the underlying primitive)
|
|
40
|
-
* - STYLE: returns the style id (string) so consumers can compare deterministically
|
|
41
|
-
* - REFERENCE: returns the underlying raw value from the PropBinding
|
|
42
|
-
* - RAW: returns the primitive value directly
|
|
43
|
-
*
|
|
44
|
-
* This is intentionally independent of Settings and intended for internal logic
|
|
45
|
-
* (ex: Output transforms), not serialization.
|
|
46
|
-
*/
|
|
47
|
-
rawValue(): RawStyle | Color | string | null;
|
|
48
|
-
/**
|
|
49
|
-
* Get the $ref for REFERENCE type styles.
|
|
50
|
-
* Returns null if not a REFERENCE type or if not bound.
|
|
51
|
-
*/
|
|
52
|
-
reference(): string | null;
|
|
53
|
-
private raw;
|
|
54
|
-
/**
|
|
55
|
-
* Check if using REST API runtime (vs Plugin API)
|
|
56
|
-
* Centralized detection logic used by all style processors
|
|
57
|
-
*/
|
|
58
|
-
static isRESTRuntime(): boolean;
|
|
59
|
-
static figmaName(id: string, foundations: FigmaFoundations | undefined): Promise<string>;
|
|
60
|
-
/**
|
|
61
|
-
* Create a deep clone of this Style instance.
|
|
62
|
-
* Clones the value object to prevent shared references.
|
|
63
|
-
*
|
|
64
|
-
* @returns A new Style instance with cloned value
|
|
65
|
-
*/
|
|
66
|
-
clone(valueOverride?: StyleValue): Style;
|
|
67
|
-
/**
|
|
68
|
-
* Set a binding reference for this style.
|
|
69
|
-
* When bound, the style will emit a $ref instead of its value.
|
|
70
|
-
* The actual value is preserved in rawValue for rendering purposes.
|
|
71
|
-
* @param ref The $ref path
|
|
72
|
-
* @param rawValue The underlying raw value for rendering
|
|
73
|
-
*/
|
|
74
|
-
setBinding(ref: string, rawValue: RawStyle): void;
|
|
75
|
-
/**
|
|
76
|
-
* Check if this style is bound to a prop reference.
|
|
77
|
-
* @returns true if bound, false otherwise
|
|
78
|
-
*/
|
|
79
|
-
isBound(): boolean;
|
|
80
|
-
private applyContext;
|
|
81
|
-
private captureColorValue;
|
|
82
|
-
private applySpecializedKeyHandler;
|
|
83
|
-
private assignCompositeValue;
|
|
84
|
-
private applyVariableReference;
|
|
85
|
-
private applyColorStyleReference;
|
|
86
|
-
private applyVisibleBinding;
|
|
87
|
-
private setValue;
|
|
88
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import type { Styles as AnovaStyles } from "@directededges/specs-schema";
|
|
2
|
-
import { FigmaElementNode } from '../Nodes/types.js';
|
|
3
|
-
import { StyleKey } from './keys.js';
|
|
4
|
-
import { Style } from './Style.js';
|
|
5
|
-
import { ResolvedConfig } from '@directededges/specs-schema';
|
|
6
|
-
import type { ProcessingContext } from '../../Runtime/Context/interfaces.js';
|
|
7
|
-
export declare class Styles {
|
|
8
|
-
private _items;
|
|
9
|
-
private _node;
|
|
10
|
-
private _context?;
|
|
11
|
-
constructor(node: FigmaElementNode, context?: ProcessingContext);
|
|
12
|
-
/**
|
|
13
|
-
* Get the source Figma node
|
|
14
|
-
* Used by Output classes to access node properties (e.g., fills, strokes for color swatches)
|
|
15
|
-
*/
|
|
16
|
-
get node(): FigmaElementNode;
|
|
17
|
-
get context(): ProcessingContext | undefined;
|
|
18
|
-
evaluate(context?: ProcessingContext, keys?: readonly string[]): void;
|
|
19
|
-
/**
|
|
20
|
-
* Merge another Styles instance onto this one.
|
|
21
|
-
* Layer styles take precedence over base styles.
|
|
22
|
-
* Performs property-level merge: base styles are preserved unless layer overrides them.
|
|
23
|
-
*
|
|
24
|
-
* @param layer - The Styles to merge onto this one
|
|
25
|
-
* @returns A new Styles instance with merged values
|
|
26
|
-
*/
|
|
27
|
-
merge(layer: Styles): Styles;
|
|
28
|
-
/**
|
|
29
|
-
* Compare this Styles against a baseline to identify differences.
|
|
30
|
-
* Returns a new Styles instance containing only styles that differ.
|
|
31
|
-
* For composite values (Sides/Corners), produces sparse diffs with only changed fields.
|
|
32
|
-
*
|
|
33
|
-
* @param baseline - The Styles to compare against
|
|
34
|
-
* @returns A new Styles instance with differences, or empty if no differences
|
|
35
|
-
*/
|
|
36
|
-
compare(baseline: Styles): Styles;
|
|
37
|
-
/**
|
|
38
|
-
* Relates raw Figma properties into semantic spec properties.
|
|
39
|
-
* Runs after evaluate() and before compare()/layer().
|
|
40
|
-
*/
|
|
41
|
-
postEvaluate(): void;
|
|
42
|
-
postProcess(removeDefaults: boolean, fullStyles: Styles | undefined, context?: ProcessingContext): Promise<void>;
|
|
43
|
-
data(config: ResolvedConfig): AnovaStyles | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Removes a style by its key.
|
|
46
|
-
* @param key The key of the style to remove.
|
|
47
|
-
*/
|
|
48
|
-
remove(key: string): void;
|
|
49
|
-
/**
|
|
50
|
-
* Copy styles from another Styles instance
|
|
51
|
-
* @param source Source Styles instance to copy from
|
|
52
|
-
* @param keys Optional set of keys to copy. If omitted, copies all styles.
|
|
53
|
-
*/
|
|
54
|
-
copy(source: Styles, keys?: Set<string> | string[]): void;
|
|
55
|
-
/**
|
|
56
|
-
* Create a deep clone of this Styles instance.
|
|
57
|
-
*
|
|
58
|
-
* @returns A new Styles instance with cloned style objects
|
|
59
|
-
*/
|
|
60
|
-
clone(): Styles;
|
|
61
|
-
get(key: StyleKey): Style | undefined;
|
|
62
|
-
set(key: StyleKey, style: Style): void;
|
|
63
|
-
has(key: StyleKey): boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Returns an iterator over [styleKey, style] entries.
|
|
66
|
-
* @example
|
|
67
|
-
* for (const [key, style] of styles.entries()) {
|
|
68
|
-
* console.log(key, style);
|
|
69
|
-
* }
|
|
70
|
-
*/
|
|
71
|
-
entries(): IterableIterator<[StyleKey, Style]>;
|
|
72
|
-
/**
|
|
73
|
-
* Returns an iterator over style values.
|
|
74
|
-
* @example
|
|
75
|
-
* for (const style of styles.values()) {
|
|
76
|
-
* await style.process();
|
|
77
|
-
* }
|
|
78
|
-
*/
|
|
79
|
-
values(): IterableIterator<Style>;
|
|
80
|
-
/**
|
|
81
|
-
* Returns an iterator over style keys.
|
|
82
|
-
* @example
|
|
83
|
-
* for (const key of styles.keys()) {
|
|
84
|
-
* console.log(key);
|
|
85
|
-
* }
|
|
86
|
-
*/
|
|
87
|
-
keys(): IterableIterator<StyleKey>;
|
|
88
|
-
/**
|
|
89
|
-
* Makes Styles directly iterable (defaults to entries).
|
|
90
|
-
* @example
|
|
91
|
-
* for (const [key, style] of styles) {
|
|
92
|
-
* console.log(key, style);
|
|
93
|
-
* }
|
|
94
|
-
*/
|
|
95
|
-
[Symbol.iterator](): IterableIterator<[StyleKey, Style]>;
|
|
96
|
-
/**
|
|
97
|
-
* Returns the number of styles in the collection.
|
|
98
|
-
*/
|
|
99
|
-
get size(): number;
|
|
100
|
-
/**
|
|
101
|
-
* Checks if the collection is empty.
|
|
102
|
-
* @example
|
|
103
|
-
* if (styles.isEmpty()) {
|
|
104
|
-
* return;
|
|
105
|
-
* }
|
|
106
|
-
*/
|
|
107
|
-
isEmpty(): boolean;
|
|
108
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { Styles } from './Styles';
|
|
2
|
-
import type { ProcessingContext } from '../../Runtime/Context/interfaces.js';
|
|
3
|
-
export declare class StylesProcessor {
|
|
4
|
-
/**
|
|
5
|
-
* Relates raw Figma properties into semantic spec properties.
|
|
6
|
-
* Runs after evaluate() and before layer() so computed values
|
|
7
|
-
* are available for variant differencing.
|
|
8
|
-
*/
|
|
9
|
-
static postEvaluate(styles: Styles): void;
|
|
10
|
-
/**
|
|
11
|
-
* Performs all post-processing steps on the given Styles instance.
|
|
12
|
-
* Runs after layer() — handles name resolution, defaults removal,
|
|
13
|
-
* and text-style/typography relationships.
|
|
14
|
-
* @param styles The Styles object to process.
|
|
15
|
-
* @param removeDefaults Whether to remove default styles.
|
|
16
|
-
* @param fullStyles The full styles for comparison.
|
|
17
|
-
* @param context Optional processing context with dataLoader
|
|
18
|
-
*/
|
|
19
|
-
static postProcess(styles: Styles, removeDefaults: boolean, fullStyles: Styles | undefined, context?: ProcessingContext): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Removes default styles from the given Styles object.
|
|
22
|
-
* @param styles The Styles object to process.
|
|
23
|
-
*/
|
|
24
|
-
private static removeDefaults;
|
|
25
|
-
/**
|
|
26
|
-
* Resolves variable names within SidesQuadComposite and CornersQuadComposite values.
|
|
27
|
-
* @param styles The Styles object to process.
|
|
28
|
-
* @param context Optional processing context
|
|
29
|
-
*/
|
|
30
|
-
private static lookupQuadCompositeVariables;
|
|
31
|
-
/**
|
|
32
|
-
* Resolves variable names within BiaxialComposite values.
|
|
33
|
-
* @param styles The Styles object to process.
|
|
34
|
-
* @param context Optional processing context
|
|
35
|
-
*/
|
|
36
|
-
private static lookupBiaxialCompositeVariables;
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* Relates layout sizing and auto-layout styles.
|
|
40
|
-
* @param styles The Styles object to process.
|
|
41
|
-
*/
|
|
42
|
-
private static relateLayoutSizingAndAutoLayout;
|
|
43
|
-
/**
|
|
44
|
-
* Maps Figma constraints to directional positioning properties (ADR-041).
|
|
45
|
-
*
|
|
46
|
-
* Reads the parent's layout mode and the child's positioning context to determine
|
|
47
|
-
* which offset properties to emit. Each axis is mapped independently (FR-013).
|
|
48
|
-
*
|
|
49
|
-
* Context rules (FR-012):
|
|
50
|
-
* - Parent layoutMode NONE (regular frame): offsets + position null
|
|
51
|
-
* - Auto-layout + ABSOLUTE child: offsets + position "ABSOLUTE"
|
|
52
|
-
* - Auto-layout + AUTO child: position "AUTO", no offsets
|
|
53
|
-
* - Top-level (no parent) or COMPONENT root: position null, no offsets
|
|
54
|
-
*/
|
|
55
|
-
private static relateAutoVsAbsoluteLayout;
|
|
56
|
-
/**
|
|
57
|
-
* Maps a single-axis constraint to the appropriate offset property/properties.
|
|
58
|
-
*/
|
|
59
|
-
private static mapAxisConstraint;
|
|
60
|
-
/**
|
|
61
|
-
* Creates a Style for an offset key and sets a computed value on it.
|
|
62
|
-
* Accepts null to explicitly mark a key as "no value" (needed for variant differencing).
|
|
63
|
-
*/
|
|
64
|
-
private static setOffsetStyle;
|
|
65
|
-
/**
|
|
66
|
-
* Removes wrapAlignment when wrap is not active — it's a dead property otherwise.
|
|
67
|
-
*/
|
|
68
|
-
private static relateWrapAndWrapAlignment;
|
|
69
|
-
private static relateTextStyleAndTextProperties;
|
|
70
|
-
/**
|
|
71
|
-
* Looks up and updates a Figma style name (text or effect) for the given Styles instance.
|
|
72
|
-
* @param styles The Styles object to process.
|
|
73
|
-
* @param styleKey The style key to look up ('textStyleId').
|
|
74
|
-
* @param context Optional processing context
|
|
75
|
-
*/
|
|
76
|
-
private static lookupFigmaStyleName;
|
|
77
|
-
/**
|
|
78
|
-
* Looks up and updates color style names for fills and strokes.
|
|
79
|
-
* Only performs lookup if the style type is 'STYLE'.
|
|
80
|
-
* @param styles The Styles object to process.
|
|
81
|
-
* @param context Optional processing context
|
|
82
|
-
*/
|
|
83
|
-
private static lookupColorStyleNames;
|
|
84
|
-
/**
|
|
85
|
-
* Looks up and updates variables for the given Styles instance.
|
|
86
|
-
* @param styles The Styles object to process.
|
|
87
|
-
* @param context Optional processing context
|
|
88
|
-
*/
|
|
89
|
-
private static lookupVariables;
|
|
90
|
-
/**
|
|
91
|
-
* Looks up and updates gradient stop variables for any gradient styles.
|
|
92
|
-
* @param styles The Styles object to process.
|
|
93
|
-
* @param context Optional processing context
|
|
94
|
-
*/
|
|
95
|
-
private static lookupGradientVariables;
|
|
96
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maps transformer spec output keys to their corresponding Figma node property keys.
|
|
3
|
-
* Only keys that differ need an entry — all others fall through to identity.
|
|
4
|
-
*
|
|
5
|
-
* This is the single source of truth for any transformer output key that diverges
|
|
6
|
-
* from its Figma node property name. Add new entries here as more semantic renames land.
|
|
7
|
-
*/
|
|
8
|
-
export declare const SPEC_TO_FIGMA_KEY_MAP: Readonly<Record<string, string>>;
|
|
9
|
-
/** Resolve a spec-layer output key to the Figma node property key to read from. */
|
|
10
|
-
export declare function toFigmaKey(specKey: string): string;
|
|
11
|
-
/** All spec keys that map to `node.fills`. */
|
|
12
|
-
export declare const FILL_SPEC_KEYS: ReadonlyArray<string>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare const STYLE_KEYS: {
|
|
2
|
-
ALL: string[];
|
|
3
|
-
STROKE_SIDES: string[];
|
|
4
|
-
CORNERS: string[];
|
|
5
|
-
PADDING_SIDES: string[];
|
|
6
|
-
COMPONENT: string[];
|
|
7
|
-
FRAME: string[];
|
|
8
|
-
SLOT: string[];
|
|
9
|
-
INSTANCE: string[];
|
|
10
|
-
GLYPH: string[];
|
|
11
|
-
TEXT: string[];
|
|
12
|
-
VECTOR: string[];
|
|
13
|
-
RECTANGLE: string[];
|
|
14
|
-
LINE: string[];
|
|
15
|
-
STAR: string[];
|
|
16
|
-
POLYGON: string[];
|
|
17
|
-
ELLIPSE: string[];
|
|
18
|
-
};
|
|
19
|
-
export type StyleKey = typeof STYLE_KEYS.ALL[number];
|
|
20
|
-
export type Side = 'TOP' | 'BOTTOM' | 'LEFT' | 'RIGHT';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Component } from "../Component.js";
|
|
2
|
-
import { SpecableNode } from '../Nodes/types.js';
|
|
3
|
-
import { ResolvedConfig } from '@directededges/specs-schema';
|
|
4
|
-
import { Subcomponent as AnovaSubcomponent } from '@directededges/specs-schema';
|
|
5
|
-
import { Anatomy } from '../Anatomy/Anatomy.js';
|
|
6
|
-
import type { ProcessingContext } from '../../Runtime/Context/interfaces.js';
|
|
7
|
-
export declare class Subcomponent extends Component {
|
|
8
|
-
private _parentComponentName?;
|
|
9
|
-
private _subcomponentKey?;
|
|
10
|
-
constructor(node: SpecableNode, config: ResolvedConfig);
|
|
11
|
-
/** Called by Subcomponents before process() to set path context for $extensions pointers. */
|
|
12
|
-
setPathContext(parentComponentName: string, subcomponentKey: string): void;
|
|
13
|
-
process(context?: ProcessingContext): Promise<void>;
|
|
14
|
-
protected _slotBasePath(): string;
|
|
15
|
-
/**
|
|
16
|
-
* Get the anatomy for this subcomponent (internal use only)
|
|
17
|
-
*/
|
|
18
|
-
getAnatomy(): Anatomy;
|
|
19
|
-
data(): AnovaSubcomponent;
|
|
20
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { ResolvedConfig, Subcomponents as AnovaSubcomponents } from "@directededges/specs-schema";
|
|
2
|
-
import { Anatomy } from '../Anatomy/Anatomy.js';
|
|
3
|
-
import type { Subcomponent } from './Subcomponent.js';
|
|
4
|
-
import type { ProcessingContext } from '../../Runtime/Context/interfaces.js';
|
|
5
|
-
export declare class Subcomponents {
|
|
6
|
-
private _items;
|
|
7
|
-
private _refMap;
|
|
8
|
-
private config;
|
|
9
|
-
constructor(config: ResolvedConfig);
|
|
10
|
-
private createSubcomponent;
|
|
11
|
-
/**
|
|
12
|
-
* Check if a name matches any of the given template patterns.
|
|
13
|
-
* Patterns use {C} (component name) and {S} (subcomponent name) placeholders.
|
|
14
|
-
* Short-circuits on first match, returning the captured subcomponent name or null.
|
|
15
|
-
*/
|
|
16
|
-
static matchesPatterns(name: string, patterns: string[], componentName: string): string | null;
|
|
17
|
-
/**
|
|
18
|
-
* Check if a name matches any exclude pattern.
|
|
19
|
-
* Returns true if the name should be excluded.
|
|
20
|
-
*/
|
|
21
|
-
private matchesExclude;
|
|
22
|
-
private evaluateAnatomy;
|
|
23
|
-
/**
|
|
24
|
-
* Scan page-level COMPONENT/COMPONENT_SET nodes for additional subcomponents.
|
|
25
|
-
* Only called when scope is PAGE. Additive — never replaces anatomy-detected subcomponents.
|
|
26
|
-
*/
|
|
27
|
-
private evaluatePage;
|
|
28
|
-
evaluate(componentName: string, anatomy: Anatomy, context?: ProcessingContext, rootNodeId?: string): Promise<void>;
|
|
29
|
-
data(_config: ResolvedConfig, _removeExcludedMembers?: boolean, _defaultVariant?: boolean): AnovaSubcomponents | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Build a formatted ref map: formatted instanceOf → formatted subcomponent key.
|
|
32
|
-
* Used by data serialization to emit `{ $ref: '#/subcomponents/{key}' }`.
|
|
33
|
-
*/
|
|
34
|
-
refMap(keyFormat: ResolvedConfig['format']['keys']): Map<string, string>;
|
|
35
|
-
get(name: string): Subcomponent | undefined;
|
|
36
|
-
set(name: string, subcomponent: Subcomponent): void;
|
|
37
|
-
has(name: string): boolean;
|
|
38
|
-
delete(name: string): void;
|
|
39
|
-
/**
|
|
40
|
-
* Returns an iterator over [name, subcomponent] entries.
|
|
41
|
-
* @example
|
|
42
|
-
* for (const [name, subcomponent] of subcomponents.entries()) {
|
|
43
|
-
* console.log(name, subcomponent);
|
|
44
|
-
* }
|
|
45
|
-
*/
|
|
46
|
-
entries(): IterableIterator<[string, Subcomponent]>;
|
|
47
|
-
/**
|
|
48
|
-
* Returns an iterator over subcomponent values.
|
|
49
|
-
* @example
|
|
50
|
-
* for (const subcomponent of subcomponents.values()) {
|
|
51
|
-
* await subcomponent.process();
|
|
52
|
-
* }
|
|
53
|
-
*/
|
|
54
|
-
values(): IterableIterator<Subcomponent>;
|
|
55
|
-
/**
|
|
56
|
-
* Returns an iterator over subcomponent names.
|
|
57
|
-
* @example
|
|
58
|
-
* for (const name of subcomponents.keys()) {
|
|
59
|
-
* console.log(name);
|
|
60
|
-
* }
|
|
61
|
-
*/
|
|
62
|
-
keys(): IterableIterator<string>;
|
|
63
|
-
/**
|
|
64
|
-
* Makes Subcomponents directly iterable (defaults to entries).
|
|
65
|
-
* @example
|
|
66
|
-
* for (const [name, subcomponent] of subcomponents) {
|
|
67
|
-
* console.log(name, subcomponent);
|
|
68
|
-
* }
|
|
69
|
-
*/
|
|
70
|
-
[Symbol.iterator](): IterableIterator<[string, Subcomponent]>;
|
|
71
|
-
/**
|
|
72
|
-
* Returns the number of subcomponents in the collection.
|
|
73
|
-
*/
|
|
74
|
-
get size(): number;
|
|
75
|
-
/**
|
|
76
|
-
* Checks if the collection is empty.
|
|
77
|
-
* @example
|
|
78
|
-
* if (subcomponents.isEmpty()) {
|
|
79
|
-
* return;
|
|
80
|
-
* }
|
|
81
|
-
*/
|
|
82
|
-
isEmpty(): boolean;
|
|
83
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { Typography as AnovaTypography, ResolvedConfig } from '@directededges/specs-schema';
|
|
2
|
-
import { FigmaVariableReference } from '../Styles/References/index.js';
|
|
3
|
-
import { type ProcessingContext } from '../../Runtime/Context/interfaces.js';
|
|
4
|
-
/**
|
|
5
|
-
* Typography - First-class component representing all typography-related properties.
|
|
6
|
-
*
|
|
7
|
-
* Consolidates 13 individual typography properties into a single composite entity,
|
|
8
|
-
* matching the Effects and Gradient pattern. Typography instances can represent:
|
|
9
|
-
* - Inline typography (13 individual properties evaluated from node)
|
|
10
|
-
* - Mixed values (when text runs have different values)
|
|
11
|
-
* - Variable bindings (fontSize, lineHeight, letterSpacing, paragraphSpacing)
|
|
12
|
-
* - Explicit null (property removed/unset in variant)
|
|
13
|
-
*
|
|
14
|
-
* @see Effects for similar pattern (composite component with property-level diffing)
|
|
15
|
-
*/
|
|
16
|
-
export declare class Typography {
|
|
17
|
-
fontSize?: number | FigmaVariableReference | 'Figma mixed' | null;
|
|
18
|
-
fontFamily?: string | FigmaVariableReference | 'Figma mixed' | null;
|
|
19
|
-
fontStyle?: string | FigmaVariableReference | 'Figma mixed' | null;
|
|
20
|
-
lineHeight?: number | FigmaVariableReference | 'Figma mixed' | null;
|
|
21
|
-
letterSpacing?: number | FigmaVariableReference | 'Figma mixed' | null;
|
|
22
|
-
textCase?: string | 'Figma mixed' | null;
|
|
23
|
-
textDecoration?: string | 'Figma mixed' | null;
|
|
24
|
-
paragraphIndent?: number | FigmaVariableReference | 'Figma mixed' | null;
|
|
25
|
-
paragraphSpacing?: number | FigmaVariableReference | 'Figma mixed' | null;
|
|
26
|
-
leadingTrim?: string | 'Figma mixed' | null;
|
|
27
|
-
listSpacing?: number | 'Figma mixed' | null;
|
|
28
|
-
hangingPunctuation?: boolean | 'Figma mixed' | null;
|
|
29
|
-
hangingList?: boolean | 'Figma mixed' | null;
|
|
30
|
-
/**
|
|
31
|
-
* Evaluate typography properties from a TextNode.
|
|
32
|
-
*
|
|
33
|
-
* Delegates to existing style primitives (FontStyle, NumberStyle, LineHeightStyle,
|
|
34
|
-
* MixedStyle, BooleanStyle) to evaluate each property. Checks for variable bindings
|
|
35
|
-
* on VARIABLE_PROPERTIES before calling primitives. Returns null if all properties
|
|
36
|
-
* are undefined (no typography data present).
|
|
37
|
-
*
|
|
38
|
-
* @param node - Figma TextNode to evaluate
|
|
39
|
-
* @returns Typography instance or null if empty
|
|
40
|
-
*/
|
|
41
|
-
static evaluate(node: TextNode, context?: ProcessingContext): Typography | null;
|
|
42
|
-
/**
|
|
43
|
-
* Returns true when no typography property has been set.
|
|
44
|
-
* Used to determine if Typography key should be omitted from output.
|
|
45
|
-
*/
|
|
46
|
-
isEmpty(): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Serialize Typography to output format.
|
|
49
|
-
*
|
|
50
|
-
* - Omits undefined properties
|
|
51
|
-
* - Includes null properties explicitly as null
|
|
52
|
-
* - Calls instance.data(config) for FigmaVariableReference properties
|
|
53
|
-
* - Returns partial object (only includes defined properties)
|
|
54
|
-
*
|
|
55
|
-
* @param config - Transformation configuration
|
|
56
|
-
* @returns Typography object (using AnovaTypography from @directededges/specs-schema)
|
|
57
|
-
*/
|
|
58
|
-
data(config: ResolvedConfig): AnovaTypography;
|
|
59
|
-
/**
|
|
60
|
-
* Serialize a property value, calling instance.data(config) for FigmaVariableReference.
|
|
61
|
-
*
|
|
62
|
-
* @param value - Property value to serialize
|
|
63
|
-
* @param config - Transformation configuration
|
|
64
|
-
* @returns Serialized value
|
|
65
|
-
*/
|
|
66
|
-
private serializeProperty;
|
|
67
|
-
/**
|
|
68
|
-
* Create a deep copy of this Typography instance.
|
|
69
|
-
*
|
|
70
|
-
* - Calls instance.clone() for FigmaVariableReference instances
|
|
71
|
-
* - Preserves null vs undefined distinction
|
|
72
|
-
*
|
|
73
|
-
* @returns New Typography instance
|
|
74
|
-
*/
|
|
75
|
-
clone(): Typography;
|
|
76
|
-
/**
|
|
77
|
-
* Clone a field value, calling instance.clone() for FigmaVariableReference.
|
|
78
|
-
*/
|
|
79
|
-
private cloneField;
|
|
80
|
-
/**
|
|
81
|
-
* Property-level comparison with base Typography.
|
|
82
|
-
*
|
|
83
|
-
* Returns true if ANY property differs. Compares:
|
|
84
|
-
* - Existence first (!!this.prop !== !!base.prop)
|
|
85
|
-
* - Calls instance.difference() for FigmaVariableReference instances
|
|
86
|
-
* - null ≠ undefined, null ≠ any value, undefined ≠ any defined value
|
|
87
|
-
*
|
|
88
|
-
* @param base - Base Typography to compare against
|
|
89
|
-
* @returns true if any property differs
|
|
90
|
-
*/
|
|
91
|
-
difference(base: Typography): boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Compare two field values for difference.
|
|
94
|
-
* Handles existence, primitives, FigmaVariableReference instances, 'Figma mixed', and null.
|
|
95
|
-
*/
|
|
96
|
-
private differField;
|
|
97
|
-
/**
|
|
98
|
-
* Whole-group replacement: returns typography.clone().
|
|
99
|
-
* When merging two Typography objects, the typography completely replaces the base with no property inheritance.
|
|
100
|
-
*
|
|
101
|
-
* @param typography - The Typography instance to merge onto this one
|
|
102
|
-
* @returns A cloned copy of the typography Typography
|
|
103
|
-
*/
|
|
104
|
-
merge(typography: Typography): Typography;
|
|
105
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Style } from '../Styles/Style.js';
|
|
2
|
-
import type { ProcessingContext } from '../../Runtime/Context/interfaces.js';
|
|
3
|
-
/**
|
|
4
|
-
* Post-processes a `typography` Style after initial evaluation.
|
|
5
|
-
*
|
|
6
|
-
* Handles two paths:
|
|
7
|
-
* 1. FigmaStyleReference: resolves the `.name` field via resolveName().
|
|
8
|
-
* 2. Typography: resolves FigmaVariableReference fields and optionally removes defaults.
|
|
9
|
-
*
|
|
10
|
-
* Called from `StylesProcessor.postProcess()` for the `typography` style key.
|
|
11
|
-
*/
|
|
12
|
-
export declare class TypographyProcessor {
|
|
13
|
-
/**
|
|
14
|
-
* Performs all post-processing steps on a typography Style.
|
|
15
|
-
* @param style The typography Style to process
|
|
16
|
-
* @param context Optional processing context with foundations
|
|
17
|
-
* @param removeDefaults Whether to remove default values
|
|
18
|
-
*/
|
|
19
|
-
static postProcess(style: Style | undefined, context?: ProcessingContext, removeDefaults?: boolean): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Resolves FigmaVariableReference fields to named variables.
|
|
22
|
-
* Processes fontSize, lineHeight, letterSpacing, paragraphSpacing.
|
|
23
|
-
* @param typography The Typography instance to process
|
|
24
|
-
* @param context Optional processing context with foundations
|
|
25
|
-
*/
|
|
26
|
-
private static lookupVariables;
|
|
27
|
-
/**
|
|
28
|
-
* Removes typography properties that match their default values.
|
|
29
|
-
* Properties matching TYPOGRAPHY_DEFAULTS are set to undefined.
|
|
30
|
-
* @param typography The Typography instance to process
|
|
31
|
-
*/
|
|
32
|
-
private static removeDefaults;
|
|
33
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typography properties that support variable bindings.
|
|
3
|
-
*
|
|
4
|
-
* These properties can be bound to Figma variables:
|
|
5
|
-
* - fontSize - Font size in pixels (number variable)
|
|
6
|
-
* - fontFamily - Font family name (string variable)
|
|
7
|
-
* - fontStyle - Font style/weight (string variable)
|
|
8
|
-
* - lineHeight - Line height (pixels or %) (number variable)
|
|
9
|
-
* - letterSpacing - Letter spacing (pixels or %) (number variable)
|
|
10
|
-
* - paragraphIndent - First line indent in pixels (number variable)
|
|
11
|
-
* - paragraphSpacing - Space between paragraphs in pixels (number variable)
|
|
12
|
-
* - listSpacing - Space between list items in pixels (number variable)
|
|
13
|
-
*
|
|
14
|
-
* Used by TypographyProcessor.postProcess() to resolve FigmaVariableReference.id
|
|
15
|
-
* to FigmaVariableReference.name via instance.resolveName().
|
|
16
|
-
*
|
|
17
|
-
* @see TypographyProcessor for variable name resolution
|
|
18
|
-
* @see Typography for property types (string|number | FigmaVariableReference | 'Figma mixed' | null)
|
|
19
|
-
*/
|
|
20
|
-
export declare const VARIABLE_PROPERTIES: readonly ["fontSize", "fontFamily", "fontStyle", "lineHeight", "letterSpacing", "paragraphIndent", "paragraphSpacing"];
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default values for Typography properties.
|
|
3
|
-
*
|
|
4
|
-
* Used for default removal logic during evaluation of the default variant.
|
|
5
|
-
* When a property's evaluated value matches its default, it's omitted from
|
|
6
|
-
* output to keep the base component minimal (existing transformer behavior).
|
|
7
|
-
*
|
|
8
|
-
* Note: textStyleId (now handled as FigmaStyleReferenceData reference) is not included here.
|
|
9
|
-
* TypographyStyle.value() checks for textStyleId separately before delegating
|
|
10
|
-
* to Typography.evaluate().
|
|
11
|
-
*
|
|
12
|
-
* @see Typography.evaluate() for default removal implementation
|
|
13
|
-
* @see data-model.md for null vs undefined semantics
|
|
14
|
-
*/
|
|
15
|
-
export declare const TYPOGRAPHY_DEFAULTS: {
|
|
16
|
-
readonly fontSize: 16;
|
|
17
|
-
readonly fontFamily: null;
|
|
18
|
-
readonly fontStyle: null;
|
|
19
|
-
readonly textCase: "ORIGINAL";
|
|
20
|
-
readonly textDecoration: "NONE";
|
|
21
|
-
readonly letterSpacing: 0;
|
|
22
|
-
readonly lineHeight: "AUTO";
|
|
23
|
-
readonly paragraphIndent: 0;
|
|
24
|
-
readonly paragraphSpacing: 0;
|
|
25
|
-
readonly leadingTrim: "NONE";
|
|
26
|
-
readonly listSpacing: 0;
|
|
27
|
-
readonly hangingPunctuation: false;
|
|
28
|
-
readonly hangingList: false;
|
|
29
|
-
};
|
|
30
|
-
export type TypographyProperty = keyof typeof TYPOGRAPHY_DEFAULTS;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typography property keys (internal to Typography component).
|
|
3
|
-
*
|
|
4
|
-
* This constant lists all 13 typography properties for iteration in:
|
|
5
|
-
* - Typography.isEmpty() - checking if all properties are undefined
|
|
6
|
-
* - Typography.data() - serializing defined properties
|
|
7
|
-
* - Typography.difference() - comparing properties with base
|
|
8
|
-
*
|
|
9
|
-
* These are internal to the Typography component and separate from the
|
|
10
|
-
* central STYLE_KEYS (which contains 'typography' as a single key).
|
|
11
|
-
*/
|
|
12
|
-
export declare const TYPOGRAPHY_KEYS: readonly ["fontSize", "fontFamily", "fontStyle", "lineHeight", "letterSpacing", "textCase", "textDecoration", "paragraphIndent", "paragraphSpacing", "leadingTrim", "listSpacing", "hangingPunctuation", "hangingList"];
|