Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/pages/develop/changelog/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ keywords:

# Changelog

## XD Release 47 (December 2021)

### New API Features

* [SymbolInstance](/develop/reference/SymbolInstance) APIs to get read-only information on Components
* [assets.symbols.get()](/develop/reference/assets/#symbolsget) function to list Component assets

## XD Release 45 (October 2021)

### New API Features
Expand Down
102 changes: 102 additions & 0 deletions src/pages/develop/reference/SymbolInstance.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,105 @@ those changes are synced to all other instances of the component (unless blocked

**Kind**: instance property of [SymbolInstance](#symbolinstance)
**Read only**: true

## stateId

▸ **stateId**: `?string`

**Since**: XD 47

Returns a unique GUID string representing the state identification, or null if there is only one state. The GUID string will be a combination of digits, lower-case letters, and dashes. All instances of a component will have the same state IDs for the same states.

**Kind**: instance property of [SymbolInstance](#symbolinstance)
**Read only**: true

## stateName

▸ **stateName**: `string`

**Since**: XD 47

Returns the name of the currently active state of the component.

**Kind**: instance property of [SymbolInstance](#symbolinstance)
**Read only**: true

## hasOverrides

▸ **hasOverrides**: `boolean`

**Since**: XD 47

Returns true if the currently active state has one or more overrides that differ from the master instance of the component.

**Kind**: instance property of [SymbolInstance](#symbolinstance)
**Read only**: true

## isDefaultState

▸ **isDefaultState**: `boolean`

**Since**: XD 47

Returns true if the currently active state is displaying the default state of the component.

**Kind**: instance property of [SymbolInstance](#symbolinstance)
**Read only**: true

## defaultState

▸ **defaultState**: [SymbolInstance](#symbolinstance)

**Since**: XD 47

Returns a [SymbolInstance](#symbolinstance) that is the default state of the component. The SymbolInstance returned may or may not be in the scenegraph, therefore it cannot be relied upon for traversing the SceneNode hierarchy.

**Kind**: instance property of [SymbolInstance](#symbolinstance)
**Read only**: true

## isActiveState

▸ **isActiveState**: `boolean`

**Since**: XD 47

Returns true if the component state is the currently active state (being displayed on canvas).

**Kind**: instance property of [SymbolInstance](#symbolinstance)
**Read only**: true

## activeState

▸ **activeState**: [SymbolInstance](#symbolinstance)

**Since**: XD 47

Returns a [SymbolInstance](#symbolinstance) that is the active state of the component.

**Kind**: instance property of [SymbolInstance](#symbolinstance)
**Read only**: true

## getState()

▸ **getState(stateId)**: [SymbolInstance](#symbolinstance)

**Since**: XD 47

Returns a [SymbolInstance](#symbolinstance) that is the state with the given state ID. Returns null if the state ID is not valid, or if the state is not found in the component.

| Param | Type |
| --------- | ------------------- |
| `stateId` | `string` |

**Kind**: instance method of [SymbolInstance](#symbolinstance)

## statesInfo

▸ **statesInfo**: `Array.<!{stateId: ?string, name: string, isDefaultState: boolean}>`

**Since**: XD 47

Returns an array containing information about all the states in the component. For each state it returns an object containing the state ID, state name and whether it is the default state.

**Kind**: instance property of [SymbolInstance](#symbolinstance)
**Read only**: true
33 changes: 33 additions & 0 deletions src/pages/develop/reference/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,36 @@ var assets = require("assets"),
```

**Kind**: static method of [characterStyles](#module_assets-characterStyles)

## symbols

▸ **symbols**

**Since**: XD 47

The collection of [Components](/develop/reference/SymbolInstance) (previously known as "Symbols" in XD's UI) saved in this document's assets library.

- [.symbols](#module_assets-symbols)
- [.get()](#symbolsget): Array.<[SymbolInstance](/develop/reference/SymbolInstance)>

---
### symbols.get()

▸ **symbols.get**(): Array.<[SymbolInstance](/develop/reference/SymbolInstance)>

**Since**: XD 47

Get a list of all canonical [component](/develop/reference/SymbolInstance) assets in the order they appear in the Assets panel.

If there are no component assets, an empty array is returned.

**Example**

```js
const assets = require("assets");
const allComponentAssets = assets.symbols.get();
```

**Kind**: static method of [symbols](#symbols)

---