chore(deps): Bump prettier from 2.8.8 to 3.0.0 (#7322)

* chore(deps): Bump prettier from 2.8.8 to 3.0.0

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: Reformat using Prettier v3.0 defaults

The main change is to add trailing commas to the last line of
block-formatted function calls.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
This commit is contained in:
dependabot[bot]
2023-07-25 14:56:10 +00:00
committed by GitHub
parent 9fc57a3bfa
commit 2546b01d70
297 changed files with 3247 additions and 3181 deletions

View File

@@ -73,7 +73,7 @@ export function unregister(name: string) {
export function init(
name: string,
theme: Theme,
opt_rendererOverrides?: {[rendererConstant: string]: any}
opt_rendererOverrides?: {[rendererConstant: string]: any},
): Renderer {
const rendererClass = registry.getClass(registry.Type.RENDERER, name);
const renderer = new rendererClass!(name);

View File

@@ -551,7 +551,7 @@ export class ConstantProvider {
'Hg',
this.FIELD_TEXT_FONTSIZE + 'pt',
this.FIELD_TEXT_FONTWEIGHT,
this.FIELD_TEXT_FONTFAMILY
this.FIELD_TEXT_FONTFAMILY,
);
this.FIELD_TEXT_HEIGHT = fontMetrics.height;
@@ -633,7 +633,7 @@ export class ConstantProvider {
}
// Validate required properties.
const parsedColour = parsing.parseBlockColour(
valid['colourPrimary'] || '#000'
valid['colourPrimary'] || '#000',
);
valid.colourPrimary = parsedColour.hex;
valid.colourSecondary = valid['colourSecondary']
@@ -820,14 +820,14 @@ export class ConstantProvider {
'a',
'0 0,0',
radius,
svgPaths.point(-radius, radius)
svgPaths.point(-radius, radius),
);
const innerBottomLeftCorner = svgPaths.arc(
'a',
'0 0,0',
radius,
svgPaths.point(radius, radius)
svgPaths.point(radius, radius),
);
return {
@@ -854,7 +854,7 @@ export class ConstantProvider {
'a',
'0 0,1',
radius,
svgPaths.point(radius, radius)
svgPaths.point(radius, radius),
);
/** SVG path for drawing the rounded bottom-left corner. */
@@ -862,7 +862,7 @@ export class ConstantProvider {
'a',
'0 0,1',
radius,
svgPaths.point(-radius, -radius)
svgPaths.point(-radius, -radius),
);
/** SVG path for drawing the rounded bottom-right corner. */
@@ -870,7 +870,7 @@ export class ConstantProvider {
'a',
'0 0,1',
radius,
svgPaths.point(-radius, radius)
svgPaths.point(-radius, radius),
);
return {
@@ -935,12 +935,12 @@ export class ConstantProvider {
const embossFilter = dom.createSvgElement(
Svg.FILTER,
{'id': 'blocklyEmbossFilter' + this.randomIdentifier},
this.defs
this.defs,
);
dom.createSvgElement(
Svg.FEGAUSSIANBLUR,
{'in': 'SourceAlpha', 'stdDeviation': 1, 'result': 'blur'},
embossFilter
embossFilter,
);
const feSpecularLighting = dom.createSvgElement(
Svg.FESPECULARLIGHTING,
@@ -952,12 +952,12 @@ export class ConstantProvider {
'lighting-color': 'white',
'result': 'specOut',
},
embossFilter
embossFilter,
);
dom.createSvgElement(
Svg.FEPOINTLIGHT,
{'x': -5000, 'y': -10000, 'z': 20000},
feSpecularLighting
feSpecularLighting,
);
dom.createSvgElement(
Svg.FECOMPOSITE,
@@ -967,7 +967,7 @@ export class ConstantProvider {
'operator': 'in',
'result': 'specOut',
},
embossFilter
embossFilter,
);
dom.createSvgElement(
Svg.FECOMPOSITE,
@@ -980,7 +980,7 @@ export class ConstantProvider {
'k3': 1,
'k4': 0,
},
embossFilter
embossFilter,
);
this.embossFilterId = embossFilter.id;
this.embossFilter = embossFilter;
@@ -1000,17 +1000,17 @@ export class ConstantProvider {
'width': 10,
'height': 10,
},
this.defs
this.defs,
);
dom.createSvgElement(
Svg.RECT,
{'width': 10, 'height': 10, 'fill': '#aaa'},
disabledPattern
disabledPattern,
);
dom.createSvgElement(
Svg.PATH,
{'d': 'M 0 0 L 10 10 M 10 0 L 0 10', 'stroke': '#cc0'},
disabledPattern
disabledPattern,
);
this.disabledPatternId = disabledPattern.id;
this.disabledPattern = disabledPattern;
@@ -1034,18 +1034,18 @@ export class ConstantProvider {
'y': '-30%',
'x': '-40%',
},
this.defs
this.defs,
);
// Set all gaussian blur pixels to 1 opacity before applying flood
const debugComponentTransfer = dom.createSvgElement(
Svg.FECOMPONENTTRANSFER,
{'result': 'outBlur'},
debugFilter
debugFilter,
);
dom.createSvgElement(
Svg.FEFUNCA,
{'type': 'table', 'tableValues': '0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'},
debugComponentTransfer
debugComponentTransfer,
);
// Color the highlight
dom.createSvgElement(
@@ -1055,7 +1055,7 @@ export class ConstantProvider {
'flood-opacity': 0.5,
'result': 'outColor',
},
debugFilter
debugFilter,
);
dom.createSvgElement(
Svg.FECOMPOSITE,
@@ -1065,7 +1065,7 @@ export class ConstantProvider {
'operator': 'in',
'result': 'outGlow',
},
debugFilter
debugFilter,
);
this.debugFilterId = debugFilter.id;
this.debugFilter = debugFilter;

View File

@@ -189,7 +189,7 @@ export class Drawer {
(input.shape as Notch).pathRight +
svgPaths.lineOnAxis(
'h',
-(input.notchOffset - this.constants_.INSIDE_CORNERS.width)
-(input.notchOffset - this.constants_.INSIDE_CORNERS.width),
) +
this.constants_.INSIDE_CORNERS.pathTop;
@@ -243,7 +243,7 @@ export class Drawer {
this.outlinePath_ += svgPaths.lineOnAxis(
'V',
bottomRow.baseline - rightCornerYOffset
bottomRow.baseline - rightCornerYOffset,
);
this.outlinePath_ += outlinePath;
}
@@ -314,7 +314,7 @@ export class Drawer {
const svgGroup = (fieldInfo as Field).field.getSvgRoot()!;
svgGroup.setAttribute(
'transform',
'translate(' + xPos + ',' + yPos + ')' + scale
'translate(' + xPos + ',' + yPos + ')' + scale,
);
if (this.info_.isInsertionMarker) {
svgGroup.setAttribute('display', 'none');
@@ -366,7 +366,7 @@ export class Drawer {
}
input.connectionModel.setOffsetInBlock(
connX,
yPos + input.connectionOffsetY
yPos + input.connectionOffsetY,
);
}
}
@@ -437,7 +437,7 @@ export class Drawer {
const connX = this.info_.RTL ? -x : x;
this.block_.outputConnection.setOffsetInBlock(
connX,
this.info_.outputConnection.connectionOffsetY
this.info_.outputConnection.connectionOffsetY,
);
}
}

View File

@@ -237,7 +237,7 @@ export class RenderInfo {
this.topRow.hasPreviousConnection = true;
this.topRow.connection = new PreviousConnection(
this.constants_,
this.block_.previousConnection as RenderedConnection
this.block_.previousConnection as RenderedConnection,
);
this.topRow.elements.push(this.topRow.connection);
}
@@ -292,7 +292,7 @@ export class RenderInfo {
if (this.bottomRow.hasNextConnection) {
this.bottomRow.connection = new NextConnection(
this.constants_,
this.block_.nextConnection as RenderedConnection
this.block_.nextConnection as RenderedConnection,
);
this.bottomRow.elements.push(this.bottomRow.connection);
}
@@ -320,7 +320,7 @@ export class RenderInfo {
activeRow.hasInlineInput = true;
} else if (input instanceof StatementInput) {
activeRow.elements.push(
new StatementInputMeasurable(this.constants_, input)
new StatementInputMeasurable(this.constants_, input),
);
activeRow.hasStatement = true;
} else if (input instanceof ValueInput) {
@@ -333,7 +333,7 @@ export class RenderInfo {
activeRow.minHeight,
input.getSourceBlock() && input.getSourceBlock()!.isShadow()
? this.constants_.DUMMY_INPUT_SHADOW_MIN_HEIGHT
: this.constants_.DUMMY_INPUT_MIN_HEIGHT
: this.constants_.DUMMY_INPUT_MIN_HEIGHT,
);
activeRow.hasDummyInput = true;
}
@@ -380,8 +380,8 @@ export class RenderInfo {
row.elements.push(
new InRowSpacer(
this.constants_,
this.getInRowSpacing_(null, oldElems[0])
)
this.getInRowSpacing_(null, oldElems[0]),
),
);
}
if (!oldElems.length) {
@@ -398,8 +398,8 @@ export class RenderInfo {
row.elements.push(
new InRowSpacer(
this.constants_,
this.getInRowSpacing_(oldElems[oldElems.length - 1], null)
)
this.getInRowSpacing_(oldElems[oldElems.length - 1], null),
),
);
}
}
@@ -416,7 +416,7 @@ export class RenderInfo {
*/
protected getInRowSpacing_(
prev: Measurable | null,
next: Measurable | null
next: Measurable | null,
): number {
if (!prev) {
// Statement input padding.
@@ -468,12 +468,12 @@ export class RenderInfo {
const innerWidth = row.width - (statementInput?.width ?? 0);
widestStatementRowFields = Math.max(
widestStatementRowFields,
innerWidth
innerWidth,
);
}
widestRowWithConnectedBlocks = Math.max(
widestRowWithConnectedBlocks,
row.widthWithConnectedBlocks
row.widthWithConnectedBlocks,
);
}
@@ -588,7 +588,7 @@ export class RenderInfo {
row.width += desiredWidth - currentWidth;
row.widthWithConnectedBlocks = Math.max(
row.width,
this.statementEdge + row.connectedBlockWidths
this.statementEdge + row.connectedBlockWidths,
);
}
@@ -717,7 +717,7 @@ export class RenderInfo {
widestRowWithConnectedBlocks = Math.max(
widestRowWithConnectedBlocks,
row.widthWithConnectedBlocks
row.widthWithConnectedBlocks,
);
this.recordElemPositions_(row);
}
@@ -727,7 +727,7 @@ export class RenderInfo {
// Include width of connected block in value to stack width measurement.
widestRowWithConnectedBlocks = Math.max(
widestRowWithConnectedBlocks,
target.getHeightWidth().width
target.getHeightWidth().width,
);
}
}

View File

@@ -75,7 +75,7 @@ export class MarkerSvg {
constructor(
private readonly workspace: WorkspaceSvg,
constants: ConstantProvider,
private readonly marker: Marker
private readonly marker: Marker,
) {
this.constants_ = constants;
@@ -228,17 +228,17 @@ export class MarkerSvg {
if (block.previousConnection) {
const connectionShape = this.constants_.shapeFor(
block.previousConnection
block.previousConnection,
) as Notch;
this.positionPrevious_(
width,
markerOffset,
markerHeight,
connectionShape
connectionShape,
);
} else if (block.outputConnection) {
const connectionShape = this.constants_.shapeFor(
block.outputConnection
block.outputConnection,
) as PuzzleTab;
this.positionOutput_(width, height, connectionShape);
} else {
@@ -402,7 +402,7 @@ export class MarkerSvg {
protected positionBlock_(
width: number,
markerOffset: number,
markerHeight: number
markerHeight: number,
) {
const markerPath =
svgPaths.moveBy(-markerOffset, markerHeight) +
@@ -411,7 +411,7 @@ export class MarkerSvg {
svgPaths.lineOnAxis('V', markerHeight);
if (!this.markerBlock_) {
throw new Error(
'createDom should be called before positioning the marker'
'createDom should be called before positioning the marker',
);
}
this.markerBlock_.setAttribute('d', markerPath);
@@ -443,7 +443,7 @@ export class MarkerSvg {
',' +
y +
')' +
(this.workspace.RTL ? ' scale(-1 1)' : '')
(this.workspace.RTL ? ' scale(-1 1)' : ''),
);
this.currentMarkerSvg = this.markerInput_;
}
@@ -477,11 +477,11 @@ export class MarkerSvg {
protected positionOutput_(
width: number,
height: number,
connectionShape: PuzzleTab
connectionShape: PuzzleTab,
) {
if (!this.markerBlock_) {
throw new Error(
'createDom should be called before positioning the output'
'createDom should be called before positioning the output',
);
}
const markerPath =
@@ -512,11 +512,11 @@ export class MarkerSvg {
width: number,
markerOffset: number,
markerHeight: number,
connectionShape: Notch
connectionShape: Notch,
) {
if (!this.markerBlock_) {
throw new Error(
'createDom should be called before positioning the previous connection marker'
'createDom should be called before positioning the previous connection marker',
);
}
const markerPath =
@@ -590,7 +590,7 @@ export class MarkerSvg {
curBlock,
this.isCursor(),
oldNode,
curNode
curNode,
);
eventUtils.fire(event);
}
@@ -632,7 +632,7 @@ export class MarkerSvg {
'width': this.constants_.CURSOR_WS_WIDTH,
'height': this.constants_.WS_CURSOR_HEIGHT,
},
this.svgGroup_
this.svgGroup_,
);
// A horizontal line used to represent a workspace coordinate or next
@@ -644,7 +644,7 @@ export class MarkerSvg {
'height': this.constants_.WS_CURSOR_HEIGHT,
'style': 'display: none',
},
this.markerSvg_
this.markerSvg_,
);
// A filled in rectangle used to represent a stack.
@@ -656,14 +656,14 @@ export class MarkerSvg {
'ry': 10,
'style': 'display: none',
},
this.markerSvg_
this.markerSvg_,
);
// A filled in puzzle piece used to represent an input value.
this.markerInput_ = dom.createSvgElement(
Svg.PATH,
{'transform': '', 'style': 'display: none'},
this.markerSvg_
this.markerSvg_,
);
// A path used to represent a previous connection and a block, an output
@@ -676,7 +676,7 @@ export class MarkerSvg {
'fill': 'none',
'stroke-width': this.constants_.CURSOR_STROKE_WIDTH,
},
this.markerSvg_
this.markerSvg_,
);
// Markers and stack markers don't blink.
@@ -687,7 +687,7 @@ export class MarkerSvg {
dom.createSvgElement(
Svg.ANIMATE,
{...blinkProperties, attributeName: 'stroke'},
this.markerBlock_
this.markerBlock_,
);
}
@@ -707,7 +707,7 @@ export class MarkerSvg {
!this.markerBlock_
) {
throw new Error(
'createDom should be called before applying color to the markerj'
'createDom should be called before applying color to the markerj',
);
}
this.markerSvgLine_.setAttribute('fill', this.colour_);

View File

@@ -47,7 +47,7 @@ export class PathObject implements IPathObject {
constructor(
root: SVGElement,
style: BlockStyle,
constants: ConstantProvider
constants: ConstantProvider,
) {
this.constants = constants;
this.style = style;
@@ -57,7 +57,7 @@ export class PathObject implements IPathObject {
this.svgPath = dom.createSvgElement(
Svg.PATH,
{'class': 'blocklyPath'},
this.svgRoot
this.svgRoot,
);
}
@@ -165,7 +165,7 @@ export class PathObject implements IPathObject {
if (enable) {
this.svgPath.setAttribute(
'filter',
'url(#' + this.constants.embossFilterId + ')'
'url(#' + this.constants.embossFilterId + ')',
);
} else {
this.svgPath.setAttribute('filter', 'none');
@@ -194,7 +194,7 @@ export class PathObject implements IPathObject {
if (disabled) {
this.svgPath.setAttribute(
'fill',
'url(#' + this.constants.disabledPatternId + ')'
'url(#' + this.constants.disabledPatternId + ')',
);
}
}

View File

@@ -66,7 +66,7 @@ export class Renderer implements IRegistrable {
*/
init(
theme: Theme,
opt_rendererOverrides?: {[rendererConstant: string]: any}
opt_rendererOverrides?: {[rendererConstant: string]: any},
) {
this.constants_ = this.makeConstants_();
if (opt_rendererOverrides) {
@@ -90,7 +90,7 @@ export class Renderer implements IRegistrable {
this.constants_.createDom(
svg,
this.name + '-' + theme.name,
'.' + this.getClassName() + '.' + theme.getClassName()
'.' + this.getClassName() + '.' + theme.getClassName(),
);
}
@@ -212,7 +212,7 @@ export class Renderer implements IRegistrable {
protected orphanCanConnectAtEnd(
topBlock: BlockSvg,
orphanBlock: BlockSvg,
localType: number
localType: number,
): boolean {
const orphanConnection =
localType === ConnectionType.OUTPUT_VALUE
@@ -220,7 +220,7 @@ export class Renderer implements IRegistrable {
: orphanBlock.previousConnection;
return !!Connection.getConnectionForOrphanedConnection(
topBlock as Block,
orphanConnection as Connection
orphanConnection as Connection,
);
}
@@ -236,7 +236,7 @@ export class Renderer implements IRegistrable {
getConnectionPreviewMethod(
closest: RenderedConnection,
local: RenderedConnection,
topBlock: BlockSvg
topBlock: BlockSvg,
): PreviewType {
if (
local.type === ConnectionType.OUTPUT_VALUE ||
@@ -247,7 +247,7 @@ export class Renderer implements IRegistrable {
this.orphanCanConnectAtEnd(
topBlock,
closest.targetBlock() as BlockSvg,
local.type
local.type,
)
) {
return InsertionMarkerManager.PREVIEW_TYPE.INSERTION_MARKER;

View File

@@ -118,7 +118,7 @@ export class Drawer extends BaseDrawer {
}
input.connectionModel.setOffsetInBlock(
connX,
yPos + input.connectionOffsetY + this.constants_.DARK_PATH_OFFSET
yPos + input.connectionOffsetY + this.constants_.DARK_PATH_OFFSET,
);
}
}
@@ -134,7 +134,7 @@ export class Drawer extends BaseDrawer {
}
input.connectionModel.setOffsetInBlock(
connX,
row.yPos + this.constants_.DARK_PATH_OFFSET
row.yPos + this.constants_.DARK_PATH_OFFSET,
);
}
}
@@ -160,7 +160,7 @@ export class Drawer extends BaseDrawer {
(this.info_.RTL ? -x : x) + this.constants_.DARK_PATH_OFFSET / 2;
connInfo.connectionModel.setOffsetInBlock(
connX,
bottomRow.baseline + this.constants_.DARK_PATH_OFFSET
bottomRow.baseline + this.constants_.DARK_PATH_OFFSET,
);
}
}

View File

@@ -151,14 +151,14 @@ export class HighlightConstantProvider {
'a',
'0 0,0',
radius,
svgPaths.point(-distance45outside - offset, radius - distance45outside)
svgPaths.point(-distance45outside - offset, radius - distance45outside),
);
const pathBottomRtl = svgPaths.arc(
'a',
'0 0,0',
radius + offset,
svgPaths.point(radius + offset, radius + offset)
svgPaths.point(radius + offset, radius + offset),
);
const pathBottomLtr =
@@ -167,7 +167,7 @@ export class HighlightConstantProvider {
'a',
'0 0,0',
radius + offset,
svgPaths.point(radius - distance45outside, distance45outside + offset)
svgPaths.point(radius - distance45outside, distance45outside + offset),
);
return {
@@ -204,7 +204,7 @@ export class HighlightConstantProvider {
'a',
'0 0,1',
radius - offset,
svgPaths.point(radius - topLeftStartX, -topLeftStartY + offset)
svgPaths.point(radius - topLeftStartX, -topLeftStartY + offset),
);
/**
* SVG path for drawing the highlight on the rounded top-left corner.
@@ -215,7 +215,7 @@ export class HighlightConstantProvider {
'a',
'0 0,1',
radius - offset,
svgPaths.point(radius, -radius + offset)
svgPaths.point(radius, -radius + offset),
);
const bottomLeftStartX = distance45inside;
@@ -226,7 +226,7 @@ export class HighlightConstantProvider {
'a',
'0 0,1',
radius - offset,
svgPaths.point(-bottomLeftStartX + offset, -bottomLeftStartY - radius)
svgPaths.point(-bottomLeftStartX + offset, -bottomLeftStartY - radius),
);
return {

View File

@@ -111,7 +111,7 @@ export class Highlighter {
// move.
this.steps_ += svgPaths.lineOnAxis(
'H',
elem.xPos + elem.width - this.highlightOffset
elem.xPos + elem.width - this.highlightOffset,
);
}
}
@@ -147,7 +147,7 @@ export class Highlighter {
this.steps_ +=
svgPaths.moveTo(
input.xPos + input.width - this.highlightOffset,
row.yPos
row.yPos,
) +
this.puzzleTabPaths_.pathDown(this.RTL_) +
svgPaths.lineOnAxis('v', belowTabHeight);
@@ -175,7 +175,7 @@ export class Highlighter {
this.insideCornerPaths_.pathBottom(this.RTL_) +
svgPaths.lineTo(
row.width - input.xPos - this.insideCornerPaths_.width,
0
0,
);
} else {
this.steps_ +=
@@ -183,7 +183,7 @@ export class Highlighter {
this.insideCornerPaths_.pathBottom(this.RTL_) +
svgPaths.lineTo(
row.width - input.xPos - this.insideCornerPaths_.width,
0
0,
);
}
}
@@ -203,7 +203,7 @@ export class Highlighter {
if (row.height > this.highlightOffset) {
this.steps_ += svgPaths.lineOnAxis(
'V',
row.yPos + row.height - this.highlightOffset
row.yPos + row.height - this.highlightOffset,
);
}
}
@@ -220,14 +220,14 @@ export class Highlighter {
if (this.RTL_) {
this.steps_ += svgPaths.lineOnAxis(
'V',
row.baseline - this.highlightOffset
row.baseline - this.highlightOffset,
);
} else {
const cornerElem = this.info_.bottomRow.elements[0];
if (Types.isLeftSquareCorner(cornerElem)) {
this.steps_ += svgPaths.moveTo(
row.xPos + this.highlightOffset,
row.baseline - this.highlightOffset
row.baseline - this.highlightOffset,
);
} else if (Types.isLeftRoundedCorner(cornerElem)) {
this.steps_ += svgPaths.moveTo(row.xPos, row.baseline);
@@ -261,12 +261,12 @@ export class Highlighter {
if (Types.isLeftRoundedCorner(topRow.elements[0])) {
this.steps_ += svgPaths.lineOnAxis(
'V',
this.outsideCornerPaths_.height
this.outsideCornerPaths_.height,
);
} else {
this.steps_ += svgPaths.lineOnAxis(
'V',
topRow.capline + this.highlightOffset
topRow.capline + this.highlightOffset,
);
}
}

View File

@@ -84,7 +84,7 @@ export class RenderInfo extends BaseRenderInfo {
activeRow.hasInlineInput = true;
} else if (input instanceof StatementInput) {
activeRow.elements.push(
new StatementInputMeasurable(this.constants_, input)
new StatementInputMeasurable(this.constants_, input),
);
activeRow.hasStatement = true;
} else if (input instanceof ValueInput) {
@@ -95,7 +95,7 @@ export class RenderInfo extends BaseRenderInfo {
// still important.
activeRow.minHeight = Math.max(
activeRow.minHeight,
this.constants_.DUMMY_INPUT_MIN_HEIGHT
this.constants_.DUMMY_INPUT_MIN_HEIGHT,
);
activeRow.hasDummyInput = true;
}
@@ -121,8 +121,8 @@ export class RenderInfo extends BaseRenderInfo {
row.elements.push(
new InRowSpacer(
this.constants_,
this.getInRowSpacing_(null, oldElems[0])
)
this.getInRowSpacing_(null, oldElems[0]),
),
);
}
if (!oldElems.length) {
@@ -137,7 +137,7 @@ export class RenderInfo extends BaseRenderInfo {
if (row.endsWithElemSpacer()) {
let spacing = this.getInRowSpacing_(
oldElems[oldElems.length - 1],
null
null,
);
if (hasExternalInputs && row.hasDummyInput) {
spacing += this.constants_.TAB_WIDTH;
@@ -398,7 +398,7 @@ export class RenderInfo extends BaseRenderInfo {
const currentWidth = row.width;
const desiredWidth = Math.max(
prevRightEdge,
rowNextRightEdges.get(row)
rowNextRightEdges.get(row),
);
const missingSpace = desiredWidth - currentWidth;
if (missingSpace > 0) {
@@ -432,7 +432,7 @@ export class RenderInfo extends BaseRenderInfo {
widestRowWithConnectedBlocks = Math.max(
widestRowWithConnectedBlocks,
row.widthWithConnectedBlocks
row.widthWithConnectedBlocks,
);
// Add padding to the bottom row if block height is less than minimum
const heightWithoutHat = yCursor - this.topRow.ascenderHeight;
@@ -457,7 +457,7 @@ export class RenderInfo extends BaseRenderInfo {
// Include width of connected block in value to stack width measurement.
widestRowWithConnectedBlocks = Math.max(
widestRowWithConnectedBlocks,
target.getHeightWidth().width - this.constants_.DARK_PATH_OFFSET
target.getHeightWidth().width - this.constants_.DARK_PATH_OFFSET,
);
}
}

View File

@@ -37,7 +37,7 @@ export class PathObject extends BasePathObject {
constructor(
root: SVGElement,
style: BlockStyle,
public override constants: ConstantProvider
public override constants: ConstantProvider,
) {
super(root, style, constants);
@@ -55,7 +55,7 @@ export class PathObject extends BasePathObject {
this.svgPathLight = dom.createSvgElement(
Svg.PATH,
{'class': 'blocklyPathLight'},
this.svgRoot
this.svgRoot,
);
}
@@ -86,7 +86,7 @@ export class PathObject extends BasePathObject {
if (!this.style.colourTertiary) {
throw new Error(
'The renderer did not properly initialize the tertiary colour of ' +
'the block style'
'the block style',
);
}
this.svgPathLight.setAttribute('stroke', this.style.colourTertiary);
@@ -107,7 +107,7 @@ export class PathObject extends BasePathObject {
if (highlighted) {
this.svgPath.setAttribute(
'filter',
'url(#' + this.constants.embossFilterId + ')'
'url(#' + this.constants.embossFilterId + ')',
);
this.svgPathLight.style.display = 'none';
} else {
@@ -122,7 +122,7 @@ export class PathObject extends BasePathObject {
if (!this.style.colourSecondary) {
throw new Error(
'The renderer did not properly initialize the secondary colour ' +
'of the block style block style'
'of the block style block style',
);
}
this.svgPathDark.setAttribute('fill', this.style.colourSecondary);

View File

@@ -44,7 +44,7 @@ export class Renderer extends BaseRenderer {
*/
override init(
theme: Theme,
opt_rendererOverrides?: {[rendererConstant: string]: any}
opt_rendererOverrides?: {[rendererConstant: string]: any},
) {
super.init(theme, opt_rendererOverrides);
this.highlightConstants = this.makeHighlightConstants_();
@@ -80,7 +80,7 @@ export class Renderer extends BaseRenderer {
*/
protected override makeDrawer_(
block: BlockSvg,
info: BaseRenderInfo
info: BaseRenderInfo,
): Drawer {
return new Drawer(block, info as RenderInfo);
}
@@ -115,7 +115,7 @@ export class Renderer extends BaseRenderer {
if (!this.highlightConstants) {
throw new Error(
'Cannot access the highlight constants because init has not ' +
'been called'
'been called',
);
}
return this.highlightConstants;

View File

@@ -29,7 +29,7 @@ export class Connection extends Measurable {
*/
constructor(
constants: ConstantProvider,
public connectionModel: RenderedConnection
public connectionModel: RenderedConnection,
) {
super(constants);

View File

@@ -33,7 +33,7 @@ export class Field extends Measurable {
constructor(
constants: ConstantProvider,
public field: BlocklyField,
public parentInput: Input
public parentInput: Input,
) {
super(constants);

View File

@@ -34,7 +34,10 @@ export class Icon extends Measurable {
* @param constants The rendering constants provider.
* @param icon The icon to measure and store information for.
*/
constructor(constants: ConstantProvider, public icon: BlocklyIcon) {
constructor(
constants: ConstantProvider,
public icon: BlocklyIcon,
) {
super(constants);
this.isVisible = hasBubble(icon) && icon.bubbleIsVisible();

View File

@@ -31,7 +31,10 @@ export class InputConnection extends Connection {
* @param constants The rendering constants provider.
* @param input The input to measure and store information for.
*/
constructor(constants: ConstantProvider, public input: Input) {
constructor(
constants: ConstantProvider,
public input: Input,
) {
super(constants, input.connection as RenderedConnection);
this.type |= Types.INPUT;

View File

@@ -25,7 +25,7 @@ export class NextConnection extends Connection {
*/
constructor(
constants: ConstantProvider,
connectionModel: RenderedConnection
connectionModel: RenderedConnection,
) {
super(constants, connectionModel);
this.type |= Types.NEXT_CONNECTION;

View File

@@ -29,7 +29,7 @@ export class OutputConnection extends Connection {
*/
constructor(
constants: ConstantProvider,
connectionModel: RenderedConnection
connectionModel: RenderedConnection,
) {
super(constants, connectionModel);
this.type |= Types.OUTPUT_CONNECTION;

View File

@@ -25,7 +25,7 @@ export class PreviousConnection extends Connection {
*/
constructor(
constants: ConstantProvider,
connectionModel: RenderedConnection
connectionModel: RenderedConnection,
) {
super(constants, connectionModel);
this.type |= Types.PREVIOUS_CONNECTION;

View File

@@ -32,7 +32,7 @@ export class SpacerRow extends Row {
constructor(
constants: ConstantProvider,
public override height: number,
public override width: number
public override width: number,
) {
super(constants);
this.type |= Types.SPACER | Types.BETWEEN_ROW_SPACER;

View File

@@ -28,7 +28,7 @@ export class ConstantProvider extends BaseConstantProvider {
'Blockly.minimalist.ConstantProvider',
'v10',
'v11',
'Blockly.blockRendering.ConstantProvider'
'Blockly.blockRendering.ConstantProvider',
);
}
}

View File

@@ -34,7 +34,7 @@ export class Drawer extends BaseDrawer {
'Blockly.minimalist.Drawer',
'v10',
'v11',
'Blockly.blockRendering.Drawer'
'Blockly.blockRendering.Drawer',
);
}
}

View File

@@ -39,7 +39,7 @@ export class RenderInfo extends BaseRenderInfo {
'Blockly.minimalist.RenderInfo',
'v10',
'v11',
'Blockly.blockRendering.RenderInfo'
'Blockly.blockRendering.RenderInfo',
);
}

View File

@@ -35,7 +35,7 @@ export class Renderer extends BaseRenderer {
'Blockly.minimalist.Renderer',
'v10',
'v11',
'Blockly.blockRendering.Renderer'
'Blockly.blockRendering.Renderer',
);
}
@@ -68,7 +68,7 @@ export class Renderer extends BaseRenderer {
*/
protected override makeDrawer_(
block: BlockSvg,
info: BaseRenderInfo
info: BaseRenderInfo,
): Drawer {
return new Drawer(block, info as RenderInfo);
}

View File

@@ -66,8 +66,8 @@ export class RenderInfo extends BaseRenderInfo {
row.elements.push(
new InRowSpacer(
this.constants_,
this.getInRowSpacing_(null, oldElems[0])
)
this.getInRowSpacing_(null, oldElems[0]),
),
);
}
if (!oldElems.length) {
@@ -82,7 +82,7 @@ export class RenderInfo extends BaseRenderInfo {
if (row.endsWithElemSpacer()) {
let spacing = this.getInRowSpacing_(
oldElems[oldElems.length - 1],
null
null,
);
if (hasExternalInputs && row.hasDummyInput) {
spacing += this.constants_.TAB_WIDTH;
@@ -290,7 +290,7 @@ export class RenderInfo extends BaseRenderInfo {
widestRowWithConnectedBlocks = Math.max(
widestRowWithConnectedBlocks,
row.widthWithConnectedBlocks
row.widthWithConnectedBlocks,
);
// Add padding to the bottom row if block height is less than minimum
const heightWithoutHat = yCursor - this.topRow.ascenderHeight;
@@ -315,7 +315,7 @@ export class RenderInfo extends BaseRenderInfo {
// Include width of connected block in value to stack width measurement.
widestRowWithConnectedBlocks = Math.max(
widestRowWithConnectedBlocks,
target.getHeightWidth().width
target.getHeightWidth().width,
);
}
}

View File

@@ -254,7 +254,7 @@ export class ConstantProvider extends BaseConstantProvider {
theme.getComponentStyle('selectedGlowColour') ||
this.SELECTED_GLOW_COLOUR;
const selectedGlowSize = Number(
theme.getComponentStyle('selectedGlowSize')
theme.getComponentStyle('selectedGlowSize'),
);
this.SELECTED_GLOW_SIZE =
selectedGlowSize && !isNaN(selectedGlowSize)
@@ -264,7 +264,7 @@ export class ConstantProvider extends BaseConstantProvider {
theme.getComponentStyle('replacementGlowColour') ||
this.REPLACEMENT_GLOW_COLOUR;
const replacementGlowSize = Number(
theme.getComponentStyle('replacementGlowSize')
theme.getComponentStyle('replacementGlowSize'),
);
this.REPLACEMENT_GLOW_SIZE =
replacementGlowSize && !isNaN(replacementGlowSize)
@@ -387,7 +387,7 @@ export class ConstantProvider extends BaseConstantProvider {
function makeMainPath(
blockHeight: number,
up: boolean,
right: boolean
right: boolean,
): string {
const remainingHeight =
blockHeight > maxHeight ? blockHeight - maxHeight : 0;
@@ -398,14 +398,14 @@ export class ConstantProvider extends BaseConstantProvider {
'a',
'0 0,1',
radius,
svgPaths.point((up ? -1 : 1) * radius, (up ? -1 : 1) * radius)
svgPaths.point((up ? -1 : 1) * radius, (up ? -1 : 1) * radius),
) +
svgPaths.lineOnAxis('v', (right ? 1 : -1) * remainingHeight) +
svgPaths.arc(
'a',
'0 0,1',
radius,
svgPaths.point((up ? 1 : -1) * radius, (up ? -1 : 1) * radius)
svgPaths.point((up ? 1 : -1) * radius, (up ? -1 : 1) * radius),
)
);
}
@@ -471,14 +471,14 @@ export class ConstantProvider extends BaseConstantProvider {
'a',
'0 0,1',
radius,
svgPaths.point((up ? -1 : 1) * radius, (up ? -1 : 1) * radius)
svgPaths.point((up ? -1 : 1) * radius, (up ? -1 : 1) * radius),
) +
svgPaths.lineOnAxis('v', (right ? 1 : -1) * innerHeight) +
svgPaths.arc(
'a',
'0 0,1',
radius,
svgPaths.point((up ? 1 : -1) * radius, (up ? -1 : 1) * radius)
svgPaths.point((up ? 1 : -1) * radius, (up ? -1 : 1) * radius),
)
);
}
@@ -617,28 +617,28 @@ export class ConstantProvider extends BaseConstantProvider {
'a',
'0 0,0',
radius,
svgPaths.point(-radius, radius)
svgPaths.point(-radius, radius),
);
const innerTopRightCorner = svgPaths.arc(
'a',
'0 0,1',
radius,
svgPaths.point(-radius, radius)
svgPaths.point(-radius, radius),
);
const innerBottomLeftCorner = svgPaths.arc(
'a',
'0 0,0',
radius,
svgPaths.point(radius, radius)
svgPaths.point(radius, radius),
);
const innerBottomRightCorner = svgPaths.arc(
'a',
'0 0,1',
radius,
svgPaths.point(radius, radius)
svgPaths.point(radius, radius),
);
return {
@@ -680,23 +680,23 @@ export class ConstantProvider extends BaseConstantProvider {
'y': '-30%',
'x': '-40%',
},
defs
defs,
);
dom.createSvgElement(
Svg.FEGAUSSIANBLUR,
{'in': 'SourceGraphic', 'stdDeviation': this.SELECTED_GLOW_SIZE},
selectedGlowFilter
selectedGlowFilter,
);
// Set all gaussian blur pixels to 1 opacity before applying flood
const selectedComponentTransfer = dom.createSvgElement(
Svg.FECOMPONENTTRANSFER,
{'result': 'outBlur'},
selectedGlowFilter
selectedGlowFilter,
);
dom.createSvgElement(
Svg.FEFUNCA,
{'type': 'table', 'tableValues': '0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'},
selectedComponentTransfer
selectedComponentTransfer,
);
// Color the highlight
dom.createSvgElement(
@@ -706,7 +706,7 @@ export class ConstantProvider extends BaseConstantProvider {
'flood-opacity': 1,
'result': 'outColor',
},
selectedGlowFilter
selectedGlowFilter,
);
dom.createSvgElement(
Svg.FECOMPOSITE,
@@ -716,7 +716,7 @@ export class ConstantProvider extends BaseConstantProvider {
'operator': 'in',
'result': 'outGlow',
},
selectedGlowFilter
selectedGlowFilter,
);
this.selectedGlowFilterId = selectedGlowFilter.id;
this.selectedGlowFilter = selectedGlowFilter;
@@ -732,23 +732,23 @@ export class ConstantProvider extends BaseConstantProvider {
'y': '-30%',
'x': '-40%',
},
defs
defs,
);
dom.createSvgElement(
Svg.FEGAUSSIANBLUR,
{'in': 'SourceGraphic', 'stdDeviation': this.REPLACEMENT_GLOW_SIZE},
replacementGlowFilter
replacementGlowFilter,
);
// Set all gaussian blur pixels to 1 opacity before applying flood
const replacementComponentTransfer = dom.createSvgElement(
Svg.FECOMPONENTTRANSFER,
{'result': 'outBlur'},
replacementGlowFilter
replacementGlowFilter,
);
dom.createSvgElement(
Svg.FEFUNCA,
{'type': 'table', 'tableValues': '0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'},
replacementComponentTransfer
replacementComponentTransfer,
);
// Color the highlight
dom.createSvgElement(
@@ -758,7 +758,7 @@ export class ConstantProvider extends BaseConstantProvider {
'flood-opacity': 1,
'result': 'outColor',
},
replacementGlowFilter
replacementGlowFilter,
);
dom.createSvgElement(
Svg.FECOMPOSITE,
@@ -768,7 +768,7 @@ export class ConstantProvider extends BaseConstantProvider {
'operator': 'in',
'result': 'outGlow',
},
replacementGlowFilter
replacementGlowFilter,
);
dom.createSvgElement(
Svg.FECOMPOSITE,
@@ -777,7 +777,7 @@ export class ConstantProvider extends BaseConstantProvider {
'in2': 'outGlow',
'operator': 'over',
},
replacementGlowFilter
replacementGlowFilter,
);
this.replacementGlowFilterId = replacementGlowFilter.id;
this.replacementGlowFilter = replacementGlowFilter;

View File

@@ -126,7 +126,7 @@ export class Drawer extends BaseDrawer {
protected drawRightDynamicConnection_() {
if (!this.info_.outputConnection) {
throw new Error(
`Cannot draw the output connection of a block that doesn't have one`
`Cannot draw the output connection of a block that doesn't have one`,
);
}
this.outlinePath_ += (
@@ -140,7 +140,7 @@ export class Drawer extends BaseDrawer {
protected drawLeftDynamicConnection_() {
if (!this.info_.outputConnection) {
throw new Error(
`Cannot draw the output connection of a block that doesn't have one`
`Cannot draw the output connection of a block that doesn't have one`,
);
}
this.positionOutputConnection_();

View File

@@ -149,7 +149,7 @@ export class RenderInfo extends BaseRenderInfo {
override getInRowSpacing_(
prev: Measurable | null,
next: Measurable | null
next: Measurable | null,
): number {
if (!prev || !next) {
// No need for padding at the beginning or end of the row if the
@@ -205,7 +205,7 @@ export class RenderInfo extends BaseRenderInfo {
(!this.outputConnection || this.hasStatementInput)
) {
return Math.abs(
this.constants_.NOTCH_HEIGHT - this.constants_.CORNER_RADIUS
this.constants_.NOTCH_HEIGHT - this.constants_.CORNER_RADIUS,
);
}
return this.constants_.NO_PADDING;
@@ -218,13 +218,13 @@ export class RenderInfo extends BaseRenderInfo {
this.topRow.minHeight,
Math.max(
this.constants_.NOTCH_HEIGHT,
this.constants_.CORNER_RADIUS
)
this.constants_.CORNER_RADIUS,
),
) - this.constants_.CORNER_RADIUS;
return topHeight;
} else if (!bottomRow.hasNextConnection && this.hasStatementInput) {
return Math.abs(
this.constants_.NOTCH_HEIGHT - this.constants_.CORNER_RADIUS
this.constants_.NOTCH_HEIGHT - this.constants_.CORNER_RADIUS,
);
}
return this.constants_.NO_PADDING;
@@ -278,7 +278,7 @@ export class RenderInfo extends BaseRenderInfo {
} else if (input instanceof StatementInput) {
// Handle statements without next connections correctly.
activeRow.elements.push(
new StatementInputMeasurable(this.constants_, input)
new StatementInputMeasurable(this.constants_, input),
);
activeRow.hasStatement = true;

View File

@@ -36,7 +36,7 @@ export class MarkerSvg extends BaseMarkerSvg {
constructor(
workspace: WorkspaceSvg,
constants: BaseConstantProvider,
marker: Marker
marker: Marker,
) {
super(workspace, constants, marker);
}
@@ -120,7 +120,7 @@ export class MarkerSvg extends BaseMarkerSvg {
'style': 'display: none',
'stroke-width': this.constants_.CURSOR_STROKE_WIDTH,
},
this.markerSvg_
this.markerSvg_,
);
// Markers and stack cursors don't blink.

View File

@@ -51,7 +51,7 @@ export class PathObject extends BasePathObject {
constructor(
root: SVGElement,
style: BlockStyle,
constants: ConstantProvider
constants: ConstantProvider,
) {
super(root, style, constants);
@@ -95,7 +95,7 @@ export class PathObject extends BasePathObject {
this.svgPathSelected.setAttribute('fill', 'none');
this.svgPathSelected.setAttribute(
'filter',
'url(#' + this.constants.selectedGlowFilterId + ')'
'url(#' + this.constants.selectedGlowFilterId + ')',
);
this.svgRoot.appendChild(this.svgPathSelected);
}
@@ -112,7 +112,7 @@ export class PathObject extends BasePathObject {
if (enable) {
this.svgPath.setAttribute(
'filter',
'url(#' + this.constants.replacementGlowFilterId + ')'
'url(#' + this.constants.replacementGlowFilterId + ')',
);
} else {
this.svgPath.removeAttribute('filter');
@@ -128,7 +128,7 @@ export class PathObject extends BasePathObject {
if (enable) {
outlinePath.setAttribute(
'filter',
'url(#' + this.constants.replacementGlowFilterId + ')'
'url(#' + this.constants.replacementGlowFilterId + ')',
);
} else {
outlinePath.removeAttribute('filter');
@@ -190,8 +190,8 @@ export class PathObject extends BasePathObject {
// default
'd': '',
},
this.svgRoot
)
this.svgRoot,
),
);
}
this.remainingOutlines.delete(name);

View File

@@ -70,7 +70,7 @@ export class Renderer extends BaseRenderer {
*/
protected override makeDrawer_(
block: BlockSvg,
info: BaseRenderInfo
info: BaseRenderInfo,
): Drawer {
return new Drawer(block, info as RenderInfo);
}
@@ -84,7 +84,7 @@ export class Renderer extends BaseRenderer {
*/
override makeMarkerDrawer(
workspace: WorkspaceSvg,
marker: Marker
marker: Marker,
): MarkerSvg {
return new MarkerSvg(workspace, this.getConstants(), marker);
}
@@ -120,7 +120,7 @@ export class Renderer extends BaseRenderer {
override getConnectionPreviewMethod(
closest: RenderedConnection,
local: RenderedConnection,
topBlock: BlockSvg
topBlock: BlockSvg,
) {
if (local.type === ConnectionType.OUTPUT_VALUE) {
if (!closest.isConnected()) {