descriptors#

Interfaces#

CircleDescriptor#

Defined in: writers/src/descriptors.ts:88

A circle of radius r around (cx, cy).

Extends#

  • Written

Properties#

attrs#

readonly attrs: readonly Attribute[]

Defined in: writers/src/descriptors.ts:63

Its attributes in the order they are written: its address, geometry, paint and opacity.

Inherited from#

Written.attrs

cx#

readonly cx: number

Defined in: writers/src/descriptors.ts:90

cy#

readonly cy: number

Defined in: writers/src/descriptors.ts:91

r#

readonly r: number

Defined in: writers/src/descriptors.ts:92

source#

readonly source: DescriptorSource

Defined in: writers/src/descriptors.ts:64

Inherited from#

Written.source

tag#

readonly tag: "circle"

Defined in: writers/src/descriptors.ts:89

text#

readonly text: null

Defined in: writers/src/descriptors.ts:93


LineDescriptor#

Defined in: writers/src/descriptors.ts:78

A line from (x1, y1) to (x2, y2).

Extends#

  • Written

Properties#

attrs#

readonly attrs: readonly Attribute[]

Defined in: writers/src/descriptors.ts:63

Its attributes in the order they are written: its address, geometry, paint and opacity.

Inherited from#

Written.attrs

source#

readonly source: DescriptorSource

Defined in: writers/src/descriptors.ts:64

Inherited from#

Written.source

tag#

readonly tag: "line"

Defined in: writers/src/descriptors.ts:79

text#

readonly text: null

Defined in: writers/src/descriptors.ts:84

x1#

readonly x1: number

Defined in: writers/src/descriptors.ts:80

x2#

readonly x2: number

Defined in: writers/src/descriptors.ts:82

y1#

readonly y1: number

Defined in: writers/src/descriptors.ts:81

y2#

readonly y2: number

Defined in: writers/src/descriptors.ts:83


PathDescriptor#

Defined in: writers/src/descriptors.ts:104

A path drawn by the commands d.

Extends#

  • Written

Properties#

attrs#

readonly attrs: readonly Attribute[]

Defined in: writers/src/descriptors.ts:63

Its attributes in the order they are written: its address, geometry, paint and opacity.

Inherited from#

Written.attrs

d#

readonly d: readonly PathCommand[]

Defined in: writers/src/descriptors.ts:106

source#

readonly source: DescriptorSource

Defined in: writers/src/descriptors.ts:64

Inherited from#

Written.source

tag#

readonly tag: "path"

Defined in: writers/src/descriptors.ts:105

text#

readonly text: null

Defined in: writers/src/descriptors.ts:107


PointsDescriptor#

Defined in: writers/src/descriptors.ts:97

A polygon (closed) or polyline (open) through points.

Extends#

  • Written

Properties#

attrs#

readonly attrs: readonly Attribute[]

Defined in: writers/src/descriptors.ts:63

Its attributes in the order they are written: its address, geometry, paint and opacity.

Inherited from#

Written.attrs

points#

readonly points: readonly Point[]

Defined in: writers/src/descriptors.ts:99

source#

readonly source: DescriptorSource

Defined in: writers/src/descriptors.ts:64

Inherited from#

Written.source

tag#

readonly tag: "polygon" | "polyline"

Defined in: writers/src/descriptors.ts:98

text#

readonly text: null

Defined in: writers/src/descriptors.ts:100


RectDescriptor#

Defined in: writers/src/descriptors.ts:68

A rect: its top-left corner (x, y), its width and its height.

Extends#

  • Written

Properties#

attrs#

readonly attrs: readonly Attribute[]

Defined in: writers/src/descriptors.ts:63

Its attributes in the order they are written: its address, geometry, paint and opacity.

Inherited from#

Written.attrs

height#

readonly height: number

Defined in: writers/src/descriptors.ts:73

source#

readonly source: DescriptorSource

Defined in: writers/src/descriptors.ts:64

Inherited from#

Written.source

tag#

readonly tag: "rect"

Defined in: writers/src/descriptors.ts:69

text#

readonly text: null

Defined in: writers/src/descriptors.ts:74

width#

readonly width: number

Defined in: writers/src/descriptors.ts:72

x#

readonly x: number

Defined in: writers/src/descriptors.ts:70

y#

readonly y: number

Defined in: writers/src/descriptors.ts:71


TextDescriptor#

Defined in: writers/src/descriptors.ts:111

A text element holding text, anchored at (x, y) by its start or middle.

Extends#

  • Written

Properties#

anchor#

readonly anchor: "start" | "middle"

Defined in: writers/src/descriptors.ts:115

attrs#

readonly attrs: readonly Attribute[]

Defined in: writers/src/descriptors.ts:63

Its attributes in the order they are written: its address, geometry, paint and opacity.

Inherited from#

Written.attrs

source#

readonly source: DescriptorSource

Defined in: writers/src/descriptors.ts:64

Inherited from#

Written.source

tag#

readonly tag: "text"

Defined in: writers/src/descriptors.ts:112

text#

readonly text: string

Defined in: writers/src/descriptors.ts:116

x#

readonly x: number

Defined in: writers/src/descriptors.ts:113

y#

readonly y: number

Defined in: writers/src/descriptors.ts:114

Type Aliases#

Attribute#

Attribute = readonly [typeof ADDRESS_ATTRIBUTES[number] | "fill" | "stroke" | "stroke-dasharray" | "text-anchor", string] | readonly ["x" | "y" | "width" | "height" | "rx" | "x1" | "y1" | "x2" | "y2" | "cx" | "cy" | "r" | "font-size" | "stroke-width" | "opacity", number] | readonly ["points", readonly Point[]] | readonly ["d", readonly PathCommand[]]

Defined in: writers/src/descriptors.ts:30

One SVG attribute, its name and its value, as the descriptor writes it.


AttributeValue#

AttributeValue = Attribute[1]

Defined in: writers/src/descriptors.ts:59

An attribute value: a number, a string, polygon points or path data.


Descriptor#

Defined in: writers/src/descriptors.ts:123

One SVG element: its tag, its geometry, its attributes in the order they are written, its text, and the element it was written from.


PathCommand#

PathCommand = { command: "M" | "L"; points: readonly [Point]; } | { command: "Q"; points: readonly [Point, Point]; } | { command: "C"; points: readonly [Point, Point, Point]; }

Defined in: layout/src/elements.ts:199

One path command and its points, in the order they are written.


Point#

Point = readonly [number, number]

Defined in: layout/src/elements.ts:196

A point (x, y) in block-local canvas units.


Tag#

Tag = "rect" | "line" | "circle" | "polygon" | "polyline" | "path" | "text"

Defined in: writers/src/descriptors.ts:27

The SVG element a descriptor writes.

Variables#

ADDRESS_ATTRIBUTES#

const ADDRESS_ATTRIBUTES: readonly ["data-id", "data-facet", "data-part"]

Defined in: writers/src/descriptors.ts:24

The SVG attributes that carry an element’s address (section 7.2), in the order written.

Functions#

toDescriptors()#

toDescriptors(drawing): Descriptor[]

Defined in: writers/src/descriptors.ts:436

The descriptors of a drawing, in the order of its elements, each naming its element.

Parameters#

drawing#

Drawing

Returns#

Descriptor[]