From fe0af5044610159ea44e204c13c090d6f9d6131c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Mar 2021 03:14:17 +0000 Subject: [PATCH 01/12] Bump y18n from 3.2.1 to 3.2.2 Bumps [y18n](https://github.com/yargs/y18n) from 3.2.1 to 3.2.2. - [Release notes](https://github.com/yargs/y18n/releases) - [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/yargs/y18n/commits) Signed-off-by: dependabot[bot] --- package-lock.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 405dea317..97f4c3914 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4105,6 +4105,12 @@ "yargs": "^12.0.2" }, "dependencies": { + "y18n": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", + "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", + "dev": true + }, "yargs": { "version": "12.0.5", "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", @@ -4285,9 +4291,9 @@ "dev": true }, "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", + "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==", "dev": true }, "yargs": { @@ -9464,9 +9470,9 @@ "dev": true }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", + "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", "dev": true }, "yallist": { @@ -9580,12 +9586,6 @@ "strip-ansi": "^6.0.0" } }, - "y18n": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", - "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", - "dev": true - }, "yargs-parser": { "version": "20.2.4", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", From c66735dcd27bf9891e0c56799d2915ea1a48ab85 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Mar 2021 03:28:12 +0000 Subject: [PATCH 02/12] Bump yargs-parser from 5.0.0 to 5.0.1 Bumps [yargs-parser](https://github.com/yargs/yargs-parser) from 5.0.0 to 5.0.1. - [Release notes](https://github.com/yargs/yargs-parser/releases) - [Changelog](https://github.com/yargs/yargs-parser/blob/v5.0.1/CHANGELOG.md) - [Commits](https://github.com/yargs/yargs-parser/compare/v5.0.0...v5.0.1) Signed-off-by: dependabot[bot] --- package-lock.json | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index 97f4c3914..6ab7ff5a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4130,6 +4130,16 @@ "y18n": "^3.2.1 || ^4.0.0", "yargs-parser": "^11.1.1" } + }, + "yargs-parser": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", + "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } } } }, @@ -4318,12 +4328,13 @@ } }, "yargs-parser": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz", - "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.1.tgz", + "integrity": "sha512-wpav5XYiddjXxirPoCTUPbqM0PXvJ9hiBMvuJgInvo4/lAOTZzUprArw17q2O1P2+GHhbBr18/iQwjL5Z9BqfA==", "dev": true, "requires": { - "camelcase": "^3.0.0" + "camelcase": "^3.0.0", + "object.assign": "^4.1.0" } } } @@ -5983,12 +5994,6 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", "dev": true - }, - "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true } } }, @@ -9585,24 +9590,14 @@ "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } - }, - "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true } } }, "yargs-parser": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", - "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } + "version": "20.2.7", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", + "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", + "dev": true }, "yargs-unparser": { "version": "2.0.0", From dd5d35178d7442503515448e7ff2734bc00dd401 Mon Sep 17 00:00:00 2001 From: Grayson Nix <61979456+nixgc@users.noreply.github.com> Date: Thu, 8 Apr 2021 18:46:51 -0400 Subject: [PATCH 03/12] Issue #4475 fix (#4758) * Issue #4475 fix --- blocks/lists.js | 1 - core/events/block_events.js | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/blocks/lists.js b/blocks/lists.js index 37c53ee98..7d1cc9be2 100644 --- a/blocks/lists.js +++ b/blocks/lists.js @@ -15,7 +15,6 @@ */ 'use strict'; -goog.provide('Blockly.Blocks.lists'); // Deprecated goog.provide('Blockly.Constants.Lists'); goog.require('Blockly'); diff --git a/core/events/block_events.js b/core/events/block_events.js index 32b9be618..df7e077f6 100644 --- a/core/events/block_events.js +++ b/core/events/block_events.js @@ -88,7 +88,7 @@ Blockly.Events.BlockBase.prototype.fromJson = function(json) { * @extends {Blockly.Events.BlockBase} * @constructor */ -Blockly.Events.Change = function(opt_block, opt_element, opt_name, opt_oldValue, +Blockly.Events.BlockChange = function(opt_block, opt_element, opt_name, opt_oldValue, opt_newValue) { Blockly.Events.Change.superClass_.constructor.call(this, opt_block); if (!opt_block) { @@ -99,7 +99,7 @@ Blockly.Events.Change = function(opt_block, opt_element, opt_name, opt_oldValue, this.oldValue = typeof opt_oldValue == 'undefined' ? '' : opt_oldValue; this.newValue = typeof opt_newValue == 'undefined' ? '' : opt_newValue; }; -Blockly.utils.object.inherits(Blockly.Events.Change, Blockly.Events.BlockBase); +Blockly.utils.object.inherits(Blockly.Events.BlockChange, Blockly.Events.BlockBase); /** * Class for a block change event. @@ -112,20 +112,20 @@ Blockly.utils.object.inherits(Blockly.Events.Change, Blockly.Events.BlockBase); * @extends {Blockly.Events.BlockBase} * @constructor */ -Blockly.Events.BlockChange = Blockly.Events.Change; +Blockly.Events.Change = Blockly.Events.BlockChange; /** * Type of this event. * @type {string} */ -Blockly.Events.Change.prototype.type = Blockly.Events.CHANGE; +Blockly.Events.BlockChange.prototype.type = Blockly.Events.CHANGE; /** * Encode the event as JSON. * @return {!Object} JSON representation. */ -Blockly.Events.Change.prototype.toJson = function() { - var json = Blockly.Events.Change.superClass_.toJson.call(this); +Blockly.Events.BlockChange.prototype.toJson = function() { + var json = Blockly.Events.BlockChange.superClass_.toJson.call(this); json['element'] = this.element; if (this.name) { json['name'] = this.name; @@ -139,8 +139,8 @@ Blockly.Events.Change.prototype.toJson = function() { * Decode the JSON event. * @param {!Object} json JSON representation. */ -Blockly.Events.Change.prototype.fromJson = function(json) { - Blockly.Events.Change.superClass_.fromJson.call(this, json); +Blockly.Events.BlockChange.prototype.fromJson = function(json) { + Blockly.Events.BlockChange.superClass_.fromJson.call(this, json); this.element = json['element']; this.name = json['name']; this.oldValue = json['oldValue']; @@ -151,7 +151,7 @@ Blockly.Events.Change.prototype.fromJson = function(json) { * Does this event record any change of state? * @return {boolean} False if something changed. */ -Blockly.Events.Change.prototype.isNull = function() { +Blockly.Events.BlockChange.prototype.isNull = function() { return this.oldValue == this.newValue; }; @@ -159,7 +159,7 @@ Blockly.Events.Change.prototype.isNull = function() { * Run a change event. * @param {boolean} forward True if run forward, false if run backward (undo). */ -Blockly.Events.Change.prototype.run = function(forward) { +Blockly.Events.BlockChange.prototype.run = function(forward) { var workspace = this.getEventWorkspace_(); var block = workspace.getBlockById(this.blockId); if (!block) { @@ -202,7 +202,7 @@ Blockly.Events.Change.prototype.run = function(forward) { var dom = Blockly.Xml.textToDom(/** @type {string} */ (value) || ''); block.domToMutation(dom); } - Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.CHANGE))( + Blockly.Events.fire(new Blockly.Events.BlockChange( block, 'mutation', null, oldMutation, value)); break; default: @@ -568,6 +568,6 @@ Blockly.registry.register(Blockly.registry.Type.EVENT, Blockly.Events.CREATE, Blockly.registry.register(Blockly.registry.Type.EVENT, Blockly.Events.DELETE, Blockly.Events.Delete); Blockly.registry.register(Blockly.registry.Type.EVENT, Blockly.Events.CHANGE, - Blockly.Events.Change); + Blockly.Events.BlockChange); Blockly.registry.register(Blockly.registry.Type.EVENT, Blockly.Events.MOVE, Blockly.Events.Move); From ec7a7177774ea922a0d4547780c8e3af42d65ee5 Mon Sep 17 00:00:00 2001 From: Monica Kozbial Date: Thu, 8 Apr 2021 15:47:19 -0700 Subject: [PATCH 04/12] Revert "Issue #4475 fix (#4758)" This reverts commit dd5d35178d7442503515448e7ff2734bc00dd401. --- blocks/lists.js | 1 + core/events/block_events.js | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/blocks/lists.js b/blocks/lists.js index 7d1cc9be2..37c53ee98 100644 --- a/blocks/lists.js +++ b/blocks/lists.js @@ -15,6 +15,7 @@ */ 'use strict'; +goog.provide('Blockly.Blocks.lists'); // Deprecated goog.provide('Blockly.Constants.Lists'); goog.require('Blockly'); diff --git a/core/events/block_events.js b/core/events/block_events.js index df7e077f6..32b9be618 100644 --- a/core/events/block_events.js +++ b/core/events/block_events.js @@ -88,7 +88,7 @@ Blockly.Events.BlockBase.prototype.fromJson = function(json) { * @extends {Blockly.Events.BlockBase} * @constructor */ -Blockly.Events.BlockChange = function(opt_block, opt_element, opt_name, opt_oldValue, +Blockly.Events.Change = function(opt_block, opt_element, opt_name, opt_oldValue, opt_newValue) { Blockly.Events.Change.superClass_.constructor.call(this, opt_block); if (!opt_block) { @@ -99,7 +99,7 @@ Blockly.Events.BlockChange = function(opt_block, opt_element, opt_name, opt_oldV this.oldValue = typeof opt_oldValue == 'undefined' ? '' : opt_oldValue; this.newValue = typeof opt_newValue == 'undefined' ? '' : opt_newValue; }; -Blockly.utils.object.inherits(Blockly.Events.BlockChange, Blockly.Events.BlockBase); +Blockly.utils.object.inherits(Blockly.Events.Change, Blockly.Events.BlockBase); /** * Class for a block change event. @@ -112,20 +112,20 @@ Blockly.utils.object.inherits(Blockly.Events.BlockChange, Blockly.Events.BlockBa * @extends {Blockly.Events.BlockBase} * @constructor */ -Blockly.Events.Change = Blockly.Events.BlockChange; +Blockly.Events.BlockChange = Blockly.Events.Change; /** * Type of this event. * @type {string} */ -Blockly.Events.BlockChange.prototype.type = Blockly.Events.CHANGE; +Blockly.Events.Change.prototype.type = Blockly.Events.CHANGE; /** * Encode the event as JSON. * @return {!Object} JSON representation. */ -Blockly.Events.BlockChange.prototype.toJson = function() { - var json = Blockly.Events.BlockChange.superClass_.toJson.call(this); +Blockly.Events.Change.prototype.toJson = function() { + var json = Blockly.Events.Change.superClass_.toJson.call(this); json['element'] = this.element; if (this.name) { json['name'] = this.name; @@ -139,8 +139,8 @@ Blockly.Events.BlockChange.prototype.toJson = function() { * Decode the JSON event. * @param {!Object} json JSON representation. */ -Blockly.Events.BlockChange.prototype.fromJson = function(json) { - Blockly.Events.BlockChange.superClass_.fromJson.call(this, json); +Blockly.Events.Change.prototype.fromJson = function(json) { + Blockly.Events.Change.superClass_.fromJson.call(this, json); this.element = json['element']; this.name = json['name']; this.oldValue = json['oldValue']; @@ -151,7 +151,7 @@ Blockly.Events.BlockChange.prototype.fromJson = function(json) { * Does this event record any change of state? * @return {boolean} False if something changed. */ -Blockly.Events.BlockChange.prototype.isNull = function() { +Blockly.Events.Change.prototype.isNull = function() { return this.oldValue == this.newValue; }; @@ -159,7 +159,7 @@ Blockly.Events.BlockChange.prototype.isNull = function() { * Run a change event. * @param {boolean} forward True if run forward, false if run backward (undo). */ -Blockly.Events.BlockChange.prototype.run = function(forward) { +Blockly.Events.Change.prototype.run = function(forward) { var workspace = this.getEventWorkspace_(); var block = workspace.getBlockById(this.blockId); if (!block) { @@ -202,7 +202,7 @@ Blockly.Events.BlockChange.prototype.run = function(forward) { var dom = Blockly.Xml.textToDom(/** @type {string} */ (value) || ''); block.domToMutation(dom); } - Blockly.Events.fire(new Blockly.Events.BlockChange( + Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.CHANGE))( block, 'mutation', null, oldMutation, value)); break; default: @@ -568,6 +568,6 @@ Blockly.registry.register(Blockly.registry.Type.EVENT, Blockly.Events.CREATE, Blockly.registry.register(Blockly.registry.Type.EVENT, Blockly.Events.DELETE, Blockly.Events.Delete); Blockly.registry.register(Blockly.registry.Type.EVENT, Blockly.Events.CHANGE, - Blockly.Events.BlockChange); + Blockly.Events.Change); Blockly.registry.register(Blockly.registry.Type.EVENT, Blockly.Events.MOVE, Blockly.Events.Move); From 7a8d16aeef00b20842e3a5d74891299f582ec7b8 Mon Sep 17 00:00:00 2001 From: alschmiedt Date: Tue, 13 Apr 2021 09:44:53 -0700 Subject: [PATCH 05/12] Reverts #4573 (#4775) --- package.json | 2 +- scripts/package/node/core.js | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index ecd03607c..b1491d69c 100644 --- a/package.json +++ b/package.json @@ -92,6 +92,6 @@ "yargs": "^16.0.3" }, "dependencies": { - "jsdom": "16.5.0" + "jsdom": "15.2.1" } } diff --git a/scripts/package/node/core.js b/scripts/package/node/core.js index 70e1f9078..8f7745304 100644 --- a/scripts/package/node/core.js +++ b/scripts/package/node/core.js @@ -23,10 +23,8 @@ Blockly.setLocale = function (locale) { // Override textToDomDocument and provide Node.js alternatives to DOMParser and // XMLSerializer. if (typeof Blockly.utils.global.document !== 'object') { - var JSDOM = require('jsdom').JSDOM; - var dom = new JSDOM(); - Blockly.utils.global.DOMParser = dom.window.DOMParser; - Blockly.utils.global.XMLSerializer = dom.window.XMLSerializer; + Blockly.utils.global.DOMParser = require("jsdom/lib/jsdom/living").DOMParser; + Blockly.utils.global.XMLSerializer = require("jsdom/lib/jsdom/living").XMLSerializer; var doc = Blockly.utils.xml.textToDomDocument( ''); Blockly.utils.xml.document = function() { From c30e0831e76687467958dca3290d341c39085796 Mon Sep 17 00:00:00 2001 From: alschmiedt Date: Tue, 13 Apr 2021 10:22:25 -0700 Subject: [PATCH 06/12] Rebuild for patch release --- blockly_compressed.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blockly_compressed.js b/blockly_compressed.js index 304bacf1b..ae1bd1303 100644 --- a/blockly_compressed.js +++ b/blockly_compressed.js @@ -803,7 +803,7 @@ Blockly.Variables.renameVariable=function(a,b,c){var d=function(e){var f=Blockly Blockly.Variables.promptName=function(a,b,c){Blockly.prompt(a,b,function(d){d&&(d=d.replace(/[\s\xa0]+/g," ").trim(),d==Blockly.Msg.RENAME_VARIABLE||d==Blockly.Msg.NEW_VARIABLE)&&(d=null);c(d)})};Blockly.Variables.nameUsedWithOtherType_=function(a,b,c){c=c.getVariableMap().getAllVariables();a=a.toLowerCase();for(var d=0,e;e=c[d];d++)if(e.name.toLowerCase()==a&&e.type!=b)return e;return null}; Blockly.Variables.nameUsedWithAnyType=function(a,b){b=b.getVariableMap().getAllVariables();a=a.toLowerCase();for(var c=0,d;d=b[c];c++)if(d.name.toLowerCase()==a)return d;return null};Blockly.Variables.generateVariableFieldDom=function(a){var b=Blockly.utils.xml.createElement("field");b.setAttribute("name","VAR");b.setAttribute("id",a.getId());b.setAttribute("variabletype",a.type);a=Blockly.utils.xml.createTextNode(a.name);b.appendChild(a);return b}; Blockly.Variables.getOrCreateVariablePackage=function(a,b,c,d){var e=Blockly.Variables.getVariable(a,b,c,d);e||(e=Blockly.Variables.createVariable_(a,b,c,d));return e};Blockly.Variables.getVariable=function(a,b,c,d){var e=a.getPotentialVariableMap(),f=null;if(b&&(f=a.getVariableById(b),!f&&e&&(f=e.getVariableById(b)),f))return f;if(c){if(void 0==d)throw Error("Tried to look up a variable by name without a type");f=a.getVariable(c,d);!f&&e&&(f=e.getVariable(c,d))}return f}; -Blockly.Variables.createVariable_=function(a,b,c,d){var e=a.getPotentialVariableMap();c||(c=Blockly.Variables.generateUniqueName(a.isFlyout?a.targetWorkspace:a));return e?e.createVariable(c,d,b):a.createVariable(c,d,b)};Blockly.Variables.getAddedVariables=function(a,b){a=a.getAllVariables();var c=[];if(b.length!=a.length)for(var d=0;d Date: Fri, 21 May 2021 20:44:38 -0700 Subject: [PATCH 07/12] Change lastConnectionInRow to getPlaceForOrphanedOutput (#4831) --- core/connection.js | 54 ++--- core/renderers/common/renderer.js | 14 +- tests/mocha/connection_test.js | 326 +++++++++++++++++++++++++++++- 3 files changed, 355 insertions(+), 39 deletions(-) diff --git a/core/connection.js b/core/connection.js index e5a632a32..9cd65f3c5 100644 --- a/core/connection.js +++ b/core/connection.js @@ -134,7 +134,7 @@ Blockly.Connection.prototype.connect_ = function(childConnection) { // Attempt to reattach the orphan at the end of the newly inserted // block. Since this block may be a row, walk down to the end // or to the first (and only) shadow block. - var connection = Blockly.Connection.lastConnectionInRow( + var connection = Blockly.Connection.getConnectionForOrphanedOutput( childBlock, orphanBlock); if (connection) { orphanBlock.outputConnection.connect(connection); @@ -372,30 +372,31 @@ Blockly.Connection.connectReciprocally_ = function(first, second) { }; /** - * Does the given block have one and only one connection point that will accept - * an orphaned block? + * Returns the single connection on the block that will accept the orphaned + * block, if one can be found. If the block has multiple compatible connections + * (even if they are filled) this returns null. If the block has no compatible + * connections, this returns null. * @param {!Blockly.Block} block The superior block. * @param {!Blockly.Block} orphanBlock The inferior block. * @return {Blockly.Connection} The suitable connection point on 'block', * or null. * @private */ -Blockly.Connection.singleConnection_ = function(block, orphanBlock) { - var connection = null; +Blockly.Connection.getSingleConnection_ = function(block, orphanBlock) { + var foundConnection = null; var output = orphanBlock.outputConnection; - for (var i = 0; i < block.inputList.length; i++) { - var thisConnection = block.inputList[i].connection; - var typeChecker = output.getConnectionChecker(); - if (thisConnection && - thisConnection.type == Blockly.connectionTypes.INPUT_VALUE && - typeChecker.canConnect(output, thisConnection, false)) { - if (connection) { + var typeChecker = output.getConnectionChecker(); + + for (var i = 0, input; (input = block.inputList[i]); i++) { + var connection = input.connection; + if (connection && typeChecker.canConnect(output, connection, false)) { + if (foundConnection) { return null; // More than one connection. } - connection = thisConnection; + foundConnection = connection; } } - return connection; + return foundConnection; }; /** @@ -410,18 +411,19 @@ Blockly.Connection.singleConnection_ = function(block, orphanBlock) { * of blocks, or null. * @package */ -Blockly.Connection.lastConnectionInRow = function(startBlock, orphanBlock) { - var newBlock = startBlock; - var connection; - while ((connection = Blockly.Connection.singleConnection_( - /** @type {!Blockly.Block} */ (newBlock), orphanBlock))) { - newBlock = connection.targetBlock(); - if (!newBlock || newBlock.isShadow()) { - return connection; - } - } - return null; -}; +Blockly.Connection.getConnectionForOrphanedOutput = + function(startBlock, orphanBlock) { + var newBlock = startBlock; + var connection; + while ((connection = Blockly.Connection.getSingleConnection_( + /** @type {!Blockly.Block} */ (newBlock), orphanBlock))) { + newBlock = connection.targetBlock(); + if (!newBlock || newBlock.isShadow()) { + return connection; + } + } + return null; + }; /** * Disconnect this connection. diff --git a/core/renderers/common/renderer.js b/core/renderers/common/renderer.js index af575403f..4d7c6ca17 100644 --- a/core/renderers/common/renderer.js +++ b/core/renderers/common/renderer.js @@ -248,19 +248,13 @@ Blockly.blockRendering.Renderer.prototype.orphanCanConnectAtEnd = function(topBlock, orphanBlock, localType) { var orphanConnection = null; var lastConnection = null; - if (localType == - Blockly.connectionTypes - .OUTPUT_VALUE) { // We are replacing an output. + if (localType == Blockly.connectionTypes.OUTPUT_VALUE) { orphanConnection = orphanBlock.outputConnection; - // TODO: I don't think this function necessarily has the correct logic, - // but for now it is being kept for behavioral backwards-compat. - lastConnection = Blockly.Connection - .lastConnectionInRow( + lastConnection = + Blockly.Connection.getConnectionForOrphanedOutput( /** @type {!Blockly.Block} **/ (topBlock), orphanBlock); - } else { // We are replacing a previous. + } else { orphanConnection = orphanBlock.previousConnection; - // TODO: This lives on the block while lastConnectionInRow lives on - // on the connection. Something is fishy. lastConnection = topBlock.lastConnectionInStack(); } diff --git a/tests/mocha/connection_test.js b/tests/mocha/connection_test.js index 73882b90b..3d96c18c5 100644 --- a/tests/mocha/connection_test.js +++ b/tests/mocha/connection_test.js @@ -156,9 +156,6 @@ suite('Connection', function() { teardown(function() { workspaceTeardown.call(this, this.workspace); - delete Blockly.Blocks['stack_block']; - delete Blockly.Blocks['row_block']; - delete Blockly.Blocks['statement_block']; }); suite('Add - No Block Connected', function() { @@ -784,4 +781,327 @@ suite('Connection', function() { }); }); }); + + suite('getConnectionForOrphanedOutput', function() { + setup(function() { + this.workspace = new Blockly.Workspace(); + + Blockly.defineBlocksWithJsonArray([ + { + 'type': 'input', + 'message0': '%1', + 'args0': [ + { + 'type': 'input_value', + 'name': 'INPUT', + 'check': 'check' + } + ], + }, + { + 'type': 'output', + 'message0': '', + 'output': 'check', + }, + ]); + }); + + teardown(function() { + workspaceTeardown.call(this, this.workspace); + }); + + suite('No available spots', function() { + setup(function() { + Blockly.defineBlocksWithJsonArray([ + { + 'type': 'output_and_statements', + 'message0': '%1 %2', + 'args0': [ + { + 'type': 'input_statement', + 'name': 'INPUT', + 'check': 'check' + }, + { + 'type': 'input_statement', + 'name': 'INPUT2', + 'check': 'check' + } + ], + 'output': 'check', + }, + { + 'type': 'output_and_inputs', + 'message0': '%1 %2', + 'args0': [ + { + 'type': 'input_value', + 'name': 'INPUT', + 'check': 'check2' + }, + { + 'type': 'input_value', + 'name': 'INPUT2', + 'check': 'check2' + } + ], + 'output': 'check', + }, + { + 'type': 'check_to_check2', + 'message0': '%1', + 'args0': [ + { + 'type': 'input_value', + 'name': 'INPUT', + 'check': 'check2' + }, + ], + 'output': 'check', + }, + { + 'type': 'check2_to_check', + 'message0': '%1', + 'args0': [ + { + 'type': 'input_value', + 'name': 'CHECK2TOCHECKINPUT', + 'check': 'check' + }, + ], + 'output': 'check2', + }, + ]); + }); + + test('No connection', function() { + const parent = this.workspace.newBlock('input'); + const oldChild = this.workspace.newBlock('output'); + const newChild = this.workspace.newBlock('output'); + + parent.getInput('INPUT').connection.connect(oldChild.outputConnection); + chai.assert.notExists( + Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); + }); + + test('All statements', function() { + const parent = this.workspace.newBlock('input'); + const oldChild = this.workspace.newBlock('output_and_statements'); + const newChild = this.workspace.newBlock('output'); + + parent.getInput('INPUT').connection.connect(oldChild.outputConnection); + chai.assert.notExists( + Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); + }); + + test('Bad checks', function() { + const parent = this.workspace.newBlock('input'); + const oldChild = this.workspace.newBlock('output_and_inputs'); + const newChild = this.workspace.newBlock('output'); + + parent.getInput('INPUT').connection.connect(oldChild.outputConnection); + chai.assert.notExists( + Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); + }); + + test('Through different types', function() { + const parent = this.workspace.newBlock('input'); + const oldChild = this.workspace.newBlock('check_to_check2'); + const otherChild = this.workspace.newBlock('check2_to_check'); + const newChild = this.workspace.newBlock('output'); + + parent.getInput('INPUT').connection + .connect(oldChild.outputConnection); + oldChild.getInput('INPUT').connection + .connect(otherChild.outputConnection); + + chai.assert.notExists( + Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); + }); + }); + + suite('Multiple available spots', function() { + setup(function() { + Blockly.defineBlocksWithJsonArray([ + { + 'type': 'multiple_inputs', + 'message0': '%1 %2', + 'args0': [ + { + 'type': 'input_value', + 'name': 'INPUT', + 'check': 'check' + }, + { + 'type': 'input_value', + 'name': 'INPUT2', + 'check': 'check' + }, + ], + 'output': 'check', + }, + { + 'type': 'single_input', + 'message0': '%1', + 'args0': [ + { + 'type': 'input_value', + 'name': 'INPUT', + 'check': 'check' + }, + ], + 'output': 'check', + }, + ]); + }); + + suite('No shadows', function() { + test('Top block', function() { + const parent = this.workspace.newBlock('input'); + const oldChild = this.workspace.newBlock('multiple_inputs'); + const newChild = this.workspace.newBlock('output'); + + parent.getInput('INPUT').connection.connect(oldChild.outputConnection); + chai.assert.notExists( + Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); + }); + + test('Child blocks', function() { + const parent = this.workspace.newBlock('input'); + const oldChild = this.workspace.newBlock('multiple_inputs'); + const childX = this.workspace.newBlock('single_input'); + const childY = this.workspace.newBlock('single_input'); + const newChild = this.workspace.newBlock('output'); + + parent.getInput('INPUT').connection.connect(oldChild.outputConnection); + oldChild.getInput('INPUT').connection.connect(childX.outputConnection); + oldChild.getInput('INPUT2').connection.connect(childY.outputConnection); + + chai.assert.notExists( + Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); + }); + + test('Spots filled', function() { + const parent = this.workspace.newBlock('input'); + const oldChild = this.workspace.newBlock('multiple_inputs'); + const otherChild = this.workspace.newBlock('output'); + const newChild = this.workspace.newBlock('output'); + + parent.getInput('INPUT').connection + .connect(oldChild.outputConnection); + oldChild.getInput('INPUT').connection + .connect(otherChild.outputConnection); + + chai.assert.notExists( + Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); + }); + }); + + suite('Shadows', function() { + test('Top block', function() { + const parent = this.workspace.newBlock('input'); + const oldChild = this.workspace.newBlock('multiple_inputs'); + const newChild = this.workspace.newBlock('output'); + + parent.getInput('INPUT').connection.connect(oldChild.outputConnection); + oldChild.getInput('INPUT').connection.setShadowDom( + Blockly.Xml.textToDom('') + .firstChild); + oldChild.getInput('INPUT2').connection.setShadowDom( + Blockly.Xml.textToDom('') + .firstChild); + + chai.assert.notExists( + Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); + }); + + test('Child blocks', function() { + const parent = this.workspace.newBlock('input'); + const oldChild = this.workspace.newBlock('multiple_inputs'); + const childX = this.workspace.newBlock('single_input'); + const childY = this.workspace.newBlock('single_input'); + const newChild = this.workspace.newBlock('output'); + + parent.getInput('INPUT').connection.connect(oldChild.outputConnection); + oldChild.getInput('INPUT').connection.connect(childX.outputConnection); + oldChild.getInput('INPUT2').connection.connect(childY.outputConnection); + childX.getInput('INPUT').connection.setShadowDom( + Blockly.Xml.textToDom('') + .firstChild); + childY.getInput('INPUT').connection.setShadowDom( + Blockly.Xml.textToDom('') + .firstChild); + + chai.assert.notExists( + Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); + }); + + test('Spots filled', function() { + const parent = this.workspace.newBlock('input'); + const oldChild = this.workspace.newBlock('multiple_inputs'); + const otherChild = this.workspace.newBlock('output'); + const newChild = this.workspace.newBlock('output'); + + parent.getInput('INPUT').connection + .connect(oldChild.outputConnection); + oldChild.getInput('INPUT').connection + .connect(otherChild.outputConnection); + oldChild.getInput('INPUT2').connection.setShadowDom( + Blockly.Xml.textToDom('') + .firstChild); + + chai.assert.notExists( + Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); + }); + }); + }); + + suite('Single available spot', function() { + setup(function() { + Blockly.defineBlocksWithJsonArray([ + { + 'type': 'single_input', + 'message0': '%1', + 'args0': [ + { + 'type': 'input_value', + 'name': 'INPUT', + 'check': 'check' + }, + ], + 'output': 'check', + }, + ]); + }); + + test('No shadows', function() { + const parent = this.workspace.newBlock('input'); + const oldChild = this.workspace.newBlock('single_input'); + const newChild = this.workspace.newBlock('output'); + + parent.getInput('INPUT').connection.connect(oldChild.outputConnection); + + const result = Blockly.Connection + .getConnectionForOrphanedOutput(oldChild, newChild); + chai.assert.exists(result); + chai.assert.equal(result.getParentInput().name, 'INPUT'); + }); + + test('Shadows', function() { + const parent = this.workspace.newBlock('input'); + const oldChild = this.workspace.newBlock('single_input'); + const newChild = this.workspace.newBlock('output'); + + parent.getInput('INPUT').connection.connect(oldChild.outputConnection); + oldChild.getInput('INPUT').connection.setShadowDom( + Blockly.Xml.textToDom('') + .firstChild); + + const result = Blockly.Connection + .getConnectionForOrphanedOutput(oldChild, newChild); + chai.assert.exists(result); + chai.assert.equal(result.getParentInput().name, 'INPUT'); + }); + }); + }); }); From 36285c64e7942a3b28e2f0e948cc19cea5b1db57 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 May 2021 15:55:20 -0700 Subject: [PATCH 08/12] Bump lodash from 4.17.19 to 4.17.21 (#4817) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 298 +++++++++++++++++----------------------------- 1 file changed, 110 insertions(+), 188 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6ab7ff5a3..bad3f651f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "blockly", - "version": "5.20210325.0", + "version": "5.20210325.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -184,12 +184,6 @@ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.5.tgz", "integrity": "sha512-wfryxy4bE1UivvQKSQDU4/X6dr+i8bctjUjj8Zyt3DQy7NtPizJXT8M52nqpNKL+nq2PW8lxk4ZqLj0fD4B4hQ==", "dev": true - }, - "lodash": { - "version": "4.17.19", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", - "dev": true } } }, @@ -202,14 +196,6 @@ "@babel/helper-validator-identifier": "^7.10.4", "lodash": "^4.17.19", "to-fast-properties": "^2.0.0" - }, - "dependencies": { - "lodash": { - "version": "4.17.19", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", - "dev": true - } } }, "@blockly/block-test": { @@ -716,23 +702,15 @@ "acorn": { "version": "6.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", - "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", - "dev": true + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==" }, "acorn-globals": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz", - "integrity": "sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", + "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", "requires": { - "acorn": "^7.1.1", - "acorn-walk": "^7.1.1" - }, - "dependencies": { - "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==" - } + "acorn": "^6.0.1", + "acorn-walk": "^6.0.1" } }, "acorn-jsx": { @@ -742,9 +720,9 @@ "dev": true }, "acorn-walk": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", - "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==" + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", + "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==" }, "agent-base": { "version": "6.0.2", @@ -965,6 +943,11 @@ "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", "dev": true }, + "array-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=" + }, "array-find-index": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", @@ -1866,12 +1849,6 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -2053,13 +2030,13 @@ "dev": true }, "data-urls": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-2.0.0.tgz", - "integrity": "sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz", + "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==", "requires": { - "abab": "^2.0.3", - "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^8.0.0" + "abab": "^2.0.0", + "whatwg-mimetype": "^2.2.0", + "whatwg-url": "^7.0.0" } }, "date-fns": { @@ -2123,11 +2100,6 @@ } } }, - "decimal.js": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.1.tgz", - "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw==" - }, "decode-uri-component": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", @@ -2313,18 +2285,11 @@ } }, "domexception": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/domexception/-/domexception-2.0.1.tgz", - "integrity": "sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", + "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", "requires": { - "webidl-conversions": "^5.0.0" - }, - "dependencies": { - "webidl-conversions": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz", - "integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==" - } + "webidl-conversions": "^4.0.2" } }, "duplexer3": { @@ -2492,7 +2457,6 @@ "version": "1.12.0", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.12.0.tgz", "integrity": "sha512-TuA+EhsanGcme5T3R0L80u4t8CpbXQjegRmf7+FPTJrtCTErXFeelblRgHQa1FofEzqYYJmJ/OqjTwREp9qgmg==", - "dev": true, "requires": { "esprima": "^3.1.3", "estraverse": "^4.2.0", @@ -2687,12 +2651,6 @@ "type-check": "~0.4.0" } }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -2840,8 +2798,7 @@ "esprima": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=" }, "esquery": { "version": "1.4.0", @@ -2880,8 +2837,7 @@ "estraverse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" }, "esutils": { "version": "2.0.3", @@ -4655,11 +4611,11 @@ "dev": true }, "html-encoding-sniffer": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz", - "integrity": "sha512-D5JbOMBIR/TVZkubHT+OyT2705QvogUW4IBn6nHd756OwieSF9aDYFj4dv6HHEVGYbHaLETa3WggZYWWMyy3ZQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", "requires": { - "whatwg-encoding": "^1.0.5" + "whatwg-encoding": "^1.0.1" } }, "http-cache-semantics": { @@ -4774,6 +4730,11 @@ "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", "dev": true }, + "ip-regex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", + "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=" + }, "is-absolute": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", @@ -4947,11 +4908,6 @@ "isobject": "^3.0.1" } }, - "is-potential-custom-element-name": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.0.tgz", - "integrity": "sha1-DFLlS8yjkbssSUsh6GJtczbG45c=" - }, "is-promise": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", @@ -5165,69 +5121,42 @@ } }, "jsdom": { - "version": "16.5.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.5.0.tgz", - "integrity": "sha512-QxZH0nmDTnTTVI0YDm4RUlaUPl5dcyn62G5TMDNfMmTW+J1u1v9gCR8WR+WZ6UghAa7nKJjDOFaI00eMMWvJFQ==", + "version": "15.2.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-15.2.1.tgz", + "integrity": "sha512-fAl1W0/7T2G5vURSyxBzrJ1LSdQn6Tr5UX/xD4PXDx/PDgwygedfW6El/KIj3xJ7FU61TTYnc/l/B7P49Eqt6g==", "requires": { - "abab": "^2.0.5", - "acorn": "^8.0.5", - "acorn-globals": "^6.0.0", - "cssom": "^0.4.4", - "cssstyle": "^2.3.0", - "data-urls": "^2.0.0", - "decimal.js": "^10.2.1", - "domexception": "^2.0.1", - "escodegen": "^2.0.0", - "html-encoding-sniffer": "^2.0.1", - "is-potential-custom-element-name": "^1.0.0", + "abab": "^2.0.0", + "acorn": "^7.1.0", + "acorn-globals": "^4.3.2", + "array-equal": "^1.0.0", + "cssom": "^0.4.1", + "cssstyle": "^2.0.0", + "data-urls": "^1.1.0", + "domexception": "^1.0.1", + "escodegen": "^1.11.1", + "html-encoding-sniffer": "^1.0.2", "nwsapi": "^2.2.0", - "parse5": "6.0.1", - "request": "^2.88.2", - "request-promise-native": "^1.0.9", - "saxes": "^5.0.1", - "symbol-tree": "^3.2.4", - "tough-cookie": "^4.0.0", - "w3c-hr-time": "^1.0.2", - "w3c-xmlserializer": "^2.0.0", - "webidl-conversions": "^6.1.0", + "parse5": "5.1.0", + "pn": "^1.1.0", + "request": "^2.88.0", + "request-promise-native": "^1.0.7", + "saxes": "^3.1.9", + "symbol-tree": "^3.2.2", + "tough-cookie": "^3.0.1", + "w3c-hr-time": "^1.0.1", + "w3c-xmlserializer": "^1.1.2", + "webidl-conversions": "^4.0.2", "whatwg-encoding": "^1.0.5", "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^8.0.0", - "ws": "^7.4.4", + "whatwg-url": "^7.0.0", + "ws": "^7.0.0", "xml-name-validator": "^3.0.0" }, "dependencies": { "acorn": { - "version": "8.0.5", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.0.5.tgz", - "integrity": "sha512-v+DieK/HJkJOpFBETDJioequtc3PfxsWMaxIdIwujtF7FEV/MAyDQLlm6/zPvr7Mix07mLh6ccVwIsloceodlg==" - }, - "escodegen": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", - "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", - "requires": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.6.1" - } - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" - }, - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==" - }, - "ws": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz", - "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==" + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==" } } }, @@ -5472,9 +5401,9 @@ } }, "lodash": { - "version": "4.17.19", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, "lodash._reinterpolate": { "version": "3.0.0", @@ -6019,16 +5948,16 @@ } }, "mime-db": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz", - "integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ==" + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.47.0.tgz", + "integrity": "sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw==" }, "mime-types": { - "version": "2.1.29", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz", - "integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==", + "version": "2.1.30", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.30.tgz", + "integrity": "sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg==", "requires": { - "mime-db": "1.46.0" + "mime-db": "1.47.0" } }, "mimic-fn": { @@ -6838,9 +6767,9 @@ "dev": true }, "parse5": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", - "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz", + "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==" }, "pascalcase": { "version": "0.1.1", @@ -7024,6 +6953,11 @@ "extend-shallow": "^3.0.2" } }, + "pn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", + "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==" + }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -7650,11 +7584,11 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "saxes": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz", - "integrity": "sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==", + "version": "3.1.11", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-3.1.11.tgz", + "integrity": "sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g==", "requires": { - "xmlchars": "^2.2.0" + "xmlchars": "^2.1.1" } }, "selenium-standalone": { @@ -8493,12 +8427,6 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "string-width": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", @@ -8729,28 +8657,21 @@ } }, "tough-cookie": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", - "integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", + "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==", "requires": { - "psl": "^1.1.33", - "punycode": "^2.1.1", - "universalify": "^0.1.2" - }, - "dependencies": { - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" - } + "ip-regex": "^2.1.0", + "psl": "^1.1.28", + "punycode": "^2.1.1" } }, "tr46": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-2.0.2.tgz", - "integrity": "sha512-3n1qG+/5kg+jrbTzwAykB5yRYtQCTqOGKq5U5PE3b0a1/mzo6snDhjGS0zJVJunO0NrT3Dg1MLy5TjWP/UJppg==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", "requires": { - "punycode": "^2.1.1" + "punycode": "^2.1.0" } }, "tree-kill": { @@ -9150,10 +9071,12 @@ } }, "w3c-xmlserializer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz", - "integrity": "sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz", + "integrity": "sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg==", "requires": { + "domexception": "^1.0.1", + "webidl-conversions": "^4.0.2", "xml-name-validator": "^3.0.0" } }, @@ -9325,9 +9248,9 @@ } }, "webidl-conversions": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", - "integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==" + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" }, "whatwg-encoding": { "version": "1.0.5", @@ -9343,13 +9266,13 @@ "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==" }, "whatwg-url": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.4.0.tgz", - "integrity": "sha512-vwTUFf6V4zhcPkWp/4CQPr1TW9Ml6SF4lVyaIMBdJw5i6qUUJ1QWM4Z6YYVkfka0OUIzVo/0aNtGVGk256IKWw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", "requires": { "lodash.sortby": "^4.7.0", - "tr46": "^2.0.2", - "webidl-conversions": "^6.1.0" + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" } }, "which": { @@ -9449,8 +9372,7 @@ "ws": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", - "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==", - "dev": true + "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==" }, "xml-name-validator": { "version": "3.0.0", From 3a13abc1ca732b4a5e70836cf311d03260ae1788 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 May 2021 15:55:34 -0700 Subject: [PATCH 09/12] Bump hosted-git-info from 2.8.4 to 2.8.9 (#4819) Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.4 to 2.8.9. - [Release notes](https://github.com/npm/hosted-git-info/releases) - [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md) - [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.4...v2.8.9) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index bad3f651f..3d5d6c40b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4605,9 +4605,9 @@ } }, "hosted-git-info": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.4.tgz", - "integrity": "sha512-pzXIvANXEFrc5oFFXRMkbLPQ2rXRoDERwDLyrcUxGhaZhgP54BBSl9Oheh7Vv0T090cszWBxPjkQQ5Sq1PbBRQ==", + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", "dev": true }, "html-encoding-sniffer": { @@ -5849,9 +5849,9 @@ }, "dependencies": { "hosted-git-info": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", - "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", "dev": true }, "normalize-package-data": { From 77257a515a63b5566ba724ea47df13724765b343 Mon Sep 17 00:00:00 2001 From: Monica Kozbial <6621618+moniika@users.noreply.github.com> Date: Tue, 25 May 2021 09:35:02 -0700 Subject: [PATCH 10/12] Revert "Change lastConnectionInRow to getPlaceForOrphanedOutput (#4831)" (#4850) This reverts commit 83640ef389fb00d9cf4a44f4aa28f813eff4ddca. --- core/connection.js | 54 +++-- core/renderers/common/renderer.js | 14 +- tests/mocha/connection_test.js | 326 +----------------------------- 3 files changed, 39 insertions(+), 355 deletions(-) diff --git a/core/connection.js b/core/connection.js index 9cd65f3c5..e5a632a32 100644 --- a/core/connection.js +++ b/core/connection.js @@ -134,7 +134,7 @@ Blockly.Connection.prototype.connect_ = function(childConnection) { // Attempt to reattach the orphan at the end of the newly inserted // block. Since this block may be a row, walk down to the end // or to the first (and only) shadow block. - var connection = Blockly.Connection.getConnectionForOrphanedOutput( + var connection = Blockly.Connection.lastConnectionInRow( childBlock, orphanBlock); if (connection) { orphanBlock.outputConnection.connect(connection); @@ -372,31 +372,30 @@ Blockly.Connection.connectReciprocally_ = function(first, second) { }; /** - * Returns the single connection on the block that will accept the orphaned - * block, if one can be found. If the block has multiple compatible connections - * (even if they are filled) this returns null. If the block has no compatible - * connections, this returns null. + * Does the given block have one and only one connection point that will accept + * an orphaned block? * @param {!Blockly.Block} block The superior block. * @param {!Blockly.Block} orphanBlock The inferior block. * @return {Blockly.Connection} The suitable connection point on 'block', * or null. * @private */ -Blockly.Connection.getSingleConnection_ = function(block, orphanBlock) { - var foundConnection = null; +Blockly.Connection.singleConnection_ = function(block, orphanBlock) { + var connection = null; var output = orphanBlock.outputConnection; - var typeChecker = output.getConnectionChecker(); - - for (var i = 0, input; (input = block.inputList[i]); i++) { - var connection = input.connection; - if (connection && typeChecker.canConnect(output, connection, false)) { - if (foundConnection) { + for (var i = 0; i < block.inputList.length; i++) { + var thisConnection = block.inputList[i].connection; + var typeChecker = output.getConnectionChecker(); + if (thisConnection && + thisConnection.type == Blockly.connectionTypes.INPUT_VALUE && + typeChecker.canConnect(output, thisConnection, false)) { + if (connection) { return null; // More than one connection. } - foundConnection = connection; + connection = thisConnection; } } - return foundConnection; + return connection; }; /** @@ -411,19 +410,18 @@ Blockly.Connection.getSingleConnection_ = function(block, orphanBlock) { * of blocks, or null. * @package */ -Blockly.Connection.getConnectionForOrphanedOutput = - function(startBlock, orphanBlock) { - var newBlock = startBlock; - var connection; - while ((connection = Blockly.Connection.getSingleConnection_( - /** @type {!Blockly.Block} */ (newBlock), orphanBlock))) { - newBlock = connection.targetBlock(); - if (!newBlock || newBlock.isShadow()) { - return connection; - } - } - return null; - }; +Blockly.Connection.lastConnectionInRow = function(startBlock, orphanBlock) { + var newBlock = startBlock; + var connection; + while ((connection = Blockly.Connection.singleConnection_( + /** @type {!Blockly.Block} */ (newBlock), orphanBlock))) { + newBlock = connection.targetBlock(); + if (!newBlock || newBlock.isShadow()) { + return connection; + } + } + return null; +}; /** * Disconnect this connection. diff --git a/core/renderers/common/renderer.js b/core/renderers/common/renderer.js index 4d7c6ca17..af575403f 100644 --- a/core/renderers/common/renderer.js +++ b/core/renderers/common/renderer.js @@ -248,13 +248,19 @@ Blockly.blockRendering.Renderer.prototype.orphanCanConnectAtEnd = function(topBlock, orphanBlock, localType) { var orphanConnection = null; var lastConnection = null; - if (localType == Blockly.connectionTypes.OUTPUT_VALUE) { + if (localType == + Blockly.connectionTypes + .OUTPUT_VALUE) { // We are replacing an output. orphanConnection = orphanBlock.outputConnection; - lastConnection = - Blockly.Connection.getConnectionForOrphanedOutput( + // TODO: I don't think this function necessarily has the correct logic, + // but for now it is being kept for behavioral backwards-compat. + lastConnection = Blockly.Connection + .lastConnectionInRow( /** @type {!Blockly.Block} **/ (topBlock), orphanBlock); - } else { + } else { // We are replacing a previous. orphanConnection = orphanBlock.previousConnection; + // TODO: This lives on the block while lastConnectionInRow lives on + // on the connection. Something is fishy. lastConnection = topBlock.lastConnectionInStack(); } diff --git a/tests/mocha/connection_test.js b/tests/mocha/connection_test.js index 3d96c18c5..73882b90b 100644 --- a/tests/mocha/connection_test.js +++ b/tests/mocha/connection_test.js @@ -156,6 +156,9 @@ suite('Connection', function() { teardown(function() { workspaceTeardown.call(this, this.workspace); + delete Blockly.Blocks['stack_block']; + delete Blockly.Blocks['row_block']; + delete Blockly.Blocks['statement_block']; }); suite('Add - No Block Connected', function() { @@ -781,327 +784,4 @@ suite('Connection', function() { }); }); }); - - suite('getConnectionForOrphanedOutput', function() { - setup(function() { - this.workspace = new Blockly.Workspace(); - - Blockly.defineBlocksWithJsonArray([ - { - 'type': 'input', - 'message0': '%1', - 'args0': [ - { - 'type': 'input_value', - 'name': 'INPUT', - 'check': 'check' - } - ], - }, - { - 'type': 'output', - 'message0': '', - 'output': 'check', - }, - ]); - }); - - teardown(function() { - workspaceTeardown.call(this, this.workspace); - }); - - suite('No available spots', function() { - setup(function() { - Blockly.defineBlocksWithJsonArray([ - { - 'type': 'output_and_statements', - 'message0': '%1 %2', - 'args0': [ - { - 'type': 'input_statement', - 'name': 'INPUT', - 'check': 'check' - }, - { - 'type': 'input_statement', - 'name': 'INPUT2', - 'check': 'check' - } - ], - 'output': 'check', - }, - { - 'type': 'output_and_inputs', - 'message0': '%1 %2', - 'args0': [ - { - 'type': 'input_value', - 'name': 'INPUT', - 'check': 'check2' - }, - { - 'type': 'input_value', - 'name': 'INPUT2', - 'check': 'check2' - } - ], - 'output': 'check', - }, - { - 'type': 'check_to_check2', - 'message0': '%1', - 'args0': [ - { - 'type': 'input_value', - 'name': 'INPUT', - 'check': 'check2' - }, - ], - 'output': 'check', - }, - { - 'type': 'check2_to_check', - 'message0': '%1', - 'args0': [ - { - 'type': 'input_value', - 'name': 'CHECK2TOCHECKINPUT', - 'check': 'check' - }, - ], - 'output': 'check2', - }, - ]); - }); - - test('No connection', function() { - const parent = this.workspace.newBlock('input'); - const oldChild = this.workspace.newBlock('output'); - const newChild = this.workspace.newBlock('output'); - - parent.getInput('INPUT').connection.connect(oldChild.outputConnection); - chai.assert.notExists( - Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); - }); - - test('All statements', function() { - const parent = this.workspace.newBlock('input'); - const oldChild = this.workspace.newBlock('output_and_statements'); - const newChild = this.workspace.newBlock('output'); - - parent.getInput('INPUT').connection.connect(oldChild.outputConnection); - chai.assert.notExists( - Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); - }); - - test('Bad checks', function() { - const parent = this.workspace.newBlock('input'); - const oldChild = this.workspace.newBlock('output_and_inputs'); - const newChild = this.workspace.newBlock('output'); - - parent.getInput('INPUT').connection.connect(oldChild.outputConnection); - chai.assert.notExists( - Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); - }); - - test('Through different types', function() { - const parent = this.workspace.newBlock('input'); - const oldChild = this.workspace.newBlock('check_to_check2'); - const otherChild = this.workspace.newBlock('check2_to_check'); - const newChild = this.workspace.newBlock('output'); - - parent.getInput('INPUT').connection - .connect(oldChild.outputConnection); - oldChild.getInput('INPUT').connection - .connect(otherChild.outputConnection); - - chai.assert.notExists( - Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); - }); - }); - - suite('Multiple available spots', function() { - setup(function() { - Blockly.defineBlocksWithJsonArray([ - { - 'type': 'multiple_inputs', - 'message0': '%1 %2', - 'args0': [ - { - 'type': 'input_value', - 'name': 'INPUT', - 'check': 'check' - }, - { - 'type': 'input_value', - 'name': 'INPUT2', - 'check': 'check' - }, - ], - 'output': 'check', - }, - { - 'type': 'single_input', - 'message0': '%1', - 'args0': [ - { - 'type': 'input_value', - 'name': 'INPUT', - 'check': 'check' - }, - ], - 'output': 'check', - }, - ]); - }); - - suite('No shadows', function() { - test('Top block', function() { - const parent = this.workspace.newBlock('input'); - const oldChild = this.workspace.newBlock('multiple_inputs'); - const newChild = this.workspace.newBlock('output'); - - parent.getInput('INPUT').connection.connect(oldChild.outputConnection); - chai.assert.notExists( - Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); - }); - - test('Child blocks', function() { - const parent = this.workspace.newBlock('input'); - const oldChild = this.workspace.newBlock('multiple_inputs'); - const childX = this.workspace.newBlock('single_input'); - const childY = this.workspace.newBlock('single_input'); - const newChild = this.workspace.newBlock('output'); - - parent.getInput('INPUT').connection.connect(oldChild.outputConnection); - oldChild.getInput('INPUT').connection.connect(childX.outputConnection); - oldChild.getInput('INPUT2').connection.connect(childY.outputConnection); - - chai.assert.notExists( - Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); - }); - - test('Spots filled', function() { - const parent = this.workspace.newBlock('input'); - const oldChild = this.workspace.newBlock('multiple_inputs'); - const otherChild = this.workspace.newBlock('output'); - const newChild = this.workspace.newBlock('output'); - - parent.getInput('INPUT').connection - .connect(oldChild.outputConnection); - oldChild.getInput('INPUT').connection - .connect(otherChild.outputConnection); - - chai.assert.notExists( - Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); - }); - }); - - suite('Shadows', function() { - test('Top block', function() { - const parent = this.workspace.newBlock('input'); - const oldChild = this.workspace.newBlock('multiple_inputs'); - const newChild = this.workspace.newBlock('output'); - - parent.getInput('INPUT').connection.connect(oldChild.outputConnection); - oldChild.getInput('INPUT').connection.setShadowDom( - Blockly.Xml.textToDom('') - .firstChild); - oldChild.getInput('INPUT2').connection.setShadowDom( - Blockly.Xml.textToDom('') - .firstChild); - - chai.assert.notExists( - Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); - }); - - test('Child blocks', function() { - const parent = this.workspace.newBlock('input'); - const oldChild = this.workspace.newBlock('multiple_inputs'); - const childX = this.workspace.newBlock('single_input'); - const childY = this.workspace.newBlock('single_input'); - const newChild = this.workspace.newBlock('output'); - - parent.getInput('INPUT').connection.connect(oldChild.outputConnection); - oldChild.getInput('INPUT').connection.connect(childX.outputConnection); - oldChild.getInput('INPUT2').connection.connect(childY.outputConnection); - childX.getInput('INPUT').connection.setShadowDom( - Blockly.Xml.textToDom('') - .firstChild); - childY.getInput('INPUT').connection.setShadowDom( - Blockly.Xml.textToDom('') - .firstChild); - - chai.assert.notExists( - Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); - }); - - test('Spots filled', function() { - const parent = this.workspace.newBlock('input'); - const oldChild = this.workspace.newBlock('multiple_inputs'); - const otherChild = this.workspace.newBlock('output'); - const newChild = this.workspace.newBlock('output'); - - parent.getInput('INPUT').connection - .connect(oldChild.outputConnection); - oldChild.getInput('INPUT').connection - .connect(otherChild.outputConnection); - oldChild.getInput('INPUT2').connection.setShadowDom( - Blockly.Xml.textToDom('') - .firstChild); - - chai.assert.notExists( - Blockly.Connection.getConnectionForOrphanedOutput(oldChild, newChild)); - }); - }); - }); - - suite('Single available spot', function() { - setup(function() { - Blockly.defineBlocksWithJsonArray([ - { - 'type': 'single_input', - 'message0': '%1', - 'args0': [ - { - 'type': 'input_value', - 'name': 'INPUT', - 'check': 'check' - }, - ], - 'output': 'check', - }, - ]); - }); - - test('No shadows', function() { - const parent = this.workspace.newBlock('input'); - const oldChild = this.workspace.newBlock('single_input'); - const newChild = this.workspace.newBlock('output'); - - parent.getInput('INPUT').connection.connect(oldChild.outputConnection); - - const result = Blockly.Connection - .getConnectionForOrphanedOutput(oldChild, newChild); - chai.assert.exists(result); - chai.assert.equal(result.getParentInput().name, 'INPUT'); - }); - - test('Shadows', function() { - const parent = this.workspace.newBlock('input'); - const oldChild = this.workspace.newBlock('single_input'); - const newChild = this.workspace.newBlock('output'); - - parent.getInput('INPUT').connection.connect(oldChild.outputConnection); - oldChild.getInput('INPUT').connection.setShadowDom( - Blockly.Xml.textToDom('') - .firstChild); - - const result = Blockly.Connection - .getConnectionForOrphanedOutput(oldChild, newChild); - chai.assert.exists(result); - chai.assert.equal(result.getParentInput().name, 'INPUT'); - }); - }); - }); }); From fc6a1be3d982349292b630d2818b3b5509688d5f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Jun 2021 16:55:17 -0700 Subject: [PATCH 11/12] Bump ws from 7.2.3 to 7.4.6 (#4858) Bumps [ws](https://github.com/websockets/ws) from 7.2.3 to 7.4.6. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/7.2.3...7.4.6) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3d5d6c40b..9af3ca751 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9370,9 +9370,9 @@ "dev": true }, "ws": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", - "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==" + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==" }, "xml-name-validator": { "version": "3.0.0", From c83ff6ca06cb6cfb7eaf00a77cba2531287af69c Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 1 Jul 2021 15:20:16 +0000 Subject: [PATCH 12/12] Bump README release date. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b95ca1c7..a9b330ab8 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Want to make Blockly better? We welcome contributions to Blockly in the form of ## Releases -The next major release will be **March 25th, 2021**. +The next major release will be **September 30th, 2021**. We release by pushing the latest code to the master branch, followed by updating the npm package, our [docs](https://developers.google.com/blockly), and [demo pages](https://google.github.io/blockly-samples/). We typically release a new version of Blockly once a quarter (every 3 months). If there are breaking bugs, such as a crash when performing a standard action or a rendering issue that makes Blockly unusable, we will cherry-pick fixes to master between releases to fix them. The [releases page](https://github.com/google/blockly/releases) has a list of all releases.