Skip to content

pixso.variables

These are all defined on pixso.variables.

getVariableByIdAsync

typescript
getVariableByIdAsync(id: string): Promise<VariableNode | null>

Finds a variable by ID. If not found or the provided ID is invalid, returns a promise containing null.

getVariableCollectionByIdAsync

typescript
getVariableCollectionByIdAsync(id: string): Promise<VariableCollection | null>

Finds a variable collection by ID. If not found or the provided ID is invalid, returns a promise containing null.

getLocalVariablesAsync

typescript
getLocalVariablesAsync(type?: VariableResolvedDataType): Promise<Variable[]>

Returns all local variables in the current file, optionally filtering by resolved type.

getLocalVariableCollectionsAsync

typescript
getLocalVariableCollectionsAsync(): Promise<VariableCollection[]>

Returns all local variable collections in the current file.

createVariable

typescript
createVariable(name: string, collection: VariableCollection, resolvedType: VariableResolvedDataType): Variable

Creates a variable with a given name and resolved type inside a collection.

createVariableCollection

typescript
createVariableCollection(name: string): VariableCollection

Creates a new variable collection with the given name.

createVariableAlias

typescript
createVariableAlias(variable: Variable): VariableAlias

Helper function to create a variable alias.

createVariableAliasByIdAsync

typescript
createVariableAliasByIdAsync(variableId: string): Promise<VariableAlias>

Helper function to create a variable alias.

setBoundVariableForPaint

typescript
setBoundVariableForPaint(paint: SolidPaint, field: VariableBindablePaintField, variable: Variable | null): SolidPaint

Helper function to bind a variable to a SolidPaint. If null is provided as the variable, the given field will be unbound from any variables.

setBoundVariableForEffect

typescript
setBoundVariableForEffect(effect: Effect, field: VariableBindableEffectField, variable: Variable | null): Effect

Helper function to bind a variable to an Effect.If null is provided as the variable, the given field will be unbound from any variables.

setBoundVariableForLayoutGrid

typescript
setBoundVariableForLayoutGrid(layoutGrid: LayoutGrid, field: VariableBindableLayoutGridField, variable: Variable | null): LayoutGrid

Helper function to bind a variable to a LayoutGrid.If null is provided as the variable, the given field will be unbound from any variables.

importVariableByKeyAsync

typescript
importVariableByKeyAsync(key: string): Promise<Variable>

Loads a variable from the team library. Promise is rejected if there is no published variable with that key or if the request fails.