Skip to content

Documentation / @ripl/core / CONTEXT_OPERATIONS

Variable: CONTEXT_OPERATIONS ​

const CONTEXT_OPERATIONS: object

Defined in: packages/core/src/core/constants.ts:36

Maps element state properties to their corresponding context setter functions.

Every property assigns except opacity, which composites multiplicatively: an element's own alpha stacks under whatever its ancestor groups already accumulated rather than replacing it, matching how the DOM composites nested opacity. Note this is the operation's contract, not Context.opacity's — assigning that property still replaces.

Type Declaration ​

direction ​

direction: (context, value) => void

Directionality used when rendering text.

Parameters ​

ParameterType
contextContext
valueNonNullable<Direction | undefined>

Returns ​

void

fill ​

fill: (context, value) => void

Fill style (CSS color, gradient, or pattern) used to paint filled regions.

Parameters ​

ParameterType
contextContext
valuestring

Returns ​

void

filter ​

filter: (context, value) => void

CSS filter string applied to subsequent drawing operations (e.g. blur(4px)).

Parameters ​

ParameterType
contextContext
valuestring

Returns ​

void

font ​

font: (context, value) => void

CSS font shorthand used when rendering text.

Parameters ​

ParameterType
contextContext
valuestring

Returns ​

void

fontKerning ​

fontKerning: (context, value) => void

Whether font kerning is applied when rendering text.

Parameters ​

ParameterType
contextContext
valueNonNullable<FontKerning | undefined>

Returns ​

void

globalCompositeOperation ​

globalCompositeOperation: (context, value) => void

Compositing operation controlling how new drawing is blended with existing content.

Parameters ​

ParameterType
contextContext
value{ }

Returns ​

void

lineCap ​

lineCap: (context, value) => void

Cap style drawn at the endpoints of stroked lines.

Parameters ​

ParameterType
contextContext
valueNonNullable<LineCap | undefined>

Returns ​

void

lineDash ​

lineDash: (context, value) => void

Dash pattern as alternating stroke and gap lengths; empty for a solid line.

Parameters ​

ParameterType
contextContext
valuenumber[]

Returns ​

void

lineDashOffset ​

lineDashOffset: (context, value) => void

Distance into the line dash pattern at which dashing begins.

Parameters ​

ParameterType
contextContext
valuenumber

Returns ​

void

lineJoin ​

lineJoin: (context, value) => void

Join style drawn where two stroked segments meet.

Parameters ​

ParameterType
contextContext
valueNonNullable<LineJoin | undefined>

Returns ​

void

lineWidth ​

lineWidth: (context, value) => void

Width, in pixels, of stroked lines.

Parameters ​

ParameterType
contextContext
valuenumber

Returns ​

void

miterLimit ​

miterLimit: (context, value) => void

Miter length limit ratio applied to miter line joins.

Parameters ​

ParameterType
contextContext
valuenumber

Returns ​

void

opacity ​

opacity: (context, value) => void

Global alpha applied to everything drawn, from 0 to 1.

Parameters ​

ParameterType
contextContext
valuenumber

Returns ​

void

rotation ​

rotation: (context, value) => void

Rotation applied to the element's transform, as radians or a deg/rad string.

Parameters ​

ParameterType
contextContext
valueNonNullable<Rotation | undefined>

Returns ​

void

shadowBlur ​

shadowBlur: (context, value) => void

Gaussian blur radius applied to drawn shadows.

Parameters ​

ParameterType
contextContext
valuenumber

Returns ​

void

shadowColor ​

shadowColor: (context, value) => void

Color of drawn shadows.

Parameters ​

ParameterType
contextContext
valuestring

Returns ​

void

shadowOffsetX ​

shadowOffsetX: (context, value) => void

Horizontal offset, in pixels, of drawn shadows.

Parameters ​

ParameterType
contextContext
valuenumber

Returns ​

void

shadowOffsetY ​

shadowOffsetY: (context, value) => void

Vertical offset, in pixels, of drawn shadows.

Parameters ​

ParameterType
contextContext
valuenumber

Returns ​

void

stroke ​

stroke: (context, value) => void

Stroke style (CSS color, gradient, or pattern) used to paint outlines.

Parameters ​

ParameterType
contextContext
valuestring

Returns ​

void

textAlign ​

textAlign: (context, value) => void

Horizontal alignment of text relative to the drawing position.

Parameters ​

ParameterType
contextContext
valueNonNullable<TextAlignment | undefined>

Returns ​

void

textBaseline ​

textBaseline: (context, value) => void

Vertical baseline used when positioning text.

Parameters ​

ParameterType
contextContext
valueNonNullable<TextBaseline | undefined>

Returns ​

void

transformOriginX ​

transformOriginX: (context, value) => void

Horizontal origin about which rotation and scaling are applied.

Parameters ​

ParameterType
contextContext
valueNonNullable<TransformOrigin | undefined>

Returns ​

void

transformOriginY ​

transformOriginY: (context, value) => void

Vertical origin about which rotation and scaling are applied.

Parameters ​

ParameterType
contextContext
valueNonNullable<TransformOrigin | undefined>

Returns ​

void

transformScaleX ​

transformScaleX: (context, value) => void

Horizontal scale factor applied to the element's transform.

Parameters ​

ParameterType
contextContext
valuenumber

Returns ​

void

transformScaleY ​

transformScaleY: (context, value) => void

Vertical scale factor applied to the element's transform.

Parameters ​

ParameterType
contextContext
valuenumber

Returns ​

void

translateX ​

translateX: (context, value) => void

Horizontal translation, in pixels, applied to the element's transform.

Parameters ​

ParameterType
contextContext
valuenumber

Returns ​

void

translateY ​

translateY: (context, value) => void

Vertical translation, in pixels, applied to the element's transform.

Parameters ​

ParameterType
contextContext
valuenumber

Returns ​

void

zIndex ​

zIndex: (context, value) => void

Stacking order used to sort elements during rendering; higher values draw on top.

Parameters ​

ParameterType
contextContext
valuenumber

Returns ​

void