From e06aa02e54ca5bce1e0c26a3e3a29d9d0914ed1e Mon Sep 17 00:00:00 2001 From: ericblackmonGoogle <129398736+ericblackmonGoogle@users.noreply.github.com> Date: Mon, 17 Jul 2023 20:30:19 +0000 Subject: [PATCH 1/8] release: v10.0.2 #7295 and #7297 (#7298) * fix(generators): Changes to exports and access controls for TypeScript compatibility (#7295) * fix(generators): Add missing declarations for Order enums * chore(generators): Remove spurious whitespace * fix(generators): Make provideFunction_ etc. public Remove the protected declaration on provideFunction_ and FUNCTION_NAME_PLACEHOLDER_ so they can be used from generator functions written in TypeScript. Not strictly part of #7283, but closely related and required to fixing the related issue google/blockly-samples#1785. * chore(generators): format (cherry picked from commit d503fbb409e58d80a3a4db89ec603532505e8663) * fix: Correct errors in `HSV_SATURATION`, `HSV_VALUE` accessors (#7297) * fix: Correct errors in HSV_SATURATION, HSV_VALUE accessors Fix the comment / message errors noted in https://github.com/google/blockly/pull/7249#issuecomment-1638645810 * chore: Add renamings for HSV_SATURATION, HSV_VALUE (cherry picked from commit 1bc4f67d78cc88c15a4e55d7d102743db1e04a4c) * release: Update version number to 10.0.2 --------- Co-authored-by: Christopher Allen --- core/generator.ts | 7 ++--- core/main.js | 14 +++++----- generators/python/python_generator.js | 36 ++++++++++++------------ package-lock.json | 4 +-- package.json | 2 +- scripts/migration/renamings.json5 | 18 ++++++++++++ typings/dart.d.ts | 21 ++++++++++++++ typings/javascript.d.ts | 38 +++++++++++++++++++++++++ typings/lua.d.ts | 15 ++++++++++ typings/php.d.ts | 40 +++++++++++++++++++++++++++ typings/python.d.ts | 24 ++++++++++++++++ 11 files changed, 186 insertions(+), 33 deletions(-) diff --git a/core/generator.ts b/core/generator.ts index 2485e5898..28d6d1f76 100644 --- a/core/generator.ts +++ b/core/generator.ts @@ -49,7 +49,7 @@ export class CodeGenerator { * legitimately appear in a function definition (or comment), and it must * not confuse the regular expression parser. */ - protected FUNCTION_NAME_PLACEHOLDER_ = '{leCUI8hutHZI4480Dc}'; + FUNCTION_NAME_PLACEHOLDER_ = '{leCUI8hutHZI4480Dc}'; FUNCTION_NAME_PLACEHOLDER_REGEXP_: RegExp; /** @@ -471,10 +471,7 @@ export class CodeGenerator { * @returns The actual name of the new function. This may differ from * desiredName if the former has already been taken by the user. */ - protected provideFunction_( - desiredName: string, - code: string[] | string - ): string { + provideFunction_(desiredName: string, code: string[] | string): string { if (!this.definitions_[desiredName]) { const functionName = this.nameDB_!.getDistinctName( desiredName, diff --git a/core/main.js b/core/main.js index 0b8e1a171..cc83733d4 100644 --- a/core/main.js +++ b/core/main.js @@ -32,8 +32,8 @@ Object.defineProperties(Blockly, { * Must be in the range of 0 (inclusive) to 1 (exclusive). * @name Blockly.HSV_SATURATION * @type {number} - * @deprecated Use Blockly.colour.getHsvSaturation() / .setHsvSaturation( - * instead. (July 2023) + * @deprecated Use Blockly.utils.colour.getHsvSaturation() / + * .setHsvSaturation() instead. (July 2023) * @suppress {checkTypes} */ HSV_SATURATION: { @@ -42,7 +42,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_SATURATION', 'version 10', 'version 11', - 'Blockly.colour.getHsvSaturation()' + 'Blockly.utils.colour.getHsvSaturation()' ); return colour.getHsvSaturation(); }, @@ -51,7 +51,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_SATURATION', 'version 10', 'version 11', - 'Blockly.colour.setHsvSaturation()' + 'Blockly.utils.colour.setHsvSaturation()' ); colour.setHsvSaturation(newValue); }, @@ -61,7 +61,7 @@ Object.defineProperties(Blockly, { * Must be in the range of 0 (inclusive) to 1 (exclusive). * @name Blockly.HSV_VALUE * @type {number} - * @deprecated Use Blockly.colour.getHsvValue() / .setHsvValue instead. + * @deprecated Use Blockly.utils.colour.getHsvValue() / .setHsvValue instead. * (July 2023) * @suppress {checkTypes} */ @@ -71,7 +71,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_VALUE', 'version 10', 'version 11', - 'Blockly.colour.getHsvValue()' + 'Blockly.utils.colour.getHsvValue()' ); return colour.getHsvValue(); }, @@ -80,7 +80,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_VALUE', 'version 10', 'version 11', - 'Blockly.colour.setHsvValue()' + 'Blockly.utils.colour.setHsvValue()' ); colour.setHsvValue(newValue); }, diff --git a/generators/python/python_generator.js b/generators/python/python_generator.js index 5897b4366..2f0aabe0c 100644 --- a/generators/python/python_generator.js +++ b/generators/python/python_generator.js @@ -72,7 +72,7 @@ export class PythonGenerator extends CodeGenerator { // (foo.bar)() -> foo.bar() // (foo[0])() -> foo[0]() [Order.MEMBER, Order.FUNCTION_CALL], - + // not (not foo) -> not not foo [Order.LOGICAL_NOT, Order.LOGICAL_NOT], // a and (b and c) -> a and b and c @@ -80,7 +80,7 @@ export class PythonGenerator extends CodeGenerator { // a or (b or c) -> a or b or c [Order.LOGICAL_OR, Order.LOGICAL_OR] ]; - + constructor(name) { super(name ?? 'Python'); this.isInitialized = false; @@ -143,7 +143,7 @@ export class PythonGenerator extends CodeGenerator { 'vars,xrange,zip' ); } - + /** * Initialise the database of variable names. * @param {!Workspace} workspace Workspace to generate code from. @@ -151,22 +151,22 @@ export class PythonGenerator extends CodeGenerator { */ init(workspace) { super.init(workspace); - + /** * Empty loops or conditionals are not allowed in Python. */ this.PASS = this.INDENT + 'pass\n'; - + if (!this.nameDB_) { this.nameDB_ = new Names(this.RESERVED_WORDS_); } else { this.nameDB_.reset(); } - + this.nameDB_.setVariableMap(workspace.getVariableMap()); this.nameDB_.populateVariables(workspace); this.nameDB_.populateProcedures(workspace); - + const defvars = []; // Add developer variables (not created or named by the user). const devVarList = Variables.allDeveloperVariables(workspace); @@ -175,7 +175,7 @@ export class PythonGenerator extends CodeGenerator { this.nameDB_.getName(devVarList[i], Names.DEVELOPER_VARIABLE_TYPE) + ' = None'); } - + // Add user variables, but only ones that are being used. const variables = Variables.allUsedVarModels(workspace); for (let i = 0; i < variables.length; i++) { @@ -183,11 +183,11 @@ export class PythonGenerator extends CodeGenerator { this.nameDB_.getName(variables[i].getId(), NameType.VARIABLE) + ' = None'); } - + this.definitions_['variables'] = defvars.join('\n'); this.isInitialized = true; } - + /** * Prepend the generated code with import statements and variable definitions. * @param {string} code Generated code. @@ -208,12 +208,12 @@ export class PythonGenerator extends CodeGenerator { // Call Blockly.CodeGenerator's finish. code = super.finish(code); this.isInitialized = false; - + this.nameDB_.reset(); const allDefs = imports.join('\n') + '\n\n' + definitions.join('\n\n'); return allDefs.replace(/\n\n+/g, '\n\n').replace(/\n*$/, '\n\n\n') + code; } - + /** * Naked values are top-level blocks with outputs that aren't plugged into * anything. @@ -223,7 +223,7 @@ export class PythonGenerator extends CodeGenerator { scrubNakedValue(line) { return line + '\n'; } - + /** * Encode a string as a properly escaped Python string, complete with quotes. * @param {string} string Text to encode. @@ -232,7 +232,7 @@ export class PythonGenerator extends CodeGenerator { */ quote_(string) { string = string.replace(/\\/g, '\\\\').replace(/\n/g, '\\\n'); - + // Follow the CPython behaviour of repr() for a non-byte string. let quote = '\''; if (string.indexOf('\'') !== -1) { @@ -244,7 +244,7 @@ export class PythonGenerator extends CodeGenerator { } return quote + string + quote; } - + /** * Encode a string as a properly escaped multiline Python string, complete * with quotes. @@ -258,7 +258,7 @@ export class PythonGenerator extends CodeGenerator { // + '\n' + return lines.join(' + \'\\n\' + \n'); } - + /** * Common tasks for generating Python from blocks. * Handles comments for the specified block and any connected value blocks. @@ -297,7 +297,7 @@ export class PythonGenerator extends CodeGenerator { const nextCode = opt_thisOnly ? '' : this.blockToCode(nextBlock); return commentCode + code + nextCode; } - + /** * Gets a property and adjusts the value, taking into account indexing. * If a static int, casts to an integer, otherwise returns a code string. @@ -315,7 +315,7 @@ export class PythonGenerator extends CodeGenerator { const defaultAtIndex = block.workspace.options.oneBasedIndex ? '1' : '0'; const atOrder = delta ? this.ORDER_ADDITIVE : this.ORDER_NONE; let at = this.valueToCode(block, atId, atOrder) || defaultAtIndex; - + if (stringUtils.isNumber(at)) { // If the index is a naked number, adjust it right now. at = parseInt(at, 10) + delta; diff --git a/package-lock.json b/package-lock.json index 7cbd2c50a..78724a455 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "blockly", - "version": "10.0.1", + "version": "10.0.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "blockly", - "version": "10.0.1", + "version": "10.0.2", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index a5c91d25f..354553b55 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blockly", - "version": "10.0.1", + "version": "10.0.2", "description": "Blockly is a library for building visual programming editors.", "keywords": [ "blockly" diff --git a/scripts/migration/renamings.json5 b/scripts/migration/renamings.json5 index ee1c33834..97fbc3fc0 100644 --- a/scripts/migration/renamings.json5 +++ b/scripts/migration/renamings.json5 @@ -1577,5 +1577,23 @@ }, ], + '10.0.1': [ + { + oldName: 'Blockly', + exports: { + HSV_SATURATION: { + newModule: 'Blockly.utils.colour', + getMethod: 'getHsvSaturation', + setMethod: 'setHsvSaturation', + }, + HSV_VALUE: { + newModule: 'Blockly.utils.colour', + getMethod: 'getHsvValue', + setMethod: 'setHsvValue', + }, + }, + }, + ], + 'develop': [], } diff --git a/typings/dart.d.ts b/typings/dart.d.ts index a547e00fe..4dda479a4 100644 --- a/typings/dart.d.ts +++ b/typings/dart.d.ts @@ -4,4 +4,25 @@ * SPDX-License-Identifier: Apache-2.0 */ +export enum Order { + ATOMIC = 0, // 0 "" ... + UNARY_POSTFIX = 1, // expr++ expr-- () [] . ?. + UNARY_PREFIX = 2, // -expr !expr ~expr ++expr --expr + MULTIPLICATIVE = 3, // * / % ~/ + ADDITIVE = 4, // + - + SHIFT = 5, // << >> + BITWISE_AND = 6, // & + BITWISE_XOR = 7, // ^ + BITWISE_OR = 8, // | + RELATIONAL = 9, // >= > <= < as is is! + EQUALITY = 10, // == != + LOGICAL_AND = 11, // && + LOGICAL_OR = 12, // || + IF_NULL = 13, // ?? + CONDITIONAL = 14, // expr ? expr : expr + CASCADE = 15, // .. + ASSIGNMENT = 16, // = *= /= ~/= %= += -= <<= >>= &= ^= |= + NONE = 99, // (...) +} + export declare const dartGenerator: any; diff --git a/typings/javascript.d.ts b/typings/javascript.d.ts index cbb55fd65..b507a9be4 100644 --- a/typings/javascript.d.ts +++ b/typings/javascript.d.ts @@ -4,4 +4,42 @@ * SPDX-License-Identifier: Apache-2.0 */ +export enum Order { + ATOMIC = 0, // 0 "" ... + NEW = 1.1, // new + MEMBER = 1.2, // . [] + FUNCTION_CALL = 2, // () + INCREMENT = 3, // ++ + DECREMENT = 3, // -- + BITWISE_NOT = 4.1, // ~ + UNARY_PLUS = 4.2, // + + UNARY_NEGATION = 4.3, // - + LOGICAL_NOT = 4.4, // ! + TYPEOF = 4.5, // typeof + VOID = 4.6, // void + DELETE = 4.7, // delete + AWAIT = 4.8, // await + EXPONENTIATION = 5.0, // ** + MULTIPLICATION = 5.1, // * + DIVISION = 5.2, // / + MODULUS = 5.3, // % + SUBTRACTION = 6.1, // - + ADDITION = 6.2, // + + BITWISE_SHIFT = 7, // << >> >>> + RELATIONAL = 8, // < <= > >= + IN = 8, // in + INSTANCEOF = 8, // instanceof + EQUALITY = 9, // == != === !== + BITWISE_AND = 10, // & + BITWISE_XOR = 11, // ^ + BITWISE_OR = 12, // | + LOGICAL_AND = 13, // && + LOGICAL_OR = 14, // || + CONDITIONAL = 15, // ?: + ASSIGNMENT = 16, // = += -= **= *= /= %= <<= >>= ... + YIELD = 17, // yield + COMMA = 18, // , + NONE = 99, // (...) +} + export declare const javascriptGenerator: any; diff --git a/typings/lua.d.ts b/typings/lua.d.ts index 551c67772..693fb0ba2 100644 --- a/typings/lua.d.ts +++ b/typings/lua.d.ts @@ -4,4 +4,19 @@ * SPDX-License-Identifier: Apache-2.0 */ +export enum Order { + ATOMIC = 0, // literals + // The next level was not explicit in documentation and inferred by Ellen. + HIGH = 1, // Function calls, tables[] + EXPONENTIATION = 2, // ^ + UNARY = 3, // not # - ~ + MULTIPLICATIVE = 4, // * / % + ADDITIVE = 5, // + - + CONCATENATION = 6, // .. + RELATIONAL = 7, // < > <= >= ~= == + AND = 8, // and + OR = 9, // or + NONE = 99, +} + export declare const luaGenerator: any; diff --git a/typings/php.d.ts b/typings/php.d.ts index df438507a..29a223613 100644 --- a/typings/php.d.ts +++ b/typings/php.d.ts @@ -4,4 +4,44 @@ * SPDX-License-Identifier: Apache-2.0 */ +export enum Order { + ATOMIC = 0, // 0 "" ... + CLONE = 1, // clone + NEW = 1, // new + MEMBER = 2.1, // [] + FUNCTION_CALL = 2.2, // () + POWER = 3, // ** + INCREMENT = 4, // ++ + DECREMENT = 4, // -- + BITWISE_NOT = 4, // ~ + CAST = 4, // (int) (float) (string) (array) ... + SUPPRESS_ERROR = 4, // @ + INSTANCEOF = 5, // instanceof + LOGICAL_NOT = 6, // ! + UNARY_PLUS = 7.1, // + + UNARY_NEGATION = 7.2, // - + MULTIPLICATION = 8.1, // * + DIVISION = 8.2, // / + MODULUS = 8.3, // % + ADDITION = 9.1, // + + SUBTRACTION = 9.2, // - + STRING_CONCAT = 9.3, // . + BITWISE_SHIFT = 10, // << >> + RELATIONAL = 11, // < <= > >= + EQUALITY = 12, // == != === !== <> <=> + REFERENCE = 13, // & + BITWISE_AND = 13, // & + BITWISE_XOR = 14, // ^ + BITWISE_OR = 15, // | + LOGICAL_AND = 16, // && + LOGICAL_OR = 17, // || + IF_NULL = 18, // ?? + CONDITIONAL = 19, // ?: + ASSIGNMENT = 20, // = += -= *= /= %= <<= >>= ... + LOGICAL_AND_WEAK = 21, // and + LOGICAL_XOR = 22, // xor + LOGICAL_OR_WEAK = 23, // or + NONE = 99, // (...) +} + export declare const phpGenerator: any; diff --git a/typings/python.d.ts b/typings/python.d.ts index ab931669b..6d6449e37 100644 --- a/typings/python.d.ts +++ b/typings/python.d.ts @@ -4,4 +4,28 @@ * SPDX-License-Identifier: Apache-2.0 */ +export enum Order { + ATOMIC = 0, // 0 "" ... + COLLECTION = 1, // tuples, lists, dictionaries + STRING_CONVERSION = 1, // `expression...` + MEMBER = 2.1, // . [] + FUNCTION_CALL = 2.2, // () + EXPONENTIATION = 3, // ** + UNARY_SIGN = 4, // + - + BITWISE_NOT = 4, // ~ + MULTIPLICATIVE = 5, // * / // % + ADDITIVE = 6, // + - + BITWISE_SHIFT = 7, // << >> + BITWISE_AND = 8, // & + BITWISE_XOR = 9, // ^ + BITWISE_OR = 10, // | + RELATIONAL = 11, // in, not in, is, is not, >, >=, <>, !=, == + LOGICAL_NOT = 12, // not + LOGICAL_AND = 13, // and + LOGICAL_OR = 14, // or + CONDITIONAL = 15, // if else + LAMBDA = 16, // lambda + NONE = 99, // (...) +} + export declare const pythonGenerator: any; From fdc9b6d9f121768f409b1b6bc3bc10cfee61df2f Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 20 Jul 2023 13:50:12 -0700 Subject: [PATCH 2/8] chore: fix renamings (#7312) --- scripts/migration/renamings.json5 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/migration/renamings.json5 b/scripts/migration/renamings.json5 index 97fbc3fc0..bdbb2a132 100644 --- a/scripts/migration/renamings.json5 +++ b/scripts/migration/renamings.json5 @@ -1454,7 +1454,7 @@ Warning: { newExport: 'WarningIcon', oldPath: 'Blockly.Warning', - newPath: 'Blocky.icons.WarningIcon', + newPath: 'Blockly.icons.WarningIcon', }, }, }, @@ -1464,7 +1464,7 @@ Comment: { newExport: 'CommentIcon', oldPath: 'Blockly.Comment', - newPath: 'Blocky.icons.CommentIcon', + newPath: 'Blockly.icons.CommentIcon', }, }, }, @@ -1475,7 +1475,7 @@ Mutator: { newExport: 'MutatorIcon', oldPath: 'Blockly.Mutator', - newPath: 'Blocky.icons.MutatorIcon', + newPath: 'Blockly.icons.MutatorIcon', }, }, }, From e276e912e77c357596d279ea1ebba1a5bca4b10b Mon Sep 17 00:00:00 2001 From: Eric Blackmon Date: Thu, 10 Aug 2023 09:19:15 -0400 Subject: [PATCH 4/8] chore: update renamings file for new release --- scripts/migration/renamings.json5 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/migration/renamings.json5 b/scripts/migration/renamings.json5 index bdbb2a132..f0bd4e124 100644 --- a/scripts/migration/renamings.json5 +++ b/scripts/migration/renamings.json5 @@ -1595,5 +1595,7 @@ }, ], + '10.1.0': [], + 'develop': [], } From f391d5c48685be57c688ca6cacfa538263888b7a Mon Sep 17 00:00:00 2001 From: Eric Blackmon Date: Thu, 10 Aug 2023 11:38:08 -0400 Subject: [PATCH 5/8] release: Update version number to 10.1.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2130ec98e..ff734dd94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "blockly", - "version": "10.0.2", + "version": "10.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "blockly", - "version": "10.0.2", + "version": "10.1.0", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 2f07c228e..35c24cffc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blockly", - "version": "10.0.2", + "version": "10.1.0", "description": "Blockly is a library for building visual programming editors.", "keywords": [ "blockly" From 74049c769a619f2aabbc495d383dede162d1433a Mon Sep 17 00:00:00 2001 From: Eric Blackmon Date: Thu, 10 Aug 2023 12:31:19 -0400 Subject: [PATCH 6/8] chore: fixing core/main.js formatting --- core/main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/main.js b/core/main.js index cc83733d4..9606a67b6 100644 --- a/core/main.js +++ b/core/main.js @@ -42,7 +42,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_SATURATION', 'version 10', 'version 11', - 'Blockly.utils.colour.getHsvSaturation()' + 'Blockly.utils.colour.getHsvSaturation()', ); return colour.getHsvSaturation(); }, @@ -51,7 +51,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_SATURATION', 'version 10', 'version 11', - 'Blockly.utils.colour.setHsvSaturation()' + 'Blockly.utils.colour.setHsvSaturation()', ); colour.setHsvSaturation(newValue); }, @@ -71,7 +71,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_VALUE', 'version 10', 'version 11', - 'Blockly.utils.colour.getHsvValue()' + 'Blockly.utils.colour.getHsvValue()', ); return colour.getHsvValue(); }, @@ -80,7 +80,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_VALUE', 'version 10', 'version 11', - 'Blockly.utils.colour.setHsvValue()' + 'Blockly.utils.colour.setHsvValue()', ); colour.setHsvValue(newValue); }, From e5bfbdd324633f4cba45c7ea63d15e4f89f58c39 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 10 Aug 2023 13:40:08 -0700 Subject: [PATCH 7/8] Revert "fix: removed X & Y from toolbox.ts and replaced movBy to moveTo (#7333)" (#7375) This reverts commit dbe926db4af5d8b1e722b1f0c1869d72ff24968b. The reverted commit made it so that RTL flyouts were rendered incorrectly. (cherry picked from commit 7bca438ab8948ebdf39cf323b3876cbb9eea3255) --- core/flyout_horizontal.ts | 5 ++--- core/flyout_vertical.ts | 8 +++----- core/utils/toolbox.ts | 2 ++ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/core/flyout_horizontal.ts b/core/flyout_horizontal.ts index 019570493..ad27ca1dc 100644 --- a/core/flyout_horizontal.ts +++ b/core/flyout_horizontal.ts @@ -19,7 +19,7 @@ import type {FlyoutButton} from './flyout_button.js'; import type {Options} from './options.js'; import * as registry from './registry.js'; import {Scrollbar} from './scrollbar.js'; -import {Coordinate} from './utils/coordinate.js'; +import type {Coordinate} from './utils/coordinate.js'; import {Rect} from './utils/rect.js'; import * as toolbox from './utils/toolbox.js'; import * as WidgetDiv from './widgetdiv.js'; @@ -285,8 +285,7 @@ export class HorizontalFlyout extends Flyout { } else { moveX = cursorX - tab; } - // No 'reason' provided since events are disabled. - block!.moveTo(new Coordinate(moveX, cursorY)); + block!.moveBy(moveX, cursorY); const rect = this.createRect_(block!, moveX, cursorY, blockHW, i); cursorX += blockHW.width + gaps[i]; diff --git a/core/flyout_vertical.ts b/core/flyout_vertical.ts index 9dac14d73..d0c4a5d58 100644 --- a/core/flyout_vertical.ts +++ b/core/flyout_vertical.ts @@ -19,7 +19,7 @@ import type {FlyoutButton} from './flyout_button.js'; import type {Options} from './options.js'; import * as registry from './registry.js'; import {Scrollbar} from './scrollbar.js'; -import {Coordinate} from './utils/coordinate.js'; +import type {Coordinate} from './utils/coordinate.js'; import {Rect} from './utils/rect.js'; import * as toolbox from './utils/toolbox.js'; import * as WidgetDiv from './widgetdiv.js'; @@ -246,8 +246,7 @@ export class VerticalFlyout extends Flyout { const moveX = block!.outputConnection ? cursorX - this.tabWidth_ : cursorX; - // No 'reason' provided since events are disabled. - block!.moveTo(new Coordinate(moveX, cursorY)); + block!.moveBy(moveX, cursorY); const rect = this.createRect_( block!, @@ -358,8 +357,7 @@ export class VerticalFlyout extends Flyout { if (!block.outputConnection) { newX -= this.tabWidth_; } - // No 'reason' provided since events are disabled. - block.moveTo(new Coordinate(newX - oldX, 0)); + block.moveBy(newX - oldX, 0); } if (this.rectMap_.has(block)) { this.moveRectToBlock_(this.rectMap_.get(block)!, block); diff --git a/core/utils/toolbox.ts b/core/utils/toolbox.ts index c192d4079..b2d71e3b6 100644 --- a/core/utils/toolbox.ts +++ b/core/utils/toolbox.ts @@ -24,6 +24,8 @@ export interface BlockInfo { disabled?: string | boolean; enabled?: boolean; id?: string; + x?: number; + y?: number; collapsed?: boolean; inline?: boolean; data?: string; From b17f5ac775721170732d07804531dff0a44fb5f0 Mon Sep 17 00:00:00 2001 From: Eric Blackmon Date: Thu, 10 Aug 2023 16:54:03 -0400 Subject: [PATCH 8/8] release: Update version number to 10.1.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index ff734dd94..c80164dac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "blockly", - "version": "10.1.0", + "version": "10.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "blockly", - "version": "10.1.0", + "version": "10.1.1", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 35c24cffc..d7649dfdf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blockly", - "version": "10.1.0", + "version": "10.1.1", "description": "Blockly is a library for building visual programming editors.", "keywords": [ "blockly"