@zeplin/extension-model
Version:
Models exposed to Zeplin extensions
52 lines (51 loc) • 1.51 kB
TypeScript
import { Color, ColorData } from "./color.js";
import { Variable } from "./variable.js";
export type VariableValueType = "text" | "variable" | "color" | "number";
export interface VariableValueData {
modeId: string;
type: VariableValueType;
color?: ColorData;
variableSourceId?: string;
}
/**
* An interface that represents a variable value.
*/
export declare class VariableValue {
/**
* Unique identifier of the variable value's mode.
*/
modeId: string;
/**
* Type of the variable value.
*/
type: VariableValueType;
/**
* RGBA color of the variable value.
*
* Available when type is "color"
*/
color?: ColorData;
/**
* Unique identifier of the linked variable to the variable value.
*
* Available when type is "variable"
*/
variableSourceId?: string;
static get ALLOWED_FIELDS(): string[];
constructor(variableValueData: VariableValueData);
/**
* Generates a Color object from the variable value
*
* @param variable The variable containing this value
* @param colorValue The color value of the variable
* @returns A new Color instance
*/
generateColorObject(variable: Variable, colorValue: ColorData): Color;
/**
* Creates a VariableValue instance from a JSON string
*
* @param json JSON string representing a variable value
* @returns A new VariableValue instance
*/
static fromJSON(json: string): VariableValue;
}