Types
Identification Type aliases
An artboard ID.
A component ID.
A layer ID.
A page ID.
Data Type aliases
Layer data (layer octopus)
Artboard content (an octopus document)
Layer Lookup Type aliases
An object used for looking up layers within a design by various properties. Properties can be combined freely.
Keys:
A single artboard ID or a list of IDs within which to search for layers.
A single bitmap asset name or a list of bitmap asset names. This can always match multiple layers.
A single font postscript name or a list of font postscript names. This can always match multiple layers. Only text layers can be matched.
A single layer ID or a list of IDs for matching multiple layers.
An exact layer name, a list of exact layer names or a regular expression. This can always match multiple layers.
NOTE: null
can be used to match layers without a name (which should not exist but it is theoretically possible from a data type perspective).
An exact text layer content, a list of exact text layer contents or a regular expression. This can always match multiple layers. Only text layers can be matched.
A single layer type or a list of layer types. This can always match multiple layers.
See the Octopus Format documentation for the possible values.
Whether to only match visible or invisible layers.
An object used for looking up layers within an artboard by various properties. Properties can be combined freely.
Keys:
A single bitmap asset name or a list of bitmap asset names. This can always match multiple layers.
A single font postscript name or a list of font postscript names. This can always match multiple layers. Only text layers can be matched.
A single layer ID or a list of IDs for matching multiple layers.
An exact layer name, a list of exact layer names or a regular expression. This can always match multiple layers.
NOTE: null
can be used to match layers without a name (which should not exist but it is theoretically possible from a data type perspective).
An exact text layer content, a list of exact text layer contents or a regular expression. This can always match multiple layers. Only text layers can be matched.
A single layer type or a list of layer types. This can always match multiple layers.
See the Octopus Format documentation for the possible values.
Whether to only match visible or invisible layers.
Artboard Lookup Type aliases
An object used for looking up artboards by various properties. Properties can be combined freely.
Keys:
A single artboard ID or a list of IDs for matching multiple artboards.
An exact artboard name, a list of exact artboard names or a regular expression. This can always match multiple artboards.
Other Type aliases
Keys:
Keys:
Configuration of the console/logger. This can either be a log level configuration for the bundled logger or a custom console object. The bundled logger can be replaced with the default node.js/browser console by providing console
.
The bundled logger log levels include these logs:
error
β API request errors; rendering engine errors; font file errorswarn
β Redundant design artboard unloading; non-fatal SDK configuration issues related to specific designs; missing fallback font filesinfo
β Successful API requestsdebug
β Initiated API requests; details about bitmap asset downloading; successful rendering engine initialization and messaging; local cache locations
Keys:
A human-readable name of the font.
This value is not always available.
The postscript name of the font.
This is the internal font name by which the font file is looked up in the font directory and the system.
Whether the fontPostScriptName
value had to be synthetically created from the font face name and its type name due to the actactual postscript name not being available.
The needed types/weights of the font used.
Keys:
Keys:
The blending mode to use for rendering the layer instead of its default blending mode.
Whether to apply clipping by a mask layer if any such mask is set for the layer (see isMasked). Clipping is disabled by default. Setting this flag for layers which do not have a mask layer set has no effect on the results.
Whether to render the component background from the main/master component. By default, the configuration from the main/master component is used.
Whether to apply layer effects of the layer. Rendering of effects of nested layers is not affected. By defaults, effects of the layer are applied.
The opacity to use for the layer instead of its default opacity.
Keys:
Area which has to be rerendered when the layer visibility is toggled.
Area in which the complete layer content (without effects) is located.
Area in which the complete layer content and its effects are located.
Area of the layer the user would likely consider the actual layer area.
The layer content can overflow outside of these bound just as there can be empty space around the layer content.
Area in which the layer content would be located had it not been transformed (rotated).
Keys:
The blending mode to use for rendering the layer instead of its default blending mode.
Whether to apply clipping by a mask layer if any such mask is set for the layer (see isMasked). Clipping is disabled by default. Setting this flag for layers which do not have a mask layer set has no effect on the results.
Whether to apply layer effects of the layer. Rendering of effects of nested layers is not affected. By defaults, effects of the layer are applied.
The opacity to use for the layer instead of its default opacity.
Page Lookup Type aliases
An object used for looking up pages by various properties. Properties can be combined freely.
Keys:
A single page ID or a list of IDs for matching multiple pages.
An exact page name, a list of exact page names or a regular expression. This can always match multiple pages.
Creates a cancellation token which can be used for aborting asynchronous operations of the SDK.
Most asynchronous methods accept a cancellation token (the returned token
). The same cancellation token can be used for multiple sequential as well as parallel operations. Finished operations no longer react to cancellations.
This mechanism is analogous to the standard AbortSignal
/AbortController
API with the difference that a cancellation reason can be specified. The created tokens are also somehow compatible with the standard API by exposing the standard AbortSignal
as token.signal
, just as it is possible to create a CancelToken
from an AbortSignal
via createCancelToken.fromSignal()
.
Example:
const controller = createCancelToken()
sdk.fetchDesignById('<ID>', { cancelToken: controller.token })
.then((design) => {
doStuffWithDesign(design)
controller.dispose()
})
.catch((err) => {
if (err.code !== 'OperationCancelled') { throw err }
})
setTimeout(() => {
controller.cancel('Timed out.')
}, 2000)
Keys:
A cancellation token which never gets cancelled.
This token can be used for logic simplification in place of actual working tokens as a default (i.e. cancelToken || null
to avoid the need for token?.throwIfCancelled()
).
Wraps an existing standard AbortSignal
in a new cancellation token which can be used with the SDK.
Was this article helpful?