Skip to content

BlockSuite API Documentation / @blocksuite/affine-model

@blocksuite/affine-model

Enumerations

ColorScheme

Enumeration Members

Dark

Dark: "dark"

Light

Light: "light"


ConnectorEndpoint

Enumeration Members

Front

Front: "Front"

Rear

Rear: "Rear"


ConnectorLabelOffsetAnchor

Enumeration Members

Bottom

Bottom: "bottom"

Center

Center: "center"

Top

Top: "top"


ConnectorMode

Enumeration Members

Curve

Curve: 2

Orthogonal

Orthogonal: 1

Straight

Straight: 0


FontFamily

Enumeration Members

BebasNeue

BebasNeue: "blocksuite:surface:BebasNeue"

Inter

Inter: "blocksuite:surface:Inter"

Kalam

Kalam: "blocksuite:surface:Kalam"

Lora

Lora: "blocksuite:surface:Lora"

OrelegaOne

OrelegaOne: "blocksuite:surface:OrelegaOne"

Poppins

Poppins: "blocksuite:surface:Poppins"

Satoshi

Satoshi: "blocksuite:surface:Satoshi"


FontStyle

Enumeration Members

Italic

Italic: "italic"

Normal

Normal: "normal"


FontWeight

Enumeration Members

Bold

Bold: "700"

Light

Light: "300"

Medium

Medium: "500"

Regular

Regular: "400"

SemiBold

SemiBold: "600"


LayoutType

Enumeration Members

BALANCE

BALANCE: 2

LEFT

LEFT: 1

RIGHT: 0


LineColor

Use DefaultTheme.StrokeColorShortMap instead.

Deprecated

Enumeration Members

Black

Black: "--affine-palette-line-black"

Blue

Blue: "--affine-palette-line-blue"

Green

Green: "--affine-palette-line-green"

Grey

Grey: "--affine-palette-line-grey"

Magenta

Magenta: "--affine-palette-line-magenta"

Orange

Orange: "--affine-palette-line-orange"

Purple

Purple: "--affine-palette-line-purple"

Red

Red: "--affine-palette-line-red"

Teal

Teal: "--affine-palette-line-teal"

White

White: "--affine-palette-line-white"

Yellow

Yellow: "--affine-palette-line-yellow"


LineWidth

Enumeration Members

Eight

Eight: 8

Four

Four: 4

Six

Six: 6

Ten

Ten: 10

Twelve

Twelve: 12

Two

Two: 2


MindmapStyle

Enumeration Members

FOUR

FOUR: 4

ONE

ONE: 1

THREE

THREE: 3

TWO

TWO: 2


NoteCorners

Enumeration Members

Huge

Huge: 32

Large

Large: 24

Medium

Medium: 16

None

None: 0

Small

Small: 8


NoteDisplayMode

Enumeration Members

DocAndEdgeless

DocAndEdgeless: "both"

DocOnly

DocOnly: "doc"

EdgelessOnly

EdgelessOnly: "edgeless"


NoteShadow

Enumeration Members

Box

Box: "--affine-note-shadow-box"

Film

Film: "--affine-note-shadow-film"

Float

Float: "--affine-note-shadow-float"

None

None: ""

Paper

Paper: "--affine-note-shadow-paper"

Sticker

Sticker: "--affine-note-shadow-sticker"


PointStyle

Enumeration Members

Arrow

Arrow: "Arrow"

Circle

Circle: "Circle"

Diamond

Diamond: "Diamond"

None

None: "None"

Triangle

Triangle: "Triangle"


ShapeStyle

Enumeration Members

General

General: "General"

Scribbled

Scribbled: "Scribbled"


ShapeTextFontSize

Enumeration Members

LARGE

LARGE: 28

MEDIUM

MEDIUM: 20

SMALL

SMALL: 12

XLARGE

XLARGE: 36


ShapeType

Enumeration Members

Diamond

Diamond: "diamond"

Ellipse

Ellipse: "ellipse"

Rect

Rect: "rect"

Triangle

Triangle: "triangle"


StrokeStyle

Enumeration Members

Dash

Dash: "dash"

None

None: "none"

Solid

Solid: "solid"


TextAlign

Enumeration Members

Center

Center: "center"

Left

Left: "left"

Right

Right: "right"


TextResizing

Enumeration Members

AUTO_HEIGHT

AUTO_HEIGHT: 1

AUTO_WIDTH_AND_HEIGHT

AUTO_WIDTH_AND_HEIGHT: 0


TextVerticalAlign

Enumeration Members

Bottom

Bottom: "bottom"

Center

Center: "center"

Top

Top: "top"

Classes

AttachmentBlockModel

The methods that a graphic element should implement. It is already included in the GfxCompatibleInterface interface.

Extends

Implements

Constructors

Properties

Accessors

Methods


AttachmentBlockTransformer

Extends

Constructors

Properties

Methods

fromSnapshot()

fromSnapshot(payload): Promise<SnapshotNode<AttachmentBlockProps>>

Parameters
payload

FromSnapshotPayload

Returns

Promise<SnapshotNode<AttachmentBlockProps>>

Overrides

BaseBlockTransformer.fromSnapshot

toSnapshot()

toSnapshot(snapshot): BlockSnapshotLeaf

Parameters
snapshot

ToSnapshotPayload<AttachmentBlockProps>

Returns

BlockSnapshotLeaf

Overrides

BaseBlockTransformer.toSnapshot


BookmarkBlockModel

The methods that a graphic element should implement. It is already included in the GfxCompatibleInterface interface.

Extends

Implements

Constructors

Properties

Accessors

Methods


BrushElementModel

All the model that can be rendered in graphics mode should implement this interface.

Extends

Constructors

Properties

Accessors

color
commands
Get Signature

get commands(): string

The SVG path commands for the brush.

Returns

string

connectable
Get Signature

get connectable(): boolean

Returns

boolean

Overrides

GfxPrimitiveElementModel.connectable

lineWidth
points
rotate
Overrides

GfxPrimitiveElementModel.rotate

type
Get Signature

get type(): string

Returns

string

Overrides

GfxPrimitiveElementModel.type

xywh
Overrides

GfxPrimitiveElementModel.xywh

Methods

containsBound()

containsBound(bounds): boolean

Parameters
bounds

Bound

Returns

boolean

Overrides

GfxPrimitiveElementModel.containsBound

getLineIntersections()

getLineIntersections(start, end): PointLocation[] | null

Parameters
start

IVec

end

IVec

Returns

PointLocation[] | null

Overrides

GfxPrimitiveElementModel.getLineIntersections

getNearestPoint()

getNearestPoint(point): IVec

Parameters
point

IVec

Returns

IVec

Overrides

GfxPrimitiveElementModel.getNearestPoint

getRelativePointLocation()

getRelativePointLocation(position): PointLocation

Parameters
position

IVec

Returns

PointLocation

Overrides

GfxPrimitiveElementModel.getRelativePointLocation

includesPoint()

includesPoint(px, py, options?): boolean

Parameters
px

number

py

number

options?

PointTestOptions

Returns

boolean

Overrides

GfxPrimitiveElementModel.includesPoint


CalloutBlockModel

Extends

Constructors

Properties

Accessors

Methods


CodeBlockModel

Extends

Constructors

Properties

Accessors

Methods


ConnectorElementModel

All the model that can be rendered in graphics mode should implement this interface.

Extends

Constructors

Properties

forceFullRender

forceFullRender: boolean = true

Connectors should always render, even during zoom.

updatingPath

updatingPath: boolean = false

Accessors

absolutePath
connectable
Get Signature

get connectable(): false

Returns

false

Overrides

GfxPrimitiveElementModel.connectable

connected
Get Signature

get connected(): boolean

Returns

boolean

elementBound
Get Signature

get elementBound(): Bound

The bound of the element after rotation. The bound without rotation should be created by Bound.deserialize(this.xywh).

Returns

Bound

The bound of the element without considering the response extension.

Overrides

GfxPrimitiveElementModel.elementBound

frontEndpointStyle
labelConstraints

Defines the size constraints of the label.

labelDisplay

Control display and hide.

labelEditing

Local control display and hide, mainly used in editing scenarios.

labelOffset

The offset property specifies the label along the connector path.

labelStyle

Defines the style of the label.

labelXYWH

Returns a XYWH array providing information about the size of a label and its position relative to the viewport.

mode
path
rearEndpointStyle
rotate
Overrides

GfxPrimitiveElementModel.rotate

rough
roughness
source
stroke
strokeStyle
strokeWidth
target
text

The content of the label.

type
Get Signature

get type(): string

Returns

string

Overrides

GfxPrimitiveElementModel.type

xywh
Overrides

GfxPrimitiveElementModel.xywh

Methods

containsBound()

containsBound(bounds): boolean

Parameters
bounds

Bound

Returns

boolean

Overrides

GfxPrimitiveElementModel.containsBound

getLineIntersections()

getLineIntersections(start, end): PointLocation[] | null

Parameters
start

IVec

end

IVec

Returns

PointLocation[] | null

Overrides

GfxPrimitiveElementModel.getLineIntersections

getNearestPoint()

getNearestPoint(point): IVec

Calculate the closest point on the curve via a point.

Parameters
point

IVec

Returns

IVec

Overrides

GfxPrimitiveElementModel.getNearestPoint

getOffsetDistanceByPoint()

getOffsetDistanceByPoint(point, bounds?): number

Calculating the computed distance along a path via a point.

The point is relative to the viewport.

Parameters
point

IVec

bounds?

Bound

Returns

number

getPointByOffsetDistance()

getPointByOffsetDistance(offsetDistance, bounds?): IVec

Calculating the computed point along a path via a offset distance.

Returns a point relative to the viewport.

Parameters
offsetDistance

number = 0.5

bounds?

Bound

Returns

IVec

getRelativePointLocation()

getRelativePointLocation(point): PointLocation

Parameters
point

IVec

Returns

PointLocation

Overrides

GfxPrimitiveElementModel.getRelativePointLocation

hasLabel()

hasLabel(): boolean

Returns

boolean

includesPoint()

includesPoint(x, y, options?): boolean

Parameters
x

number

y

number

options?

PointTestOptions

Returns

boolean

Overrides

GfxPrimitiveElementModel.includesPoint

labelIncludesPoint()

labelIncludesPoint(point): boolean

Parameters
point

IVec

Returns

boolean

moveTo()

moveTo(bound): void

Parameters
bound

Bound

Returns

void

resize()

resize(originalPath, matrix): object

Parameters
originalPath

PointLocation[]

matrix

DOMMatrix

Returns

object

source?

optional source: Connection

target?

optional target: Connection

resizePath()

resizePath(originalPath, matrix): PointLocation[]

Parameters
originalPath

PointLocation[]

matrix

DOMMatrix

Returns

PointLocation[]

serialize()

serialize(): SerializedConnectorElement

Returns

SerializedConnectorElement

Overrides

GfxPrimitiveElementModel.serialize

propsToY()

static propsToY(props): ConnectorElementProps

Parameters
props

ConnectorElementProps

Returns

ConnectorElementProps


DatabaseBlockModel

Extends

Constructors

Properties

Accessors

Methods


DividerBlockModel

Extends

Constructors

Properties

Accessors

Methods


EdgelessTextBlockModel

The methods that a graphic element should implement. It is already included in the GfxCompatibleInterface interface.

Extends

Implements

Constructors

Properties

Accessors

color
Get Signature

get color(): string | { normal: string; } | { dark: string; light: string; }

Returns

string | { normal: string; } | { dark: string; light: string; }

Set Signature

set color(color): void

Parameters
color

string | { normal: string; } | { dark: string; light: string; }

Returns

void

Methods


EmbedFigmaModel

The graphic block model that can be rendered in the graphics mode. All the graphic block model should extend this class. You can use GfxCompatibleBlockModel to convert a BlockModel to a subclass that extends it.

Extends

Constructors

Properties

Accessors

Methods


EmbedGithubModel

The graphic block model that can be rendered in the graphics mode. All the graphic block model should extend this class. You can use GfxCompatibleBlockModel to convert a BlockModel to a subclass that extends it.

Extends

Constructors

Properties

Accessors

Methods


EmbedHtmlModel

The graphic block model that can be rendered in the graphics mode. All the graphic block model should extend this class. You can use GfxCompatibleBlockModel to convert a BlockModel to a subclass that extends it.

Extends

Constructors

Properties

Accessors

Methods


EmbedIframeBlockModel

The methods that a graphic element should implement. It is already included in the GfxCompatibleInterface interface.

Extends

Implements

Constructors

Properties

Accessors

Methods


EmbedLinkedDocModel

The graphic block model that can be rendered in the graphics mode. All the graphic block model should extend this class. You can use GfxCompatibleBlockModel to convert a BlockModel to a subclass that extends it.

Extends

Constructors

Properties

Accessors

Methods


EmbedLoomModel

The graphic block model that can be rendered in the graphics mode. All the graphic block model should extend this class. You can use GfxCompatibleBlockModel to convert a BlockModel to a subclass that extends it.

Extends

Constructors

Properties

Accessors

Methods


EmbedSyncedDocModel

The graphic block model that can be rendered in the graphics mode. All the graphic block model should extend this class. You can use GfxCompatibleBlockModel to convert a BlockModel to a subclass that extends it.

Extends

Constructors

Properties

Accessors

isFolded
Get Signature

get isFolded(): boolean

Returns

boolean

Methods


EmbedYoutubeModel

The graphic block model that can be rendered in the graphics mode. All the graphic block model should extend this class. You can use GfxCompatibleBlockModel to convert a BlockModel to a subclass that extends it.

Extends

Constructors

Properties

Accessors

Methods


FrameBlockModel

The methods that a graphic element should implement. It is already included in the GfxCompatibleInterface interface.

Extends

Implements

Constructors

Properties

[gfxGroupCompatibleSymbol]

[gfxGroupCompatibleSymbol]: true

Implementation of

GfxGroupCompatibleInterface.[gfxGroupCompatibleSymbol]

Accessors

childElements
Get Signature

get childElements(): GfxModel[]

All child element models of this container. Note that the childElements may not contains all the children in childIds, because some children may not be loaded.

Returns

GfxModel[]

All child element models of this container. Note that the childElements may not contains all the children in childIds, because some children may not be loaded.

Implementation of

GfxGroupCompatibleInterface.childElements

childIds
Get Signature

get childIds(): string[]

All child ids of this container.

Returns

string[]

All child ids of this container.

Implementation of

GfxGroupCompatibleInterface.childIds

descendantElements
Get Signature

get descendantElements(): GfxModel[]

Returns

GfxModel[]

Implementation of

GfxGroupCompatibleInterface.descendantElements

Methods

addChild()

addChild(element): void

Parameters
element

GfxModel

Returns

void

Implementation of

GfxGroupCompatibleInterface.addChild

addChildren()

addChildren(elements): void

Parameters
elements

GfxModel[]

Returns

void

containsBound()

containsBound(bound): boolean

Parameters
bound

Bound

Returns

boolean

Implementation of

GfxElementGeometry.containsBound

Overrides

GfxBlockElementModel.containsBound

hasChild()

hasChild(element): boolean

Parameters
element

GfxModel

Returns

boolean

Implementation of

GfxGroupCompatibleInterface.hasChild

hasDescendant()

hasDescendant(element): boolean

Parameters
element

GfxModel

Returns

boolean

Implementation of

GfxGroupCompatibleInterface.hasDescendant

includesPoint()

includesPoint(x, y, _): boolean

Parameters
x

number

y

number

_

PointTestOptions

Returns

boolean

Implementation of

GfxElementGeometry.includesPoint

Overrides

GfxBlockElementModel.includesPoint

intersectsBound()

intersectsBound(selectedBound): boolean

Parameters
selectedBound

Bound

Returns

boolean

Implementation of

GfxElementGeometry.intersectsBound

Overrides

GfxBlockElementModel.intersectsBound

removeChild()

removeChild(element): void

Parameters
element

GfxModel

Returns

void

Implementation of

GfxGroupCompatibleInterface.removeChild

removeChildren()

removeChildren(elements): void

Parameters
elements

GfxModel[]

Returns

void


GroupElementModel

GfxGroupCompatibleElement is a model that can contain other models. It just like a group that in common graphic software.

Extends

Constructors

Properties

Accessors

children
Overrides

GfxGroupLikeElementModel.children

rotate
Get Signature

get rotate(): number

Returns

number

Set Signature

set rotate(_): void

Parameters
_

number

Returns

void

Overrides

GfxGroupLikeElementModel.rotate

showTitle
title
type
Get Signature

get type(): string

Returns

string

Overrides

GfxGroupLikeElementModel.type

Methods

addChild()

addChild(element): void

Parameters
element

GfxModel

Returns

void

Overrides

GfxGroupLikeElementModel.addChild

addChildren()

addChildren(elements): void

Parameters
elements

GfxModel[]

Returns

void

containsBound()

containsBound(bound): boolean

Parameters
bound

Bound

Returns

boolean

Overrides

GfxGroupLikeElementModel.containsBound

getLineIntersections()

getLineIntersections(start, end): PointLocation[] | null

Parameters
start

IVec

end

IVec

Returns

PointLocation[] | null

Overrides

GfxGroupLikeElementModel.getLineIntersections

lock()

lock(): void

Returns

void

Overrides

GfxGroupLikeElementModel.lock

removeChild()

removeChild(element): void

Remove the child from the group

Parameters
element

GfxModel

Returns

void

Overrides

GfxGroupLikeElementModel.removeChild

removeChildren()

removeChildren(elements): void

Parameters
elements

GfxModel[]

Returns

void

serialize()

serialize(): SerializedGroupElement

Returns

SerializedGroupElement

Overrides

GfxGroupLikeElementModel.serialize

unlock()

unlock(): void

Returns

void

Overrides

GfxGroupLikeElementModel.unlock

propsToY()

static propsToY(props): GroupElementProps

Parameters
props

Record<string, unknown>

Returns

GroupElementProps


HighlighterElementModel

All the model that can be rendered in graphics mode should implement this interface.

Extends

Constructors

Properties

Accessors

color
commands
Get Signature

get commands(): string

The SVG path commands for the brush.

Returns

string

connectable
Get Signature

get connectable(): boolean

Returns

boolean

Overrides

GfxPrimitiveElementModel.connectable

lineWidth
points
rotate
Overrides

GfxPrimitiveElementModel.rotate

type
Get Signature

get type(): string

Returns

string

Overrides

GfxPrimitiveElementModel.type

xywh
Overrides

GfxPrimitiveElementModel.xywh

Methods

containsBound()

containsBound(bounds): boolean

Parameters
bounds

Bound

Returns

boolean

Overrides

GfxPrimitiveElementModel.containsBound

getLineIntersections()

getLineIntersections(start, end): PointLocation[] | null

Parameters
start

IVec

end

IVec

Returns

PointLocation[] | null

Overrides

GfxPrimitiveElementModel.getLineIntersections

getNearestPoint()

getNearestPoint(point): IVec

Parameters
point

IVec

Returns

IVec

Overrides

GfxPrimitiveElementModel.getNearestPoint

getRelativePointLocation()

getRelativePointLocation(position): PointLocation

Parameters
position

IVec

Returns

PointLocation

Overrides

GfxPrimitiveElementModel.getRelativePointLocation

includesPoint()

includesPoint(px, py, options?): boolean

Parameters
px

number

py

number

options?

PointTestOptions

Returns

boolean

Overrides

GfxPrimitiveElementModel.includesPoint


ImageBlockModel

The methods that a graphic element should implement. It is already included in the GfxCompatibleInterface interface.

Extends

Implements

Constructors

Properties

Accessors

Methods


ImageBlockTransformer

Extends

Constructors

Properties

Methods

fromSnapshot()

fromSnapshot(payload): Promise<SnapshotNode<ImageBlockProps>>

Parameters
payload

FromSnapshotPayload

Returns

Promise<SnapshotNode<ImageBlockProps>>

Overrides

BaseBlockTransformer.fromSnapshot

toSnapshot()

toSnapshot(snapshot): BlockSnapshotLeaf

Parameters
snapshot

ToSnapshotPayload<ImageBlockProps>

Returns

BlockSnapshotLeaf

Overrides

BaseBlockTransformer.toSnapshot


LatexBlockModel

The methods that a graphic element should implement. It is already included in the GfxCompatibleInterface interface.

Extends

Implements

Constructors

Properties

Accessors

Methods


ListBlockModel

Extends

Constructors

Properties

Accessors

Methods


LocalConnectorElementModel

All the model that can be rendered in graphics mode should implement this interface.

Extends

Constructors

Properties

absolutePath

absolutePath: PointLocation[] = []

frontEndpointStyle

frontEndpointStyle: PointStyle

mode

mode: ConnectorMode = ConnectorMode.Orthogonal

rearEndpointStyle

rearEndpointStyle: PointStyle

rough?

optional rough: boolean

roughness

roughness: number = DEFAULT_ROUGHNESS

source

source: Connection

stroke

stroke: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.connectorColor

strokeStyle

strokeStyle: StrokeStyle = StrokeStyle.Solid

strokeWidth

strokeWidth: number = 4

target

target: Connection

updatingPath

updatingPath: boolean = false

Accessors

path
Get Signature

get path(): PointLocation[]

Returns

PointLocation[]

Set Signature

set path(value): void

Parameters
value

PointLocation[]

Returns

void

type
Get Signature

get type(): string

Returns

string

Overrides

GfxLocalElementModel.type

Methods


LocalShapeElementModel

All the model that can be rendered in graphics mode should implement this interface.

Extends

Constructors

Properties

roughness

roughness: number = DEFAULT_ROUGHNESS

textBound

textBound: Bound | null = null

textDisplay

textDisplay: boolean = true

Accessors

color
fillColor
filled
fontFamily
fontSize
fontStyle
fontWeight
padding
radius
shadow
shapeStyle
shapeType
strokeColor
strokeStyle
strokeWidth
text
textAlign
textVerticalAlign
type
Get Signature

get type(): string

Returns

string

Overrides

GfxLocalElementModel.type

Methods


MindmapElementModel

GfxGroupCompatibleElement is a model that can contain other models. It just like a group that in common graphic software.

Extends

Constructors

Properties

connectors

connectors: Map<string, LocalConnectorElementModel>

Accessors

children
Overrides

GfxGroupLikeElementModel.children

layoutType
nodeMap
Get Signature

get nodeMap(): Map<string, MindmapNode>

Returns

Map<string, MindmapNode>

rotate
Get Signature

get rotate(): number

Returns

number

Set Signature

set rotate(_): void

Parameters
_

number

Returns

void

Overrides

GfxGroupLikeElementModel.rotate

style
styleGetter
Get Signature

get styleGetter(): MindmapStyleGetter

Returns

MindmapStyleGetter

tree
Get Signature

get tree(): MindmapRoot

Returns

MindmapRoot

type
Get Signature

get type(): string

Returns

string

Overrides

GfxGroupLikeElementModel.type

Methods

_getXYWH()

protected _getXYWH(): Bound

Returns

Bound

Overrides

GfxGroupLikeElementModel._getXYWH

addChild()

addChild(_element): void

Parameters
_element

GfxModel

Returns

void

Deprecated

you should not call this method directly

Overrides

GfxGroupLikeElementModel.addChild

addNode()

addNode(parent, sibling?, position?, props?): string

Parameters
parent

The parent node id of the new node. If it's null, the node will be the root node

string | MindmapNode | null

sibling?

string | number

position?

"before" | "after"

props?

Record<string, unknown> = {}

Returns

string

buildTree()

buildTree(): void

Returns

void

getChildNodes()

getChildNodes(id, subtree?): MindmapNode[]

Parameters
id

string

subtree?

The subtree of root, this only take effects when the layout type is BALANCED.

"left" | "right"

Returns

MindmapNode[]

getConnectors()

getConnectors(node): object[] | null

Get all the connectors start from the given node

Parameters
node

MindmapNode

Returns

object[] | null

getLayoutDir()

getLayoutDir(node): LayoutType

Parameters
node

string | MindmapNode

Returns

LayoutType

getNode()

getNode(id): MindmapNode | null

Parameters
id

string

Returns

MindmapNode | null

getNodeByPath()

getNodeByPath(path): MindmapNode | null

Parameters
path

number[]

Returns

MindmapNode | null

getParentNode()

getParentNode(id): MindmapNode | null

Parameters
id

string

Returns

MindmapNode | null

getPath()

getPath(element): number[]

Path is an array of indexes that represent the path from the root node to the target node. The first element of the array is always 0, which represents the root node.

Parameters
element

string | MindmapNode

Returns

number[]

Example
ts
const path = mindmap.getPath('nodeId');
// [0, 1, 2]
getSiblingNode()

getSiblingNode(id, direction, subtree?): MindmapNode | null

Parameters
id

string

direction

"prev" | "next"

subtree?

The subtree of which that the sibling node belongs to, this is used when the layout type is BALANCED.

"left" | "right"

Returns

MindmapNode | null

includesPoint()

includesPoint(x, y, options): boolean

Parameters
x

number

y

number

options

PointTestOptions

Returns

boolean

Overrides

GfxGroupLikeElementModel.includesPoint

layout()

layout(_tree, _options): void

Parameters
_tree

MindmapNode | MindmapRoot

_options
applyStyle?

boolean

calculateTreeBound?

boolean

layoutType?

LayoutType

stashed?

boolean

Returns

void

moveTo()

moveTo(targetXYWH): void

Parameters
targetXYWH

`[${number},${number},${number},${number}]` | XYWH

Returns

void

onCreated()

onCreated(): void

Returns

void

Overrides

GfxGroupLikeElementModel.onCreated

removeChild()

removeChild(element): void

Remove the child from the group

Parameters
element

GfxModel

Returns

void

Overrides

GfxGroupLikeElementModel.removeChild

requestBuildTree()

protected requestBuildTree(): void

Returns

void

requestLayout()

requestLayout(): void

Returns

void

serialize()

serialize(): SerializedMindmapElement

Returns

SerializedMindmapElement

Overrides

GfxGroupLikeElementModel.serialize

setLayoutMethod()

setLayoutMethod(layoutMethod): void

Parameters
layoutMethod

(_tree, _options) => void

Returns

void

stashTree()

stashTree(node): () => void | undefined

Stash mind map node and its children's xywh property

Parameters
node

string | MindmapNode

Returns

() => void | undefined

a function that write back the stashed xywh into yjs

toggleCollapse()

toggleCollapse(node, options): void

Parameters
node

MindmapNode

options
layout?

boolean

Returns

void

traverse()

traverse(callback, root, options): void

Parameters
callback

(node, parent) => void

root

MindmapNode = ...

options
stopOnCollapse?

boolean

Returns

void

propsToY()

static propsToY(props): MindmapElementProps

Parameters
props

Record<string, unknown>

Returns

MindmapElementProps


abstract MindmapStyleGetter

Extended by

Constructors

Constructor

new MindmapStyleGetter(): MindmapStyleGetter

Returns

MindmapStyleGetter

Properties

root

abstract readonly root: NodeStyle

Methods

getNodeStyle()

abstract getNodeStyle(node, path): object

Parameters
node

MindmapNode

path

number[]

Returns

object

collapseButton

collapseButton: CollapseButton

connector

connector: ConnectorStyle

expandButton

expandButton: ExpandButton

node

node: NodeStyle


NoteBlockModel

The methods that a graphic element should implement. It is already included in the GfxCompatibleInterface interface.

Extends

Implements

Constructors

Properties

Accessors

Methods

containsBound()

containsBound(bounds): boolean

Parameters
bounds

Bound

Returns

boolean

Implementation of

GfxElementGeometry.containsBound

Overrides

GfxBlockElementModel.containsBound

includesPoint()

includesPoint(x, y): boolean

Parameters
x

number

y

number

Returns

boolean

Implementation of

GfxElementGeometry.includesPoint

Overrides

GfxBlockElementModel.includesPoint

intersectsBound()

intersectsBound(bound): boolean

Parameters
bound

Bound

Returns

boolean

Implementation of

GfxElementGeometry.intersectsBound

Overrides

GfxBlockElementModel.intersectsBound

isEmpty()

isEmpty(): boolean

Returns

boolean

Overrides

GfxCompatible<NoteProps>(BlockModel).isEmpty

isPageBlock()

isPageBlock(): boolean

We define a note block as a page block if it is the first visible note

Returns

boolean


ParagraphBlockModel

Extends

Constructors

Properties

Accessors

Methods

isEmpty()

isEmpty(): boolean

Returns

boolean

Overrides

BlockModel.isEmpty


RootBlockModel

Extends

Constructors

Constructor

new RootBlockModel(): RootBlockModel

Returns

RootBlockModel

Overrides

BlockModel.constructor

Properties

Accessors

Methods

isEmpty()

isEmpty(): boolean

A page is empty if it only contains one empty note and the canvas is empty

Returns

boolean

Overrides

BlockModel.isEmpty


ShapeElementModel

All the model that can be rendered in graphics mode should implement this interface.

Extends

Constructors

Properties

textBound

textBound: IBound | null = null

The bound of the text content.

Accessors

color
fillColor
filled
fontFamily
fontSize
fontStyle
fontWeight
maxWidth
padding
radius
rotate
Overrides

GfxPrimitiveElementModel.rotate

roughness
shadow
shapeStyle
shapeType
strokeColor
strokeStyle
strokeWidth
text
textAlign
textDisplay
textHorizontalAlign
textResizing
textVerticalAlign
type
Get Signature

get type(): string

Returns

string

Overrides

GfxPrimitiveElementModel.type

xywh
Overrides

GfxPrimitiveElementModel.xywh

Methods

containsBound()

containsBound(bounds): boolean

Parameters
bounds

Bound

Returns

boolean

Overrides

GfxPrimitiveElementModel.containsBound

getLineIntersections()

getLineIntersections(start, end): PointLocation[] | null

Parameters
start

IVec

end

IVec

Returns

PointLocation[] | null

Overrides

GfxPrimitiveElementModel.getLineIntersections

getNearestPoint()

getNearestPoint(point): IVec

Parameters
point

IVec

Returns

IVec

Overrides

GfxPrimitiveElementModel.getNearestPoint

getRelativePointLocation()

getRelativePointLocation(point): PointLocation

Parameters
point

IVec

Returns

PointLocation

Overrides

GfxPrimitiveElementModel.getRelativePointLocation

includesPoint()

includesPoint(x, y, options): boolean

Parameters
x

number

y

number

options

PointTestOptions

Returns

boolean

Overrides

GfxPrimitiveElementModel.includesPoint

propsToY()

static propsToY(props): ShapeProps

Parameters
props

ShapeProps

Returns

ShapeProps


StyleFour

Extends

Constructors

Properties

root

readonly root: object

color

color: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.black

fillColor

fillColor: string = 'transparent'

filled

filled: boolean = true

fontFamily

fontFamily: FontFamily = FontFamily.Kalam

fontSize

fontSize: number = 22

fontWeight

fontWeight: FontWeight = FontWeight.Bold

maxWidth

maxWidth: number = MINDMAP_NODE_MAX_WIDTH

padding

padding: [number, number]

radius

radius: number = 0

strokeColor

strokeColor: string = 'transparent'

strokeWidth

strokeWidth: number = 0

textResizing

textResizing: TextResizing = TextResizing.AUTO_WIDTH_AND_HEIGHT

Overrides

MindmapStyleGetter.root

Methods

getNodeStyle()

getNodeStyle(_, path): object

Parameters
_

MindmapNode

path

number[]

Returns

object

collapseButton

collapseButton: object

collapseButton.fillColor

collapseButton.fillColor: string = DefaultTheme.pureWhite

collapseButton.filled

collapseButton.filled: boolean = true

collapseButton.height

collapseButton.height: number = 16

collapseButton.radius

collapseButton.radius: number = 0.5

collapseButton.strokeColor

collapseButton.strokeColor: string | { normal: string; } | { dark: string; light: string; } = stroke

collapseButton.strokeWidth

collapseButton.strokeWidth: number = 3

collapseButton.width

collapseButton.width: number = 16

connector

connector: object

connector.mode

connector.mode: ConnectorMode = ConnectorMode.Curve

connector.stroke

connector.stroke: string | { normal: string; } | { dark: string; light: string; }

connector.strokeStyle

connector.strokeStyle: StrokeStyle = StrokeStyle.Solid

connector.strokeWidth

connector.strokeWidth: number = 3

expandButton

expandButton: object

expandButton.color

expandButton.color: string = DefaultTheme.pureWhite

expandButton.fillColor

expandButton.fillColor: string | { normal: string; } | { dark: string; light: string; } = stroke

expandButton.filled

expandButton.filled: boolean = true

expandButton.fontFamily

expandButton.fontFamily: FontFamily = FontFamily.Inter

expandButton.fontSize

expandButton.fontSize: number = 15

expandButton.fontWeight

expandButton.fontWeight: FontWeight = FontWeight.Bold

expandButton.height

expandButton.height: number = 24

expandButton.padding

expandButton.padding: number[]

expandButton.radius

expandButton.radius: number = 8

expandButton.strokeColor

expandButton.strokeColor: string | { normal: string; } | { dark: string; light: string; } = stroke

expandButton.strokeWidth

expandButton.strokeWidth: number = 0

expandButton.width

expandButton.width: number = 24

node

node: object

node.color

node.color: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.black

node.fillColor

node.fillColor: string = 'transparent'

node.filled

node.filled: boolean = true

node.fontFamily

node.fontFamily: FontFamily = FontFamily.Kalam

node.fontSize

node.fontSize: number = 18

node.fontWeight

node.fontWeight: FontWeight = FontWeight.Bold

node.maxWidth

node.maxWidth: number = MINDMAP_NODE_MAX_WIDTH

node.padding

node.padding: [number, number]

node.radius

node.radius: number = 0

node.strokeColor

node.strokeColor: string = 'transparent'

node.strokeWidth

node.strokeWidth: number = 0

node.textResizing

node.textResizing: TextResizing = TextResizing.AUTO_WIDTH_AND_HEIGHT

Overrides

MindmapStyleGetter.getNodeStyle


StyleOne

Extends

Constructors

Properties

root

readonly root: object

color

color: string = DefaultTheme.pureBlack

fillColor

fillColor: string = DefaultTheme.pureWhite

filled

filled: boolean = true

fontFamily

fontFamily: FontFamily = FontFamily.Poppins

fontSize

fontSize: number = 20

fontWeight

fontWeight: FontWeight = FontWeight.SemiBold

maxWidth

maxWidth: number = MINDMAP_NODE_MAX_WIDTH

padding

padding: [number, number]

radius

radius: number = 8

shadow

shadow: object

shadow.blur

shadow.blur: number = 12

shadow.color

shadow.color: string = 'rgba(0, 0, 0, 0.14)'

shadow.offsetX

shadow.offsetX: number = 0

shadow.offsetY

shadow.offsetY: number = 6

strokeColor

strokeColor: string = '#53b2ef'

strokeWidth

strokeWidth: number = 4

textResizing

textResizing: TextResizing = TextResizing.AUTO_WIDTH_AND_HEIGHT

Overrides

MindmapStyleGetter.root

Methods

getNodeStyle()

getNodeStyle(_, path): object

Parameters
_

MindmapNode

path

number[]

Returns

object

collapseButton

collapseButton: object

collapseButton.fillColor

collapseButton.fillColor: string = DefaultTheme.pureWhite

collapseButton.filled

collapseButton.filled: boolean = true

collapseButton.height

collapseButton.height: number = 16

collapseButton.radius

collapseButton.radius: number = 0.5

collapseButton.strokeColor

collapseButton.strokeColor: string | { normal: string; } | { dark: string; light: string; } = color

collapseButton.strokeWidth

collapseButton.strokeWidth: number = 3

collapseButton.width

collapseButton.width: number = 16

connector

connector: object

connector.mode

connector.mode: ConnectorMode = ConnectorMode.Curve

connector.stroke

connector.stroke: string | { normal: string; } | { dark: string; light: string; } = color

connector.strokeStyle

connector.strokeStyle: StrokeStyle = StrokeStyle.Solid

connector.strokeWidth

connector.strokeWidth: number = 3

expandButton

expandButton: object

expandButton.color

expandButton.color: string = DefaultTheme.pureWhite

expandButton.fillColor

expandButton.fillColor: string | { normal: string; } | { dark: string; light: string; } = color

expandButton.filled

expandButton.filled: boolean = true

expandButton.fontFamily

expandButton.fontFamily: FontFamily = FontFamily.Inter

expandButton.fontSize

expandButton.fontSize: number = 15

expandButton.fontWeight

expandButton.fontWeight: FontWeight = FontWeight.Bold

expandButton.height

expandButton.height: number = 24

expandButton.padding

expandButton.padding: number[]

expandButton.radius

expandButton.radius: number = 8

expandButton.strokeColor

expandButton.strokeColor: string | { normal: string; } | { dark: string; light: string; } = color

expandButton.strokeWidth

expandButton.strokeWidth: number = 0

expandButton.width

expandButton.width: number = 24

node

node: object

node.color

node.color: string = DefaultTheme.pureBlack

node.fillColor

node.fillColor: string = DefaultTheme.pureWhite

node.filled

node.filled: boolean = true

node.fontFamily

node.fontFamily: FontFamily = FontFamily.Poppins

node.fontSize

node.fontSize: number = 16

node.fontWeight

node.fontWeight: FontWeight = FontWeight.Medium

node.maxWidth

node.maxWidth: number = MINDMAP_NODE_MAX_WIDTH

node.padding

node.padding: [number, number]

node.radius

node.radius: number = 8

node.shadow

node.shadow: object

node.shadow.blur

node.shadow.blur: number = 12

node.shadow.color

node.shadow.color: string = 'rgba(0, 0, 0, 0.14)'

node.shadow.offsetX

node.shadow.offsetX: number = 0

node.shadow.offsetY

node.shadow.offsetY: number = 6

node.strokeColor

node.strokeColor: string | { normal: string; } | { dark: string; light: string; } = color

node.strokeWidth

node.strokeWidth: number = 3

node.textResizing

node.textResizing: TextResizing = TextResizing.AUTO_WIDTH_AND_HEIGHT

Overrides

MindmapStyleGetter.getNodeStyle


StyleThree

Extends

Constructors

Properties

root

readonly root: object

color

color: string = DefaultTheme.pureBlack

fillColor

fillColor: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.StrokeColorShortMap.Yellow

filled

filled: boolean = true

fontFamily

fontFamily: FontFamily = FontFamily.Poppins

fontSize

fontSize: number = 16

fontWeight

fontWeight: FontWeight = FontWeight.Medium

maxWidth

maxWidth: number = MINDMAP_NODE_MAX_WIDTH

padding

padding: [number, number]

radius

radius: number = 10

shadow

shadow: object

shadow.blur

shadow.blur: number = 12

shadow.color

shadow.color: string = 'rgba(66, 65, 73, 0.18)'

shadow.offsetX

shadow.offsetX: number = 0

shadow.offsetY

shadow.offsetY: number = 0

strokeColor

strokeColor: string = 'transparent'

strokeWidth

strokeWidth: number = 0

textResizing

textResizing: TextResizing = TextResizing.AUTO_WIDTH_AND_HEIGHT

Overrides

MindmapStyleGetter.root

Methods

getNodeStyle()

getNodeStyle(_, path): object

Parameters
_

MindmapNode

path

number[]

Returns

object

collapseButton

collapseButton: object

collapseButton.fillColor

collapseButton.fillColor: string = DefaultTheme.pureWhite

collapseButton.filled

collapseButton.filled: boolean = true

collapseButton.height

collapseButton.height: number = 16

collapseButton.radius

collapseButton.radius: number = 0.5

collapseButton.strokeColor

collapseButton.strokeColor: string | { normal: string; } | { dark: string; light: string; } = dotColor

collapseButton.strokeWidth

collapseButton.strokeWidth: number = 3

collapseButton.width

collapseButton.width: number = 16

connector

connector: object

connector.mode

connector.mode: ConnectorMode = ConnectorMode.Curve

connector.stroke

connector.stroke: string | { normal: string; } | { dark: string; light: string; } = strokeColor

connector.strokeStyle

connector.strokeStyle: StrokeStyle = StrokeStyle.Solid

connector.strokeWidth

connector.strokeWidth: number = 2

expandButton

expandButton: object

expandButton.color

expandButton.color: string = DefaultTheme.pureWhite

expandButton.fillColor

expandButton.fillColor: string | { normal: string; } | { dark: string; light: string; } = dotColor

expandButton.filled

expandButton.filled: boolean = true

expandButton.fontFamily

expandButton.fontFamily: FontFamily = FontFamily.Inter

expandButton.fontSize

expandButton.fontSize: number = 15

expandButton.fontWeight

expandButton.fontWeight: FontWeight = FontWeight.Bold

expandButton.height

expandButton.height: number = 24

expandButton.padding

expandButton.padding: number[]

expandButton.radius

expandButton.radius: number = 8

expandButton.strokeColor

expandButton.strokeColor: string | { normal: string; } | { dark: string; light: string; } = dotColor

expandButton.strokeWidth

expandButton.strokeWidth: number = 0

expandButton.width

expandButton.width: number = 24

node

node: object

node.color

node.color: string = DefaultTheme.pureBlack

node.fillColor

node.fillColor: string = DefaultTheme.pureWhite

node.filled

node.filled: boolean = true

node.fontFamily

node.fontFamily: FontFamily = FontFamily.Poppins

node.fontSize

node.fontSize: number = 16

node.fontWeight

node.fontWeight: FontWeight = FontWeight.Medium

node.maxWidth

node.maxWidth: number = MINDMAP_NODE_MAX_WIDTH

node.padding

node.padding: [number, number]

node.radius

node.radius: number = 10

node.shadow

node.shadow: object

node.shadow.blur

node.shadow.blur: number = 12

node.shadow.color

node.shadow.color: string = 'rgba(66, 65, 73, 0.18)'

node.shadow.offsetX

node.shadow.offsetX: number = 0

node.shadow.offsetY

node.shadow.offsetY: number = 0

node.strokeColor

node.strokeColor: string | { normal: string; } | { dark: string; light: string; }

node.strokeWidth

node.strokeWidth: number = 2

node.textResizing

node.textResizing: TextResizing = TextResizing.AUTO_WIDTH_AND_HEIGHT

Overrides

MindmapStyleGetter.getNodeStyle


StyleTwo

Extends

Constructors

Properties

root

readonly root: object

color

color: string = DefaultTheme.pureBlack

fillColor

fillColor: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.StrokeColorShortMap.Yellow

filled

filled: boolean = true

fontFamily

fontFamily: FontFamily = FontFamily.Poppins

fontSize

fontSize: number = 18

fontWeight

fontWeight: FontWeight = FontWeight.SemiBold

maxWidth

maxWidth: number = MINDMAP_NODE_MAX_WIDTH

padding

padding: [number, number]

radius

radius: number = 3

shadow

shadow: object

shadow.blur

shadow.blur: number = 0

shadow.color

shadow.color: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.black

shadow.offsetX

shadow.offsetX: number = 3

shadow.offsetY

shadow.offsetY: number = 3

strokeColor

strokeColor: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.black

strokeWidth

strokeWidth: number = 3

textResizing

textResizing: TextResizing = TextResizing.AUTO_WIDTH_AND_HEIGHT

Overrides

MindmapStyleGetter.root

Methods

getNodeStyle()

getNodeStyle(_, path): object

Parameters
_

MindmapNode

path

number[]

Returns

object

collapseButton

collapseButton: object

collapseButton.fillColor

collapseButton.fillColor: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.white

collapseButton.filled

collapseButton.filled: boolean = true

collapseButton.height

collapseButton.height: number = 16

collapseButton.radius

collapseButton.radius: number = 0.5

collapseButton.strokeColor

collapseButton.strokeColor: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.black

collapseButton.strokeWidth

collapseButton.strokeWidth: number = 3

collapseButton.width

collapseButton.width: number = 16

connector

connector: object

connector.mode

connector.mode: ConnectorMode = ConnectorMode.Orthogonal

connector.stroke

connector.stroke: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.black

connector.strokeStyle

connector.strokeStyle: StrokeStyle = StrokeStyle.Solid

connector.strokeWidth

connector.strokeWidth: number = 3

expandButton

expandButton: object

expandButton.color

expandButton.color: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.white

expandButton.fillColor

expandButton.fillColor: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.black

expandButton.filled

expandButton.filled: boolean = true

expandButton.fontFamily

expandButton.fontFamily: FontFamily = FontFamily.Inter

expandButton.fontSize

expandButton.fontSize: number = 15

expandButton.fontWeight

expandButton.fontWeight: FontWeight = FontWeight.Bold

expandButton.height

expandButton.height: number = 24

expandButton.padding

expandButton.padding: number[]

expandButton.radius

expandButton.radius: number = 2

expandButton.strokeColor

expandButton.strokeColor: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.black

expandButton.strokeWidth

expandButton.strokeWidth: number = 0

expandButton.width

expandButton.width: number = 24

node

node: object

node.color

node.color: string = DefaultTheme.pureBlack

node.fillColor

node.fillColor: string | { normal: string; } | { dark: string; light: string; } = color

node.filled

node.filled: boolean = true

node.fontFamily

node.fontFamily: FontFamily = FontFamily.Poppins

node.fontSize

node.fontSize: number = 16

node.fontWeight

node.fontWeight: FontWeight = FontWeight.SemiBold

node.maxWidth

node.maxWidth: number = MINDMAP_NODE_MAX_WIDTH

node.padding

node.padding: [number, number]

node.radius

node.radius: number = 3

node.shadow

node.shadow: object

node.shadow.blur

node.shadow.blur: number = 0

node.shadow.color

node.shadow.color: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.black

node.shadow.offsetX

node.shadow.offsetX: number = 3

node.shadow.offsetY

node.shadow.offsetY: number = 3

node.strokeColor

node.strokeColor: string | { normal: string; } | { dark: string; light: string; } = DefaultTheme.black

node.strokeWidth

node.strokeWidth: number = 3

node.textResizing

node.textResizing: TextResizing = TextResizing.AUTO_WIDTH_AND_HEIGHT

Overrides

MindmapStyleGetter.getNodeStyle


SurfaceRefBlockModel

Extends

Constructors

Properties

Accessors

Methods


TableBlockModel

Extends

Constructors

Properties

Accessors

Methods


TextElementModel

All the model that can be rendered in graphics mode should implement this interface.

Extends

Constructors

Properties

Accessors

color
fontFamily
fontSize
fontStyle
fontWeight
hasMaxWidth
rotate
Overrides

GfxPrimitiveElementModel.rotate

text
textAlign
type
Get Signature

get type(): string

Returns

string

Overrides

GfxPrimitiveElementModel.type

xywh
Overrides

GfxPrimitiveElementModel.xywh

Methods

containsBound()

containsBound(bounds): boolean

Parameters
bounds

Bound

Returns

boolean

Overrides

GfxPrimitiveElementModel.containsBound

getLineIntersections()

getLineIntersections(start, end): PointLocation[] | null

Parameters
start

IVec

end

IVec

Returns

PointLocation[] | null

Overrides

GfxPrimitiveElementModel.getLineIntersections

getNearestPoint()

getNearestPoint(point): IVec

Parameters
point

IVec

Returns

IVec

Overrides

GfxPrimitiveElementModel.getNearestPoint

includesPoint()

includesPoint(x, y): boolean

Parameters
x

number

y

number

Returns

boolean

Overrides

GfxPrimitiveElementModel.includesPoint

propsToY()

static propsToY(props): Record<string, unknown>

Parameters
props

Record<string, unknown>

Returns

Record<string, unknown>

Interfaces

ColumnDataType<Data>

Type Parameters

Data

Data extends Record<string, unknown> = Record<string, unknown>

Properties

data

data: Data

id

id: string

name

name: string

type

type: string


MindMapElement

Properties

children

children: object

affine:surface:ymap

affine:surface:ymap: boolean

json

json: MindMapJson

id

id: string

index

index: string

layoutType

layoutType: number

seed

seed: number

style

style: number

type

type: "mindmap"


MindMapNode

Properties

index

index: string

parent?

optional parent: string


MindMapTreeNode

Properties

children

children: MindMapTreeNode[]

id

id: string

index

index: string


TableBlockProps

Extends

Properties

cells

cells: Record<string, TableCell>

columns

columns: Record<string, TableColumn>

comments?

optional comments: Record<string, boolean>

rows

rows: Record<string, TableRow>

textAlign?

optional textAlign: TextAlign


TableBlockPropsSerialized

Properties

cells

cells: Record<string, TableCellSerialized>

columns

columns: Record<string, TableColumn>

rows

rows: Record<string, TableRow>


TableCellSerialized

Properties

text

text: object

delta

delta: DeltaInsert[]


TableColumn

Properties

backgroundColor?

optional backgroundColor: string

columnId

columnId: string

order

order: string

width?

optional width: number


TableRow

Properties

backgroundColor?

optional backgroundColor: string

order

order: string

rowId

rowId: string

Type Aliases

AliasInfo

AliasInfo = z.infer<typeof AliasInfoSchema>


AttachmentBlockProps

AttachmentBlockProps = object & Omit<GfxCommonBlockProps, "scale"> & BlockMeta

Type Declaration

caption?

optional caption: string

comments?

optional comments: Record<string, boolean>

embed

embed: boolean | BackwardCompatibleUndefined

Whether to show the attachment as an embed view.

footnoteIdentifier

footnoteIdentifier: string | null

name

name: string

size

size: number

sourceId?

optional sourceId: string

style?

optional style: typeof AttachmentBlockStyles[number]

type

type: string

MIME type


BlockMeta

BlockMeta = object

Extended by

Properties

meta:createdAt?

optional meta:createdAt: number

meta:createdBy?

optional meta:createdBy: string

meta:updatedAt?

optional meta:updatedAt: number

meta:updatedBy?

optional meta:updatedBy: string


BookmarkBlockProps

BookmarkBlockProps = object & LinkPreviewData & Omit<GfxCommonBlockProps, "scale"> & BlockMeta

Type Declaration

caption

caption: string | null

comments?

optional comments: Record<string, boolean>

footnoteIdentifier

footnoteIdentifier: string | null

style

style: typeof BookmarkStyles[number]

url

url: string


BrushProps

BrushProps = BaseElementProps & object

Type Declaration

color

color: Color

lineWidth

lineWidth: number

points

points: number[][]

[[x0,y0,pressure0?],[x1,y1,pressure1?]...] pressure is optional and exsits when pressure sensitivity is supported, otherwise not.


BuiltInEmbedModel

BuiltInEmbedModel = EmbedCardModel | EmbedHtmlModel


CalloutProps

CalloutProps = object & BlockMeta

Type Declaration

backgroundColorName?

optional backgroundColorName: string

icon?

optional icon: IconData

text

text: Text


CellDataType<ValueType>

CellDataType<ValueType> = object

Type Parameters

ValueType

ValueType = unknown

Properties

columnId

columnId: ColumnDataType["id"]

value

value: ValueType


CollapseButton

CollapseButton = object

Properties

fillColor

fillColor: Color

filled

filled: boolean

height

height: number

radius

radius: number

strokeColor

strokeColor: Color

strokeWidth

strokeWidth: number

width

width: number


Color

Color = z.infer<typeof ColorSchema>


ColumnUpdater()<T>

ColumnUpdater<T> = (data) => Partial<T>

Type Parameters

T

T extends ColumnDataType = ColumnDataType

Parameters

data

T

Returns

Partial<T>


Connectable

Connectable = Exclude<GfxModel, ConnectorElementModel | BrushElementModel | GroupElementModel>


Connection

Connection = object

Properties

id?

optional id: string

position?

optional position: [number, number]


ConnectorElementProps

ConnectorElementProps = BaseElementProps & object & ConnectorLabelProps

Type Declaration

frontEndpointStyle?

optional frontEndpointStyle: PointStyle

mode

mode: ConnectorMode

rearEndpointStyle?

optional rearEndpointStyle: PointStyle

rough?

optional rough: boolean

roughness?

optional roughness: number

source

source: Connection

stroke

stroke: Color

strokeStyle

strokeStyle: StrokeStyle

strokeWidth

strokeWidth: number

target

target: Connection


ConnectorLabelConstraintsProps

ConnectorLabelConstraintsProps = object

Properties

hasMaxWidth

hasMaxWidth: boolean

maxWidth

maxWidth: number


ConnectorLabelOffsetProps

ConnectorLabelOffsetProps = object

Properties

anchor?

optional anchor: ConnectorLabelOffsetAnchor

distance

distance: number


ConnectorLabelProps

ConnectorLabelProps = object

Properties

labelConstraints?

optional labelConstraints: ConnectorLabelConstraintsProps

labelDisplay?

optional labelDisplay: boolean

labelEditing?

optional labelEditing: boolean

labelOffset?

optional labelOffset: ConnectorLabelOffsetProps

labelStyle?

optional labelStyle: TextStyleProps

labelXYWH?

optional labelXYWH: XYWH

text?

optional text: Y.Text


ConnectorStyle

ConnectorStyle = object

Properties

mode

mode: ConnectorMode

stroke

stroke: Color

strokeStyle

strokeStyle: StrokeStyle

strokeWidth

strokeWidth: number


DatabaseBlockProps

DatabaseBlockProps = object

Properties

cells

cells: SerializedCells

columns

columns: ColumnDataType[]

comments?

optional comments: Record<string, boolean>

title

title: Text

views

views: ViewBasicDataType[]


DocMode

DocMode = "edgeless" | "page"


EmbedBlockModel<Props>

EmbedBlockModel<Props> = BlockModel<EmbedProps<Props>>

Type Parameters

Props

Props = object


EmbedCardModel

EmbedCardModel = InstanceType<ExternalEmbedModel | InternalEmbedModel>


EmbedCardStyle

EmbedCardStyle = "horizontal" | "horizontalThin" | "list" | "vertical" | "cube" | "cubeThick" | "video" | "figma" | "html" | "syncedDoc" | "pdf" | "citation" | "audio"


EmbedFigmaBlockProps

EmbedFigmaBlockProps = object & EmbedFigmaBlockUrlData

Type Declaration

caption

caption: string | null

style

style: typeof EmbedFigmaStyles[number]

url

url: string


EmbedFigmaBlockUrlData

EmbedFigmaBlockUrlData = object

Properties

description

description: string | null

title

title: string | null


EmbedGithubBlockProps

EmbedGithubBlockProps = object & EmbedGithubBlockUrlData

Type Declaration

caption

caption: string | null

githubId

githubId: string

githubType

githubType: "issue" | "pr"

owner

owner: string

repo

repo: string

style

style: typeof EmbedGithubStyles[number]

url

url: string


EmbedGithubBlockUrlData

EmbedGithubBlockUrlData = object

Properties

assignees

assignees: string[] | null

createdAt

createdAt: string | null

description

description: string | null

image

image: string | null

status

status: string | null

statusReason

statusReason: string | null

title

title: string | null


EmbedHtmlBlockProps

EmbedHtmlBlockProps = object

Properties

caption

caption: string | null

design?

optional design: string

html?

optional html: string

style

style: typeof EmbedHtmlStyles[number]


EmbedIframeBlockProps

EmbedIframeBlockProps = object & Omit<GfxCommonBlockProps, "rotate">

Type Declaration

caption

caption: string | null

description

description: string | null

height?

optional height: number

iframeUrl?

optional iframeUrl: string

title

title: string | null

url

url: string

width?

optional width: number


EmbedLinkedDocBlockProps

EmbedLinkedDocBlockProps = object & ReferenceInfo

Type Declaration

caption

caption: string | null

footnoteIdentifier

footnoteIdentifier: string | null

style

style: typeof EmbedLinkedDocStyles[number]


EmbedLoomBlockProps

EmbedLoomBlockProps = object & EmbedLoomBlockUrlData

Type Declaration

caption

caption: string | null

style

style: typeof EmbedLoomStyles[number]

url

url: string


EmbedLoomBlockUrlData

EmbedLoomBlockUrlData = object

Properties

description

description: string | null

image

image: string | null

title

title: string | null

videoId

videoId: string | null


EmbedProps<Props>

EmbedProps<Props> = Props & GfxCompatibleProps & BlockMeta & object

Type Declaration

comments?

optional comments: Record<string, boolean>

Type Parameters

Props

Props = object


EmbedSyncedDocBlockProps

EmbedSyncedDocBlockProps = object & ReferenceInfo & GfxCompatibleProps

Type Declaration

caption?

optional caption: string | null

preFoldHeight?

optional preFoldHeight: number

Record the scaled height of the synced doc block when it is folded, a.k.a the fourth number of the xywh

scale?

optional scale: number

style

style: EmbedCardStyle


EmbedYoutubeBlockProps

EmbedYoutubeBlockProps = object & EmbedYoutubeBlockUrlData

Type Declaration

caption

caption: string | null

style

style: typeof EmbedYoutubeStyles[number]

url

url: string


EmbedYoutubeBlockUrlData

EmbedYoutubeBlockUrlData = object

Properties

creator

creator: string | null

creatorImage

creatorImage: string | null

creatorUrl

creatorUrl: string | null

description

description: string | null

image

image: string | null

title

title: string | null

videoId

videoId: string | null


ExpandButton

ExpandButton = CollapseButton & object

Type Declaration

color

color: Color

fontFamily

fontFamily: FontFamily

fontSize

fontSize: number

fontWeight

fontWeight: FontWeight


ExternalEmbedModel

ExternalEmbedModel = typeof ExternalEmbedModels[number]


FootNote

FootNote = z.infer<typeof FootNoteSchema>


FootNoteReferenceParams

FootNoteReferenceParams = z.infer<typeof FootNoteReferenceParamsSchema>


FootNoteReferenceType

FootNoteReferenceType = "doc" | "attachment" | "url"


FrameBlockProps

FrameBlockProps = object & GfxCompatibleProps

Type Declaration

background

background: Color

childElementIds?

optional childElementIds: Record<string, boolean>

comments?

optional comments: Record<string, boolean>

presentationIndex?

optional presentationIndex: string

title

title: Text


HighlighterProps

HighlighterProps = BaseElementProps & object

Type Declaration

color

color: Color

lineWidth

lineWidth: number

points

points: number[][]

[[x0,y0,pressure0?],[x1,y1,pressure1?]...] pressure is optional and exsits when pressure sensitivity is supported, otherwise not.


ImageBlockProps

ImageBlockProps = object & Omit<GfxCommonBlockProps, "scale"> & BlockMeta

Type Declaration

caption?

optional caption: string

comments?

optional comments: Record<string, boolean>

height?

optional height: number

rotate

rotate: number

size?

optional size: number

sourceId?

optional sourceId: string

textAlign?

optional textAlign: TextAlign

width?

optional width: number


InternalEmbedModel

InternalEmbedModel = typeof InternalEmbedModels[number]


LatexProps

LatexProps = object & GfxCommonBlockProps

Type Declaration

comments?

optional comments: Record<string, boolean>

latex

latex: string


LinkableEmbedModel

LinkableEmbedModel = EmbedCardModel | EmbedIframeBlockModel | BookmarkBlockModel


LinkPreviewData

LinkPreviewData = z.infer<typeof LinkPreviewDataSchema>


ListProps

ListProps = object & BlockMeta

Type Declaration

checked

checked: boolean

collapsed

collapsed: boolean

comments?

optional comments: Record<string, boolean>

order

order: number | null

text

text: Text

textAlign?

optional textAlign: TextAlign

type

type: ListType


ListType

ListType = "bulleted" | "numbered" | "todo" | "toggle"


MindMapJson

MindMapJson = Record<string, MindMapNode>


MindmapNode

MindmapNode = object

Properties

children

children: MindmapNode[]

detail

detail: NodeDetail

element

element: GfxPrimitiveElementModel

id

id: string

overriddenDir?

optional overriddenDir: LayoutType

This property override the preferredDir or default layout direction. It is used during dragging that would temporary change the layout direction

parent

parent: MindmapNode | null

responseArea?

optional responseArea: Bound

This area is used to determine where to place the dragged node.

When dragging another node into this area, it will become a sibling of the this node. But if it is dragged into the small area located right after the this node, it will become a child of the this node.


MindmapRoot

MindmapRoot = MindmapNode & object

Type Declaration

left

left: MindmapNode[]

right

right: MindmapNode[]


NodeDetail

NodeDetail = object

Properties

collapsed?

optional collapsed: boolean

index

index: string

The index of the node, it decides the layout order of the node

parent?

optional parent: string


NodeStyle

NodeStyle = object

Properties

color

color: Color

fillColor

fillColor: Color

filled

filled: boolean

fontFamily

fontFamily: string

fontSize

fontSize: number

fontWeight

fontWeight: FontWeight

maxWidth

maxWidth: false | number

padding

padding: [number, number]

radius

radius: number

shadow?

optional shadow: object

blur

blur: number

color

color: Color

offsetX

offsetX: number

offsetY

offsetY: number

strokeColor

strokeColor: Color

strokeWidth

strokeWidth: number

textResizing

textResizing: TextResizing


NodeType

NodeType = z.infer<typeof nodeSchema>


NoteEdgelessProps

NoteEdgelessProps = object

Properties

collapse?

optional collapse: boolean

collapsedHeight?

optional collapsedHeight: number

scale?

optional scale: number

style

style: object

borderRadius

borderRadius: number

borderSize

borderSize: number

borderStyle

borderStyle: StrokeStyle

shadowType

shadowType: string


NoteProps

NoteProps = object & GfxCompatibleProps

Type Declaration

background

background: Color

comments?

optional comments: Record<string, boolean>

displayMode

displayMode: NoteDisplayMode

edgeless

edgeless: NoteEdgelessProps

hidden

hidden: boolean

Deprecated

use displayMode instead hidden:true -> displayMode:NoteDisplayMode.EdgelessOnly: means the note is visible only in the edgeless mode hidden:false -> displayMode:NoteDisplayMode.DocAndEdgeless: means the note is visible in the doc and edgeless mode


Palette

Palette = z.infer<typeof PaletteSchema>


ParagraphProps

ParagraphProps = object & BlockMeta

Type Declaration

collapsed

collapsed: boolean

comments?

optional comments: Record<string, boolean>

text

text: Text

textAlign?

optional textAlign: TextAlign

type

type: ParagraphType


ParagraphType

ParagraphType = "text" | "quote" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6"


ReferenceInfo

ReferenceInfo = z.infer<typeof ReferenceInfoSchema>


ReferenceParams

ReferenceParams = z.infer<typeof ReferenceParamsSchema>


RootBlockProps

RootBlockProps = object

Properties

title

title: Text


SerializedCells

SerializedCells = Record<string, Record<string, CellDataType>>


SerializedConnection

SerializedConnection = object

Properties

id?

optional id: string

position?

optional position: `[${number},${number}]` | PointLocation


SerializedConnectorElement

SerializedConnectorElement = SerializedElement & object

Type Declaration

source

source: SerializedConnection

target

target: SerializedConnection


SerializedGroupElement

SerializedGroupElement = SerializedElement & object

Type Declaration

children

children: Record<string, boolean>

title

title: string


SerializedMindmapElement

SerializedMindmapElement = SerializedElement & object

Type Declaration

children

children: Record<string, NodeDetail>


ShapeName

ShapeName = ShapeType | "roundedRect"


ShapeProps

ShapeProps = BaseElementProps & object & Partial<TextStyleProps>

Type Declaration

fillColor

fillColor: Color

filled

filled: boolean

maxWidth?

optional maxWidth: false | number

radius

radius: number

roughness?

optional roughness: number

shapeStyle

shapeStyle: ShapeStyle

shapeType

shapeType: ShapeType

strokeColor

strokeColor: Color

strokeStyle

strokeStyle: StrokeStyle

strokeWidth

strokeWidth: number

text?

optional text: Y.Text

textHorizontalAlign?

optional textHorizontalAlign: TextAlign

textResizing?

optional textResizing: TextResizing

textVerticalAlign?

optional textVerticalAlign: TextVerticalAlign


SurfaceElementModelMap

SurfaceElementModelMap = object

Properties

brush

brush: BrushElementModel

connector

connector: ConnectorElementModel

group

group: GroupElementModel

highlighter

highlighter: HighlighterElementModel

mindmap

mindmap: MindmapElementModel

shape

shape: ShapeElementModel

text

text: TextElementModel


SurfaceRefProps

SurfaceRefProps = object

Properties

caption

caption: string

comments?

optional comments: Record<string, boolean>

reference

reference: string

refFlavour

refFlavour: string


SurfaceTextModel

SurfaceTextModel = SurfaceTextModelMap[keyof SurfaceTextModelMap]


SurfaceTextModelMap

SurfaceTextModelMap = object

Properties

connector

connector: ConnectorElementModel

edgeless-text

edgeless-text: EdgelessTextBlockModel

shape

shape: ShapeElementModel

text

text: TextElementModel


TableCell

TableCell = object

Properties

text

text: Text


TextElementProps

TextElementProps = BaseElementProps & object & Omit<TextStyleProps, "fontWeight" | "fontStyle"> & Partial<Pick<TextStyleProps, "fontWeight" | "fontStyle">>

Type Declaration

hasMaxWidth?

optional hasMaxWidth: boolean

text

text: Y.Text


TextStyleProps

TextStyleProps = object

Properties

color

color: Color

fontFamily

fontFamily: FontFamily

fontSize

fontSize: number

fontStyle

fontStyle: FontStyle

fontWeight

fontWeight: FontWeight

textAlign

textAlign: TextAlign


Theme

Theme = z.infer<typeof ThemeSchema>


ViewBasicDataType

ViewBasicDataType = object

Properties

id

id: string

mode

mode: string

name

name: string

Variables

AliasInfoSchema

const AliasInfoSchema: ZodObject<{ description: ZodOptional<ZodString>; title: ZodOptional<ZodString>; }, "strip", ZodTypeAny, { description?: string; title?: string; }, { description?: string; title?: string; }>

Custom title and description information.

Supports the following blocks:

  1. Inline View: AffineReference - title
  2. Card View: EmbedLinkedDocBlock - title & description
  3. Embed View: EmbedSyncedDocBlock - title

AttachmentBlockSchema

const AttachmentBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:attachment"

props

props: PropsGetter<AttachmentBlockProps>

Type Declaration
children

children: string[]

parent

parent: string[]

role

role: "content" = 'content'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => AttachmentBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

AttachmentBlockTransformer

version

version: number


AttachmentBlockSchemaExtension

const AttachmentBlockSchemaExtension: ExtensionType


AttachmentBlockStyles

const AttachmentBlockStyles: ["cubeThick", "horizontalThin", "pdf", "citation"]


BookmarkBlockSchema

const BookmarkBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:bookmark"

props

props: PropsGetter<BookmarkBlockProps>

Type Declaration
parent

parent: string[]

role

role: "content" = 'content'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


BookmarkBlockSchemaExtension

const BookmarkBlockSchemaExtension: ExtensionType


BookmarkStyles

const BookmarkStyles: ["vertical", "horizontal", "list", "cube", "citation"]


BRUSH_LINE_WIDTHS

const BRUSH_LINE_WIDTHS: LineWidth[]


CalloutBlockSchema

const CalloutBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:callout"

props

props: PropsGetter<CalloutProps>

Type Declaration
children

children: string[]

parent

parent: string[]

role

role: "hub" = 'hub'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


CalloutBlockSchemaExtension

const CalloutBlockSchemaExtension: ExtensionType


CodeBlockSchema

const CodeBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:code"

props

props: PropsGetter<CodeBlockProps>

Type Declaration
children

children: never[] = []

parent

parent: string[]

role

role: "content" = 'content'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


CodeBlockSchemaExtension

const CodeBlockSchemaExtension: ExtensionType


ColorSchema

const ColorSchema: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>


CONNECTOR_LABEL_MAX_WIDTH

const CONNECTOR_LABEL_MAX_WIDTH: 280 = 280


DatabaseBlockSchema

const DatabaseBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:database"

props

props: PropsGetter<DatabaseBlockProps>

Type Declaration
children

children: string[]

parent

parent: string[]

role

role: "hub" = 'hub'

version

version: number = 3

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


DatabaseBlockSchemaExtension

const DatabaseBlockSchemaExtension: ExtensionType


DEFAULT_CENTRAL_AREA_RATIO

const DEFAULT_CENTRAL_AREA_RATIO: 0.3 = 0.3


DEFAULT_CONNECTOR_MODE

const DEFAULT_CONNECTOR_MODE: Curve = ConnectorMode.Curve


DEFAULT_FRONT_ENDPOINT_STYLE

const DEFAULT_FRONT_ENDPOINT_STYLE: None = PointStyle.None


DEFAULT_HIGHLIGHTER_LINE_WIDTH

const DEFAULT_HIGHLIGHTER_LINE_WIDTH: 22 = 22


DEFAULT_NOTE_BORDER_SIZE

const DEFAULT_NOTE_BORDER_SIZE: 4 = 4


DEFAULT_NOTE_BORDER_STYLE

const DEFAULT_NOTE_BORDER_STYLE: None = StrokeStyle.None


DEFAULT_NOTE_CORNER

const DEFAULT_NOTE_CORNER: Small = NoteCorners.Small


DEFAULT_NOTE_HEIGHT

const DEFAULT_NOTE_HEIGHT: 92 = NOTE_MIN_HEIGHT


DEFAULT_NOTE_SHADOW

const DEFAULT_NOTE_SHADOW: Box = NoteShadow.Box


DEFAULT_NOTE_WIDTH

const DEFAULT_NOTE_WIDTH: number


DEFAULT_PAGE_BLOCK_HEIGHT

const DEFAULT_PAGE_BLOCK_HEIGHT: 92 = DEFAULT_NOTE_HEIGHT


DEFAULT_PAGE_BLOCK_WIDTH

const DEFAULT_PAGE_BLOCK_WIDTH: 800 = 800


DEFAULT_REAR_ENDPOINT_STYLE

const DEFAULT_REAR_ENDPOINT_STYLE: Arrow = PointStyle.Arrow


DEFAULT_ROUGHNESS

const DEFAULT_ROUGHNESS: 1.4 = 1.4


defaultAttachmentProps

const defaultAttachmentProps: AttachmentBlockProps


defaultEmbedIframeProps

const defaultEmbedIframeProps: EmbedIframeBlockProps


defaultEmbedSyncedDocBlockProps

const defaultEmbedSyncedDocBlockProps: EmbedSyncedDocBlockProps


DefaultTheme

const DefaultTheme: Theme


DividerBlockSchema

const DividerBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:divider"

props

props: PropsGetter<object>

Type Declaration
children

children: never[] = []

role

role: "content" = 'content'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


DividerBlockSchemaExtension

const DividerBlockSchemaExtension: ExtensionType


DocModes

const DocModes: readonly ["edgeless", "page"]


EDGELESS_TEXT_BLOCK_MIN_HEIGHT

const EDGELESS_TEXT_BLOCK_MIN_HEIGHT: 50 = 50


EDGELESS_TEXT_BLOCK_MIN_WIDTH

const EDGELESS_TEXT_BLOCK_MIN_WIDTH: 50 = 50


EdgelessTextBlockSchema

const EdgelessTextBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:edgeless-text"

props

props: PropsGetter<EdgelessTextProps>

Type Declaration
children

children: string[]

parent

parent: string[]

role

role: "hub" = 'hub'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


EdgelessTextBlockSchemaExtension

const EdgelessTextBlockSchemaExtension: ExtensionType


EdgelessTextZodSchema

const EdgelessTextZodSchema: ZodDefault<ZodObject<{ color: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; fontFamily: ZodNativeEnum<typeof FontFamily>; fontStyle: ZodNativeEnum<typeof FontStyle>; fontWeight: ZodNativeEnum<typeof FontWeight>; textAlign: ZodNativeEnum<typeof TextAlign>; }, "strip", ZodTypeAny, { color: string | { normal: string; } | { dark: string; light: string; }; fontFamily: FontFamily; fontStyle: FontStyle; fontWeight: FontWeight; textAlign: TextAlign; }, { color: string | { normal: string; } | { dark: string; light: string; }; fontFamily: FontFamily; fontStyle: FontStyle; fontWeight: FontWeight; textAlign: TextAlign; }>>


EmbedFigmaBlockSchema

const EmbedFigmaBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: `affine:embed-${string}`

props

props: PropsGetter<EmbedProps<EmbedFigmaBlockProps>>

Type Declaration
role

role: "content" = 'content'

version

version: number

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


EmbedFigmaBlockSchemaExtension

const EmbedFigmaBlockSchemaExtension: ExtensionType


EmbedFigmaStyles

const EmbedFigmaStyles: ["figma"]


EmbedGithubBlockSchema

const EmbedGithubBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: `affine:embed-${string}`

props

props: PropsGetter<EmbedProps<EmbedGithubBlockProps>>

Type Declaration
role

role: "content" = 'content'

version

version: number

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


EmbedGithubBlockSchemaExtension

const EmbedGithubBlockSchemaExtension: ExtensionType


EmbedGithubStyles

const EmbedGithubStyles: ["vertical", "horizontal", "list", "cube"]


EmbedHtmlBlockSchema

const EmbedHtmlBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: `affine:embed-${string}`

props

props: PropsGetter<EmbedProps<EmbedHtmlBlockProps>>

Type Declaration
role

role: "content" = 'content'

version

version: number

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


EmbedHtmlBlockSchemaExtension

const EmbedHtmlBlockSchemaExtension: ExtensionType


EmbedHtmlStyles

const EmbedHtmlStyles: ["html"]


EmbedIframeBlockSchema

const EmbedIframeBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:embed-iframe"

props

props: PropsGetter<EmbedIframeBlockProps>

Type Declaration
role

role: "content" = 'content'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


EmbedIframeBlockSchemaExtension

const EmbedIframeBlockSchemaExtension: ExtensionType


EmbedIframeStyles

const EmbedIframeStyles: ["figma"]


EmbedLinkedDocBlockSchema

const EmbedLinkedDocBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: `affine:embed-${string}`

props

props: PropsGetter<EmbedProps<EmbedLinkedDocBlockProps>>

Type Declaration
role

role: "content" = 'content'

version

version: number

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


EmbedLinkedDocBlockSchemaExtension

const EmbedLinkedDocBlockSchemaExtension: ExtensionType


EmbedLinkedDocStyles

const EmbedLinkedDocStyles: ["vertical", "horizontal", "list", "cube", "horizontalThin", "citation"]


EmbedLoomBlockSchema

const EmbedLoomBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: `affine:embed-${string}`

props

props: PropsGetter<EmbedProps<EmbedLoomBlockProps>>

Type Declaration
role

role: "content" = 'content'

version

version: number

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


EmbedLoomBlockSchemaExtension

const EmbedLoomBlockSchemaExtension: ExtensionType


EmbedLoomStyles

const EmbedLoomStyles: ["video"]


EmbedSyncedDocBlockSchema

const EmbedSyncedDocBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: `affine:embed-${string}`

props

props: PropsGetter<EmbedProps<EmbedSyncedDocBlockProps>>

Type Declaration
role

role: "content" = 'content'

version

version: number

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


EmbedSyncedDocBlockSchemaExtension

const EmbedSyncedDocBlockSchemaExtension: ExtensionType


EmbedSyncedDocStyles

const EmbedSyncedDocStyles: ["syncedDoc"]


EmbedYoutubeBlockSchema

const EmbedYoutubeBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: `affine:embed-${string}`

props

props: PropsGetter<EmbedProps<EmbedYoutubeBlockProps>>

Type Declaration
role

role: "content" = 'content'

version

version: number

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


EmbedYoutubeBlockSchemaExtension

const EmbedYoutubeBlockSchemaExtension: ExtensionType


EmbedYoutubeStyles

const EmbedYoutubeStyles: ["video"]


ExternalEmbedModels

const ExternalEmbedModels: readonly [typeof EmbedFigmaModel, typeof EmbedGithubModel, typeof EmbedLoomModel, typeof EmbedYoutubeModel]


FontFamilyList

const FontFamilyList: ([BebasNeue, "BebasNeue" | "Inter" | "Kalam" | "Lora" | "OrelegaOne" | "Poppins" | "Satoshi"] | [Inter, "BebasNeue" | "Inter" | "Kalam" | "Lora" | "OrelegaOne" | "Poppins" | "Satoshi"] | [Kalam, "BebasNeue" | "Inter" | "Kalam" | "Lora" | "OrelegaOne" | "Poppins" | "Satoshi"] | [Lora, "BebasNeue" | "Inter" | "Kalam" | "Lora" | "OrelegaOne" | "Poppins" | "Satoshi"] | [OrelegaOne, "BebasNeue" | "Inter" | "Kalam" | "Lora" | "OrelegaOne" | "Poppins" | "Satoshi"] | [Poppins, "BebasNeue" | "Inter" | "Kalam" | "Lora" | "OrelegaOne" | "Poppins" | "Satoshi"] | [Satoshi, "BebasNeue" | "Inter" | "Kalam" | "Lora" | "OrelegaOne" | "Poppins" | "Satoshi"])[]


FontFamilyMap

const FontFamilyMap: Record<FontFamily, "BebasNeue" | "Inter" | "Kalam" | "Lora" | "OrelegaOne" | "Poppins" | "Satoshi">


FontFamilySchema

const FontFamilySchema: ZodNativeEnum<typeof FontFamily>


FontStyleSchema

const FontStyleSchema: ZodNativeEnum<typeof FontStyle>


FontWeightMap

const FontWeightMap: Record<FontWeight, "Medium" | "Bold" | "Light" | "Regular" | "SemiBold">


FontWeightSchema

const FontWeightSchema: ZodNativeEnum<typeof FontWeight>


FootNoteReferenceParamsSchema

const FootNoteReferenceParamsSchema: ZodObject<{ blobId: ZodOptional<ZodString>; description: ZodOptional<ZodString>; docId: ZodOptional<ZodString>; favicon: ZodOptional<ZodString>; fileName: ZodOptional<ZodString>; fileType: ZodOptional<ZodString>; title: ZodOptional<ZodString>; type: ZodEnum<["doc", "attachment", "url"]>; url: ZodOptional<ZodString>; }, "strip", ZodTypeAny, { blobId?: string; description?: string; docId?: string; favicon?: string; fileName?: string; fileType?: string; title?: string; type: "doc" | "attachment" | "url"; url?: string; }, { blobId?: string; description?: string; docId?: string; favicon?: string; fileName?: string; fileType?: string; title?: string; type: "doc" | "attachment" | "url"; url?: string; }>

FootNoteReferenceParamsSchema is used to define the parameters for a footnote reference. It supports the following types:

  1. docId: string - the id of the doc
  2. blobId: string - the id of the attachment
  3. url: string - the url of the reference
  4. fileName: string - the name of the attachment
  5. fileType: string - the type of the attachment
  6. favicon: string - the favicon of the url reference
  7. title: string - the title of the url reference
  8. description: string - the description of the url reference

FootNoteReferenceTypes

const FootNoteReferenceTypes: readonly ["doc", "attachment", "url"]


FootNoteSchema

const FootNoteSchema: ZodObject<{ label: ZodString; reference: ZodObject<{ blobId: ZodOptional<ZodString>; description: ZodOptional<ZodString>; docId: ZodOptional<ZodString>; favicon: ZodOptional<ZodString>; fileName: ZodOptional<ZodString>; fileType: ZodOptional<ZodString>; title: ZodOptional<ZodString>; type: ZodEnum<["doc", "attachment", "url"]>; url: ZodOptional<ZodString>; }, "strip", ZodTypeAny, { blobId?: string; description?: string; docId?: string; favicon?: string; fileName?: string; fileType?: string; title?: string; type: "doc" | "attachment" | "url"; url?: string; }, { blobId?: string; description?: string; docId?: string; favicon?: string; fileName?: string; fileType?: string; title?: string; type: "doc" | "attachment" | "url"; url?: string; }>; }, "strip", ZodTypeAny, { label: string; reference: { blobId?: string; description?: string; docId?: string; favicon?: string; fileName?: string; fileType?: string; title?: string; type: "doc" | "attachment" | "url"; url?: string; }; }, { label: string; reference: { blobId?: string; description?: string; docId?: string; favicon?: string; fileName?: string; fileType?: string; title?: string; type: "doc" | "attachment" | "url"; url?: string; }; }>


FrameBlockSchema

const FrameBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:frame"

props

props: PropsGetter<FrameBlockProps>

Type Declaration
children

children: never[] = []

parent

parent: string[]

role

role: "content" = 'content'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


FrameBlockSchemaExtension

const FrameBlockSchemaExtension: ExtensionType


FrameZodSchema

const FrameZodSchema: ZodDefault<ZodObject<{ background: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; }, "strip", ZodTypeAny, { background: string | { normal: string; } | { dark: string; light: string; }; }, { background: string | { normal: string; } | { dark: string; light: string; }; }>>


HIGHLIGHTER_LINE_WIDTHS

const HIGHLIGHTER_LINE_WIDTHS: number[]


ImageBlockSchema

const ImageBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:image"

props

props: PropsGetter<ImageBlockProps>

Type Declaration
role

role: "content" = 'content'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => ImageBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

ImageBlockTransformer

version

version: number


ImageBlockSchemaExtension

const ImageBlockSchemaExtension: ExtensionType


InternalEmbedModels

const InternalEmbedModels: readonly [typeof EmbedLinkedDocModel, typeof EmbedSyncedDocModel]


LatexBlockSchema

const LatexBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:latex"

props

props: PropsGetter<LatexProps>

Type Declaration
parent

parent: string[]

role

role: "content" = 'content'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


LatexBlockSchemaExtension

const LatexBlockSchemaExtension: ExtensionType


LINE_COLORS

const LINE_COLORS: readonly [Yellow, Orange, Red, Magenta, Purple, Blue, Teal, Green, Black, Grey, White]

Use DefaultTheme.StrokeColorShortPalettes instead.

Deprecated


LineColorMap

const LineColorMap: Record<LineColor, "Black" | "Blue" | "Green" | "Grey" | "Magenta" | "Orange" | "Purple" | "Red" | "Teal" | "White" | "Yellow">


LineColorsSchema

const LineColorsSchema: ZodNativeEnum<typeof LineColor>


LinkPreviewDataSchema

const LinkPreviewDataSchema: ZodObject<{ description: ZodNullable<ZodString>; icon: ZodNullable<ZodString>; image: ZodNullable<ZodString>; title: ZodNullable<ZodString>; }, "strip", ZodTypeAny, { description: string | null; icon: string | null; image: string | null; title: string | null; }, { description: string | null; icon: string | null; image: string | null; title: string | null; }>


ListBlockSchema

const ListBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:list"

props

props: PropsGetter<ListProps>

Type Declaration
parent

parent: string[]

role

role: "content" = 'content'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


ListBlockSchemaExtension

const ListBlockSchemaExtension: ExtensionType


MAX_IMAGE_WIDTH

const MAX_IMAGE_WIDTH: 460 = 460


MINDMAP_NODE_MAX_WIDTH

const MINDMAP_NODE_MAX_WIDTH: 512 = 512


mindmapStyleGetters

const mindmapStyleGetters: Record<MindmapStyle, MindmapStyleGetter>


NOTE_CORNERS

const NOTE_CORNERS: readonly [None, Small, Medium, Large, Huge]


NOTE_MIN_HEIGHT

const NOTE_MIN_HEIGHT: 92 = 92


NOTE_MIN_WIDTH

const NOTE_MIN_WIDTH: number


NOTE_SHADOWS

const NOTE_SHADOWS: readonly [None, Box, Sticker, Paper, Float, Film]


NoteBlockSchema

const NoteBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:note"

props

props: PropsGetter<NoteProps>

Type Declaration
children

children: string[]

parent

parent: string[]

role

role: "hub" = 'hub'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


NoteBlockSchemaExtension

const NoteBlockSchemaExtension: ExtensionType


NoteCornersMap

const NoteCornersMap: Record<NoteCorners, "None" | "Huge" | "Large" | "Medium" | "Small">


NoteCornersSchema

const NoteCornersSchema: ZodNativeEnum<typeof NoteCorners>


NoteDisplayModeSchema

const NoteDisplayModeSchema: ZodNativeEnum<typeof NoteDisplayMode>


NoteShadowMap

const NoteShadowMap: Record<NoteShadow, "None" | "Box" | "Film" | "Float" | "Paper" | "Sticker">


NoteShadowsSchema

const NoteShadowsSchema: ZodNativeEnum<typeof NoteShadow>


NoteZodSchema

const NoteZodSchema: ZodDefault<ZodObject<{ background: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; displayMode: ZodNativeEnum<typeof NoteDisplayMode>; edgeless: ZodObject<{ style: ZodObject<{ borderRadius: ZodNumber; borderSize: ZodNumber; borderStyle: ZodNativeEnum<typeof StrokeStyle>; shadowType: ZodNativeEnum<typeof NoteShadow>; }, "strip", ZodTypeAny, { borderRadius: number; borderSize: number; borderStyle: StrokeStyle; shadowType: NoteShadow; }, { borderRadius: number; borderSize: number; borderStyle: StrokeStyle; shadowType: NoteShadow; }>; }, "strip", ZodTypeAny, { style: { borderRadius: number; borderSize: number; borderStyle: StrokeStyle; shadowType: NoteShadow; }; }, { style: { borderRadius: number; borderSize: number; borderStyle: StrokeStyle; shadowType: NoteShadow; }; }>; }, "strip", ZodTypeAny, { background: string | { normal: string; } | { dark: string; light: string; }; displayMode: NoteDisplayMode; edgeless: { style: { borderRadius: number; borderSize: number; borderStyle: StrokeStyle; shadowType: NoteShadow; }; }; }, { background: string | { normal: string; } | { dark: string; light: string; }; displayMode: NoteDisplayMode; edgeless: { style: { borderRadius: number; borderSize: number; borderStyle: StrokeStyle; shadowType: NoteShadow; }; }; }>>


PaletteSchema

const PaletteSchema: ZodObject<{ key: ZodString; value: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; }, "strip", ZodTypeAny, { key: string; value: string | { normal: string; } | { dark: string; light: string; }; }, { key: string; value: string | { normal: string; } | { dark: string; light: string; }; }>


ParagraphBlockSchema

const ParagraphBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:paragraph"

props

props: PropsGetter<ParagraphProps>

Type Declaration
parent

parent: string[]

role

role: "content" = 'content'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


ParagraphBlockSchemaExtension

const ParagraphBlockSchemaExtension: ExtensionType


PointStyleMap

const PointStyleMap: Record<PointStyle, "Arrow" | "Circle" | "Diamond" | "None" | "Triangle">


ReferenceInfoSchema

const ReferenceInfoSchema: ZodObject<object & object, "strip", ZodTypeAny, { description?: string; pageId: string; params?: { blockIds?: string[]; commentId?: string; databaseId?: string; databaseRowId?: string; elementIds?: string[]; mode?: "edgeless" | "page"; xywh?: `[${number},${number},${number},${number}]`; }; title?: string; }, { description?: string; pageId: string; params?: { blockIds?: string[]; commentId?: string; databaseId?: string; databaseRowId?: string; elementIds?: string[]; mode?: "edgeless" | "page"; xywh?: `[${number},${number},${number},${number}]`; }; title?: string; }>


ReferenceParamsSchema

const ReferenceParamsSchema: ZodObject<{ blockIds: ZodOptional<ZodArray<ZodString, "many">>; commentId: ZodOptional<ZodOptional<ZodString>>; databaseId: ZodOptional<ZodOptional<ZodString>>; databaseRowId: ZodOptional<ZodOptional<ZodString>>; elementIds: ZodOptional<ZodArray<ZodString, "many">>; mode: ZodOptional<ZodEnum<["edgeless", "page"]>>; xywh: ZodOptional<ZodOptional<ZodType<`[${number},${number},${number},${number}]`, ZodTypeDef, `[${number},${number},${number},${number}]`>>>; }, "strip", ZodTypeAny, { blockIds?: string[]; commentId?: string; databaseId?: string; databaseRowId?: string; elementIds?: string[]; mode?: "edgeless" | "page"; xywh?: `[${number},${number},${number},${number}]`; }, { blockIds?: string[]; commentId?: string; databaseId?: string; databaseRowId?: string; elementIds?: string[]; mode?: "edgeless" | "page"; xywh?: `[${number},${number},${number},${number}]`; }>


RootBlockSchema

const RootBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:page"

props

props: PropsGetter<RootBlockProps>

Type Declaration
role

role: "root" = 'root'

version

version: number = 2

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


RootBlockSchemaExtension

const RootBlockSchemaExtension: ExtensionType


SerializedXYWHSchema

const SerializedXYWHSchema: ZodType<`[${number},${number},${number},${number}]`, ZodTypeDef, `[${number},${number},${number},${number}]`>


SHAPE_TEXT_PADDING

const SHAPE_TEXT_PADDING: 20 = 20


SHAPE_TEXT_VERTICAL_PADDING

const SHAPE_TEXT_VERTICAL_PADDING: 10 = 10


shapeMethods

const shapeMethods: Record<ShapeType, typeof rect>


StrokeStyleMap

const StrokeStyleMap: Record<StrokeStyle, "None" | "Dash" | "Solid">


StrokeStyleSchema

const StrokeStyleSchema: ZodNativeEnum<typeof StrokeStyle>


styleFour

const styleFour: StyleFour


styleOne

const styleOne: StyleOne


styleThree

const styleThree: StyleThree


styleTwo

const styleTwo: StyleTwo


SurfaceRefBlockSchema

const SurfaceRefBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:surface-ref"

props

props: PropsGetter<SurfaceRefProps>

Type Declaration
parent

parent: string[]

role

role: "content" = 'content'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


SurfaceRefBlockSchemaExtension

const SurfaceRefBlockSchemaExtension: ExtensionType


SYNCED_DEFAULT_MAX_HEIGHT

const SYNCED_DEFAULT_MAX_HEIGHT: 800 = 800


SYNCED_DEFAULT_WIDTH

const SYNCED_DEFAULT_WIDTH: 800 = 800


SYNCED_MIN_HEIGHT

const SYNCED_MIN_HEIGHT: 48 = 48


SYNCED_MIN_WIDTH

const SYNCED_MIN_WIDTH: 370 = 370


TableBlockSchema

const TableBlockSchema: object

Type Declaration

model

model: object & object

Type Declaration
flavour

flavour: "affine:table"

props

props: PropsGetter<TableBlockProps>

Type Declaration
children

children: never[] = []

isFlatData

isFlatData: true = true

parent

parent: string[]

role

role: "content" = 'content'

version

version: number = 1

transformer()?

optional transformer: (transformerConfig) => BaseBlockTransformer

Parameters
transformerConfig

Map<string, unknown>

Returns

BaseBlockTransformer

version

version: number


TableBlockSchemaExtension

const TableBlockSchemaExtension: ExtensionType


TableModelFlavour

const TableModelFlavour: "affine:table" = 'affine:table'


TextAlignMap

const TextAlignMap: Record<TextAlign, "Center" | "Left" | "Right">


TextAlignSchema

const TextAlignSchema: ZodNativeEnum<typeof TextAlign>


Themes

const Themes: Record<string, Theme>


ThemeSchema

const ThemeSchema: ZodObject<{ black: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; connectorColor: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; FillColorShortMap: ZodRecord<ZodString, ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>>; FillColorShortPalettes: ZodArray<ZodObject<{ key: ZodString; value: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; }, "strip", ZodTypeAny, { key: string; value: string | { normal: string; } | { dark: string; light: string; }; }, { key: string; value: string | { normal: string; } | { dark: string; light: string; }; }>, "many">; hightlighterColor: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; noteBackgrounColor: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; NoteBackgroundColorMap: ZodRecord<ZodString, ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>>; NoteBackgroundColorPalettes: ZodArray<ZodObject<{ key: ZodString; value: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; }, "strip", ZodTypeAny, { key: string; value: string | { normal: string; } | { dark: string; light: string; }; }, { key: string; value: string | { normal: string; } | { dark: string; light: string; }; }>, "many">; Palettes: ZodArray<ZodObject<{ key: ZodString; value: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; }, "strip", ZodTypeAny, { key: string; value: string | { normal: string; } | { dark: string; light: string; }; }, { key: string; value: string | { normal: string; } | { dark: string; light: string; }; }>, "many">; pureBlack: ZodString; pureWhite: ZodString; shapeFillColor: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; shapeStrokeColor: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; shapeTextColor: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; ShapeTextColorPalettes: ZodArray<ZodObject<{ key: ZodString; value: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; }, "strip", ZodTypeAny, { key: string; value: string | { normal: string; } | { dark: string; light: string; }; }, { key: string; value: string | { normal: string; } | { dark: string; light: string; }; }>, "many">; ShapeTextColorShortMap: ZodRecord<ZodString, ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>>; ShapeTextColorShortPalettes: ZodArray<ZodObject<{ key: ZodString; value: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; }, "strip", ZodTypeAny, { key: string; value: string | { normal: string; } | { dark: string; light: string; }; }, { key: string; value: string | { normal: string; } | { dark: string; light: string; }; }>, "many">; StrokeColorShortMap: ZodRecord<ZodString, ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>>; StrokeColorShortPalettes: ZodArray<ZodObject<{ key: ZodString; value: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; }, "strip", ZodTypeAny, { key: string; value: string | { normal: string; } | { dark: string; light: string; }; }, { key: string; value: string | { normal: string; } | { dark: string; light: string; }; }>, "many">; textColor: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; transparent: ZodLiteral<"transparent">; white: ZodUnion<[ZodString, ZodObject<{ normal: ZodString; }, "strip", ZodTypeAny, { normal: string; }, { normal: string; }>, ZodObject<{ dark: ZodString; light: ZodString; }, "strip", ZodTypeAny, { dark: string; light: string; }, { dark: string; light: string; }>]>; }, "strip", ZodTypeAny, { black: string | { normal: string; } | { dark: string; light: string; }; connectorColor: string | { normal: string; } | { dark: string; light: string; }; FillColorShortMap: Record<string, string | { normal: string; } | { dark: string; light: string; }>; FillColorShortPalettes: object[]; hightlighterColor: string | { normal: string; } | { dark: string; light: string; }; noteBackgrounColor: string | { normal: string; } | { dark: string; light: string; }; NoteBackgroundColorMap: Record<string, string | { normal: string; } | { dark: string; light: string; }>; NoteBackgroundColorPalettes: object[]; Palettes: object[]; pureBlack: string; pureWhite: string; shapeFillColor: string | { normal: string; } | { dark: string; light: string; }; shapeStrokeColor: string | { normal: string; } | { dark: string; light: string; }; shapeTextColor: string | { normal: string; } | { dark: string; light: string; }; ShapeTextColorPalettes: object[]; ShapeTextColorShortMap: Record<string, string | { normal: string; } | { dark: string; light: string; }>; ShapeTextColorShortPalettes: object[]; StrokeColorShortMap: Record<string, string | { normal: string; } | { dark: string; light: string; }>; StrokeColorShortPalettes: object[]; textColor: string | { normal: string; } | { dark: string; light: string; }; transparent: "transparent"; white: string | { normal: string; } | { dark: string; light: string; }; }, { black: string | { normal: string; } | { dark: string; light: string; }; connectorColor: string | { normal: string; } | { dark: string; light: string; }; FillColorShortMap: Record<string, string | { normal: string; } | { dark: string; light: string; }>; FillColorShortPalettes: object[]; hightlighterColor: string | { normal: string; } | { dark: string; light: string; }; noteBackgrounColor: string | { normal: string; } | { dark: string; light: string; }; NoteBackgroundColorMap: Record<string, string | { normal: string; } | { dark: string; light: string; }>; NoteBackgroundColorPalettes: object[]; Palettes: object[]; pureBlack: string; pureWhite: string; shapeFillColor: string | { normal: string; } | { dark: string; light: string; }; shapeStrokeColor: string | { normal: string; } | { dark: string; light: string; }; shapeTextColor: string | { normal: string; } | { dark: string; light: string; }; ShapeTextColorPalettes: object[]; ShapeTextColorShortMap: Record<string, string | { normal: string; } | { dark: string; light: string; }>; ShapeTextColorShortPalettes: object[]; StrokeColorShortMap: Record<string, string | { normal: string; } | { dark: string; light: string; }>; StrokeColorShortPalettes: object[]; textColor: string | { normal: string; } | { dark: string; light: string; }; transparent: "transparent"; white: string | { normal: string; } | { dark: string; light: string; }; }>

Functions

applyNodeStyle()

applyNodeStyle(node, nodeStyle): void

Parameters

node

MindmapNode

nodeStyle

NodeStyle

Returns

void


buildMindMapTree()

buildMindMapTree(element): MindMapTreeNode | null

Parameters

element

Record<string, unknown>

Returns

MindMapTreeNode | null


createEmbedBlockSchema()

createEmbedBlockSchema<Props, Model, Transformer>(__namedParameters): object

Type Parameters

Props

Props extends object

Model

Model extends EmbedBlockModel<Props>

Transformer

Transformer extends BaseBlockTransformer<EmbedProps<Props>> = BaseBlockTransformer<EmbedProps<Props>>

Parameters

__namedParameters
name

string

props?

(internalPrimitives) => Props

toModel

() => Model

transformer?

() => Transformer

version

number

Returns

object

model

model: object & object

Type Declaration
flavour

flavour: `affine:embed-${string}`

props

props: PropsGetter<EmbedProps<Props>>

Type Declaration
role

role: "content" = 'content'

version

version: number

transformer()?

optional transformer: (transformerConfig) => Transformer

Parameters
transformerConfig

Map<string, unknown>

Returns

Transformer

version

version: number


createEnumMap()

createEnumMap<T>(EnumObject): Record<T[keyof T], keyof T>

Type Parameters

T

T extends Record<string, string | number>

Parameters

EnumObject

T

Returns

Record<T[keyof T], keyof T>


defineEmbedModel()

defineEmbedModel<Props, T>(BlockModelSuperClass): {(): GfxBlockElementModel<EmbedProps<Props>>; prototype: GfxBlockElementModel<any>; }

Type Parameters

Props

Props extends object

T

T extends Constructor<BlockModel<Props>> = Constructor<BlockModel<Props>>

Parameters

BlockModelSuperClass

T

Returns

new defineEmbedModel(): GfxBlockElementModel<EmbedProps<Props>>

Returns

GfxBlockElementModel<EmbedProps<Props>>

prototype

prototype: GfxBlockElementModel<any>


getConnectorModeName()

getConnectorModeName(mode): string

Parameters

mode

ConnectorMode

Returns

string


getMindMapNodeMap()

getMindMapNodeMap(element): Map<string, MindMapTreeNode>

Parameters

element

Record<string, unknown>

Returns

Map<string, MindMapTreeNode>


getShapeName()

getShapeName(type, radius): ShapeName

Parameters

type

ShapeType

radius

number

Returns

ShapeName


getShapeRadius()

getShapeRadius(name): number

Parameters

name

ShapeName

Returns

number


getShapeType()

getShapeType(name): ShapeType

Parameters

name

ShapeName

Returns

ShapeType


isExternalEmbedModel()

isExternalEmbedModel(model): model is EmbedGithubModel | EmbedYoutubeModel | EmbedFigmaModel | EmbedLoomModel

Parameters

model

BlockModel<object> | GfxModel

Returns

model is EmbedGithubModel | EmbedYoutubeModel | EmbedFigmaModel | EmbedLoomModel


isInternalEmbedModel()

isInternalEmbedModel(model): model is EmbedLinkedDocModel | EmbedSyncedDocModel

Parameters

model

BlockModel<object> | GfxModel

Returns

model is EmbedLinkedDocModel | EmbedSyncedDocModel


isTransparent()

isTransparent(color): boolean

Parameters

color

string | { normal: string; } | { dark: string; light: string; }

Returns

boolean


resolveColor()

resolveColor(color, colorScheme, fallback): string

Parameters

color

string | { normal: string; } | { dark: string; light: string; }

colorScheme

ColorScheme

fallback

string = 'transparent'

Returns

string