Skip to main content

Class: ConstantProvider

Defined in: packages/blockly/core/renderers/common/constants.ts:124

An object that provides constants for rendering blocks.

Extended by​

Properties index​

PropertyDescription
NO_PADDINGThe size of an empty spacer.
SMALL_PADDINGThe size of small padding.
MEDIUM_PADDINGThe size of medium padding.
MEDIUM_LARGE_PADDINGThe size of medium-large padding.
LARGE_PADDINGThe size of large padding.
TALL_INPUT_FIELD_OFFSET_Y-
TAB_HEIGHTThe height of the puzzle tab used for input and output connections.
TAB_OFFSET_FROM_TOPThe offset from the top of the block at which a puzzle tab is positioned.
TAB_VERTICAL_OVERLAPVertical overlap of the puzzle tab, used to make it look more like a puzzle piece.
TAB_WIDTHThe width of the puzzle tab used for input and output connections.
NOTCH_WIDTHThe width of the notch used for previous and next connections.
NOTCH_HEIGHTThe height of the notch used for previous and next connections.
MIN_BLOCK_WIDTHThe minimum width of the block.
EMPTY_BLOCK_SPACER_HEIGHT-
DUMMY_INPUT_MIN_HEIGHT-
DUMMY_INPUT_SHADOW_MIN_HEIGHT-
CORNER_RADIUSRounded corner radius.
NOTCH_OFFSET_LEFTOffset from the left side of a block or the inside of a statement input to the left side of the notch.
STATEMENT_INPUT_NOTCH_OFFSET-
STATEMENT_BOTTOM_SPACER-
STATEMENT_INPUT_PADDING_LEFT-
BETWEEN_STATEMENT_PADDING_YVertical padding between consecutive statement inputs.
TOP_ROW_MIN_HEIGHT-
TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT-
BOTTOM_ROW_MIN_HEIGHT-
BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT-
ADD_START_HATSWhether to add a 'hat' on top of all blocks with no previous or output connections. Can be overridden by 'hat' property on Theme.BlockStyle.
START_HAT_HEIGHTHeight of the top hat.
START_HAT_WIDTHWidth of the top hat.
SPACER_DEFAULT_HEIGHT-
MIN_BLOCK_HEIGHT-
EMPTY_INLINE_INPUT_PADDING-
EMPTY_INLINE_INPUT_HEIGHT-
EXTERNAL_VALUE_INPUT_PADDING-
EMPTY_STATEMENT_INPUT_HEIGHT-
START_POINT-
JAGGED_TEETH_HEIGHTHeight of SVG path for jagged teeth at the end of collapsed blocks.
JAGGED_TEETH_WIDTHWidth of SVG path for jagged teeth at the end of collapsed blocks.
FIELD_TEXT_FONTSIZEPoint size of text.
FIELD_TEXT_FONTWEIGHTText font weight.
FIELD_TEXT_FONTFAMILYText font family.
FIELD_TEXT_HEIGHTHeight of text. This constant is dynamically set in setFontConstants_ to be the height of the text based on the font used.
FIELD_TEXT_BASELINEText baseline. This constant is dynamically set in setFontConstants_ to be the baseline of the text based on the font used.
FIELD_BORDER_RECT_RADIUSA field's border rect corner radius.
FIELD_BORDER_RECT_HEIGHTA field's border rect default height.
FIELD_BORDER_RECT_X_PADDINGA field's border rect X padding.
FIELD_BORDER_RECT_Y_PADDINGA field's border rect Y padding.
FIELD_BORDER_RECT_COLOURThe backing colour of a field's border rect.
FIELD_TEXT_BASELINE_CENTER-
FIELD_DROPDOWN_BORDER_RECT_HEIGHT-
FIELD_DROPDOWN_NO_BORDER_RECT_SHADOWWhether or not a dropdown field should add a border rect when in a shadow block.
FIELD_DROPDOWN_COLOURED_DIVWhether or not a dropdown field's div should be coloured to match the block colours.
FIELD_DROPDOWN_SVG_ARROWWhether or not a dropdown field uses a text or SVG arrow.
FIELD_DROPDOWN_SVG_ARROW_PADDING-
FIELD_DROPDOWN_SVG_ARROW_SIZEA dropdown field's SVG arrow size.
FIELD_DROPDOWN_SVG_ARROW_DATAURI-
FIELD_TEXTINPUT_BOX_SHADOWWhether or not to show a box shadow around the widget div. This is only a feature of full block fields.
FIELD_COLOUR_FULL_BLOCKWhether or not the colour field should display its colour value on the entire block.
FIELD_COLOUR_DEFAULT_WIDTHA colour field's default width.
FIELD_COLOUR_DEFAULT_HEIGHT-
FIELD_CHECKBOX_X_OFFSET-
randomIdentifier-
embossFilterIdThe ID of the emboss filter, or the empty string if no filter is set.
disabledPatternIdThe ID of the disabled pattern, or the empty string if no pattern is set.
debugFilterIdThe ID of the debug filter, or the empty string if no pattern is set.
CURSOR_COLOURCursor colour.
MARKER_COLOURImmovable marker colour.
CURSOR_WS_WIDTHWidth of the horizontal cursor.
WS_CURSOR_HEIGHTHeight of the horizontal cursor.
CURSOR_STACK_PADDINGPadding around a stack.
CURSOR_BLOCK_PADDINGPadding around a block.
CURSOR_STROKE_WIDTHStroke of the cursor.
FULL_BLOCK_FIELDSWhether text input and colour fields fill up the entire source block.
INSERTION_MARKER_COLOURThe main colour of insertion markers, in hex. The block is rendered a transparent grey by changing the fill opacity in CSS.
INSERTION_MARKER_OPACITYThe insertion marker opacity.
SHAPES-
JAGGED_TEETH-
NOTCH-
START_HAT-
PUZZLE_TAB-
INSIDE_CORNERS-
OUTSIDE_CORNERS-
blockStyles-

Methods index​

MethodDescription
initInitialize shape objects based on the constants set in the constructor.
setThemeRefresh constants properties that depend on the theme.
setDynamicProperties_Sets dynamic properties that depend on other values or theme properties.
setFontConstants_Set constants related to fonts.
setComponentConstants_Set constants from a theme's component styles.
getBlockStyleForColourGet or create a block style based on a single colour value. Generate a name for the style based on the colour.
getBlockStyleGets the BlockStyle for the given block style name.
createBlockStyle_Create a block style object based on the given colour.
validatedBlockStyle_Get a full block style object based on the input style object. Populate any missing values.
generateSecondaryColour_Generate a secondary colour from the passed in primary colour.
generateTertiaryColour_Generate a tertiary colour from the passed in primary colour.
disposeDispose of this constants provider. Delete all DOM elements that this provider created.
makeJaggedTeethReturns an object containing sizing and path information about collapsed block indicators.
makeStartHatReturns an object containing sizing and path information about start hats.
makePuzzleTabReturns an object containing sizing and path information about puzzle tabs.
makeNotchReturns an object containing sizing and path information about notches.
makeInsideCornersReturns an object containing sizing and path information about inside corners.
makeOutsideCornersReturns an object containing sizing and path information about outside corners.
shapeForGet an object with connection shape and sizing information based on the type of the connection.
createDomCreate any DOM elements that this renderer needs (filters, patterns, etc).
injectCSS_Inject renderer specific CSS into the page.
getCSS_Get any renderer specific CSS to inject when the renderer is initialized.

Constructors​

Constructor​

new ConstantProvider(): ConstantProvider;

Defined in: packages/blockly/core/renderers/common/constants.ts:400

Returns​

ConstantProvider

Properties​

NO_PADDING​

NO_PADDING: number = 0;

Defined in: packages/blockly/core/renderers/common/constants.ts:126

The size of an empty spacer.


SMALL_PADDING​

SMALL_PADDING: number = 3;

Defined in: packages/blockly/core/renderers/common/constants.ts:129

The size of small padding.


MEDIUM_PADDING​

MEDIUM_PADDING: number = 5;

Defined in: packages/blockly/core/renderers/common/constants.ts:132

The size of medium padding.


MEDIUM_LARGE_PADDING​

MEDIUM_LARGE_PADDING: number = 8;

Defined in: packages/blockly/core/renderers/common/constants.ts:135

The size of medium-large padding.


LARGE_PADDING​

LARGE_PADDING: number = 10;

Defined in: packages/blockly/core/renderers/common/constants.ts:138

The size of large padding.


TALL_INPUT_FIELD_OFFSET_Y​

TALL_INPUT_FIELD_OFFSET_Y: number;

Defined in: packages/blockly/core/renderers/common/constants.ts:139


TAB_HEIGHT​

TAB_HEIGHT: number = 15;

Defined in: packages/blockly/core/renderers/common/constants.ts:142

The height of the puzzle tab used for input and output connections.


TAB_OFFSET_FROM_TOP​

TAB_OFFSET_FROM_TOP: number = 5;

Defined in: packages/blockly/core/renderers/common/constants.ts:147

The offset from the top of the block at which a puzzle tab is positioned.


TAB_VERTICAL_OVERLAP​

TAB_VERTICAL_OVERLAP: number = 2.5;

Defined in: packages/blockly/core/renderers/common/constants.ts:153

Vertical overlap of the puzzle tab, used to make it look more like a puzzle piece.


TAB_WIDTH​

TAB_WIDTH: number = 8;

Defined in: packages/blockly/core/renderers/common/constants.ts:156

The width of the puzzle tab used for input and output connections.


NOTCH_WIDTH​

NOTCH_WIDTH: number = 15;

Defined in: packages/blockly/core/renderers/common/constants.ts:159

The width of the notch used for previous and next connections.


NOTCH_HEIGHT​

NOTCH_HEIGHT: number = 4;

Defined in: packages/blockly/core/renderers/common/constants.ts:162

The height of the notch used for previous and next connections.


MIN_BLOCK_WIDTH​

MIN_BLOCK_WIDTH: number = 12;

Defined in: packages/blockly/core/renderers/common/constants.ts:165

The minimum width of the block.


EMPTY_BLOCK_SPACER_HEIGHT​

EMPTY_BLOCK_SPACER_HEIGHT: number = 16;

Defined in: packages/blockly/core/renderers/common/constants.ts:166


DUMMY_INPUT_MIN_HEIGHT​

DUMMY_INPUT_MIN_HEIGHT: number;

Defined in: packages/blockly/core/renderers/common/constants.ts:167


DUMMY_INPUT_SHADOW_MIN_HEIGHT​

DUMMY_INPUT_SHADOW_MIN_HEIGHT: number;

Defined in: packages/blockly/core/renderers/common/constants.ts:168


CORNER_RADIUS​

CORNER_RADIUS: number = 8;

Defined in: packages/blockly/core/renderers/common/constants.ts:171

Rounded corner radius.


NOTCH_OFFSET_LEFT​

NOTCH_OFFSET_LEFT: number = 15;

Defined in: packages/blockly/core/renderers/common/constants.ts:177

Offset from the left side of a block or the inside of a statement input to the left side of the notch.


STATEMENT_INPUT_NOTCH_OFFSET​

STATEMENT_INPUT_NOTCH_OFFSET: number;

Defined in: packages/blockly/core/renderers/common/constants.ts:178


STATEMENT_BOTTOM_SPACER​

STATEMENT_BOTTOM_SPACER: number = 0;

Defined in: packages/blockly/core/renderers/common/constants.ts:180


STATEMENT_INPUT_PADDING_LEFT​

STATEMENT_INPUT_PADDING_LEFT: number = 20;

Defined in: packages/blockly/core/renderers/common/constants.ts:181


BETWEEN_STATEMENT_PADDING_Y​

BETWEEN_STATEMENT_PADDING_Y: number = 4;

Defined in: packages/blockly/core/renderers/common/constants.ts:184

Vertical padding between consecutive statement inputs.


TOP_ROW_MIN_HEIGHT​

TOP_ROW_MIN_HEIGHT: number;

Defined in: packages/blockly/core/renderers/common/constants.ts:185


TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT​

TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT: number;

Defined in: packages/blockly/core/renderers/common/constants.ts:186


BOTTOM_ROW_MIN_HEIGHT​

BOTTOM_ROW_MIN_HEIGHT: number;

Defined in: packages/blockly/core/renderers/common/constants.ts:187


BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT​

BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT: number;

Defined in: packages/blockly/core/renderers/common/constants.ts:188


ADD_START_HATS​

ADD_START_HATS: boolean = false;

Defined in: packages/blockly/core/renderers/common/constants.ts:194

Whether to add a 'hat' on top of all blocks with no previous or output connections. Can be overridden by 'hat' property on Theme.BlockStyle.


START_HAT_HEIGHT​

START_HAT_HEIGHT: number = 15;

Defined in: packages/blockly/core/renderers/common/constants.ts:197

Height of the top hat.


START_HAT_WIDTH​

START_HAT_WIDTH: number = 100;

Defined in: packages/blockly/core/renderers/common/constants.ts:200

Width of the top hat.


SPACER_DEFAULT_HEIGHT​

SPACER_DEFAULT_HEIGHT: number = 15;

Defined in: packages/blockly/core/renderers/common/constants.ts:202


MIN_BLOCK_HEIGHT​

MIN_BLOCK_HEIGHT: number = 24;

Defined in: packages/blockly/core/renderers/common/constants.ts:204


EMPTY_INLINE_INPUT_PADDING​

EMPTY_INLINE_INPUT_PADDING: number = 14.5;

Defined in: packages/blockly/core/renderers/common/constants.ts:206


EMPTY_INLINE_INPUT_HEIGHT​

EMPTY_INLINE_INPUT_HEIGHT: number;

Defined in: packages/blockly/core/renderers/common/constants.ts:207


EXTERNAL_VALUE_INPUT_PADDING​

EXTERNAL_VALUE_INPUT_PADDING: number = 2;

Defined in: packages/blockly/core/renderers/common/constants.ts:209


EMPTY_STATEMENT_INPUT_HEIGHT​

EMPTY_STATEMENT_INPUT_HEIGHT: number;

Defined in: packages/blockly/core/renderers/common/constants.ts:210


START_POINT​

START_POINT: string;

Defined in: packages/blockly/core/renderers/common/constants.ts:211


JAGGED_TEETH_HEIGHT​

JAGGED_TEETH_HEIGHT: number = 12;

Defined in: packages/blockly/core/renderers/common/constants.ts:214

Height of SVG path for jagged teeth at the end of collapsed blocks.


JAGGED_TEETH_WIDTH​

JAGGED_TEETH_WIDTH: number = 6;

Defined in: packages/blockly/core/renderers/common/constants.ts:217

Width of SVG path for jagged teeth at the end of collapsed blocks.


FIELD_TEXT_FONTSIZE​

FIELD_TEXT_FONTSIZE: number = 11;

Defined in: packages/blockly/core/renderers/common/constants.ts:220

Point size of text.


FIELD_TEXT_FONTWEIGHT​

FIELD_TEXT_FONTWEIGHT: string = 'normal';

Defined in: packages/blockly/core/renderers/common/constants.ts:223

Text font weight.


FIELD_TEXT_FONTFAMILY​

FIELD_TEXT_FONTFAMILY: string = 'sans-serif';

Defined in: packages/blockly/core/renderers/common/constants.ts:226

Text font family.


FIELD_TEXT_HEIGHT​

FIELD_TEXT_HEIGHT: number = -1;

Defined in: packages/blockly/core/renderers/common/constants.ts:233

Height of text. This constant is dynamically set in setFontConstants_ to be the height of the text based on the font used.


FIELD_TEXT_BASELINE​

FIELD_TEXT_BASELINE: number = -1;

Defined in: packages/blockly/core/renderers/common/constants.ts:239

Text baseline. This constant is dynamically set in setFontConstants_ to be the baseline of the text based on the font used.


FIELD_BORDER_RECT_RADIUS​

FIELD_BORDER_RECT_RADIUS: number = 4;

Defined in: packages/blockly/core/renderers/common/constants.ts:242

A field's border rect corner radius.


FIELD_BORDER_RECT_HEIGHT​

FIELD_BORDER_RECT_HEIGHT: number = 16;

Defined in: packages/blockly/core/renderers/common/constants.ts:245

A field's border rect default height.


FIELD_BORDER_RECT_X_PADDING​

FIELD_BORDER_RECT_X_PADDING: number = 5;

Defined in: packages/blockly/core/renderers/common/constants.ts:248

A field's border rect X padding.


FIELD_BORDER_RECT_Y_PADDING​

FIELD_BORDER_RECT_Y_PADDING: number = 3;

Defined in: packages/blockly/core/renderers/common/constants.ts:251

A field's border rect Y padding.


FIELD_BORDER_RECT_COLOUR​

FIELD_BORDER_RECT_COLOUR: string = '#fff';

Defined in: packages/blockly/core/renderers/common/constants.ts:256

The backing colour of a field's border rect.


FIELD_TEXT_BASELINE_CENTER​

FIELD_TEXT_BASELINE_CENTER: boolean;

Defined in: packages/blockly/core/renderers/common/constants.ts:257


FIELD_DROPDOWN_BORDER_RECT_HEIGHT​

FIELD_DROPDOWN_BORDER_RECT_HEIGHT: number;

Defined in: packages/blockly/core/renderers/common/constants.ts:258


FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW​

FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW: boolean = false;

Defined in: packages/blockly/core/renderers/common/constants.ts:264

Whether or not a dropdown field should add a border rect when in a shadow block.


FIELD_DROPDOWN_COLOURED_DIV​

FIELD_DROPDOWN_COLOURED_DIV: boolean = false;

Defined in: packages/blockly/core/renderers/common/constants.ts:270

Whether or not a dropdown field's div should be coloured to match the block colours.


FIELD_DROPDOWN_SVG_ARROW​

FIELD_DROPDOWN_SVG_ARROW: boolean = false;

Defined in: packages/blockly/core/renderers/common/constants.ts:273

Whether or not a dropdown field uses a text or SVG arrow.


FIELD_DROPDOWN_SVG_ARROW_PADDING​

FIELD_DROPDOWN_SVG_ARROW_PADDING: number;

Defined in: packages/blockly/core/renderers/common/constants.ts:274


FIELD_DROPDOWN_SVG_ARROW_SIZE​

FIELD_DROPDOWN_SVG_ARROW_SIZE: number = 12;

Defined in: packages/blockly/core/renderers/common/constants.ts:277

A dropdown field's SVG arrow size.


FIELD_DROPDOWN_SVG_ARROW_DATAURI​

FIELD_DROPDOWN_SVG_ARROW_DATAURI: string;

Defined in: packages/blockly/core/renderers/common/constants.ts:278


FIELD_TEXTINPUT_BOX_SHADOW​

FIELD_TEXTINPUT_BOX_SHADOW: boolean = false;

Defined in: packages/blockly/core/renderers/common/constants.ts:284

Whether or not to show a box shadow around the widget div. This is only a feature of full block fields.


FIELD_COLOUR_FULL_BLOCK​

FIELD_COLOUR_FULL_BLOCK: boolean = false;

Defined in: packages/blockly/core/renderers/common/constants.ts:290

Whether or not the colour field should display its colour value on the entire block.


FIELD_COLOUR_DEFAULT_WIDTH​

FIELD_COLOUR_DEFAULT_WIDTH: number = 26;

Defined in: packages/blockly/core/renderers/common/constants.ts:293

A colour field's default width.


FIELD_COLOUR_DEFAULT_HEIGHT​

FIELD_COLOUR_DEFAULT_HEIGHT: number;

Defined in: packages/blockly/core/renderers/common/constants.ts:294


FIELD_CHECKBOX_X_OFFSET​

FIELD_CHECKBOX_X_OFFSET: number;

Defined in: packages/blockly/core/renderers/common/constants.ts:295


randomIdentifier​

randomIdentifier: string;

Defined in: packages/blockly/core/renderers/common/constants.ts:296


embossFilterId​

embossFilterId: string = '';

Defined in: packages/blockly/core/renderers/common/constants.ts:307

The ID of the emboss filter, or the empty string if no filter is set.


disabledPatternId​

disabledPatternId: string = '';

Defined in: packages/blockly/core/renderers/common/constants.ts:315

The ID of the disabled pattern, or the empty string if no pattern is set.


debugFilterId​

debugFilterId: string = '';

Defined in: packages/blockly/core/renderers/common/constants.ts:325

The ID of the debug filter, or the empty string if no pattern is set.


CURSOR_COLOUR​

CURSOR_COLOUR: string = '#cc0a0a';

Defined in: packages/blockly/core/renderers/common/constants.ts:335

Cursor colour.


MARKER_COLOUR​

MARKER_COLOUR: string = '#4286f4';

Defined in: packages/blockly/core/renderers/common/constants.ts:340

Immovable marker colour.


CURSOR_WS_WIDTH​

CURSOR_WS_WIDTH: number = 100;

Defined in: packages/blockly/core/renderers/common/constants.ts:345

Width of the horizontal cursor.


WS_CURSOR_HEIGHT​

WS_CURSOR_HEIGHT: number = 5;

Defined in: packages/blockly/core/renderers/common/constants.ts:350

Height of the horizontal cursor.


CURSOR_STACK_PADDING​

CURSOR_STACK_PADDING: number = 10;

Defined in: packages/blockly/core/renderers/common/constants.ts:355

Padding around a stack.


CURSOR_BLOCK_PADDING​

CURSOR_BLOCK_PADDING: number = 2;

Defined in: packages/blockly/core/renderers/common/constants.ts:360

Padding around a block.


CURSOR_STROKE_WIDTH​

CURSOR_STROKE_WIDTH: number = 4;

Defined in: packages/blockly/core/renderers/common/constants.ts:365

Stroke of the cursor.


FULL_BLOCK_FIELDS​

FULL_BLOCK_FIELDS: boolean = false;

Defined in: packages/blockly/core/renderers/common/constants.ts:370

Whether text input and colour fields fill up the entire source block.


INSERTION_MARKER_COLOUR​

INSERTION_MARKER_COLOUR: string = '#000000';

Defined in: packages/blockly/core/renderers/common/constants.ts:376

The main colour of insertion markers, in hex. The block is rendered a transparent grey by changing the fill opacity in CSS.


INSERTION_MARKER_OPACITY​

INSERTION_MARKER_OPACITY: number = 0.2;

Defined in: packages/blockly/core/renderers/common/constants.ts:381

The insertion marker opacity.


SHAPES​

SHAPES: object;

Defined in: packages/blockly/core/renderers/common/constants.ts:383

Index Signature​

[key: string]: number

JAGGED_TEETH​

JAGGED_TEETH: JaggedTeeth;

Defined in: packages/blockly/core/renderers/common/constants.ts:385


NOTCH​

NOTCH: Notch;

Defined in: packages/blockly/core/renderers/common/constants.ts:387


START_HAT​

START_HAT: StartHat;

Defined in: packages/blockly/core/renderers/common/constants.ts:389


PUZZLE_TAB​

PUZZLE_TAB: PuzzleTab;

Defined in: packages/blockly/core/renderers/common/constants.ts:391


INSIDE_CORNERS​

INSIDE_CORNERS: InsideCorners;

Defined in: packages/blockly/core/renderers/common/constants.ts:393


OUTSIDE_CORNERS​

OUTSIDE_CORNERS: OutsideCorners;

Defined in: packages/blockly/core/renderers/common/constants.ts:395


blockStyles​

blockStyles: object;

Defined in: packages/blockly/core/renderers/common/constants.ts:398

Index Signature​

[key: string]: BlockStyle

Methods​

init()​

init(): void;

Defined in: packages/blockly/core/renderers/common/constants.ts:487

Initialize shape objects based on the constants set in the constructor.

Returns​

void


setTheme()​

setTheme(theme): void;

Defined in: packages/blockly/core/renderers/common/constants.ts:521

Refresh constants properties that depend on the theme.

Parameters​

ParameterTypeDescription
themeThemeThe current workspace theme.

Returns​

void


setDynamicProperties_()​

protected setDynamicProperties_(theme): void;

Defined in: packages/blockly/core/renderers/common/constants.ts:538

Sets dynamic properties that depend on other values or theme properties.

Parameters​

ParameterTypeDescription
themeThemeThe current workspace theme.

Returns​

void


setFontConstants_()​

protected setFontConstants_(theme): void;

Defined in: packages/blockly/core/renderers/common/constants.ts:551

Set constants related to fonts.

Parameters​

ParameterTypeDescription
themeThemeThe current workspace theme.

Returns​

void


setComponentConstants_()​

protected setComponentConstants_(theme): void;

Defined in: packages/blockly/core/renderers/common/constants.ts:580

Set constants from a theme's component styles.

Parameters​

ParameterTypeDescription
themeThemeThe current workspace theme.

Returns​

void


getBlockStyleForColour()​

getBlockStyleForColour(colour): object;

Defined in: packages/blockly/core/renderers/common/constants.ts:601

Get or create a block style based on a single colour value. Generate a name for the style based on the colour.

Parameters​

ParameterTypeDescription
colourstring#RRGGBB colour string.

Returns​

object

An object containing the style and an autogenerated name for that style.

style​
style: BlockStyle;
name​
name: string;

getBlockStyle()​

getBlockStyle(blockStyleName): BlockStyle;

Defined in: packages/blockly/core/renderers/common/constants.ts:616

Gets the BlockStyle for the given block style name.

Parameters​

ParameterTypeDescription
blockStyleNamestring | nullThe name of the block style.

Returns​

BlockStyle

The named block style, or a default style if no style with the given name was found.


createBlockStyle_()​

protected createBlockStyle_(colour): BlockStyle;

Defined in: packages/blockly/core/renderers/common/constants.ts:631

Create a block style object based on the given colour.

Parameters​

ParameterTypeDescription
colourstring#RRGGBB colour string.

Returns​

BlockStyle

A populated block style based on the given colour.


validatedBlockStyle_()​

protected validatedBlockStyle_(blockStyle): BlockStyle;

Defined in: packages/blockly/core/renderers/common/constants.ts:642

Get a full block style object based on the input style object. Populate any missing values.

Parameters​

ParameterTypeDescription
blockStylePartial<BlockStyle>A full or partial block style object.

Returns​

BlockStyle

A full block style object, with all required properties populated.


generateSecondaryColour_()​

protected generateSecondaryColour_(inputColour): string;

Defined in: packages/blockly/core/renderers/common/constants.ts:670

Generate a secondary colour from the passed in primary colour.

Parameters​

ParameterTypeDescription
inputColourstringPrimary colour.

Returns​

string

The generated secondary colour.


generateTertiaryColour_()​

protected generateTertiaryColour_(inputColour): string;

Defined in: packages/blockly/core/renderers/common/constants.ts:680

Generate a tertiary colour from the passed in primary colour.

Parameters​

ParameterTypeDescription
inputColourstringPrimary colour.

Returns​

string

The generated tertiary colour.


dispose()​

dispose(): void;

Defined in: packages/blockly/core/renderers/common/constants.ts:688

Dispose of this constants provider. Delete all DOM elements that this provider created.

Returns​

void


makeJaggedTeeth()​

protected makeJaggedTeeth(): JaggedTeeth;

Defined in: packages/blockly/core/renderers/common/constants.ts:704

Returns​

JaggedTeeth

An object containing sizing and path information about collapsed block indicators.


makeStartHat()​

protected makeStartHat(): StartHat;

Defined in: packages/blockly/core/renderers/common/constants.ts:719

Returns​

StartHat

An object containing sizing and path information about start hats.


makePuzzleTab()​

protected makePuzzleTab(): PuzzleTab;

Defined in: packages/blockly/core/renderers/common/constants.ts:738

Returns​

PuzzleTab

An object containing sizing and path information about puzzle tabs.


makeNotch()​

protected makeNotch(): Notch;

Defined in: packages/blockly/core/renderers/common/constants.ts:796

Returns​

Notch

An object containing sizing and path information about notches.


makeInsideCorners()​

protected makeInsideCorners(): InsideCorners;

Defined in: packages/blockly/core/renderers/common/constants.ts:832

Returns​

InsideCorners

An object containing sizing and path information about inside corners.


makeOutsideCorners()​

protected makeOutsideCorners(): OutsideCorners;

Defined in: packages/blockly/core/renderers/common/constants.ts:861

Returns​

OutsideCorners

An object containing sizing and path information about outside corners.


shapeFor()​

shapeFor(connection): Shape;

Defined in: packages/blockly/core/renderers/common/constants.ts:908

Get an object with connection shape and sizing information based on the type of the connection.

Parameters​

ParameterTypeDescription
connectionRenderedConnectionThe connection to find a shape object for

Returns​

Shape

The shape object for the connection.


createDom()​

createDom(
svg,
selector,
injectionDivIfIsParent?
): void;

Defined in: packages/blockly/core/renderers/common/constants.ts:932

Create any DOM elements that this renderer needs (filters, patterns, etc).

Parameters​

ParameterTypeDescription
svgSVGElementThe root of the workspace's SVG.
selectorstringThe CSS selector to use.
injectionDivIfIsParent?HTMLElementThe div containing the parent workspace and all related workspaces and block containers, if this renderer is for the parent workspace. CSS variables representing SVG patterns will be scoped to this container. Child workspaces should not override the CSS variables created by the parent and thus do not need access to the injection div.

Returns​

void


injectCSS_()​

protected injectCSS_(root, selector): void;

Defined in: packages/blockly/core/renderers/common/constants.ts:1127

Inject renderer specific CSS into the page.

Parameters​

ParameterTypeDescription
rootDocument | ShadowRootThe document root to inject the CSS into.
selectorstringThe CSS selector to interpolate into the stylesheet.

Returns​

void


getCSS_()​

protected getCSS_(selector): string[];

Defined in: packages/blockly/core/renderers/common/constants.ts:1153

Get any renderer specific CSS to inject when the renderer is initialized.

Parameters​

ParameterTypeDescription
selectorstringCSS selector to use.

Returns​

string[]

Array of CSS strings.