@directededges/specs-from-figma 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/Adapters/RestApi/NodeIndexer.d.ts +118 -0
  2. package/dist/Adapters/RestApi/RestBaseNode.d.ts +271 -0
  3. package/dist/Adapters/RestApi/RestComponentNode.d.ts +30 -0
  4. package/dist/Adapters/RestApi/RestInstanceNode.d.ts +50 -0
  5. package/dist/Adapters/RestApi/RestLibraryFile.d.ts +51 -0
  6. package/dist/Adapters/RestApi/RestTextNode.d.ts +41 -0
  7. package/dist/Component/Anatomy/Anatomy.d.ts +97 -0
  8. package/dist/Component/Anatomy/AnatomyElement.d.ts +24 -0
  9. package/dist/Component/Children/Children.d.ts +96 -0
  10. package/dist/Component/Color/Color.d.ts +63 -0
  11. package/dist/Component/Component.d.ts +71 -0
  12. package/dist/Component/Effects/Blur.d.ts +41 -0
  13. package/dist/Component/Effects/Effects.d.ts +51 -0
  14. package/dist/Component/Effects/EffectsProcessor.d.ts +15 -0
  15. package/dist/Component/Effects/Shadow.d.ts +51 -0
  16. package/dist/Component/Effects/index.d.ts +4 -0
  17. package/dist/Component/Elements/BaseElement.d.ts +87 -0
  18. package/dist/Component/Elements/ElementFactory.d.ts +7 -0
  19. package/dist/Component/Elements/ElementFactoryRegistry.d.ts +21 -0
  20. package/dist/Component/Elements/Elements.d.ts +86 -0
  21. package/dist/Component/Elements/Primitives/ComponentElement.d.ts +8 -0
  22. package/dist/Component/Elements/Primitives/EllipseElement.d.ts +8 -0
  23. package/dist/Component/Elements/Primitives/FrameElement.d.ts +8 -0
  24. package/dist/Component/Elements/Primitives/GlyphElement.d.ts +21 -0
  25. package/dist/Component/Elements/Primitives/InstanceElement.d.ts +24 -0
  26. package/dist/Component/Elements/Primitives/LineElement.d.ts +8 -0
  27. package/dist/Component/Elements/Primitives/PolygonElement.d.ts +8 -0
  28. package/dist/Component/Elements/Primitives/RectangleElement.d.ts +8 -0
  29. package/dist/Component/Elements/Primitives/SlotElement.d.ts +8 -0
  30. package/dist/Component/Elements/Primitives/StarElement.d.ts +8 -0
  31. package/dist/Component/Elements/Primitives/TextElement.d.ts +8 -0
  32. package/dist/Component/Elements/Primitives/VectorElement.d.ts +8 -0
  33. package/dist/Component/Elements/index.d.ts +12 -0
  34. package/dist/Component/Gradient/Gradient.d.ts +73 -0
  35. package/dist/Component/Gradient/GradientProcessor.d.ts +18 -0
  36. package/dist/Component/Gradient/index.d.ts +2 -0
  37. package/dist/Component/InstanceExamples/InstanceExample.d.ts +35 -0
  38. package/dist/Component/InstanceExamples/InstanceExamples.d.ts +49 -0
  39. package/dist/Component/Layout/Layout.d.ts +26 -0
  40. package/dist/Component/Layout/types.d.ts +61 -0
  41. package/dist/Component/Metadata/Metadata.d.ts +13 -0
  42. package/dist/Component/Metadata/constants.d.ts +8 -0
  43. package/dist/Component/Nodes/types.d.ts +4 -0
  44. package/dist/Component/PropConfigurations/PropConfiguration.d.ts +15 -0
  45. package/dist/Component/PropConfigurations/PropConfigurations.d.ts +55 -0
  46. package/dist/Component/Props/CodeOnlyProps/BooleanCodeOnlyProp.d.ts +11 -0
  47. package/dist/Component/Props/CodeOnlyProps/CodeOnlyProps.d.ts +36 -0
  48. package/dist/Component/Props/CodeOnlyProps/InstanceCodeOnlyProp.d.ts +19 -0
  49. package/dist/Component/Props/CodeOnlyProps/TextCodeOnlyProp.d.ts +18 -0
  50. package/dist/Component/Props/CodeOnlyProps/index.d.ts +4 -0
  51. package/dist/Component/Props/PropBinding.d.ts +69 -0
  52. package/dist/Component/Props/PropPair.d.ts +16 -0
  53. package/dist/Component/Props/PropPairings.d.ts +89 -0
  54. package/dist/Component/Props/Props.d.ts +93 -0
  55. package/dist/Component/Props/SlotConstraints.d.ts +37 -0
  56. package/dist/Component/SlotContent/SlotCandidate.d.ts +42 -0
  57. package/dist/Component/SlotContent/SlotContent.d.ts +84 -0
  58. package/dist/Component/SlotContent/SlotDetector.d.ts +85 -0
  59. package/dist/Component/SlotContent/SlotItem.d.ts +44 -0
  60. package/dist/Component/SlotContent/SlotRegistry.d.ts +61 -0
  61. package/dist/Component/Styles/Composites/BiaxialComposite.d.ts +64 -0
  62. package/dist/Component/Styles/Composites/QuadComposite.d.ts +80 -0
  63. package/dist/Component/Styles/Composites/index.d.ts +4 -0
  64. package/dist/Component/Styles/Primitives/AspectRatioStyle.d.ts +34 -0
  65. package/dist/Component/Styles/Primitives/BooleanStyle.d.ts +6 -0
  66. package/dist/Component/Styles/Primitives/ColorStyle.d.ts +29 -0
  67. package/dist/Component/Styles/Primitives/ConditionalStyle.d.ts +30 -0
  68. package/dist/Component/Styles/Primitives/CornerStyle.d.ts +12 -0
  69. package/dist/Component/Styles/Primitives/EffectsStyle.d.ts +13 -0
  70. package/dist/Component/Styles/Primitives/IconFillStyle.d.ts +40 -0
  71. package/dist/Component/Styles/Primitives/MixedStyle.d.ts +5 -0
  72. package/dist/Component/Styles/Primitives/NumberStyle.d.ts +7 -0
  73. package/dist/Component/Styles/Primitives/PaddingStyle.d.ts +13 -0
  74. package/dist/Component/Styles/Primitives/StringStyle.d.ts +5 -0
  75. package/dist/Component/Styles/Primitives/StrokeStyle.d.ts +12 -0
  76. package/dist/Component/Styles/Primitives/TypographyStyle.d.ts +21 -0
  77. package/dist/Component/Styles/Primitives/index.d.ts +13 -0
  78. package/dist/Component/Styles/Primitives/mapping.d.ts +85 -0
  79. package/dist/Component/Styles/References/FigmaStyleReference.d.ts +45 -0
  80. package/dist/Component/Styles/References/FigmaVariableReference.d.ts +61 -0
  81. package/dist/Component/Styles/References/index.d.ts +24 -0
  82. package/dist/Component/Styles/Style.d.ts +88 -0
  83. package/dist/Component/Styles/Styles.d.ts +108 -0
  84. package/dist/Component/Styles/StylesProcessor.d.ts +96 -0
  85. package/dist/Component/Styles/defaults.d.ts +2 -0
  86. package/dist/Component/Styles/figmaKeyMap.d.ts +12 -0
  87. package/dist/Component/Styles/keys.d.ts +20 -0
  88. package/dist/Component/Subcomponents/Subcomponent.d.ts +20 -0
  89. package/dist/Component/Subcomponents/Subcomponents.d.ts +83 -0
  90. package/dist/Component/Typography/FontStyle.d.ts +6 -0
  91. package/dist/Component/Typography/LetterSpacingStyle.d.ts +4 -0
  92. package/dist/Component/Typography/LineHeightStyle.d.ts +4 -0
  93. package/dist/Component/Typography/Typography.d.ts +105 -0
  94. package/dist/Component/Typography/TypographyProcessor.d.ts +33 -0
  95. package/dist/Component/Typography/constants.d.ts +20 -0
  96. package/dist/Component/Typography/defaults.d.ts +30 -0
  97. package/dist/Component/Typography/keys.d.ts +12 -0
  98. package/dist/Component/Variants/Differencer.d.ts +47 -0
  99. package/dist/Component/Variants/Variant.d.ts +55 -0
  100. package/dist/Component/Variants/Variants.d.ts +91 -0
  101. package/dist/Components/Components.d.ts +68 -0
  102. package/dist/Config/types.Settings.d.ts +30 -0
  103. package/dist/Constants/ApiMappings.d.ts +31 -0
  104. package/dist/Constants/BindingKeys.d.ts +2 -0
  105. package/dist/Constants/DevSettings.d.ts +4 -0
  106. package/dist/Constants/Nodes.d.ts +1 -0
  107. package/dist/License/LicenseManager.d.ts +43 -0
  108. package/dist/License/ProxyClient.d.ts +25 -0
  109. package/dist/License/constants.d.ts +41 -0
  110. package/dist/License/types.d.ts +83 -0
  111. package/dist/Progress/PhaseConfiguration.d.ts +20 -0
  112. package/dist/Progress/Progress.d.ts +107 -0
  113. package/dist/Progress/ProgressCoordinator.d.ts +33 -0
  114. package/dist/Runtime/Context/interfaces.d.ts +73 -0
  115. package/dist/Runtime/Foundations/FigmaPluginFoundations.d.ts +37 -0
  116. package/dist/Runtime/Foundations/FigmaRESTFoundations.d.ts +72 -0
  117. package/dist/Runtime/Foundations/FigmaRESTMaps.d.ts +55 -0
  118. package/dist/Runtime/Foundations/interfaces.d.ts +72 -0
  119. package/dist/Runtime/Nodes/FigmaPluginNodes.d.ts +45 -0
  120. package/dist/Runtime/Nodes/FigmaRestNodes.d.ts +43 -0
  121. package/dist/Runtime/Nodes/NodeAccess.d.ts +23 -0
  122. package/dist/Runtime/Nodes/interfaces.d.ts +60 -0
  123. package/dist/Utilities/Utilities.d.ts +44 -0
  124. package/dist/Utilities/types.ReferenceValue.d.ts +16 -0
  125. package/dist/index.js +1 -1
  126. package/package.json +5 -5
@@ -0,0 +1,80 @@
1
+ import type { ResolvedConfig } from '@directededges/specs-schema';
2
+ import { FigmaVariableReference } from '../References/index.js';
3
+ import { FigmaElementNode } from '../../Nodes/types.js';
4
+ /** Per-field value: raw number or variable reference */
5
+ export type FieldValue = number | FigmaVariableReference;
6
+ export type QuadValue = number | FigmaVariableReference | QuadComposite;
7
+ export type QuadKind = 'SIDES' | 'CORNERS';
8
+ /** Collected per-field data from Figma node reading */
9
+ export type CollectedField = {
10
+ logicalKey: string;
11
+ raw: number | null;
12
+ variable: FigmaVariableReference | null;
13
+ };
14
+ /**
15
+ * Generic composite for per-field numeric values (padding, strokeWeight, cornerRadius).
16
+ * Fields hold raw numbers or FigmaVariableReference instances keyed by logical name.
17
+ * Serializes to the anova `Sides` or `Corners` output type via data().
18
+ */
19
+ export declare class QuadComposite {
20
+ private _fields;
21
+ private _kind;
22
+ /** Inherited shorthand default for fields not explicitly set (used during layered diffing) */
23
+ private _default;
24
+ /**
25
+ * Resolve a bound variable for a Figma node property key.
26
+ */
27
+ static getVariableForKey(node: FigmaElementNode, figmaKey: string, rawValue: number | null): FigmaVariableReference | null;
28
+ /**
29
+ * Collect per-field raw values and variables from a Figma node using a key map.
30
+ */
31
+ static collectFields(node: FigmaElementNode, figmaKeyMap: Record<string, string>, includeVariables: boolean, getVariable?: (node: FigmaElementNode, figmaKey: string, raw: number | null) => FigmaVariableReference | null, getRawValue?: (node: FigmaElementNode, figmaKey: string) => number | null): CollectedField[];
32
+ /**
33
+ * Build a QuadComposite (or collapse to scalar) from collected per-field data.
34
+ * Returns a single FigmaVariableReference if all fields share the same variable,
35
+ * a scalar number if all fields have the same raw value, or a QuadComposite.
36
+ */
37
+ static fromFields(fields: CollectedField[], kind: QuadKind): QuadValue;
38
+ /**
39
+ * Merge a layered variant object onto a baseline shorthand/object.
40
+ * Variant wins on overlapping properties.
41
+ */
42
+ static merge(base: QuadValue, layer: QuadComposite | null): QuadValue;
43
+ constructor(fields: Record<string, FieldValue>, kind?: QuadKind);
44
+ /**
45
+ * Compare against a baseline. Returns a sparse composite with only changed fields,
46
+ * or null if no fields differ.
47
+ */
48
+ difference(baseline: QuadValue): QuadValue | null;
49
+ /**
50
+ * Quad-aware difference router for Style-level union values.
51
+ *
52
+ * Returns:
53
+ * - `undefined` when quad semantics do not apply
54
+ * - `null` when values participate in quad comparison and are equal
55
+ * - `QuadValue` when values participate and differ
56
+ */
57
+ static differenceValues(current: unknown, baseline: unknown): QuadValue | null | undefined;
58
+ clone(): QuadComposite;
59
+ data(config: ResolvedConfig): Record<string, unknown>;
60
+ /** Returns logical field names that have values */
61
+ fields(): string[];
62
+ get kind(): QuadKind;
63
+ /** True when all fields are plain numbers equal to the given scalar (for default removal) */
64
+ isEqualToScalar(scalar: number): boolean;
65
+ /** Get a field value by logical name */
66
+ get(field: string): FieldValue | undefined;
67
+ /** Set a field value by logical name */
68
+ set(field: string, value: FieldValue): void;
69
+ private fieldValue;
70
+ private static fieldDiffers;
71
+ private static cloneFieldValue;
72
+ private static cloneQuadValue;
73
+ private static quadFieldValue;
74
+ private static normalizeQuadOutput;
75
+ private static keysForKind;
76
+ private static inferKindFromFields;
77
+ private static resolveKind;
78
+ /** Resolve variable names for all FigmaVariableReference fields */
79
+ resolveVariables(foundations: import('../../../Runtime/Foundations/interfaces.js').FigmaFoundations | undefined): Promise<void>;
80
+ }
@@ -0,0 +1,4 @@
1
+ export { QuadComposite } from './QuadComposite.js';
2
+ export type { FieldValue, CollectedField } from './QuadComposite.js';
3
+ export { BiaxialComposite } from './BiaxialComposite.js';
4
+ export type { BiaxialFieldValue, BiaxialValue } from './BiaxialComposite.js';
@@ -0,0 +1,34 @@
1
+ import type { AspectRatioValue } from '@directededges/specs-schema';
2
+ import type { FigmaElementNode } from '../../Nodes/types.js';
3
+ export declare class AspectRatioStyle {
4
+ /**
5
+ * Evaluate the aspectRatio value for a node:
6
+ * - If `targetAspectRatio` is set to a non-null Vector → return `{ x, y }` verbatim
7
+ * - Otherwise → return `null`
8
+ *
9
+ * The `targetAspectRatio` property is available on nodes with LayoutMixin.
10
+ * When the aspect ratio is locked via "Lock aspect ratio" in Figma UI,
11
+ * this property contains a Vector with x/y values matching the ratio.
12
+ * When unlocked, the property is `null`.
13
+ */
14
+ static value(node: FigmaElementNode): AspectRatioValue | null;
15
+ /**
16
+ * Compare two AspectRatioValue instances for equality.
17
+ * Returns true if they differ, false if they are equivalent.
18
+ *
19
+ * @param a - First aspect ratio value (or null)
20
+ * @param b - Second aspect ratio value (or null)
21
+ * @returns true if values differ, false if equivalent
22
+ */
23
+ static difference(a: AspectRatioValue | null, b: AspectRatioValue | null): boolean;
24
+ /**
25
+ * Explicit type guard for AspectRatioValue.
26
+ * The key must be 'aspectRatio' and the value must be non-null.
27
+ * Use this guard when narrowing a bare `StyleValue` where the key is known.
28
+ *
29
+ * @param key - The style key to check
30
+ * @param v - The value to check
31
+ * @returns true if v is a valid AspectRatioValue
32
+ */
33
+ static isAspectRatioStyle(key: string, v: unknown): v is AspectRatioValue;
34
+ }
@@ -0,0 +1,6 @@
1
+ import { RawStyle } from '../Style.js';
2
+ import { StyleKey } from "../keys.js";
3
+ import { FigmaElementNode } from '../../Nodes/types.js';
4
+ export declare class BooleanStyle {
5
+ static value(node: FigmaElementNode, key: StyleKey): RawStyle | null;
6
+ }
@@ -0,0 +1,29 @@
1
+ import { RawStyle } from '../Style.js';
2
+ import { StyleKey } from "../keys.js";
3
+ import { FigmaElementNode } from '../../Nodes/types.js';
4
+ import { Gradient } from '../../Gradient/Gradient.js';
5
+ import { Color } from '../../Color/Color.js';
6
+ import type { ProcessingContext } from '../../../Runtime/Context/interfaces.js';
7
+ export declare class ColorStyle {
8
+ static extractFirstPaint(node: FigmaElementNode, key: string): Paint | undefined;
9
+ /**
10
+ * Convert Figma RGB channels (0–1) + opacity to a Color instance.
11
+ * Always emits sRGB; alpha is omitted when fully opaque.
12
+ */
13
+ static toColorValue(color: RGB | (RGB & {
14
+ a: number;
15
+ }), opacity?: number): Color;
16
+ /**
17
+ * Extract alpha component from a paint or effect as a percentage string suffix.
18
+ * Retained for future color format configuration (RGBA, HSLA, etc.).
19
+ */
20
+ static alpha(color: Paint | Effect): string;
21
+ /**
22
+ * Convert a paint or effect color to an HSLA string.
23
+ * Retained for future color format configuration (RGBA, HSLA, etc.).
24
+ */
25
+ static HSLA2(paintOrEffect: Paint | Effect): string;
26
+ static value(node: FigmaElementNode, key: StyleKey, context?: ProcessingContext): RawStyle | Color | Gradient | null;
27
+ static styleFromPaints(colorArray: Paint[] | Effect[], context?: ProcessingContext): RawStyle | Color | Gradient | null;
28
+ private static toHexByte;
29
+ }
@@ -0,0 +1,30 @@
1
+ import { Conditional, ResolvedConfig } from '@directededges/specs-schema';
2
+ import type { PropPair } from '../../Props/PropPair.js';
3
+ /**
4
+ * ConditionalStyle — Style primitive for visibility conditionals.
5
+ *
6
+ * Stores the content prop name from a validated binding pair.
7
+ * Builds the Conditional object on serialization via data().
8
+ */
9
+ export declare class ConditionalStyle {
10
+ private readonly _contentPropName;
11
+ private readonly _booleanPropName;
12
+ constructor(pair: PropPair);
13
+ /**
14
+ * The commensurate Figma BOOLEAN prop that drives this element's visibility
15
+ * (e.g. `showIcon`), as opposed to the content prop referenced in the
16
+ * serialized condition (e.g. `icon`). Exposed for consumers that render the
17
+ * binding directly from the model — e.g. the plugin's canvas output renders a
18
+ * boolean prop pill for it. NOT part of the serialized `data()` shape, so this
19
+ * does not affect schema output.
20
+ */
21
+ get booleanPropName(): string;
22
+ data(config: ResolvedConfig): Conditional;
23
+ clone(): ConditionalStyle;
24
+ /**
25
+ * Compare two values where at least one may be a ConditionalStyle.
26
+ * Returns true if different, false if identical.
27
+ */
28
+ static difference(a: unknown, b: unknown): boolean;
29
+ static is(value: unknown): value is ConditionalStyle;
30
+ }
@@ -0,0 +1,12 @@
1
+ import { FigmaCorneredNode, FigmaElementNode } from '../../Nodes/types.js';
2
+ import { QuadComposite } from '../Composites/index.js';
3
+ import { FigmaVariableReference } from '../References/index.js';
4
+ import { type ProcessingContext } from '../../../Runtime/Context/interfaces.js';
5
+ /**
6
+ * Evaluates corner radius from a Figma node.
7
+ * Returns scalar number (uniform), FigmaVariableReference (uniform token),
8
+ * CornersQuadComposite (non-uniform), or null (no corners).
9
+ */
10
+ export declare class CornerStyle {
11
+ static value(node: FigmaCorneredNode | FigmaElementNode, context?: ProcessingContext): number | FigmaVariableReference | QuadComposite | null;
12
+ }
@@ -0,0 +1,13 @@
1
+ import type { FigmaElementNode } from '../../Nodes/types.js';
2
+ import { FigmaStyleReference } from '../Style.js';
3
+ import { Effects } from '../../Effects/Effects.js';
4
+ import { type ProcessingContext } from '../../../Runtime/Context/interfaces.js';
5
+ export declare class EffectsStyle {
6
+ /**
7
+ * Evaluate the effects value for a node:
8
+ * - If `effectStyleId` is set and entitled → return `FigmaStyleReference` (named style)
9
+ * - If inline effects exist → return populated `Effects` (shadows gated by context)
10
+ * - Otherwise → return `null`
11
+ */
12
+ static value(node: FigmaElementNode, context?: ProcessingContext): Effects | FigmaStyleReference | null;
13
+ }
@@ -0,0 +1,40 @@
1
+ import { RawStyle } from '../Style.js';
2
+ import { StyleKey } from '../keys.js';
3
+ import { FigmaElementNode } from '../../Nodes/types.js';
4
+ import { Color } from '../../Color/Color.js';
5
+ import { FigmaVariableReference } from '../References/FigmaVariableReference.js';
6
+ import { FigmaStyleReference } from '../References/FigmaStyleReference.js';
7
+ /**
8
+ * Specialized style handler for icon element `fillColor`.
9
+ *
10
+ * Handles the full resolution chain (variable ref → style ref → raw color)
11
+ * at whichever node has fills, with recursive child drill-down and a
12
+ * solid-only constraint on fills[0].
13
+ *
14
+ * Registered in Style.applySpecializedKeyHandler() so it runs before the
15
+ * generic applyVariableReference / applyColorStyleReference steps — those
16
+ * check the top-level node, but icon fills may live on a child.
17
+ */
18
+ export declare class IconFillStyle {
19
+ /**
20
+ * Evaluate fillColor for an icon element.
21
+ *
22
+ * Two-pass depth-first search:
23
+ * 1. Prefer a node with a variable or style binding (richer data).
24
+ * 2. Fall back to the first node with any solid fill (raw color).
25
+ *
26
+ * This ensures intermediate GROUP nodes with unbound fills don't shadow
27
+ * deeper children that carry the actual variable binding (see #99).
28
+ */
29
+ static evaluate(node: FigmaElementNode, key: StyleKey, resolveVariables: boolean): RawStyle | Color | FigmaVariableReference | FigmaStyleReference | null;
30
+ /** Depth-first walk returning the first matching fill result. */
31
+ private static walk;
32
+ /**
33
+ * Evaluate a single node's fills[0] with full resolution chain.
34
+ * Order: style ref → variable ref → raw solid color.
35
+ *
36
+ * When `bindingsOnly` is true, returns null instead of a raw color —
37
+ * only style/variable references are returned.
38
+ */
39
+ private static evaluateNode;
40
+ }
@@ -0,0 +1,5 @@
1
+ import { StyleKey } from "../keys.js";
2
+ import { FigmaElementNode } from '../../Nodes/types.js';
3
+ export declare class MixedStyle {
4
+ static value<T extends string | number | object>(member: string, node: FigmaElementNode, key: StyleKey): T | string | null;
5
+ }
@@ -0,0 +1,7 @@
1
+ import { RawStyle } from '../Style.js';
2
+ import { StyleKey } from '../keys.js';
3
+ import { FigmaElementNode } from '../../Nodes/types.js';
4
+ export declare class NumberStyle {
5
+ static value(node: FigmaElementNode, key: StyleKey): RawStyle | null;
6
+ static rounded(value: number | null | undefined): number | null;
7
+ }
@@ -0,0 +1,13 @@
1
+ import { FigmaElementNode } from '../../Nodes/types.js';
2
+ import { QuadComposite } from '../Composites/index.js';
3
+ import { FigmaVariableReference } from '../References/index.js';
4
+ import { type ProcessingContext } from '../../../Runtime/Context/interfaces.js';
5
+ /**
6
+ * Evaluates padding from a Figma node.
7
+ * Returns scalar number (uniform), FigmaVariableReference (uniform token),
8
+ * QuadComposite (non-uniform), or null (no padding).
9
+ */
10
+ export declare class PaddingStyle {
11
+ static value(node: FigmaElementNode, context?: ProcessingContext): number | FigmaVariableReference | QuadComposite | null;
12
+ private static getVariableForKey;
13
+ }
@@ -0,0 +1,5 @@
1
+ import { StyleKey } from '../keys.js';
2
+ import { FigmaElementNode } from '../../Nodes/types.js';
3
+ export declare class StringStyle {
4
+ static value(node: FigmaElementNode, key: StyleKey): string | null;
5
+ }
@@ -0,0 +1,12 @@
1
+ import { FigmaElementNode } from '../../Nodes/types.js';
2
+ import { QuadComposite } from '../Composites/index.js';
3
+ import { FigmaVariableReference } from '../References/index.js';
4
+ import { type ProcessingContext } from '../../../Runtime/Context/interfaces.js';
5
+ /**
6
+ * Evaluates stroke weight from a Figma node.
7
+ * Returns scalar number (uniform), FigmaVariableReference (uniform token),
8
+ * SidesQuadComposite (non-uniform), or null (no strokes).
9
+ */
10
+ export declare class StrokeStyle {
11
+ static value(node: FigmaElementNode, context?: ProcessingContext): number | FigmaVariableReference | QuadComposite | null;
12
+ }
@@ -0,0 +1,21 @@
1
+ import { FigmaStyleReference } from '../Style.js';
2
+ import { Typography } from '../../Typography/Typography.js';
3
+ import { type ProcessingContext } from '../../../Runtime/Context/interfaces.js';
4
+ /**
5
+ * TypographyStyle - Minimal orchestration primitive for typography evaluation.
6
+ *
7
+ * Priority:
8
+ * 1. Named text style (textStyleId) → FigmaStyleReference (PRO only)
9
+ * 2. Inline typography → Typography.evaluate(node, context)
10
+ *
11
+ * @see Typography.evaluate() for evaluation implementation
12
+ * @see EffectsStyle for similar primitive pattern
13
+ */
14
+ export declare class TypographyStyle {
15
+ /**
16
+ * Evaluate typography value for a TextNode.
17
+ * When not entitled to PRO, named text styles are skipped and inline
18
+ * Typography is returned instead (with variable references also gated).
19
+ */
20
+ static value(node: TextNode, context?: ProcessingContext): FigmaStyleReference | Typography | null;
21
+ }
@@ -0,0 +1,13 @@
1
+ export { AspectRatioStyle } from './AspectRatioStyle.js';
2
+ export { BooleanStyle } from './BooleanStyle.js';
3
+ export { ColorStyle } from './ColorStyle.js';
4
+ export { CornerStyle } from './CornerStyle.js';
5
+ export { EffectsStyle } from './EffectsStyle.js';
6
+ export { IconFillStyle } from './IconFillStyle.js';
7
+ export { MixedStyle } from './MixedStyle.js';
8
+ export { NumberStyle } from './NumberStyle.js';
9
+ export { PaddingStyle } from './PaddingStyle.js';
10
+ export { StringStyle } from './StringStyle.js';
11
+ export { StrokeStyle } from './StrokeStyle.js';
12
+ export { TypographyStyle } from './TypographyStyle.js';
13
+ export { ConditionalStyle } from './ConditionalStyle.js';
@@ -0,0 +1,85 @@
1
+ import type { TokenReference } from '@directededges/specs-schema';
2
+ export declare const SIDES_DIRECTION_MAP: {
3
+ readonly left: "start";
4
+ readonly right: "end";
5
+ readonly top: "top";
6
+ readonly bottom: "bottom";
7
+ };
8
+ export declare const CORNERS_DIRECTION_MAP: {
9
+ readonly topLeft: "topStart";
10
+ readonly topRight: "topEnd";
11
+ readonly bottomRight: "bottomEnd";
12
+ readonly bottomLeft: "bottomStart";
13
+ };
14
+ export type LogicalSide = typeof SIDES_DIRECTION_MAP[keyof typeof SIDES_DIRECTION_MAP];
15
+ export type LogicalCorner = typeof CORNERS_DIRECTION_MAP[keyof typeof CORNERS_DIRECTION_MAP];
16
+ export declare const PADDING_FIGMA_KEYS: {
17
+ readonly paddingTop: "top";
18
+ readonly paddingBottom: "bottom";
19
+ readonly paddingLeft: "start";
20
+ readonly paddingRight: "end";
21
+ };
22
+ export declare const STROKE_WEIGHT_FIGMA_KEYS: {
23
+ readonly strokeTopWeight: "top";
24
+ readonly strokeBottomWeight: "bottom";
25
+ readonly strokeLeftWeight: "start";
26
+ readonly strokeRightWeight: "end";
27
+ };
28
+ export declare const CORNER_RADIUS_FIGMA_KEYS: {
29
+ readonly topLeftRadius: "topStart";
30
+ readonly topRightRadius: "topEnd";
31
+ readonly bottomRightRadius: "bottomEnd";
32
+ readonly bottomLeftRadius: "bottomStart";
33
+ };
34
+ export declare const STYLE_KEYS_PRIMITIVE_MAP: {
35
+ TYPOGRAPHY: {
36
+ keys: string[];
37
+ tokenType: "typography";
38
+ };
39
+ COLOR: {
40
+ keys: string[];
41
+ tokenType: "color";
42
+ };
43
+ STROKE: {
44
+ keys: string[];
45
+ tokenType: "dimension";
46
+ };
47
+ CORNER: {
48
+ keys: string[];
49
+ tokenType: "dimension";
50
+ };
51
+ PADDING: {
52
+ keys: string[];
53
+ tokenType: "dimension";
54
+ };
55
+ PURE_NUMBER_DIMENSIONLESS: {
56
+ keys: string[];
57
+ tokenType: "number";
58
+ };
59
+ PURE_NUMBER_DIMENSIONS: {
60
+ keys: string[];
61
+ tokenType: "dimension";
62
+ };
63
+ MIXABLE_STRING: {
64
+ keys: string[];
65
+ tokenType: "string";
66
+ };
67
+ PURE_STRING: {
68
+ keys: string[];
69
+ tokenType: "string";
70
+ };
71
+ BOOLEAN: {
72
+ keys: string[];
73
+ tokenType: undefined;
74
+ };
75
+ EFFECTS: {
76
+ keys: string[];
77
+ tokenType: "effects";
78
+ };
79
+ ASPECT_RATIO: {
80
+ keys: string[];
81
+ tokenType: undefined;
82
+ };
83
+ };
84
+ export declare const STYLE_KEYS_PRIMITIVE: Record<string, string>;
85
+ export declare const STYLE_KEY_TO_TOKEN_TYPE: Record<string, TokenReference['$type']>;
@@ -0,0 +1,45 @@
1
+ import type { FigmaElementNode } from '../../Nodes/types.js';
2
+ import type { StyleKey } from '../keys.js';
3
+ import type { ResolvedConfig, TokenReference } from '@directededges/specs-schema';
4
+ import type { FigmaFoundations } from '../../../Runtime/Foundations/interfaces.js';
5
+ /**
6
+ * FigmaStyleReference - instance-based published style binding.
7
+ *
8
+ * Represents a node property bound to a published Figma style. Instance-based lifecycle
9
+ * matches Effects, Gradient, Typography pattern.
10
+ */
11
+ export declare class FigmaStyleReference {
12
+ readonly id: string;
13
+ readonly tokenType: TokenReference['$type'];
14
+ name?: string;
15
+ customValue?: Record<string, unknown>;
16
+ constructor(id: string, tokenType: TokenReference['$type']);
17
+ /**
18
+ * Evaluate Figma published style binding for a property.
19
+ *
20
+ * Handles:
21
+ * - textStyleId (top-level property)
22
+ * - fillStyleId (color styles for fills)
23
+ * - strokeStyleId (color styles for strokes)
24
+ *
25
+ * @param node - Figma node to evaluate
26
+ * @param key - Style key to check for style binding
27
+ * @param tokenType - The TokenReference $type for this style reference
28
+ * @returns FigmaStyleReference instance if bound to published style, null otherwise
29
+ */
30
+ static evaluate(node: FigmaElementNode, key: StyleKey, tokenType: TokenReference['$type']): FigmaStyleReference | null;
31
+ /**
32
+ * Type guard for FigmaStyleReference instances.
33
+ */
34
+ static is(v: unknown): v is FigmaStyleReference;
35
+ difference(other: FigmaStyleReference): boolean;
36
+ clone(): FigmaStyleReference;
37
+ data(config: ResolvedConfig): string | TokenReference;
38
+ /**
39
+ * Convert style name to token path using Figma's native `/` separator.
40
+ * Uses `/` for all profiles to avoid DTCG-restricted characters (`.`, `{`, `}`).
41
+ * Returns fallback string if name not yet resolved.
42
+ */
43
+ private toTokenPath;
44
+ resolveName(foundations: FigmaFoundations | undefined): Promise<void>;
45
+ }
@@ -0,0 +1,61 @@
1
+ import type { FigmaElementNode } from '../../Nodes/types.js';
2
+ import type { StyleKey } from '../keys.js';
3
+ import type { ResolvedConfig, TokenReference } from '@directededges/specs-schema';
4
+ import type { FigmaFoundations } from '../../../Runtime/Foundations/interfaces.js';
5
+ import type { Color } from '../../Color/Color.js';
6
+ export type RawStyle = string | number | boolean;
7
+ /**
8
+ * FigmaVariableReference - instance-based variable binding.
9
+ *
10
+ * Represents a style value bound to a Figma variable. Instance-based lifecycle
11
+ * matches Effects, Gradient, Typography pattern.
12
+ */
13
+ export declare class FigmaVariableReference {
14
+ readonly id: string;
15
+ readonly rawValue: RawStyle | Color;
16
+ readonly tokenType: TokenReference['$type'];
17
+ variableName?: string;
18
+ collectionName?: string;
19
+ collectionId?: string;
20
+ customValue?: Record<string, unknown>;
21
+ codeSyntax?: {
22
+ WEB?: string;
23
+ ANDROID?: string;
24
+ iOS?: string;
25
+ };
26
+ constructor(id: string, rawValue: RawStyle | Color, tokenType: TokenReference['$type']);
27
+ /**
28
+ * Evaluate variable binding for a style property.
29
+ *
30
+ * @param node - Figma node to evaluate
31
+ * @param key - Style key to check for variable binding
32
+ * @param rawValueGetter - Function to compute the raw value if variable binding exists
33
+ * @returns FigmaVariableReference instance if bound to variable, null otherwise
34
+ */
35
+ static evaluate(node: FigmaElementNode, key: StyleKey, rawValueGetter: () => RawStyle | Color): FigmaVariableReference | null;
36
+ /**
37
+ * Type guard for FigmaVariableReference instances.
38
+ */
39
+ static is(v: unknown): v is FigmaVariableReference;
40
+ difference(other: FigmaVariableReference): boolean;
41
+ clone(): FigmaVariableReference;
42
+ data(config: ResolvedConfig): string | TokenReference;
43
+ /**
44
+ * Emit the `TOKEN` shape (`{ $token, $type }`) using the platform's Figma
45
+ * `codeSyntax` as the `$token`, falling back to the resolved token path when
46
+ * the token has no code syntax defined for that platform (ADR-051). The
47
+ * fall-back is a transformer responsibility, not a schema rule.
48
+ */
49
+ private codeSyntaxOrTokenFallback;
50
+ /**
51
+ * Convert variable name to token path using Figma's native `/` separator.
52
+ * Uses `/` for all profiles to avoid DTCG-restricted characters (`.`, `{`, `}`).
53
+ * Returns fallback string if name data not yet resolved.
54
+ */
55
+ private toTokenPath;
56
+ /**
57
+ * Serialize rawValue for output — Color instances emit ColorObject, primitives pass through.
58
+ */
59
+ private serializedRawValue;
60
+ resolveName(foundations: FigmaFoundations | undefined, includeCollection: boolean): Promise<void>;
61
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Figma reference types for indirection (variables, styles, component properties).
3
+ *
4
+ * These types represent pointers to values defined elsewhere in Figma:
5
+ * - FigmaVariableReference: Design tokens/variables (instance class)
6
+ * - FigmaStyleReference: Published color/text/effect styles (instance class)
7
+ * - PropBinding: Component property bindings (instance class, defined in Props/)
8
+ */
9
+ export type { RawStyle } from './FigmaVariableReference.js';
10
+ export { FigmaVariableReference } from './FigmaVariableReference.js';
11
+ export { FigmaStyleReference } from './FigmaStyleReference.js';
12
+ import { FigmaVariableReference } from './FigmaVariableReference.js';
13
+ import { FigmaStyleReference } from './FigmaStyleReference.js';
14
+ /**
15
+ * Type guard for FigmaVariableReference instances.
16
+ */
17
+ export declare function isFigmaVariableReference(v: unknown): v is FigmaVariableReference;
18
+ /**
19
+ * Type guard for FigmaStyleReference instances.
20
+ *
21
+ * Prefer `style.type === 'STYLE'` when the enclosing Style object is available.
22
+ * Use this guard when narrowing a bare StyleValue.
23
+ */
24
+ export declare function isFigmaStyleReference(v: unknown): v is FigmaStyleReference;
@@ -0,0 +1,88 @@
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
+ }