NAV

Editor Extension SDK Reference

The Editor Extension SDK is a TypeScript library that provides access to Lucid's core application for editor extensions built using the Extension API.

Classes

BaseFieldTypeArray<Type>

core/data/fieldtypedefinition/fieldtypearray.BaseFieldTypeArray

Type parameters

Name
Type

Hierarchy

Constructors

constructor

new BaseFieldTypeArray<Type>(validTypesArray)

Type parameters
Name
Type
Parameters
Name Type
validTypesArray Type[]

Properties

validTypesArray

Readonly validTypesArray: Type[]

Methods

getInnerNonArrayTypes

getInnerNonArrayTypes(): Exclude<Type, BaseFieldTypeArray <Type>>[]

Returns

Exclude<Type, BaseFieldTypeArray <Type>>[]


getInnerTypes

getInnerTypes(): Type[]

Returns

Type[]


serialize

serialize(): SerializedFieldTypeArray

Returns

SerializedFieldTypeArray


serializeType

Protected Abstract serializeType(t): SerializedFieldTypeArraySubTypes

Parameters
Name Type
t Type
Returns

SerializedFieldTypeArraySubTypes


BlockProxy

document/blockproxy.BlockProxy

A block is a single shape on the document. A BlockProxy provides an interface to read and write the content of an existing block, and is typically accessed through PageProxy.blocks or another similar mechanism.

Hierarchy

Constructors

constructor

new BlockProxy(id, client)

Parameters
Name Type Description
id string ID of this item
client EditorClient
Inherited from

ItemProxy.constructor

Properties

allShapeData

Readonly allShapeData: MapProxy <string, SerializedFieldType | DataError >

All shape data accessible on this element, including shape data inherited from the page or a containing group. This collection is read-only.

Inherited from

ItemProxy.allShapeData


client

Protected Readonly client: EditorClient

Inherited from

ItemProxy.client


id

Readonly id: string

Inherited from

ItemProxy.id


properties

Readonly properties: WriteableMapProxy <string, JsonSerializable , void, JsonSerializable >

All properties available on this element, organized by name. Not all properties are writeable (e.g. "ClassName" on a block). To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

ItemProxy.properties


referenceKeys

Readonly referenceKeys: MapProxy <string | number, ReferenceKeyProxy >

The set of reference keys, organized by their ID, which can be either a string or number.

For more information, see the Developer Guide.

Inherited from

ItemProxy.referenceKeys


shapeData

Readonly shapeData: ShapeDataProxy

The shape data set directly on this element (not including any shape data inherited from the page or a containing group).

Inherited from

ItemProxy.shapeData


textAreas

Readonly textAreas: WriteableMapProxy <string, string, undefined, string>

The plain text in each of the text areas on this item, organized by text area name.

Inherited from

ItemProxy.textAreas


textStyles

Readonly textStyles: WriteableMapProxy <string, TextStyle , Promise<undefined>, Partial< TextStyle >>

The text style in each of the text areas on this item, organized by text area name.

Inherited from

ItemProxy.textStyles

Methods

changeZOrder

changeZOrder(operation): void

Parameters
Name Type Description
operation ZOrderOperation How to adjust the Z order of this item relative to the other items it overlaps on the page
Returns

void

Inherited from

ItemProxy.changeZOrder


delete

delete(): void

Delete this item from the document

Returns

void

Inherited from

ItemProxy.delete


executeFormula

executeFormula(formula): SerializedFieldType | DataError

Execute a formula in the context of this element

Parameters
Name Type Description
formula string The formula text, e.g. "@a + @b" to add together the shape data values a and b.
Returns

SerializedFieldType | DataError

The result of the formula, or an error.

Inherited from

ItemProxy.executeFormula


exists

exists(): boolean

Returns

boolean

true if this element still exists on the document, or false otherwise

Inherited from

ItemProxy.exists


getBoundingBox

getBoundingBox(): Box

Returns

Box

The bounding box of this item relative to its containing page. As pages may change size to fit the content on them, note that these coordinates may be negative or very large.

If this is a rotated block, the bounding box returned here is where the block would be if it were unrotated.

Inherited from

ItemProxy.getBoundingBox


getClassName

getClassName(): string

Returns

string

The class name of this block. This name is not necessarily human-readable, and will remain consistent over time, e.g. "ProcessBlock"..


getConnectedLines

getConnectedLines(): LineProxy []

Returns

LineProxy []

An array of lines that have one or both endpoints connected to this block.


getContainers

getContainers(): BlockProxy []

Returns

BlockProxy []

An array of blocks whose bounding boxes contain this item's upper-left corner

Inherited from

ItemProxy.getContainers


getLineWidth

getLineWidth(): number

Returns

number

The line width used by most kinds of blocks to render their outline.


getLocation

getLocation(): Object

Returns

Object

The x/y location of this item

Name Type
x number
y number
Inherited from

ItemProxy.getLocation


getPage

getPage(): PageProxy

Returns

PageProxy

The page containing this item

Inherited from

ItemProxy.getPage


getRotation

getRotation(): number

Returns

number

The amount this block is rotated around its own center, in radians.


getShadow

getShadow(): undefined | Shadow

Returns

undefined | Shadow

The current drop shadow on this block, or undefined if no shadow is set


getSimpleStaticDataGraphic

getSimpleStaticDataGraphic(): undefined | SimpleStaticDataGraphicSettings

Returns

undefined | SimpleStaticDataGraphicSettings

Settings for the simple static data graphic currently set on this block, or undefined if no simple data graphic is currently set. Note that if a data graphic exists that is not an icon, this will return undefined. This function will not consider data graphics set via conditional formatting rules.


linkText

linkText(textAreaKey, referenceKey, field): void

Link a text area to a data field, so that editing the text area will also update the associated data, and vice versa.

To use this, first establish a reference key on this block with setReferenceKey.

Parameters
Name Type
textAreaKey string
referenceKey string | number
field string
Returns

void


lockAspectRatio

lockAspectRatio(): void

Lock this block's aspect ratio to its current value. This can be reversed with unlockAspectRatio.

Returns

void


offset

offset(type, offset): void

Offset this item in the given direction by the given amount.

Parameters
Name Type Description
type LinearOffsetType The type of offset to apply to this item
offset Point The amount to offset
Returns

void

Inherited from

ItemProxy.offset


removeReferenceKey

removeReferenceKey(key): void

Remove the specified reference key from this element.

Parameters
Name Type
key string | number
Returns

void

Inherited from

ItemProxy.removeReferenceKey


setBoundingBox

setBoundingBox(bb): void

Attempts to move and resize this item to fit into the given bounding box. If this item (or another item it contains) has size or aspect ratio restrictions, it may not be possible to fit the requested location exactly.

This is done by moving this item to the requested location, then attempting to resize it from the bottom-right corner to the requested size.

Parameters
Name Type Description
bb Box The bounding box to attempt to make this item fill
Returns

void

Inherited from

ItemProxy.setBoundingBox


setDataSyncStateIconPosition

setDataSyncStateIconPosition(position): void

Parameters
Name Type Description
position undefined | BadgeEnumPosition The postion where the data sync state icon should be displayed on the block. If this position is set to undefined then the state icon position will fallback to the default position for the block.
Returns

void


setFillStyle

setFillStyle(fillStyle): void

Set the fill style used (by most kinds of blocks) to fill in their main opaque areas. This can be a string color (e.g. '#ff00ff80') or an image fill.

Parameters
Name Type
fillStyle SimpleFillStyle
Returns

void


setLineWidth

setLineWidth(width): void

Parameters
Name Type Description
width number The line width to be used (by most kinds of blocks) to render this block's outline
Returns

void


setLocation

setLocation(location): void

Moves this item so that its upper-left corner is positioned at the given location (prior to any rotation)

Parameters
Name Type Description
location Point The target location
Returns

void

Inherited from

ItemProxy.setLocation


setReferenceKey

setReferenceKey(key, settings): void

Set a reference key on this element, replacing any existing reference at the specified key.

Parameters
Name Type
key string | number
settings ReferenceKeyDefinition
Returns

void

Inherited from

ItemProxy.setReferenceKey


setRotation

setRotation(radians): void

Parameters
Name Type Description
radians number Angle the block should be rotated
Returns

void


setShadow

setShadow(shadow): void

Parameters
Name Type Description
shadow undefined | Shadow The drop shadow to set on the block, or undefined to clear the drop shadow
Returns

void


setSimpleStaticDataGraphic

setSimpleStaticDataGraphic(settings): void

Parameters
Name Type Description
settings undefined | SimpleStaticDataGraphicSettings Information about the static data graphic icon to set on this block.
Returns

void


unlockAspectRatio

unlockAspectRatio(): void

Unlock the aspect ratio of this block, allowing it to be stretched vertically or horizontally independently.

Returns

void


CardBlockProxy

document/blockclasses/cardblockproxy.CardBlockProxy

A block is a single shape on the document. A BlockProxy provides an interface to read and write the content of an existing block, and is typically accessed through PageProxy.blocks or another similar mechanism.

Hierarchy

Constructors

constructor

new CardBlockProxy(id, client)

Parameters
Name Type Description
id string ID of this item
client EditorClient
Inherited from

BlockProxy.constructor

Properties

allShapeData

Readonly allShapeData: MapProxy <string, SerializedFieldType | DataError >

All shape data accessible on this element, including shape data inherited from the page or a containing group. This collection is read-only.

Inherited from

BlockProxy.allShapeData


client

Protected Readonly client: EditorClient

Inherited from

BlockProxy.client


id

Readonly id: string

Inherited from

BlockProxy.id


properties

Readonly properties: WriteableMapProxy <string, JsonSerializable , void, JsonSerializable >

All properties available on this element, organized by name. Not all properties are writeable (e.g. "ClassName" on a block). To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

BlockProxy.properties


referenceKeys

Readonly referenceKeys: MapProxy <string | number, ReferenceKeyProxy >

The set of reference keys, organized by their ID, which can be either a string or number.

For more information, see the Developer Guide.

Inherited from

BlockProxy.referenceKeys


shapeData

Readonly shapeData: ShapeDataProxy

The shape data set directly on this element (not including any shape data inherited from the page or a containing group).

Inherited from

BlockProxy.shapeData


textAreas

Readonly textAreas: WriteableMapProxy <string, string, undefined, string>

The plain text in each of the text areas on this item, organized by text area name.

Inherited from

BlockProxy.textAreas


textStyles

Readonly textStyles: WriteableMapProxy <string, TextStyle , Promise<undefined>, Partial< TextStyle >>

The text style in each of the text areas on this item, organized by text area name.

Inherited from

BlockProxy.textStyles


classNameRegex

Static classNameRegex: RegExp

Methods

changeZOrder

changeZOrder(operation): void

Parameters
Name Type Description
operation ZOrderOperation How to adjust the Z order of this item relative to the other items it overlaps on the page
Returns

void

Inherited from

BlockProxy.changeZOrder


delete

delete(): void

Delete this item from the document

Returns

void

Inherited from

BlockProxy.delete


executeFormula

executeFormula(formula): SerializedFieldType | DataError

Execute a formula in the context of this element

Parameters
Name Type Description
formula string The formula text, e.g. "@a + @b" to add together the shape data values a and b.
Returns

SerializedFieldType | DataError

The result of the formula, or an error.

Inherited from

BlockProxy.executeFormula


exists

exists(): boolean

Returns

boolean

true if this element still exists on the document, or false otherwise

Inherited from

BlockProxy.exists


getBoundingBox

getBoundingBox(): Box

Returns

Box

The bounding box of this item relative to its containing page. As pages may change size to fit the content on them, note that these coordinates may be negative or very large.

If this is a rotated block, the bounding box returned here is where the block would be if it were unrotated.

Inherited from

BlockProxy.getBoundingBox


getClassName

getClassName(): string

Returns

string

The class name of this block. This name is not necessarily human-readable, and will remain consistent over time, e.g. "ProcessBlock"..

Inherited from

BlockProxy.getClassName


getConnectedLines

getConnectedLines(): LineProxy []

Returns

LineProxy []

An array of lines that have one or both endpoints connected to this block.

Inherited from

BlockProxy.getConnectedLines


getContainers

getContainers(): BlockProxy []

Returns

BlockProxy []

An array of blocks whose bounding boxes contain this item's upper-left corner

Inherited from

BlockProxy.getContainers


getLineWidth

getLineWidth(): number

Returns

number

The line width used by most kinds of blocks to render their outline.

Inherited from

BlockProxy.getLineWidth


getLocation

getLocation(): Object

Returns

Object

The x/y location of this item

Name Type
x number
y number
Inherited from

BlockProxy.getLocation


getPage

getPage(): PageProxy

Returns

PageProxy

The page containing this item

Inherited from

BlockProxy.getPage


getRotation

getRotation(): number

Returns

number

The amount this block is rotated around its own center, in radians.

Inherited from

BlockProxy.getRotation


getShadow

getShadow(): undefined | Shadow

Returns

undefined | Shadow

The current drop shadow on this block, or undefined if no shadow is set

Inherited from

BlockProxy.getShadow


getSimpleStaticDataGraphic

getSimpleStaticDataGraphic(): undefined | SimpleStaticDataGraphicSettings

Returns

undefined | SimpleStaticDataGraphicSettings

Settings for the simple static data graphic currently set on this block, or undefined if no simple data graphic is currently set. Note that if a data graphic exists that is not an icon, this will return undefined. This function will not consider data graphics set via conditional formatting rules.

Inherited from

BlockProxy.getSimpleStaticDataGraphic


linkText

linkText(textAreaKey, referenceKey, field): void

Link a text area to a data field, so that editing the text area will also update the associated data, and vice versa.

To use this, first establish a reference key on this block with setReferenceKey.

Parameters
Name Type
textAreaKey string
referenceKey string | number
field string
Returns

void

Inherited from

BlockProxy.linkText


lockAspectRatio

lockAspectRatio(): void

Lock this block's aspect ratio to its current value. This can be reversed with unlockAspectRatio.

Returns

void

Inherited from

BlockProxy.lockAspectRatio


offset

offset(type, offset): void

Offset this item in the given direction by the given amount.

Parameters
Name Type Description
type LinearOffsetType The type of offset to apply to this item
offset Point The amount to offset
Returns

void

Inherited from

BlockProxy.offset


removeReferenceKey

removeReferenceKey(key): void

Remove the specified reference key from this element.

Parameters
Name Type
key string | number
Returns

void

Inherited from

BlockProxy.removeReferenceKey


setBoundingBox

setBoundingBox(bb): void

Attempts to move and resize this item to fit into the given bounding box. If this item (or another item it contains) has size or aspect ratio restrictions, it may not be possible to fit the requested location exactly.

This is done by moving this item to the requested location, then attempting to resize it from the bottom-right corner to the requested size.

Parameters
Name Type Description
bb Box The bounding box to attempt to make this item fill
Returns

void

Inherited from

BlockProxy.setBoundingBox


setDataSyncStateIconPosition

setDataSyncStateIconPosition(position): void

Parameters
Name Type Description
position undefined | BadgeEnumPosition The postion where the data sync state icon should be displayed on the block. If this position is set to undefined then the state icon position will fallback to the default position for the block.
Returns

void

Inherited from

BlockProxy.setDataSyncStateIconPosition


setFillStyle

setFillStyle(fillStyle): void

Set the fill style used (by most kinds of blocks) to fill in their main opaque areas. This can be a string color (e.g. '#ff00ff80') or an image fill.

Parameters
Name Type
fillStyle SimpleFillStyle
Returns

void

Inherited from

BlockProxy.setFillStyle


setLineWidth

setLineWidth(width): void

Parameters
Name Type Description
width number The line width to be used (by most kinds of blocks) to render this block's outline
Returns

void

Inherited from

BlockProxy.setLineWidth


setLocation

setLocation(location): void

Moves this item so that its upper-left corner is positioned at the given location (prior to any rotation)

Parameters
Name Type Description
location Point The target location
Returns

void

Inherited from

BlockProxy.setLocation


setReferenceKey

setReferenceKey(key, settings): void

Set a reference key on this element, replacing any existing reference at the specified key.

Parameters
Name Type
key string | number
settings ReferenceKeyDefinition
Returns

void

Inherited from

BlockProxy.setReferenceKey


setRotation

setRotation(radians): void

Parameters
Name Type Description
radians number Angle the block should be rotated
Returns

void

Inherited from

BlockProxy.setRotation


setShadow

setShadow(shadow): void

Parameters
Name Type Description
shadow undefined | Shadow The drop shadow to set on the block, or undefined to clear the drop shadow
Returns

void

Inherited from

BlockProxy.setShadow


setSimpleStaticDataGraphic

setSimpleStaticDataGraphic(settings): void

Parameters
Name Type Description
settings undefined | SimpleStaticDataGraphicSettings Information about the static data graphic icon to set on this block.
Returns

void

Inherited from

BlockProxy.setSimpleStaticDataGraphic


unlockAspectRatio

unlockAspectRatio(): void

Unlock the aspect ratio of this block, allowing it to be stretched vertically or horizontally independently.

Returns

void

Inherited from

BlockProxy.unlockAspectRatio


CardConfigProxy

document/documentelement/cardconfigproxy.CardConfigProxy

Base class for anything on a Lucid document that has an ID and properties.

Hierarchy

Constructors

constructor

new CardConfigProxy(id, client)

Parameters
Name Type Description
id string The ID of this card config element
client EditorClient
Overrides

DocumentElementProxy.constructor

Properties

client

Protected Readonly client: EditorClient

Inherited from

DocumentElementProxy.client


id

Readonly id: string

Inherited from

DocumentElementProxy.id


properties

Readonly properties: WriteableMapProxy <string, JsonSerializable , void, JsonSerializable >

All properties available on this element, organized by name. Not all properties are writeable (e.g. "ClassName" on a block). To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

DocumentElementProxy.properties


CollectionEnumFieldType

core/data/fieldtypedefinition/collectionenumfieldtype.CollectionEnumFieldType

Constructors

constructor

new CollectionEnumFieldType(collectionId)

Parameters
Name Type
collectionId string

Properties

collectionId

Readonly collectionId: string


PRIMARY_KEY

Static Readonly PRIMARY_KEY: Id = CollectionEnumFieldNames.Id

Specifies which groovy field name is used as the primary key.

This should be kept in sync with GroovyFieldNames in FieldType.scala

Methods

serialize

serialize(): SerializedCollectionEnumFieldType

Returns

SerializedCollectionEnumFieldType


CollectionProxy

data/collectionproxy.CollectionProxy

A collection is a set of data items, each with the same set of fields (though some data items may not have all fields defined).

Hierarchy

Constructors

constructor

new CollectionProxy(id, client)

Parameters
Name Type Description
id string ID of this collection on the current document
client EditorClient
Overrides

PropertyStoreProxy.constructor

Properties

client

Protected Readonly client: EditorClient

Inherited from

PropertyStoreProxy.client


id

Readonly id: string

Inherited from

PropertyStoreProxy.id


items

Readonly items: MapProxy <string, DataItemProxy >

The data items in this collection, organized by their primary key. The primary key is usually calculated from the content of the data item, but may differ from the expected value in some circumstances, e.g. if there are two data items that would have the same primary key.


properties

Readonly properties: WriteableMapProxy <string, JsonSerializable , void, JsonSerializable >

All properties available on this element, organized by name. Not all properties are writeable (e.g. "ClassName" on a block). To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

PropertyStoreProxy.properties

Methods

getBranchedFrom

getBranchedFrom(): undefined | CollectionProxy

Some data collections may have local branches on the document, to store the set of changes that have been made by the user since the time the data was last refreshed from its source. For those collections, you can use this method to get the original data collection as it was last imported or refreshed.

Returns

undefined | CollectionProxy

the original collection from which this collection was branched, or undefined if this collection is not a branch


getFields

getFields(): string[]

Returns

string[]

an array of field names that are accessible on the items in this collection


getLocalChanges

getLocalChanges(): undefined | PatchCollectionProxy

Returns

undefined | PatchCollectionProxy

information about any changes made locally to the collection that have not been synchronized with the external data source.


getName

getName(): string

Returns

string

a human-readable name for this collection


getSchema

getSchema(): SchemaDefinition

Returns

SchemaDefinition


getSyncCollectionId

getSyncCollectionId(): undefined | string

Returns

undefined | string


patchItems

patchItems(patch): PatchDataItemsResult

Parameters
Name Type
patch Object
patch.added? Record<string, SerializedFieldType >[]
patch.changed? Map<string, Record<string, SerializedFieldType >>
patch.deleted? string[]
Returns

PatchDataItemsResult


CustomBlockProxy

document/blockclasses/customblockproxy.CustomBlockProxy

Custom shapes defined in extension packages (or other stencil-providing means like Visio stencil imports) are represented by a CustomBlockProxy.

Hierarchy

Constructors

constructor

new CustomBlockProxy(id, client)

Parameters
Name Type Description
id string ID of this item
client EditorClient
Inherited from

BlockProxy.constructor

Properties

allShapeData

Readonly allShapeData: MapProxy <string, SerializedFieldType | DataError >

All shape data accessible on this element, including shape data inherited from the page or a containing group. This collection is read-only.

Inherited from

BlockProxy.allShapeData


client

Protected Readonly client: EditorClient

Inherited from

BlockProxy.client


id

Readonly id: string

Inherited from

BlockProxy.id


properties

Readonly properties: WriteableMapProxy <string, JsonSerializable , void, JsonSerializable >

All properties available on this element, organized by name. Not all properties are writeable (e.g. "ClassName" on a block). To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

BlockProxy.properties


referenceKeys

Readonly referenceKeys: MapProxy <string | number, ReferenceKeyProxy >

The set of reference keys, organized by their ID, which can be either a string or number.

For more information, see the Developer Guide.

Inherited from

BlockProxy.referenceKeys


shapeData

Readonly shapeData: ShapeDataProxy

The shape data set directly on this element (not including any shape data inherited from the page or a containing group).

Inherited from

BlockProxy.shapeData


textAreas

Readonly textAreas: WriteableMapProxy <string, string, undefined, string>

The plain text in each of the text areas on this item, organized by text area name.

Inherited from

BlockProxy.textAreas


textStyles

Readonly textStyles: WriteableMapProxy <string, TextStyle , Promise<undefined>, Partial< TextStyle >>

The text style in each of the text areas on this item, organized by text area name.

Inherited from

BlockProxy.textStyles


classNameRegex

Static classNameRegex: RegExp

Methods

changeZOrder

changeZOrder(operation): void

Parameters
Name Type Description
operation ZOrderOperation How to adjust the Z order of this item relative to the other items it overlaps on the page
Returns

void

Inherited from

BlockProxy.changeZOrder


delete

delete(): void

Delete this item from the document

Returns

void

Inherited from

BlockProxy.delete


executeFormula

executeFormula(formula): SerializedFieldType | DataError

Execute a formula in the context of this element

Parameters
Name Type Description
formula string The formula text, e.g. "@a + @b" to add together the shape data values a and b.
Returns

SerializedFieldType | DataError

The result of the formula, or an error.

Inherited from

BlockProxy.executeFormula


exists

exists(): boolean

Returns

boolean

true if this element still exists on the document, or false otherwise

Inherited from

BlockProxy.exists


getBoundingBox

getBoundingBox(): Box

Returns

Box

The bounding box of this item relative to its containing page. As pages may change size to fit the content on them, note that these coordinates may be negative or very large.

If this is a rotated block, the bounding box returned here is where the block would be if it were unrotated.

Inherited from

BlockProxy.getBoundingBox


getClassName

getClassName(): string

Returns

string

The class name of this block. This name is not necessarily human-readable, and will remain consistent over time, e.g. "ProcessBlock"..

Inherited from

BlockProxy.getClassName


getConnectedLines

getConnectedLines(): LineProxy []

Returns

LineProxy []

An array of lines that have one or both endpoints connected to this block.

Inherited from

BlockProxy.getConnectedLines


getContainers

getContainers(): BlockProxy []

Returns

BlockProxy []

An array of blocks whose bounding boxes contain this item's upper-left corner

Inherited from

BlockProxy.getContainers


getLineWidth

getLineWidth(): number

Returns

number

The line width used by most kinds of blocks to render their outline.

Inherited from

BlockProxy.getLineWidth


getLocation

getLocation(): Object

Returns

Object

The x/y location of this item

Name Type
x number
y number
Inherited from

BlockProxy.getLocation


getPage

getPage(): PageProxy

Returns

PageProxy

The page containing this item

Inherited from

BlockProxy.getPage


getRotation

getRotation(): number

Returns

number

The amount this block is rotated around its own center, in radians.

Inherited from

BlockProxy.getRotation


getShadow

getShadow(): undefined | Shadow

Returns

undefined | Shadow

The current drop shadow on this block, or undefined if no shadow is set

Inherited from

BlockProxy.getShadow


getSimpleStaticDataGraphic

getSimpleStaticDataGraphic(): undefined | SimpleStaticDataGraphicSettings

Returns

undefined | SimpleStaticDataGraphicSettings

Settings for the simple static data graphic currently set on this block, or undefined if no simple data graphic is currently set. Note that if a data graphic exists that is not an icon, this will return undefined. This function will not consider data graphics set via conditional formatting rules.

Inherited from

BlockProxy.getSimpleStaticDataGraphic


getStencilTextAreaName

getStencilTextAreaName(stencilTextAreaName): undefined | string

Parameters
Name Type
stencilTextAreaName string
Returns

undefined | string


isFromStencil

isFromStencil(library, shape): boolean

Parameters
Name Type
library string
shape string
Returns

boolean


linkText

linkText(textAreaKey, referenceKey, field): void

Link a text area to a data field, so that editing the text area will also update the associated data, and vice versa.

To use this, first establish a reference key on this block with setReferenceKey.

Parameters
Name Type
textAreaKey string
referenceKey string | number
field string
Returns

void

Inherited from

BlockProxy.linkText


lockAspectRatio

lockAspectRatio(): void

Lock this block's aspect ratio to its current value. This can be reversed with unlockAspectRatio.

Returns

void

Inherited from

BlockProxy.lockAspectRatio


offset

offset(type, offset): void

Offset this item in the given direction by the given amount.

Parameters
Name Type Description
type LinearOffsetType The type of offset to apply to this item
offset Point The amount to offset
Returns

void

Inherited from

BlockProxy.offset


removeReferenceKey

removeReferenceKey(key): void

Remove the specified reference key from this element.

Parameters
Name Type
key string | number
Returns

void

Inherited from

BlockProxy.removeReferenceKey


setBoundingBox

setBoundingBox(bb): void

Attempts to move and resize this item to fit into the given bounding box. If this item (or another item it contains) has size or aspect ratio restrictions, it may not be possible to fit the requested location exactly.

This is done by moving this item to the requested location, then attempting to resize it from the bottom-right corner to the requested size.

Parameters
Name Type Description
bb Box The bounding box to attempt to make this item fill
Returns

void

Inherited from

BlockProxy.setBoundingBox


setDataSyncStateIconPosition

setDataSyncStateIconPosition(position): void

Parameters
Name Type Description
position undefined | BadgeEnumPosition The postion where the data sync state icon should be displayed on the block. If this position is set to undefined then the state icon position will fallback to the default position for the block.
Returns

void

Inherited from

BlockProxy.setDataSyncStateIconPosition


setFillStyle

setFillStyle(fillStyle): void

Set the fill style used (by most kinds of blocks) to fill in their main opaque areas. This can be a string color (e.g. '#ff00ff80') or an image fill.

Parameters
Name Type
fillStyle SimpleFillStyle
Returns

void

Inherited from

BlockProxy.setFillStyle


setLineWidth

setLineWidth(width): void

Parameters
Name Type Description
width number The line width to be used (by most kinds of blocks) to render this block's outline
Returns

void

Inherited from

BlockProxy.setLineWidth


setLocation

setLocation(location): void

Moves this item so that its upper-left corner is positioned at the given location (prior to any rotation)

Parameters
Name Type Description
location Point The target location
Returns

void

Inherited from

BlockProxy.setLocation


setReferenceKey

setReferenceKey(key, settings): void

Set a reference key on this element, replacing any existing reference at the specified key.

Parameters
Name Type
key string | number
settings ReferenceKeyDefinition
Returns

void

Inherited from

BlockProxy.setReferenceKey


setRotation

setRotation(radians): void

Parameters
Name Type Description
radians number Angle the block should be rotated
Returns

void

Inherited from

BlockProxy.setRotation


setShadow

setShadow(shadow): void

Parameters
Name Type Description
shadow undefined | Shadow The drop shadow to set on the block, or undefined to clear the drop shadow
Returns

void

Inherited from

BlockProxy.setShadow


setSimpleStaticDataGraphic

setSimpleStaticDataGraphic(settings): void

Parameters
Name Type Description
settings undefined | SimpleStaticDataGraphicSettings Information about the static data graphic icon to set on this block.
Returns

void

Inherited from

BlockProxy.setSimpleStaticDataGraphic


unlockAspectRatio

unlockAspectRatio(): void

Unlock the aspect ratio of this block, allowing it to be stretched vertically or horizontally independently.

Returns

void

Inherited from

BlockProxy.unlockAspectRatio


registerCustomBlockClass

Static registerCustomBlockClass(klass): void

Parameters
Name Type
klass CustomBlockProxyConstructor
Returns

void


DataConnector

dataconnector/dataconnector.DataConnector

Factory class to define a bunch of action handlers.

Constructors

constructor

new DataConnector(client)

Parameters
Name Type
client DataConnectorClient

Properties

actions

actions: Record<string, { actionResponder: ActionRequest< DataConnectorAsynchronousAction , unknown> ; asynchronous: true } | { actionResponder: ActionRequest< DataConnectorAction , unknown> ; asynchronous: false }> = {}


routes

routes: Record<string, DataConnectorRoute > = {}

Methods

defineAction

defineAction<T>(name, request, asynchronous?): DataConnector

Factory to define an action request handler

Type parameters
Name Type
T extends string
Parameters
Name Type Default value
name T undefined
request ActionTypeForName<T, boolean> undefined
asynchronous boolean false
Returns

DataConnector


defineAsynchronousAction

defineAsynchronousAction<T>(name, request): DataConnector

Factory to define an asynchronous action request handler

Type parameters
Name Type
T extends string
Parameters
Name Type
name T
request ActionTypeForName<T, true>
Returns

DataConnector


defineRoute

defineRoute(name, request): DataConnector

Factory to define a route handler

Parameters
Name Type
name string
request DataConnectorRoute
Returns

DataConnector


routeDebugServer

routeDebugServer(options): ExpressAppLike

Add a route to the given express app (or generate a new app) to serve this data connector

Parameters
Name Type
options RunDebugServerOptions
Returns

ExpressAppLike


runAction

runAction(url, headers, body): Promise<{ body: unknown ; status: number }>

Call a defined action handler and gather its serialized response

Parameters
Name Type
url string
headers Record<string, undefined | string | string[]>
body unknown
Returns

Promise<{ body: unknown ; status: number }>


runDebugServer

runDebugServer(options): void

Serve this data connector as a simple express app for debugging purposes

Parameters
Name Type
options RunDebugServerOptions
Returns

void


DataConnectorAction

dataconnector/actions/action.DataConnectorAction

Base class for actions to be performed by data connectors

Hierarchy

Constructors

constructor

new DataConnectorAction(name, context)

Parameters
Name Type
name string
context DataConnectorActionContext

Properties

context

context: DataConnectorActionContext


name

name: string


DataConnectorActionContext

dataconnector/actions/action.DataConnectorActionContext

This holds all the contextual information about a give data action.

Constructors

constructor

new DataConnectorActionContext(packageId, packageVersion, userCredential, dataConnectorName, installationId, documentCollections, updateFilterType)

Parameters
Name Type Description
packageId string The package ID of the extension that triggered this action
packageVersion string The version of the extension that triggered this action
userCredential string The authorized OAuth2 credential that Lucid has for the 3rd party this extension works with
dataConnectorName string The data connector name from manifest.json that triggered this action
installationId undefined | string The installation id of the extension/user that triggered this action
documentCollections Object Set of items this document is tracking as a Record<CollectionId, ItemPrimaryKey[]>
updateFilterType DataUpdateFilterType Update filter type for this document

Properties

dataConnectorName

dataConnectorName: string

The data connector name from manifest.json that triggered this action


documentCollections

documentCollections: Object

Set of items this document is tracking as a Record<CollectionId, ItemPrimaryKey[]>

Index signature

▪ [collectionId: CollectionId ]: ItemPrimaryKey []


installationId

installationId: undefined | string

The installation id of the extension/user that triggered this action


packageId

Readonly packageId: string

The package ID of the extension that triggered this action


packageVersion

packageVersion: string

The version of the extension that triggered this action


updateFilterType

updateFilterType: DataUpdateFilterType

Update filter type for this document


userCredential

userCredential: string

The authorized OAuth2 credential that Lucid has for the 3rd party this extension works with


DataConnectorAsynchronousAction

dataconnector/actions/action.DataConnectorAsynchronousAction

A generic "asynchronous" action to be performed by the data connector. This is an action that reports back to Lucid by calling back in the DataSourceClient rather than returning a meaningful value.

Hierarchy

Constructors

constructor

new DataConnectorAsynchronousAction(name, context, client, data)

Parameters
Name Type
name string
context DataConnectorActionContext
client DataSourceClient
data unknown
Overrides

DataConnectorAction.constructor

Properties

client

client: DataSourceClient


context

context: DataConnectorActionContext

Inherited from

DataConnectorAction.context


data

data: unknown


name

name: string

Inherited from

DataConnectorAction.name


DataConnectorClient

dataconnector/dataconnectorclient.DataConnectorClient

Client for requests to and from Lucid

Hierarchy

Constructors

constructor

new DataConnectorClient(cryptoDependencies, urls?, fetchMethod?)

Parameters
Name Type Default value
cryptoDependencies CryptoDependencies undefined
urls Object LUCID_URLS
urls.api string undefined
urls.main string undefined
fetchMethod GlobalFetchType globalFetch

Properties

urls

urls: Object = LUCID_URLS

Type declaration
Name Type
api string
main string

Methods

getDataSourceClient

getDataSourceClient(updateToken): DataSourceClient

Get a client for DataSource related requests to Lucid

Parameters
Name Type
updateToken string
Returns

DataSourceClient


getPublicKey

getPublicKey(): Promise<string>

Get Lucid's public key to verify requests came from Lucid if you don't want to use the SignatureValidator. Maybe you're not running in a NodeJS environment

Returns

Promise<string>


getSignatureValidator

getSignatureValidator(): Promise< SignatureValidator >

Get a validator to prove a given request came from Lucid

Returns

Promise< SignatureValidator >


parseActions

parseActions(url, headers, actions): Promise<undefined | DataConnectorAction []>

Validate and parse an action request from Lucid

Parameters
Name Type
url string
headers Record<string, unknown>
actions unknown
Returns

Promise<undefined | DataConnectorAction []>


DataConnectorManageWebhookAction

dataconnector/actions/action.DataConnectorManageWebhookAction

A "synchronous" style action indicating that Lucid would like to setup a webhook in the third party.

Hierarchy

Constructors

constructor

new DataConnectorManageWebhookAction(context, webhookToken, webhooks)

Parameters
Name Type Description
context DataConnectorActionContext -
webhookToken string Token to be added to the newly created webhook so that when it fires it will have permissions to make changes to Lucid documents.
webhooks Webhook [] A list of existing webhooks so you can be more granular about what you track. You may also find it useful to delete some of the existing webhooks. The response back to Lucid should include all existing webhooks (newly created or any of these that were not deleted).
Overrides

DataConnectorAction.constructor

Properties

context

context: DataConnectorActionContext

Inherited from

DataConnectorAction.context


name

name: string

Inherited from

DataConnectorAction.name


webhookToken

webhookToken: string

Token to be added to the newly created webhook so that when it fires it will have permissions to make changes to Lucid documents.


webhooks

webhooks: Webhook []

A list of existing webhooks so you can be more granular about what you track. You may also find it useful to delete some of the existing webhooks. The response back to Lucid should include all existing webhooks (newly created or any of these that were not deleted).


DataConnectorPatchAction

dataconnector/actions/action.DataConnectorPatchAction

A patch action is a kind of synchronous style action. It occurs when data is changed in the Lucid editor. All the changes are collected in the patches field.

Hierarchy

Constructors

constructor

new DataConnectorPatchAction(context, patches, name?)

Parameters
Name Type Default value Description
context DataConnectorActionContext undefined -
patches Patch [] undefined changes applied by Lucid
name string DataConnectorActionKeys.Patch -
Overrides

DataConnectorAction.constructor

Properties

context

context: DataConnectorActionContext

Inherited from

DataConnectorAction.context


name

name: string

Inherited from

DataConnectorAction.name


patches

patches: Patch []

changes applied by Lucid


DataConnectorRequestError

dataconnector/dataconnector.DataConnectorRequestError

Thrown by any failable http APIs

Hierarchy

  • Error

    DataConnectorRequestError

Constructors

constructor

new DataConnectorRequestError(status, message, response, statusText?)

Parameters
Name Type
status number
message string
response string
statusText? string
Overrides

Error.constructor

Properties

message

message: string

Inherited from

Error.message


name

name: string

Inherited from

Error.name


response

response: string


stack

Optional stack: string

Inherited from

Error.stack


status

status: number


statusText

Optional statusText: string

Methods

toString

toString(): string

Returns

string


DataConnectorResponseError

dataconnector/dataconnector.DataConnectorResponseError

Thrown by any APIs the client didn't recognize when parsing

Hierarchy

  • Error

    DataConnectorResponseError

Constructors

constructor

new DataConnectorResponseError(message, response)

Parameters
Name Type
message string
response string
Overrides

Error.constructor

Properties

message

message: string

Inherited from

Error.message


name

name: string

Inherited from

Error.name


response

response: string


stack

Optional stack: string

Inherited from

Error.stack


DataConnectorRunError

dataconnector/dataconnector.DataConnectorRunError

Throw this from an action request handler to produce a non-200 response code and not have to return the expected result type

Hierarchy

  • Error

    DataConnectorRunError

Constructors

constructor

new DataConnectorRunError(status, body, message?)

Parameters
Name Type
status number
body unknown
message? string
Overrides

Error.constructor

Properties

body

body: unknown


message

message: string

Inherited from

Error.message


name

name: string

Inherited from

Error.name


stack

Optional stack: string

Inherited from

Error.stack


status

status: number

Methods

withMessage

Static withMessage(status, message): DataConnectorRunError

Parameters
Name Type
status number
message string
Returns

DataConnectorRunError


DataConnectorSynchronousAction

dataconnector/actions/action.DataConnectorSynchronousAction

A generic "synchronous" action to be performed by the data connector.

Hierarchy

Constructors

constructor

new DataConnectorSynchronousAction(name, context, data)

Parameters
Name Type
name string
context DataConnectorActionContext
data unknown
Overrides

DataConnectorAction.constructor

Properties

context

context: DataConnectorActionContext

Inherited from

DataConnectorAction.context


data

data: unknown


name

name: string

Inherited from

DataConnectorAction.name


DataError

data/dataerror.DataError

The requested data or formula result couldn't be calculated.

Constructors

constructor

new DataError(error, type)

Parameters
Name Type Description
error string A human-readable description of the reason why the error occurred
type DataErrorType The kind of error that occurred

Properties

error

Readonly error: string


type

Readonly type: DataErrorType


DataItemProxy

data/dataitemproxy.DataItemProxy

One data item in a collection, consisting of key-value pairs

Hierarchy

Constructors

constructor

new DataItemProxy(primaryKey, collection, client)

Parameters
Name Type Description
primaryKey string The current primary key of the data item. This may change if the fields on the data item change, rendering this proxy inoperable.
collection CollectionProxy The collection that contains this data item.
client EditorClient

Properties

collection

Readonly collection: CollectionProxy


fields

Readonly fields: MapProxy <string, SerializedFieldType >

The fields on this data item, organized by their name.


primaryKey

Readonly primaryKey: string

Methods

exists

exists(): boolean

Returns

boolean

True if a data item exists in this collection at this primary key


DataProxy

data/dataproxy.DataProxy

The DataProxy class gives access to the tabular and graph data on the current Lucid document.

Data collections are organized into data sources. One data sources is typically produced for each data import, and may contain multiple collections.

Constructors

constructor

new DataProxy(client)

Parameters
Name Type
client EditorClient

Properties

dataSources

Readonly dataSources: MapProxy <string, DataSourceProxy >

Data sources on the current document, organized by their ID on this document. The ID will remain stable for as long as the data source exists on this document, but will vary from the data source ID on other documents if the same data is imported there.

Methods

addDataSource

addDataSource(name, sourceConfig): DataSourceProxy

Creates a new empty data source, which you can then add collections of data to.

Parameters
Name Type Description
name string Human-readable name of the new data source
sourceConfig Object Any configuration values that might be useful to reference later, such as the upstream origin of this data source
Returns

DataSourceProxy

the newly created data source


DataSourceClient

dataconnector/datasourceclient.DataSourceClient

Authenticated client for DataSource related requests to Lucid.

Hierarchy

Constructors

constructor

new DataSourceClient(urls, updateToken, fetchMethod?)

Parameters
Name Type Default value
urls Object undefined
urls.api string undefined
urls.main string undefined
updateToken string undefined
fetchMethod GlobalFetchType globalFetch

Methods

update

update(request): Promise<void>

Create or update a datasource. If you create a new collection it must be fully specified in terms of schema and and items. If it's just an update then the schema can be omitted (if unchanged) and items that already exist can be partial.

Parameters
Name Type
request DataSourceRequest
Returns

Promise<void>


DataSourceProxy

data/datasourceproxy.DataSourceProxy

A data source represents a set of related data collections on a document. Typically one data source is produced for each data import.

Hierarchy

Constructors

constructor

new DataSourceProxy(id, client)

Parameters
Name Type Description
id string ID of the dataSource on the current document
client EditorClient
Overrides

PropertyStoreProxy.constructor

Properties

client

Protected Readonly client: EditorClient

Inherited from

PropertyStoreProxy.client


collections

Readonly collections: MapProxy <string, CollectionProxy >

The set of data collections in this data source, organized by ID on this document. The IDs will remain stable for as long as the collection exists on this document, but will vary from the collection ID on other documents if the same data is imported there.


id

Readonly id: string

Inherited from

PropertyStoreProxy.id


properties

Readonly properties: WriteableMapProxy <string, JsonSerializable , void, JsonSerializable >

All properties available on this element, organized by name. Not all properties are writeable (e.g. "ClassName" on a block). To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

PropertyStoreProxy.properties

Methods

addCollection

addCollection(name, schema): CollectionProxy

Create a new collection as part of this data source.

Parameters
Name Type
name string
schema SchemaDefinition
Returns

CollectionProxy

The newly created collection


getName

getName(): string

Returns

string

A human-readable name for this data source


getSourceConfig

getSourceConfig(): Object

Returns

Object

The source configuration values set when this data source was created


DocumentElementProxy

document/documentelement/documentelementproxy.DocumentElementProxy

Base class for anything on a Lucid document that has an ID and properties.

Hierarchy

Constructors

constructor

new DocumentElementProxy(id, client)

Parameters
Name Type Description
id string The ID of this document element
client EditorClient
Overrides

PropertyStoreProxy.constructor

Properties

client

Protected Readonly client: EditorClient

Inherited from

PropertyStoreProxy.client


id

Readonly id: string

Inherited from

PropertyStoreProxy.id


properties

Readonly properties: WriteableMapProxy <string, JsonSerializable , void, JsonSerializable >

All properties available on this element, organized by name. Not all properties are writeable (e.g. "ClassName" on a block). To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

PropertyStoreProxy.properties


DocumentProxy

document/documentproxy.DocumentProxy

The currently-open Lucid document

Hierarchy

Constructors

constructor

new DocumentProxy(client)

Parameters
Name Type
client EditorClient
Overrides

ElementProxy.constructor

Properties

allShapeData

Readonly allShapeData: MapProxy <string, SerializedFieldType | DataError >

All shape data accessible on this element, including shape data inherited from the page or a containing group. This collection is read-only.

Inherited from

ElementProxy.allShapeData


cardIntegrationConfigs

Readonly cardIntegrationConfigs: MapProxy <string, CardConfigProxy >


client

Protected Readonly client: EditorClient

Inherited from

ElementProxy.client


id

Readonly id: string

Inherited from

ElementProxy.id


pages

Readonly pages: MapProxy <string, PageProxy >

The set of pages on this document, organized by ID


properties

Readonly properties: WriteableMapProxy <string, JsonSerializable , void, JsonSerializable >

All properties available on this element, organized by name. Not all properties are writeable (e.g. "ClassName" on a block). To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

ElementProxy.properties


referenceKeys

Readonly referenceKeys: MapProxy <string | number, ReferenceKeyProxy >

The set of reference keys, organized by their ID, which can be either a string or number.

For more information, see the Developer Guide.

Inherited from

ElementProxy.referenceKeys


shapeData

Readonly shapeData: ShapeDataProxy

The shape data set directly on this element (not including any shape data inherited from the page or a containing group).

Inherited from

ElementProxy.shapeData

Methods

addPage

addPage(def): PageProxy

Add a new page to the current document

Parameters
Name Type Description
def PageDefinition Definition of the page to add
Returns

PageProxy

The created page


allBlocks

allBlocks(): Generator< BlockProxy , void, unknown>

An iterator over all blocks on all pages of the document

Returns

Generator< BlockProxy , void, unknown>


executeFormula

executeFormula(formula): SerializedFieldType | DataError

Execute a formula in the context of this element

Parameters
Name Type Description
formula string The formula text, e.g. "@a + @b" to add together the shape data values a and b.
Returns

SerializedFieldType | DataError

The result of the formula, or an error.

Inherited from

ElementProxy.executeFormula


exists

exists(): boolean

Returns

boolean

true if this element still exists on the document, or false otherwise

Inherited from

ElementProxy.exists


getTitle

getTitle(): string

Returns

string

The title of this document


hookCreateItems

hookCreateItems(callback): string

Watch for new blocks, lines, or groups added to this document. The callback will be called with new items created by the current user, but will not be called with items created

  • As part of a generated diagram, e.g. org chart
  • By another user on the same document
Parameters
Name Type
callback (items: ItemProxy []) => void
Returns

string

A handle that can be passed to unhookCreateItems


hookDeleteItems

hookDeleteItems(callback): string

Watch for new blocks, lines, or groups deleted from this document. The callback will be called with items deleted by the current user, but will not be called with items deleted

  • As part of a generated diagram, e.g. org chart
  • By another user on the same document
Parameters
Name Type
callback (itemIds: string[]) => void
Returns

string

A handle that can be passed to unhookDeleteItems


removeReferenceKey

removeReferenceKey(key): void

Remove the specified reference key from this element.

Parameters
Name Type
key string | number
Returns

void

Inherited from

ElementProxy.removeReferenceKey


setReferenceKey

setReferenceKey(key, settings): void

Set a reference key on this element, replacing any existing reference at the specified key.

Parameters
Name Type
key string | number
settings ReferenceKeyDefinition
Returns

void

Inherited from

ElementProxy.setReferenceKey


setTitle

setTitle(title): void

Updates the title of this document

Parameters
Name Type Description
title string The new title for this document
Returns

void


unhookCreateItems

unhookCreateItems(handle): void

Parameters
Name Type Description
handle string Return value from hookCreateItems
Returns

void


unhookDeleteItems

unhookDeleteItems(handle): void

Parameters
Name Type Description
handle string Return value from hookDeleteItems
Returns

void


EditorClient

editorclient.EditorClient

Constructors

constructor

new EditorClient()

Methods

actionExists

actionExists(name): boolean

Parameters
Name Type Description
name string name of the action to check
Returns

boolean

true if a callback has been registered for this action; false otherwise


alert

alert(text, title?, buttonText?): AlertResult

Display an alert modal to the user

Parameters
Name Type Description
text string Body text to display in the alert modal
title? string Title of the alert modal; defaults to the extension title specified in manifest.json
buttonText? string Text for the OK button; defaults to "OK" (or a translation)
Returns

AlertResult

a Promise that resolves true if the user clicks OK, false if they otherwise dismiss the modal


asyncOAuthXhr

asyncOAuthXhr(providerName, request): Promise< TextXHRResponse >

Make an asyncronous OAuth network request. The request is enqueued to eventually execute. The request may be attempted multiple times with an overall timeout of 120 seconds.

Parameters
Name Type Description
providerName string Name of the OAuth provider
request OAuthXHRRequest & { responseFormat: "utf8" } Settings for the request
Returns

Promise< TextXHRResponse >

A promise that will either resolve or reject with an XHRResponse. If the HTTP status code is not 2xx, the promise will reject.

asyncOAuthXhr(providerName, request): Promise< BinaryXHRResponse >

Parameters
Name Type
providerName string
request OAuthXHRRequest & { responseFormat: "binary" }
Returns

Promise< BinaryXHRResponse >

asyncOAuthXhr(providerName, request): Promise< XHRResponse >

Parameters
Name Type
providerName string
request OAuthXHRRequest
Returns

Promise< XHRResponse >


awaitDataImport

awaitDataImport(dataConnectorName, syncDataSourceId, syncCollectionId, primaryKeys, timeout?): Promise< CollectionProxy >

Parameters
Name Type Default value
dataConnectorName string undefined
syncDataSourceId undefined | string undefined
syncCollectionId string undefined
primaryKeys string[] undefined
timeout number 30000
Returns

Promise< CollectionProxy >


canEditPackageSettings

canEditPackageSettings(): Promise<boolean>

Returns

Promise<boolean>

True if the current user is allowed to edit package settings on this installation of this extension (if any settings exist), or false otherwise.


confirm

confirm(text, title?, okText?, cancelText?): ConfirmResult

Display a confirm modal to the user

Parameters
Name Type Description
text string Body text to display in the alert modal
title? string Title of the alert modal; defaults to the extension title specified in manifest.json
okText? string Text for the OK button; defaults to "OK" (or a translation)
cancelText? string Text for the Cancel button; defaults to "Cancel" (or a translation)
Returns

ConfirmResult

a Promise that resolves true if the user clicks OK, false if they click Cancel or otherwise dismiss the modal


createUserImage

createUserImage(mediaType, data): Promise<string>

Upload an image and return a URL that can be used for displaying that image on the canvas. Note: the URL is public - anyone with the URL can access the image.

Parameters
Name Type Description
mediaType string The media type, e.g. 'image/png'
data string | Uint8Array The binary image contents, or a base64-encoded string
Returns

Promise<string>

A promise that resolves with the URL of the created image.


deleteAction

deleteAction(name): void

Remove the callback for a given action. If the action is later invoked, nothing will happen.

Parameters
Name Type Description
name string name of the action to unregister
Returns

void


download

download(filename, data, mime, base64): void

Initiate a browser file download of custom content

Parameters
Name Type Description
filename string Filename of the downloaded file
data string The content to put into the file, either in plain text or as base64-encoded binary data
mime string The MIME type to tell the browser it is downloading
base64 boolean If true, base64 decode the data before downloading it
Returns

void


getBlockProxy

getBlockProxy(id): BlockProxy

Create and return a proxy for accessing a block with the given ID. If the block is of a type that has a specific proxy implementation (e.g. an ERD block) then a specialized subclass of BlockProxy may be returned.

Parameters
Name Type Description
id string ID of the block to create a proxy for
Returns

BlockProxy

the given block


getCustomShapeDefinition

getCustomShapeDefinition(library, shape): Promise<undefined | BlockDefinition >

Load the requested shape library's content, and if it was found, return a block definition ready to be created.

Example usage:

const client = new EditorClient(); const viewport = new Viewport(client); const page = viewport.getCurrentPage(); if (page) { const def = await page.getCustomShapeDefinition('libraryName', 'shapeName'); if (def) { //Customize the shape about to be created def.boundingBox.x = 500; def.boundingBox.y = 500; //Create the shape itself const block = page.addBlock(def); //Set any data fields on the shape as needed block.shapeData.set('Value', 50); } }

Parameters
Name Type Description
library string Name of the shape library in this extension to search for
shape string Name of the shape within that library to search for
Returns

Promise<undefined | BlockDefinition >


getElementProxy

getElementProxy(id): ElementProxy

Parameters
Name Type Description
id string ID of the element to create a proxy for
Returns

ElementProxy

the given element


getItemProxy

getItemProxy(id): BlockProxy | LineProxy | GroupProxy

Parameters
Name Type Description
id string ID of the item to create a proxy for
Returns

BlockProxy | LineProxy | GroupProxy

the given item


getLineProxy

getLineProxy(id): LineProxy

Parameters
Name Type Description
id string ID of the line to create a proxy for
Returns

LineProxy

the given line


getPackageSettings

getPackageSettings(): Promise<Map<string, JsonSerializable >>

If the extension package containing this editor extension has configurable settings, fetch the current values of those settings for this installation of this extension.

Only settings that have been set by the installing user will have a value in the map, other settings will be missing.

Returns

Promise<Map<string, JsonSerializable >>

A promise that resolves to a map of setting names to current setting values


getPageProxy

getPageProxy(id): PageProxy

Parameters
Name Type Description
id string ID of the page to create a proxy for
Returns

PageProxy

the given page


getProduct

getProduct(): LucidProduct

Get which Lucid product this editor extension has been loaded in.

Returns

LucidProduct


killExtension

killExtension(): void

Unload this extension immediately, removing any custom menu items etc., until the user refreshes the browser tab.

Returns

void


loadBlockClasses

loadBlockClasses(classNames): Promise<undefined>

Because code for block classes are loaded incrementally, you MUST call loadBlockClasses with the given block class name (and wait for it to resolve) before attempting to create a block. If you don't, an error will be thrown.

Parameters
Name Type Description
classNames string[] the block classes to load
Returns

Promise<undefined>

a promise that resolves when the block classes can be used to create new blocks on the document


oauthXhr

oauthXhr(providerName, request): Promise< TextXHRResponse >

Make an OAuth network request. Make the request immediately and only once with a 10 second timeout.

Parameters
Name Type Description
providerName string Name of the OAuth provider
request OAuthXHRRequest & { responseFormat: "utf8" } Settings for the request
Returns

Promise< TextXHRResponse >

A promise that will either resolve or reject with an XHRResponse. If the HTTP status code is not 2xx, the promise will reject.

oauthXhr(providerName, request): Promise< BinaryXHRResponse >

Parameters
Name Type
providerName string
request OAuthXHRRequest & { responseFormat: "binary" }
Returns

Promise< BinaryXHRResponse >

oauthXhr(providerName, request): Promise< XHRResponse >

Parameters
Name Type
providerName string
request OAuthXHRRequest
Returns

Promise< XHRResponse >


performDataAction

performDataAction(options): Promise< DataActionResponse >

Parameters
Name Type
options DataActionOptions
Returns

Promise< DataActionResponse >


permanentTokenXhr

permanentTokenXhr(providerName, request): Promise< BinaryXHRResponse >

Parameters
Name Type
providerName string
request XHRRequest & { responseFormat: "binary" }
Returns

Promise< BinaryXHRResponse >

permanentTokenXhr(providerName, request): Promise< XHRResponse >

Parameters
Name Type
providerName string
request XHRRequest
Returns

Promise< XHRResponse >


processAndClearBootstrapData

processAndClearBootstrapData(callback, markExtensionAsRequired?): Promise<void>

Parameters
Name Type Description
callback (data: JsonSerializable ) => void | Promise<void> A callback that processes the bootstrap data, if any, stored on the document and associated with this editor extension. If this callback is async (returns a promise), then the bootstrap data is not cleared off of the document until that promise resolves.
markExtensionAsRequired? boolean If bootstrap data is available for this editor extension, this will mark the document as requiring the extension. Once marked, if the extension is not installed the user will be notified about the extension being required on document load. The minimum extension version required by the document is the version provided in the request body when creating the document.
Returns

Promise<void>

a promise that resolves immediately if there is no available bootstrap data, or else after the callback successfully completes. This promise will reject/throw if the callback throws or returns a promise that rejects, or if there is another editor session processing the same bootstrap data at the same time.


prompt

prompt(text, title?): PromptResult

Display a prompt modal to the user

Parameters
Name Type Description
text string Body text to display in the alert modal
title? string Title of the alert modal; defaults to the extension title specified in manifest.json
Returns

PromptResult

a Promise that resolves to a string if a user enters one, or undefined if they cancel


registerAction

registerAction(name, callback): void

Register a named action. These actions can be triggered from custom UI, for example as the action of a custom menu item.

Some actions may return a value that is used by the core application, e.g. a visibleAction for a menu item. However, if you return a Promise from your callback, that value will be discarded and your action will return undefined instead. The ability to provide a callback that returns a Promise is only a convenience so that you can register actions with async callbacks for easy async/await.

Throws an error if the same action name is registered multiple times.

Parameters
Name Type Description
name string name of the action
callback (value: any) => void | JsonSerializable | Promise<any> function to execute when this action is invoked
Returns

void


registerFileUploadAction

registerFileUploadAction(name, callback): void

Register a named action that receives file upload data. These callbacks can be used in Menu.addMenuItem as the file action.

Parameters
Name Type Description
name string The name of the action
callback (files: FileUploadData []) => void Function to execute when this action is invoked
Returns

void


registerUnfurlHandler

registerUnfurlHandler(domain, callbacks): void

Registers a handler for link unfurling.

Parameters
Name Type Description
domain string The domain
callbacks UnfurlCallbacks The callbacks to call when a link matching the domain is pasted.
Returns

void


reloadExtension

reloadExtension(): void

Unload this extension, and then re-execute it.

Returns

void


sendCommand

sendCommand<C>(name, params): CommandArgs [C]["result"]

Execute an API command. This is the low-level API that most of this SDK wraps. It is not expected that you should ever need to use this directly.

Type parameters
Name Type
C extends CommandName
Parameters
Name Type Description
name C name of the API command to execute
params UnionToIntersection< CommandArgs [C]["query"]> data to pass to the API command
Returns

CommandArgs [C]["result"]

the output of the given API command


showPackageSettingsModal

showPackageSettingsModal(): Promise<void>

If the extension package containing this editor extension has configurable settings, show a standard modal allowing the user to view or change those settings.

If the user does not have permission to change settings on this installation of this extension, or if no settings exist, an error is thrown.

Returns

Promise<void>

A promise that resolves when the user closes the settings modal.


triggerAuthFlow

triggerAuthFlow(providerName): TriggerAuthFlowResult

Parameters
Name Type
providerName string
Returns

TriggerAuthFlowResult


xhr

xhr(request): Promise< TextXHRResponse >

Make a network request

Parameters
Name Type Description
request XHRRequest & { responseFormat: "utf8" } Settings for the network request
Returns

Promise< TextXHRResponse >

A promise that will either resolve or reject with an XHRResponse. If the HTTP status code is not 2xx, the promise will reject.

xhr(request): Promise< BinaryXHRResponse >

Parameters
Name Type
request XHRRequest & { responseFormat: "binary" }
Returns

Promise< BinaryXHRResponse >

xhr(request): Promise< XHRResponse >

Parameters
Name Type
request XHRRequest
Returns

Promise< XHRResponse >


ElementProxy

document/elementproxy.ElementProxy

An element is anything on a Lucid document that can have properties and shape data:

Hierarchy

Constructors

constructor

new ElementProxy(id, client)

Parameters
Name Type Description
id string ID of this element
client EditorClient
Overrides

PropertyStoreProxy.constructor

Properties

allShapeData

Readonly allShapeData: MapProxy <string, SerializedFieldType | DataError >

All shape data accessible on this element, including shape data inherited from the page or a containing group. This collection is read-only.


client

Protected Readonly client: EditorClient

Inherited from

PropertyStoreProxy.client


id

Readonly id: string

Inherited from

PropertyStoreProxy.id


properties

Readonly properties: WriteableMapProxy <string, JsonSerializable , void, JsonSerializable >

All properties available on this element, organized by name. Not all properties are writeable (e.g. "ClassName" on a block). To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

PropertyStoreProxy.properties


referenceKeys

Readonly referenceKeys: MapProxy <string | number, ReferenceKeyProxy >

The set of reference keys, organized by their ID, which can be either a string or number.

For more information, see the Developer Guide.


shapeData

Readonly shapeData: ShapeDataProxy

The shape data set directly on this element (not including any shape data inherited from the page or a containing group).

Methods

executeFormula

executeFormula(formula): SerializedFieldType | DataError

Execute a formula in the context of this element

Parameters
Name Type Description
formula string The formula text, e.g. "@a + @b" to add together the shape data values a and b.
Returns

SerializedFieldType | DataError

The result of the formula, or an error.


exists

exists(): boolean

Returns

boolean

true if this element still exists on the document, or false otherwise


removeReferenceKey

removeReferenceKey(key): void

Remove the specified reference key from this element.

Parameters
Name Type
key string | number
Returns

void


setReferenceKey

setReferenceKey(key, settings): void

Set a reference key on this element, replacing any existing reference at the specified key.

Parameters
Name Type
key string | number
settings ReferenceKeyDefinition
Returns

void


ERDBlockProxy

document/blockclasses/erdblockproxy.ERDBlockProxy

A block is a single shape on the document. A BlockProxy provides an interface to read and write the content of an existing block, and is typically accessed through PageProxy.blocks or another similar mechanism.

Hierarchy

Constructors

constructor

new ERDBlockProxy(id, client)

Parameters
Name Type Description
id string ID of this item
client EditorClient
Inherited from

BlockProxy.constructor

Properties

allShapeData

Readonly allShapeData: MapProxy <string, SerializedFieldType | DataError >

All shape data accessible on this element, including shape data inherited from the page or a containing group. This collection is read-only.

Inherited from

BlockProxy.allShapeData


client

Protected Readonly client: EditorClient

Inherited from

BlockProxy.client


id

Readonly id: string

Inherited from

BlockProxy.id


properties

Readonly properties: WriteableMapProxy <string, JsonSerializable , void, JsonSerializable >

All properties available on this element, organized by name. Not all properties are writeable (e.g. "ClassName" on a block). To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

BlockProxy.properties


referenceKeys

Readonly referenceKeys: MapProxy <string | number, ReferenceKeyProxy >

The set of reference keys, organized by their ID, which can be either a string or number.

For more information, see the Developer Guide.

Inherited from

BlockProxy.referenceKeys


shapeData

Readonly shapeData: ShapeDataProxy

The shape data set directly on this element (not including any shape data inherited from the page or a containing group).

Inherited from

BlockProxy.shapeData


textAreas

Readonly textAreas: WriteableMapProxy <string, string, undefined, string>

The plain text in each of the text areas on this item, organized by text area name.

Inherited from

BlockProxy.textAreas


textStyles

Readonly textStyles: WriteableMapProxy <string, TextStyle , Promise<undefined>, Partial< TextStyle >>

The text style in each of the text areas on this item, organized by text area name.

Inherited from

BlockProxy.textStyles


classNameRegex

Static classNameRegex: RegExp

Methods

changeZOrder

changeZOrder(operation): void

Parameters
Name Type Description
operation ZOrderOperation How to adjust the Z order of this item relative to the other items it overlaps on the page
Returns

void

Inherited from

BlockProxy.changeZOrder


delete

delete(): void

Delete this item from the document

Returns

void

Inherited from

BlockProxy.delete


executeFormula

executeFormula(formula): SerializedFieldType | DataError

Execute a formula in the context of this element

Parameters
Name Type Description
formula string The formula text, e.g. "@a + @b" to add together the shape data values a and b.
Returns

SerializedFieldType | DataError

The result of the formula, or an error.

Inherited from

BlockProxy.executeFormula


exists

exists(): boolean

Returns

boolean

true if this element still exists on the document, or false otherwise

Inherited from

BlockProxy.exists


getBoundingBox

getBoundingBox(): Box

Returns

Box

The bounding box of this item relative to its containing page. As pages may change size to fit the content on them, note that these coordinates may be negative or very large.

If this is a rotated block, the bounding box returned here is where the block would be if it were unrotated.

Inherited from

BlockProxy.getBoundingBox


getClassName

getClassName(): string

Returns

string

The class name of this block. This name is not necessarily human-readable, and will remain consistent over time, e.g. "ProcessBlock"..

Inherited from

BlockProxy.getClassName


getConnectedLines

getConnectedLines(): LineProxy []

Returns

LineProxy []

An array of lines that have one or both endpoints connected to this block.

Inherited from

BlockProxy.getConnectedLines


getContainers

getContainers(): BlockProxy []

Returns

BlockProxy []

An array of blocks whose bounding boxes contain this item's upper-left corner

Inherited from

BlockProxy.getContainers


getFieldCount

getFieldCount(): number

Returns

number


getFields

getFields(): ERDFieldProxy []

Returns

ERDFieldProxy []


getLineWidth

getLineWidth(): number

Returns

number

The line width used by most kinds of blocks to render their outline.

Inherited from

BlockProxy.getLineWidth


getLocation

getLocation(): Object

Returns

Object

The x/y location of this item

Name Type
x number
y number
Inherited from

BlockProxy.getLocation


getName

getName(): string

Returns

string


getPage

getPage(): PageProxy

Returns

PageProxy

The page containing this item

Inherited from

BlockProxy.getPage


getRotation

getRotation(): number

Returns

number

The amount this block is rotated around its own center, in radians.

Inherited from

BlockProxy.getRotation


getShadow

getShadow(): undefined | Shadow

Returns

undefined | Shadow

The current drop shadow on this block, or undefined if no shadow is set

Inherited from

BlockProxy.getShadow


getSimpleStaticDataGraphic

getSimpleStaticDataGraphic(): undefined | SimpleStaticDataGraphicSettings

Returns

undefined | SimpleStaticDataGraphicSettings

Settings for the simple static data graphic currently set on this block, or undefined if no simple data graphic is currently set. Note that if a data graphic exists that is not an icon, this will return undefined. This function will not consider data graphics set via conditional formatting rules.

Inherited from

BlockProxy.getSimpleStaticDataGraphic


linkText

linkText(textAreaKey, referenceKey, field): void

Link a text area to a data field, so that editing the text area will also update the associated data, and vice versa.

To use this, first establish a reference key on this block with setReferenceKey.

Parameters
Name Type
textAreaKey string
referenceKey string | number
field string
Returns

void

Inherited from

BlockProxy.linkText


lockAspectRatio

lockAspectRatio(): void

Lock this block's aspect ratio to its current value. This can be reversed with unlockAspectRatio.

Returns

void

Inherited from

BlockProxy.lockAspectRatio


offset

offset(type, offset): void

Offset this item in the given direction by the given amount.

Parameters
Name Type Description
type LinearOffsetType The type of offset to apply to this item
offset Point The amount to offset
Returns

void

Inherited from

BlockProxy.offset


removeReferenceKey

removeReferenceKey(key): void

Remove the specified reference key from this element.

Parameters
Name Type
key string | number
Returns

void

Inherited from

BlockProxy.removeReferenceKey


setBoundingBox

setBoundingBox(bb): void

Attempts to move and resize this item to fit into the given bounding box. If this item (or another item it contains) has size or aspect ratio restrictions, it may not be possible to fit the requested location exactly.

This is done by moving this item to the requested location, then attempting to resize it from the bottom-right corner to the requested size.

Parameters
Name Type Description
bb Box The bounding box to attempt to make this item fill
Returns

void

Inherited from

BlockProxy.setBoundingBox


setDataSyncStateIconPosition

setDataSyncStateIconPosition(position): void

Parameters
Name Type Description
position undefined | BadgeEnumPosition The postion where the data sync state icon should be displayed on the block. If this position is set to undefined then the state icon position will fallback to the default position for the block.
Returns

void

Inherited from

BlockProxy.setDataSyncStateIconPosition


setFillStyle

setFillStyle(fillStyle): void

Set the fill style used (by most kinds of blocks) to fill in their main opaque areas. This can be a string color (e.g. '#ff00ff80') or an image fill.

Parameters
Name Type
fillStyle SimpleFillStyle
Returns

void

Inherited from

BlockProxy.setFillStyle


setLineWidth

setLineWidth(width): void

Parameters
Name Type Description
width number The line width to be used (by most kinds of blocks) to render this block's outline
Returns

void

Inherited from

BlockProxy.setLineWidth


setLocation

setLocation(location): void

Moves this item so that its upper-left corner is positioned at the given location (prior to any rotation)

Parameters
Name Type Description
location Point The target location
Returns

void

Inherited from

BlockProxy.setLocation


setReferenceKey

setReferenceKey(key, settings): void

Set a reference key on this element, replacing any existing reference at the specified key.

Parameters
Name Type
key string | number
settings ReferenceKeyDefinition
Returns

void

Inherited from

BlockProxy.setReferenceKey


setRotation

setRotation(radians): void

Parameters
Name Type Description
radians number Angle the block should be rotated
Returns

void

Inherited from

BlockProxy.setRotation


setShadow

setShadow(shadow): void

Parameters
Name Type Description
shadow undefined | Shadow The drop shadow to set on the block, or undefined to clear the drop shadow
Returns

void

Inherited from

BlockProxy.setShadow


setSimpleStaticDataGraphic

setSimpleStaticDataGraphic(settings): void

Parameters
Name Type Description
settings undefined | SimpleStaticDataGraphicSettings Information about the static data graphic icon to set on this block.
Returns

void

Inherited from

BlockProxy.setSimpleStaticDataGraphic


unlockAspectRatio

unlockAspectRatio(): void

Unlock the aspect ratio of this block, allowing it to be stretched vertically or horizontally independently.

Returns

void

Inherited from

BlockProxy.unlockAspectRatio


ERDFieldProxy

document/blockclasses/erdblockproxy.ERDFieldProxy

Constructors

constructor

new ERDFieldProxy(block, index)

Parameters
Name Type
block ERDBlockProxy
index number

Methods

getKey

getKey(): string | number | boolean | JsonArray | JsonObject

Returns

string | number | boolean | JsonArray | JsonObject


getName

getName(): string

Returns

string


getType

getType(): string | number | boolean | JsonArray | JsonObject

Returns

string | number | boolean | JsonArray | JsonObject


FieldTypeArray<SubTypes>

core/data/fieldtypedefinition/fieldtypearray.FieldTypeArray

Type parameters

Name Type
SubTypes extends FieldTypeArraySubTypes = FieldTypeArraySubTypes

Hierarchy

Constructors

constructor

new FieldTypeArray<SubTypes>(validTypesArray)

Type parameters
Name Type
SubTypes extends FieldTypeArraySubTypes = FieldTypeArraySubTypes
Parameters
Name Type
validTypesArray SubTypes[]
Inherited from

BaseFieldTypeArray.constructor

Properties

validTypesArray

Readonly validTypesArray: SubTypes[]

Inherited from

BaseFieldTypeArray.validTypesArray

Methods

getInnerNonArrayTypes

getInnerNonArrayTypes(): Exclude<SubTypes, BaseFieldTypeArray <SubTypes>>[]

Returns

Exclude<SubTypes, BaseFieldTypeArray <SubTypes>>[]

Inherited from

BaseFieldTypeArray.getInnerNonArrayTypes


getInnerTypes

getInnerTypes(): SubTypes[]

Returns

SubTypes[]

Inherited from

BaseFieldTypeArray.getInnerTypes


serialize

serialize(): SerializedFieldTypeArray

Returns

SerializedFieldTypeArray

Inherited from

BaseFieldTypeArray.serialize


serializeType

Protected serializeType(t): string | SerializedCollectionEnumFieldType | ScalarFieldTypeEnum | SerializedFieldTypeArray

Parameters
Name Type
t FieldTypeArraySubTypes
Returns

string | SerializedCollectionEnumFieldType | ScalarFieldTypeEnum | SerializedFieldTypeArray

Overrides

BaseFieldTypeArray.serializeType


FormattedPrimaryKey<Fields, PrimaryKey>

core/data/fieldspecification.FormattedPrimaryKey

Generates a mapper that, given a primary key definition is able to produce the primary key for that item.

Type parameters

Name Type
Fields extends FieldsStructure
PrimaryKey extends keyof Fields

Constructors

constructor

new FormattedPrimaryKey<Fields, PrimaryKey>(...elements)

Type parameters
Name Type
Fields extends FieldsStructure
PrimaryKey extends string | number | symbol
Parameters
Name Type
...elements PrimaryKey[]

Properties

elements

Readonly elements: PrimaryKey[]

Methods

forItem

forItem(item): string

Generate the serialized form of the item's primary key.

For single value primary keys, the encoded values are just the json representation of the primary key. For example, if the primary key is ['id'] the following table shows encodings:

type value encoded
number 15 new Map([["15", ...], ...])
boolean false new Map([["false", ...], ...])
string "hello" new Map([['"hello"', ...], ...])

Take note of the extra quotes in the string case.

For primary keys with multiple values, first sort the array of primary keys then join the json encoded values from of the keys with commas. For example:

undefined
primary key = ["lastName", "firstName"] sorted key = ["firstName", "lastName"] row = {"lastName": "Smith", "firstName": "John", "age": 42} row key = '"John","Smith"' items = new Map([['"John","Smith"', {"lastName": "Smith", "firstName": "John", "age": 42}]])
Parameters
Name Type
item PartialItemType <Fields, PrimaryKey>
Returns

string


GroupProxy

document/groupproxy.GroupProxy

A group of items on a page.

Hierarchy

Constructors

constructor

new GroupProxy(id, client)

Parameters
Name Type Description
id string ID of this item
client EditorClient
Inherited from

ItemProxy.constructor

Properties

allBlocks

Readonly allBlocks: MapProxy <string, BlockProxy >

The blocks that are contained in this group, including those nested in deeper groups, organized by ID.


allGroups

Readonly allGroups: MapProxy <string, GroupProxy >

The groups that are contained in this group, including those nested in deeper groups, organized by ID.


allLines

Readonly allLines: MapProxy <string, LineProxy >

The lines that are contained in this group, including those nested in deeper groups, organized by ID.


allShapeData

Readonly allShapeData: MapProxy <string, SerializedFieldType | DataError >

All shape data accessible on this element, including shape data inherited from the page or a containing group. This collection is read-only.

Inherited from

ItemProxy.allShapeData


blocks

Readonly blocks: MapProxy <string, BlockProxy >

The blocks that are directly contained in this group, organized by ID.


client

Protected Readonly client: EditorClient

Inherited from

ItemProxy.client


groups

Readonly groups: MapProxy <string, GroupProxy >

The groups that are directly contained in this group, organized by ID.


id

Readonly id: string

Inherited from

ItemProxy.id


lines

Readonly lines: MapProxy <string, LineProxy >

The lines that are directly contained in this group, organized by ID.


properties

Readonly properties: WriteableMapProxy <string, JsonSerializable , void, JsonSerializable >

All properties available on this element, organized by name. Not all properties are writeable (e.g. "ClassName" on a block). To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

ItemProxy.properties


referenceKeys

Readonly referenceKeys: MapProxy <string | number, ReferenceKeyProxy >

The set of reference keys, organized by their ID, which can be either a string or number.

For more information, see the Developer Guide.

Inherited from

ItemProxy.referenceKeys


shapeData

Readonly shapeData: ShapeDataProxy

The shape data set directly on this element (not including any shape data inherited from the page or a containing group).

Inherited from

ItemProxy.shapeData


textAreas

Readonly textAreas: WriteableMapProxy <string, string, undefined, string>

The plain text in each of the text areas on this item, organized by text area name.

Inherited from

ItemProxy.textAreas


textStyles

Readonly textStyles: WriteableMapProxy <string, TextStyle , Promise<undefined>, Partial< TextStyle >>

The text style in each of the text areas on this item, organized by text area name.

Inherited from

ItemProxy.textStyles

Methods

changeZOrder

changeZOrder(operation): void

Parameters
Name Type Description
operation ZOrderOperation How to adjust the Z order of this item relative to the other items it overlaps on the page
Returns

void

Inherited from

ItemProxy.changeZOrder


delete

delete(): void

Delete this item from the document

Returns

void

Inherited from

ItemProxy.delete


executeFormula

executeFormula(formula): SerializedFieldType | DataError

Execute a formula in the context of this element

Parameters
Name Type Description
formula string The formula text, e.g. "@a + @b" to add together the shape data values a and b.
Returns

SerializedFieldType | DataError

The result of the formula, or an error.

Inherited from

ItemProxy.executeFormula


exists

exists(): boolean

Returns

boolean

true if this element still exists on the document, or false otherwise

Inherited from

ItemProxy.exists


getBoundingBox

getBoundingBox(): Box

Returns

Box

The bounding box of this item relative to its containing page. As pages may change size to fit the content on them, note that these coordinates may be negative or very large.

If this is a rotated block, the bounding box returned here is where the block would be if it were unrotated.

Inherited from

ItemProxy.getBoundingBox


getContainers

getContainers(): BlockProxy []

Returns

BlockProxy []

An array of blocks whose bounding boxes contain this item's upper-left corner

Inherited from

ItemProxy.getContainers


getLocation

getLocation(): Object

Returns

Object

The x/y location of this item

Name Type
x number
y number
Inherited from

ItemProxy.getLocation


getPage

getPage(): PageProxy

Returns

PageProxy

The page containing this item

Inherited from

ItemProxy.getPage


offset

offset(type, offset): void

Offset this item in the given direction by the given amount.

Parameters
Name Type Description
type LinearOffsetType The type of offset to apply to this item
offset Point The amount to offset
Returns

void

Inherited from

ItemProxy.offset


removeReferenceKey

removeReferenceKey(key): void

Remove the specified reference key from this element.

Parameters
Name Type
key string | number
Returns

void

Inherited from

ItemProxy.removeReferenceKey


setBoundingBox

setBoundingBox(bb): void

Attempts to move and resize this item to fit into the given bounding box. If this item (or another item it contains) has size or aspect ratio restrictions, it may not be possible to fit the requested location exactly.

This is done by moving this item to the requested location, then attempting to resize it from the bottom-right corner to the requested size.

Parameters
Name Type Description
bb Box The bounding box to attempt to make this item fill
Returns

void

Inherited from

ItemProxy.setBoundingBox


setLocation

setLocation(location): void

Moves this item so that its upper-left corner is positioned at the given location (prior to any rotation)

Parameters
Name Type Description
location Point The target location
Returns

void

Inherited from

ItemProxy.setLocation


setReferenceKey

setReferenceKey(key, settings): void

Set a reference key on this element, replacing any existing reference at the specified key.

Parameters
Name Type
key string | number
settings ReferenceKeyDefinition
Returns

void

Inherited from

ItemProxy.setReferenceKey


HumanReadableError

core/humanreadableerror.HumanReadableError

An error carrying a message that is good to be shown directly in the UI. These can be thrown from extensions and caught in core code.

Hierarchy

  • Error

    HumanReadableError

Constructors

constructor

new HumanReadableError(message?)

Parameters
Name Type
message? string
Inherited from

Error.constructor

Properties

message

message: string

Inherited from

Error.message


name

name: string = 'HumanReadableError'

Overrides

Error.name


stack

Optional stack: string

Inherited from

Error.stack


I18nFormattedNumber

interop.I18nFormattedNumber

Constructors

constructor

new I18nFormattedNumber()


I18nSafeString

interop.I18nSafeString

Constructors

constructor

new I18nSafeString(str)

Parameters
Name Type
str string

Properties

value

value: string


IframeUI

ui/iframeui.IframeUI

Base class for defining and interacting with custom UI elements whose contents are displayed in an iframe.

Hierarchy

Constructors

constructor

new IframeUI(client)

Parameters
Name Type
client EditorClient

Properties

client

Protected Readonly client: EditorClient


framePosition

Protected framePosition: Object

The location of this frame within the top-level browser window. This is always updated immediately before messageFromFrame is called.

Type declaration
Name Type
h number
w number
x number
y number

loaded

Protected loaded: boolean = false

True after the iframe has fired an onload event (not all scripts are necessarily finished executing)


messageActionName

Protected messageActionName: string

Methods

frameClosed

Protected frameClosed(): void

Called when the iframe has been removed from the DOM

Returns

void


frameLoaded

Protected frameLoaded(): void

Called when the iframe has been constructed, its srcdoc set, and the window loaded event has fired

Returns

void


hookMessages

Protected hookMessages(): void

Subclasses must call hookMessages some time before the UI is displayed. A Modal will call this when the open() method is called, where a Panel will need to do this in the constructor to watch for the user opening the panel.

Returns

void


messageFromFrame

Protected messageFromFrame(message): void

Receives messages sent from the iframe via parent.postMessage(, '*')

Parameters
Name Type Description
message any data sent from the iframe
Returns

void


sendMessage

sendMessage(data): void

Send a message to this UI component's iframe via window.postMessage.

Parameters
Name Type Description
data JsonSerializable Data to send to the iframe
Returns

void


unhookMessages

Protected unhookMessages(): void

Subclasses must call unhookMessages to allow them to be garbage collected.

Returns

void


ItemProxy

document/itemproxy.ItemProxy

A block, line, or group on a page of the current document.

Hierarchy

Constructors

constructor

new ItemProxy(id, client)

Parameters
Name Type Description
id string ID of this item
client EditorClient
Overrides

ElementProxy.constructor

Properties

allShapeData

Readonly allShapeData: MapProxy <string, SerializedFieldType | DataError >

All shape data accessible on this element, including shape data inherited from the page or a containing group. This collection is read-only.

Inherited from

ElementProxy.allShapeData


client

Protected Readonly client: EditorClient

Inherited from

ElementProxy.client


id

Readonly id: string

Inherited from

ElementProxy.id


properties

Readonly properties: WriteableMapProxy <string, JsonSerializable , void, JsonSerializable >

All properties available on this element, organized by name. Not all properties are writeable (e.g. "ClassName" on a block). To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

ElementProxy.properties


referenceKeys

Readonly referenceKeys: MapProxy <string | number, ReferenceKeyProxy >

The set of reference keys, organized by their ID, which can be either a string or number.

For more information, see the Developer Guide.

Inherited from

ElementProxy.referenceKeys


shapeData

Readonly shapeData: ShapeDataProxy

The shape data set directly on this element (not including any shape data inherited from the page or a containing group).

Inherited from

ElementProxy.shapeData


textAreas

Readonly textAreas: WriteableMapProxy <string, string, undefined, string>

The plain text in each of the text areas on this item, organized by text area name.


textStyles

Readonly textStyles: WriteableMapProxy <string, TextStyle , Promise<undefined>, Partial< TextStyle >>

The text style in each of the text areas on this item, organized by text area name.

Methods

changeZOrder

changeZOrder(operation): void

Parameters
Name Type Description
operation ZOrderOperation How to adjust the Z order of this item relative to the other items it overlaps on the page
Returns

void


delete

delete(): void

Delete this item from the document

Returns

void


executeFormula

executeFormula(formula): SerializedFieldType | DataError

Execute a formula in the context of this element

Parameters
Name Type Description
formula string The formula text, e.g. "@a + @b" to add together the shape data values a and b.
Returns

SerializedFieldType | DataError

The result of the formula, or an error.

Inherited from

ElementProxy.executeFormula


exists

exists(): boolean

Returns

boolean

true if this element still exists on the document, or false otherwise

Inherited from

ElementProxy.exists


getBoundingBox

getBoundingBox(): Box

Returns

Box

The bounding box of this item relative to its containing page. As pages may change size to fit the content on them, note that these coordinates may be negative or very large.

If this is a rotated block, the bounding box returned here is where the block would be if it were unrotated.


getContainers

getContainers(): BlockProxy []

Returns

BlockProxy []

An array of blocks whose bounding boxes contain this item's upper-left corner


getLocation

getLocation(): Object

Returns

Object

The x/y location of this item

Name Type
x number
y number

getPage

getPage(): PageProxy

Returns

PageProxy

The page containing this item


offset

offset(type, offset): void

Offset this item in the given direction by the given amount.

Parameters
Name Type Description
type LinearOffsetType The type of offset to apply to this item
offset Point The amount to offset
Returns

void


removeReferenceKey

removeReferenceKey(key): void

Remove the specified reference key from this element.

Parameters
Name Type
key string | number
Returns

void

Inherited from

ElementProxy.removeReferenceKey


setBoundingBox

setBoundingBox(bb): void

Attempts to move and resize this item to fit into the given bounding box. If this item (or another item it contains) has size or aspect ratio restrictions, it may not be possible to fit the requested location exactly.

This is done by moving this item to the requested location, then attempting to resize it from the bottom-right corner to the requested size.

Parameters
Name Type Description
bb Box The bounding box to attempt to make this item fill
Returns

void


setLocation

setLocation(location): void

Moves this item so that its upper-left corner is positioned at the given location (prior to any rotation)

Parameters
Name Type Description
location Point The target location
Returns

void


setReferenceKey

setReferenceKey(key, settings): void

Set a reference key on this element, replacing any existing reference at the specified key.

Parameters
Name Type
key string | number
settings ReferenceKeyDefinition
Returns

void

Inherited from

ElementProxy.setReferenceKey


LineProxy

document/lineproxy.LineProxy

A line on the current Lucid document

Hierarchy

Constructors

constructor

new LineProxy(id, client)

Parameters
Name Type Description
id string ID of this item
client EditorClient
Inherited from

ItemProxy.constructor

Properties

allShapeData

Readonly allShapeData: MapProxy <string, SerializedFieldType | DataError >

All shape data accessible on this element, including shape data inherited from the page or a containing group. This collection is read-only.

Inherited from

ItemProxy.allShapeData


client

Protected Readonly client: EditorClient

Inherited from

ItemProxy.client


id

Readonly id: string

Inherited from

ItemProxy.id


properties

Readonly properties: WriteableMapProxy <string, JsonSerializable , void, JsonSerializable >

All properties available on this element, organized by name. Not all properties are writeable (e.g. "ClassName" on a block). To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

ItemProxy.properties


referenceKeys

Readonly referenceKeys: MapProxy <string | number, ReferenceKeyProxy >

The set of reference keys, organized by their ID, which can be either a string or number.

For more information, see the Developer Guide.

Inherited from

ItemProxy.referenceKeys


shapeData

Readonly shapeData: ShapeDataProxy

The shape data set directly on this element (not including any shape data inherited from the page or a containing group).

Inherited from

ItemProxy.shapeData


textAreas

Readonly textAreas: WriteableMapProxy <string, string, undefined, string>

The plain text in each of the text areas on this item, organized by text area name.

Inherited from

ItemProxy.textAreas


textStyles

Readonly textStyles: WriteableMapProxy <string, TextStyle , Promise<undefined>, Partial< TextStyle >>

The text style in each of the text areas on this item, organized by text area name.

Inherited from

ItemProxy.textStyles