From 84f6dfef4fe9b0c6a89794f2b97c0cfa7c4b411d Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Wed, 5 Oct 2022 06:38:32 +0200 Subject: [PATCH 01/69] Fix: `//` isn't a legal comment in CSS (#6467) --- core/css.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/css.ts b/core/css.ts index 4d7917d2d..81b2e15a9 100644 --- a/core/css.ts +++ b/core/css.ts @@ -160,7 +160,7 @@ let content = ` } .blocklyDropDownContent { - max-height: 300px; // @todo: spec for maximum height. + max-height: 300px; /* @todo: spec for maximum height. */ overflow: auto; overflow-x: hidden; position: relative; From fe714bb8c72ac8870f80c1ea88c256434d105aef Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 5 Oct 2022 13:35:20 -0700 Subject: [PATCH 02/69] test: add skipped tests for the procedure map (#6486) * test: add skipped tests for the procedure map * chore: format --- tests/mocha/index.html | 1 + tests/mocha/procedure_map_test.js | 187 ++++++++++++++++++++++++++++++ 2 files changed, 188 insertions(+) create mode 100644 tests/mocha/procedure_map_test.js diff --git a/tests/mocha/index.html b/tests/mocha/index.html index 0c5806244..561454f2d 100644 --- a/tests/mocha/index.html +++ b/tests/mocha/index.html @@ -92,6 +92,7 @@ 'Blockly.test.metrics', 'Blockly.test.mutator', 'Blockly.test.names', + 'Blockly.test.procedureMap', 'Blockly.test.procedures', 'Blockly.test.registry', 'Blockly.test.serialization', diff --git a/tests/mocha/procedure_map_test.js b/tests/mocha/procedure_map_test.js new file mode 100644 index 000000000..08e5f8137 --- /dev/null +++ b/tests/mocha/procedure_map_test.js @@ -0,0 +1,187 @@ +/** + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js'; + +goog.declareModuleId('Blockly.test.procedureMap'); + +suite.skip('Procedure Map', function() { + setup(function() { + sharedTestSetup.call(this); + this.workspace = new Blockly.Workspace(); + this.procedureMap = this.workspace.getProcedureMap(); + }); + + teardown(function() { + sharedTestTeardown.call(this); + }); + + suite('triggering block updates', function() { + setup(function() { + Blockly.Blocks['procedure_mock'] = { + init: function() { }, + doProcedureUpdate: function() {}, + }; + + this.procedureBlock = this.workspace.newBlock('procedure_mock'); + + this.updateSpy = sinon.spy(this.procedureBlock, 'doProcedureUpdate'); + }); + + teardown(function() { + delete Blockly.Blocks['procedure_mock']; + }); + + suite('procedure map updates', function() { + test('adding a procedure does not trigger an update', function() { + this.procedureMap.addProcedure( + new Blockly.procedures.ObservableProcedureModel(this.workspace)); + + chai.assert.isFalse( + this.updateSpy.called, 'Expected no update to be triggered'); + }); + + test('deleting a procedure triggers an update', function() { + const procedureModel = + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); + + this.procedureMap.deleteProcedure(procedureModel.getId()); + + chai.assert.isTrue( + this.updateSpy.calledOnce, 'Expected an update to be triggered'); + }); + }); + + suite('procedure model updates', function() { + test('setting the name triggers an update', function() { + const procedureModel = + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); + + procedureModel.setName('new name'); + + chai.assert.isTrue( + this.updateSpy.calledOnce, 'Expected an update to be triggered'); + }); + + test('setting the return type triggers an update', function() { + const procedureModel = + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); + + procedureModel.setReturnType(['return type 1', 'return type 2']); + + chai.assert.isTrue( + this.updateSpy.calledOnce, 'Expected an update to be triggered'); + }); + + test('removing the return type triggers an update', function() { + const procedureModel = + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); + + procedureModel.setReturnType(['return type']); + this.updateSpy.reset(); + procedureModel.setReturnType(null); + + chai.assert.isTrue( + this.updateSpy.calledOnce, 'Expected an update to be triggered'); + }); + + test('disabling the procedure triggers an update', function() { + const procedureModel = + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); + + procedureModel.setEnabled(false); + + chai.assert.isTrue( + this.updateSpy.calledOnce, 'Expected an update to be triggered'); + }); + + test('enabling the procedure triggers an update', function() { + const procedureModel = + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); + procedureModel.setEnabled(false); + this.updateSpy.reset(); + + procedureModel.setEnabled(true); + + chai.assert.isTrue( + this.updateSpy.calledOnce, 'Expected an update to be triggered'); + }); + + test('inserting a parameter triggers an update', function() { + const procedureModel = + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); + + procedureModel.insertParameter( + new Blockly.procedures.ObservableParameterModel(this.workspace)); + + chai.assert.isTrue( + this.updateSpy.calledOnce, 'Expected an update to be triggered'); + }); + + test('deleting a parameter triggers an update', function() { + const procedureModel = + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); + procedureModel.insertParameter( + new Blockly.procedures.ObservableParameterModel(this.workspace)); + this.updateSpy.reset(); + + procedureModel.deleteParameter(0); + + chai.assert.isTrue( + this.updateSpy.calledOnce, 'Expected an update to be triggered'); + }); + }); + + suite('parameter model updates', function() { + test('setting the variable model triggers an update', function() { + const procedureModel = + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); + const parameterModel = + new Blockly.procedures.ObservableParameterModel(this.workspace); + procedureModel.insertParameter(parameterModel); + this.updateSpy.reset(); + + parameterModel.setVariable( + new Blockly.VariableModel(this.workspace, 'variable')); + + chai.assert.isTrue( + this.updateSpy.calledOnce, 'Expected an update to be triggered'); + }); + + test('modifying the variable model does not trigger an update', function() { + const procedureModel = + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); + const parameterModel = + new Blockly.procedures.ObservableParameterModel(this.workspace); + procedureModel.insertParameter(parameterModel); + const variableModel = + new Blockly.VariableModel(this.workspace, 'variable'); + parameterModel.setVariable(variableModel); + this.updateSpy.reset(); + + variableModel.name = 'some name'; + variableModel.type = 'some type'; + + chai.assert.isFalse( + this.updateSpy.called, 'Expected no update to be triggered'); + }); + }); + }); + + suite('event firing', function() { + // TBA after the procedure map is implemented + }); +}); From 083ea0c3709742753ffebd4465507b94937165aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Oct 2022 13:35:45 -0700 Subject: [PATCH 03/69] chore(deps): bump webdriverio from 7.25.0 to 7.25.1 (#6468) Bumps [webdriverio](https://github.com/webdriverio/webdriverio) from 7.25.0 to 7.25.1. - [Release notes](https://github.com/webdriverio/webdriverio/releases) - [Changelog](https://github.com/webdriverio/webdriverio/blob/main/CHANGELOG.md) - [Commits](https://github.com/webdriverio/webdriverio/compare/v7.25.0...v7.25.1) --- updated-dependencies: - dependency-name: webdriverio dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 320 +++++++++++++++++++++++----------------------- 1 file changed, 160 insertions(+), 160 deletions(-) diff --git a/package-lock.json b/package-lock.json index 99fba3746..67fb9dd5c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1684,21 +1684,21 @@ } }, "node_modules/@wdio/repl": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-7.25.0.tgz", - "integrity": "sha512-XhWsiOgKnkJ/0z2Um+ckcLVUHjyBB9JEtdP2mY2LjkK55W2/mXl+Mg0G3zNbG3YvT8VCV3QzSFAJKBhyfaBjwA==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-7.25.1.tgz", + "integrity": "sha512-3DUtOrLi5thba22IBn/XQ7caFrbXtYOg3750UtXxUuxXU4QHkKq1AN8+WXr4Rq2EnXfB2G9t9pEdqjZSv9oPAw==", "dev": true, "dependencies": { - "@wdio/utils": "7.25.0" + "@wdio/utils": "7.25.1" }, "engines": { "node": ">=12.0.0" } }, "node_modules/@wdio/repl/node_modules/@types/node": { - "version": "18.7.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.21.tgz", - "integrity": "sha512-rLFzK5bhM0YPyCoTC8bolBjMk7bwnZ8qeZUBslBfjZQou2ssJdWslx9CZ8DGM+Dx7QXQiiTVZ/6QO6kwtHkZCA==", + "version": "18.8.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.0.tgz", + "integrity": "sha512-u+h43R6U8xXDt2vzUaVP3VwjjLyOJk6uEciZS8OSyziUQGOwmk+l+4drxcsDboHXwyTaqS1INebghmWMRxq3LA==", "dev": true }, "node_modules/@wdio/repl/node_modules/@wdio/logger": { @@ -1717,9 +1717,9 @@ } }, "node_modules/@wdio/repl/node_modules/@wdio/types": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.0.tgz", - "integrity": "sha512-BET/5UZSobAiBSbpWlUzcdjU1WszuUhaGBY7Pj4aAZjlvEeU5ZW5q2/655kxAvFhqHZ4AFEgd6NXg8krOEkXaA==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.1.tgz", + "integrity": "sha512-9Xt2U0YXYxRW4UvMFwjt+44UkfhwrI1gPhW+y56SubpyKaUfdNGberteboQoR/7Os1SVtJry4FohEZNmFzPK6g==", "dev": true, "dependencies": { "@types/node": "^18.0.0", @@ -1738,13 +1738,13 @@ } }, "node_modules/@wdio/repl/node_modules/@wdio/utils": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.0.tgz", - "integrity": "sha512-dRPJoVb2wsMv/GFwAVcVbp0+8CE+vVeW/+lpre6ocn36WAnDQJD6X5UGYde5oQeXGyjzj1/nMHBSsr+ifvuJRQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.1.tgz", + "integrity": "sha512-DL+nDRVgzruJLhedBUQEMUcojLoGwsjCQCYWram4NfwAIIkxcAX/5Y4vHSut3OoW2bEHl3R8/FQ4B/ivIr2EoQ==", "dev": true, "dependencies": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", + "@wdio/types": "7.25.1", "p-iteration": "^1.1.8" }, "engines": { @@ -4107,18 +4107,18 @@ } }, "node_modules/devtools": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/devtools/-/devtools-7.25.0.tgz", - "integrity": "sha512-SU9jKoJJccXKXfYiIqgktoL5TuzLglqcHeivPPJjzhX17S99zH9bHw4SyhQALox3J1Xgmim+dzO6yTQtRU6cAQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/devtools/-/devtools-7.25.1.tgz", + "integrity": "sha512-01T8QZeiD92MpI/7rP8kUflN3XcMqv2moa07123OjjENuuOhYxRWmJ7xj94txnF5PJp1Cv8/jvK8EUbnEHf6MQ==", "dev": true, "dependencies": { "@types/node": "^18.0.0", "@types/ua-parser-js": "^0.7.33", - "@wdio/config": "7.25.0", + "@wdio/config": "7.25.1", "@wdio/logger": "7.19.0", "@wdio/protocols": "7.22.0", - "@wdio/types": "7.25.0", - "@wdio/utils": "7.25.0", + "@wdio/types": "7.25.1", + "@wdio/utils": "7.25.1", "chrome-launcher": "^0.15.0", "edge-paths": "^2.1.0", "puppeteer-core": "^13.1.3", @@ -4137,20 +4137,20 @@ "dev": true }, "node_modules/devtools/node_modules/@types/node": { - "version": "18.7.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.21.tgz", - "integrity": "sha512-rLFzK5bhM0YPyCoTC8bolBjMk7bwnZ8qeZUBslBfjZQou2ssJdWslx9CZ8DGM+Dx7QXQiiTVZ/6QO6kwtHkZCA==", + "version": "18.8.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.0.tgz", + "integrity": "sha512-u+h43R6U8xXDt2vzUaVP3VwjjLyOJk6uEciZS8OSyziUQGOwmk+l+4drxcsDboHXwyTaqS1INebghmWMRxq3LA==", "dev": true }, "node_modules/devtools/node_modules/@wdio/config": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.0.tgz", - "integrity": "sha512-fttJIPu9x2H9sz6g7GsDNx0LH6S3EyXUjrk3nUz+ccwgnXtq3E3WyGgBdZsAObItvvplLNM5nSdtWNZSW0+Dzw==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.1.tgz", + "integrity": "sha512-7I3L+TE75gvh8jiv8cE/Ch9S9erDgrZG9o5587OlNKfpgFciT7DH7/efPXzYwh8YPFV3grFaydxaaoYzDv6PDA==", "dev": true, "dependencies": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", - "@wdio/utils": "7.25.0", + "@wdio/types": "7.25.1", + "@wdio/utils": "7.25.1", "deepmerge": "^4.0.0", "glob": "^8.0.3" }, @@ -4183,9 +4183,9 @@ } }, "node_modules/devtools/node_modules/@wdio/types": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.0.tgz", - "integrity": "sha512-BET/5UZSobAiBSbpWlUzcdjU1WszuUhaGBY7Pj4aAZjlvEeU5ZW5q2/655kxAvFhqHZ4AFEgd6NXg8krOEkXaA==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.1.tgz", + "integrity": "sha512-9Xt2U0YXYxRW4UvMFwjt+44UkfhwrI1gPhW+y56SubpyKaUfdNGberteboQoR/7Os1SVtJry4FohEZNmFzPK6g==", "dev": true, "dependencies": { "@types/node": "^18.0.0", @@ -4204,13 +4204,13 @@ } }, "node_modules/devtools/node_modules/@wdio/utils": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.0.tgz", - "integrity": "sha512-dRPJoVb2wsMv/GFwAVcVbp0+8CE+vVeW/+lpre6ocn36WAnDQJD6X5UGYde5oQeXGyjzj1/nMHBSsr+ifvuJRQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.1.tgz", + "integrity": "sha512-DL+nDRVgzruJLhedBUQEMUcojLoGwsjCQCYWram4NfwAIIkxcAX/5Y4vHSut3OoW2bEHl3R8/FQ4B/ivIr2EoQ==", "dev": true, "dependencies": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", + "@wdio/types": "7.25.1", "p-iteration": "^1.1.8" }, "engines": { @@ -12966,17 +12966,17 @@ } }, "node_modules/webdriver": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-7.25.0.tgz", - "integrity": "sha512-fYsxVMHpYAXecJP1m+fqC3BSKrWS3fcCiI120NRnZrZ52vcodpiJSuOAedKIXegQZlzl77U4VWeSHiY1f6Iseg==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-7.25.1.tgz", + "integrity": "sha512-BmR5RT37EGNJj/O/GTCqBKXV/Jr9V4oQTTDaurZixVKW0ubG7uyfrhiklzuWUtmES9VualTKgQumhGhchBTC6g==", "dev": true, "dependencies": { "@types/node": "^18.0.0", - "@wdio/config": "7.25.0", + "@wdio/config": "7.25.1", "@wdio/logger": "7.19.0", "@wdio/protocols": "7.22.0", - "@wdio/types": "7.25.0", - "@wdio/utils": "7.25.0", + "@wdio/types": "7.25.1", + "@wdio/utils": "7.25.1", "got": "^11.0.2", "ky": "0.30.0", "lodash.merge": "^4.6.1" @@ -12986,20 +12986,20 @@ } }, "node_modules/webdriver/node_modules/@types/node": { - "version": "18.7.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.21.tgz", - "integrity": "sha512-rLFzK5bhM0YPyCoTC8bolBjMk7bwnZ8qeZUBslBfjZQou2ssJdWslx9CZ8DGM+Dx7QXQiiTVZ/6QO6kwtHkZCA==", + "version": "18.8.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.0.tgz", + "integrity": "sha512-u+h43R6U8xXDt2vzUaVP3VwjjLyOJk6uEciZS8OSyziUQGOwmk+l+4drxcsDboHXwyTaqS1INebghmWMRxq3LA==", "dev": true }, "node_modules/webdriver/node_modules/@wdio/config": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.0.tgz", - "integrity": "sha512-fttJIPu9x2H9sz6g7GsDNx0LH6S3EyXUjrk3nUz+ccwgnXtq3E3WyGgBdZsAObItvvplLNM5nSdtWNZSW0+Dzw==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.1.tgz", + "integrity": "sha512-7I3L+TE75gvh8jiv8cE/Ch9S9erDgrZG9o5587OlNKfpgFciT7DH7/efPXzYwh8YPFV3grFaydxaaoYzDv6PDA==", "dev": true, "dependencies": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", - "@wdio/utils": "7.25.0", + "@wdio/types": "7.25.1", + "@wdio/utils": "7.25.1", "deepmerge": "^4.0.0", "glob": "^8.0.3" }, @@ -13032,9 +13032,9 @@ } }, "node_modules/webdriver/node_modules/@wdio/types": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.0.tgz", - "integrity": "sha512-BET/5UZSobAiBSbpWlUzcdjU1WszuUhaGBY7Pj4aAZjlvEeU5ZW5q2/655kxAvFhqHZ4AFEgd6NXg8krOEkXaA==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.1.tgz", + "integrity": "sha512-9Xt2U0YXYxRW4UvMFwjt+44UkfhwrI1gPhW+y56SubpyKaUfdNGberteboQoR/7Os1SVtJry4FohEZNmFzPK6g==", "dev": true, "dependencies": { "@types/node": "^18.0.0", @@ -13053,13 +13053,13 @@ } }, "node_modules/webdriver/node_modules/@wdio/utils": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.0.tgz", - "integrity": "sha512-dRPJoVb2wsMv/GFwAVcVbp0+8CE+vVeW/+lpre6ocn36WAnDQJD6X5UGYde5oQeXGyjzj1/nMHBSsr+ifvuJRQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.1.tgz", + "integrity": "sha512-DL+nDRVgzruJLhedBUQEMUcojLoGwsjCQCYWram4NfwAIIkxcAX/5Y4vHSut3OoW2bEHl3R8/FQ4B/ivIr2EoQ==", "dev": true, "dependencies": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", + "@wdio/types": "7.25.1", "p-iteration": "^1.1.8" }, "engines": { @@ -13119,24 +13119,24 @@ } }, "node_modules/webdriverio": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-7.25.0.tgz", - "integrity": "sha512-7s7PSeGpcUkZq3UTjdG8etbblAerp27Jyf/VQ4Nr0bdZACDfsCVSyvQQuD0HH880VryV+7tjXK6cSV4eYzY64Q==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-7.25.1.tgz", + "integrity": "sha512-8O5FgQWZzByen2vivBXa101PwsJT/wOLUSdks80nxbFHVWKI/5kda1zi+m6x01ATtStva4xMQCxW/Df7QVloKA==", "dev": true, "dependencies": { "@types/aria-query": "^5.0.0", "@types/node": "^18.0.0", - "@wdio/config": "7.25.0", + "@wdio/config": "7.25.1", "@wdio/logger": "7.19.0", "@wdio/protocols": "7.22.0", - "@wdio/repl": "7.25.0", - "@wdio/types": "7.25.0", - "@wdio/utils": "7.25.0", + "@wdio/repl": "7.25.1", + "@wdio/types": "7.25.1", + "@wdio/utils": "7.25.1", "archiver": "^5.0.0", "aria-query": "^5.0.0", "css-shorthand-properties": "^1.1.1", "css-value": "^0.0.1", - "devtools": "7.25.0", + "devtools": "7.25.1", "devtools-protocol": "^0.0.1049481", "fs-extra": "^10.0.0", "grapheme-splitter": "^1.0.2", @@ -13150,27 +13150,27 @@ "resq": "^1.9.1", "rgb2hex": "0.2.5", "serialize-error": "^8.0.0", - "webdriver": "7.25.0" + "webdriver": "7.25.1" }, "engines": { "node": ">=12.0.0" } }, "node_modules/webdriverio/node_modules/@types/node": { - "version": "18.7.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.21.tgz", - "integrity": "sha512-rLFzK5bhM0YPyCoTC8bolBjMk7bwnZ8qeZUBslBfjZQou2ssJdWslx9CZ8DGM+Dx7QXQiiTVZ/6QO6kwtHkZCA==", + "version": "18.8.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.0.tgz", + "integrity": "sha512-u+h43R6U8xXDt2vzUaVP3VwjjLyOJk6uEciZS8OSyziUQGOwmk+l+4drxcsDboHXwyTaqS1INebghmWMRxq3LA==", "dev": true }, "node_modules/webdriverio/node_modules/@wdio/config": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.0.tgz", - "integrity": "sha512-fttJIPu9x2H9sz6g7GsDNx0LH6S3EyXUjrk3nUz+ccwgnXtq3E3WyGgBdZsAObItvvplLNM5nSdtWNZSW0+Dzw==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.1.tgz", + "integrity": "sha512-7I3L+TE75gvh8jiv8cE/Ch9S9erDgrZG9o5587OlNKfpgFciT7DH7/efPXzYwh8YPFV3grFaydxaaoYzDv6PDA==", "dev": true, "dependencies": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", - "@wdio/utils": "7.25.0", + "@wdio/types": "7.25.1", + "@wdio/utils": "7.25.1", "deepmerge": "^4.0.0", "glob": "^8.0.3" }, @@ -13203,9 +13203,9 @@ } }, "node_modules/webdriverio/node_modules/@wdio/types": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.0.tgz", - "integrity": "sha512-BET/5UZSobAiBSbpWlUzcdjU1WszuUhaGBY7Pj4aAZjlvEeU5ZW5q2/655kxAvFhqHZ4AFEgd6NXg8krOEkXaA==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.1.tgz", + "integrity": "sha512-9Xt2U0YXYxRW4UvMFwjt+44UkfhwrI1gPhW+y56SubpyKaUfdNGberteboQoR/7Os1SVtJry4FohEZNmFzPK6g==", "dev": true, "dependencies": { "@types/node": "^18.0.0", @@ -13224,13 +13224,13 @@ } }, "node_modules/webdriverio/node_modules/@wdio/utils": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.0.tgz", - "integrity": "sha512-dRPJoVb2wsMv/GFwAVcVbp0+8CE+vVeW/+lpre6ocn36WAnDQJD6X5UGYde5oQeXGyjzj1/nMHBSsr+ifvuJRQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.1.tgz", + "integrity": "sha512-DL+nDRVgzruJLhedBUQEMUcojLoGwsjCQCYWram4NfwAIIkxcAX/5Y4vHSut3OoW2bEHl3R8/FQ4B/ivIr2EoQ==", "dev": true, "dependencies": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", + "@wdio/types": "7.25.1", "p-iteration": "^1.1.8" }, "engines": { @@ -14987,18 +14987,18 @@ "peer": true }, "@wdio/repl": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-7.25.0.tgz", - "integrity": "sha512-XhWsiOgKnkJ/0z2Um+ckcLVUHjyBB9JEtdP2mY2LjkK55W2/mXl+Mg0G3zNbG3YvT8VCV3QzSFAJKBhyfaBjwA==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-7.25.1.tgz", + "integrity": "sha512-3DUtOrLi5thba22IBn/XQ7caFrbXtYOg3750UtXxUuxXU4QHkKq1AN8+WXr4Rq2EnXfB2G9t9pEdqjZSv9oPAw==", "dev": true, "requires": { - "@wdio/utils": "7.25.0" + "@wdio/utils": "7.25.1" }, "dependencies": { "@types/node": { - "version": "18.7.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.21.tgz", - "integrity": "sha512-rLFzK5bhM0YPyCoTC8bolBjMk7bwnZ8qeZUBslBfjZQou2ssJdWslx9CZ8DGM+Dx7QXQiiTVZ/6QO6kwtHkZCA==", + "version": "18.8.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.0.tgz", + "integrity": "sha512-u+h43R6U8xXDt2vzUaVP3VwjjLyOJk6uEciZS8OSyziUQGOwmk+l+4drxcsDboHXwyTaqS1INebghmWMRxq3LA==", "dev": true }, "@wdio/logger": { @@ -15014,9 +15014,9 @@ } }, "@wdio/types": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.0.tgz", - "integrity": "sha512-BET/5UZSobAiBSbpWlUzcdjU1WszuUhaGBY7Pj4aAZjlvEeU5ZW5q2/655kxAvFhqHZ4AFEgd6NXg8krOEkXaA==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.1.tgz", + "integrity": "sha512-9Xt2U0YXYxRW4UvMFwjt+44UkfhwrI1gPhW+y56SubpyKaUfdNGberteboQoR/7Os1SVtJry4FohEZNmFzPK6g==", "dev": true, "requires": { "@types/node": "^18.0.0", @@ -15024,13 +15024,13 @@ } }, "@wdio/utils": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.0.tgz", - "integrity": "sha512-dRPJoVb2wsMv/GFwAVcVbp0+8CE+vVeW/+lpre6ocn36WAnDQJD6X5UGYde5oQeXGyjzj1/nMHBSsr+ifvuJRQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.1.tgz", + "integrity": "sha512-DL+nDRVgzruJLhedBUQEMUcojLoGwsjCQCYWram4NfwAIIkxcAX/5Y4vHSut3OoW2bEHl3R8/FQ4B/ivIr2EoQ==", "dev": true, "requires": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", + "@wdio/types": "7.25.1", "p-iteration": "^1.1.8" } } @@ -16857,18 +16857,18 @@ "dev": true }, "devtools": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/devtools/-/devtools-7.25.0.tgz", - "integrity": "sha512-SU9jKoJJccXKXfYiIqgktoL5TuzLglqcHeivPPJjzhX17S99zH9bHw4SyhQALox3J1Xgmim+dzO6yTQtRU6cAQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/devtools/-/devtools-7.25.1.tgz", + "integrity": "sha512-01T8QZeiD92MpI/7rP8kUflN3XcMqv2moa07123OjjENuuOhYxRWmJ7xj94txnF5PJp1Cv8/jvK8EUbnEHf6MQ==", "dev": true, "requires": { "@types/node": "^18.0.0", "@types/ua-parser-js": "^0.7.33", - "@wdio/config": "7.25.0", + "@wdio/config": "7.25.1", "@wdio/logger": "7.19.0", "@wdio/protocols": "7.22.0", - "@wdio/types": "7.25.0", - "@wdio/utils": "7.25.0", + "@wdio/types": "7.25.1", + "@wdio/utils": "7.25.1", "chrome-launcher": "^0.15.0", "edge-paths": "^2.1.0", "puppeteer-core": "^13.1.3", @@ -16878,20 +16878,20 @@ }, "dependencies": { "@types/node": { - "version": "18.7.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.21.tgz", - "integrity": "sha512-rLFzK5bhM0YPyCoTC8bolBjMk7bwnZ8qeZUBslBfjZQou2ssJdWslx9CZ8DGM+Dx7QXQiiTVZ/6QO6kwtHkZCA==", + "version": "18.8.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.0.tgz", + "integrity": "sha512-u+h43R6U8xXDt2vzUaVP3VwjjLyOJk6uEciZS8OSyziUQGOwmk+l+4drxcsDboHXwyTaqS1INebghmWMRxq3LA==", "dev": true }, "@wdio/config": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.0.tgz", - "integrity": "sha512-fttJIPu9x2H9sz6g7GsDNx0LH6S3EyXUjrk3nUz+ccwgnXtq3E3WyGgBdZsAObItvvplLNM5nSdtWNZSW0+Dzw==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.1.tgz", + "integrity": "sha512-7I3L+TE75gvh8jiv8cE/Ch9S9erDgrZG9o5587OlNKfpgFciT7DH7/efPXzYwh8YPFV3grFaydxaaoYzDv6PDA==", "dev": true, "requires": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", - "@wdio/utils": "7.25.0", + "@wdio/types": "7.25.1", + "@wdio/utils": "7.25.1", "deepmerge": "^4.0.0", "glob": "^8.0.3" } @@ -16915,9 +16915,9 @@ "dev": true }, "@wdio/types": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.0.tgz", - "integrity": "sha512-BET/5UZSobAiBSbpWlUzcdjU1WszuUhaGBY7Pj4aAZjlvEeU5ZW5q2/655kxAvFhqHZ4AFEgd6NXg8krOEkXaA==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.1.tgz", + "integrity": "sha512-9Xt2U0YXYxRW4UvMFwjt+44UkfhwrI1gPhW+y56SubpyKaUfdNGberteboQoR/7Os1SVtJry4FohEZNmFzPK6g==", "dev": true, "requires": { "@types/node": "^18.0.0", @@ -16925,13 +16925,13 @@ } }, "@wdio/utils": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.0.tgz", - "integrity": "sha512-dRPJoVb2wsMv/GFwAVcVbp0+8CE+vVeW/+lpre6ocn36WAnDQJD6X5UGYde5oQeXGyjzj1/nMHBSsr+ifvuJRQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.1.tgz", + "integrity": "sha512-DL+nDRVgzruJLhedBUQEMUcojLoGwsjCQCYWram4NfwAIIkxcAX/5Y4vHSut3OoW2bEHl3R8/FQ4B/ivIr2EoQ==", "dev": true, "requires": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", + "@wdio/types": "7.25.1", "p-iteration": "^1.1.8" } }, @@ -23989,37 +23989,37 @@ } }, "webdriver": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-7.25.0.tgz", - "integrity": "sha512-fYsxVMHpYAXecJP1m+fqC3BSKrWS3fcCiI120NRnZrZ52vcodpiJSuOAedKIXegQZlzl77U4VWeSHiY1f6Iseg==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-7.25.1.tgz", + "integrity": "sha512-BmR5RT37EGNJj/O/GTCqBKXV/Jr9V4oQTTDaurZixVKW0ubG7uyfrhiklzuWUtmES9VualTKgQumhGhchBTC6g==", "dev": true, "requires": { "@types/node": "^18.0.0", - "@wdio/config": "7.25.0", + "@wdio/config": "7.25.1", "@wdio/logger": "7.19.0", "@wdio/protocols": "7.22.0", - "@wdio/types": "7.25.0", - "@wdio/utils": "7.25.0", + "@wdio/types": "7.25.1", + "@wdio/utils": "7.25.1", "got": "^11.0.2", "ky": "0.30.0", "lodash.merge": "^4.6.1" }, "dependencies": { "@types/node": { - "version": "18.7.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.21.tgz", - "integrity": "sha512-rLFzK5bhM0YPyCoTC8bolBjMk7bwnZ8qeZUBslBfjZQou2ssJdWslx9CZ8DGM+Dx7QXQiiTVZ/6QO6kwtHkZCA==", + "version": "18.8.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.0.tgz", + "integrity": "sha512-u+h43R6U8xXDt2vzUaVP3VwjjLyOJk6uEciZS8OSyziUQGOwmk+l+4drxcsDboHXwyTaqS1INebghmWMRxq3LA==", "dev": true }, "@wdio/config": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.0.tgz", - "integrity": "sha512-fttJIPu9x2H9sz6g7GsDNx0LH6S3EyXUjrk3nUz+ccwgnXtq3E3WyGgBdZsAObItvvplLNM5nSdtWNZSW0+Dzw==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.1.tgz", + "integrity": "sha512-7I3L+TE75gvh8jiv8cE/Ch9S9erDgrZG9o5587OlNKfpgFciT7DH7/efPXzYwh8YPFV3grFaydxaaoYzDv6PDA==", "dev": true, "requires": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", - "@wdio/utils": "7.25.0", + "@wdio/types": "7.25.1", + "@wdio/utils": "7.25.1", "deepmerge": "^4.0.0", "glob": "^8.0.3" } @@ -24043,9 +24043,9 @@ "dev": true }, "@wdio/types": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.0.tgz", - "integrity": "sha512-BET/5UZSobAiBSbpWlUzcdjU1WszuUhaGBY7Pj4aAZjlvEeU5ZW5q2/655kxAvFhqHZ4AFEgd6NXg8krOEkXaA==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.1.tgz", + "integrity": "sha512-9Xt2U0YXYxRW4UvMFwjt+44UkfhwrI1gPhW+y56SubpyKaUfdNGberteboQoR/7Os1SVtJry4FohEZNmFzPK6g==", "dev": true, "requires": { "@types/node": "^18.0.0", @@ -24053,13 +24053,13 @@ } }, "@wdio/utils": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.0.tgz", - "integrity": "sha512-dRPJoVb2wsMv/GFwAVcVbp0+8CE+vVeW/+lpre6ocn36WAnDQJD6X5UGYde5oQeXGyjzj1/nMHBSsr+ifvuJRQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.1.tgz", + "integrity": "sha512-DL+nDRVgzruJLhedBUQEMUcojLoGwsjCQCYWram4NfwAIIkxcAX/5Y4vHSut3OoW2bEHl3R8/FQ4B/ivIr2EoQ==", "dev": true, "requires": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", + "@wdio/types": "7.25.1", "p-iteration": "^1.1.8" } }, @@ -24103,24 +24103,24 @@ } }, "webdriverio": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-7.25.0.tgz", - "integrity": "sha512-7s7PSeGpcUkZq3UTjdG8etbblAerp27Jyf/VQ4Nr0bdZACDfsCVSyvQQuD0HH880VryV+7tjXK6cSV4eYzY64Q==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-7.25.1.tgz", + "integrity": "sha512-8O5FgQWZzByen2vivBXa101PwsJT/wOLUSdks80nxbFHVWKI/5kda1zi+m6x01ATtStva4xMQCxW/Df7QVloKA==", "dev": true, "requires": { "@types/aria-query": "^5.0.0", "@types/node": "^18.0.0", - "@wdio/config": "7.25.0", + "@wdio/config": "7.25.1", "@wdio/logger": "7.19.0", "@wdio/protocols": "7.22.0", - "@wdio/repl": "7.25.0", - "@wdio/types": "7.25.0", - "@wdio/utils": "7.25.0", + "@wdio/repl": "7.25.1", + "@wdio/types": "7.25.1", + "@wdio/utils": "7.25.1", "archiver": "^5.0.0", "aria-query": "^5.0.0", "css-shorthand-properties": "^1.1.1", "css-value": "^0.0.1", - "devtools": "7.25.0", + "devtools": "7.25.1", "devtools-protocol": "^0.0.1049481", "fs-extra": "^10.0.0", "grapheme-splitter": "^1.0.2", @@ -24134,24 +24134,24 @@ "resq": "^1.9.1", "rgb2hex": "0.2.5", "serialize-error": "^8.0.0", - "webdriver": "7.25.0" + "webdriver": "7.25.1" }, "dependencies": { "@types/node": { - "version": "18.7.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.21.tgz", - "integrity": "sha512-rLFzK5bhM0YPyCoTC8bolBjMk7bwnZ8qeZUBslBfjZQou2ssJdWslx9CZ8DGM+Dx7QXQiiTVZ/6QO6kwtHkZCA==", + "version": "18.8.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.0.tgz", + "integrity": "sha512-u+h43R6U8xXDt2vzUaVP3VwjjLyOJk6uEciZS8OSyziUQGOwmk+l+4drxcsDboHXwyTaqS1INebghmWMRxq3LA==", "dev": true }, "@wdio/config": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.0.tgz", - "integrity": "sha512-fttJIPu9x2H9sz6g7GsDNx0LH6S3EyXUjrk3nUz+ccwgnXtq3E3WyGgBdZsAObItvvplLNM5nSdtWNZSW0+Dzw==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.1.tgz", + "integrity": "sha512-7I3L+TE75gvh8jiv8cE/Ch9S9erDgrZG9o5587OlNKfpgFciT7DH7/efPXzYwh8YPFV3grFaydxaaoYzDv6PDA==", "dev": true, "requires": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", - "@wdio/utils": "7.25.0", + "@wdio/types": "7.25.1", + "@wdio/utils": "7.25.1", "deepmerge": "^4.0.0", "glob": "^8.0.3" } @@ -24175,9 +24175,9 @@ "dev": true }, "@wdio/types": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.0.tgz", - "integrity": "sha512-BET/5UZSobAiBSbpWlUzcdjU1WszuUhaGBY7Pj4aAZjlvEeU5ZW5q2/655kxAvFhqHZ4AFEgd6NXg8krOEkXaA==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.1.tgz", + "integrity": "sha512-9Xt2U0YXYxRW4UvMFwjt+44UkfhwrI1gPhW+y56SubpyKaUfdNGberteboQoR/7Os1SVtJry4FohEZNmFzPK6g==", "dev": true, "requires": { "@types/node": "^18.0.0", @@ -24185,13 +24185,13 @@ } }, "@wdio/utils": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.0.tgz", - "integrity": "sha512-dRPJoVb2wsMv/GFwAVcVbp0+8CE+vVeW/+lpre6ocn36WAnDQJD6X5UGYde5oQeXGyjzj1/nMHBSsr+ifvuJRQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.1.tgz", + "integrity": "sha512-DL+nDRVgzruJLhedBUQEMUcojLoGwsjCQCYWram4NfwAIIkxcAX/5Y4vHSut3OoW2bEHl3R8/FQ4B/ivIr2EoQ==", "dev": true, "requires": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", + "@wdio/types": "7.25.1", "p-iteration": "^1.1.8" } }, From a263587ca0e389c10bbb9320849c78080f5409cb Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 5 Oct 2022 13:43:07 -0700 Subject: [PATCH 04/69] chore: rearrange serialization export to make APIExtractor happy (#6480) * chore: rearrange serialization export to make APIExtractor happy * chore: format --- core/blockly.ts | 19 ++----------------- core/serialization.ts | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 core/serialization.ts diff --git a/core/blockly.ts b/core/blockly.ts index 0682f729d..71c19f77d 100644 --- a/core/blockly.ts +++ b/core/blockly.ts @@ -104,7 +104,6 @@ import {IRegistrable} from './interfaces/i_registrable.js'; import {IRegistrableField} from './interfaces/i_registrable_field.js'; import {ISelectable} from './interfaces/i_selectable.js'; import {ISelectableToolboxItem} from './interfaces/i_selectable_toolbox_item.js'; -import {ISerializer as SerializerInterface} from './interfaces/i_serializer.js'; import {IStyleable} from './interfaces/i_styleable.js'; import {IToolbox} from './interfaces/i_toolbox.js'; import {IToolboxItem} from './interfaces/i_toolbox_item.js'; @@ -134,12 +133,7 @@ import * as thrasos from './renderers/thrasos/thrasos.js'; import * as zelos from './renderers/zelos/zelos.js'; import {Scrollbar} from './scrollbar.js'; import {ScrollbarPair} from './scrollbar_pair.js'; -import * as serializationBlocks from './serialization/blocks.js'; -import * as serializationExceptions from './serialization/exceptions.js'; -import * as serializationPriorities from './serialization/priorities.js'; -import * as serializationRegistry from './serialization/registry.js'; -import * as serializationVariables from './serialization/variables.js'; -import * as serializationWorkspaces from './serialization/workspaces.js'; +import * as serialization from './serialization.js'; import * as ShortcutItems from './shortcut_items.js'; import {ShortcutRegistry} from './shortcut_registry.js'; import {Theme} from './theme.js'; @@ -157,7 +151,6 @@ import {Trashcan} from './trashcan.js'; import * as utils from './utils.js'; import * as colour from './utils/colour.js'; import * as deprecation from './utils/deprecation.js'; -import * as svgMath from './utils/svg_math.js'; import * as toolbox from './utils/toolbox.js'; import {VariableMap} from './variable_map.js'; import {VariableModel} from './variable_model.js'; @@ -743,12 +736,4 @@ export {config}; export const connectionTypes = ConnectionType; export {inject}; export {inputTypes}; -export namespace serialization { - export const blocks = serializationBlocks; - export const exceptions = serializationExceptions; - export const priorities = serializationPriorities; - export const registry = serializationRegistry; - export const variables = serializationVariables; - export const workspaces = serializationWorkspaces; - export type ISerializer = SerializerInterface; -} +export {serialization}; diff --git a/core/serialization.ts b/core/serialization.ts new file mode 100644 index 000000000..991b022ad --- /dev/null +++ b/core/serialization.ts @@ -0,0 +1,29 @@ +/** + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * Serialization methods. + */ +import * as goog from '../closure/goog/goog.js'; +goog.declareModuleId('Blockly.serialization'); + +import * as blocks from './serialization/blocks.js'; +import * as exceptions from './serialization/exceptions.js'; +import * as priorities from './serialization/priorities.js'; +import * as registry from './serialization/registry.js'; +import * as variables from './serialization/variables.js'; +import * as workspaces from './serialization/workspaces.js'; +import {ISerializer} from './interfaces/i_serializer.js'; + +export { + blocks, + exceptions, + priorities, + registry, + variables, + workspaces, + ISerializer, +}; From d4f2ba80406ae02df61a3902ff7c6571eca364aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Oct 2022 15:48:59 -0700 Subject: [PATCH 05/69] chore(deps): bump selenium-standalone from 8.2.0 to 8.2.1 (#6487) Bumps [selenium-standalone](https://github.com/webdriverio/selenium-standalone) from 8.2.0 to 8.2.1. - [Release notes](https://github.com/webdriverio/selenium-standalone/releases) - [Changelog](https://github.com/webdriverio/selenium-standalone/blob/main/HISTORY.md) - [Commits](https://github.com/webdriverio/selenium-standalone/compare/v8.2.0...v8.2.1) --- updated-dependencies: - dependency-name: selenium-standalone dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] 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 67fb9dd5c..baee6099e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11217,9 +11217,9 @@ "dev": true }, "node_modules/selenium-standalone": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.2.0.tgz", - "integrity": "sha512-gRFJm2A91sL0/4PavIsfTVNjyqNjk+zbdJg/zAYgTMjuoWJv+BlYJh+1UbEtyjt4YvZACYif1DFAzFjQapqiOA==", + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.2.1.tgz", + "integrity": "sha512-xRTtFt9YwGjmXLk7R4iCa67s2388DDJEKtPsXkh0nmuFxigYg3MDnVa2J0ucuFWNjaYEuu+U9rtxKk7qCXdFPg==", "dev": true, "dependencies": { "commander": "^9.0.0", @@ -22539,9 +22539,9 @@ "dev": true }, "selenium-standalone": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.2.0.tgz", - "integrity": "sha512-gRFJm2A91sL0/4PavIsfTVNjyqNjk+zbdJg/zAYgTMjuoWJv+BlYJh+1UbEtyjt4YvZACYif1DFAzFjQapqiOA==", + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.2.1.tgz", + "integrity": "sha512-xRTtFt9YwGjmXLk7R4iCa67s2388DDJEKtPsXkh0nmuFxigYg3MDnVa2J0ucuFWNjaYEuu+U9rtxKk7qCXdFPg==", "dev": true, "requires": { "commander": "^9.0.0", From 88a5bba64655e69c7ab8f884ee17207cb0ff1558 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Oct 2022 15:56:47 -0700 Subject: [PATCH 06/69] chore(deps): bump @wdio/selenium-standalone-service (#6490) Bumps [@wdio/selenium-standalone-service](https://github.com/webdriverio/webdriverio) from 7.25.0 to 7.25.1. - [Release notes](https://github.com/webdriverio/webdriverio/releases) - [Changelog](https://github.com/webdriverio/webdriverio/blob/main/CHANGELOG.md) - [Commits](https://github.com/webdriverio/webdriverio/compare/v7.25.0...v7.25.1) --- updated-dependencies: - dependency-name: "@wdio/selenium-standalone-service" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 80 +++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/package-lock.json b/package-lock.json index baee6099e..2e1b1a87b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1752,17 +1752,17 @@ } }, "node_modules/@wdio/selenium-standalone-service": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/selenium-standalone-service/-/selenium-standalone-service-7.25.0.tgz", - "integrity": "sha512-WRX4ljr6VRmV2YO+jqWSOhKMQKpLItJUklhOT9P98LwzMB607fMFTnN1vJ/rI3Q2ZLoHDPbPGnbmTYUw/4uzzQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/selenium-standalone-service/-/selenium-standalone-service-7.25.1.tgz", + "integrity": "sha512-TRD4hAxdHuZ0z414eDayE6q2gEmyAg7YdMrF+CJHWbjZKhJG4cqTSpV04zgMfQmTov5Y2+WtasdlGnqV5AXfMg==", "dev": true, "dependencies": { "@types/fs-extra": "^9.0.1", "@types/node": "^18.0.0", "@types/selenium-standalone": "^7.0.0", - "@wdio/config": "7.25.0", + "@wdio/config": "7.25.1", "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", + "@wdio/types": "7.25.1", "fs-extra": "^10.0.0", "selenium-standalone": "^8.0.3" }, @@ -1774,20 +1774,20 @@ } }, "node_modules/@wdio/selenium-standalone-service/node_modules/@types/node": { - "version": "18.7.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.21.tgz", - "integrity": "sha512-rLFzK5bhM0YPyCoTC8bolBjMk7bwnZ8qeZUBslBfjZQou2ssJdWslx9CZ8DGM+Dx7QXQiiTVZ/6QO6kwtHkZCA==", + "version": "18.8.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.2.tgz", + "integrity": "sha512-cRMwIgdDN43GO4xMWAfJAecYn8wV4JbsOGHNfNUIDiuYkUYAR5ec4Rj7IO2SAhFPEfpPtLtUTbbny/TCT7aDwA==", "dev": true }, "node_modules/@wdio/selenium-standalone-service/node_modules/@wdio/config": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.0.tgz", - "integrity": "sha512-fttJIPu9x2H9sz6g7GsDNx0LH6S3EyXUjrk3nUz+ccwgnXtq3E3WyGgBdZsAObItvvplLNM5nSdtWNZSW0+Dzw==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.1.tgz", + "integrity": "sha512-7I3L+TE75gvh8jiv8cE/Ch9S9erDgrZG9o5587OlNKfpgFciT7DH7/efPXzYwh8YPFV3grFaydxaaoYzDv6PDA==", "dev": true, "dependencies": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", - "@wdio/utils": "7.25.0", + "@wdio/types": "7.25.1", + "@wdio/utils": "7.25.1", "deepmerge": "^4.0.0", "glob": "^8.0.3" }, @@ -1811,9 +1811,9 @@ } }, "node_modules/@wdio/selenium-standalone-service/node_modules/@wdio/types": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.0.tgz", - "integrity": "sha512-BET/5UZSobAiBSbpWlUzcdjU1WszuUhaGBY7Pj4aAZjlvEeU5ZW5q2/655kxAvFhqHZ4AFEgd6NXg8krOEkXaA==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.1.tgz", + "integrity": "sha512-9Xt2U0YXYxRW4UvMFwjt+44UkfhwrI1gPhW+y56SubpyKaUfdNGberteboQoR/7Os1SVtJry4FohEZNmFzPK6g==", "dev": true, "dependencies": { "@types/node": "^18.0.0", @@ -1832,13 +1832,13 @@ } }, "node_modules/@wdio/selenium-standalone-service/node_modules/@wdio/utils": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.0.tgz", - "integrity": "sha512-dRPJoVb2wsMv/GFwAVcVbp0+8CE+vVeW/+lpre6ocn36WAnDQJD6X5UGYde5oQeXGyjzj1/nMHBSsr+ifvuJRQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.1.tgz", + "integrity": "sha512-DL+nDRVgzruJLhedBUQEMUcojLoGwsjCQCYWram4NfwAIIkxcAX/5Y4vHSut3OoW2bEHl3R8/FQ4B/ivIr2EoQ==", "dev": true, "dependencies": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", + "@wdio/types": "7.25.1", "p-iteration": "^1.1.8" }, "engines": { @@ -15037,36 +15037,36 @@ } }, "@wdio/selenium-standalone-service": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/selenium-standalone-service/-/selenium-standalone-service-7.25.0.tgz", - "integrity": "sha512-WRX4ljr6VRmV2YO+jqWSOhKMQKpLItJUklhOT9P98LwzMB607fMFTnN1vJ/rI3Q2ZLoHDPbPGnbmTYUw/4uzzQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/selenium-standalone-service/-/selenium-standalone-service-7.25.1.tgz", + "integrity": "sha512-TRD4hAxdHuZ0z414eDayE6q2gEmyAg7YdMrF+CJHWbjZKhJG4cqTSpV04zgMfQmTov5Y2+WtasdlGnqV5AXfMg==", "dev": true, "requires": { "@types/fs-extra": "^9.0.1", "@types/node": "^18.0.0", "@types/selenium-standalone": "^7.0.0", - "@wdio/config": "7.25.0", + "@wdio/config": "7.25.1", "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", + "@wdio/types": "7.25.1", "fs-extra": "^10.0.0", "selenium-standalone": "^8.0.3" }, "dependencies": { "@types/node": { - "version": "18.7.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.21.tgz", - "integrity": "sha512-rLFzK5bhM0YPyCoTC8bolBjMk7bwnZ8qeZUBslBfjZQou2ssJdWslx9CZ8DGM+Dx7QXQiiTVZ/6QO6kwtHkZCA==", + "version": "18.8.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.2.tgz", + "integrity": "sha512-cRMwIgdDN43GO4xMWAfJAecYn8wV4JbsOGHNfNUIDiuYkUYAR5ec4Rj7IO2SAhFPEfpPtLtUTbbny/TCT7aDwA==", "dev": true }, "@wdio/config": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.0.tgz", - "integrity": "sha512-fttJIPu9x2H9sz6g7GsDNx0LH6S3EyXUjrk3nUz+ccwgnXtq3E3WyGgBdZsAObItvvplLNM5nSdtWNZSW0+Dzw==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.25.1.tgz", + "integrity": "sha512-7I3L+TE75gvh8jiv8cE/Ch9S9erDgrZG9o5587OlNKfpgFciT7DH7/efPXzYwh8YPFV3grFaydxaaoYzDv6PDA==", "dev": true, "requires": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", - "@wdio/utils": "7.25.0", + "@wdio/types": "7.25.1", + "@wdio/utils": "7.25.1", "deepmerge": "^4.0.0", "glob": "^8.0.3" } @@ -15084,9 +15084,9 @@ } }, "@wdio/types": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.0.tgz", - "integrity": "sha512-BET/5UZSobAiBSbpWlUzcdjU1WszuUhaGBY7Pj4aAZjlvEeU5ZW5q2/655kxAvFhqHZ4AFEgd6NXg8krOEkXaA==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.25.1.tgz", + "integrity": "sha512-9Xt2U0YXYxRW4UvMFwjt+44UkfhwrI1gPhW+y56SubpyKaUfdNGberteboQoR/7Os1SVtJry4FohEZNmFzPK6g==", "dev": true, "requires": { "@types/node": "^18.0.0", @@ -15094,13 +15094,13 @@ } }, "@wdio/utils": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.0.tgz", - "integrity": "sha512-dRPJoVb2wsMv/GFwAVcVbp0+8CE+vVeW/+lpre6ocn36WAnDQJD6X5UGYde5oQeXGyjzj1/nMHBSsr+ifvuJRQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.25.1.tgz", + "integrity": "sha512-DL+nDRVgzruJLhedBUQEMUcojLoGwsjCQCYWram4NfwAIIkxcAX/5Y4vHSut3OoW2bEHl3R8/FQ4B/ivIr2EoQ==", "dev": true, "requires": { "@wdio/logger": "7.19.0", - "@wdio/types": "7.25.0", + "@wdio/types": "7.25.1", "p-iteration": "^1.1.8" } }, From ce3ec78501a900959c8cc850f0bc5f0642d4e4cc Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Thu, 6 Oct 2022 13:04:34 -0700 Subject: [PATCH 07/69] fix: update a moved function in developer tools so it loads (#6500) --- demos/blockfactory/workspacefactory/wfactory_generator.js | 2 +- demos/blockfactory/workspacefactory/wfactory_model.js | 4 ++-- tests/mocha/test_helpers/setup_teardown.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/demos/blockfactory/workspacefactory/wfactory_generator.js b/demos/blockfactory/workspacefactory/wfactory_generator.js index 732db7c2e..02a1fa43e 100644 --- a/demos/blockfactory/workspacefactory/wfactory_generator.js +++ b/demos/blockfactory/workspacefactory/wfactory_generator.js @@ -25,7 +25,7 @@ WorkspaceFactoryGenerator = function(model) { var hiddenBlocks = document.createElement('div'); // Generate a globally unique ID for the hidden div element to avoid // collisions. - var hiddenBlocksId = Blockly.utils.genUid(); + var hiddenBlocksId = Blockly.utils.idGenerator.genUid(); hiddenBlocks.id = hiddenBlocksId; hiddenBlocks.style.display = 'none'; document.body.appendChild(hiddenBlocks); diff --git a/demos/blockfactory/workspacefactory/wfactory_model.js b/demos/blockfactory/workspacefactory/wfactory_model.js index 7fa8cc332..4b871ccf6 100644 --- a/demos/blockfactory/workspacefactory/wfactory_model.js +++ b/demos/blockfactory/workspacefactory/wfactory_model.js @@ -477,7 +477,7 @@ ListElement = function(type, opt_name) { // Name of category. Can be changed by user. Null if separator. this.name = opt_name ? opt_name : null; // Unique ID of element. Does not change. - this.id = Blockly.utils.genUid(); + this.id = Blockly.utils.idGenerator.genUid(); // Colour of category. Default is no colour. Null if separator. this.colour = null; // Stores a custom tag, if necessary. Null if no custom tag or separator. @@ -538,7 +538,7 @@ ListElement.prototype.changeColour = function(colour) { ListElement.prototype.copy = function() { copy = new ListElement(this.type); // Generate a unique ID for the element. - copy.id = Blockly.utils.genUid(); + copy.id = Blockly.utils.idGenerator.genUid(); // Copy all attributes except ID. copy.name = this.name; copy.xml = this.xml; diff --git a/tests/mocha/test_helpers/setup_teardown.js b/tests/mocha/test_helpers/setup_teardown.js index 8d318af4d..669c6564b 100644 --- a/tests/mocha/test_helpers/setup_teardown.js +++ b/tests/mocha/test_helpers/setup_teardown.js @@ -179,7 +179,7 @@ export function sharedTestTeardown() { } /** - * Creates stub for Blockly.utils.genUid that returns the provided id or ids. + * Creates stub for Blockly.utils.idGenerator.genUid that returns the provided id or ids. * Recommended to also assert that the stub is called the expected number of * times. * @param {string|!Array} returnIds The return values to use for the From 224af0aa6bb17b3b6e2c7cc7c01daae75ccc7122 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Thu, 6 Oct 2022 13:05:00 -0700 Subject: [PATCH 08/69] fix: remove deprecated use of objectUtils from generators (#6499) --- generators/javascript.js | 3 +-- generators/lua.js | 3 +-- generators/php.js | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/generators/javascript.js b/generators/javascript.js index 75220f760..c9634057c 100644 --- a/generators/javascript.js +++ b/generators/javascript.js @@ -13,7 +13,6 @@ goog.module('Blockly.JavaScript'); const Variables = goog.require('Blockly.Variables'); -const objectUtils = goog.require('Blockly.utils.object'); const stringUtils = goog.require('Blockly.utils.string'); const {Block} = goog.requireType('Blockly.Block'); const {Generator} = goog.require('Blockly.Generator'); @@ -169,7 +168,7 @@ JavaScript.init = function(workspace) { */ JavaScript.finish = function(code) { // Convert the definitions dictionary into a list. - const definitions = objectUtils.values(this.definitions_); + const definitions = Object.values(this.definitions_); // Call Blockly.Generator's finish. code = Object.getPrototypeOf(this).finish.call(this, code); this.isInitialized = false; diff --git a/generators/lua.js b/generators/lua.js index bf12f95a2..aec7db2cf 100644 --- a/generators/lua.js +++ b/generators/lua.js @@ -13,7 +13,6 @@ goog.module('Blockly.Lua'); -const objectUtils = goog.require('Blockly.utils.object'); const stringUtils = goog.require('Blockly.utils.string'); const {Block} = goog.requireType('Blockly.Block'); const {Generator} = goog.require('Blockly.Generator'); @@ -115,7 +114,7 @@ Lua.init = function(workspace) { */ Lua.finish = function(code) { // Convert the definitions dictionary into a list. - const definitions = objectUtils.values(this.definitions_); + const definitions = Object.values(this.definitions_); // Call Blockly.Generator's finish. code = Object.getPrototypeOf(this).finish.call(this, code); this.isInitialized = false; diff --git a/generators/php.js b/generators/php.js index 748141491..f47d763a4 100644 --- a/generators/php.js +++ b/generators/php.js @@ -12,7 +12,6 @@ goog.module('Blockly.PHP'); -const objectUtils = goog.require('Blockly.utils.object'); const stringUtils = goog.require('Blockly.utils.string'); const {Block} = goog.requireType('Blockly.Block'); const {Generator} = goog.require('Blockly.Generator'); @@ -154,7 +153,7 @@ PHP.init = function(workspace) { */ PHP.finish = function(code) { // Convert the definitions dictionary into a list. - const definitions = objectUtils.values(this.definitions_); + const definitions = Object.values(this.definitions_); // Call Blockly.Generator's finish. code = Object.getPrototypeOf(this).finish.call(this, code); this.isInitialized = false; From ee4e24d219f0a2d6d8efa5b627f4efaa062c838a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Oct 2022 08:27:14 -0700 Subject: [PATCH 09/69] chore(deps): bump @typescript-eslint/eslint-plugin from 5.38.0 to 5.39.0 (#6491) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.38.0 to 5.39.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.39.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 232 +++++++++++++++++++++++----------------------- 1 file changed, 116 insertions(+), 116 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2e1b1a87b..d102c61f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -989,14 +989,14 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.38.0.tgz", - "integrity": "sha512-GgHi/GNuUbTOeoJiEANi0oI6fF3gBQc3bGFYj40nnAPCbhrtEDf2rjBmefFadweBmO1Du1YovHeDP2h5JLhtTQ==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.39.0.tgz", + "integrity": "sha512-xVfKOkBm5iWMNGKQ2fwX5GVgBuHmZBO1tCRwXmY5oAIsPscfwm2UADDuNB8ZVYCtpQvJK4xpjrK7jEhcJ0zY9A==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.38.0", - "@typescript-eslint/type-utils": "5.38.0", - "@typescript-eslint/utils": "5.38.0", + "@typescript-eslint/scope-manager": "5.39.0", + "@typescript-eslint/type-utils": "5.39.0", + "@typescript-eslint/utils": "5.39.0", "debug": "^4.3.4", "ignore": "^5.2.0", "regexpp": "^3.2.0", @@ -1021,13 +1021,13 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.38.0.tgz", - "integrity": "sha512-ByhHIuNyKD9giwkkLqzezZ9y5bALW8VNY6xXcP+VxoH4JBDKjU5WNnsiD4HJdglHECdV+lyaxhvQjTUbRboiTA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.39.0.tgz", + "integrity": "sha512-/I13vAqmG3dyqMVSZPjsbuNQlYS082Y7OMkwhCfLXYsmlI0ca4nkL7wJ/4gjX70LD4P8Hnw1JywUVVAwepURBw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.38.0", - "@typescript-eslint/visitor-keys": "5.38.0" + "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/visitor-keys": "5.39.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1038,9 +1038,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.38.0.tgz", - "integrity": "sha512-HHu4yMjJ7i3Cb+8NUuRCdOGu2VMkfmKyIJsOr9PfkBVYLYrtMCK/Ap50Rpov+iKpxDTfnqvDbuPLgBE5FwUNfA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.39.0.tgz", + "integrity": "sha512-gQMZrnfEBFXK38hYqt8Lkwt8f4U6yq+2H5VDSgP/qiTzC8Nw8JO3OuSUOQ2qW37S/dlwdkHDntkZM6SQhKyPhw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1051,12 +1051,12 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.38.0.tgz", - "integrity": "sha512-MxnrdIyArnTi+XyFLR+kt/uNAcdOnmT+879os7qDRI+EYySR4crXJq9BXPfRzzLGq0wgxkwidrCJ9WCAoacm1w==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.39.0.tgz", + "integrity": "sha512-yyE3RPwOG+XJBLrhvsxAidUgybJVQ/hG8BhiJo0k8JSAYfk/CshVcxf0HwP4Jt7WZZ6vLmxdo1p6EyN3tzFTkg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.38.0", + "@typescript-eslint/types": "5.39.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1114,13 +1114,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.38.0.tgz", - "integrity": "sha512-iZq5USgybUcj/lfnbuelJ0j3K9dbs1I3RICAJY9NZZpDgBYXmuUlYQGzftpQA9wC8cKgtS6DASTvF3HrXwwozA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.39.0.tgz", + "integrity": "sha512-KJHJkOothljQWzR3t/GunL0TPKY+fGJtnpl+pX+sJ0YiKTz3q2Zr87SGTmFqsCMFrLt5E0+o+S6eQY0FAXj9uA==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.38.0", - "@typescript-eslint/utils": "5.38.0", + "@typescript-eslint/typescript-estree": "5.39.0", + "@typescript-eslint/utils": "5.39.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -1141,9 +1141,9 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.38.0.tgz", - "integrity": "sha512-HHu4yMjJ7i3Cb+8NUuRCdOGu2VMkfmKyIJsOr9PfkBVYLYrtMCK/Ap50Rpov+iKpxDTfnqvDbuPLgBE5FwUNfA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.39.0.tgz", + "integrity": "sha512-gQMZrnfEBFXK38hYqt8Lkwt8f4U6yq+2H5VDSgP/qiTzC8Nw8JO3OuSUOQ2qW37S/dlwdkHDntkZM6SQhKyPhw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1154,13 +1154,13 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.38.0.tgz", - "integrity": "sha512-6P0RuphkR+UuV7Avv7MU3hFoWaGcrgOdi8eTe1NwhMp2/GjUJoODBTRWzlHpZh6lFOaPmSvgxGlROa0Sg5Zbyg==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.39.0.tgz", + "integrity": "sha512-qLFQP0f398sdnogJoLtd43pUgB18Q50QSA+BTE5h3sUxySzbWDpTSdgt4UyxNSozY/oDK2ta6HVAzvGgq8JYnA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.38.0", - "@typescript-eslint/visitor-keys": "5.38.0", + "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/visitor-keys": "5.39.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1181,12 +1181,12 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.38.0.tgz", - "integrity": "sha512-MxnrdIyArnTi+XyFLR+kt/uNAcdOnmT+879os7qDRI+EYySR4crXJq9BXPfRzzLGq0wgxkwidrCJ9WCAoacm1w==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.39.0.tgz", + "integrity": "sha512-yyE3RPwOG+XJBLrhvsxAidUgybJVQ/hG8BhiJo0k8JSAYfk/CshVcxf0HwP4Jt7WZZ6vLmxdo1p6EyN3tzFTkg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.38.0", + "@typescript-eslint/types": "5.39.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1240,15 +1240,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.38.0.tgz", - "integrity": "sha512-6sdeYaBgk9Fh7N2unEXGz+D+som2QCQGPAf1SxrkEr+Z32gMreQ0rparXTNGRRfYUWk/JzbGdcM8NSSd6oqnTA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.39.0.tgz", + "integrity": "sha512-+DnY5jkpOpgj+EBtYPyHRjXampJfC0yUZZzfzLuUWVZvCuKqSdJVC8UhdWipIw7VKNTfwfAPiOWzYkAwuIhiAg==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.38.0", - "@typescript-eslint/types": "5.38.0", - "@typescript-eslint/typescript-estree": "5.38.0", + "@typescript-eslint/scope-manager": "5.39.0", + "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/typescript-estree": "5.39.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -1264,13 +1264,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.38.0.tgz", - "integrity": "sha512-ByhHIuNyKD9giwkkLqzezZ9y5bALW8VNY6xXcP+VxoH4JBDKjU5WNnsiD4HJdglHECdV+lyaxhvQjTUbRboiTA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.39.0.tgz", + "integrity": "sha512-/I13vAqmG3dyqMVSZPjsbuNQlYS082Y7OMkwhCfLXYsmlI0ca4nkL7wJ/4gjX70LD4P8Hnw1JywUVVAwepURBw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.38.0", - "@typescript-eslint/visitor-keys": "5.38.0" + "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/visitor-keys": "5.39.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1281,9 +1281,9 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.38.0.tgz", - "integrity": "sha512-HHu4yMjJ7i3Cb+8NUuRCdOGu2VMkfmKyIJsOr9PfkBVYLYrtMCK/Ap50Rpov+iKpxDTfnqvDbuPLgBE5FwUNfA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.39.0.tgz", + "integrity": "sha512-gQMZrnfEBFXK38hYqt8Lkwt8f4U6yq+2H5VDSgP/qiTzC8Nw8JO3OuSUOQ2qW37S/dlwdkHDntkZM6SQhKyPhw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1294,13 +1294,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.38.0.tgz", - "integrity": "sha512-6P0RuphkR+UuV7Avv7MU3hFoWaGcrgOdi8eTe1NwhMp2/GjUJoODBTRWzlHpZh6lFOaPmSvgxGlROa0Sg5Zbyg==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.39.0.tgz", + "integrity": "sha512-qLFQP0f398sdnogJoLtd43pUgB18Q50QSA+BTE5h3sUxySzbWDpTSdgt4UyxNSozY/oDK2ta6HVAzvGgq8JYnA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.38.0", - "@typescript-eslint/visitor-keys": "5.38.0", + "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/visitor-keys": "5.39.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1321,12 +1321,12 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.38.0.tgz", - "integrity": "sha512-MxnrdIyArnTi+XyFLR+kt/uNAcdOnmT+879os7qDRI+EYySR4crXJq9BXPfRzzLGq0wgxkwidrCJ9WCAoacm1w==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.39.0.tgz", + "integrity": "sha512-yyE3RPwOG+XJBLrhvsxAidUgybJVQ/hG8BhiJo0k8JSAYfk/CshVcxf0HwP4Jt7WZZ6vLmxdo1p6EyN3tzFTkg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.38.0", + "@typescript-eslint/types": "5.39.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -14512,14 +14512,14 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.38.0.tgz", - "integrity": "sha512-GgHi/GNuUbTOeoJiEANi0oI6fF3gBQc3bGFYj40nnAPCbhrtEDf2rjBmefFadweBmO1Du1YovHeDP2h5JLhtTQ==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.39.0.tgz", + "integrity": "sha512-xVfKOkBm5iWMNGKQ2fwX5GVgBuHmZBO1tCRwXmY5oAIsPscfwm2UADDuNB8ZVYCtpQvJK4xpjrK7jEhcJ0zY9A==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.38.0", - "@typescript-eslint/type-utils": "5.38.0", - "@typescript-eslint/utils": "5.38.0", + "@typescript-eslint/scope-manager": "5.39.0", + "@typescript-eslint/type-utils": "5.39.0", + "@typescript-eslint/utils": "5.39.0", "debug": "^4.3.4", "ignore": "^5.2.0", "regexpp": "^3.2.0", @@ -14528,28 +14528,28 @@ }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.38.0.tgz", - "integrity": "sha512-ByhHIuNyKD9giwkkLqzezZ9y5bALW8VNY6xXcP+VxoH4JBDKjU5WNnsiD4HJdglHECdV+lyaxhvQjTUbRboiTA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.39.0.tgz", + "integrity": "sha512-/I13vAqmG3dyqMVSZPjsbuNQlYS082Y7OMkwhCfLXYsmlI0ca4nkL7wJ/4gjX70LD4P8Hnw1JywUVVAwepURBw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.38.0", - "@typescript-eslint/visitor-keys": "5.38.0" + "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/visitor-keys": "5.39.0" } }, "@typescript-eslint/types": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.38.0.tgz", - "integrity": "sha512-HHu4yMjJ7i3Cb+8NUuRCdOGu2VMkfmKyIJsOr9PfkBVYLYrtMCK/Ap50Rpov+iKpxDTfnqvDbuPLgBE5FwUNfA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.39.0.tgz", + "integrity": "sha512-gQMZrnfEBFXK38hYqt8Lkwt8f4U6yq+2H5VDSgP/qiTzC8Nw8JO3OuSUOQ2qW37S/dlwdkHDntkZM6SQhKyPhw==", "dev": true }, "@typescript-eslint/visitor-keys": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.38.0.tgz", - "integrity": "sha512-MxnrdIyArnTi+XyFLR+kt/uNAcdOnmT+879os7qDRI+EYySR4crXJq9BXPfRzzLGq0wgxkwidrCJ9WCAoacm1w==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.39.0.tgz", + "integrity": "sha512-yyE3RPwOG+XJBLrhvsxAidUgybJVQ/hG8BhiJo0k8JSAYfk/CshVcxf0HwP4Jt7WZZ6vLmxdo1p6EyN3tzFTkg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.38.0", + "@typescript-eslint/types": "5.39.0", "eslint-visitor-keys": "^3.3.0" } } @@ -14580,31 +14580,31 @@ } }, "@typescript-eslint/type-utils": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.38.0.tgz", - "integrity": "sha512-iZq5USgybUcj/lfnbuelJ0j3K9dbs1I3RICAJY9NZZpDgBYXmuUlYQGzftpQA9wC8cKgtS6DASTvF3HrXwwozA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.39.0.tgz", + "integrity": "sha512-KJHJkOothljQWzR3t/GunL0TPKY+fGJtnpl+pX+sJ0YiKTz3q2Zr87SGTmFqsCMFrLt5E0+o+S6eQY0FAXj9uA==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.38.0", - "@typescript-eslint/utils": "5.38.0", + "@typescript-eslint/typescript-estree": "5.39.0", + "@typescript-eslint/utils": "5.39.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, "dependencies": { "@typescript-eslint/types": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.38.0.tgz", - "integrity": "sha512-HHu4yMjJ7i3Cb+8NUuRCdOGu2VMkfmKyIJsOr9PfkBVYLYrtMCK/Ap50Rpov+iKpxDTfnqvDbuPLgBE5FwUNfA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.39.0.tgz", + "integrity": "sha512-gQMZrnfEBFXK38hYqt8Lkwt8f4U6yq+2H5VDSgP/qiTzC8Nw8JO3OuSUOQ2qW37S/dlwdkHDntkZM6SQhKyPhw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.38.0.tgz", - "integrity": "sha512-6P0RuphkR+UuV7Avv7MU3hFoWaGcrgOdi8eTe1NwhMp2/GjUJoODBTRWzlHpZh6lFOaPmSvgxGlROa0Sg5Zbyg==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.39.0.tgz", + "integrity": "sha512-qLFQP0f398sdnogJoLtd43pUgB18Q50QSA+BTE5h3sUxySzbWDpTSdgt4UyxNSozY/oDK2ta6HVAzvGgq8JYnA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.38.0", - "@typescript-eslint/visitor-keys": "5.38.0", + "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/visitor-keys": "5.39.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -14613,12 +14613,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.38.0.tgz", - "integrity": "sha512-MxnrdIyArnTi+XyFLR+kt/uNAcdOnmT+879os7qDRI+EYySR4crXJq9BXPfRzzLGq0wgxkwidrCJ9WCAoacm1w==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.39.0.tgz", + "integrity": "sha512-yyE3RPwOG+XJBLrhvsxAidUgybJVQ/hG8BhiJo0k8JSAYfk/CshVcxf0HwP4Jt7WZZ6vLmxdo1p6EyN3tzFTkg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.38.0", + "@typescript-eslint/types": "5.39.0", "eslint-visitor-keys": "^3.3.0" } } @@ -14648,43 +14648,43 @@ } }, "@typescript-eslint/utils": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.38.0.tgz", - "integrity": "sha512-6sdeYaBgk9Fh7N2unEXGz+D+som2QCQGPAf1SxrkEr+Z32gMreQ0rparXTNGRRfYUWk/JzbGdcM8NSSd6oqnTA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.39.0.tgz", + "integrity": "sha512-+DnY5jkpOpgj+EBtYPyHRjXampJfC0yUZZzfzLuUWVZvCuKqSdJVC8UhdWipIw7VKNTfwfAPiOWzYkAwuIhiAg==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.38.0", - "@typescript-eslint/types": "5.38.0", - "@typescript-eslint/typescript-estree": "5.38.0", + "@typescript-eslint/scope-manager": "5.39.0", + "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/typescript-estree": "5.39.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.38.0.tgz", - "integrity": "sha512-ByhHIuNyKD9giwkkLqzezZ9y5bALW8VNY6xXcP+VxoH4JBDKjU5WNnsiD4HJdglHECdV+lyaxhvQjTUbRboiTA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.39.0.tgz", + "integrity": "sha512-/I13vAqmG3dyqMVSZPjsbuNQlYS082Y7OMkwhCfLXYsmlI0ca4nkL7wJ/4gjX70LD4P8Hnw1JywUVVAwepURBw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.38.0", - "@typescript-eslint/visitor-keys": "5.38.0" + "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/visitor-keys": "5.39.0" } }, "@typescript-eslint/types": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.38.0.tgz", - "integrity": "sha512-HHu4yMjJ7i3Cb+8NUuRCdOGu2VMkfmKyIJsOr9PfkBVYLYrtMCK/Ap50Rpov+iKpxDTfnqvDbuPLgBE5FwUNfA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.39.0.tgz", + "integrity": "sha512-gQMZrnfEBFXK38hYqt8Lkwt8f4U6yq+2H5VDSgP/qiTzC8Nw8JO3OuSUOQ2qW37S/dlwdkHDntkZM6SQhKyPhw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.38.0.tgz", - "integrity": "sha512-6P0RuphkR+UuV7Avv7MU3hFoWaGcrgOdi8eTe1NwhMp2/GjUJoODBTRWzlHpZh6lFOaPmSvgxGlROa0Sg5Zbyg==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.39.0.tgz", + "integrity": "sha512-qLFQP0f398sdnogJoLtd43pUgB18Q50QSA+BTE5h3sUxySzbWDpTSdgt4UyxNSozY/oDK2ta6HVAzvGgq8JYnA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.38.0", - "@typescript-eslint/visitor-keys": "5.38.0", + "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/visitor-keys": "5.39.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -14693,12 +14693,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.38.0.tgz", - "integrity": "sha512-MxnrdIyArnTi+XyFLR+kt/uNAcdOnmT+879os7qDRI+EYySR4crXJq9BXPfRzzLGq0wgxkwidrCJ9WCAoacm1w==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.39.0.tgz", + "integrity": "sha512-yyE3RPwOG+XJBLrhvsxAidUgybJVQ/hG8BhiJo0k8JSAYfk/CshVcxf0HwP4Jt7WZZ6vLmxdo1p6EyN3tzFTkg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.38.0", + "@typescript-eslint/types": "5.39.0", "eslint-visitor-keys": "^3.3.0" } }, From 12343d47a2dc8219028190472c00246c5a097b0e Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Fri, 7 Oct 2022 12:58:46 -0700 Subject: [PATCH 10/69] chore: add auto labeling workflow (#6504) * chore: add auto labeling workflow * chore: formatting --- .github/workflows/conventional-label.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/conventional-label.yml diff --git a/.github/workflows/conventional-label.yml b/.github/workflows/conventional-label.yml new file mode 100644 index 000000000..efba70b92 --- /dev/null +++ b/.github/workflows/conventional-label.yml @@ -0,0 +1,12 @@ +on: + pull_request_target: + types: [ opened, edited ] +name: conventional-release-labels +jobs: + label: + runs-on: ubuntu-latest + steps: + - uses: bcoe/conventional-release-labels@v1 + with: + type_labels: '{"feat": "PR: feature", "fix": "PR: fix", "breaking": "breaking change", "chore": "PR: chore", "docs": "PR: docs", "refactor": "PR: refactor"}' + ignored_types: '[]' From 581e8acf4bba46ddcdd5f9f4eb19021396815d1e Mon Sep 17 00:00:00 2001 From: koenvanwijk Date: Mon, 10 Oct 2022 20:34:27 +0200 Subject: [PATCH 11/69] fix: Connections can be highlighted multiple times (#6502) * fix: Connections can be highlighted multiple times * fix: remove spaces to fix clang-formating --- core/rendered_connection.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/rendered_connection.ts b/core/rendered_connection.ts index 933f18bb3..7330ff9da 100644 --- a/core/rendered_connection.ts +++ b/core/rendered_connection.ts @@ -280,6 +280,10 @@ export class RenderedConnection extends Connection { /** Add highlighting around this connection. */ highlight() { + if (this.highlightPath) { + // This connection is already highlighted + return; + } let steps; const sourceBlockSvg = (this.sourceBlock_); const renderConstants = From 29acad04d3123a6d4df176bf03f7fe5e0b2c0ac7 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Mon, 10 Oct 2022 11:53:19 -0700 Subject: [PATCH 12/69] chore(deps): force update @blockly deps (#6509) --- package-lock.json | 136 +++++++++++++++++++++++----------------------- package.json | 6 +- 2 files changed, 71 insertions(+), 71 deletions(-) diff --git a/package-lock.json b/package-lock.json index d102c61f1..04f36c857 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,9 +12,9 @@ "jsdom": "15.2.1" }, "devDependencies": { - "@blockly/block-test": "^2.0.1", - "@blockly/dev-tools": "^4.0.2", - "@blockly/theme-modern": "^2.1.1", + "@blockly/block-test": "^3.0.0", + "@blockly/dev-tools": "^5.0.0", + "@blockly/theme-modern": "^3.0.0", "@hyperjump/json-schema": "^0.18.4", "@microsoft/api-extractor": "^7.29.5", "@typescript-eslint/eslint-plugin": "^5.33.1", @@ -158,28 +158,28 @@ } }, "node_modules/@blockly/block-test": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-2.0.18.tgz", - "integrity": "sha512-IujQmkTPwRtbONyJ1nWxSr5FYaoCXByOKuNYsXiLa5TL79DlU6CuapzFCw/AnFF0z6LImY+WlMuiQPo0HhG/Lw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.0.tgz", + "integrity": "sha512-yEJUyjFfIS9xNS27wLfM7cXTZ5ZIN0DrRsAdw8JOib1PWh6g+aWffB9F44JlMNHLqg12lB0R1bTr/yv/Wjl5Lw==", "dev": true, "engines": { "node": ">=8.17.0" }, "peerDependencies": { - "blockly": ">=7 <9" + "blockly": "^9.0.0" } }, "node_modules/@blockly/dev-tools": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@blockly/dev-tools/-/dev-tools-4.0.3.tgz", - "integrity": "sha512-YWkutC33AjdOHFYmzC2skVbVqv7acfOzoD4f1ph3/9G6JsfNPuXLMvYdeuxH2iCULtHcYXwUn5Cg8Q7cLS83ow==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@blockly/dev-tools/-/dev-tools-5.0.0.tgz", + "integrity": "sha512-9GSH+Y8aU+KLcu3sFKkqr/sIz4RWDjmkzKgDI0ryiZiihR8LKIi/gxREc04ZnnLWZWMlXo/RyMoLNWyM7YW36g==", "dev": true, "dependencies": { - "@blockly/block-test": "^2.0.18", - "@blockly/theme-dark": "^3.0.17", - "@blockly/theme-deuteranopia": "^2.0.17", - "@blockly/theme-highcontrast": "^2.0.17", - "@blockly/theme-tritanopia": "^2.0.17", + "@blockly/block-test": "^3.0.0", + "@blockly/theme-dark": "^4.0.0", + "@blockly/theme-deuteranopia": "^3.0.0", + "@blockly/theme-highcontrast": "^3.0.0", + "@blockly/theme-tritanopia": "^3.0.0", "chai": "^4.2.0", "dat.gui": "^0.7.7", "lodash.assign": "^4.2.0", @@ -191,67 +191,67 @@ "node": ">=8.0.0" }, "peerDependencies": { - "blockly": ">=8 <9" + "blockly": "^9.0.0" } }, "node_modules/@blockly/theme-dark": { - "version": "3.0.17", - "resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-3.0.17.tgz", - "integrity": "sha512-WxYApZT2vok2k4ba98KrweFTTiL2CS8JvOO8ZaOaI5GSWTU7jO6b+KCPHf5WAEY80iqAspg1gRTeePKliZmgIA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-4.0.0.tgz", + "integrity": "sha512-JCah9PULu/K4E8485CzvWTpWMDB8zAsqKxLtAGu106eSUKgaOrB6WR3nzoA10nmoUcZdh/fk/UPcHUB/XsHkhg==", "dev": true, "engines": { "node": ">=8.17.0" }, "peerDependencies": { - "blockly": ">=7 <9" + "blockly": "^9.0.0" } }, "node_modules/@blockly/theme-deuteranopia": { - "version": "2.0.17", - "resolved": "https://registry.npmjs.org/@blockly/theme-deuteranopia/-/theme-deuteranopia-2.0.17.tgz", - "integrity": "sha512-smTIWZJNUBAz7YoNRoFUWk0K5ghFWaXlrDqtbPWxpSEr+qxmVoj3ZqjDvy1R+QexMCg4BQ+XZdJpTwVAwuY8lg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-deuteranopia/-/theme-deuteranopia-3.0.0.tgz", + "integrity": "sha512-1m8aEZw4tA7LwKWXyIU5IU1pO2iDgrJGYTHn3/N5+GPRIQzuHqxGM62QcP3wTMYPqj8TX1Rs3xR0OPVZW2CgGw==", "dev": true, "engines": { "node": ">=8.17.0" }, "peerDependencies": { - "blockly": ">=7 <9" + "blockly": "^9.0.0" } }, "node_modules/@blockly/theme-highcontrast": { - "version": "2.0.17", - "resolved": "https://registry.npmjs.org/@blockly/theme-highcontrast/-/theme-highcontrast-2.0.17.tgz", - "integrity": "sha512-Cy3hd0TNmeytvLwqo9yRYy4YgW9pn4z8sDPWO7SXdUqFNgKoT8FBfMMEbYLmC2vdQyn+Fj1Q04FugVF1xqEm2w==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-highcontrast/-/theme-highcontrast-3.0.0.tgz", + "integrity": "sha512-4egNcV/Dl2pDcWBdS1199HUAI/hrlwAjwq7B2cf52A0O2ek/qfdrHxB2jm+6ez+giQFvrnFVjvCL9DptuKfNIg==", "dev": true, "engines": { "node": ">=8.17.0" }, "peerDependencies": { - "blockly": ">=7 <9" + "blockly": "^9.0.0" } }, "node_modules/@blockly/theme-modern": { - "version": "2.1.42", - "resolved": "https://registry.npmjs.org/@blockly/theme-modern/-/theme-modern-2.1.42.tgz", - "integrity": "sha512-CCS1EYQ3k0N70/ol0ozzEBcb5dYMpmjjOQFOEDWsSzyt8qujKRneFDp8f9+/W1a43jyaY53kZPTYuaXfPaAp0A==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-modern/-/theme-modern-3.0.0.tgz", + "integrity": "sha512-E7J70ymzxEOb4uDft2V6zeZ8XqX/DBHsRDZx3Ji6uQbFXjIAQpokhz7n+1epBTF625vxF/D87PG4z2eF7kupYA==", "dev": true, "engines": { "node": ">=8.17.0" }, "peerDependencies": { - "blockly": ">=3.20200123.0 <9" + "blockly": "^9.0.0" } }, "node_modules/@blockly/theme-tritanopia": { - "version": "2.0.17", - "resolved": "https://registry.npmjs.org/@blockly/theme-tritanopia/-/theme-tritanopia-2.0.17.tgz", - "integrity": "sha512-DuE6TcRTcrEIzVszbcI3xeq8XEdAR25uOVIOTAUPLcp8wjGSGxDp5OZLePLHvIFC8aZ7tUgr/3gW6F0/F0nPmQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-tritanopia/-/theme-tritanopia-3.0.0.tgz", + "integrity": "sha512-kwV01Wt57ktzqcu3yWb7FPHsXd0ZLz6ApvX0AWCuNJ+64+AxezBG+WOigD0/JzyIz7U6VFjHsecX+MIKmxaPgw==", "dev": true, "engines": { "node": ">=8.17.0" }, "peerDependencies": { - "blockly": ">=7 <9" + "blockly": "^9.0.0" } }, "node_modules/@es-joy/jsdoccomment": { @@ -2645,9 +2645,9 @@ } }, "node_modules/blockly": { - "version": "8.0.4", - "resolved": "https://registry.npmjs.org/blockly/-/blockly-8.0.4.tgz", - "integrity": "sha512-qGYrynzalzEHOMLJhZmADpuMXUH55nSTVgVd11Z1ZlVsm3NQ69ZVgBEaCSN+GsEUUpoui71g4oVzE2iHEHbAtw==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/blockly/-/blockly-9.0.0.tgz", + "integrity": "sha512-V8rAT3N4QJ5r2emMGAf8D/yhwmAEfMnu/JVXmcvmS6dFcWR8g8aVlYpjTjW3CH8FyAPTrav2JalLqSfdc8TPpg==", "dev": true, "peer": true, "dependencies": { @@ -13807,23 +13807,23 @@ } }, "@blockly/block-test": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-2.0.18.tgz", - "integrity": "sha512-IujQmkTPwRtbONyJ1nWxSr5FYaoCXByOKuNYsXiLa5TL79DlU6CuapzFCw/AnFF0z6LImY+WlMuiQPo0HhG/Lw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.0.tgz", + "integrity": "sha512-yEJUyjFfIS9xNS27wLfM7cXTZ5ZIN0DrRsAdw8JOib1PWh6g+aWffB9F44JlMNHLqg12lB0R1bTr/yv/Wjl5Lw==", "dev": true, "requires": {} }, "@blockly/dev-tools": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@blockly/dev-tools/-/dev-tools-4.0.3.tgz", - "integrity": "sha512-YWkutC33AjdOHFYmzC2skVbVqv7acfOzoD4f1ph3/9G6JsfNPuXLMvYdeuxH2iCULtHcYXwUn5Cg8Q7cLS83ow==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@blockly/dev-tools/-/dev-tools-5.0.0.tgz", + "integrity": "sha512-9GSH+Y8aU+KLcu3sFKkqr/sIz4RWDjmkzKgDI0ryiZiihR8LKIi/gxREc04ZnnLWZWMlXo/RyMoLNWyM7YW36g==", "dev": true, "requires": { - "@blockly/block-test": "^2.0.18", - "@blockly/theme-dark": "^3.0.17", - "@blockly/theme-deuteranopia": "^2.0.17", - "@blockly/theme-highcontrast": "^2.0.17", - "@blockly/theme-tritanopia": "^2.0.17", + "@blockly/block-test": "^3.0.0", + "@blockly/theme-dark": "^4.0.0", + "@blockly/theme-deuteranopia": "^3.0.0", + "@blockly/theme-highcontrast": "^3.0.0", + "@blockly/theme-tritanopia": "^3.0.0", "chai": "^4.2.0", "dat.gui": "^0.7.7", "lodash.assign": "^4.2.0", @@ -13833,37 +13833,37 @@ } }, "@blockly/theme-dark": { - "version": "3.0.17", - "resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-3.0.17.tgz", - "integrity": "sha512-WxYApZT2vok2k4ba98KrweFTTiL2CS8JvOO8ZaOaI5GSWTU7jO6b+KCPHf5WAEY80iqAspg1gRTeePKliZmgIA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-4.0.0.tgz", + "integrity": "sha512-JCah9PULu/K4E8485CzvWTpWMDB8zAsqKxLtAGu106eSUKgaOrB6WR3nzoA10nmoUcZdh/fk/UPcHUB/XsHkhg==", "dev": true, "requires": {} }, "@blockly/theme-deuteranopia": { - "version": "2.0.17", - "resolved": "https://registry.npmjs.org/@blockly/theme-deuteranopia/-/theme-deuteranopia-2.0.17.tgz", - "integrity": "sha512-smTIWZJNUBAz7YoNRoFUWk0K5ghFWaXlrDqtbPWxpSEr+qxmVoj3ZqjDvy1R+QexMCg4BQ+XZdJpTwVAwuY8lg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-deuteranopia/-/theme-deuteranopia-3.0.0.tgz", + "integrity": "sha512-1m8aEZw4tA7LwKWXyIU5IU1pO2iDgrJGYTHn3/N5+GPRIQzuHqxGM62QcP3wTMYPqj8TX1Rs3xR0OPVZW2CgGw==", "dev": true, "requires": {} }, "@blockly/theme-highcontrast": { - "version": "2.0.17", - "resolved": "https://registry.npmjs.org/@blockly/theme-highcontrast/-/theme-highcontrast-2.0.17.tgz", - "integrity": "sha512-Cy3hd0TNmeytvLwqo9yRYy4YgW9pn4z8sDPWO7SXdUqFNgKoT8FBfMMEbYLmC2vdQyn+Fj1Q04FugVF1xqEm2w==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-highcontrast/-/theme-highcontrast-3.0.0.tgz", + "integrity": "sha512-4egNcV/Dl2pDcWBdS1199HUAI/hrlwAjwq7B2cf52A0O2ek/qfdrHxB2jm+6ez+giQFvrnFVjvCL9DptuKfNIg==", "dev": true, "requires": {} }, "@blockly/theme-modern": { - "version": "2.1.42", - "resolved": "https://registry.npmjs.org/@blockly/theme-modern/-/theme-modern-2.1.42.tgz", - "integrity": "sha512-CCS1EYQ3k0N70/ol0ozzEBcb5dYMpmjjOQFOEDWsSzyt8qujKRneFDp8f9+/W1a43jyaY53kZPTYuaXfPaAp0A==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-modern/-/theme-modern-3.0.0.tgz", + "integrity": "sha512-E7J70ymzxEOb4uDft2V6zeZ8XqX/DBHsRDZx3Ji6uQbFXjIAQpokhz7n+1epBTF625vxF/D87PG4z2eF7kupYA==", "dev": true, "requires": {} }, "@blockly/theme-tritanopia": { - "version": "2.0.17", - "resolved": "https://registry.npmjs.org/@blockly/theme-tritanopia/-/theme-tritanopia-2.0.17.tgz", - "integrity": "sha512-DuE6TcRTcrEIzVszbcI3xeq8XEdAR25uOVIOTAUPLcp8wjGSGxDp5OZLePLHvIFC8aZ7tUgr/3gW6F0/F0nPmQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-tritanopia/-/theme-tritanopia-3.0.0.tgz", + "integrity": "sha512-kwV01Wt57ktzqcu3yWb7FPHsXd0ZLz6ApvX0AWCuNJ+64+AxezBG+WOigD0/JzyIz7U6VFjHsecX+MIKmxaPgw==", "dev": true, "requires": {} }, @@ -15709,9 +15709,9 @@ } }, "blockly": { - "version": "8.0.4", - "resolved": "https://registry.npmjs.org/blockly/-/blockly-8.0.4.tgz", - "integrity": "sha512-qGYrynzalzEHOMLJhZmADpuMXUH55nSTVgVd11Z1ZlVsm3NQ69ZVgBEaCSN+GsEUUpoui71g4oVzE2iHEHbAtw==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/blockly/-/blockly-9.0.0.tgz", + "integrity": "sha512-V8rAT3N4QJ5r2emMGAf8D/yhwmAEfMnu/JVXmcvmS6dFcWR8g8aVlYpjTjW3CH8FyAPTrav2JalLqSfdc8TPpg==", "dev": true, "peer": true, "requires": { diff --git a/package.json b/package.json index 985087517..b3ad20497 100644 --- a/package.json +++ b/package.json @@ -66,9 +66,9 @@ }, "license": "Apache-2.0", "devDependencies": { - "@blockly/block-test": "^2.0.1", - "@blockly/dev-tools": "^4.0.2", - "@blockly/theme-modern": "^2.1.1", + "@blockly/block-test": "^3.0.0", + "@blockly/dev-tools": "^5.0.0", + "@blockly/theme-modern": "^3.0.0", "@hyperjump/json-schema": "^0.18.4", "@microsoft/api-extractor": "^7.29.5", "@typescript-eslint/eslint-plugin": "^5.33.1", From 4f6b0b8d34fc642e4d5c16a173f86caa3a80b156 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 10:59:12 -0700 Subject: [PATCH 13/69] chore(deps): bump @typescript-eslint/eslint-plugin from 5.39.0 to 5.40.0 (#6510) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.39.0 to 5.40.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.40.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 238 +++++++++++++++++++++++----------------------- 1 file changed, 120 insertions(+), 118 deletions(-) diff --git a/package-lock.json b/package-lock.json index 04f36c857..b65a8b5a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -989,14 +989,14 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.39.0.tgz", - "integrity": "sha512-xVfKOkBm5iWMNGKQ2fwX5GVgBuHmZBO1tCRwXmY5oAIsPscfwm2UADDuNB8ZVYCtpQvJK4xpjrK7jEhcJ0zY9A==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.0.tgz", + "integrity": "sha512-FIBZgS3DVJgqPwJzvZTuH4HNsZhHMa9SjxTKAZTlMsPw/UzpEjcf9f4dfgDJEHjK+HboUJo123Eshl6niwEm/Q==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.39.0", - "@typescript-eslint/type-utils": "5.39.0", - "@typescript-eslint/utils": "5.39.0", + "@typescript-eslint/scope-manager": "5.40.0", + "@typescript-eslint/type-utils": "5.40.0", + "@typescript-eslint/utils": "5.40.0", "debug": "^4.3.4", "ignore": "^5.2.0", "regexpp": "^3.2.0", @@ -1021,13 +1021,13 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.39.0.tgz", - "integrity": "sha512-/I13vAqmG3dyqMVSZPjsbuNQlYS082Y7OMkwhCfLXYsmlI0ca4nkL7wJ/4gjX70LD4P8Hnw1JywUVVAwepURBw==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.0.tgz", + "integrity": "sha512-d3nPmjUeZtEWRvyReMI4I1MwPGC63E8pDoHy0BnrYjnJgilBD3hv7XOiETKLY/zTwI7kCnBDf2vWTRUVpYw0Uw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/visitor-keys": "5.39.0" + "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/visitor-keys": "5.40.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1038,9 +1038,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.39.0.tgz", - "integrity": "sha512-gQMZrnfEBFXK38hYqt8Lkwt8f4U6yq+2H5VDSgP/qiTzC8Nw8JO3OuSUOQ2qW37S/dlwdkHDntkZM6SQhKyPhw==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz", + "integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1051,12 +1051,12 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.39.0.tgz", - "integrity": "sha512-yyE3RPwOG+XJBLrhvsxAidUgybJVQ/hG8BhiJo0k8JSAYfk/CshVcxf0HwP4Jt7WZZ6vLmxdo1p6EyN3tzFTkg==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz", + "integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/types": "5.40.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1114,13 +1114,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.39.0.tgz", - "integrity": "sha512-KJHJkOothljQWzR3t/GunL0TPKY+fGJtnpl+pX+sJ0YiKTz3q2Zr87SGTmFqsCMFrLt5E0+o+S6eQY0FAXj9uA==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.40.0.tgz", + "integrity": "sha512-nfuSdKEZY2TpnPz5covjJqav+g5qeBqwSHKBvz7Vm1SAfy93SwKk/JeSTymruDGItTwNijSsno5LhOHRS1pcfw==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.39.0", - "@typescript-eslint/utils": "5.39.0", + "@typescript-eslint/typescript-estree": "5.40.0", + "@typescript-eslint/utils": "5.40.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -1141,9 +1141,9 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.39.0.tgz", - "integrity": "sha512-gQMZrnfEBFXK38hYqt8Lkwt8f4U6yq+2H5VDSgP/qiTzC8Nw8JO3OuSUOQ2qW37S/dlwdkHDntkZM6SQhKyPhw==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz", + "integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1154,13 +1154,13 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.39.0.tgz", - "integrity": "sha512-qLFQP0f398sdnogJoLtd43pUgB18Q50QSA+BTE5h3sUxySzbWDpTSdgt4UyxNSozY/oDK2ta6HVAzvGgq8JYnA==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.0.tgz", + "integrity": "sha512-b0GYlDj8TLTOqwX7EGbw2gL5EXS2CPEWhF9nGJiGmEcmlpNBjyHsTwbqpyIEPVpl6br4UcBOYlcI2FJVtJkYhg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/visitor-keys": "5.39.0", + "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/visitor-keys": "5.40.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1181,12 +1181,12 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.39.0.tgz", - "integrity": "sha512-yyE3RPwOG+XJBLrhvsxAidUgybJVQ/hG8BhiJo0k8JSAYfk/CshVcxf0HwP4Jt7WZZ6vLmxdo1p6EyN3tzFTkg==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz", + "integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/types": "5.40.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1240,17 +1240,18 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.39.0.tgz", - "integrity": "sha512-+DnY5jkpOpgj+EBtYPyHRjXampJfC0yUZZzfzLuUWVZvCuKqSdJVC8UhdWipIw7VKNTfwfAPiOWzYkAwuIhiAg==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.40.0.tgz", + "integrity": "sha512-MO0y3T5BQ5+tkkuYZJBjePewsY+cQnfkYeRqS6tPh28niiIwPnQ1t59CSRcs1ZwJJNOdWw7rv9pF8aP58IMihA==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.39.0", - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/typescript-estree": "5.39.0", + "@typescript-eslint/scope-manager": "5.40.0", + "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/typescript-estree": "5.40.0", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1264,13 +1265,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.39.0.tgz", - "integrity": "sha512-/I13vAqmG3dyqMVSZPjsbuNQlYS082Y7OMkwhCfLXYsmlI0ca4nkL7wJ/4gjX70LD4P8Hnw1JywUVVAwepURBw==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.0.tgz", + "integrity": "sha512-d3nPmjUeZtEWRvyReMI4I1MwPGC63E8pDoHy0BnrYjnJgilBD3hv7XOiETKLY/zTwI7kCnBDf2vWTRUVpYw0Uw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/visitor-keys": "5.39.0" + "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/visitor-keys": "5.40.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1281,9 +1282,9 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.39.0.tgz", - "integrity": "sha512-gQMZrnfEBFXK38hYqt8Lkwt8f4U6yq+2H5VDSgP/qiTzC8Nw8JO3OuSUOQ2qW37S/dlwdkHDntkZM6SQhKyPhw==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz", + "integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1294,13 +1295,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.39.0.tgz", - "integrity": "sha512-qLFQP0f398sdnogJoLtd43pUgB18Q50QSA+BTE5h3sUxySzbWDpTSdgt4UyxNSozY/oDK2ta6HVAzvGgq8JYnA==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.0.tgz", + "integrity": "sha512-b0GYlDj8TLTOqwX7EGbw2gL5EXS2CPEWhF9nGJiGmEcmlpNBjyHsTwbqpyIEPVpl6br4UcBOYlcI2FJVtJkYhg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/visitor-keys": "5.39.0", + "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/visitor-keys": "5.40.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1321,12 +1322,12 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.39.0.tgz", - "integrity": "sha512-yyE3RPwOG+XJBLrhvsxAidUgybJVQ/hG8BhiJo0k8JSAYfk/CshVcxf0HwP4Jt7WZZ6vLmxdo1p6EyN3tzFTkg==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz", + "integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/types": "5.40.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -14512,14 +14513,14 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.39.0.tgz", - "integrity": "sha512-xVfKOkBm5iWMNGKQ2fwX5GVgBuHmZBO1tCRwXmY5oAIsPscfwm2UADDuNB8ZVYCtpQvJK4xpjrK7jEhcJ0zY9A==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.0.tgz", + "integrity": "sha512-FIBZgS3DVJgqPwJzvZTuH4HNsZhHMa9SjxTKAZTlMsPw/UzpEjcf9f4dfgDJEHjK+HboUJo123Eshl6niwEm/Q==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.39.0", - "@typescript-eslint/type-utils": "5.39.0", - "@typescript-eslint/utils": "5.39.0", + "@typescript-eslint/scope-manager": "5.40.0", + "@typescript-eslint/type-utils": "5.40.0", + "@typescript-eslint/utils": "5.40.0", "debug": "^4.3.4", "ignore": "^5.2.0", "regexpp": "^3.2.0", @@ -14528,28 +14529,28 @@ }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.39.0.tgz", - "integrity": "sha512-/I13vAqmG3dyqMVSZPjsbuNQlYS082Y7OMkwhCfLXYsmlI0ca4nkL7wJ/4gjX70LD4P8Hnw1JywUVVAwepURBw==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.0.tgz", + "integrity": "sha512-d3nPmjUeZtEWRvyReMI4I1MwPGC63E8pDoHy0BnrYjnJgilBD3hv7XOiETKLY/zTwI7kCnBDf2vWTRUVpYw0Uw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/visitor-keys": "5.39.0" + "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/visitor-keys": "5.40.0" } }, "@typescript-eslint/types": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.39.0.tgz", - "integrity": "sha512-gQMZrnfEBFXK38hYqt8Lkwt8f4U6yq+2H5VDSgP/qiTzC8Nw8JO3OuSUOQ2qW37S/dlwdkHDntkZM6SQhKyPhw==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz", + "integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==", "dev": true }, "@typescript-eslint/visitor-keys": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.39.0.tgz", - "integrity": "sha512-yyE3RPwOG+XJBLrhvsxAidUgybJVQ/hG8BhiJo0k8JSAYfk/CshVcxf0HwP4Jt7WZZ6vLmxdo1p6EyN3tzFTkg==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz", + "integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/types": "5.40.0", "eslint-visitor-keys": "^3.3.0" } } @@ -14580,31 +14581,31 @@ } }, "@typescript-eslint/type-utils": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.39.0.tgz", - "integrity": "sha512-KJHJkOothljQWzR3t/GunL0TPKY+fGJtnpl+pX+sJ0YiKTz3q2Zr87SGTmFqsCMFrLt5E0+o+S6eQY0FAXj9uA==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.40.0.tgz", + "integrity": "sha512-nfuSdKEZY2TpnPz5covjJqav+g5qeBqwSHKBvz7Vm1SAfy93SwKk/JeSTymruDGItTwNijSsno5LhOHRS1pcfw==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.39.0", - "@typescript-eslint/utils": "5.39.0", + "@typescript-eslint/typescript-estree": "5.40.0", + "@typescript-eslint/utils": "5.40.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, "dependencies": { "@typescript-eslint/types": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.39.0.tgz", - "integrity": "sha512-gQMZrnfEBFXK38hYqt8Lkwt8f4U6yq+2H5VDSgP/qiTzC8Nw8JO3OuSUOQ2qW37S/dlwdkHDntkZM6SQhKyPhw==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz", + "integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.39.0.tgz", - "integrity": "sha512-qLFQP0f398sdnogJoLtd43pUgB18Q50QSA+BTE5h3sUxySzbWDpTSdgt4UyxNSozY/oDK2ta6HVAzvGgq8JYnA==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.0.tgz", + "integrity": "sha512-b0GYlDj8TLTOqwX7EGbw2gL5EXS2CPEWhF9nGJiGmEcmlpNBjyHsTwbqpyIEPVpl6br4UcBOYlcI2FJVtJkYhg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/visitor-keys": "5.39.0", + "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/visitor-keys": "5.40.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -14613,12 +14614,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.39.0.tgz", - "integrity": "sha512-yyE3RPwOG+XJBLrhvsxAidUgybJVQ/hG8BhiJo0k8JSAYfk/CshVcxf0HwP4Jt7WZZ6vLmxdo1p6EyN3tzFTkg==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz", + "integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/types": "5.40.0", "eslint-visitor-keys": "^3.3.0" } } @@ -14648,43 +14649,44 @@ } }, "@typescript-eslint/utils": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.39.0.tgz", - "integrity": "sha512-+DnY5jkpOpgj+EBtYPyHRjXampJfC0yUZZzfzLuUWVZvCuKqSdJVC8UhdWipIw7VKNTfwfAPiOWzYkAwuIhiAg==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.40.0.tgz", + "integrity": "sha512-MO0y3T5BQ5+tkkuYZJBjePewsY+cQnfkYeRqS6tPh28niiIwPnQ1t59CSRcs1ZwJJNOdWw7rv9pF8aP58IMihA==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.39.0", - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/typescript-estree": "5.39.0", + "@typescript-eslint/scope-manager": "5.40.0", + "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/typescript-estree": "5.40.0", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.39.0.tgz", - "integrity": "sha512-/I13vAqmG3dyqMVSZPjsbuNQlYS082Y7OMkwhCfLXYsmlI0ca4nkL7wJ/4gjX70LD4P8Hnw1JywUVVAwepURBw==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.0.tgz", + "integrity": "sha512-d3nPmjUeZtEWRvyReMI4I1MwPGC63E8pDoHy0BnrYjnJgilBD3hv7XOiETKLY/zTwI7kCnBDf2vWTRUVpYw0Uw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/visitor-keys": "5.39.0" + "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/visitor-keys": "5.40.0" } }, "@typescript-eslint/types": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.39.0.tgz", - "integrity": "sha512-gQMZrnfEBFXK38hYqt8Lkwt8f4U6yq+2H5VDSgP/qiTzC8Nw8JO3OuSUOQ2qW37S/dlwdkHDntkZM6SQhKyPhw==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz", + "integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.39.0.tgz", - "integrity": "sha512-qLFQP0f398sdnogJoLtd43pUgB18Q50QSA+BTE5h3sUxySzbWDpTSdgt4UyxNSozY/oDK2ta6HVAzvGgq8JYnA==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.0.tgz", + "integrity": "sha512-b0GYlDj8TLTOqwX7EGbw2gL5EXS2CPEWhF9nGJiGmEcmlpNBjyHsTwbqpyIEPVpl6br4UcBOYlcI2FJVtJkYhg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/visitor-keys": "5.39.0", + "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/visitor-keys": "5.40.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -14693,12 +14695,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.39.0.tgz", - "integrity": "sha512-yyE3RPwOG+XJBLrhvsxAidUgybJVQ/hG8BhiJo0k8JSAYfk/CshVcxf0HwP4Jt7WZZ6vLmxdo1p6EyN3tzFTkg==", + "version": "5.40.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz", + "integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/types": "5.40.0", "eslint-visitor-keys": "^3.3.0" } }, From 9507b2986ebcea89fa6c5116dff31c452dfdf258 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 11:03:13 -0700 Subject: [PATCH 14/69] chore(deps): bump selenium-standalone from 8.2.1 to 8.2.2 (#6529) Bumps [selenium-standalone](https://github.com/webdriverio/selenium-standalone) from 8.2.1 to 8.2.2. - [Release notes](https://github.com/webdriverio/selenium-standalone/releases) - [Changelog](https://github.com/webdriverio/selenium-standalone/blob/main/HISTORY.md) - [Commits](https://github.com/webdriverio/selenium-standalone/compare/v8.2.1...v8.2.2) --- updated-dependencies: - dependency-name: selenium-standalone dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] 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 b65a8b5a6..2aca309f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11218,9 +11218,9 @@ "dev": true }, "node_modules/selenium-standalone": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.2.1.tgz", - "integrity": "sha512-xRTtFt9YwGjmXLk7R4iCa67s2388DDJEKtPsXkh0nmuFxigYg3MDnVa2J0ucuFWNjaYEuu+U9rtxKk7qCXdFPg==", + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.2.2.tgz", + "integrity": "sha512-CdfN5WnX0mzrjeCTFnvnsjsXEsQwgepLIvrA6OamrKT29gD8mufemwM3v9VG4grQDFHZZy7Ma1giw232x4eGmw==", "dev": true, "dependencies": { "commander": "^9.0.0", @@ -22541,9 +22541,9 @@ "dev": true }, "selenium-standalone": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.2.1.tgz", - "integrity": "sha512-xRTtFt9YwGjmXLk7R4iCa67s2388DDJEKtPsXkh0nmuFxigYg3MDnVa2J0ucuFWNjaYEuu+U9rtxKk7qCXdFPg==", + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.2.2.tgz", + "integrity": "sha512-CdfN5WnX0mzrjeCTFnvnsjsXEsQwgepLIvrA6OamrKT29gD8mufemwM3v9VG4grQDFHZZy7Ma1giw232x4eGmw==", "dev": true, "requires": { "commander": "^9.0.0", From 51fe84b9ccafb0ce2c268f0a05dffd48a63f9e03 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 11:03:23 -0700 Subject: [PATCH 15/69] chore(deps): bump async from 2.6.3 to 3.2.3 (#6528) Bumps [async](https://github.com/caolan/async) from 2.6.3 to 3.2.3. - [Release notes](https://github.com/caolan/async/releases) - [Changelog](https://github.com/caolan/async/blob/master/CHANGELOG.md) - [Commits](https://github.com/caolan/async/compare/v2.6.3...v3.2.3) --- updated-dependencies: - dependency-name: async dependency-type: indirect ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2aca309f1..59b31b702 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2406,9 +2406,9 @@ } }, "node_modules/async": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", - "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", "dev": true }, "node_modules/async-done": { @@ -7738,7 +7738,7 @@ "node_modules/jake/node_modules/async": { "version": "0.9.2", "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", - "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", + "integrity": "sha512-l6ToIJIotphWahxxHyzK9bnLR6kM4jJIIgLShZeqLY7iboHoGkdgFl7W2/Ivi4SkMJYGKqW8vSuk0uKUj6qsSw==", "dev": true, "peer": true }, @@ -10200,9 +10200,9 @@ } }, "node_modules/portfinder/node_modules/async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, "dependencies": { "lodash": "^4.17.14" @@ -15526,9 +15526,9 @@ "dev": true }, "async": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", - "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", "dev": true }, "async-done": { @@ -19751,7 +19751,7 @@ "async": { "version": "0.9.2", "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", - "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", + "integrity": "sha512-l6ToIJIotphWahxxHyzK9bnLR6kM4jJIIgLShZeqLY7iboHoGkdgFl7W2/Ivi4SkMJYGKqW8vSuk0uKUj6qsSw==", "dev": true, "peer": true }, @@ -21742,9 +21742,9 @@ }, "dependencies": { "async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, "requires": { "lodash": "^4.17.14" From d731880f608a4fcee6fa30bd9b5e1b79a3a1e8b5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 13:27:37 -0700 Subject: [PATCH 16/69] chore(deps): bump eslint from 8.24.0 to 8.25.0 (#6530) Bumps [eslint](https://github.com/eslint/eslint) from 8.24.0 to 8.25.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.24.0...v8.25.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 46 ++++++++++++++-------------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/package-lock.json b/package-lock.json index 59b31b702..f1df5bf63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -269,9 +269,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.2.tgz", - "integrity": "sha512-AXYd23w1S/bv3fTs3Lz0vjiYemS08jWkI3hYyS9I1ry+0f+Yjs1wm+sU0BS8qDOPrBIkp4qHYC16I8uVtpLajQ==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", + "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -399,16 +399,6 @@ "node": ">=10.10.0" } }, - "node_modules/@humanwhocodes/gitignore-to-minimatch": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz", - "integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -4598,14 +4588,13 @@ } }, "node_modules/eslint": { - "version": "8.24.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.24.0.tgz", - "integrity": "sha512-dWFaPhGhTAiPcCgm3f6LI2MBWbogMnTJzFBbhXVRQDJPkr9pGZvVjlVfXd+vyDcWPA2Ic9L2AXPIQM0+vk/cSQ==", + "version": "8.25.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.25.0.tgz", + "integrity": "sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.3.2", + "@eslint/eslintrc": "^1.3.3", "@humanwhocodes/config-array": "^0.10.5", - "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", "@humanwhocodes/module-importer": "^1.0.1", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -13880,9 +13869,9 @@ } }, "@eslint/eslintrc": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.2.tgz", - "integrity": "sha512-AXYd23w1S/bv3fTs3Lz0vjiYemS08jWkI3hYyS9I1ry+0f+Yjs1wm+sU0BS8qDOPrBIkp4qHYC16I8uVtpLajQ==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", + "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", "dev": true, "requires": { "ajv": "^6.12.4", @@ -13986,12 +13975,6 @@ "minimatch": "^3.0.4" } }, - "@humanwhocodes/gitignore-to-minimatch": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz", - "integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==", - "dev": true - }, "@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -17267,14 +17250,13 @@ } }, "eslint": { - "version": "8.24.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.24.0.tgz", - "integrity": "sha512-dWFaPhGhTAiPcCgm3f6LI2MBWbogMnTJzFBbhXVRQDJPkr9pGZvVjlVfXd+vyDcWPA2Ic9L2AXPIQM0+vk/cSQ==", + "version": "8.25.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.25.0.tgz", + "integrity": "sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.3.2", + "@eslint/eslintrc": "^1.3.3", "@humanwhocodes/config-array": "^0.10.5", - "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", "@humanwhocodes/module-importer": "^1.0.1", "ajv": "^6.10.0", "chalk": "^4.0.0", From 1da58e085d31c60a9af43a699fc663d0fb8e5630 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 15:05:40 -0700 Subject: [PATCH 17/69] chore(deps): bump google-closure-compiler (#6531) Bumps [google-closure-compiler](https://github.com/google/closure-compiler-npm) from 20220905.0.0 to 20221004.0.0. - [Release notes](https://github.com/google/closure-compiler-npm/releases) - [Commits](https://github.com/google/closure-compiler-npm/compare/v20220905.0.0...v20221004.0.0) --- updated-dependencies: - dependency-name: google-closure-compiler dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 78 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/package-lock.json b/package-lock.json index f1df5bf63..ad13db76d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "eslint": "^8.4.1", "eslint-config-google": "^0.14.0", "eslint-plugin-jsdoc": "^39.3.6", - "google-closure-compiler": "^20220905.0.0", + "google-closure-compiler": "^20221004.0.0", "google-closure-deps": "^20220905.0.0", "gulp": "^4.0.2", "gulp-clang-format": "^1.0.27", @@ -6045,13 +6045,13 @@ } }, "node_modules/google-closure-compiler": { - "version": "20220905.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20220905.0.0.tgz", - "integrity": "sha512-idZavy2vn91HCmqEepjmLFjfOdYoRsh9PggUbazUpjAOrBQz0HOm3WjOICMiywre+EnY1QGss0srEBtFtukM6w==", + "version": "20221004.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20221004.0.0.tgz", + "integrity": "sha512-OKENLrZFF2o3FZ/E4zdTc9NeuAUh1fdwbQxT0sibI19aR62sgNUBo2mLU6sc4Gcm0cQ2gwfB7qX1xnapOIkbaA==", "dev": true, "dependencies": { "chalk": "4.x", - "google-closure-compiler-java": "^20220905.0.0", + "google-closure-compiler-java": "^20221004.0.0", "minimist": "1.x", "vinyl": "2.x", "vinyl-sourcemaps-apply": "^0.2.0" @@ -6063,21 +6063,21 @@ "node": ">=10" }, "optionalDependencies": { - "google-closure-compiler-linux": "^20220905.0.0", - "google-closure-compiler-osx": "^20220905.0.0", - "google-closure-compiler-windows": "^20220905.0.0" + "google-closure-compiler-linux": "^20221004.0.0", + "google-closure-compiler-osx": "^20221004.0.0", + "google-closure-compiler-windows": "^20221004.0.0" } }, "node_modules/google-closure-compiler-java": { - "version": "20220905.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20220905.0.0.tgz", - "integrity": "sha512-wxGxNla/0UDS1Lm0cRxEy85KhVRd0vNlsTclnIJ9f1gRWzvvTsJ4lwz+PdT60R6y2hKAOBvydIJHh+B8XJastA==", + "version": "20221004.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20221004.0.0.tgz", + "integrity": "sha512-CygLEB40HxtK0VtP6klv2Xm08w4HQNYX/DTgLV7CP74r8LiQMUByRFleaG/Hv5xQG1JzPNiW0GOAiAubDSdr5A==", "dev": true }, "node_modules/google-closure-compiler-linux": { - "version": "20220905.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20220905.0.0.tgz", - "integrity": "sha512-kH09S66sz9+6wZmYM22VX8vG8KhCKJwFwXCfHx/ZOU6DBEzni6KfWrP+87CzTmZFEivclBhWAndm5HgNhSOEXQ==", + "version": "20221004.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20221004.0.0.tgz", + "integrity": "sha512-B6sca3Lmw3cYXdFzdU0iQpk8L9VEo1ecC1aM7Gl9lgWhIicqqEZebsgnUe5TQ3uHBfQoKjV9fdFG8mt8X/oqSQ==", "cpu": [ "x32", "x64" @@ -6089,9 +6089,9 @@ ] }, "node_modules/google-closure-compiler-osx": { - "version": "20220905.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20220905.0.0.tgz", - "integrity": "sha512-4uo2GAz77gI8nDt4OA8VUYh/FNdjmTLOIRDazl7si+BOjgp9bC6C3E/88o+YHETsVtrPmZk57/W7vH0lftyTAw==", + "version": "20221004.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20221004.0.0.tgz", + "integrity": "sha512-z5V7BvaMauPga8DMTt9u6RGcjBdLAuv4gL2Ebw5NIQRTAHVkEVzCd3kiMX7CVCGhmWdS/1r3jZcCg4BswGia6w==", "cpu": [ "x32", "x64", @@ -6104,9 +6104,9 @@ ] }, "node_modules/google-closure-compiler-windows": { - "version": "20220905.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20220905.0.0.tgz", - "integrity": "sha512-TZKHu6RHnrmgV90Gyen8+TGc0vgjgds80ErR+al5CqmfP9p+AskBbOe5CWZJht0bANrUhaeBMCrbs+7loFv06Q==", + "version": "20221004.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20221004.0.0.tgz", + "integrity": "sha512-JSAWilVa7d65QJYKUr+DmklwKmjkAce6BMD6smqJfdL2dv5OSJ2ydGy73euoBJ4Tka8iQPoaOP+BjLrhIuvqKg==", "cpu": [ "x32", "x64" @@ -18398,45 +18398,45 @@ } }, "google-closure-compiler": { - "version": "20220905.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20220905.0.0.tgz", - "integrity": "sha512-idZavy2vn91HCmqEepjmLFjfOdYoRsh9PggUbazUpjAOrBQz0HOm3WjOICMiywre+EnY1QGss0srEBtFtukM6w==", + "version": "20221004.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20221004.0.0.tgz", + "integrity": "sha512-OKENLrZFF2o3FZ/E4zdTc9NeuAUh1fdwbQxT0sibI19aR62sgNUBo2mLU6sc4Gcm0cQ2gwfB7qX1xnapOIkbaA==", "dev": true, "requires": { "chalk": "4.x", - "google-closure-compiler-java": "^20220905.0.0", - "google-closure-compiler-linux": "^20220905.0.0", - "google-closure-compiler-osx": "^20220905.0.0", - "google-closure-compiler-windows": "^20220905.0.0", + "google-closure-compiler-java": "^20221004.0.0", + "google-closure-compiler-linux": "^20221004.0.0", + "google-closure-compiler-osx": "^20221004.0.0", + "google-closure-compiler-windows": "^20221004.0.0", "minimist": "1.x", "vinyl": "2.x", "vinyl-sourcemaps-apply": "^0.2.0" } }, "google-closure-compiler-java": { - "version": "20220905.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20220905.0.0.tgz", - "integrity": "sha512-wxGxNla/0UDS1Lm0cRxEy85KhVRd0vNlsTclnIJ9f1gRWzvvTsJ4lwz+PdT60R6y2hKAOBvydIJHh+B8XJastA==", + "version": "20221004.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20221004.0.0.tgz", + "integrity": "sha512-CygLEB40HxtK0VtP6klv2Xm08w4HQNYX/DTgLV7CP74r8LiQMUByRFleaG/Hv5xQG1JzPNiW0GOAiAubDSdr5A==", "dev": true }, "google-closure-compiler-linux": { - "version": "20220905.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20220905.0.0.tgz", - "integrity": "sha512-kH09S66sz9+6wZmYM22VX8vG8KhCKJwFwXCfHx/ZOU6DBEzni6KfWrP+87CzTmZFEivclBhWAndm5HgNhSOEXQ==", + "version": "20221004.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20221004.0.0.tgz", + "integrity": "sha512-B6sca3Lmw3cYXdFzdU0iQpk8L9VEo1ecC1aM7Gl9lgWhIicqqEZebsgnUe5TQ3uHBfQoKjV9fdFG8mt8X/oqSQ==", "dev": true, "optional": true }, "google-closure-compiler-osx": { - "version": "20220905.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20220905.0.0.tgz", - "integrity": "sha512-4uo2GAz77gI8nDt4OA8VUYh/FNdjmTLOIRDazl7si+BOjgp9bC6C3E/88o+YHETsVtrPmZk57/W7vH0lftyTAw==", + "version": "20221004.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20221004.0.0.tgz", + "integrity": "sha512-z5V7BvaMauPga8DMTt9u6RGcjBdLAuv4gL2Ebw5NIQRTAHVkEVzCd3kiMX7CVCGhmWdS/1r3jZcCg4BswGia6w==", "dev": true, "optional": true }, "google-closure-compiler-windows": { - "version": "20220905.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20220905.0.0.tgz", - "integrity": "sha512-TZKHu6RHnrmgV90Gyen8+TGc0vgjgds80ErR+al5CqmfP9p+AskBbOe5CWZJht0bANrUhaeBMCrbs+7loFv06Q==", + "version": "20221004.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20221004.0.0.tgz", + "integrity": "sha512-JSAWilVa7d65QJYKUr+DmklwKmjkAce6BMD6smqJfdL2dv5OSJ2ydGy73euoBJ4Tka8iQPoaOP+BjLrhIuvqKg==", "dev": true, "optional": true }, diff --git a/package.json b/package.json index b3ad20497..eadfbc2e8 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "eslint": "^8.4.1", "eslint-config-google": "^0.14.0", "eslint-plugin-jsdoc": "^39.3.6", - "google-closure-compiler": "^20220905.0.0", + "google-closure-compiler": "^20221004.0.0", "google-closure-deps": "^20220905.0.0", "gulp": "^4.0.2", "gulp-clang-format": "^1.0.27", From 6456ab90f049c23deed597cb6c76c704652bb9fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 15:05:59 -0700 Subject: [PATCH 18/69] chore(deps): bump peter-evans/create-pull-request from 4.1.2 to 4.1.3 (#6466) Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 4.1.2 to 4.1.3. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/171dd555b9ab6b18fa02519fdfacbb8bf671e1b4...671dc9c9e0c2d73f07fa45a3eb0220e1622f0c5f) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/update_metadata.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update_metadata.yml b/.github/workflows/update_metadata.yml index c1100b290..624f26c9e 100644 --- a/.github/workflows/update_metadata.yml +++ b/.github/workflows/update_metadata.yml @@ -36,7 +36,7 @@ jobs: run: source ./tests/scripts/update_metadata.sh - name: Create Pull Request - uses: peter-evans/create-pull-request@171dd555b9ab6b18fa02519fdfacbb8bf671e1b4 + uses: peter-evans/create-pull-request@671dc9c9e0c2d73f07fa45a3eb0220e1622f0c5f with: commit-message: Update build artifact sizes in check_metadata.sh delete-branch: true From ca3b9bd079316b6785873a0c51afcc4e9200ef29 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 11 Oct 2022 15:40:56 -0700 Subject: [PATCH 19/69] fix: move Theme to use a Partial type for BlockStyle (#6532) * fix: move theme to use Partial type * chore: remove useless error throwing * chore: format * chore: update validatedBlockStyle_ to use Partial --- core/field_angle.ts | 4 ---- core/field_dropdown.ts | 12 ------------ core/field_textinput.ts | 4 ---- core/renderers/common/constants.ts | 7 +------ core/renderers/common/path_object.ts | 8 -------- core/renderers/zelos/path_object.ts | 12 ------------ core/theme.ts | 11 ++++++----- 7 files changed, 7 insertions(+), 51 deletions(-) diff --git a/core/field_angle.ts b/core/field_angle.ts index ecbfdb66f..33d813593 100644 --- a/core/field_angle.ts +++ b/core/field_angle.ts @@ -228,10 +228,6 @@ export class FieldAngle extends FieldTextInput { dropDownDiv.getContentDiv().appendChild(this.editor_ as AnyDuringMigration); if (this.sourceBlock_ instanceof BlockSvg) { - if (!this.sourceBlock_.style.colourTertiary) { - throw new Error( - 'The renderer did not properly initialize the block style'); - } dropDownDiv.setColour( this.sourceBlock_.style.colourPrimary, this.sourceBlock_.style.colourTertiary); diff --git a/core/field_dropdown.ts b/core/field_dropdown.ts index c58e7376d..4385c037d 100644 --- a/core/field_dropdown.ts +++ b/core/field_dropdown.ts @@ -285,10 +285,6 @@ export class FieldDropdown extends Field { const borderColour = this.getSourceBlock().isShadow() ? (this.getSourceBlock().getParent() as BlockSvg).style.colourTertiary : (this.sourceBlock_ as BlockSvg).style.colourTertiary; - if (!borderColour) { - throw new Error( - 'The renderer did not properly initialize the block style'); - } dropDownDiv.setColour(primaryColour, borderColour); } @@ -503,14 +499,6 @@ export class FieldDropdown extends Field { */ override applyColour() { const style = (this.sourceBlock_ as BlockSvg).style; - if (!style.colourSecondary) { - throw new Error( - 'The renderer did not properly initialize the block style'); - } - if (!style.colourTertiary) { - throw new Error( - 'The renderer did not properly initialize the block style'); - } if (this.borderRect_) { this.borderRect_.setAttribute('stroke', style.colourTertiary); if (this.menu_) { diff --git a/core/field_textinput.ts b/core/field_textinput.ts index dc4e29455..b639ffd2f 100644 --- a/core/field_textinput.ts +++ b/core/field_textinput.ts @@ -222,10 +222,6 @@ export class FieldTextInput extends Field { const source = this.sourceBlock_ as BlockSvg; if (this.borderRect_) { - if (!source.style.colourTertiary) { - throw new Error( - 'The renderer did not properly initialize the block style'); - } this.borderRect_.setAttribute('stroke', source.style.colourTertiary); } else { source.pathObject.svgPath.setAttribute( diff --git a/core/renderers/common/constants.ts b/core/renderers/common/constants.ts index 9017b3eaf..82854abb4 100644 --- a/core/renderers/common/constants.ts +++ b/core/renderers/common/constants.ts @@ -658,12 +658,7 @@ export class ConstantProvider { * @param blockStyle A full or partial block style object. * @returns A full block style object, with all required properties populated. */ - protected validatedBlockStyle_(blockStyle: { - colourPrimary: string, - colourSecondary?: string, - colourTertiary?: string, - hat?: string - }): BlockStyle { + protected validatedBlockStyle_(blockStyle: Partial): BlockStyle { // Make a new object with all of the same properties. const valid = {} as BlockStyle; if (blockStyle) { diff --git a/core/renderers/common/path_object.ts b/core/renderers/common/path_object.ts index 712fce28b..c28a629e4 100644 --- a/core/renderers/common/path_object.ts +++ b/core/renderers/common/path_object.ts @@ -137,10 +137,6 @@ export class PathObject implements IPathObject { * @internal */ applyColour(block: BlockSvg) { - if (!this.style.colourTertiary) { - throw new Error( - 'The renderer did not properly initialize the block style'); - } this.svgPath.setAttribute('stroke', this.style.colourTertiary); this.svgPath.setAttribute('fill', this.style.colourPrimary); @@ -199,10 +195,6 @@ export class PathObject implements IPathObject { */ protected updateShadow_(shadow: boolean) { if (shadow) { - if (!this.style.colourSecondary) { - throw new Error( - 'The renderer did not properly initialize the block style'); - } this.svgPath.setAttribute('stroke', 'none'); this.svgPath.setAttribute('fill', this.style.colourSecondary); } diff --git a/core/renderers/zelos/path_object.ts b/core/renderers/zelos/path_object.ts index 05fba1f85..fba99877a 100644 --- a/core/renderers/zelos/path_object.ts +++ b/core/renderers/zelos/path_object.ts @@ -77,19 +77,11 @@ export class PathObject extends BasePathObject { // Set shadow stroke colour. const parent = block.getParent(); if (block.isShadow() && parent) { - if (!parent.style.colourTertiary) { - throw new Error( - 'The renderer did not properly initialize the block style'); - } this.svgPath.setAttribute('stroke', parent.style.colourTertiary); } // Apply colour to outlines. for (const outline of this.outlines.values()) { - if (!this.style.colourTertiary) { - throw new Error( - 'The renderer did not properly initialize the block style'); - } outline.setAttribute('fill', this.style.colourTertiary); } } @@ -183,10 +175,6 @@ export class PathObject extends BasePathObject { setOutlinePath(name: string, pathString: string) { const outline = this.getOutlinePath_(name); outline.setAttribute('d', pathString); - if (!this.style.colourTertiary) { - throw new Error( - 'The renderer did not properly initialize the block style'); - } outline.setAttribute('fill', this.style.colourTertiary); } diff --git a/core/theme.ts b/core/theme.ts index 2ac60b0de..c34600233 100644 --- a/core/theme.ts +++ b/core/theme.ts @@ -17,7 +17,7 @@ import * as object from './utils/object.js'; export interface ITheme { - blockStyles?: {[key: string]: BlockStyle}; + blockStyles?: {[key: string]: Partial}; categoryStyles?: {[key: string]: CategoryStyle}; componentStyles?: ComponentStyle; fontStyle?: FontStyle; @@ -58,7 +58,8 @@ export class Theme implements ITheme { * @param opt_componentStyles A map of Blockly component names to style value. */ constructor( - public name: string, opt_blockStyles?: {[key: string]: BlockStyle}, + public name: string, + opt_blockStyles?: {[key: string]: Partial}, opt_categoryStyles?: {[key: string]: CategoryStyle}, opt_componentStyles?: ComponentStyle) { /** The block styles map. */ @@ -187,9 +188,9 @@ export class Theme implements ITheme { export namespace Theme { export interface BlockStyle { colourPrimary: string; - colourSecondary?: string; - colourTertiary?: string; - hat?: string; + colourSecondary: string; + colourTertiary: string; + hat: string; } export interface CategoryStyle { From a9b0b199e31288d55a7a4d50600382038a45b78f Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Tue, 11 Oct 2022 15:48:21 -0700 Subject: [PATCH 20/69] chore: clean up some underscores (#6492) * chore: clean up block_drag_surface.ts * chore: remove underscores in property names in bubble.ts * chore: remove underscores from method names in bubble.ts * chore: format, and remove one cast --- core/block_drag_surface.ts | 92 +++++------ core/bubble.ts | 324 ++++++++++++++++++------------------- 2 files changed, 208 insertions(+), 208 deletions(-) diff --git a/core/block_drag_surface.ts b/core/block_drag_surface.ts index cfcce75cd..909aa76bf 100644 --- a/core/block_drag_surface.ts +++ b/core/block_drag_surface.ts @@ -31,39 +31,40 @@ import * as svgMath from './utils/svg_math.js'; * @alias Blockly.BlockDragSurfaceSvg */ export class BlockDragSurfaceSvg { - /** The SVG drag surface. Set once by BlockDragSurfaceSvg.createDom. */ - private svg_: SVGElement; + /** + * The root element of the drag surface. + */ + private svg: SVGElement; /** * This is where blocks live while they are being dragged if the drag * surface is enabled. */ - private dragGroup_: SVGElement; + private dragGroup: SVGElement; /** * Cached value for the scale of the drag surface. * Used to set/get the correct translation during and after a drag. */ - private scale_ = 1; + private scale = 1; /** * Cached value for the translation of the drag surface. * This translation is in pixel units, because the scale is applied to the * drag group rather than the top-level SVG. */ - private surfaceXY_: Coordinate = new Coordinate(0, 0); - private readonly childSurfaceXY_: Coordinate; + private surfaceXY = new Coordinate(0, 0); + + /** + * Cached value for the translation of the child drag surface in pixel + * units. Since the child drag surface tracks the translation of the + * workspace this is ultimately the translation of the workspace. + */ + private readonly childSurfaceXY = new Coordinate(0, 0); /** @param container Containing element. */ constructor(private readonly container: Element) { - /** - * Cached value for the translation of the child drag surface in pixel - * units. Since the child drag surface tracks the translation of the - * workspace this is ultimately the translation of the workspace. - */ - this.childSurfaceXY_ = new Coordinate(0, 0); - - this.svg_ = dom.createSvgElement( + this.svg = dom.createSvgElement( Svg.SVG, { 'xmlns': dom.SVG_NS, 'xmlns:html': dom.HTML_NS, @@ -72,7 +73,8 @@ export class BlockDragSurfaceSvg { 'class': 'blocklyBlockDragSurface', }, this.container); - this.dragGroup_ = dom.createSvgElement(Svg.G, {}, this.svg_ as SVGElement); + + this.dragGroup = dom.createSvgElement(Svg.G, {}, this.svg); } /** @@ -93,13 +95,13 @@ export class BlockDragSurfaceSvg { * @param blocks Block or group of blocks to place on the drag surface. */ setBlocksAndShow(blocks: SVGElement) { - if (this.dragGroup_.childNodes.length) { + if (this.dragGroup.childNodes.length) { throw Error('Already dragging a block.'); } // appendChild removes the blocks from the previous parent - this.dragGroup_.appendChild(blocks); - this.svg_.style.display = 'block'; - this.surfaceXY_ = new Coordinate(0, 0); + this.dragGroup.appendChild(blocks); + this.svg.style.display = 'block'; + this.surfaceXY = new Coordinate(0, 0); } /** @@ -111,13 +113,13 @@ export class BlockDragSurfaceSvg { * @param scale Scale of the group. */ translateAndScaleGroup(x: number, y: number, scale: number) { - this.scale_ = scale; + this.scale = scale; // Make sure the svg exists on a pixel boundary so that it is not fuzzy. const roundX = Math.round(x); const roundY = Math.round(y); - this.childSurfaceXY_.x = roundX; - this.childSurfaceXY_.y = roundY; - this.dragGroup_!.setAttribute( + this.childSurfaceXY.x = roundX; + this.childSurfaceXY.y = roundY; + this.dragGroup.setAttribute( 'transform', 'translate(' + roundX + ',' + roundY + ') scale(' + scale + ')'); } @@ -128,13 +130,11 @@ export class BlockDragSurfaceSvg { * @internal */ translateSurfaceInternal_() { - let x = this.surfaceXY_!.x; - let y = this.surfaceXY_!.y; // Make sure the svg exists on a pixel boundary so that it is not fuzzy. - x = Math.round(x); - y = Math.round(y); - this.svg_.style.display = 'block'; - dom.setCssTransform(this.svg_, 'translate3d(' + x + 'px, ' + y + 'px, 0)'); + const x = Math.round(this.surfaceXY.x); + const y = Math.round(this.surfaceXY.y); + this.svg.style.display = 'block'; + dom.setCssTransform(this.svg, 'translate3d(' + x + 'px, ' + y + 'px, 0)'); } /** @@ -144,9 +144,9 @@ export class BlockDragSurfaceSvg { * @param deltaY Vertical offset in pixel units. */ translateBy(deltaX: number, deltaY: number) { - const x = this.surfaceXY_.x + deltaX; - const y = this.surfaceXY_.y + deltaY; - this.surfaceXY_ = new Coordinate(x, y); + const x = this.surfaceXY.x + deltaX; + const y = this.surfaceXY.y + deltaY; + this.surfaceXY = new Coordinate(x, y); this.translateSurfaceInternal_(); } @@ -160,7 +160,7 @@ export class BlockDragSurfaceSvg { * @param y Y translation for the entire surface. */ translateSurface(x: number, y: number) { - this.surfaceXY_ = new Coordinate(x * this.scale_, y * this.scale_); + this.surfaceXY = new Coordinate(x * this.scale, y * this.scale); this.translateSurfaceInternal_(); } @@ -171,8 +171,8 @@ export class BlockDragSurfaceSvg { * @returns Current translation of the surface. */ getSurfaceTranslation(): Coordinate { - const xy = svgMath.getRelativeXY(this.svg_ as SVGElement); - return new Coordinate(xy.x / this.scale_, xy.y / this.scale_); + const xy = svgMath.getRelativeXY(this.svg); + return new Coordinate(xy.x / this.scale, xy.y / this.scale); } /** @@ -181,8 +181,8 @@ export class BlockDragSurfaceSvg { * * @returns Drag surface group element. */ - getGroup(): SVGElement|null { - return this.dragGroup_; + getGroup(): SVGElement { + return this.dragGroup; } /** @@ -190,8 +190,8 @@ export class BlockDragSurfaceSvg { * * @returns The SVG drag surface. */ - getSvgRoot(): SVGElement|null { - return this.svg_; + getSvgRoot(): SVGElement { + return this.svg; } /** @@ -201,7 +201,7 @@ export class BlockDragSurfaceSvg { * @returns Drag surface block DOM element, or null if no blocks exist. */ getCurrentBlock(): Element|null { - return this.dragGroup_.firstChild as Element; + return this.dragGroup.firstChild as Element; } /** @@ -213,7 +213,7 @@ export class BlockDragSurfaceSvg { */ getWsTranslation(): Coordinate { // Returning a copy so the coordinate can not be changed outside this class. - return this.childSurfaceXY_.clone(); + return this.childSurfaceXY.clone(); } /** @@ -230,16 +230,16 @@ export class BlockDragSurfaceSvg { const currentBlockElement = this.getCurrentBlock(); if (currentBlockElement) { if (opt_newSurface) { - // appendChild removes the node from this.dragGroup_ + // appendChild removes the node from this.dragGroup opt_newSurface.appendChild(currentBlockElement); } else { - this.dragGroup_.removeChild(currentBlockElement); + this.dragGroup.removeChild(currentBlockElement); } } - this.svg_.style.display = 'none'; - if (this.dragGroup_.childNodes.length) { + this.svg.style.display = 'none'; + if (this.dragGroup.childNodes.length) { throw Error('Drag group was not cleared.'); } - this.surfaceXY_ = new Coordinate(0, 0); + this.surfaceXY = new Coordinate(0, 0); } } diff --git a/core/bubble.ts b/core/bubble.ts index 0652c852a..000ae773e 100644 --- a/core/bubble.ts +++ b/core/bubble.ts @@ -56,67 +56,68 @@ export class Bubble implements IBubble { static ANCHOR_RADIUS = 8; /** Mouse up event data. */ - private static onMouseUpWrapper_: browserEvents.Data|null = null; + private static onMouseUpWrapper: browserEvents.Data|null = null; /** Mouse move event data. */ - private static onMouseMoveWrapper_: browserEvents.Data|null = null; + private static onMouseMoveWrapper: browserEvents.Data|null = null; + workspace_: WorkspaceSvg; content_: SVGElement; shape_: SVGElement; /** Flag to stop incremental rendering during construction. */ - private readonly rendered_: boolean; + private readonly rendered: boolean; /** The SVG group containing all parts of the bubble. */ - private bubbleGroup_: SVGGElement|null = null; + private bubbleGroup: SVGGElement|null = null; /** * The SVG path for the arrow from the bubble to the icon on the block. */ - private bubbleArrow_: SVGPathElement|null = null; + private bubbleArrow: SVGPathElement|null = null; /** The SVG rect for the main body of the bubble. */ - private bubbleBack_: SVGRectElement|null = null; + private bubbleBack: SVGRectElement|null = null; /** The SVG group for the resize hash marks on some bubbles. */ - private resizeGroup_: SVGGElement|null = null; + private resizeGroup: SVGGElement|null = null; /** Absolute coordinate of anchor point, in workspace coordinates. */ - private anchorXY_!: Coordinate; + private anchorXY!: Coordinate; /** * Relative X coordinate of bubble with respect to the anchor's centre, * in workspace units. * In RTL mode the initial value is negated. */ - private relativeLeft_ = 0; + private relativeLeft = 0; /** * Relative Y coordinate of bubble with respect to the anchor's centre, in * workspace units. */ - private relativeTop_ = 0; + private relativeTop = 0; /** Width of bubble, in workspace units. */ - private width_ = 0; + private width = 0; /** Height of bubble, in workspace units. */ - private height_ = 0; + private height = 0; /** Automatically position and reposition the bubble. */ - private autoLayout_ = true; + private autoLayout = true; /** Method to call on resize of bubble. */ - private resizeCallback_: (() => void)|null = null; + private resizeCallback: (() => void)|null = null; /** Method to call on move of bubble. */ - private moveCallback_: (() => void)|null = null; + private moveCallback: (() => void)|null = null; - /** Mouse down on bubbleBack_ event data. */ - private onMouseDownBubbleWrapper_: browserEvents.Data|null = null; + /** Mouse down on bubbleBack event data. */ + private onMouseDownBubbleWrapper: browserEvents.Data|null = null; - /** Mouse down on resizeGroup_ event data. */ - private onMouseDownResizeWrapper_: browserEvents.Data|null = null; + /** Mouse down on resizeGroup event data. */ + private onMouseDownResizeWrapper: browserEvents.Data|null = null; /** * Describes whether this bubble has been disposed of (nodes and event @@ -125,7 +126,7 @@ export class Bubble implements IBubble { * @internal */ disposed = false; - private arrow_radians_: number; + private arrowRadians: number; /** * @param workspace The workspace on which to draw the bubble. @@ -139,7 +140,7 @@ export class Bubble implements IBubble { workspace: WorkspaceSvg, content: SVGElement, shape: SVGElement, anchorXY: Coordinate, bubbleWidth: number|null, bubbleHeight: number|null) { - this.rendered_ = false; + this.rendered = false; this.workspace_ = workspace; this.content_ = content; this.shape_ = shape; @@ -148,11 +149,11 @@ export class Bubble implements IBubble { if (this.workspace_.RTL) { angle = -angle; } - this.arrow_radians_ = math.toRadians(angle); + this.arrowRadians = math.toRadians(angle); const canvas = workspace.getBubbleCanvas(); canvas.appendChild( - this.createDom_(content, !!(bubbleWidth && bubbleHeight))); + this.createDom(content, !!(bubbleWidth && bubbleHeight))); this.setAnchorLocation(anchorXY); if (!bubbleWidth || !bubbleHeight) { @@ -163,9 +164,9 @@ export class Bubble implements IBubble { this.setBubbleSize(bubbleWidth, bubbleHeight); // Render the bubble. - this.positionBubble_(); - this.renderArrow_(); - this.rendered_ = true; + this.positionBubble(); + this.renderArrow(); + this.rendered = true; } /** @@ -175,7 +176,7 @@ export class Bubble implements IBubble { * @param hasResize Add diagonal resize gripper if true. * @returns The bubble's SVG group. */ - private createDom_(content: Element, hasResize: boolean): SVGElement { + private createDom(content: Element, hasResize: boolean): SVGElement { /* Create the bubble. Here's the markup that will be generated: @@ -191,7 +192,7 @@ export class Bubble implements IBubble { [...content goes here...] */ - this.bubbleGroup_ = dom.createSvgElement(Svg.G, {}); + this.bubbleGroup = dom.createSvgElement(Svg.G, {}); let filter: {filter?: string} = { 'filter': 'url(#' + this.workspace_.getRenderer().getConstants().embossFilterId + ')', @@ -201,9 +202,9 @@ export class Bubble implements IBubble { // https://github.com/google/blockly/issues/99 filter = {}; } - const bubbleEmboss = dom.createSvgElement(Svg.G, filter, this.bubbleGroup_); - this.bubbleArrow_ = dom.createSvgElement(Svg.PATH, {}, bubbleEmboss); - this.bubbleBack_ = dom.createSvgElement( + const bubbleEmboss = dom.createSvgElement(Svg.G, filter, this.bubbleGroup); + this.bubbleArrow = dom.createSvgElement(Svg.PATH, {}, bubbleEmboss); + this.bubbleBack = dom.createSvgElement( Svg.RECT, { 'class': 'blocklyDraggable', 'x': 0, @@ -213,17 +214,17 @@ export class Bubble implements IBubble { }, bubbleEmboss); if (hasResize) { - this.resizeGroup_ = dom.createSvgElement( + this.resizeGroup = dom.createSvgElement( Svg.G, { 'class': this.workspace_.RTL ? 'blocklyResizeSW' : 'blocklyResizeSE', }, - this.bubbleGroup_); + this.bubbleGroup); const resizeSize = 2 * Bubble.BORDER_WIDTH; dom.createSvgElement( Svg.POLYGON, {'points': '0,x x,x x,0'.replace(/x/g, resizeSize.toString())}, - this.resizeGroup_); + this.resizeGroup); dom.createSvgElement( Svg.LINE, { 'class': 'blocklyResizeLine', @@ -232,7 +233,7 @@ export class Bubble implements IBubble { 'x2': resizeSize - 1, 'y2': resizeSize / 3, }, - this.resizeGroup_); + this.resizeGroup); dom.createSvgElement( Svg.LINE, { 'class': 'blocklyResizeLine', @@ -241,21 +242,21 @@ export class Bubble implements IBubble { 'x2': resizeSize - 1, 'y2': resizeSize * 2 / 3, }, - this.resizeGroup_); + this.resizeGroup); } else { - this.resizeGroup_ = null; + this.resizeGroup = null; } if (!this.workspace_.options.readOnly) { - this.onMouseDownBubbleWrapper_ = browserEvents.conditionalBind( - this.bubbleBack_, 'mousedown', this, this.bubbleMouseDown_); - if (this.resizeGroup_) { - this.onMouseDownResizeWrapper_ = browserEvents.conditionalBind( - this.resizeGroup_, 'mousedown', this, this.resizeMouseDown_); + this.onMouseDownBubbleWrapper = browserEvents.conditionalBind( + this.bubbleBack, 'mousedown', this, this.bubbleMouseDown); + if (this.resizeGroup) { + this.onMouseDownResizeWrapper = browserEvents.conditionalBind( + this.resizeGroup, 'mousedown', this, this.resizeMouseDown); } } - this.bubbleGroup_.appendChild(content); - return this.bubbleGroup_; + this.bubbleGroup.appendChild(content); + return this.bubbleGroup; } /** @@ -264,7 +265,7 @@ export class Bubble implements IBubble { * @returns The root SVG node of the bubble's group. */ getSvgRoot(): SVGElement { - return this.bubbleGroup_ as SVGElement; + return this.bubbleGroup as SVGElement; } /** @@ -273,7 +274,7 @@ export class Bubble implements IBubble { * @param id ID of block. */ setSvgId(id: string) { - this.bubbleGroup_?.setAttribute('data-block-id', id); + this.bubbleGroup?.setAttribute('data-block-id', id); } /** @@ -281,7 +282,7 @@ export class Bubble implements IBubble { * * @param e Mouse down event. */ - private bubbleMouseDown_(e: Event) { + private bubbleMouseDown(e: Event) { const gesture = this.workspace_.getGesture(e); if (gesture) { gesture.handleBubbleStart(e, this); @@ -321,9 +322,9 @@ export class Bubble implements IBubble { * * @param e Mouse down event. */ - private resizeMouseDown_(e: MouseEvent) { + private resizeMouseDown(e: MouseEvent) { this.promote(); - Bubble.unbindDragEvents_(); + Bubble.unbindDragEvents(); if (browserEvents.isRightButton(e)) { // No right-click. e.stopPropagation(); @@ -333,12 +334,12 @@ export class Bubble implements IBubble { this.workspace_.startDrag( e, new Coordinate( - this.workspace_.RTL ? -this.width_ : this.width_, this.height_)); + this.workspace_.RTL ? -this.width : this.width, this.height)); - Bubble.onMouseUpWrapper_ = browserEvents.conditionalBind( - document, 'mouseup', this, Bubble.bubbleMouseUp_); - Bubble.onMouseMoveWrapper_ = browserEvents.conditionalBind( - document, 'mousemove', this, this.resizeMouseMove_); + Bubble.onMouseUpWrapper = browserEvents.conditionalBind( + document, 'mouseup', this, Bubble.bubbleMouseUp); + Bubble.onMouseMoveWrapper = browserEvents.conditionalBind( + document, 'mousemove', this, this.resizeMouseMove); this.workspace_.hideChaff(); // This event has been handled. No need to bubble up to the document. e.stopPropagation(); @@ -349,13 +350,13 @@ export class Bubble implements IBubble { * * @param e Mouse move event. */ - private resizeMouseMove_(e: MouseEvent) { - this.autoLayout_ = false; + private resizeMouseMove(e: MouseEvent) { + this.autoLayout = false; const newXY = this.workspace_.moveDrag(e); this.setBubbleSize(this.workspace_.RTL ? -newXY.x : newXY.x, newXY.y); if (this.workspace_.RTL) { // RTL requires the bubble to move its left edge. - this.positionBubble_(); + this.positionBubble(); } } @@ -365,7 +366,7 @@ export class Bubble implements IBubble { * @param callback The function to call on resize. */ registerResizeEvent(callback: () => void) { - this.resizeCallback_ = callback; + this.resizeCallback = callback; } /** @@ -374,7 +375,7 @@ export class Bubble implements IBubble { * @param callback The function to call on move. */ registerMoveEvent(callback: () => void) { - this.moveCallback_ = callback; + this.moveCallback = callback; } /** @@ -384,9 +385,9 @@ export class Bubble implements IBubble { * @internal */ promote(): boolean { - const svgGroup = this.bubbleGroup_?.parentNode; - if (svgGroup?.lastChild !== this.bubbleGroup_ && this.bubbleGroup_) { - svgGroup?.appendChild(this.bubbleGroup_); + const svgGroup = this.bubbleGroup?.parentNode; + if (svgGroup?.lastChild !== this.bubbleGroup && this.bubbleGroup) { + svgGroup?.appendChild(this.bubbleGroup); return true; } return false; @@ -399,29 +400,29 @@ export class Bubble implements IBubble { * @param xy Absolute location. */ setAnchorLocation(xy: Coordinate) { - this.anchorXY_ = xy; - if (this.rendered_) { - this.positionBubble_(); + this.anchorXY = xy; + if (this.rendered) { + this.positionBubble(); } } /** Position the bubble so that it does not fall off-screen. */ - private layoutBubble_() { + private layoutBubble() { // Get the metrics in workspace units. const viewMetrics = this.workspace_.getMetricsManager().getViewMetrics(true); - const optimalLeft = this.getOptimalRelativeLeft_(viewMetrics); - const optimalTop = this.getOptimalRelativeTop_(viewMetrics); + const optimalLeft = this.getOptimalRelativeLeft(viewMetrics); + const optimalTop = this.getOptimalRelativeTop(viewMetrics); const bbox = (this.shape_ as SVGGraphicsElement).getBBox(); const topPosition = { x: optimalLeft, - y: -this.height_ - + y: -this.height - this.workspace_.getRenderer().getConstants().MIN_BLOCK_HEIGHT as number, }; - const startPosition = {x: -this.width_ - 30, y: optimalTop}; + const startPosition = {x: -this.width - 30, y: optimalTop}; const endPosition = {x: bbox.width, y: optimalTop}; const bottomPosition = {x: optimalLeft, y: bbox.height}; @@ -430,11 +431,11 @@ export class Bubble implements IBubble { const fartherPosition = bbox.width < bbox.height ? bottomPosition : endPosition; - const topPositionOverlap = this.getOverlap_(topPosition, viewMetrics); - const startPositionOverlap = this.getOverlap_(startPosition, viewMetrics); - const closerPositionOverlap = this.getOverlap_(closerPosition, viewMetrics); + const topPositionOverlap = this.getOverlap(topPosition, viewMetrics); + const startPositionOverlap = this.getOverlap(startPosition, viewMetrics); + const closerPositionOverlap = this.getOverlap(closerPosition, viewMetrics); const fartherPositionOverlap = - this.getOverlap_(fartherPosition, viewMetrics); + this.getOverlap(fartherPosition, viewMetrics); // Set the position to whichever position shows the most of the bubble, // with tiebreaks going in the order: top > start > close > far. @@ -442,25 +443,25 @@ export class Bubble implements IBubble { topPositionOverlap, startPositionOverlap, closerPositionOverlap, fartherPositionOverlap); if (topPositionOverlap === mostOverlap) { - this.relativeLeft_ = topPosition.x; - this.relativeTop_ = topPosition.y; + this.relativeLeft = topPosition.x; + this.relativeTop = topPosition.y; return; } if (startPositionOverlap === mostOverlap) { - this.relativeLeft_ = startPosition.x; - this.relativeTop_ = startPosition.y; + this.relativeLeft = startPosition.x; + this.relativeTop = startPosition.y; return; } if (closerPositionOverlap === mostOverlap) { - this.relativeLeft_ = closerPosition.x; - this.relativeTop_ = closerPosition.y; + this.relativeLeft = closerPosition.x; + this.relativeTop = closerPosition.y; return; } // TODO: I believe relativeLeft_ should actually be called relativeStart_ // and then the math should be fixed to reflect this. (hopefully it'll // make it look simpler) - this.relativeLeft_ = fartherPosition.x; - this.relativeTop_ = fartherPosition.y; + this.relativeLeft = fartherPosition.x; + this.relativeTop = fartherPosition.y; } /** @@ -473,19 +474,19 @@ export class Bubble implements IBubble { * in. * @returns The percentage of the bubble that is visible. */ - private getOverlap_( + private getOverlap( relativeMin: {x: number, y: number}, viewMetrics: ContainerRegion): number { // The position of the top-left corner of the bubble in workspace units. const bubbleMin = { - x: this.workspace_.RTL ? this.anchorXY_.x - relativeMin.x - this.width_ : - relativeMin.x + this.anchorXY_.x, - y: relativeMin.y + this.anchorXY_.y, + x: this.workspace_.RTL ? this.anchorXY.x - relativeMin.x - this.width : + relativeMin.x + this.anchorXY.x, + y: relativeMin.y + this.anchorXY.y, }; // The position of the bottom-right corner of the bubble in workspace units. const bubbleMax = { - x: bubbleMin.x + this.width_, - y: bubbleMin.y + this.height_, + x: bubbleMin.x + this.width, + y: bubbleMin.y + this.height, }; // We could adjust these values to account for the scrollbars, but the @@ -507,8 +508,7 @@ export class Bubble implements IBubble { Math.max(bubbleMin.y, workspaceMin.y); return Math.max( 0, - Math.min( - 1, overlapWidth * overlapHeight / (this.width_ * this.height_))); + Math.min(1, overlapWidth * overlapHeight / (this.width * this.height))); } /** @@ -521,18 +521,18 @@ export class Bubble implements IBubble { * @returns The optimal horizontal position of the top-left corner of the * bubble. */ - private getOptimalRelativeLeft_(viewMetrics: ContainerRegion): number { - let relativeLeft = -this.width_ / 4; + private getOptimalRelativeLeft(viewMetrics: ContainerRegion): number { + let relativeLeft = -this.width / 4; // No amount of sliding left or right will give us a better overlap. - if (this.width_ > viewMetrics.width) { + if (this.width > viewMetrics.width) { return relativeLeft; } if (this.workspace_.RTL) { // Bubble coordinates are flipped in RTL. - const bubbleRight = this.anchorXY_.x - relativeLeft; - const bubbleLeft = bubbleRight - this.width_; + const bubbleRight = this.anchorXY.x - relativeLeft; + const bubbleLeft = bubbleRight - this.width; const workspaceRight = viewMetrics.left + viewMetrics.width; const workspaceLeft = viewMetrics.left + @@ -541,14 +541,14 @@ export class Bubble implements IBubble { if (bubbleLeft < workspaceLeft) { // Slide the bubble right until it is onscreen. - relativeLeft = -(workspaceLeft - this.anchorXY_.x + this.width_); + relativeLeft = -(workspaceLeft - this.anchorXY.x + this.width); } else if (bubbleRight > workspaceRight) { // Slide the bubble left until it is onscreen. - relativeLeft = -(workspaceRight - this.anchorXY_.x); + relativeLeft = -(workspaceRight - this.anchorXY.x); } } else { - const bubbleLeft = relativeLeft + this.anchorXY_.x; - const bubbleRight = bubbleLeft + this.width_; + const bubbleLeft = relativeLeft + this.anchorXY.x; + const bubbleRight = bubbleLeft + this.width; const workspaceLeft = viewMetrics.left; const workspaceRight = viewMetrics.left + viewMetrics.width - @@ -557,10 +557,10 @@ export class Bubble implements IBubble { if (bubbleLeft < workspaceLeft) { // Slide the bubble right until it is onscreen. - relativeLeft = workspaceLeft - this.anchorXY_.x; + relativeLeft = workspaceLeft - this.anchorXY.x; } else if (bubbleRight > workspaceRight) { // Slide the bubble left until it is onscreen. - relativeLeft = workspaceRight - this.anchorXY_.x - this.width_; + relativeLeft = workspaceRight - this.anchorXY.x - this.width; } } @@ -577,42 +577,42 @@ export class Bubble implements IBubble { * @returns The optimal vertical position of the top-left corner of the * bubble. */ - private getOptimalRelativeTop_(viewMetrics: ContainerRegion): number { - let relativeTop = -this.height_ / 4; + private getOptimalRelativeTop(viewMetrics: ContainerRegion): number { + let relativeTop = -this.height / 4; // No amount of sliding up or down will give us a better overlap. - if (this.height_ > viewMetrics.height) { + if (this.height > viewMetrics.height) { return relativeTop; } - const bubbleTop = this.anchorXY_.y + relativeTop; - const bubbleBottom = bubbleTop + this.height_; + const bubbleTop = this.anchorXY.y + relativeTop; + const bubbleBottom = bubbleTop + this.height; const workspaceTop = viewMetrics.top; const workspaceBottom = viewMetrics.top + viewMetrics.height - // Thickness in workspace units. Scrollbar.scrollbarThickness / this.workspace_.scale; - const anchorY = this.anchorXY_.y; + const anchorY = this.anchorXY.y; if (bubbleTop < workspaceTop) { // Slide the bubble down until it is onscreen. relativeTop = workspaceTop - anchorY; } else if (bubbleBottom > workspaceBottom) { // Slide the bubble up until it is onscreen. - relativeTop = workspaceBottom - anchorY - this.height_; + relativeTop = workspaceBottom - anchorY - this.height; } return relativeTop; } /** Move the bubble to a location relative to the anchor's centre. */ - private positionBubble_() { - let left = this.anchorXY_.x; + private positionBubble() { + let left = this.anchorXY.x; if (this.workspace_.RTL) { - left -= this.relativeLeft_ + this.width_; + left -= this.relativeLeft + this.width; } else { - left += this.relativeLeft_; + left += this.relativeLeft; } - const top = this.relativeTop_ + this.anchorXY_.y; + const top = this.relativeTop + this.anchorXY.y; this.moveTo(left, top); } @@ -624,7 +624,7 @@ export class Bubble implements IBubble { * @internal */ moveTo(x: number, y: number) { - this.bubbleGroup_?.setAttribute( + this.bubbleGroup?.setAttribute( 'transform', 'translate(' + x + ',' + y + ')'); } @@ -635,8 +635,8 @@ export class Bubble implements IBubble { * @internal */ setDragging(adding: boolean) { - if (!adding && this.moveCallback_) { - this.moveCallback_(); + if (!adding && this.moveCallback) { + this.moveCallback(); } } @@ -646,7 +646,7 @@ export class Bubble implements IBubble { * @returns The height and width of the bubble. */ getBubbleSize(): Size { - return new Size(this.width_, this.height_); + return new Size(this.width, this.height); } /** @@ -660,46 +660,46 @@ export class Bubble implements IBubble { // Minimum size of a bubble. width = Math.max(width, doubleBorderWidth + 45); height = Math.max(height, doubleBorderWidth + 20); - this.width_ = width; - this.height_ = height; - this.bubbleBack_?.setAttribute('width', width.toString()); - this.bubbleBack_?.setAttribute('height', height.toString()); - if (this.resizeGroup_) { + this.width = width; + this.height = height; + this.bubbleBack?.setAttribute('width', width.toString()); + this.bubbleBack?.setAttribute('height', height.toString()); + if (this.resizeGroup) { if (this.workspace_.RTL) { // Mirror the resize group. const resizeSize = 2 * Bubble.BORDER_WIDTH; - this.resizeGroup_.setAttribute( + this.resizeGroup.setAttribute( 'transform', 'translate(' + resizeSize + ',' + (height - doubleBorderWidth) + ') scale(-1 1)'); } else { - this.resizeGroup_.setAttribute( + this.resizeGroup.setAttribute( 'transform', 'translate(' + (width - doubleBorderWidth) + ',' + (height - doubleBorderWidth) + ')'); } } - if (this.autoLayout_) { - this.layoutBubble_(); + if (this.autoLayout) { + this.layoutBubble(); } - this.positionBubble_(); - this.renderArrow_(); + this.positionBubble(); + this.renderArrow(); // Allow the contents to resize. - if (this.resizeCallback_) { - this.resizeCallback_(); + if (this.resizeCallback) { + this.resizeCallback(); } } /** Draw the arrow between the bubble and the origin. */ - private renderArrow_() { + private renderArrow() { const steps = []; // Find the relative coordinates of the center of the bubble. - const relBubbleX = this.width_ / 2; - const relBubbleY = this.height_ / 2; + const relBubbleX = this.width / 2; + const relBubbleY = this.height / 2; // Find the relative coordinates of the center of the anchor. - let relAnchorX = -this.relativeLeft_; - let relAnchorY = -this.relativeTop_; + let relAnchorX = -this.relativeLeft; + let relAnchorY = -this.relativeTop; if (relBubbleX === relAnchorX && relBubbleY === relAnchorY) { // Null case. Bubble is directly on top of the anchor. // Short circuit this rather than wade through divide by zeros. @@ -742,7 +742,7 @@ export class Bubble implements IBubble { const baseY2 = relBubbleY - thickness * rightRise; // Distortion to curve the arrow. - let swirlAngle = angle + this.arrow_radians_; + let swirlAngle = angle + this.arrowRadians; if (swirlAngle > Math.PI * 2) { swirlAngle -= Math.PI * 2; } @@ -758,7 +758,7 @@ export class Bubble implements IBubble { ',' + (baseY2 + swirlRise) + ' ' + baseX2 + ',' + baseY2); } steps.push('z'); - this.bubbleArrow_?.setAttribute('d', steps.join(' ')); + this.bubbleArrow?.setAttribute('d', steps.join(' ')); } /** @@ -767,20 +767,20 @@ export class Bubble implements IBubble { * @param hexColour Hex code of colour. */ setColour(hexColour: string) { - this.bubbleBack_?.setAttribute('fill', hexColour); - this.bubbleArrow_?.setAttribute('fill', hexColour); + this.bubbleBack?.setAttribute('fill', hexColour); + this.bubbleArrow?.setAttribute('fill', hexColour); } /** Dispose of this bubble. */ dispose() { - if (this.onMouseDownBubbleWrapper_) { - browserEvents.unbind(this.onMouseDownBubbleWrapper_); + if (this.onMouseDownBubbleWrapper) { + browserEvents.unbind(this.onMouseDownBubbleWrapper); } - if (this.onMouseDownResizeWrapper_) { - browserEvents.unbind(this.onMouseDownResizeWrapper_); + if (this.onMouseDownResizeWrapper) { + browserEvents.unbind(this.onMouseDownResizeWrapper); } - Bubble.unbindDragEvents_(); - dom.removeNode(this.bubbleGroup_); + Bubble.unbindDragEvents(); + dom.removeNode(this.bubbleGroup); this.disposed = true; } @@ -800,12 +800,12 @@ export class Bubble implements IBubble { this.moveTo(newLoc.x, newLoc.y); } if (this.workspace_.RTL) { - this.relativeLeft_ = this.anchorXY_.x - newLoc.x - this.width_; + this.relativeLeft = this.anchorXY.x - newLoc.x - this.width; } else { - this.relativeLeft_ = newLoc.x - this.anchorXY_.x; + this.relativeLeft = newLoc.x - this.anchorXY.x; } - this.relativeTop_ = newLoc.y - this.anchorXY_.y; - this.renderArrow_(); + this.relativeTop = newLoc.y - this.anchorXY.y; + this.renderArrow(); } /** @@ -817,9 +817,9 @@ export class Bubble implements IBubble { getRelativeToSurfaceXY(): Coordinate { return new Coordinate( this.workspace_.RTL ? - -this.relativeLeft_ + this.anchorXY_.x - this.width_ : - this.anchorXY_.x + this.relativeLeft_, - this.anchorXY_.y + this.relativeTop_); + -this.relativeLeft + this.anchorXY.x - this.width : + this.anchorXY.x + this.relativeLeft, + this.anchorXY.y + this.relativeTop); } /** @@ -831,18 +831,18 @@ export class Bubble implements IBubble { * @internal */ setAutoLayout(enable: boolean) { - this.autoLayout_ = enable; + this.autoLayout = enable; } /** Stop binding to the global mouseup and mousemove events. */ - private static unbindDragEvents_() { - if (Bubble.onMouseUpWrapper_) { - browserEvents.unbind(Bubble.onMouseUpWrapper_); - Bubble.onMouseUpWrapper_ = null; + private static unbindDragEvents() { + if (Bubble.onMouseUpWrapper) { + browserEvents.unbind(Bubble.onMouseUpWrapper); + Bubble.onMouseUpWrapper = null; } - if (Bubble.onMouseMoveWrapper_) { - browserEvents.unbind(Bubble.onMouseMoveWrapper_); - Bubble.onMouseMoveWrapper_ = null; + if (Bubble.onMouseMoveWrapper) { + browserEvents.unbind(Bubble.onMouseMoveWrapper); + Bubble.onMouseMoveWrapper = null; } } @@ -851,9 +851,9 @@ export class Bubble implements IBubble { * * @param _e Mouse up event. */ - private static bubbleMouseUp_(_e: MouseEvent) { + private static bubbleMouseUp(_e: MouseEvent) { Touch.clearTouchIdentifier(); - Bubble.unbindDragEvents_(); + Bubble.unbindDragEvents(); } /** From a64d6e91a038f34eb89bac7f0f2bdb5c5472d34e Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Wed, 12 Oct 2022 09:22:17 -0700 Subject: [PATCH 21/69] fix: fix block factory in manual mode (#6533) --- .../block_definition_extractor.js | 2 +- demos/blockfactory/factory.js | 52 ++++++++++--------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/demos/blockfactory/block_definition_extractor.js b/demos/blockfactory/block_definition_extractor.js index 59cc50fd8..ef791a224 100644 --- a/demos/blockfactory/block_definition_extractor.js +++ b/demos/blockfactory/block_definition_extractor.js @@ -716,7 +716,7 @@ BlockDefinitionExtractor.colourBlockFromHue_ = function(hue) { var colourBlock = BlockDefinitionExtractor.newDomElement_( 'block', {type: 'colour_hue'}); colourBlock.append(BlockDefinitionExtractor.newDomElement_('mutation', { - colour: Blockly.hueToRgb(hue) + colour: Blockly.utils.colour.hueToHex(hue) })); colourBlock.append(BlockDefinitionExtractor.newDomElement_( 'field', {name: 'HUE'}, hue.toString())); diff --git a/demos/blockfactory/factory.js b/demos/blockfactory/factory.js index 166f5f707..05832e2f1 100644 --- a/demos/blockfactory/factory.js +++ b/demos/blockfactory/factory.js @@ -178,26 +178,38 @@ BlockFactory.updatePreview = function() { return; } - // Backup Blockly.Blocks definitions so we can delete them all - // before instantiating user-defined block. This avoids a collision - // between the main workspace and preview if the user creates a - // 'factory_base' block, for instance. - var originalBlocks = Object.assign(Object.create(null), Blockly.Blocks); - try { - // Delete existing blocks. - for (var key in Blockly.Blocks) { - delete Blockly.Blocks[key]; + // Don't let the user create a block type that already exists, + // because it doesn't work. + var warnExistingBlock = function(blockType) { + if (blockType in Blockly.Blocks) { + var text = `You can't make a block called ${blockType} in this tool because that name already exists.`; + FactoryUtils.getRootBlock(BlockFactory.mainWorkspace).setWarningText(text); + console.error(text); + return true; } + return false; + } + var blockType = 'block_type'; + var blockCreated = false; + try { if (format === 'JSON') { var json = JSON.parse(code); - Blockly.Blocks[json.type || BlockFactory.UNNAMED] = { + blockType = json.type || BlockFactory.UNNAMED; + if (warnExistingBlock(blockType)) { + return; + } + Blockly.Blocks[blockType] = { init: function() { this.jsonInit(json); } }; } else if (format === 'JavaScript') { try { + blockType = FactoryUtils.getBlockTypeFromJsDefinition(code); + if (warnExistingBlock(blockType)) { + return; + } eval(code); } catch (e) { // TODO: Display error in the UI @@ -205,15 +217,7 @@ BlockFactory.updatePreview = function() { return; } } - - // Look for newly-created block(s) (ideally just one). - var createdTypes = Object.getOwnPropertyNames(Blockly.Blocks); - if (createdTypes.length < 1) { - return; - } else if (createdTypes.length > 1) { - console.log('Unexpectedly found more than one block definition'); - } - var blockType = createdTypes[0]; + blockCreated = true; // Create the preview block. var previewBlock = BlockFactory.previewWorkspace.newBlock(blockType); @@ -247,12 +251,12 @@ BlockFactory.updatePreview = function() { BlockFactory.updateBlocksFlag = false BlockFactory.updateBlocksFlagDelayed = false } finally { - // Remove all newly-created block(s). - for (var key in Blockly.Blocks) { - delete Blockly.Blocks[key]; + // Remove the newly-created block. + // We have to check if the block was actually created so that we don't remove + // one of the built-in blocks, like factory_base. + if (blockCreated) { + delete Blockly.Blocks[blockType]; } - // Restore original blocks. - Object.assign(Blockly.Blocks, originalBlocks); } }; From 25fe27221f97b3bfa507d491e01bd20b6f207189 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Wed, 12 Oct 2022 13:28:29 -0700 Subject: [PATCH 22/69] chore: remove underscores from private properties in workspace.ts (#6536) --- core/workspace.ts | 80 +++++++++++++-------------- tests/mocha/gesture_test.js | 2 +- tests/mocha/test_helpers/workspace.js | 22 ++++---- 3 files changed, 52 insertions(+), 52 deletions(-) diff --git a/core/workspace.ts b/core/workspace.ts index 2560b8744..101596374 100644 --- a/core/workspace.ts +++ b/core/workspace.ts @@ -101,15 +101,15 @@ export class Workspace implements IASTNodeLocation { connectionDBList: ConnectionDB[] = []; connectionChecker: IConnectionChecker; - private readonly topBlocks_: Block[] = []; - private readonly topComments_: WorkspaceComment[] = []; + private readonly topBlocks: Block[] = []; + private readonly topComments: WorkspaceComment[] = []; private readonly commentDB = new Map(); - private readonly listeners_: Function[] = []; + private readonly listeners: Function[] = []; protected undoStack_: Abstract[] = []; protected redoStack_: Abstract[] = []; private readonly blockDB = new Map(); private readonly typedBlocksDB = new Map(); - private variableMap_: VariableMap; + private variableMap: VariableMap; /** * Blocks in the flyout can refer to variables that don't exist in the main @@ -119,7 +119,7 @@ export class Workspace implements IASTNodeLocation { * these by tracking "potential" variables in the flyout. These variables * become real when references to them are dragged into the main workspace. */ - private potentialVariableMap_: VariableMap|null = null; + private potentialVariableMap: VariableMap|null = null; /** @param opt_options Dictionary of options. */ constructor(opt_options?: Options) { @@ -142,7 +142,7 @@ export class Workspace implements IASTNodeLocation { * all of the named variables in the workspace, including variables that are * not currently in use. */ - this.variableMap_ = new VariableMap(this); + this.variableMap = new VariableMap(this); } /** @@ -152,7 +152,7 @@ export class Workspace implements IASTNodeLocation { * @suppress {checkTypes} */ dispose() { - this.listeners_.length = 0; + this.listeners.length = 0; this.clear(); // Remove from workspace database. common.unregisterWorkpace(this); @@ -193,7 +193,7 @@ export class Workspace implements IASTNodeLocation { * @param block Block to add. */ addTopBlock(block: Block) { - this.topBlocks_.push(block); + this.topBlocks.push(block); } /** @@ -202,7 +202,7 @@ export class Workspace implements IASTNodeLocation { * @param block Block to remove. */ removeTopBlock(block: Block) { - if (!arrayUtils.removeElem(this.topBlocks_, block)) { + if (!arrayUtils.removeElem(this.topBlocks, block)) { throw Error('Block not present in workspace\'s list of top-most blocks.'); } } @@ -215,8 +215,8 @@ export class Workspace implements IASTNodeLocation { * @returns The top-level block objects. */ getTopBlocks(ordered: boolean): Block[] { - // Copy the topBlocks_ list. - const blocks = (new Array()).concat(this.topBlocks_); + // Copy the topBlocks list. + const blocks = (new Array()).concat(this.topBlocks); if (ordered && blocks.length > 1) { // AnyDuringMigration because: Property 'offset' does not exist on type // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) => number'. @@ -296,7 +296,7 @@ export class Workspace implements IASTNodeLocation { * @internal */ addTopComment(comment: WorkspaceComment) { - this.topComments_.push(comment); + this.topComments.push(comment); // Note: If the comment database starts to hold block comments, this may // need to move to a separate function. @@ -315,7 +315,7 @@ export class Workspace implements IASTNodeLocation { * @internal */ removeTopComment(comment: WorkspaceComment) { - if (!arrayUtils.removeElem(this.topComments_, comment)) { + if (!arrayUtils.removeElem(this.topComments, comment)) { throw Error( 'Comment not present in workspace\'s list of top-most ' + 'comments.'); @@ -334,8 +334,8 @@ export class Workspace implements IASTNodeLocation { * @internal */ getTopComments(ordered: boolean): WorkspaceComment[] { - // Copy the topComments_ list. - const comments = (new Array()).concat(this.topComments_); + // Copy the topComments list. + const comments = (new Array()).concat(this.topComments); if (ordered && comments.length > 1) { // AnyDuringMigration because: Property 'offset' does not exist on type // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) => number'. @@ -393,18 +393,18 @@ export class Workspace implements IASTNodeLocation { if (!existingGroup) { eventUtils.setGroup(true); } - while (this.topBlocks_.length) { - this.topBlocks_[0].dispose(false); + while (this.topBlocks.length) { + this.topBlocks[0].dispose(false); } - while (this.topComments_.length) { - this.topComments_[this.topComments_.length - 1].dispose(); + while (this.topComments.length) { + this.topComments[this.topComments.length - 1].dispose(); } if (!existingGroup) { eventUtils.setGroup(false); } - this.variableMap_.clear(); - if (this.potentialVariableMap_) { - this.potentialVariableMap_.clear(); + this.variableMap.clear(); + if (this.potentialVariableMap) { + this.potentialVariableMap.clear(); } } finally { this.isClearing = false; @@ -420,7 +420,7 @@ export class Workspace implements IASTNodeLocation { * @param newName New variable name. */ renameVariableById(id: string, newName: string) { - this.variableMap_.renameVariableById(id, newName); + this.variableMap.renameVariableById(id, newName); } /** @@ -436,7 +436,7 @@ export class Workspace implements IASTNodeLocation { */ createVariable(name: string, opt_type?: string|null, opt_id?: string|null): VariableModel { - return this.variableMap_.createVariable(name, opt_type, opt_id); + return this.variableMap.createVariable(name, opt_type, opt_id); } /** @@ -446,7 +446,7 @@ export class Workspace implements IASTNodeLocation { * @returns Array of block usages. */ getVariableUsesById(id: string): Block[] { - return this.variableMap_.getVariableUsesById(id); + return this.variableMap.getVariableUsesById(id); } /** @@ -456,7 +456,7 @@ export class Workspace implements IASTNodeLocation { * @param id ID of variable to delete. */ deleteVariableById(id: string) { - this.variableMap_.deleteVariableById(id); + this.variableMap.deleteVariableById(id); } /** @@ -470,7 +470,7 @@ export class Workspace implements IASTNodeLocation { */ getVariable(name: string, opt_type?: string): VariableModel|null { // TODO (#1559): Possibly delete this function after resolving #1559. - return this.variableMap_.getVariable(name, opt_type); + return this.variableMap.getVariable(name, opt_type); } /** @@ -480,7 +480,7 @@ export class Workspace implements IASTNodeLocation { * @returns The variable with the given ID. */ getVariableById(id: string): VariableModel|null { - return this.variableMap_.getVariableById(id); + return this.variableMap.getVariableById(id); } /** @@ -492,7 +492,7 @@ export class Workspace implements IASTNodeLocation { * if none are found. */ getVariablesOfType(type: string|null): VariableModel[] { - return this.variableMap_.getVariablesOfType(type); + return this.variableMap.getVariablesOfType(type); } /** @@ -502,7 +502,7 @@ export class Workspace implements IASTNodeLocation { * @internal */ getVariableTypes(): string[] { - return this.variableMap_.getVariableTypes(this); + return this.variableMap.getVariableTypes(this); } /** @@ -511,7 +511,7 @@ export class Workspace implements IASTNodeLocation { * @returns List of variable models. */ getAllVariables(): VariableModel[] { - return this.variableMap_.getAllVariables(); + return this.variableMap.getAllVariables(); } /** @@ -520,7 +520,7 @@ export class Workspace implements IASTNodeLocation { * @returns List of all variable names of all types. */ getAllVariableNames(): string[] { - return this.variableMap_.getAllVariableNames(); + return this.variableMap.getAllVariableNames(); } /* End functions that are just pass-throughs to the variable map. */ /** @@ -697,7 +697,7 @@ export class Workspace implements IASTNodeLocation { * @returns Obsolete return value, ignore. */ addChangeListener(func: Function): Function { - this.listeners_.push(func); + this.listeners.push(func); return func; } @@ -707,7 +707,7 @@ export class Workspace implements IASTNodeLocation { * @param func Function to stop calling. */ removeChangeListener(func: Function) { - arrayUtils.removeElem(this.listeners_, func); + arrayUtils.removeElem(this.listeners, func); } /** @@ -723,8 +723,8 @@ export class Workspace implements IASTNodeLocation { this.undoStack_.shift(); } } - for (let i = 0; i < this.listeners_.length; i++) { - const func = this.listeners_[i]; + for (let i = 0; i < this.listeners.length; i++) { + const func = this.listeners[i]; func(event); } } @@ -798,7 +798,7 @@ export class Workspace implements IASTNodeLocation { * @internal */ getPotentialVariableMap(): VariableMap|null { - return this.potentialVariableMap_; + return this.potentialVariableMap; } /** @@ -807,7 +807,7 @@ export class Workspace implements IASTNodeLocation { * @internal */ createPotentialVariableMap() { - this.potentialVariableMap_ = new VariableMap(this); + this.potentialVariableMap = new VariableMap(this); } /** @@ -816,7 +816,7 @@ export class Workspace implements IASTNodeLocation { * @returns The variable map. */ getVariableMap(): VariableMap { - return this.variableMap_; + return this.variableMap; } /** @@ -826,7 +826,7 @@ export class Workspace implements IASTNodeLocation { * @internal */ setVariableMap(variableMap: VariableMap) { - this.variableMap_ = variableMap; + this.variableMap = variableMap; } /** diff --git a/tests/mocha/gesture_test.js b/tests/mocha/gesture_test.js index 1ee0c75ca..01e0da18d 100644 --- a/tests/mocha/gesture_test.js +++ b/tests/mocha/gesture_test.js @@ -43,7 +43,7 @@ suite('Gesture', function() { } function getTopFlyoutBlock(flyout) { - return flyout.workspace_.topBlocks_[0]; + return flyout.workspace_.getTopBlocks(false)[0]; } setup(function() { diff --git a/tests/mocha/test_helpers/workspace.js b/tests/mocha/test_helpers/workspace.js index 21ae2db67..a51d5b02e 100644 --- a/tests/mocha/test_helpers/workspace.js +++ b/tests/mocha/test_helpers/workspace.js @@ -37,14 +37,14 @@ export function testAWorkspace() { }); function assertBlockVarModelName(workspace, blockIndex, name) { - const block = workspace.topBlocks_[blockIndex]; - chai.assert.exists(block, 'Block at topBlocks_[' + blockIndex + ']'); + const block = workspace.getTopBlocks(false)[blockIndex]; + chai.assert.exists(block, 'Block at topBlocks[' + blockIndex + ']'); const varModel = block.getVarModels()[0]; chai.assert.exists(varModel, - 'VariableModel for block at topBlocks_[' + blockIndex + ']'); + 'VariableModel for block at topBlocks[' + blockIndex + ']'); const blockVarName = varModel.name; chai.assert.equal(blockVarName, name, - 'VariableModel name for block at topBlocks_[' + blockIndex + ']'); + 'VariableModel name for block at topBlocks[' + blockIndex + ']'); } function createVarBlocksNoEvents(workspace, ids) { @@ -68,8 +68,8 @@ export function testAWorkspace() { this.workspace.newBlock(''); this.workspace.clear(); - chai.assert.equal(this.workspace.topBlocks_.length, 0); - const varMapLength = this.workspace.variableMap_.variableMap.size; + chai.assert.equal(this.workspace.getTopBlocks(false).length, 0); + const varMapLength = this.workspace.getVariableMap().variableMap.size; chai.assert.equal(varMapLength, 0); }); @@ -78,8 +78,8 @@ export function testAWorkspace() { this.workspace.newBlock(''); this.workspace.clear(); - chai.assert.equal(this.workspace.topBlocks_.length, 0); - const varMapLength = this.workspace.variableMap_.variableMap.size; + chai.assert.equal(this.workspace.getTopBlocks(false).length, 0); + const varMapLength = this.workspace.getVariableMap().variableMap.size; chai.assert.equal(varMapLength, 0); }); }); @@ -1272,7 +1272,7 @@ export function testAWorkspace() { this.workspace.undo(true); // Expect that both variables are deleted - chai.assert.equal(this.workspace.topBlocks_.length, 0); + chai.assert.equal(this.workspace.getTopBlocks(false).length, 0); chai.assert.isNull(this.workspace.getVariableById('id1')); chai.assert.isNull(this.workspace.getVariableById('id2')); @@ -1338,12 +1338,12 @@ export function testAWorkspace() { // Redo delete this.workspace.undo(true); - chai.assert.equal(this.workspace.topBlocks_.length, 0); + chai.assert.equal(this.workspace.getTopBlocks(false).length, 0); chai.assert.isNull(this.workspace.getVariableById('id1')); // Redo delete, nothing should happen this.workspace.undo(true); - chai.assert.equal(this.workspace.topBlocks_.length, 0); + chai.assert.equal(this.workspace.getTopBlocks(false).length, 0); chai.assert.isNull(this.workspace.getVariableById('id1')); }); }); From ab9825cfafe226b9456d2a73d738a754291f332d Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Wed, 12 Oct 2022 16:07:13 -0700 Subject: [PATCH 23/69] chore: remove underscores from some private properties and methods (#6537) * chore: rename properties to remove underscores in zoom_controls.ts * chore: remove underscores from private methods in zoom_controls.ts * chore: fix underscores in private property names in ws_svg * chore: format --- core/workspace_svg.ts | 303 ++++++++++++++++++------------------ core/zoom_controls.ts | 108 ++++++------- tests/mocha/gesture_test.js | 8 +- 3 files changed, 209 insertions(+), 210 deletions(-) diff --git a/core/workspace_svg.ts b/core/workspace_svg.ts index f7a18d914..551b60476 100644 --- a/core/workspace_svg.ts +++ b/core/workspace_svg.ts @@ -96,7 +96,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * A wrapper function called when a resize event occurs. * You can pass the result to `eventHandling.unbind`. */ - private resizeHandlerWrapper_: browserEvents.Data|null = null; + private resizeHandlerWrapper: browserEvents.Data|null = null; /** * The render status of an SVG workspace. @@ -115,7 +115,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * Whether this workspace has resizes enabled. * Disable during batch operations for a performance improvement. */ - private resizesEnabled_ = true; + private resizesEnabled = true; /** * Current horizontal scrolling offset in pixel units, relative to the @@ -188,19 +188,19 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { startScrollY = 0; /** Distance from mouse to object being dragged. */ - private dragDeltaXY_: Coordinate|null = null; + private dragDeltaXY: Coordinate|null = null; /** Current scale. */ scale = 1; /** Cached scale value. Used to detect changes in viewport. */ - private oldScale_ = 1; + private oldScale = 1; /** Cached viewport top value. Used to detect changes in viewport. */ - private oldTop_ = 0; + private oldTop = 0; /** Cached viewport left value. Used to detect changes in viewport. */ - private oldLeft_ = 0; + private oldLeft = 0; /** The workspace's trashcan (if any). */ trashcan: Trashcan|null = null; @@ -211,7 +211,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { /** * Fixed flyout providing blocks which may be dragged into this workspace. */ - private flyout_: IFlyout|null = null; + private flyout: IFlyout|null = null; /** * Category-based toolbox providing blocks which may be dragged into this @@ -227,16 +227,16 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { currentGesture_: TouchGesture|null = null; /** This workspace's surface for dragging blocks, if it exists. */ - private readonly blockDragSurface_: BlockDragSurfaceSvg|null = null; + private readonly blockDragSurface: BlockDragSurfaceSvg|null = null; /** This workspace's drag surface, if it exists. */ - private readonly workspaceDragSurface_: WorkspaceDragSurfaceSvg|null = null; + private readonly workspaceDragSurface: WorkspaceDragSurfaceSvg|null = null; /** * Whether to move workspace to the drag surface when it is dragged. * True if it should move, false if it should be translated directly. */ - private readonly useWorkspaceDragSurface_; + private readonly useWorkspaceDragSurface; /** * Whether the drag surface is actively in use. When true, calls to @@ -244,20 +244,20 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * workspace directly. * This is set to true in setupDragSurface and to false in resetDragSurface. */ - private isDragSurfaceActive_ = false; + private isDragSurfaceActive = false; /** * The first parent div with 'injectionDiv' in the name, or null if not set. * Access this with getInjectionDiv. */ - private injectionDiv_: Element|null = null; + private injectionDiv: Element|null = null; /** * Last known position of the page scroll. * This is used to determine whether we have recalculated screen coordinate * stuff since the page scrolled. */ - private lastRecordedPageScroll_: Coordinate|null = null; + private lastRecordedPageScroll: Coordinate|null = null; /** * Developers may define this function to add custom menu options to the @@ -279,25 +279,25 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { targetWorkspace: WorkspaceSvg|null = null; /** Inverted screen CTM, for use in mouseToSvg. */ - private inverseScreenCTM_: SVGMatrix|null = null; + private inverseScreenCTM: SVGMatrix|null = null; /** Inverted screen CTM is dirty, recalculate it. */ - private inverseScreenCTMDirty_ = true; - private metricsManager_: IMetricsManager; + private inverseScreenCTMDirty = true; + private metricsManager: IMetricsManager; /** @internal */ getMetrics: () => Metrics; /** @internal */ setMetrics: (p1: {x?: number, y?: number}) => void; - private readonly componentManager_: ComponentManager; + private readonly componentManager: ComponentManager; /** * List of currently highlighted blocks. Block highlighting is often used * to visually mark blocks currently being executed. */ - private readonly highlightedBlocks_: BlockSvg[] = []; - private audioManager_: WorkspaceAudio; - private grid_: Grid|null; - private markerManager_: MarkerManager; + private readonly highlightedBlocks: BlockSvg[] = []; + private audioManager: WorkspaceAudio; + private grid: Grid|null; + private markerManager: MarkerManager; /** * Map from function names to callbacks, for deciding what to do when a @@ -312,21 +312,21 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { */ private flyoutButtonCallbacks = new Map void>(); protected themeManager_: ThemeManager; - private readonly renderer_: Renderer; + private readonly renderer: Renderer; /** Cached parent SVG. */ - private cachedParentSvg_: SVGElement|null = null; + private cachedParentSvg: SVGElement|null = null; /** True if keyboard accessibility mode is on, false otherwise. */ keyboardAccessibilityMode = false; /** The list of top-level bounded elements on the workspace. */ - private topBoundedElements_: IBoundedElement[] = []; + private topBoundedElements: IBoundedElement[] = []; /** The recorded drag targets. */ - private dragTargetAreas_: Array<{component: IDragTarget, clientRect: Rect}> = + private dragTargetAreas: Array<{component: IDragTarget, clientRect: Rect}> = []; - private readonly cachedParentSvgSize_: Size; + private readonly cachedParentSvgSize: Size; // TODO(b/109816955): remove '!', see go/strict-prop-init-fix. svgGroup_!: SVGElement; // TODO(b/109816955): remove '!', see go/strict-prop-init-fix. @@ -350,43 +350,43 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { const MetricsManagerClass = registry.getClassFromOptions( registry.Type.METRICS_MANAGER, options, true); /** Object in charge of calculating metrics for the workspace. */ - this.metricsManager_ = new MetricsManagerClass!(this); + this.metricsManager = new MetricsManagerClass!(this); /** Method to get all the metrics that have to do with a workspace. */ this.getMetrics = options.getMetrics || - this.metricsManager_.getMetrics.bind(this.metricsManager_); + this.metricsManager.getMetrics.bind(this.metricsManager); /** Translates the workspace. */ this.setMetrics = options.setMetrics || WorkspaceSvg.setTopLevelWorkspaceMetrics_; - this.componentManager_ = new ComponentManager(); + this.componentManager = new ComponentManager(); this.connectionDBList = ConnectionDB.init(this.connectionChecker); if (opt_blockDragSurface) { - this.blockDragSurface_ = opt_blockDragSurface; + this.blockDragSurface = opt_blockDragSurface; } if (opt_wsDragSurface) { - this.workspaceDragSurface_ = opt_wsDragSurface; + this.workspaceDragSurface = opt_wsDragSurface; } - this.useWorkspaceDragSurface_ = !!this.workspaceDragSurface_; + this.useWorkspaceDragSurface = !!this.workspaceDragSurface; /** * Object in charge of loading, storing, and playing audio for a workspace. */ - this.audioManager_ = + this.audioManager = new WorkspaceAudio((options.parentWorkspace as WorkspaceSvg)); /** This workspace's grid object or null. */ - this.grid_ = this.options.gridPattern ? + this.grid = this.options.gridPattern ? new Grid(this.options.gridPattern, options.gridOptions) : null; /** Manager in charge of markers and cursors. */ - this.markerManager_ = new MarkerManager(this); + this.markerManager = new MarkerManager(this); if (Variables && Variables.flyoutCategory) { this.registerToolboxCategoryCallback( @@ -411,7 +411,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.themeManager_.subscribeWorkspace(this); /** The block renderer used for rendering blocks on this workspace. */ - this.renderer_ = blockRendering.init( + this.renderer = blockRendering.init( this.options.renderer || 'geras', this.getTheme(), this.options.rendererOverrides ?? undefined); @@ -419,7 +419,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * The cached size of the parent svg element. * Used to compute svg metrics. */ - this.cachedParentSvgSize_ = new Size(0, 0); + this.cachedParentSvgSize = new Size(0, 0); } /** @@ -428,7 +428,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @returns The marker manager. */ getMarkerManager(): MarkerManager { - return this.markerManager_; + return this.markerManager; } /** @@ -437,7 +437,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @returns The metrics manager. */ getMetricsManager(): IMetricsManager { - return this.metricsManager_; + return this.metricsManager; } /** @@ -447,9 +447,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @internal */ setMetricsManager(metricsManager: IMetricsManager) { - this.metricsManager_ = metricsManager; - this.getMetrics = - this.metricsManager_.getMetrics.bind(this.metricsManager_); + this.metricsManager = metricsManager; + this.getMetrics = this.metricsManager.getMetrics.bind(this.metricsManager); } /** @@ -458,7 +457,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @returns The component manager. */ getComponentManager(): ComponentManager { - return this.componentManager_; + return this.componentManager; } /** @@ -469,7 +468,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @internal */ setCursorSvg(cursorSvg: SVGElement) { - this.markerManager_.setCursorSvg(cursorSvg); + this.markerManager.setCursorSvg(cursorSvg); } /** @@ -480,7 +479,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @internal */ setMarkerSvg(markerSvg: SVGElement) { - this.markerManager_.setMarkerSvg(markerSvg); + this.markerManager.setMarkerSvg(markerSvg); } /** @@ -492,8 +491,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @internal */ getMarker(id: string): Marker|null { - if (this.markerManager_) { - return this.markerManager_.getMarker(id); + if (this.markerManager) { + return this.markerManager.getMarker(id); } return null; } @@ -504,8 +503,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @returns The cursor for the workspace. */ getCursor(): Cursor|null { - if (this.markerManager_) { - return this.markerManager_.getCursor(); + if (this.markerManager) { + return this.markerManager.getCursor(); } return null; } @@ -516,7 +515,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @returns The renderer attached to this workspace. */ getRenderer(): Renderer { - return this.renderer_; + return this.renderer; } /** @@ -556,7 +555,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { */ refreshTheme() { if (this.svgGroup_) { - this.renderer_.refreshDom(this.svgGroup_, this.getTheme()); + this.renderer.refreshDom(this.svgGroup_, this.getTheme()); } // Update all blocks in workspace that have a style name. @@ -606,20 +605,20 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { getInverseScreenCTM(): SVGMatrix|null { // Defer getting the screen CTM until we actually need it, this should // avoid forced reflows from any calls to updateInverseScreenCTM. - if (this.inverseScreenCTMDirty_) { + if (this.inverseScreenCTMDirty) { const ctm = this.getParentSvg().getScreenCTM(); if (ctm) { - this.inverseScreenCTM_ = (ctm).inverse(); - this.inverseScreenCTMDirty_ = false; + this.inverseScreenCTM = (ctm).inverse(); + this.inverseScreenCTMDirty = false; } } - return this.inverseScreenCTM_; + return this.inverseScreenCTM; } /** Mark the inverse screen CTM as dirty. */ updateInverseScreenCTM() { - this.inverseScreenCTMDirty_ = true; + this.inverseScreenCTMDirty = true; } /** @@ -671,7 +670,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @internal */ getCachedParentSvgSize(): Size { - const size = this.cachedParentSvgSize_; + const size = this.cachedParentSvgSize; return new Size(size.width, size.height); } @@ -700,18 +699,18 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { getInjectionDiv(): Element { // NB: it would be better to pass this in at createDom, but is more likely // to break existing uses of Blockly. - if (!this.injectionDiv_) { + if (!this.injectionDiv) { let element: Element = this.svgGroup_; while (element) { const classes = element.getAttribute('class') || ''; if ((' ' + classes + ' ').indexOf(' injectionDiv ') !== -1) { - this.injectionDiv_ = element; + this.injectionDiv = element; break; } element = element.parentNode as Element; } } - return this.injectionDiv_!; + return this.injectionDiv!; } /** @@ -730,7 +729,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @param handler Data that can be passed to eventHandling.unbind. */ setResizeHandlerWrapper(handler: browserEvents.Data) { - this.resizeHandlerWrapper_ = handler; + this.resizeHandlerWrapper = handler; } /** @@ -760,9 +759,9 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { {'height': '100%', 'width': '100%', 'class': opt_backgroundClass}, this.svgGroup_); - if (opt_backgroundClass === 'blocklyMainBackground' && this.grid_) { + if (opt_backgroundClass === 'blocklyMainBackground' && this.grid) { this.svgBackground_.style.fill = - 'url(#' + this.grid_.getPatternId() + ')'; + 'url(#' + this.grid.getPatternId() + ')'; } else { this.themeManager_.subscribe( this.svgBackground_, 'workspaceBackgroundColour', 'fill'); @@ -791,16 +790,16 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { registry.Type.TOOLBOX, this.options, true); this.toolbox_ = new ToolboxClass!(this); } - if (this.grid_) { - this.grid_.update(this.scale); + if (this.grid) { + this.grid.update(this.scale); } this.recordDragTargets(); const CursorClass = registry.getClassFromOptions(registry.Type.CURSOR, this.options); - CursorClass && this.markerManager_.setCursor(new CursorClass()); + CursorClass && this.markerManager.setCursor(new CursorClass()); - this.renderer_.createDom(this.svgGroup_, this.getTheme()); + this.renderer.createDom(this.svgGroup_, this.getTheme()); return this.svgGroup_; } @@ -823,9 +822,9 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.toolbox_.dispose(); this.toolbox_ = null; } - if (this.flyout_) { - this.flyout_.dispose(); - this.flyout_ = null; + if (this.flyout) { + this.flyout.dispose(); + this.flyout = null; } if (this.trashcan) { this.trashcan.dispose(); @@ -839,18 +838,18 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.zoomControls_.dispose(); } - if (this.audioManager_) { - this.audioManager_.dispose(); + if (this.audioManager) { + this.audioManager.dispose(); } - if (this.grid_) { - this.grid_ = null; + if (this.grid) { + this.grid = null; } - this.renderer_.dispose(); + this.renderer.dispose(); - if (this.markerManager_) { - this.markerManager_.dispose(); + if (this.markerManager) { + this.markerManager.dispose(); } super.dispose(); @@ -877,9 +876,9 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { dom.removeNode(parentSvg.parentNode); } } - if (this.resizeHandlerWrapper_) { - browserEvents.unbind(this.resizeHandlerWrapper_); - this.resizeHandlerWrapper_ = null; + if (this.resizeHandlerWrapper) { + browserEvents.unbind(this.resizeHandlerWrapper); + this.resizeHandlerWrapper = null; } } @@ -938,19 +937,19 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { if (this.horizontalLayout) { const HorizontalFlyout = registry.getClassFromOptions( registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX, this.options, true); - this.flyout_ = new HorizontalFlyout!(workspaceOptions); + this.flyout = new HorizontalFlyout!(workspaceOptions); } else { const VerticalFlyout = registry.getClassFromOptions( registry.Type.FLYOUTS_VERTICAL_TOOLBOX, this.options, true); - this.flyout_ = new VerticalFlyout!(workspaceOptions); + this.flyout = new VerticalFlyout!(workspaceOptions); } - this.flyout_.autoClose = false; - this.flyout_.getWorkspace().setVisible(true); + this.flyout.autoClose = false; + this.flyout.getWorkspace().setVisible(true); // Return the element so that callers can place it in their desired // spot in the DOM. For example, mutator flyouts do not go in the same // place as main workspace flyouts. - return this.flyout_.createDom(tagName); + return this.flyout.createDom(tagName); } /** @@ -963,8 +962,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @internal */ getFlyout(opt_own?: boolean): IFlyout|null { - if (this.flyout_ || opt_own) { - return this.flyout_; + if (this.flyout || opt_own) { + return this.flyout; } if (this.toolbox_) { return this.toolbox_.getFlyout(); @@ -999,7 +998,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @internal */ resizeContents() { - if (!this.resizesEnabled_ || !this.rendered) { + if (!this.resizesEnabled || !this.rendered) { return; } if (this.scrollbar) { @@ -1019,11 +1018,11 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { if (this.toolbox_) { this.toolbox_.position(); } - if (this.flyout_) { - this.flyout_.position(); + if (this.flyout) { + this.flyout.position(); } - const positionables = this.componentManager_.getComponents( + const positionables = this.componentManager.getComponents( ComponentManager.Capability.POSITIONABLE, true); const metrics = this.getMetricsManager().getUiMetrics(); const savedPositions = []; @@ -1050,8 +1049,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { updateScreenCalculationsIfScrolled() { /* eslint-disable indent */ const currScroll = svgMath.getDocumentScroll(); - if (!Coordinate.equals(this.lastRecordedPageScroll_, currScroll)) { - this.lastRecordedPageScroll_ = currScroll; + if (!Coordinate.equals(this.lastRecordedPageScroll, currScroll)) { + this.lastRecordedPageScroll = currScroll; this.updateScreenCalculations_(); } } @@ -1077,13 +1076,13 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { setCachedParentSvgSize(width: number|null, height: number|null) { const svg = this.getParentSvg(); if (width != null) { - this.cachedParentSvgSize_.width = width; + this.cachedParentSvgSize.width = width; // This is set to support the public (but deprecated) Blockly.svgSize // method. svg.setAttribute('data-cached-width', width.toString()); } if (height != null) { - this.cachedParentSvgSize_.height = height; + this.cachedParentSvgSize.height = height; // This is set to support the public (but deprecated) Blockly.svgSize // method. svg.setAttribute('data-cached-height', height.toString()); @@ -1107,17 +1106,17 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @returns SVG element. */ getParentSvg(): SVGSVGElement { - if (!this.cachedParentSvg_) { + if (!this.cachedParentSvg) { let element = this.svgGroup_; while (element) { if (element.tagName === 'svg') { - this.cachedParentSvg_ = element; + this.cachedParentSvg = element; break; } element = element.parentNode as SVGSVGElement; } } - return this.cachedParentSvg_ as SVGSVGElement; + return this.cachedParentSvg as SVGSVGElement; } /** @@ -1133,17 +1132,17 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { const scale = this.scale; const top = -this.scrollY; const left = -this.scrollX; - if (scale === this.oldScale_ && Math.abs(top - this.oldTop_) < 1 && - Math.abs(left - this.oldLeft_) < 1) { + if (scale === this.oldScale && Math.abs(top - this.oldTop) < 1 && + Math.abs(left - this.oldLeft) < 1) { // Ignore sub-pixel changes in top and left. Due to #4192 there are a lot // of negligible changes in viewport top/left. return; } const event = new (eventUtils.get(eventUtils.VIEWPORT_CHANGE))( - top, left, scale, this.id, this.oldScale_); - this.oldScale_ = scale; - this.oldTop_ = top; - this.oldLeft_ = left; + top, left, scale, this.id, this.oldScale); + this.oldScale = scale; + this.oldTop = top; + this.oldLeft = left; eventUtils.fire(event); } @@ -1156,8 +1155,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * the Blockly div. */ translate(x: number, y: number) { - if (this.useWorkspaceDragSurface_ && this.isDragSurfaceActive_) { - this.workspaceDragSurface_?.translateSurface(x, y); + if (this.useWorkspaceDragSurface && this.isDragSurfaceActive) { + this.workspaceDragSurface?.translateSurface(x, y); } else { const translation = 'translate(' + x + ',' + y + ') ' + 'scale(' + this.scale + ')'; @@ -1165,12 +1164,12 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.svgBubbleCanvas_.setAttribute('transform', translation); } // Now update the block drag surface if we're using one. - if (this.blockDragSurface_) { - this.blockDragSurface_.translateAndScaleGroup(x, y, this.scale); + if (this.blockDragSurface) { + this.blockDragSurface.translateAndScaleGroup(x, y, this.scale); } // And update the grid if we're using one. - if (this.grid_) { - this.grid_.moveTo(x, y); + if (this.grid) { + this.grid.moveTo(x, y); } this.maybeFireViewportChangeEvent(); @@ -1185,14 +1184,14 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { */ resetDragSurface() { // Don't do anything if we aren't using a drag surface. - if (!this.useWorkspaceDragSurface_) { + if (!this.useWorkspaceDragSurface) { return; } - this.isDragSurfaceActive_ = false; + this.isDragSurfaceActive = false; - const trans = this.workspaceDragSurface_!.getSurfaceTranslation(); - this.workspaceDragSurface_!.clearAndHide(this.svgGroup_); + const trans = this.workspaceDragSurface!.getSurfaceTranslation(); + this.workspaceDragSurface!.clearAndHide(this.svgGroup_); const translation = 'translate(' + trans.x + ',' + trans.y + ') ' + 'scale(' + this.scale + ')'; this.svgBlockCanvas_.setAttribute('transform', translation); @@ -1208,7 +1207,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { */ setupDragSurface() { // Don't do anything if we aren't using a drag surface. - if (!this.useWorkspaceDragSurface_) { + if (!this.useWorkspaceDragSurface) { return; } @@ -1217,11 +1216,11 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { // iframe) and then moves the mouse back in the workspace. On mobile and // ff, we get the mouseup outside the frame. On chrome and safari desktop we // do not. - if (this.isDragSurfaceActive_) { + if (this.isDragSurfaceActive) { return; } - this.isDragSurfaceActive_ = true; + this.isDragSurfaceActive = true; // Figure out where we want to put the canvas back. The order // in the is important because things are layered. @@ -1229,10 +1228,10 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { const width = parseInt(this.getParentSvg().getAttribute('width') ?? '0'); const height = parseInt(this.getParentSvg().getAttribute('height') ?? '0'); const coord = svgMath.getRelativeXY(this.getCanvas()); - this.workspaceDragSurface_!.setContentsAndShow( + this.workspaceDragSurface!.setContentsAndShow( this.getCanvas(), this.getBubbleCanvas(), previousElement, width, height, this.scale); - this.workspaceDragSurface_!.translateSurface(coord.x, coord.y); + this.workspaceDragSurface!.translateSurface(coord.x, coord.y); } /** @@ -1242,7 +1241,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @internal */ getBlockDragSurface(): BlockDragSurfaceSvg|null { - return this.blockDragSurface_; + return this.blockDragSurface; } /** @@ -1317,7 +1316,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { } } - this.markerManager_.updateMarkers(); + this.markerManager.updateMarkers(); } /** @@ -1333,10 +1332,10 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { highlightBlock(id: string|null, opt_state?: boolean) { if (opt_state === undefined) { // Unhighlight all blocks. - for (let i = 0, block; block = this.highlightedBlocks_[i]; i++) { + for (let i = 0, block; block = this.highlightedBlocks[i]; i++) { block.setHighlighted(false); } - this.highlightedBlocks_.length = 0; + this.highlightedBlocks.length = 0; } // Highlight/unhighlight the specified block. const block = id ? this.getBlockById(id) : null; @@ -1344,9 +1343,9 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { const state = opt_state === undefined || opt_state; // Using Set here would be great, but at the cost of IE10 support. if (!state) { - arrayUtils.removeElem(this.highlightedBlocks_, block); - } else if (this.highlightedBlocks_.indexOf(block) === -1) { - this.highlightedBlocks_.push(block); + arrayUtils.removeElem(this.highlightedBlocks, block); + } else if (this.highlightedBlocks.indexOf(block) === -1) { + this.highlightedBlocks.push(block); } block.setHighlighted(state); } @@ -1564,14 +1563,14 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { /** Make a list of all the delete areas for this workspace. */ recordDragTargets() { - const dragTargets = this.componentManager_.getComponents( + const dragTargets = this.componentManager.getComponents( ComponentManager.Capability.DRAG_TARGET, true); - this.dragTargetAreas_ = []; + this.dragTargetAreas = []; for (let i = 0, targetArea; targetArea = dragTargets[i]; i++) { const rect = targetArea.getClientRect(); if (rect) { - this.dragTargetAreas_.push({ + this.dragTargetAreas.push({ component: targetArea, clientRect: rect, }); @@ -1604,7 +1603,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * over. */ getDragTarget(e: Event): IDragTarget|null { - for (let i = 0, targetArea; targetArea = this.dragTargetAreas_[i]; i++) { + for (let i = 0, targetArea; targetArea = this.dragTargetAreas[i]; i++) { if (targetArea.clientRect.contains( (e as AnyDuringMigration).clientX, (e as AnyDuringMigration).clientY)) { @@ -1639,7 +1638,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { // Fix scale of mouse event. point.x /= this.scale; point.y /= this.scale; - this.dragDeltaXY_ = Coordinate.difference(xy, point); + this.dragDeltaXY = Coordinate.difference(xy, point); } /** @@ -1654,7 +1653,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { // Fix scale of mouse event. point.x /= this.scale; point.y /= this.scale; - return Coordinate.sum((this.dragDeltaXY_!), point); + return Coordinate.sum((this.dragDeltaXY!), point); } /** @@ -1829,7 +1828,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { block.snapToGrid(); cursorY = block.getRelativeToSurfaceXY().y + block.getHeightWidth().height + - this.renderer_.getConstants().MIN_BLOCK_HEIGHT; + this.renderer.getConstants().MIN_BLOCK_HEIGHT; } eventUtils.setGroup(false); this.setResizesEnabled(true); @@ -1882,11 +1881,11 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.options.languageTree = parsedToolboxDef; this.toolbox_.render(parsedToolboxDef); } else { - if (!this.flyout_) { + if (!this.flyout) { throw Error('Existing toolbox has categories. Can\'t change mode.'); } this.options.languageTree = parsedToolboxDef; - this.flyout_.show(parsedToolboxDef); + this.flyout.show(parsedToolboxDef); } } @@ -1997,7 +1996,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { const metrics = this.getMetrics(); let x; let y; - if (this.flyout_) { + if (this.flyout) { // If you want blocks in the center of the view (visible portion of the // workspace) to stay centered when the size of the view decreases (i.e. // when the size of the flyout increases) you need the center of the @@ -2031,19 +2030,19 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { if (!blocksWidth) { return; // Prevents zooming to infinity. } - if (this.flyout_) { + if (this.flyout) { // We have to add the flyout size to both the workspace size and the // block size because the blocks we want to resize include the blocks in // the flyout, and the area we want to fit them includes the portion of // the workspace that is behind the flyout. if (this.horizontalLayout) { - workspaceHeight += this.flyout_.getHeight(); + workspaceHeight += this.flyout.getHeight(); // Convert from pixels to workspace coordinates. - blocksHeight += this.flyout_.getHeight() / this.scale; + blocksHeight += this.flyout.getHeight() / this.scale; } else { - workspaceWidth += this.flyout_.getWidth(); + workspaceWidth += this.flyout.getWidth(); // Convert from pixels to workspace coordinates. - blocksWidth += this.flyout_.getWidth() / this.scale; + blocksWidth += this.flyout.getWidth() / this.scale; } } @@ -2180,8 +2179,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { flyout.reflow(); this.recordDragTargets(); } - if (this.grid_) { - this.grid_.update(this.scale); + if (this.grid) { + this.grid.update(this.scale); } // We call scroll instead of scrollbar.resize() so that we can center the @@ -2198,7 +2197,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.scroll(this.scrollX, this.scrollY); if (this.scrollbar) { - if (this.flyout_) { + if (this.flyout) { this.scrollbar.resizeView(metrics); } else { this.scrollbar.resizeContent(metrics); @@ -2344,7 +2343,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @param element Bounded element to add. */ addTopBoundedElement(element: IBoundedElement) { - this.topBoundedElements_.push(element); + this.topBoundedElements.push(element); } /** @@ -2353,7 +2352,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @param element Bounded element to remove. */ removeTopBoundedElement(element: IBoundedElement) { - arrayUtils.removeElem(this.topBoundedElements_, element); + arrayUtils.removeElem(this.topBoundedElements, element); } /** @@ -2362,7 +2361,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @returns The top-level bounded elements. */ getTopBoundedElements(): IBoundedElement[] { - return (new Array()).concat(this.topBoundedElements_); + return (new Array()).concat(this.topBoundedElements); } /** @@ -2374,8 +2373,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @param enabled Whether resizes should be enabled. */ setResizesEnabled(enabled: boolean) { - const reenabled = !this.resizesEnabled_ && enabled; - this.resizesEnabled_ = enabled; + const reenabled = !this.resizesEnabled && enabled; + this.resizesEnabled = enabled; if (reenabled) { // Newly enabled. Trigger a resize. this.resizeContents(); @@ -2389,7 +2388,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { override clear() { this.setResizesEnabled(false); super.clear(); - this.topBoundedElements_ = []; + this.topBoundedElements = []; this.setResizesEnabled(true); } @@ -2531,7 +2530,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @returns The audio manager for this workspace. */ getAudioManager(): WorkspaceAudio { - return this.audioManager_; + return this.audioManager; } /** @@ -2541,7 +2540,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @internal */ getGrid(): Grid|null { - return this.grid_; + return this.grid; } /** diff --git a/core/zoom_controls.ts b/core/zoom_controls.ts index d73ff47fd..6b4f6f4b2 100644 --- a/core/zoom_controls.ts +++ b/core/zoom_controls.ts @@ -47,19 +47,19 @@ export class ZoomControls implements IPositionable { * A handle to use to unbind the mouse down event handler for zoom reset * button. Opaque data returned from browserEvents.conditionalBind. */ - private onZoomResetWrapper_: browserEvents.Data|null = null; + private onZoomResetWrapper: browserEvents.Data|null = null; /** * A handle to use to unbind the mouse down event handler for zoom in * button. Opaque data returned from browserEvents.conditionalBind. */ - private onZoomInWrapper_: browserEvents.Data|null = null; + private onZoomInWrapper: browserEvents.Data|null = null; /** * A handle to use to unbind the mouse down event handler for zoom out * button. Opaque data returned from browserEvents.conditionalBind. */ - private onZoomOutWrapper_: browserEvents.Data|null = null; + private onZoomOutWrapper: browserEvents.Data|null = null; /** The zoom in svg element. */ private zoomInGroup: SVGGElement|null = null; @@ -71,36 +71,36 @@ export class ZoomControls implements IPositionable { private zoomResetGroup: SVGGElement|null = null; /** Width of the zoom controls. */ - private readonly WIDTH_ = 32; + private readonly WIDTH = 32; /** Height of each zoom control. */ - private readonly HEIGHT_ = 32; + private readonly HEIGHT = 32; /** Small spacing used between the zoom in and out control, in pixels. */ - private readonly SMALL_SPACING_ = 2; + private readonly SMALL_SPACING = 2; /** * Large spacing used between the zoom in and reset control, in pixels. */ - private readonly LARGE_SPACING_ = 11; + private readonly LARGE_SPACING = 11; /** Distance between zoom controls and bottom or top edge of workspace. */ - private readonly MARGIN_VERTICAL_ = 20; + private readonly MARGIN_VERTICAL = 20; /** Distance between zoom controls and right or left edge of workspace. */ - private readonly MARGIN_HORIZONTAL_ = 20; + private readonly MARGIN_HORIZONTAL = 20; /** The SVG group containing the zoom controls. */ private svgGroup: SVGElement|null = null; /** Left coordinate of the zoom controls. */ - private left_ = 0; + private left = 0; /** Top coordinate of the zoom controls. */ - private top_ = 0; + private top = 0; /** Whether this has been initialized. */ - private initialized_ = false; + private initialized = false; /** @param workspace The workspace to sit in. */ constructor(private readonly workspace: WorkspaceSvg) {} @@ -117,12 +117,12 @@ export class ZoomControls implements IPositionable { // instances on a page. Browser behaviour becomes undefined otherwise. // https://neil.fraser.name/news/2015/11/01/ const rnd = String(Math.random()).substring(2); - this.createZoomOutSvg_(rnd); - this.createZoomInSvg_(rnd); + this.createZoomOutSvg(rnd); + this.createZoomInSvg(rnd); if (this.workspace.isMovable()) { // If we zoom to the center and the workspace isn't movable we could // loose blocks at the edges of the workspace. - this.createZoomResetSvg_(rnd); + this.createZoomResetSvg(rnd); } return this.svgGroup; } @@ -134,7 +134,7 @@ export class ZoomControls implements IPositionable { weight: 2, capabilities: [ComponentManager.Capability.POSITIONABLE], }); - this.initialized_ = true; + this.initialized = true; } /** @@ -146,14 +146,14 @@ export class ZoomControls implements IPositionable { if (this.svgGroup) { dom.removeNode(this.svgGroup); } - if (this.onZoomResetWrapper_) { - browserEvents.unbind(this.onZoomResetWrapper_); + if (this.onZoomResetWrapper) { + browserEvents.unbind(this.onZoomResetWrapper); } - if (this.onZoomInWrapper_) { - browserEvents.unbind(this.onZoomInWrapper_); + if (this.onZoomInWrapper) { + browserEvents.unbind(this.onZoomInWrapper); } - if (this.onZoomOutWrapper_) { - browserEvents.unbind(this.onZoomOutWrapper_); + if (this.onZoomOutWrapper) { + browserEvents.unbind(this.onZoomOutWrapper); } } @@ -165,13 +165,13 @@ export class ZoomControls implements IPositionable { * ignored by other UI elements. */ getBoundingRectangle(): Rect|null { - let height = this.SMALL_SPACING_ + 2 * this.HEIGHT_; + let height = this.SMALL_SPACING + 2 * this.HEIGHT; if (this.zoomResetGroup) { - height += this.LARGE_SPACING_ + this.HEIGHT_; + height += this.LARGE_SPACING + this.HEIGHT; } - const bottom = this.top_ + height; - const right = this.left_ + this.WIDTH_; - return new Rect(this.top_, bottom, this.left_, right); + const bottom = this.top + height; + const right = this.left + this.WIDTH; + return new Rect(this.top, bottom, this.left, right); } /** @@ -184,52 +184,52 @@ export class ZoomControls implements IPositionable { */ position(metrics: UiMetrics, savedPositions: Rect[]) { // Not yet initialized. - if (!this.initialized_) { + if (!this.initialized) { return; } const cornerPosition = uiPosition.getCornerOppositeToolbox(this.workspace, metrics); - let height = this.SMALL_SPACING_ + 2 * this.HEIGHT_; + let height = this.SMALL_SPACING + 2 * this.HEIGHT; if (this.zoomResetGroup) { - height += this.LARGE_SPACING_ + this.HEIGHT_; + height += this.LARGE_SPACING + this.HEIGHT; } const startRect = uiPosition.getStartPositionRect( - cornerPosition, new Size(this.WIDTH_, height), this.MARGIN_HORIZONTAL_, - this.MARGIN_VERTICAL_, metrics, this.workspace); + cornerPosition, new Size(this.WIDTH, height), this.MARGIN_HORIZONTAL, + this.MARGIN_VERTICAL, metrics, this.workspace); const verticalPosition = cornerPosition.vertical; const bumpDirection = verticalPosition === uiPosition.verticalPosition.TOP ? uiPosition.bumpDirection.DOWN : uiPosition.bumpDirection.UP; const positionRect = uiPosition.bumpPositionRect( - startRect, this.MARGIN_VERTICAL_, bumpDirection, savedPositions); + startRect, this.MARGIN_VERTICAL, bumpDirection, savedPositions); if (verticalPosition === uiPosition.verticalPosition.TOP) { - const zoomInTranslateY = this.SMALL_SPACING_ + this.HEIGHT_; + const zoomInTranslateY = this.SMALL_SPACING + this.HEIGHT; this.zoomInGroup?.setAttribute( 'transform', 'translate(0, ' + zoomInTranslateY + ')'); if (this.zoomResetGroup) { const zoomResetTranslateY = - zoomInTranslateY + this.LARGE_SPACING_ + this.HEIGHT_; + zoomInTranslateY + this.LARGE_SPACING + this.HEIGHT; this.zoomResetGroup.setAttribute( 'transform', 'translate(0, ' + zoomResetTranslateY + ')'); } } else { const zoomInTranslateY = - this.zoomResetGroup ? this.LARGE_SPACING_ + this.HEIGHT_ : 0; + this.zoomResetGroup ? this.LARGE_SPACING + this.HEIGHT : 0; this.zoomInGroup?.setAttribute( 'transform', 'translate(0, ' + zoomInTranslateY + ')'); const zoomOutTranslateY = - zoomInTranslateY + this.SMALL_SPACING_ + this.HEIGHT_; + zoomInTranslateY + this.SMALL_SPACING + this.HEIGHT; this.zoomOutGroup?.setAttribute( 'transform', 'translate(0, ' + zoomOutTranslateY + ')'); } - this.top_ = positionRect.top; - this.left_ = positionRect.left; + this.top = positionRect.top; + this.left = positionRect.left; this.svgGroup?.setAttribute( - 'transform', 'translate(' + this.left_ + ',' + this.top_ + ')'); + 'transform', 'translate(' + this.left + ',' + this.top + ')'); } /** @@ -239,7 +239,7 @@ export class ZoomControls implements IPositionable { * These IDs must be unique in case there are multiple Blockly instances * on the same page. */ - private createZoomOutSvg_(rnd: string) { + private createZoomOutSvg(rnd: string) { /* This markup will be generated and added to the .svgGroup: @@ -275,8 +275,8 @@ export class ZoomControls implements IPositionable { this.workspace.options.pathToMedia + SPRITE.url); // Attach listener. - this.onZoomOutWrapper_ = browserEvents.conditionalBind( - this.zoomOutGroup, 'mousedown', null, this.zoom_.bind(this, -1)); + this.onZoomOutWrapper = browserEvents.conditionalBind( + this.zoomOutGroup, 'mousedown', null, this.zoom.bind(this, -1)); } /** @@ -286,7 +286,7 @@ export class ZoomControls implements IPositionable { * These IDs must be unique in case there are multiple Blockly instances * on the same page. */ - private createZoomInSvg_(rnd: string) { + private createZoomInSvg(rnd: string) { /* This markup will be generated and added to the .svgGroup: @@ -321,8 +321,8 @@ export class ZoomControls implements IPositionable { this.workspace.options.pathToMedia + SPRITE.url); // Attach listener. - this.onZoomInWrapper_ = browserEvents.conditionalBind( - this.zoomInGroup, 'mousedown', null, this.zoom_.bind(this, 1)); + this.onZoomInWrapper = browserEvents.conditionalBind( + this.zoomInGroup, 'mousedown', null, this.zoom.bind(this, 1)); } /** @@ -333,10 +333,10 @@ export class ZoomControls implements IPositionable { * positive amount values zoom in. * @param e A mouse down event. */ - private zoom_(amount: number, e: Event) { + private zoom(amount: number, e: Event) { this.workspace.markFocused(); this.workspace.zoomCenter(amount); - this.fireZoomEvent_(); + this.fireZoomEvent(); Touch.clearTouchIdentifier(); // Don't block future drags. e.stopPropagation(); // Don't start a workspace scroll. e.preventDefault(); // Stop double-clicking from selecting text. @@ -349,7 +349,7 @@ export class ZoomControls implements IPositionable { * These IDs must be unique in case there are multiple Blockly instances * on the same page. */ - private createZoomResetSvg_(rnd: string) { + private createZoomResetSvg(rnd: string) { /* This markup will be generated and added to the .svgGroup: @@ -379,8 +379,8 @@ export class ZoomControls implements IPositionable { this.workspace.options.pathToMedia + SPRITE.url); // Attach event listeners. - this.onZoomResetWrapper_ = browserEvents.conditionalBind( - this.zoomResetGroup, 'mousedown', null, this.resetZoom_.bind(this)); + this.onZoomResetWrapper = browserEvents.conditionalBind( + this.zoomResetGroup, 'mousedown', null, this.resetZoom.bind(this)); } /** @@ -388,7 +388,7 @@ export class ZoomControls implements IPositionable { * * @param e A mouse down event. */ - private resetZoom_(e: Event) { + private resetZoom(e: Event) { this.workspace.markFocused(); // zoom is passed amount and computes the new scale using the formula: @@ -406,14 +406,14 @@ export class ZoomControls implements IPositionable { this.workspace.scrollCenter(); setTimeout(this.workspace.endCanvasTransition.bind(this.workspace), 500); - this.fireZoomEvent_(); + this.fireZoomEvent(); Touch.clearTouchIdentifier(); // Don't block future drags. e.stopPropagation(); // Don't start a workspace scroll. e.preventDefault(); // Stop double-clicking from selecting text. } /** Fires a zoom control UI event. */ - private fireZoomEvent_() { + private fireZoomEvent() { const uiEvent = new (eventUtils.get(eventUtils.CLICK))( null, this.workspace.id, 'zoom_controls'); eventUtils.fire(uiEvent); diff --git a/tests/mocha/gesture_test.js b/tests/mocha/gesture_test.js index 01e0da18d..d181e620a 100644 --- a/tests/mocha/gesture_test.js +++ b/tests/mocha/gesture_test.js @@ -73,8 +73,8 @@ suite('Gesture', function() { }); test('Field click - Auto close flyout', function() { - const flyout = this.workspace.flyout_; - chai.assert.exists(this.workspace.flyout_, + const flyout = this.workspace.getFlyout(true); + chai.assert.exists(flyout, 'Precondition: missing flyout'); flyout.autoClose = true; @@ -83,8 +83,8 @@ suite('Gesture', function() { }); test('Field click - Always open flyout', function() { - const flyout = this.workspace.flyout_; - chai.assert.exists(this.workspace.flyout_, + const flyout = this.workspace.getFlyout(true); + chai.assert.exists(flyout, 'Precondition: missing flyout'); flyout.autoClose = false; From 9b81317d326ba63f063d333aa9f9d135620fad03 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Thu, 13 Oct 2022 01:30:17 +0200 Subject: [PATCH 24/69] chore: Remove blockly factory use of utils.dom.add/removeClass (#6534) * Remove usages of utils.dom.add/removeClass from Blockly Factory * Use template strings for error messages. (Random stuff found while working on something larger.) --- blocks/procedures.js | 3 +- core/block_svg.ts | 4 +- core/shortcut_registry.ts | 21 +- demos/blockfactory/factory.js | 33 +- demos/blockfactory/standard_categories.js | 556 +++++++++--------- .../workspacefactory/wfactory_controller.js | 2 +- .../workspacefactory/wfactory_view.js | 18 +- tests/mocha/blocks/variables_test.js | 4 +- tests/mocha/shortcut_registry_test.js | 10 +- 9 files changed, 325 insertions(+), 326 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index cdb272031..d6fd9ddcf 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -150,8 +150,7 @@ const PROCEDURE_DEF_COMMON = { this.argumentVarModels_.push(variable); } else { console.log( - 'Failed to create a variable with name ' + varName + - ', ignoring.'); + `Failed to create a variable named "${varName}", ignoring.`); } } } diff --git a/core/block_svg.ts b/core/block_svg.ts index b4bdd5dfa..f0054e8af 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -980,8 +980,8 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, } /** - * Updates the color of the block (and children) to match the current disabled - * state. + * Updates the colour of the block (and children) to match the current + * disabled state. * * @internal */ diff --git a/core/shortcut_registry.ts b/core/shortcut_registry.ts index 7bb7f035e..aba367887 100644 --- a/core/shortcut_registry.ts +++ b/core/shortcut_registry.ts @@ -56,8 +56,7 @@ export class ShortcutRegistry { register(shortcut: KeyboardShortcut, opt_allowOverrides?: boolean) { const registeredShortcut = this.shortcuts.get(shortcut.name); if (registeredShortcut && !opt_allowOverrides) { - throw new Error( - 'Shortcut with name "' + shortcut.name + '" already exists.'); + throw new Error(`Shortcut named "${shortcut.name}" already exists.`); } this.shortcuts.set(shortcut.name, shortcut); @@ -81,8 +80,7 @@ export class ShortcutRegistry { const shortcut = this.shortcuts.get(shortcutName); if (!shortcut) { - console.warn( - 'Keyboard shortcut with name "' + shortcutName + '" not found.'); + console.warn(`Keyboard shortcut named "${shortcutName}" not found.`); return false; } @@ -110,9 +108,8 @@ export class ShortcutRegistry { keyCode = String(keyCode); const shortcutNames = this.keyMap.get(keyCode); if (shortcutNames && !opt_allowCollision) { - throw new Error( - 'Shortcut with name "' + shortcutName + '" collides with shortcuts ' + - shortcutNames.toString()); + throw new Error(`Shortcut named "${ + shortcutName}" collides with shortcuts "${shortcutNames}"`); } else if (shortcutNames && opt_allowCollision) { shortcutNames.unshift(shortcutName); } else { @@ -138,9 +135,8 @@ export class ShortcutRegistry { if (!shortcutNames) { if (!opt_quiet) { - console.warn( - 'No keyboard shortcut with name "' + shortcutName + - '" registered with key code "' + keyCode + '"'); + console.warn(`No keyboard shortcut named "${ + shortcutName}" registered with key code "${keyCode}"`); } return false; } @@ -154,9 +150,8 @@ export class ShortcutRegistry { return true; } if (!opt_quiet) { - console.warn( - 'No keyboard shortcut with name "' + shortcutName + - '" registered with key code "' + keyCode + '"'); + console.warn(`No keyboard shortcut named "${ + shortcutName}" registered with key code "${keyCode}"`); } return false; } diff --git a/demos/blockfactory/factory.js b/demos/blockfactory/factory.js index 05832e2f1..6acdbee82 100644 --- a/demos/blockfactory/factory.js +++ b/demos/blockfactory/factory.js @@ -65,18 +65,25 @@ BlockFactory.updateBlocksFlagDelayed = false; */ BlockFactory.STARTER_BLOCK_XML_TEXT = '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '230' + - ''; + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '230' + + '' + + '' + + '' + + ''; /** * Change the language code format. @@ -328,4 +335,4 @@ BlockFactory.manualEdit = function() { BlockFactory.updateBlocksFlag = true; BlockFactory.updateBlocksFlagDelayed = true; BlockFactory.updateLanguage(); -} +}; diff --git a/demos/blockfactory/standard_categories.js b/demos/blockfactory/standard_categories.js index 45ee7e24b..eefadf2b9 100644 --- a/demos/blockfactory/standard_categories.js +++ b/demos/blockfactory/standard_categories.js @@ -29,13 +29,13 @@ StandardCategories.categoryMap['logic'] = StandardCategories.categoryMap['logic'].xml = Blockly.Xml.textToDom( '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + ''); StandardCategories.categoryMap['logic'].hue = 210; @@ -44,33 +44,33 @@ StandardCategories.categoryMap['loops'] = StandardCategories.categoryMap['loops'].xml = Blockly.Xml.textToDom( '' + - '' + - '' + - '' + - '10' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '1' + - '' + - '' + - '' + - '' + - '10' + - '' + - '' + - '' + - '' + - '1' + - '' + - '' + - '' + - '' + - '' + + '' + + '' + + '' + + '10' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '1' + + '' + + '' + + '' + + '' + + '10' + + '' + + '' + + '' + + '' + + '1' + + '' + + '' + + '' + + '' + + '' + ''); StandardCategories.categoryMap['loops'].hue = 120; @@ -79,91 +79,91 @@ StandardCategories.categoryMap['math'] = StandardCategories.categoryMap['math'].xml = Blockly.Xml.textToDom( '' + - '' + - '' + - '' + - '' + - '1' + - '' + - '' + - '' + - '' + - '1' + - '' + - '' + - '' + - '' + - '' + - '' + - '9' + - '' + - '' + - '' + - '' + - '' + - '' + - '45' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '0' + - '' + - '' + - '' + - '' + - '' + - '' + - '3.1' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '64' + - '' + - '' + - '' + - '' + - '10'+ - '' + - '' + - '' + - '' + - '' + - '' + - '50' + - '' + - '' + - '' + - '' + - '1' + - '' + - '' + - '' + - '' + - '100' + - '' + - '' + - '' + - '' + - '' + - '' + - '1' + - '' + - '' + - '' + - '' + - '100' + - '' + - '' + - '' + - '' + + '' + + '' + + '' + + '' + + '1' + + '' + + '' + + '' + + '' + + '1' + + '' + + '' + + '' + + '' + + '' + + '' + + '9' + + '' + + '' + + '' + + '' + + '' + + '' + + '45' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '0' + + '' + + '' + + '' + + '' + + '' + + '' + + '3.1' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '64' + + '' + + '' + + '' + + '' + + '10'+ + '' + + '' + + '' + + '' + + '' + + '' + + '50' + + '' + + '' + + '' + + '' + + '1' + + '' + + '' + + '' + + '' + + '100' + + '' + + '' + + '' + + '' + + '' + + '' + + '1' + + '' + + '' + + '' + + '' + + '100' + + '' + + '' + + '' + + '' + ''); StandardCategories.categoryMap['math'].hue = 230; @@ -172,81 +172,81 @@ StandardCategories.categoryMap['text'] = StandardCategories.categoryMap['text'].xml = Blockly.Xml.textToDom( '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - 'abc' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - 'text' + - '' + - '' + - '' + - '' + - 'abc' + - '' + - '' + - '' + - '' + - '' + - '' + - 'text' + - '' + - '' + - '' + - '' + - '' + - '' + - 'text' + - '' + - '' + - '' + - '' + - '' + - '' + - 'abc' + - '' + - '' + - '' + - '' + - '' + - '' + - 'abc' + - '' + - '' + - '' + - '' + - '' + - '' + - 'abc' + - '' + - '' + - '' + - '' + - '' + - '' + - 'abc' + - '' + - '' + - '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + 'abc' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + 'text' + + '' + + '' + + '' + + '' + + 'abc' + + '' + + '' + + '' + + '' + + '' + + '' + + 'text' + + '' + + '' + + '' + + '' + + '' + + '' + + 'text' + + '' + + '' + + '' + + '' + + '' + + '' + + 'abc' + + '' + + '' + + '' + + '' + + '' + + '' + + 'abc' + + '' + + '' + + '' + + '' + + '' + + '' + + 'abc' + + '' + + '' + + '' + + '' + + '' + + '' + + 'abc' + + '' + + '' + + '' + ''); StandardCategories.categoryMap['text'].hue = 160; @@ -255,55 +255,55 @@ StandardCategories.categoryMap['lists'] = StandardCategories.categoryMap['lists'].xml = Blockly.Xml.textToDom( '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '5' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - 'list' + - '' + - '' + - '' + - '' + - '' + - '' + - 'list' + - '' + - '' + - '' + - '' + - '' + - '' + - 'list' + - '' + - '' + - '' + - '' + - '' + - '' + - 'list' + - '' + - '' + - '' + - '' + - '' + - '' + - ',' + - '' + - '' + - '' + - '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '5' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + 'list' + + '' + + '' + + '' + + '' + + '' + + '' + + 'list' + + '' + + '' + + '' + + '' + + '' + + '' + + 'list' + + '' + + '' + + '' + + '' + + '' + + '' + + 'list' + + '' + + '' + + '' + + '' + + '' + + '' + + ',' + + '' + + '' + + '' + + '' + ''); StandardCategories.categoryMap['lists'].hue = 260; @@ -312,42 +312,42 @@ StandardCategories.categoryMap['colour'] = StandardCategories.categoryMap['colour'].xml = Blockly.Xml.textToDom( '' + - '' + - '' + - '' + - '' + - '' + - '100' + + '' + + '' + + '' + + '' + + '' + + '100' + + '' + + '' + + '' + + '' + + '50' + + '' + + '' + + '' + + '' + + '0' + + '' + + '' + + '' + + '' + + '' + + '' + + '#ff0000' + + '' + + '' + + '' + + '' + + '#3333ff' + + '' + + '' + + '' + + '' + + '0.5' + '' + - '' + - '' + - '' + - '50' + - '' + - '' + - '' + - '' + - '0' + - '' + - '' + - '' + - '' + - '' + - '' + - '#ff0000' + - '' + - '' + - '' + - '' + - '#3333ff' + - '' + - '' + - '' + - '' + - '0.5' + - '' + - '' + - '' + + '' + + '' + ''); StandardCategories.categoryMap['colour'].hue = 20; diff --git a/demos/blockfactory/workspacefactory/wfactory_controller.js b/demos/blockfactory/workspacefactory/wfactory_controller.js index 149d91352..73a2a4b41 100644 --- a/demos/blockfactory/workspacefactory/wfactory_controller.js +++ b/demos/blockfactory/workspacefactory/wfactory_controller.js @@ -606,7 +606,7 @@ WorkspaceFactoryController.prototype.loadCategoryByName = function(name) { // Update the copy in the view. var tab = this.view.addCategoryRow(copy.name, copy.id); this.addClickToSwitch(tab, copy.id); - // Color the category tab in the view. + // Colour the category tab in the view. if (copy.colour) { this.view.setBorderColour(copy.id, copy.colour); } diff --git a/demos/blockfactory/workspacefactory/wfactory_view.js b/demos/blockfactory/workspacefactory/wfactory_view.js index 774bbb8a3..f98b13530 100644 --- a/demos/blockfactory/workspacefactory/wfactory_view.js +++ b/demos/blockfactory/workspacefactory/wfactory_view.js @@ -10,7 +10,6 @@ * Depends on WorkspaceFactoryController (for adding mouse listeners). Tabs for * each category are stored in tab map, which associates a unique ID for a * category with a particular tab. - * */ @@ -122,7 +121,7 @@ WorkspaceFactoryView.prototype.createCategoryIdName = function(name) { WorkspaceFactoryView.prototype.setCategoryTabSelection = function(id, selected) { if (!this.tabMap[id]) { - return; // Exit if tab does not exist. + return; // Exit if tab does not exist. } this.tabMap[id].className = selected ? 'tabon' : 'taboff'; }; @@ -144,8 +143,8 @@ WorkspaceFactoryView.prototype.bindClick = function(el, func) { /** * Creates a file and downloads it. In some browsers downloads, and in other * browsers, opens new tab with contents. - * @param {string} filename Name of file - * @param {!Blob} data Blob containing contents to download + * @param {string} filename Name of file. + * @param {!Blob} data Blob containing contents to download. */ WorkspaceFactoryView.prototype.createAndDownloadFile = function(filename, data) { @@ -164,8 +163,8 @@ WorkspaceFactoryView.prototype.createAndDownloadFile = /** * Given the ID of a certain category, updates the corresponding tab in * the DOM to show a new name. - * @param {string} newName Name of string to be displayed on tab - * @param {string} id ID of category to be updated + * @param {string} newName Name of string to be displayed on tab. + * @param {string} id ID of category to be updated. */ WorkspaceFactoryView.prototype.updateCategoryName = function(newName, id) { this.tabMap[id].textContent = newName; @@ -311,7 +310,7 @@ WorkspaceFactoryView.prototype.markShadowBlocks = function(blocks) { */ WorkspaceFactoryView.prototype.markShadowBlock = function(block) { // Add Blockly CSS for user-generated shadow blocks. - Blockly.utils.dom.addClass(block.svgGroup_, 'shadowBlock'); + block.getSvgRoot().classList.add('shadowBlock'); // If not a valid shadow block, add a warning message. if (!block.getSurroundParent()) { block.setWarningText('Shadow blocks must be nested inside' + @@ -329,7 +328,7 @@ WorkspaceFactoryView.prototype.markShadowBlock = function(block) { */ WorkspaceFactoryView.prototype.unmarkShadowBlock = function(block) { // Remove Blockly CSS for user-generated shadow blocks. - Blockly.utils.dom.removeClass(block.svgGroup_, 'shadowBlock'); + block.getSvgRoot().classList.remove('shadowBlock'); }; /** @@ -387,8 +386,7 @@ WorkspaceFactoryView.prototype.setBaseOptions = function() { // Check infinite blocks and hide suboption. document.getElementById('option_infiniteBlocks_checkbox').checked = true; - document.getElementById('maxBlockNumber_option').style.display = - 'none'; + document.getElementById('maxBlockNumber_option').style.display = 'none'; // Uncheck grid and zoom options and hide suboptions. document.getElementById('option_grid_checkbox').checked = false; diff --git a/tests/mocha/blocks/variables_test.js b/tests/mocha/blocks/variables_test.js index 737471220..7de2b7368 100644 --- a/tests/mocha/blocks/variables_test.js +++ b/tests/mocha/blocks/variables_test.js @@ -92,7 +92,7 @@ suite('Variables', function() { }); suite('getVariable', function() { - test('By id', function() { + test('By ID', function() { const var1 = this.workspace.createVariable('name1', 'type1', 'id1'); const var2 = this.workspace.createVariable('name2', 'type1', 'id2'); const var3 = this.workspace.createVariable('name3', 'type2', 'id3'); @@ -122,7 +122,7 @@ suite('Variables', function() { chai.assert.equal(var3, result3); }); - test('Bad id with name and type fallback', function() { + test('Bad ID with name and type fallback', function() { const var1 = this.workspace.createVariable('name1', 'type1', 'id1'); const var2 = this.workspace.createVariable('name2', 'type1', 'id2'); const var3 = this.workspace.createVariable('name3', 'type2', 'id3'); diff --git a/tests/mocha/shortcut_registry_test.js b/tests/mocha/shortcut_registry_test.js index dea01e22a..916dc53fd 100644 --- a/tests/mocha/shortcut_registry_test.js +++ b/tests/mocha/shortcut_registry_test.js @@ -39,7 +39,7 @@ suite('Keyboard Shortcut Registry Test', function() { }; chai.assert.throws( shouldThrow, Error, - 'Shortcut with name "test_shortcut" already exists.'); + 'Shortcut named "test_shortcut" already exists.'); }); test( 'Registers shortcut with same name opt_allowOverrides=true', @@ -104,7 +104,7 @@ suite('Keyboard Shortcut Registry Test', function() { const registry = this.registry; chai.assert.isFalse(registry.unregister('test')); - sinon.assert.calledOnceWithExactly(consoleStub, 'Keyboard shortcut with name "test" not found.'); + sinon.assert.calledOnceWithExactly(consoleStub, 'Keyboard shortcut named "test" not found.'); }); test('Unregistering a shortcut with key mappings', function() { const testShortcut = {'name': 'test_shortcut'}; @@ -173,7 +173,7 @@ suite('Keyboard Shortcut Registry Test', function() { }; chai.assert.throws( shouldThrow, Error, - 'Shortcut with name "test_shortcut" collides with shortcuts test_shortcut_2'); + 'Shortcut named "test_shortcut" collides with shortcuts "test_shortcut_2"'); }); }); @@ -216,7 +216,7 @@ suite('Keyboard Shortcut Registry Test', function() { chai.assert.isFalse(isRemoved); sinon.assert.calledOnceWithExactly( consoleStub, - 'No keyboard shortcut with name "test_shortcut" registered with key code "keyCode"'); + 'No keyboard shortcut named "test_shortcut" registered with key code "keyCode"'); }); test( 'Removes a key map that does not exist from empty key mapping opt_quiet=false', @@ -229,7 +229,7 @@ suite('Keyboard Shortcut Registry Test', function() { chai.assert.isFalse(isRemoved); sinon.assert.calledOnceWithExactly( consoleStub, - 'No keyboard shortcut with name "test_shortcut" registered with key code "keyCode"'); + 'No keyboard shortcut named "test_shortcut" registered with key code "keyCode"'); }); }); From 7147813693b5187d257c72800e9ee6b430d6f938 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 13 Oct 2022 10:59:04 -0700 Subject: [PATCH 25/69] fix: parent blocks not bumping neighbours (#6538) * fix: parent blocks not bumping neighbours * chore: add more comments --- core/block_svg.ts | 65 +++++++++++++++++++------------------ core/rendered_connection.ts | 2 +- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/core/block_svg.ts b/core/block_svg.ts index f0054e8af..615e568c4 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -1535,45 +1535,46 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, } /** - * Bump unconnected blocks out of alignment. Two blocks which aren't actually - * connected should not coincidentally line up on screen. + * Bumps unconnected blocks out of alignment. + * + * Two blocks which aren't actually connected should not coincidentally line + * up on screen, because that creates confusion for end-users. */ override bumpNeighbours() { - if (this.isDeadOrDying()) { + this.getRootBlock().bumpNeighboursInternal(); + } + + /** + * Bumps unconnected blocks out of alignment. + */ + private bumpNeighboursInternal() { + const root = this.getRootBlock(); + if (this.isDeadOrDying() || this.workspace.isDragging() || + root.isInFlyout) { return; } - if (this.workspace.isDragging()) { - return; + + function neighbourIsInStack(neighbour: RenderedConnection) { + return neighbour.getSourceBlock().getRootBlock() === root; } - const rootBlock = this.getRootBlock(); - if (rootBlock.isInFlyout) { - return; - } - // Don't move blocks around in a flyout. - // Loop through every connection on this block. - const myConnections = this.getConnections_(false); - for (let i = 0, connection; connection = myConnections[i]; i++) { - const renderedConn = (connection); - // Spider down from this block bumping all sub-blocks. - if (renderedConn.isConnected() && renderedConn.isSuperior()) { - renderedConn.targetBlock()!.bumpNeighbours(); + + for (const conn of this.getConnections_(false)) { + if (conn.isSuperior()) { + // Recurse down the block stack. + conn.targetBlock()?.bumpNeighboursInternal(); } - const neighbours = connection.neighbours(config.snapRadius); - for (let j = 0, otherConnection; otherConnection = neighbours[j]; j++) { - const renderedOther = otherConnection as RenderedConnection; - // If both connections are connected, that's probably fine. But if - // either one of them is unconnected, then there could be confusion. - if (!renderedConn.isConnected() || !renderedOther.isConnected()) { - // Only bump blocks if they are from different tree structures. - if (renderedOther.getSourceBlock().getRootBlock() !== rootBlock) { - // Always bump the inferior block. - if (renderedConn.isSuperior()) { - renderedOther.bumpAwayFrom(renderedConn); - } else { - renderedConn.bumpAwayFrom(renderedOther); - } - } + for (const neighbour of conn.neighbours(config.snapRadius)) { + // Don't bump away from things that are in our stack. + if (neighbourIsInStack(neighbour)) continue; + // If both connections are connected, that's fine. + if (conn.isConnected() && neighbour.isConnected()) continue; + + // Always bump the inferior connection. + if (conn.isSuperior()) { + neighbour.bumpAwayFrom(conn); + } else { + conn.bumpAwayFrom(neighbour); } } } diff --git a/core/rendered_connection.ts b/core/rendered_connection.ts index 7330ff9da..82af1b1b1 100644 --- a/core/rendered_connection.ts +++ b/core/rendered_connection.ts @@ -499,7 +499,7 @@ export class RenderedConnection extends Connection { * @returns List of connections. * @internal */ - override neighbours(maxLimit: number): Connection[] { + override neighbours(maxLimit: number): RenderedConnection[] { return this.dbOpposite_.getNeighbours(this, maxLimit); } From 1162a660a0cfe9ff2acdbed5ee66246d3bd5beb2 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 13 Oct 2022 11:21:37 -0700 Subject: [PATCH 26/69] feat: add interface definitions for procedure stuff (#6488) * feat: add interface definitions for procedure stuff * fix: signature of insertParameter * fix: remove declareModuleId * fix: remove variable-ness from the parameter interface * chore: types -> type * chore: PR comments * fix: update interfaces to use this return type * chore: format --- core/interfaces/i_parameter_model.ts | 35 ++++++++++++++ core/interfaces/i_procedure_model.ts | 70 ++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 core/interfaces/i_parameter_model.ts create mode 100644 core/interfaces/i_procedure_model.ts diff --git a/core/interfaces/i_parameter_model.ts b/core/interfaces/i_parameter_model.ts new file mode 100644 index 000000000..00d117240 --- /dev/null +++ b/core/interfaces/i_parameter_model.ts @@ -0,0 +1,35 @@ +/** + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * The interface for the data model of a procedure parameter. + * + * @namespace Blockly.IParameterModel + */ + + +/** + * A data model for a procedure. + */ +export interface IParameterModel { + /** + * Sets the name of this parameter to the given name. + */ + setName(name: string): this; + + /** + * Sets the types of this parameter to the given type. + */ + setTypes(types: string[]): this; + + /** + * Returns the unique language-neutral ID for the parameter. + * + * This represents the identify of the variable model which does not change + * over time. + */ + getId(): string; +} diff --git a/core/interfaces/i_procedure_model.ts b/core/interfaces/i_procedure_model.ts new file mode 100644 index 000000000..1950fff76 --- /dev/null +++ b/core/interfaces/i_procedure_model.ts @@ -0,0 +1,70 @@ +/** + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * The interface for the data model of a procedure. + * + * @namespace Blockly.IProcedureModel + */ + +import {IParameterModel} from './i_parameter_model.js'; + + +/** + * A data model for a procedure. + */ +export interface IProcedureModel { + /** Sets the human-readable name of the procedure. */ + setName(name: string): this; + + /** + * Inserts a parameter into the list of parameters. + * + * To move a parameter, first delete it, and then re-insert. + */ + insertParameter(parameterModel: IParameterModel, index: number): this; + + /** Removes the parameter at the given index from the parameter list. */ + deleteParameter(index: number): this; + + /** + * Sets the return type(s) of the procedure. + * + * Pass null to represent a procedure that does not return. + */ + setReturnTypes(types: string[]|null): this; + + /** + * Sets whether this procedure is enabled/disabled. If a procedure is disabled + * all procedure caller blocks should be disabled as well. + */ + setEnabled(enabled: boolean): this; + + /** Returns the unique language-neutral ID for the procedure. */ + getId(): string; + + /** Returns the human-readable name of the procedure. */ + getName(): string; + + /** Returns the parameter at the given index in the parameter list. */ + getParameter(index: number): IParameterModel; + + /** Returns an array of all of the parameters in the parameter list. */ + getParameters(): IParameterModel[]; + + /** + * Returns the return type(s) of the procedure. + * + * Null represents a procedure that does not return a value. + */ + getReturnTypes(): string[]|null; + + /** + * Returns whether the procedure is enabled/disabled. If a procedure is + * disabled, all procedure caller blocks should be disabled as well. + */ + getEnabled(): boolean; +} From a7247af7c3e2a32b037079d01a5a01524c79b0db Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 13 Oct 2022 15:23:10 -0700 Subject: [PATCH 27/69] feat: add basic observable implementations of procedure interfaces (#6489) * feat: implement basic observable procedure model * feat: implement basic observable procedure model * feat: implement basic observable parameter model * feat: implement basic observable procedure map * chore: format * chore: refactor parameter model * chore: update the observable procedure model to match interface * chore: update the observable parameter model to match interface * chore: update the observable procedure map * chore: update concrete implementations to use this return type * chore: format * chore: remove legacy module IDs * chore: fix typo --- core/procedures/observable_parameter_model.ts | 59 ++++++++++ core/procedures/observable_procedure_map.ts | 50 +++++++++ core/procedures/observable_procedure_model.ts | 101 ++++++++++++++++++ 3 files changed, 210 insertions(+) create mode 100644 core/procedures/observable_parameter_model.ts create mode 100644 core/procedures/observable_procedure_map.ts create mode 100644 core/procedures/observable_procedure_model.ts diff --git a/core/procedures/observable_parameter_model.ts b/core/procedures/observable_parameter_model.ts new file mode 100644 index 000000000..4c74a0505 --- /dev/null +++ b/core/procedures/observable_parameter_model.ts @@ -0,0 +1,59 @@ +/** + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import type {IParameterModel} from '../interfaces/i_parameter_model.js'; +import {genUid} from '../utils/idgenerator.js'; +import type {VariableModel} from '../variable_model.js'; +import type {Workspace} from '../workspace.js'; + + +export class ObservableParameterModel implements IParameterModel { + private id: string; + private variable: VariableModel; + + constructor( + private readonly workspace: Workspace, name: string, id?: string) { + this.id = id ?? genUid(); + this.variable = workspace.createVariable(name); + } + + /** + * Sets the name of this parameter to the given name. + */ + setName(name: string): this { + if (name == this.variable.name) return this; + this.variable = + this.workspace.getVariable(name) ?? this.workspace.createVariable(name); + return this; + } + + /** + * Unimplemented. The built-in ParameterModel does not support typing. + * If you want your procedure blocks to have typed parameters, you need to + * implement your own ParameterModel. + */ + setTypes(_types: string[]): this { + console.warn( + 'The built-in ParameterModel does not support typing. You need to ' + + 'implement your own custom ParameterModel.'); + return this; + } + + /** + * Returns the unique language-neutral ID for the parameter. + * + * This represents the identify of the variable model which does not change + * over time. + */ + getId(): string { + return this.id; + } + + /** Returns the variable model associated with the parameter model. */ + getVariableModel(): VariableModel { + return this.variable; + } +} diff --git a/core/procedures/observable_procedure_map.ts b/core/procedures/observable_procedure_map.ts new file mode 100644 index 000000000..db5edfe68 --- /dev/null +++ b/core/procedures/observable_procedure_map.ts @@ -0,0 +1,50 @@ +/** + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import type {IProcedureModel} from '../interfaces/i_procedure_model.js'; +import type {Workspace} from '../workspace.js'; + + +export class ObservableProcedureMap extends Map { + constructor(private readonly workspace: Workspace) { + super(); + } + + /** + * Adds the given procedure model to the procedure map. + */ + override set(id: string, proc: IProcedureModel): this { + // TODO(#6156): Fire events. + super.set(id, proc); + return this; + } + + /** + * Deletes the ProcedureModel with the given ID from the procedure map (if it + * exists). + */ + override delete(id: string): boolean { + // TODO(#6156): Fire events. + return super.delete(id); + } + + /** + * Removes all ProcedureModels from the procedure map. + */ + override clear() { + // TODO(#6156): Fire events. + super.clear(); + } + + /** + * Adds the given ProcedureModel to the map of procedure models, so that + * blocks can find it. + */ + add(proc: IProcedureModel): this { + // TODO(#6156): Fire events. + return this.set(proc.getId(), proc); + } +} diff --git a/core/procedures/observable_procedure_model.ts b/core/procedures/observable_procedure_model.ts new file mode 100644 index 000000000..335667ab9 --- /dev/null +++ b/core/procedures/observable_procedure_model.ts @@ -0,0 +1,101 @@ +/** + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import type {IParameterModel} from '../interfaces/i_parameter_model.js'; +import type {IProcedureModel} from '../interfaces/i_procedure_model.js'; +import type {Workspace} from '../workspace.js'; +import {genUid} from '../utils/idgenerator.js'; + + +export class ObservableProcedureModel implements IProcedureModel { + private id: string; + private name = ''; + private parameters: IParameterModel[] = []; + private returnTypes: string[]|null = null; + private enabled = true; + + constructor(private readonly workspace: Workspace, id?: string) { + this.id = id ?? genUid(); + } + + /** Sets the human-readable name of the procedure. */ + setName(name: string): this { + this.name = name; + return this; + } + + /** + * Inserts a parameter into the list of parameters. + * + * To move a parameter, first delete it, and then re-insert. + */ + insertParameter(parameterModel: IParameterModel, index: number): this { + this.parameters.splice(index, 0, parameterModel); + return this; + } + + /** Removes the parameter at the given index from the parameter list. */ + deleteParameter(index: number): this { + this.parameters.splice(index, 1); + return this; + } + + /** + * Sets the return type(s) of the procedure. + * + * Pass null to represent a procedure that does not return. + */ + setReturnTypes(types: string[]|null): this { + this.returnTypes = types; + return this; + } + + /** + * Sets whether this procedure is enabled/disabled. If a procedure is disabled + * all procedure caller blocks should be disabled as well. + */ + setEnabled(enabled: boolean): this { + this.enabled = enabled; + return this; + } + + /** Returns the unique language-neutral ID for the procedure. */ + getId(): string { + return this.id; + } + + /** Returns the human-readable name of the procedure. */ + getName(): string { + return this.name; + } + + /** Returns the parameter at the given index in the parameter list. */ + getParameter(index: number): IParameterModel { + return this.parameters[index]; + } + + /** Returns an array of all of the parameters in the parameter list. */ + getParameters(): IParameterModel[] { + return [...this.parameters]; + } + + /** + * Returns the return type of the procedure. + * + * Null represents a procedure that does not return a value. + */ + getReturnTypes(): string[]|null { + return this.returnTypes; + } + + /** + * Returns whether the procedure is enabled/disabled. If a procedure is + * disabled, all procedure caller blocks should be disabled as well. + */ + getEnabled(): boolean { + return this.enabled; + } +} From ad22de1e530f53881a6ae64dfc74bf23bc475e32 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 13 Oct 2022 15:26:00 -0700 Subject: [PATCH 28/69] test: add shared procedures playground (#6485) * test: add shared procedures playground * test: use json toolbox in testplayground * chore: delete unnecessary toolbox def --- tests/playgrounds/shared_procedures.html | 179 +++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 tests/playgrounds/shared_procedures.html diff --git a/tests/playgrounds/shared_procedures.html b/tests/playgrounds/shared_procedures.html new file mode 100644 index 000000000..63a1a9054 --- /dev/null +++ b/tests/playgrounds/shared_procedures.html @@ -0,0 +1,179 @@ + + + + +Shared Procedures Playground + + + + + + + + + +

Shared Procedures Playground

+ +
+
+ + From caf91c82a6334c566024c079ea57471c03045942 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Thu, 13 Oct 2022 18:05:42 -0700 Subject: [PATCH 29/69] fix: fix pinch to zoom (#6544) * fix: fix pinch to zoom * chore: format --- core/touch.ts | 14 +++--- tests/mocha/index.html | 1 + tests/mocha/touch_test.js | 95 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 tests/mocha/touch_test.js diff --git a/core/touch.ts b/core/touch.ts index 093a8f7ab..2b621bac6 100644 --- a/core/touch.ts +++ b/core/touch.ts @@ -158,20 +158,20 @@ export function shouldHandleEvent(e: Event|PseudoEvent): boolean { * Get the touch identifier from the given event. If it was a mouse event, the * identifier is the string 'mouse'. * - * @param e Mouse event or touch event. - * @returns The touch identifier from the first changed touch, if defined. - * Otherwise 'mouse'. + * @param e Pointer event, mouse event, or touch event. + * @returns The pointerId, or touch identifier from the first changed touch, if + * defined. Otherwise 'mouse'. * @alias Blockly.Touch.getTouchIdentifierFromEvent */ export function getTouchIdentifierFromEvent(e: Event|PseudoEvent): string { - if (e instanceof MouseEvent) { - return 'mouse'; - } - if (e instanceof PointerEvent) { return String(e.pointerId); } + if (e instanceof MouseEvent) { + return 'mouse'; + } + /** * TODO(#6097): Fix types. This is a catch-all for everything but mouse * and pointer events. diff --git a/tests/mocha/index.html b/tests/mocha/index.html index 561454f2d..2706bafc7 100644 --- a/tests/mocha/index.html +++ b/tests/mocha/index.html @@ -97,6 +97,7 @@ 'Blockly.test.registry', 'Blockly.test.serialization', 'Blockly.test.shortcutRegistry', + 'Blockly.test.touch', 'Blockly.test.theme', 'Blockly.test.toolbox', 'Blockly.test.tooltip', diff --git a/tests/mocha/touch_test.js b/tests/mocha/touch_test.js new file mode 100644 index 000000000..5c6eab803 --- /dev/null +++ b/tests/mocha/touch_test.js @@ -0,0 +1,95 @@ +/** + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + + goog.declareModuleId('Blockly.test.touch'); + + import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js'; + + suite('Touch', function() { + setup(function() { + sharedTestSetup.call(this); + }); + + teardown(function() { + Blockly.Touch.clearTouchIdentifier(); + sharedTestTeardown.call(this); + }); + + suite('shouldHandleTouch', function() { + test('handles mousedown event', function() { + const mouseEvent = new MouseEvent('mousedown'); + chai.assert.isTrue(Blockly.Touch.shouldHandleEvent(mouseEvent)); + }); + + test('handles multiple mousedown events', function() { + const mouseEvent1 = new MouseEvent('mousedown'); + const mouseEvent2 = new MouseEvent('mousedown'); + Blockly.Touch.shouldHandleEvent(mouseEvent1); + chai.assert.isTrue(Blockly.Touch.shouldHandleEvent(mouseEvent2)); + }); + + test('does not handle mouseup if not tracking touch', function() { + const mouseEvent = new MouseEvent('mouseup'); + chai.assert.isFalse(Blockly.Touch.shouldHandleEvent(mouseEvent)); + }); + + test('handles mouseup if already tracking a touch', function() { + const mousedown = new MouseEvent('mousedown'); + const mouseup = new MouseEvent('mouseup'); + // Register the mousedown event first + Blockly.Touch.shouldHandleEvent(mousedown); + chai.assert.isTrue(Blockly.Touch.shouldHandleEvent(mouseup)); + }); + + test('handles pointerdown if this is a new touch', function() { + const pointerdown = new PointerEvent('pointerdown', {pointerId: 1, pointerType: 'touch'}); + chai.assert.isTrue(Blockly.Touch.shouldHandleEvent(pointerdown)); + }); + + test('does not handle pointerdown if part of a different touch', function() { + const pointerdown1 = new PointerEvent('pointerdown', {pointerId: 1, pointerType: 'touch'}); + const pointerdown2 = new PointerEvent('pointerdown', {pointerId: 2, pointerType: 'touch'}); + Blockly.Touch.shouldHandleEvent(pointerdown1); + chai.assert.isFalse(Blockly.Touch.shouldHandleEvent(pointerdown2)); + }); + + test('does not handle pointerdown after a mousedown', function() { + const mouseEvent = new MouseEvent('mousedown'); + const pointerdown = new PointerEvent('pointerdown', {pointerId: 1, pointerType: 'touch'}); + Blockly.Touch.shouldHandleEvent(mouseEvent); + chai.assert.isFalse(Blockly.Touch.shouldHandleEvent(pointerdown)); + }); + + test('does not handle pointerup if not tracking touch', function() { + const pointerup = new PointerEvent('pointerup', {pointerId: 1, pointerType: 'touch'}); + chai.assert.isFalse(Blockly.Touch.shouldHandleEvent(pointerup)); + }); + + test('handles pointerup if part of existing touch', function() { + const pointerdown = new PointerEvent('pointerdown', {pointerId: 1, pointerType: 'touch'}); + const pointerup = new PointerEvent('pointerdown', {pointerId: 1, pointerType: 'touch'}); + Blockly.Touch.shouldHandleEvent(pointerdown); + chai.assert.isTrue(Blockly.Touch.shouldHandleEvent(pointerup)); + }); + }); + + suite('getTouchIdentifierFromEvent', function() { + test('is mouse for MouseEvents', function() { + const mousedown = new MouseEvent('mousedown'); + chai.assert.equal(Blockly.Touch.getTouchIdentifierFromEvent(mousedown), 'mouse'); + }); + + test('is pointerId for mouse PointerEvents', function() { + const pointerdown = new PointerEvent('pointerdown', {pointerId: 7, pointerType: 'mouse'}); + chai.assert.equal(Blockly.Touch.getTouchIdentifierFromEvent(pointerdown), 7); + }); + + test('is pointerId for touch PointerEvents', function() { + const pointerdown = new PointerEvent('pointerdown', {pointerId: 42, pointerType: 'touch'}); + chai.assert.equal(Blockly.Touch.getTouchIdentifierFromEvent(pointerdown), 42); + }); + }); + }); From 5a23c84e6ef9c0b2bbd503ad9f58fa86db1232a8 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Fri, 14 Oct 2022 19:01:28 +0200 Subject: [PATCH 30/69] Don't quote fromJson property. (#6545) This is the only place in our codebase where it's quoted. The result is a failure to compile correctly using advanced optimizations. --- core/events/events_block_drag.ts | 5 ++--- core/events/events_bubble_open.ts | 8 +++----- core/field_registry.ts | 2 +- core/shortcut_items.ts | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/core/events/events_block_drag.ts b/core/events/events_block_drag.ts index 5d7943527..f45790274 100644 --- a/core/events/events_block_drag.ts +++ b/core/events/events_block_drag.ts @@ -61,9 +61,8 @@ export class BlockDrag extends UiBase { const json = super.toJson() as BlockDragJson; if (this.isStart === undefined) { throw new Error( - 'Whether this event is the start of a drag is ' + - 'undefined. Either pass the value to the constructor, or call ' + - 'fromJson'); + 'Whether this event is the start of a drag is undefined. ' + + 'Either pass the value to the constructor, or call fromJson'); } if (this.blockId === undefined) { throw new Error( diff --git a/core/events/events_bubble_open.ts b/core/events/events_bubble_open.ts index 4768aeb6d..b847f2cd7 100644 --- a/core/events/events_bubble_open.ts +++ b/core/events/events_bubble_open.ts @@ -61,15 +61,13 @@ export class BubbleOpen extends UiBase { const json = super.toJson() as BubbleOpenJson; if (this.isOpen === undefined) { throw new Error( - 'Whether this event is for opening the bubble is ' + - 'undefined. Either pass the value to the constructor, or call ' + - 'fromJson'); + 'Whether this event is for opening the bubble is undefined. ' + + 'Either pass the value to the constructor, or call fromJson'); } if (!this.bubbleType) { throw new Error( 'The type of bubble is undefined. Either pass the ' + - 'value to the constructor, or call ' + - 'fromJson'); + 'value to the constructor, or call fromJson'); } json['isOpen'] = this.isOpen; json['bubbleType'] = this.bubbleType; diff --git a/core/field_registry.ts b/core/field_registry.ts index 3645c1fe7..7880bf643 100644 --- a/core/field_registry.ts +++ b/core/field_registry.ts @@ -75,7 +75,7 @@ function fromJsonInternal(options: AnyDuringMigration): Field|null { ' the file is not loaded, the field does not register itself (Issue' + ' #1584), or the registration is not being reached.'); return null; - } else if (typeof (fieldObject as any)['fromJson'] !== 'function') { + } else if (typeof (fieldObject as any).fromJson !== 'function') { throw new TypeError('returned Field was not a IRegistrableField'); } else { return (fieldObject as unknown as IRegistrableField).fromJson(options); diff --git a/core/shortcut_items.ts b/core/shortcut_items.ts index 707a252f6..cf35096e9 100644 --- a/core/shortcut_items.ts +++ b/core/shortcut_items.ts @@ -34,7 +34,7 @@ export enum names { CUT = 'cut', PASTE = 'paste', UNDO = 'undo', - REDO = 'redo' + REDO = 'redo', } /** From 6c95b9eba20980d0575d6f58cb291ee69e3171d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Oct 2022 08:26:33 -0700 Subject: [PATCH 31/69] chore(deps): bump google-github-actions/deploy-appengine (#6555) Bumps [google-github-actions/deploy-appengine](https://github.com/google-github-actions/deploy-appengine) from 0.8.0 to 0.8.2. - [Release notes](https://github.com/google-github-actions/deploy-appengine/releases) - [Changelog](https://github.com/google-github-actions/deploy-appengine/blob/main/CHANGELOG.md) - [Commits](https://github.com/google-github-actions/deploy-appengine/compare/v0.8.0...v0.8.2) --- updated-dependencies: - dependency-name: google-github-actions/deploy-appengine dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/appengine_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/appengine_deploy.yml b/.github/workflows/appengine_deploy.yml index 5b8868aa5..6ea1b0daf 100644 --- a/.github/workflows/appengine_deploy.yml +++ b/.github/workflows/appengine_deploy.yml @@ -42,7 +42,7 @@ jobs: path: _deploy/ - name: Deploy to App Engine - uses: google-github-actions/deploy-appengine@v0.8.0 + uses: google-github-actions/deploy-appengine@v0.8.2 # For parameters see: # https://github.com/google-github-actions/deploy-appengine#inputs with: From 3eddb2c86f7f707036480c447d21678e44306ee6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Oct 2022 08:26:54 -0700 Subject: [PATCH 32/69] chore(deps): bump peter-evans/create-pull-request from 4.1.3 to 4.1.4 (#6556) Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 4.1.3 to 4.1.4. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/671dc9c9e0c2d73f07fa45a3eb0220e1622f0c5f...ad43dccb4d726ca8514126628bec209b8354b6dd) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/update_metadata.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update_metadata.yml b/.github/workflows/update_metadata.yml index 624f26c9e..8a1414f98 100644 --- a/.github/workflows/update_metadata.yml +++ b/.github/workflows/update_metadata.yml @@ -36,7 +36,7 @@ jobs: run: source ./tests/scripts/update_metadata.sh - name: Create Pull Request - uses: peter-evans/create-pull-request@671dc9c9e0c2d73f07fa45a3eb0220e1622f0c5f + uses: peter-evans/create-pull-request@ad43dccb4d726ca8514126628bec209b8354b6dd with: commit-message: Update build artifact sizes in check_metadata.sh delete-branch: true From b0c897224aba45e3f2fdc14786e0f959b2f0688d Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Mon, 17 Oct 2022 09:27:42 -0700 Subject: [PATCH 33/69] chore: clean up code in field_angle.ts (#6551) --- core/field_angle.ts | 81 +++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 51 deletions(-) diff --git a/core/field_angle.ts b/core/field_angle.ts index 33d813593..678f3ef7f 100644 --- a/core/field_angle.ts +++ b/core/field_angle.ts @@ -70,19 +70,36 @@ export class FieldAngle extends FieldTextInput { * otherwise SVG crops off half the border at the edges. */ static readonly RADIUS: number = FieldAngle.HALF - 1; - private clockwise_: boolean; - private offset_: number; - private wrap_: number; - private round_: number; + + /** + * Whether the angle should increase as the angle picker is moved clockwise + * (true) or counterclockwise (false). + */ + private clockwise_ = FieldAngle.CLOCKWISE; + + /** + * The offset of zero degrees (and all other angles). + */ + private offset_ = FieldAngle.OFFSET; + + /** + * The maximum angle to allow before wrapping. + */ + private wrap_ = FieldAngle.WRAP; + + /** + * The amount to round angles to when using a mouse or keyboard nav input. + */ + private round_ = FieldAngle.ROUND; /** The angle picker's SVG element. */ - private editor_: SVGElement|null = null; + private editor_: SVGSVGElement|null = null; /** The angle picker's gauge path depending on the value. */ - gauge_: SVGElement|null = null; + gauge_: SVGPathElement|null = null; /** The angle picker's line drawn representing the value's angle. */ - line_: SVGElement|null = null; + line_: SVGLineElement|null = null; /** The degree symbol for this field. */ // AnyDuringMigration because: Type 'null' is not assignable to type @@ -122,35 +139,6 @@ export class FieldAngle extends FieldTextInput { opt_config?: FieldAngleConfig) { super(Field.SKIP_SETUP); - /** - * Should the angle increase as the angle picker is moved clockwise (true) - * or counterclockwise (false) - * - * @see FieldAngle.CLOCKWISE - */ - this.clockwise_ = FieldAngle.CLOCKWISE; - - /** - * The offset of zero degrees (and all other angles). - * - * @see FieldAngle.OFFSET - */ - this.offset_ = FieldAngle.OFFSET; - - /** - * The maximum angle to allow before wrapping. - * - * @see FieldAngle.WRAP - */ - this.wrap_ = FieldAngle.WRAP; - - /** - * The amount to round angles to when using a mouse or keyboard nav input. - * - * @see FieldAngle.ROUND - */ - this.round_ = FieldAngle.ROUND; - if (opt_value === Field.SKIP_SETUP) { return; } @@ -223,9 +211,7 @@ export class FieldAngle extends FieldTextInput { super.showEditor_(opt_e, noFocus); this.dropdownCreate_(); - // AnyDuringMigration because: Argument of type 'SVGElement | null' is not - // assignable to parameter of type 'Node'. - dropDownDiv.getContentDiv().appendChild(this.editor_ as AnyDuringMigration); + dropDownDiv.getContentDiv().appendChild(this.editor_!); if (this.sourceBlock_ instanceof BlockSvg) { dropDownDiv.setColour( @@ -427,25 +413,18 @@ export class FieldAngle extends FieldTextInput { protected override onHtmlInputKeyDown_(e: Event) { super.onHtmlInputKeyDown_(e); + const keyboardEvent = e as KeyboardEvent; let multiplier; - // AnyDuringMigration because: Property 'keyCode' does not exist on type - // 'Event'. - if ((e as AnyDuringMigration).keyCode === KeyCodes.LEFT) { + if (keyboardEvent.keyCode === KeyCodes.LEFT) { // decrement (increment in RTL) multiplier = this.getSourceBlock().RTL ? 1 : -1; - // AnyDuringMigration because: Property 'keyCode' does not exist on type - // 'Event'. - } else if ((e as AnyDuringMigration).keyCode === KeyCodes.RIGHT) { + } else if (keyboardEvent.keyCode === KeyCodes.RIGHT) { // increment (decrement in RTL) multiplier = this.getSourceBlock().RTL ? -1 : 1; - // AnyDuringMigration because: Property 'keyCode' does not exist on type - // 'Event'. - } else if ((e as AnyDuringMigration).keyCode === KeyCodes.DOWN) { + } else if (keyboardEvent.keyCode === KeyCodes.DOWN) { // decrement multiplier = -1; - // AnyDuringMigration because: Property 'keyCode' does not exist on type - // 'Event'. - } else if ((e as AnyDuringMigration).keyCode === KeyCodes.UP) { + } else if (keyboardEvent.keyCode === KeyCodes.UP) { // increment multiplier = 1; } From df660af66ca62dcbe44560c05156160c4d91445b Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 18 Oct 2022 12:57:44 -0700 Subject: [PATCH 34/69] fix: make getSourceBlock nullable again (#6542) * fix: make getSourceBlock nullable again * chore: format * chore: move to a specific error * chore: also update procedures with new error * chore: format --- core/field.ts | 42 +++++++++++++++---- core/field_angle.ts | 10 +++-- core/field_dropdown.ts | 41 ++++++++++++------ core/field_multilineinput.ts | 14 +++++-- core/field_textinput.ts | 34 ++++++++++----- core/field_variable.ts | 42 ++++++++++++++----- .../i_ast_node_location_with_block.ts | 2 +- core/keyboard_nav/ast_node.ts | 20 ++++++++- core/procedures.ts | 11 +++-- 9 files changed, 161 insertions(+), 55 deletions(-) diff --git a/core/field.ts b/core/field.ts index ac827bbd9..480a459d2 100644 --- a/core/field.ts +++ b/core/field.ts @@ -255,10 +255,7 @@ export abstract class Field implements IASTNodeLocationSvg, * @returns The block containing this field. * @throws An error if the source block is not defined. */ - getSourceBlock(): Block { - if (!this.sourceBlock_) { - throw new Error(`The source block is ${this.sourceBlock_}.`); - } + getSourceBlock(): Block|null { return this.sourceBlock_; } @@ -476,10 +473,11 @@ export abstract class Field implements IASTNodeLocationSvg, /** Add or remove the UI indicating if this field is editable or not. */ updateEditable() { const group = this.fieldGroup_; - if (!this.EDITABLE || !group) { + const block = this.getSourceBlock(); + if (!this.EDITABLE || !group || !block) { return; } - if (this.enabled_ && this.getSourceBlock().isEditable()) { + if (this.enabled_ && block.isEditable()) { dom.addClass(group, 'blocklyEditableText'); dom.removeClass(group, 'blocklyNonEditableText'); group.style.cursor = this.CURSOR; @@ -756,7 +754,7 @@ export abstract class Field implements IASTNodeLocationSvg, this.textElement_.setAttribute( 'x', `${ - this.getSourceBlock().RTL ? + this.getSourceBlock()?.RTL ? this.size_.width - contentWidth - xOffset : xOffset}`); this.textElement_.setAttribute( @@ -819,12 +817,17 @@ export abstract class Field implements IASTNodeLocationSvg, let scaledWidth; let scaledHeight; let xy; + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } + if (!this.borderRect_) { // Browsers are inconsistent in what they return for a bounding box. // - Webkit / Blink: fill-box / object bounding box // - Gecko: stroke-box const bBox = (this.sourceBlock_ as BlockSvg).getHeightWidth(); - const scale = (this.getSourceBlock().workspace as WorkspaceSvg).scale; + const scale = (block.workspace as WorkspaceSvg).scale; xy = this.getAbsoluteXY_(); scaledWidth = (bBox.width + 1) * scale; scaledHeight = (bBox.height + 1) * scale; @@ -1158,6 +1161,9 @@ export abstract class Field implements IASTNodeLocationSvg, getParentInput(): Input { let parentInput = null; const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } const inputs = block.inputList; for (let idx = 0; idx < block.inputList.length; idx++) { @@ -1241,7 +1247,11 @@ export abstract class Field implements IASTNodeLocationSvg, /** Redraw any attached marker or cursor svgs if needed. */ protected updateMarkers_() { - const workspace = this.getSourceBlock().workspace as WorkspaceSvg; + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } + const workspace = block.workspace as WorkspaceSvg; if (workspace.keyboardAccessibilityMode && this.cursorSvg_) { workspace.getCursor()!.draw(); } @@ -1264,3 +1274,17 @@ export interface FieldConfig { * in descendants, though they should contain all of Field's prototype methods. */ export type FieldProto = Pick; + +/** + * Represents an error where the field is trying to access its block or + * information about its block before it has actually been attached to said + * block. + */ +export class UnattachedFieldError extends Error { + /** @internal */ + constructor() { + super( + 'The field has not yet been attached to its input. ' + + 'Call appendField to attach it.'); + } +} diff --git a/core/field_angle.ts b/core/field_angle.ts index 678f3ef7f..69a5df239 100644 --- a/core/field_angle.ts +++ b/core/field_angle.ts @@ -16,7 +16,7 @@ import {BlockSvg} from './block_svg.js'; import * as browserEvents from './browser_events.js'; import * as Css from './css.js'; import * as dropDownDiv from './dropdowndiv.js'; -import {Field} from './field.js'; +import {Field, UnattachedFieldError} from './field.js'; import * as fieldRegistry from './field_registry.js'; import {FieldTextInputConfig, FieldTextInput} from './field_textinput.js'; import * as dom from './utils/dom.js'; @@ -412,15 +412,19 @@ export class FieldAngle extends FieldTextInput { */ protected override onHtmlInputKeyDown_(e: Event) { super.onHtmlInputKeyDown_(e); + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } const keyboardEvent = e as KeyboardEvent; let multiplier; if (keyboardEvent.keyCode === KeyCodes.LEFT) { // decrement (increment in RTL) - multiplier = this.getSourceBlock().RTL ? 1 : -1; + multiplier = block.RTL ? 1 : -1; } else if (keyboardEvent.keyCode === KeyCodes.RIGHT) { // increment (decrement in RTL) - multiplier = this.getSourceBlock().RTL ? -1 : 1; + multiplier = block.RTL ? -1 : 1; } else if (keyboardEvent.keyCode === KeyCodes.DOWN) { // decrement multiplier = -1; diff --git a/core/field_dropdown.ts b/core/field_dropdown.ts index 4385c037d..87580726f 100644 --- a/core/field_dropdown.ts +++ b/core/field_dropdown.ts @@ -16,7 +16,7 @@ goog.declareModuleId('Blockly.FieldDropdown'); import type {BlockSvg} from './block_svg.js'; import * as dropDownDiv from './dropdowndiv.js'; -import {FieldConfig, Field} from './field.js'; +import {FieldConfig, Field, UnattachedFieldError} from './field.js'; import * as fieldRegistry from './field_registry.js'; import {Menu} from './menu.js'; import {MenuItem} from './menuitem.js'; @@ -217,16 +217,16 @@ export class FieldDropdown extends Field { protected shouldAddBorderRect_(): boolean { return !this.getConstants()!.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW || this.getConstants()!.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW && - !this.getSourceBlock().isShadow(); + !this.getSourceBlock()?.isShadow(); } /** Create a tspan based arrow. */ protected createTextArrow_() { this.arrow_ = dom.createSvgElement(Svg.TSPAN, {}, this.textElement_); this.arrow_!.appendChild(document.createTextNode( - this.getSourceBlock().RTL ? FieldDropdown.ARROW_CHAR + ' ' : - ' ' + FieldDropdown.ARROW_CHAR)); - if (this.getSourceBlock().RTL) { + this.getSourceBlock()?.RTL ? FieldDropdown.ARROW_CHAR + ' ' : + ' ' + FieldDropdown.ARROW_CHAR)); + if (this.getSourceBlock()?.RTL) { // AnyDuringMigration because: Argument of type 'SVGTSpanElement | null' // is not assignable to parameter of type 'Node'. this.getTextElement().insertBefore( @@ -258,6 +258,10 @@ export class FieldDropdown extends Field { * undefined if triggered programmatically. */ protected override showEditor_(opt_e?: Event) { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } this.dropdownCreate_(); // AnyDuringMigration because: Property 'clientX' does not exist on type // 'Event'. @@ -279,11 +283,10 @@ export class FieldDropdown extends Field { dom.addClass(menuElement, 'blocklyDropdownMenu'); if (this.getConstants()!.FIELD_DROPDOWN_COLOURED_DIV) { - const primaryColour = this.getSourceBlock().isShadow() ? - this.getSourceBlock().getParent()!.getColour() : - this.getSourceBlock().getColour(); - const borderColour = this.getSourceBlock().isShadow() ? - (this.getSourceBlock().getParent() as BlockSvg).style.colourTertiary : + const primaryColour = + block.isShadow() ? block.getParent()!.getColour() : block.getColour(); + const borderColour = block.isShadow() ? + (block.getParent() as BlockSvg).style.colourTertiary : (this.sourceBlock_ as BlockSvg).style.colourTertiary; dropDownDiv.setColour(primaryColour, borderColour); } @@ -304,6 +307,10 @@ export class FieldDropdown extends Field { /** Create the dropdown editor. */ private dropdownCreate_() { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } const menu = new Menu(); menu.setRole(aria.Role.LISTBOX); this.menu_ = menu; @@ -322,7 +329,7 @@ export class FieldDropdown extends Field { } const menuItem = new MenuItem(content, value); menuItem.setRole(aria.Role.OPTION); - menuItem.setRightToLeft(this.getSourceBlock().RTL); + menuItem.setRightToLeft(block.RTL); menuItem.setCheckable(true); menu.addChild(menuItem); menuItem.setChecked(value === this.value_); @@ -540,6 +547,10 @@ export class FieldDropdown extends Field { * @param imageJson Selected option that must be an image. */ private renderSelectedImage_(imageJson: ImageProperties) { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } this.imageElement_!.style.display = ''; this.imageElement_!.setAttributeNS( dom.XLINK_NS, 'xlink:href', imageJson.src); @@ -578,7 +589,7 @@ export class FieldDropdown extends Field { this.size_.height = height; let arrowX = 0; - if (this.getSourceBlock().RTL) { + if (block.RTL) { const imageX = xPadding + arrowWidth; this.imageElement_!.setAttribute('x', imageX.toString()); } else { @@ -634,12 +645,16 @@ export class FieldDropdown extends Field { if (!this.svgArrow_) { return 0; } + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } const hasBorder = !!this.borderRect_; const xPadding = hasBorder ? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING : 0; const textPadding = this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_PADDING; const svgArrowSize = this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_SIZE; - const arrowX = this.getSourceBlock().RTL ? xPadding : x + textPadding; + const arrowX = block.RTL ? xPadding : x + textPadding; this.svgArrow_.setAttribute( 'transform', 'translate(' + arrowX + ',' + y + ')'); return svgArrowSize + textPadding; diff --git a/core/field_multilineinput.ts b/core/field_multilineinput.ts index 44bcd651a..403f725cc 100644 --- a/core/field_multilineinput.ts +++ b/core/field_multilineinput.ts @@ -13,7 +13,7 @@ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.FieldMultilineInput'); import * as Css from './css.js'; -import {Field} from './field.js'; +import {Field, UnattachedFieldError} from './field.js'; import * as fieldRegistry from './field_registry.js'; import {FieldTextInputConfig, FieldTextInput} from './field_textinput.js'; import * as aria from './utils/aria.js'; @@ -163,6 +163,10 @@ export class FieldMultilineInput extends FieldTextInput { * @returns Currently displayed text. */ protected override getDisplayText_(): string { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } let textLines = this.getText(); if (!textLines) { // Prevent the field from disappearing if empty. @@ -189,7 +193,7 @@ export class FieldMultilineInput extends FieldTextInput { textLines += '\n'; } } - if (this.getSourceBlock().RTL) { + if (block.RTL) { // The SVG is LTR, force value to be RTL. textLines += '\u200F'; } @@ -212,6 +216,10 @@ export class FieldMultilineInput extends FieldTextInput { /** Updates the text of the textElement. */ protected override render_() { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } // Remove all text group children. let currentChild; while (currentChild = this.textGroup_.firstChild) { @@ -248,7 +256,7 @@ export class FieldMultilineInput extends FieldTextInput { this.updateSize_(); if (this.isBeingEdited_) { - if (this.getSourceBlock().RTL) { + if (block.RTL) { // in RTL, we need to let the browser reflow before resizing // in order to get the correct bounding box of the borderRect // avoiding issue #2777. diff --git a/core/field_textinput.ts b/core/field_textinput.ts index b639ffd2f..ca4e6053c 100644 --- a/core/field_textinput.ts +++ b/core/field_textinput.ts @@ -21,7 +21,7 @@ import * as dialog from './dialog.js'; import * as dom from './utils/dom.js'; import * as dropDownDiv from './dropdowndiv.js'; import * as eventUtils from './events/utils.js'; -import {FieldConfig, Field} from './field.js'; +import {FieldConfig, Field, UnattachedFieldError} from './field.js'; import * as fieldRegistry from './field_registry.js'; import {Msg} from './msg.js'; import * as aria from './utils/aria.js'; @@ -127,13 +127,17 @@ export class FieldTextInput extends Field { /** @internal */ override initView() { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } if (this.getConstants()!.FULL_BLOCK_FIELDS) { // Step one: figure out if this is the only field on this block. // Rendering is quite different in that case. let nFields = 0; let nConnections = 0; // Count the number of fields, excluding text fields - for (let i = 0, input; input = this.getSourceBlock().inputList[i]; i++) { + for (let i = 0, input; input = block.inputList[i]; i++) { for (let j = 0; input.fieldRow[j]; j++) { nFields++; } @@ -143,8 +147,8 @@ export class FieldTextInput extends Field { } // The special case is when this is the only non-label field on the block // and it has an output but no inputs. - this.fullBlockClickTarget_ = nFields <= 1 && - this.getSourceBlock().outputConnection && !nConnections; + this.fullBlockClickTarget_ = + nFields <= 1 && block.outputConnection && !nConnections; } else { this.fullBlockClickTarget_ = false; } @@ -307,8 +311,11 @@ export class FieldTextInput extends Field { * @param quietInput True if editor should be created without focus. */ private showInlineEditor_(quietInput: boolean) { - WidgetDiv.show( - this, this.getSourceBlock().RTL, this.widgetDispose_.bind(this)); + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } + WidgetDiv.show(this, block.RTL, this.widgetDispose_.bind(this)); this.htmlInput_ = this.widgetCreate_() as HTMLInputElement; this.isBeingEdited_ = true; @@ -326,6 +333,10 @@ export class FieldTextInput extends Field { * @returns The newly created text input editor. */ protected widgetCreate_(): HTMLElement { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } eventUtils.setGroup(true); const div = WidgetDiv.getDiv(); @@ -351,8 +362,8 @@ export class FieldTextInput extends Field { // Override border radius. borderRadius = (bBox.bottom - bBox.top) / 2 + 'px'; // Pull stroke colour from the existing shadow block - const strokeColour = this.getSourceBlock().getParent() ? - (this.getSourceBlock().getParent() as BlockSvg).style.colourTertiary : + const strokeColour = block.getParent() ? + (block.getParent() as BlockSvg).style.colourTertiary : (this.sourceBlock_ as BlockSvg).style.colourTertiary; htmlInput.style.border = 1 * scale + 'px solid ' + strokeColour; div!.style.borderRadius = borderRadius; @@ -510,6 +521,10 @@ export class FieldTextInput extends Field { /** Resize the editor to fit the text. */ protected resizeEditor_() { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } const div = WidgetDiv.getDiv(); const bBox = this.getScaledBBox(); div!.style.width = bBox.right - bBox.left + 'px'; @@ -517,8 +532,7 @@ export class FieldTextInput extends Field { // In RTL mode block fields and LTR input fields the left edge moves, // whereas the right edge is fixed. Reposition the editor. - const x = - this.getSourceBlock().RTL ? bBox.right - div!.offsetWidth : bBox.left; + const x = block.RTL ? bBox.right - div!.offsetWidth : bBox.left; const xy = new Coordinate(x, bBox.top); div!.style.left = xy.x + 'px'; diff --git a/core/field_variable.ts b/core/field_variable.ts index e337356bf..879eb1aa9 100644 --- a/core/field_variable.ts +++ b/core/field_variable.ts @@ -16,7 +16,7 @@ goog.declareModuleId('Blockly.FieldVariable'); import './events/events_block_change.js'; import type {Block} from './block.js'; -import {Field, FieldConfig} from './field.js'; +import {Field, FieldConfig, UnattachedFieldError} from './field.js'; import {FieldDropdown} from './field_dropdown.js'; import * as fieldRegistry from './field_registry.js'; import * as internalConstants from './internal_constants.js'; @@ -135,20 +135,27 @@ export class FieldVariable extends FieldDropdown { * @internal */ override initModel() { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } if (this.variable_) { return; // Initialization already happened. } const variable = Variables.getOrCreateVariablePackage( - this.getSourceBlock().workspace, null, this.defaultVariableName, - this.defaultType_); + block.workspace, null, this.defaultVariableName, this.defaultType_); // Don't call setValue because we don't want to cause a rerender. this.doValueUpdate_(variable.getId()); } override shouldAddBorderRect_() { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } return super.shouldAddBorderRect_() && (!this.getConstants()!.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW || - this.getSourceBlock().type !== 'variables_get'); + block.type !== 'variables_get'); } /** @@ -158,6 +165,10 @@ export class FieldVariable extends FieldDropdown { * field's state. */ override fromXml(fieldElement: Element) { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } const id = fieldElement.getAttribute('id'); const variableName = fieldElement.textContent; // 'variabletype' should be lowercase, but until July 2019 it was sometimes @@ -168,8 +179,7 @@ export class FieldVariable extends FieldDropdown { // AnyDuringMigration because: Argument of type 'string | null' is not // assignable to parameter of type 'string | undefined'. const variable = Variables.getOrCreateVariablePackage( - this.getSourceBlock().workspace, id, variableName as AnyDuringMigration, - variableType); + block.workspace, id, variableName as AnyDuringMigration, variableType); // This should never happen :) if (variableType !== null && variableType !== variable.type) { @@ -233,12 +243,16 @@ export class FieldVariable extends FieldDropdown { * @internal */ override loadState(state: AnyDuringMigration) { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } if (this.loadLegacyState(FieldVariable, state)) { return; } // This is necessary so that blocks in the flyout can have custom var names. const variable = Variables.getOrCreateVariablePackage( - this.getSourceBlock().workspace, state['id'] || null, state['name'], + block.workspace, state['id'] || null, state['name'], state['type'] || ''); this.setValue(variable.getId()); } @@ -315,9 +329,12 @@ export class FieldVariable extends FieldDropdown { if (opt_newValue === null) { return null; } + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } const newId = opt_newValue as string; - const variable = - Variables.getVariable(this.getSourceBlock().workspace, newId); + const variable = Variables.getVariable(block.workspace, newId); if (!variable) { console.warn( 'Variable id doesn\'t point to a real variable! ' + @@ -343,8 +360,11 @@ export class FieldVariable extends FieldDropdown { * @param newId The value to be saved. */ protected override doValueUpdate_(newId: AnyDuringMigration) { - this.variable_ = - Variables.getVariable(this.getSourceBlock().workspace, newId as string); + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } + this.variable_ = Variables.getVariable(block.workspace, newId as string); super.doValueUpdate_(newId); } diff --git a/core/interfaces/i_ast_node_location_with_block.ts b/core/interfaces/i_ast_node_location_with_block.ts index 72ef94b78..cf54ddc41 100644 --- a/core/interfaces/i_ast_node_location_with_block.ts +++ b/core/interfaces/i_ast_node_location_with_block.ts @@ -28,5 +28,5 @@ export interface IASTNodeLocationWithBlock extends IASTNodeLocation { * * @returns The source block. */ - getSourceBlock(): Block; + getSourceBlock(): Block|null; } diff --git a/core/keyboard_nav/ast_node.ts b/core/keyboard_nav/ast_node.ts index 24bf02803..27d0a4554 100644 --- a/core/keyboard_nav/ast_node.ts +++ b/core/keyboard_nav/ast_node.ts @@ -176,6 +176,10 @@ export class ASTNode { const location = this.location_ as Field; const input = location.getParentInput(); const block = location.getSourceBlock(); + if (!block) { + throw new Error( + 'The current AST location is not associated with a block'); + } const curIdx = block.inputList.indexOf((input)); let fieldIdx = input.fieldRow.indexOf(location) + 1; for (let i = curIdx; i < block.inputList.length; i++) { @@ -235,6 +239,10 @@ export class ASTNode { const location = this.location_ as Field; const parentInput = location.getParentInput(); const block = location.getSourceBlock(); + if (!block) { + throw new Error( + 'The current AST location is not associated with a block'); + } const curIdx = block.inputList.indexOf((parentInput)); let fieldIdx = parentInput.fieldRow.indexOf(location) - 1; for (let i = curIdx; i >= 0; i--) { @@ -270,7 +278,10 @@ export class ASTNode { // TODO(#6097): Use instanceof checks to exit early for values of // curLocation that don't make sense. if ((curLocation as IASTNodeLocationWithBlock).getSourceBlock) { - curLocation = (curLocation as IASTNodeLocationWithBlock).getSourceBlock(); + const block = (curLocation as IASTNodeLocationWithBlock).getSourceBlock(); + if (block) { + curLocation = block; + } } // TODO(#6097): Use instanceof checks to exit early for values of // curLocation that don't make sense. @@ -531,7 +542,12 @@ export class ASTNode { } case ASTNode.types.FIELD: { const field = this.location_ as Field; - return ASTNode.createBlockNode(field.getSourceBlock()); + const block = field.getSourceBlock(); + if (!block) { + throw new Error( + 'The current AST location is not associated with a block'); + } + return ASTNode.createBlockNode(block); } case ASTNode.types.INPUT: { const connection = this.location_ as Connection; diff --git a/core/procedures.ts b/core/procedures.ts index e472fcd8a..7fad925e6 100644 --- a/core/procedures.ts +++ b/core/procedures.ts @@ -22,7 +22,7 @@ import * as common from './common.js'; import type {Abstract} from './events/events_abstract.js'; import type {BubbleOpen} from './events/events_bubble_open.js'; import * as eventUtils from './events/utils.js'; -import type {Field} from './field.js'; +import {Field, UnattachedFieldError} from './field.js'; import {Msg} from './msg.js'; import {Names} from './names.js'; import * as utilsXml from './utils/xml.js'; @@ -180,14 +180,19 @@ export function isNameUsed( * @alias Blockly.Procedures.rename */ export function rename(this: Field, name: string): string { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } + // Strip leading and trailing whitespace. Beyond this, all names are legal. name = name.trim(); - const legalName = findLegalName(name, (this.getSourceBlock())); + const legalName = findLegalName(name, block); const oldName = this.getValue(); if (oldName !== name && oldName !== legalName) { // Rename any callers. - const blocks = this.getSourceBlock().workspace.getAllBlocks(false); + const blocks = block.workspace.getAllBlocks(false); for (let i = 0; i < blocks.length; i++) { // Assume it is a procedure so we can check. const procedureBlock = blocks[i] as unknown as ProcedureBlock; From 321f619e28f24d644ca11a503ba25ba112d5aefc Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Tue, 18 Oct 2022 23:01:41 +0200 Subject: [PATCH 35/69] fix: Don't warn if field is acually 0 width (#6558) One part of issue 6557. --- core/field.ts | 9 ++++++--- core/utils/parsing.ts | 3 +-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/field.ts b/core/field.ts index 480a459d2..dc9010633 100644 --- a/core/field.ts +++ b/core/field.ts @@ -797,10 +797,13 @@ export abstract class Field implements IASTNodeLocationSvg, } else if (this.visible_ && this.size_.width === 0) { // If the field is not visible the width will be 0 as well, one of the // problems with the old system. - console.warn( - 'Deprecated use of setting size_.width to 0 to rerender a' + - ' field. Set field.isDirty_ to true instead.'); this.render_(); + // Don't issue a warning if the field is actually zero width. + if (this.size_.width !== 0) { + console.warn( + 'Deprecated use of setting size_.width to 0 to rerender a' + + ' field. Set field.isDirty_ to true instead.'); + } } return this.size_; } diff --git a/core/utils/parsing.ts b/core/utils/parsing.ts index 36452f0d7..3a2fdd611 100644 --- a/core/utils/parsing.ts +++ b/core/utils/parsing.ts @@ -29,8 +29,7 @@ function tokenizeInterpolationInternal( message: string, parseInterpolationTokens: boolean): (string|number)[] { const tokens = []; const chars = message.split(''); - chars.push( // End marker. - ''); + chars.push(''); // End marker. // Parse the message with a finite state machine. // 0 - Base case. // 1 - % found. From 04dffbc33a009d5c7f2983040ac09d7e12b6dd42 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 18 Oct 2022 14:15:53 -0700 Subject: [PATCH 36/69] chore: fix mutator blocks jumping (#6559) * chore: fix mutator blocks jumping * chore: format --- core/block_animations.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/block_animations.ts b/core/block_animations.ts index 68b8d7582..47ee63581 100644 --- a/core/block_animations.ts +++ b/core/block_animations.ts @@ -188,7 +188,11 @@ function disconnectUiStep(group: SVGElement, magnitude: number, start: Date) { skew = `skewX(${val})`; disconnectPid = setTimeout(disconnectUiStep, 10, group, magnitude, start); } - group.setAttribute('transform', skew); + (group as AnyDuringMigration).skew_ = skew; + group.setAttribute( + 'transform', + (group as AnyDuringMigration).translate_ + + (group as AnyDuringMigration).skew_); } /** @@ -202,7 +206,9 @@ export function disconnectUiStop() { if (disconnectPid) { clearTimeout(disconnectPid); } - disconnectGroup.setAttribute('transform', ''); + const group = disconnectGroup; + (group as AnyDuringMigration).skew_ = ''; + group.setAttribute('transform', (group as AnyDuringMigration).translate_); disconnectGroup = null; } } From 4a26103c0fe9d35f216a99e3dd11e1ab06b3a0fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Oct 2022 15:39:00 -0700 Subject: [PATCH 37/69] chore(deps): bump @blockly/block-test from 3.0.0 to 3.0.1 (#6553) Bumps [@blockly/block-test](https://github.com/google/blockly-samples/tree/HEAD/plugins/block-test) from 3.0.0 to 3.0.1. - [Release notes](https://github.com/google/blockly-samples/releases) - [Changelog](https://github.com/google/blockly-samples/blob/master/plugins/block-test/CHANGELOG.md) - [Commits](https://github.com/google/blockly-samples/commits/@blockly/block-test@3.0.1/plugins/block-test) --- updated-dependencies: - dependency-name: "@blockly/block-test" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] 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 ad13db76d..691fbbd5d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -158,9 +158,9 @@ } }, "node_modules/@blockly/block-test": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.0.tgz", - "integrity": "sha512-yEJUyjFfIS9xNS27wLfM7cXTZ5ZIN0DrRsAdw8JOib1PWh6g+aWffB9F44JlMNHLqg12lB0R1bTr/yv/Wjl5Lw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.1.tgz", + "integrity": "sha512-lXHwyAFiLNAmDS3BvBscy7S4YfKt8U8yMghop/j5G3nUz5gKWQGMtUJDq7Wm5ZpIFHghYDPxnhdpwhdCkuRchA==", "dev": true, "engines": { "node": ">=8.17.0" @@ -13797,9 +13797,9 @@ } }, "@blockly/block-test": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.0.tgz", - "integrity": "sha512-yEJUyjFfIS9xNS27wLfM7cXTZ5ZIN0DrRsAdw8JOib1PWh6g+aWffB9F44JlMNHLqg12lB0R1bTr/yv/Wjl5Lw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.1.tgz", + "integrity": "sha512-lXHwyAFiLNAmDS3BvBscy7S4YfKt8U8yMghop/j5G3nUz5gKWQGMtUJDq7Wm5ZpIFHghYDPxnhdpwhdCkuRchA==", "dev": true, "requires": {} }, From 82e5a23216e7863978339636f17b9aa0df605af6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Oct 2022 22:41:13 +0000 Subject: [PATCH 38/69] chore(deps): bump @microsoft/api-extractor from 7.31.2 to 7.33.4 Bumps [@microsoft/api-extractor](https://github.com/microsoft/rushstack/tree/HEAD/apps/api-extractor) from 7.31.2 to 7.33.4. - [Release notes](https://github.com/microsoft/rushstack/releases) - [Changelog](https://github.com/microsoft/rushstack/blob/main/apps/api-extractor/CHANGELOG.md) - [Commits](https://github.com/microsoft/rushstack/commits/@microsoft/api-extractor_v7.33.4/apps/api-extractor) --- updated-dependencies: - dependency-name: "@microsoft/api-extractor" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 96 +++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/package-lock.json b/package-lock.json index 691fbbd5d..40e12b2f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -481,37 +481,37 @@ } }, "node_modules/@microsoft/api-extractor": { - "version": "7.31.2", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.31.2.tgz", - "integrity": "sha512-ZODCU9ckTS9brXiZpUW2iDrnAg7jLxeLBM1AkPpSZFcbG/8HGLvfKOKrd71VIJHjc52x2lB8xj7ZWksnP7AOBA==", + "version": "7.33.4", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.33.4.tgz", + "integrity": "sha512-uZG4CHxVcQNpXBC77GwHaKFwGI9vAnzORY4fFN5JuTnQQDKS0vi4BazP4pmYYwbb8IdH4ocQSwOA3j9Ul/sWmg==", "dev": true, "dependencies": { - "@microsoft/api-extractor-model": "7.24.2", + "@microsoft/api-extractor-model": "7.25.1", "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.52.0", - "@rushstack/rig-package": "0.3.15", - "@rushstack/ts-command-line": "4.12.3", + "@rushstack/node-core-library": "3.53.2", + "@rushstack/rig-package": "0.3.17", + "@rushstack/ts-command-line": "4.13.0", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.17.0", "semver": "~7.3.0", "source-map": "~0.6.1", - "typescript": "~4.7.4" + "typescript": "~4.8.4" }, "bin": { "api-extractor": "bin/api-extractor" } }, "node_modules/@microsoft/api-extractor-model": { - "version": "7.24.2", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.24.2.tgz", - "integrity": "sha512-uUvjqTCY7hYERWGks+joTioN1QYHIucCDy7I/JqLxFxLbFXE5dpc1X7L+FG4PN/s8QYL24DKt0fqJkgcrFKLTw==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.25.1.tgz", + "integrity": "sha512-AaZ0ohCGLRjWiZviM+0p/DaxgMhbawS183LW2+CSqyEBh6wZks7NjoyhzhibAYapS4omnrmv96+0V/2wBvnIZQ==", "dev": true, "dependencies": { "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.52.0" + "@rushstack/node-core-library": "3.53.2" } }, "node_modules/@microsoft/api-extractor/node_modules/resolve": { @@ -608,9 +608,9 @@ } }, "node_modules/@rushstack/node-core-library": { - "version": "3.52.0", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.52.0.tgz", - "integrity": "sha512-Z+MAP//G3rEGZd3JxJcBGcPYJlh8pvPoLMTLa5Sy6FTE6hRPzN+5J8DT7BbTmlqZaL6SZpXF30heRUbnYOvujw==", + "version": "3.53.2", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.53.2.tgz", + "integrity": "sha512-FggLe5DQs0X9MNFeJN3/EXwb+8hyZUTEp2i+V1e8r4Va4JgkjBNY0BuEaQI+3DW6S4apV3UtXU3im17MSY00DA==", "dev": true, "dependencies": { "@types/node": "12.20.24", @@ -674,9 +674,9 @@ } }, "node_modules/@rushstack/rig-package": { - "version": "0.3.15", - "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.3.15.tgz", - "integrity": "sha512-jxVfvO5OnkRlYRhcVDZWvwiI2l4pv37HDJRtyg5HbD8Z/I8Xj32RICgrxS5xMeGGytobrg5S6OfPOHskg7Nw+A==", + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.3.17.tgz", + "integrity": "sha512-nxvAGeIMnHl1LlZSQmacgcRV4y1EYtgcDIrw6KkeVjudOMonlxO482PhDj3LVZEp6L7emSf6YSO2s5JkHlwfZA==", "dev": true, "dependencies": { "resolve": "~1.17.0", @@ -696,9 +696,9 @@ } }, "node_modules/@rushstack/ts-command-line": { - "version": "4.12.3", - "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.12.3.tgz", - "integrity": "sha512-Pdij22RotMXzI+HWHyYCvw0RMZhiP5a6Za/96XamZ1+mxmpSm4ujf8TROKxGAHySmR5A8iNVSlzhNMnUlFQE6g==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.13.0.tgz", + "integrity": "sha512-crLT31kl+qilz0eBRjqqYO06CqwbElc0EvzS6jI69B9Ikt1SkkSzIZ2iDP7zt/rd1ZYipKIS9hf9CQR9swDIKg==", "dev": true, "dependencies": { "@types/argparse": "1.0.38", @@ -12495,9 +12495,9 @@ "dev": true }, "node_modules/typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", + "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -14030,23 +14030,23 @@ } }, "@microsoft/api-extractor": { - "version": "7.31.2", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.31.2.tgz", - "integrity": "sha512-ZODCU9ckTS9brXiZpUW2iDrnAg7jLxeLBM1AkPpSZFcbG/8HGLvfKOKrd71VIJHjc52x2lB8xj7ZWksnP7AOBA==", + "version": "7.33.4", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.33.4.tgz", + "integrity": "sha512-uZG4CHxVcQNpXBC77GwHaKFwGI9vAnzORY4fFN5JuTnQQDKS0vi4BazP4pmYYwbb8IdH4ocQSwOA3j9Ul/sWmg==", "dev": true, "requires": { - "@microsoft/api-extractor-model": "7.24.2", + "@microsoft/api-extractor-model": "7.25.1", "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.52.0", - "@rushstack/rig-package": "0.3.15", - "@rushstack/ts-command-line": "4.12.3", + "@rushstack/node-core-library": "3.53.2", + "@rushstack/rig-package": "0.3.17", + "@rushstack/ts-command-line": "4.13.0", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.17.0", "semver": "~7.3.0", "source-map": "~0.6.1", - "typescript": "~4.7.4" + "typescript": "~4.8.4" }, "dependencies": { "resolve": { @@ -14067,14 +14067,14 @@ } }, "@microsoft/api-extractor-model": { - "version": "7.24.2", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.24.2.tgz", - "integrity": "sha512-uUvjqTCY7hYERWGks+joTioN1QYHIucCDy7I/JqLxFxLbFXE5dpc1X7L+FG4PN/s8QYL24DKt0fqJkgcrFKLTw==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.25.1.tgz", + "integrity": "sha512-AaZ0ohCGLRjWiZviM+0p/DaxgMhbawS183LW2+CSqyEBh6wZks7NjoyhzhibAYapS4omnrmv96+0V/2wBvnIZQ==", "dev": true, "requires": { "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.52.0" + "@rushstack/node-core-library": "3.53.2" } }, "@microsoft/tsdoc": { @@ -14140,9 +14140,9 @@ } }, "@rushstack/node-core-library": { - "version": "3.52.0", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.52.0.tgz", - "integrity": "sha512-Z+MAP//G3rEGZd3JxJcBGcPYJlh8pvPoLMTLa5Sy6FTE6hRPzN+5J8DT7BbTmlqZaL6SZpXF30heRUbnYOvujw==", + "version": "3.53.2", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.53.2.tgz", + "integrity": "sha512-FggLe5DQs0X9MNFeJN3/EXwb+8hyZUTEp2i+V1e8r4Va4JgkjBNY0BuEaQI+3DW6S4apV3UtXU3im17MSY00DA==", "dev": true, "requires": { "@types/node": "12.20.24", @@ -14199,9 +14199,9 @@ } }, "@rushstack/rig-package": { - "version": "0.3.15", - "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.3.15.tgz", - "integrity": "sha512-jxVfvO5OnkRlYRhcVDZWvwiI2l4pv37HDJRtyg5HbD8Z/I8Xj32RICgrxS5xMeGGytobrg5S6OfPOHskg7Nw+A==", + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.3.17.tgz", + "integrity": "sha512-nxvAGeIMnHl1LlZSQmacgcRV4y1EYtgcDIrw6KkeVjudOMonlxO482PhDj3LVZEp6L7emSf6YSO2s5JkHlwfZA==", "dev": true, "requires": { "resolve": "~1.17.0", @@ -14220,9 +14220,9 @@ } }, "@rushstack/ts-command-line": { - "version": "4.12.3", - "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.12.3.tgz", - "integrity": "sha512-Pdij22RotMXzI+HWHyYCvw0RMZhiP5a6Za/96XamZ1+mxmpSm4ujf8TROKxGAHySmR5A8iNVSlzhNMnUlFQE6g==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.13.0.tgz", + "integrity": "sha512-crLT31kl+qilz0eBRjqqYO06CqwbElc0EvzS6jI69B9Ikt1SkkSzIZ2iDP7zt/rd1ZYipKIS9hf9CQR9swDIKg==", "dev": true, "requires": { "@types/argparse": "1.0.38", @@ -23591,9 +23591,9 @@ "dev": true }, "typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", + "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", "dev": true }, "ua-parser-js": { From 169bf67e51ee927cba14a636076ea656115bb858 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Oct 2022 15:58:23 -0700 Subject: [PATCH 39/69] chore(deps): bump @typescript-eslint/eslint-plugin from 5.40.0 to 5.40.1 (#6563) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.40.0 to 5.40.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.40.1/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 246 ++++++++++++++++++++++++---------------------- 1 file changed, 130 insertions(+), 116 deletions(-) diff --git a/package-lock.json b/package-lock.json index 691fbbd5d..676787ed0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -936,6 +936,12 @@ "@types/node": "*" } }, + "node_modules/@types/semver": { + "version": "7.3.12", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.12.tgz", + "integrity": "sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==", + "dev": true + }, "node_modules/@types/through": { "version": "0.0.30", "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.30.tgz", @@ -979,14 +985,14 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.0.tgz", - "integrity": "sha512-FIBZgS3DVJgqPwJzvZTuH4HNsZhHMa9SjxTKAZTlMsPw/UzpEjcf9f4dfgDJEHjK+HboUJo123Eshl6niwEm/Q==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.1.tgz", + "integrity": "sha512-FsWboKkWdytGiXT5O1/R9j37YgcjO8MKHSUmWnIEjVaz0krHkplPnYi7mwdb+5+cs0toFNQb0HIrN7zONdIEWg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.40.0", - "@typescript-eslint/type-utils": "5.40.0", - "@typescript-eslint/utils": "5.40.0", + "@typescript-eslint/scope-manager": "5.40.1", + "@typescript-eslint/type-utils": "5.40.1", + "@typescript-eslint/utils": "5.40.1", "debug": "^4.3.4", "ignore": "^5.2.0", "regexpp": "^3.2.0", @@ -1011,13 +1017,13 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.0.tgz", - "integrity": "sha512-d3nPmjUeZtEWRvyReMI4I1MwPGC63E8pDoHy0BnrYjnJgilBD3hv7XOiETKLY/zTwI7kCnBDf2vWTRUVpYw0Uw==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.1.tgz", + "integrity": "sha512-jkn4xsJiUQucI16OLCXrLRXDZ3afKhOIqXs4R3O+M00hdQLKR58WuyXPZZjhKLFCEP2g+TXdBRtLQ33UfAdRUg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.40.0", - "@typescript-eslint/visitor-keys": "5.40.0" + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/visitor-keys": "5.40.1" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1028,9 +1034,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz", - "integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.1.tgz", + "integrity": "sha512-Icg9kiuVJSwdzSQvtdGspOlWNjVDnF3qVIKXdJ103o36yRprdl3Ge5cABQx+csx960nuMF21v8qvO31v9t3OHw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1041,12 +1047,12 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz", - "integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.1.tgz", + "integrity": "sha512-A2DGmeZ+FMja0geX5rww+DpvILpwo1OsiQs0M+joPWJYsiEFBLsH0y1oFymPNul6Z5okSmHpP4ivkc2N0Cgfkw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/types": "5.40.1", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1104,13 +1110,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.40.0.tgz", - "integrity": "sha512-nfuSdKEZY2TpnPz5covjJqav+g5qeBqwSHKBvz7Vm1SAfy93SwKk/JeSTymruDGItTwNijSsno5LhOHRS1pcfw==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.40.1.tgz", + "integrity": "sha512-DLAs+AHQOe6n5LRraXiv27IYPhleF0ldEmx6yBqBgBLaNRKTkffhV1RPsjoJBhVup2zHxfaRtan8/YRBgYhU9Q==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.40.0", - "@typescript-eslint/utils": "5.40.0", + "@typescript-eslint/typescript-estree": "5.40.1", + "@typescript-eslint/utils": "5.40.1", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -1131,9 +1137,9 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz", - "integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.1.tgz", + "integrity": "sha512-Icg9kiuVJSwdzSQvtdGspOlWNjVDnF3qVIKXdJ103o36yRprdl3Ge5cABQx+csx960nuMF21v8qvO31v9t3OHw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1144,13 +1150,13 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.0.tgz", - "integrity": "sha512-b0GYlDj8TLTOqwX7EGbw2gL5EXS2CPEWhF9nGJiGmEcmlpNBjyHsTwbqpyIEPVpl6br4UcBOYlcI2FJVtJkYhg==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.1.tgz", + "integrity": "sha512-5QTP/nW5+60jBcEPfXy/EZL01qrl9GZtbgDZtDPlfW5zj/zjNrdI2B5zMUHmOsfvOr2cWqwVdWjobCiHcedmQA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.40.0", - "@typescript-eslint/visitor-keys": "5.40.0", + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/visitor-keys": "5.40.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1171,12 +1177,12 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz", - "integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.1.tgz", + "integrity": "sha512-A2DGmeZ+FMja0geX5rww+DpvILpwo1OsiQs0M+joPWJYsiEFBLsH0y1oFymPNul6Z5okSmHpP4ivkc2N0Cgfkw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/types": "5.40.1", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1230,15 +1236,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.40.0.tgz", - "integrity": "sha512-MO0y3T5BQ5+tkkuYZJBjePewsY+cQnfkYeRqS6tPh28niiIwPnQ1t59CSRcs1ZwJJNOdWw7rv9pF8aP58IMihA==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.40.1.tgz", + "integrity": "sha512-a2TAVScoX9fjryNrW6BZRnreDUszxqm9eQ9Esv8n5nXApMW0zeANUYlwh/DED04SC/ifuBvXgZpIK5xeJHQ3aw==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.40.0", - "@typescript-eslint/types": "5.40.0", - "@typescript-eslint/typescript-estree": "5.40.0", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.40.1", + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/typescript-estree": "5.40.1", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0", "semver": "^7.3.7" @@ -1255,13 +1262,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.0.tgz", - "integrity": "sha512-d3nPmjUeZtEWRvyReMI4I1MwPGC63E8pDoHy0BnrYjnJgilBD3hv7XOiETKLY/zTwI7kCnBDf2vWTRUVpYw0Uw==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.1.tgz", + "integrity": "sha512-jkn4xsJiUQucI16OLCXrLRXDZ3afKhOIqXs4R3O+M00hdQLKR58WuyXPZZjhKLFCEP2g+TXdBRtLQ33UfAdRUg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.40.0", - "@typescript-eslint/visitor-keys": "5.40.0" + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/visitor-keys": "5.40.1" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1272,9 +1279,9 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz", - "integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.1.tgz", + "integrity": "sha512-Icg9kiuVJSwdzSQvtdGspOlWNjVDnF3qVIKXdJ103o36yRprdl3Ge5cABQx+csx960nuMF21v8qvO31v9t3OHw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1285,13 +1292,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.0.tgz", - "integrity": "sha512-b0GYlDj8TLTOqwX7EGbw2gL5EXS2CPEWhF9nGJiGmEcmlpNBjyHsTwbqpyIEPVpl6br4UcBOYlcI2FJVtJkYhg==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.1.tgz", + "integrity": "sha512-5QTP/nW5+60jBcEPfXy/EZL01qrl9GZtbgDZtDPlfW5zj/zjNrdI2B5zMUHmOsfvOr2cWqwVdWjobCiHcedmQA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.40.0", - "@typescript-eslint/visitor-keys": "5.40.0", + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/visitor-keys": "5.40.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1312,12 +1319,12 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz", - "integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.1.tgz", + "integrity": "sha512-A2DGmeZ+FMja0geX5rww+DpvILpwo1OsiQs0M+joPWJYsiEFBLsH0y1oFymPNul6Z5okSmHpP4ivkc2N0Cgfkw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/types": "5.40.1", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -14453,6 +14460,12 @@ "@types/node": "*" } }, + "@types/semver": { + "version": "7.3.12", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.12.tgz", + "integrity": "sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==", + "dev": true + }, "@types/through": { "version": "0.0.30", "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.30.tgz", @@ -14496,14 +14509,14 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.0.tgz", - "integrity": "sha512-FIBZgS3DVJgqPwJzvZTuH4HNsZhHMa9SjxTKAZTlMsPw/UzpEjcf9f4dfgDJEHjK+HboUJo123Eshl6niwEm/Q==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.1.tgz", + "integrity": "sha512-FsWboKkWdytGiXT5O1/R9j37YgcjO8MKHSUmWnIEjVaz0krHkplPnYi7mwdb+5+cs0toFNQb0HIrN7zONdIEWg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.40.0", - "@typescript-eslint/type-utils": "5.40.0", - "@typescript-eslint/utils": "5.40.0", + "@typescript-eslint/scope-manager": "5.40.1", + "@typescript-eslint/type-utils": "5.40.1", + "@typescript-eslint/utils": "5.40.1", "debug": "^4.3.4", "ignore": "^5.2.0", "regexpp": "^3.2.0", @@ -14512,28 +14525,28 @@ }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.0.tgz", - "integrity": "sha512-d3nPmjUeZtEWRvyReMI4I1MwPGC63E8pDoHy0BnrYjnJgilBD3hv7XOiETKLY/zTwI7kCnBDf2vWTRUVpYw0Uw==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.1.tgz", + "integrity": "sha512-jkn4xsJiUQucI16OLCXrLRXDZ3afKhOIqXs4R3O+M00hdQLKR58WuyXPZZjhKLFCEP2g+TXdBRtLQ33UfAdRUg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.40.0", - "@typescript-eslint/visitor-keys": "5.40.0" + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/visitor-keys": "5.40.1" } }, "@typescript-eslint/types": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz", - "integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.1.tgz", + "integrity": "sha512-Icg9kiuVJSwdzSQvtdGspOlWNjVDnF3qVIKXdJ103o36yRprdl3Ge5cABQx+csx960nuMF21v8qvO31v9t3OHw==", "dev": true }, "@typescript-eslint/visitor-keys": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz", - "integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.1.tgz", + "integrity": "sha512-A2DGmeZ+FMja0geX5rww+DpvILpwo1OsiQs0M+joPWJYsiEFBLsH0y1oFymPNul6Z5okSmHpP4ivkc2N0Cgfkw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/types": "5.40.1", "eslint-visitor-keys": "^3.3.0" } } @@ -14564,31 +14577,31 @@ } }, "@typescript-eslint/type-utils": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.40.0.tgz", - "integrity": "sha512-nfuSdKEZY2TpnPz5covjJqav+g5qeBqwSHKBvz7Vm1SAfy93SwKk/JeSTymruDGItTwNijSsno5LhOHRS1pcfw==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.40.1.tgz", + "integrity": "sha512-DLAs+AHQOe6n5LRraXiv27IYPhleF0ldEmx6yBqBgBLaNRKTkffhV1RPsjoJBhVup2zHxfaRtan8/YRBgYhU9Q==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.40.0", - "@typescript-eslint/utils": "5.40.0", + "@typescript-eslint/typescript-estree": "5.40.1", + "@typescript-eslint/utils": "5.40.1", "debug": "^4.3.4", "tsutils": "^3.21.0" }, "dependencies": { "@typescript-eslint/types": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz", - "integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.1.tgz", + "integrity": "sha512-Icg9kiuVJSwdzSQvtdGspOlWNjVDnF3qVIKXdJ103o36yRprdl3Ge5cABQx+csx960nuMF21v8qvO31v9t3OHw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.0.tgz", - "integrity": "sha512-b0GYlDj8TLTOqwX7EGbw2gL5EXS2CPEWhF9nGJiGmEcmlpNBjyHsTwbqpyIEPVpl6br4UcBOYlcI2FJVtJkYhg==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.1.tgz", + "integrity": "sha512-5QTP/nW5+60jBcEPfXy/EZL01qrl9GZtbgDZtDPlfW5zj/zjNrdI2B5zMUHmOsfvOr2cWqwVdWjobCiHcedmQA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.40.0", - "@typescript-eslint/visitor-keys": "5.40.0", + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/visitor-keys": "5.40.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -14597,12 +14610,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz", - "integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.1.tgz", + "integrity": "sha512-A2DGmeZ+FMja0geX5rww+DpvILpwo1OsiQs0M+joPWJYsiEFBLsH0y1oFymPNul6Z5okSmHpP4ivkc2N0Cgfkw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/types": "5.40.1", "eslint-visitor-keys": "^3.3.0" } } @@ -14632,44 +14645,45 @@ } }, "@typescript-eslint/utils": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.40.0.tgz", - "integrity": "sha512-MO0y3T5BQ5+tkkuYZJBjePewsY+cQnfkYeRqS6tPh28niiIwPnQ1t59CSRcs1ZwJJNOdWw7rv9pF8aP58IMihA==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.40.1.tgz", + "integrity": "sha512-a2TAVScoX9fjryNrW6BZRnreDUszxqm9eQ9Esv8n5nXApMW0zeANUYlwh/DED04SC/ifuBvXgZpIK5xeJHQ3aw==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.40.0", - "@typescript-eslint/types": "5.40.0", - "@typescript-eslint/typescript-estree": "5.40.0", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.40.1", + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/typescript-estree": "5.40.1", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0", "semver": "^7.3.7" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.0.tgz", - "integrity": "sha512-d3nPmjUeZtEWRvyReMI4I1MwPGC63E8pDoHy0BnrYjnJgilBD3hv7XOiETKLY/zTwI7kCnBDf2vWTRUVpYw0Uw==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.1.tgz", + "integrity": "sha512-jkn4xsJiUQucI16OLCXrLRXDZ3afKhOIqXs4R3O+M00hdQLKR58WuyXPZZjhKLFCEP2g+TXdBRtLQ33UfAdRUg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.40.0", - "@typescript-eslint/visitor-keys": "5.40.0" + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/visitor-keys": "5.40.1" } }, "@typescript-eslint/types": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz", - "integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.1.tgz", + "integrity": "sha512-Icg9kiuVJSwdzSQvtdGspOlWNjVDnF3qVIKXdJ103o36yRprdl3Ge5cABQx+csx960nuMF21v8qvO31v9t3OHw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.0.tgz", - "integrity": "sha512-b0GYlDj8TLTOqwX7EGbw2gL5EXS2CPEWhF9nGJiGmEcmlpNBjyHsTwbqpyIEPVpl6br4UcBOYlcI2FJVtJkYhg==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.1.tgz", + "integrity": "sha512-5QTP/nW5+60jBcEPfXy/EZL01qrl9GZtbgDZtDPlfW5zj/zjNrdI2B5zMUHmOsfvOr2cWqwVdWjobCiHcedmQA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.40.0", - "@typescript-eslint/visitor-keys": "5.40.0", + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/visitor-keys": "5.40.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -14678,12 +14692,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz", - "integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==", + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.1.tgz", + "integrity": "sha512-A2DGmeZ+FMja0geX5rww+DpvILpwo1OsiQs0M+joPWJYsiEFBLsH0y1oFymPNul6Z5okSmHpP4ivkc2N0Cgfkw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.40.0", + "@typescript-eslint/types": "5.40.1", "eslint-visitor-keys": "^3.3.0" } }, From d4351866fd0dee75b94d8928f2af9e62ab3ffee3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Oct 2022 08:20:18 -0700 Subject: [PATCH 40/69] chore(deps): bump mocha from 10.0.0 to 10.1.0 (#6566) Bumps [mocha](https://github.com/mochajs/mocha) from 10.0.0 to 10.1.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v10.0.0...v10.1.0) --- updated-dependencies: - dependency-name: mocha dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 676787ed0..5e0804f8e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1366,12 +1366,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@ungap/promise-all-settled": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", - "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", - "dev": true - }, "node_modules/@wdio/cli": { "version": "7.16.10", "resolved": "https://registry.npmjs.org/@wdio/cli/-/cli-7.16.10.tgz", @@ -8947,12 +8941,11 @@ "dev": true }, "node_modules/mocha": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.0.0.tgz", - "integrity": "sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.1.0.tgz", + "integrity": "sha512-vUF7IYxEoN7XhQpFLxQAEMtE4W91acW4B6En9l97MwE9stL1A9gusXfoHZCLVHDUJ/7V5+lbCM6yMqzo5vNymg==", "dev": true, "dependencies": { - "@ungap/promise-all-settled": "1.1.2", "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", "chokidar": "3.5.3", @@ -14724,12 +14717,6 @@ "eslint-visitor-keys": "^3.3.0" } }, - "@ungap/promise-all-settled": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", - "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", - "dev": true - }, "@wdio/cli": { "version": "7.16.10", "resolved": "https://registry.npmjs.org/@wdio/cli/-/cli-7.16.10.tgz", @@ -20765,12 +20752,11 @@ "dev": true }, "mocha": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.0.0.tgz", - "integrity": "sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.1.0.tgz", + "integrity": "sha512-vUF7IYxEoN7XhQpFLxQAEMtE4W91acW4B6En9l97MwE9stL1A9gusXfoHZCLVHDUJ/7V5+lbCM6yMqzo5vNymg==", "dev": true, "requires": { - "@ungap/promise-all-settled": "1.1.2", "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", "chokidar": "3.5.3", From 5f70fc415bfde65dcc2c9832b2b680cefcfb39f7 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 19 Oct 2022 10:28:40 -0700 Subject: [PATCH 41/69] chore: update procedure map tests to match the refactored API (#6562) * fix: feedback on procedure model implementations * chore: format * chore: add tests for the backing variable of parameter models * chore: update existing procedure map tests * chore: update block update tests to use refactored API * chore: update tests to actually use fluent API * chore: format * chore: fix tests * chore: reorganize tests * chore: format * chore: add comment --- core/blockly.ts | 1 + core/procedures.ts | 9 + core/procedures/observable_parameter_model.ts | 10 +- core/procedures/observable_procedure_map.ts | 9 +- core/procedures/observable_procedure_model.ts | 5 + tests/mocha/procedure_map_test.js | 155 +++++++++++++----- 6 files changed, 139 insertions(+), 50 deletions(-) diff --git a/core/blockly.ts b/core/blockly.ts index 71c19f77d..41946d4d4 100644 --- a/core/blockly.ts +++ b/core/blockly.ts @@ -602,6 +602,7 @@ export {Css}; export {Events}; export {Extensions}; export {Procedures}; +export {Procedures as procedures}; export {ShortcutItems}; export {Themes}; export {Tooltip}; diff --git a/core/procedures.ts b/core/procedures.ts index 7fad925e6..e31d77d31 100644 --- a/core/procedures.ts +++ b/core/procedures.ts @@ -25,6 +25,9 @@ import * as eventUtils from './events/utils.js'; import {Field, UnattachedFieldError} from './field.js'; import {Msg} from './msg.js'; import {Names} from './names.js'; +import {ObservableProcedureMap} from './procedures/observable_procedure_map.js'; +import {ObservableProcedureModel} from './procedures/observable_procedure_model.js'; +import {ObservableParameterModel} from './procedures/observable_parameter_model.js'; import * as utilsXml from './utils/xml.js'; import * as Variables from './variables.js'; import type {Workspace} from './workspace.js'; @@ -450,3 +453,9 @@ export function getDefinition(name: string, workspace: Workspace): Block|null { } return null; } + +export { + ObservableProcedureMap, + ObservableProcedureModel, + ObservableParameterModel, +}; diff --git a/core/procedures/observable_parameter_model.ts b/core/procedures/observable_parameter_model.ts index 4c74a0505..407b0ad6d 100644 --- a/core/procedures/observable_parameter_model.ts +++ b/core/procedures/observable_parameter_model.ts @@ -17,13 +17,15 @@ export class ObservableParameterModel implements IParameterModel { constructor( private readonly workspace: Workspace, name: string, id?: string) { this.id = id ?? genUid(); - this.variable = workspace.createVariable(name); + this.variable = + this.workspace.getVariable(name) ?? workspace.createVariable(name); } /** * Sets the name of this parameter to the given name. */ setName(name: string): this { + // TODO(#6516): Fire events. if (name == this.variable.name) return this; this.variable = this.workspace.getVariable(name) ?? this.workspace.createVariable(name); @@ -34,12 +36,14 @@ export class ObservableParameterModel implements IParameterModel { * Unimplemented. The built-in ParameterModel does not support typing. * If you want your procedure blocks to have typed parameters, you need to * implement your own ParameterModel. + * + * @throws Throws for the ObservableParameterModel specifically because this + * method is unimplemented. */ setTypes(_types: string[]): this { - console.warn( + throw new Error( 'The built-in ParameterModel does not support typing. You need to ' + 'implement your own custom ParameterModel.'); - return this; } /** diff --git a/core/procedures/observable_procedure_map.ts b/core/procedures/observable_procedure_map.ts index db5edfe68..35ee4a5e7 100644 --- a/core/procedures/observable_procedure_map.ts +++ b/core/procedures/observable_procedure_map.ts @@ -17,7 +17,7 @@ export class ObservableProcedureMap extends Map { * Adds the given procedure model to the procedure map. */ override set(id: string, proc: IProcedureModel): this { - // TODO(#6156): Fire events. + // TODO(#6516): Fire events. super.set(id, proc); return this; } @@ -27,7 +27,7 @@ export class ObservableProcedureMap extends Map { * exists). */ override delete(id: string): boolean { - // TODO(#6156): Fire events. + // TODO(#6516): Fire events. return super.delete(id); } @@ -35,7 +35,7 @@ export class ObservableProcedureMap extends Map { * Removes all ProcedureModels from the procedure map. */ override clear() { - // TODO(#6156): Fire events. + // TODO(#6516): Fire events. super.clear(); } @@ -44,7 +44,8 @@ export class ObservableProcedureMap extends Map { * blocks can find it. */ add(proc: IProcedureModel): this { - // TODO(#6156): Fire events. + // TODO(#6516): Fire events. + // TODO(#6526): See if this method is actually useful. return this.set(proc.getId(), proc); } } diff --git a/core/procedures/observable_procedure_model.ts b/core/procedures/observable_procedure_model.ts index 335667ab9..aa51bb7f9 100644 --- a/core/procedures/observable_procedure_model.ts +++ b/core/procedures/observable_procedure_model.ts @@ -23,6 +23,7 @@ export class ObservableProcedureModel implements IProcedureModel { /** Sets the human-readable name of the procedure. */ setName(name: string): this { + // TODO(#6516): Fire events. this.name = name; return this; } @@ -33,12 +34,14 @@ export class ObservableProcedureModel implements IProcedureModel { * To move a parameter, first delete it, and then re-insert. */ insertParameter(parameterModel: IParameterModel, index: number): this { + // TODO(#6516): Fire events. this.parameters.splice(index, 0, parameterModel); return this; } /** Removes the parameter at the given index from the parameter list. */ deleteParameter(index: number): this { + // TODO(#6516): Fire events. this.parameters.splice(index, 1); return this; } @@ -49,6 +52,7 @@ export class ObservableProcedureModel implements IProcedureModel { * Pass null to represent a procedure that does not return. */ setReturnTypes(types: string[]|null): this { + // TODO(#6516): Fire events. this.returnTypes = types; return this; } @@ -58,6 +62,7 @@ export class ObservableProcedureModel implements IProcedureModel { * all procedure caller blocks should be disabled as well. */ setEnabled(enabled: boolean): this { + // TODO(#6516): Fire events. this.enabled = enabled; return this; } diff --git a/tests/mocha/procedure_map_test.js b/tests/mocha/procedure_map_test.js index 08e5f8137..60a84ad37 100644 --- a/tests/mocha/procedure_map_test.js +++ b/tests/mocha/procedure_map_test.js @@ -8,18 +8,19 @@ import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown goog.declareModuleId('Blockly.test.procedureMap'); -suite.skip('Procedure Map', function() { +suite('Procedure Map', function() { setup(function() { sharedTestSetup.call(this); this.workspace = new Blockly.Workspace(); - this.procedureMap = this.workspace.getProcedureMap(); + // this.procedureMap = this.workspace.getProcedureMap(); }); teardown(function() { sharedTestTeardown.call(this); }); - suite('triggering block updates', function() { + // TODO (#6515): Unskip tests. + suite.skip('triggering block updates', function() { setup(function() { Blockly.Blocks['procedure_mock'] = { init: function() { }, @@ -36,8 +37,17 @@ suite.skip('Procedure Map', function() { }); suite('procedure map updates', function() { + test('inserting a procedure does not trigger an update', function() { + const procedureModel = + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.set(procedureModel.getId(), procedureModel); + + chai.assert.isFalse( + this.updateSpy.called, 'Expected no update to be triggered'); + }); + test('adding a procedure does not trigger an update', function() { - this.procedureMap.addProcedure( + this.procedureMap.add( new Blockly.procedures.ObservableProcedureModel(this.workspace)); chai.assert.isFalse( @@ -47,9 +57,9 @@ suite.skip('Procedure Map', function() { test('deleting a procedure triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); + this.procedureMap.add(procedureModel); - this.procedureMap.deleteProcedure(procedureModel.getId()); + this.procedureMap.delete(procedureModel.getId()); chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); @@ -60,7 +70,7 @@ suite.skip('Procedure Map', function() { test('setting the name triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); + this.procedureMap.add(procedureModel); procedureModel.setName('new name'); @@ -71,9 +81,9 @@ suite.skip('Procedure Map', function() { test('setting the return type triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); + this.procedureMap.add(procedureModel); - procedureModel.setReturnType(['return type 1', 'return type 2']); + procedureModel.setReturnTypes(['return type 1', 'return type 2']); chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); @@ -81,12 +91,12 @@ suite.skip('Procedure Map', function() { test('removing the return type triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); + new Blockly.procedures.ObservableProcedureModel(this.workspace) + .setReturnTypes(['return type']); + this.procedureMap.add(procedureModel); + this.updateSpy.resetHistory(); - procedureModel.setReturnType(['return type']); - this.updateSpy.reset(); - procedureModel.setReturnType(null); + procedureModel.setReturnTypes(null); chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); @@ -95,7 +105,7 @@ suite.skip('Procedure Map', function() { test('disabling the procedure triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); + this.procedureMap.add(procedureModel); procedureModel.setEnabled(false); @@ -105,10 +115,10 @@ suite.skip('Procedure Map', function() { test('enabling the procedure triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); - procedureModel.setEnabled(false); - this.updateSpy.reset(); + new Blockly.procedures.ObservableProcedureModel(this.workspace) + .setEnabled(false); + this.procedureMap.add(procedureModel); + this.updateSpy.resetHistory(); procedureModel.setEnabled(true); @@ -119,7 +129,7 @@ suite.skip('Procedure Map', function() { test('inserting a parameter triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); + this.procedureMap.add(procedureModel); procedureModel.insertParameter( new Blockly.procedures.ObservableParameterModel(this.workspace)); @@ -130,11 +140,12 @@ suite.skip('Procedure Map', function() { test('deleting a parameter triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); - procedureModel.insertParameter( - new Blockly.procedures.ObservableParameterModel(this.workspace)); - this.updateSpy.reset(); + new Blockly.procedures.ObservableProcedureModel(this.workspace) + .insertParameter( + new Blockly.procedures.ObservableParameterModel( + this.workspace)); + this.procedureMap.add(procedureModel); + this.updateSpy.resetHistory(); procedureModel.deleteParameter(0); @@ -144,34 +155,31 @@ suite.skip('Procedure Map', function() { }); suite('parameter model updates', function() { - test('setting the variable model triggers an update', function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); + test('setting the name triggers an update', function() { const parameterModel = - new Blockly.procedures.ObservableParameterModel(this.workspace); - procedureModel.insertParameter(parameterModel); - this.updateSpy.reset(); + new Blockly.procedures.ObservableParameterModel( + this.workspace, 'test1'); + this.procedureMap.add( + new Blockly.procedures.ObservableProcedureModel(this.workspace) + .insertParameter(parameterModel)); + this.updateSpy.resetHistory(); - parameterModel.setVariable( - new Blockly.VariableModel(this.workspace, 'variable')); + parameterModel.setName('test2'); chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); }); test('modifying the variable model does not trigger an update', function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); const parameterModel = - new Blockly.procedures.ObservableParameterModel(this.workspace); - procedureModel.insertParameter(parameterModel); - const variableModel = - new Blockly.VariableModel(this.workspace, 'variable'); - parameterModel.setVariable(variableModel); - this.updateSpy.reset(); + new Blockly.procedures.ObservableParameterModel( + this.workspace, 'test1'); + this.procedureMap.add( + new Blockly.procedures.ObservableProcedureModel(this.workspace) + .insertParameter(parameterModel)); + this.updateSpy.resetHistory(); + const variableModel = parameterModel.getVariableModel(); variableModel.name = 'some name'; variableModel.type = 'some type'; @@ -184,4 +192,65 @@ suite.skip('Procedure Map', function() { suite('event firing', function() { // TBA after the procedure map is implemented }); + + suite('backing variable to parameters', function() { + test( + 'construction references an existing variable if available', + function() { + const variable = this.workspace.createVariable('test1'); + const param = new Blockly.procedures.ObservableParameterModel( + this.workspace, 'test1'); + + chai.assert.equal( + variable, + param.getVariableModel(), + 'Expected the parameter model to reference the existing variable'); + }); + + test('construction creates a variable if none exists', function() { + const param = new Blockly.procedures.ObservableParameterModel( + this.workspace, 'test1'); + + chai.assert.equal( + this.workspace.getVariable('test1'), + param.getVariableModel(), + 'Expected the parameter model to create a variable'); + }); + + test('setName references an existing variable if available', function() { + const variable = this.workspace.createVariable('test2'); + const param = new Blockly.procedures.ObservableParameterModel( + this.workspace, 'test1'); + + param.setName('test2'); + + chai.assert.equal( + variable, + param.getVariableModel(), + 'Expected the parameter model to reference the existing variable'); + }); + + test('setName creates a variable if none exits', function() { + const param = new Blockly.procedures.ObservableParameterModel( + this.workspace, 'test1'); + + param.setName('test2'); + + chai.assert.equal( + this.workspace.getVariable('test2'), + param.getVariableModel(), + 'Expected the parameter model to create a variable'); + }); + + test('setTypes is unimplemented', function() { + const param = new Blockly.procedures.ObservableParameterModel( + this.workspace, 'test1'); + + chai.assert.throws( + () => { + param.setTypes(['some', 'types']); + }, + 'The built-in ParameterModel does not support typing'); + }); + }); }); From d58844d23cb41974ad72e428e299fe7e4dfd17c1 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 19 Oct 2022 10:42:32 -0700 Subject: [PATCH 42/69] Revert "chore: update procedure map tests to match the refactored API (#6562)" (#6568) This reverts commit 5f70fc415bfde65dcc2c9832b2b680cefcfb39f7. --- core/blockly.ts | 1 - core/procedures.ts | 9 - core/procedures/observable_parameter_model.ts | 10 +- core/procedures/observable_procedure_map.ts | 9 +- core/procedures/observable_procedure_model.ts | 5 - tests/mocha/procedure_map_test.js | 155 +++++------------- 6 files changed, 50 insertions(+), 139 deletions(-) diff --git a/core/blockly.ts b/core/blockly.ts index 41946d4d4..71c19f77d 100644 --- a/core/blockly.ts +++ b/core/blockly.ts @@ -602,7 +602,6 @@ export {Css}; export {Events}; export {Extensions}; export {Procedures}; -export {Procedures as procedures}; export {ShortcutItems}; export {Themes}; export {Tooltip}; diff --git a/core/procedures.ts b/core/procedures.ts index e31d77d31..7fad925e6 100644 --- a/core/procedures.ts +++ b/core/procedures.ts @@ -25,9 +25,6 @@ import * as eventUtils from './events/utils.js'; import {Field, UnattachedFieldError} from './field.js'; import {Msg} from './msg.js'; import {Names} from './names.js'; -import {ObservableProcedureMap} from './procedures/observable_procedure_map.js'; -import {ObservableProcedureModel} from './procedures/observable_procedure_model.js'; -import {ObservableParameterModel} from './procedures/observable_parameter_model.js'; import * as utilsXml from './utils/xml.js'; import * as Variables from './variables.js'; import type {Workspace} from './workspace.js'; @@ -453,9 +450,3 @@ export function getDefinition(name: string, workspace: Workspace): Block|null { } return null; } - -export { - ObservableProcedureMap, - ObservableProcedureModel, - ObservableParameterModel, -}; diff --git a/core/procedures/observable_parameter_model.ts b/core/procedures/observable_parameter_model.ts index 407b0ad6d..4c74a0505 100644 --- a/core/procedures/observable_parameter_model.ts +++ b/core/procedures/observable_parameter_model.ts @@ -17,15 +17,13 @@ export class ObservableParameterModel implements IParameterModel { constructor( private readonly workspace: Workspace, name: string, id?: string) { this.id = id ?? genUid(); - this.variable = - this.workspace.getVariable(name) ?? workspace.createVariable(name); + this.variable = workspace.createVariable(name); } /** * Sets the name of this parameter to the given name. */ setName(name: string): this { - // TODO(#6516): Fire events. if (name == this.variable.name) return this; this.variable = this.workspace.getVariable(name) ?? this.workspace.createVariable(name); @@ -36,14 +34,12 @@ export class ObservableParameterModel implements IParameterModel { * Unimplemented. The built-in ParameterModel does not support typing. * If you want your procedure blocks to have typed parameters, you need to * implement your own ParameterModel. - * - * @throws Throws for the ObservableParameterModel specifically because this - * method is unimplemented. */ setTypes(_types: string[]): this { - throw new Error( + console.warn( 'The built-in ParameterModel does not support typing. You need to ' + 'implement your own custom ParameterModel.'); + return this; } /** diff --git a/core/procedures/observable_procedure_map.ts b/core/procedures/observable_procedure_map.ts index 35ee4a5e7..db5edfe68 100644 --- a/core/procedures/observable_procedure_map.ts +++ b/core/procedures/observable_procedure_map.ts @@ -17,7 +17,7 @@ export class ObservableProcedureMap extends Map { * Adds the given procedure model to the procedure map. */ override set(id: string, proc: IProcedureModel): this { - // TODO(#6516): Fire events. + // TODO(#6156): Fire events. super.set(id, proc); return this; } @@ -27,7 +27,7 @@ export class ObservableProcedureMap extends Map { * exists). */ override delete(id: string): boolean { - // TODO(#6516): Fire events. + // TODO(#6156): Fire events. return super.delete(id); } @@ -35,7 +35,7 @@ export class ObservableProcedureMap extends Map { * Removes all ProcedureModels from the procedure map. */ override clear() { - // TODO(#6516): Fire events. + // TODO(#6156): Fire events. super.clear(); } @@ -44,8 +44,7 @@ export class ObservableProcedureMap extends Map { * blocks can find it. */ add(proc: IProcedureModel): this { - // TODO(#6516): Fire events. - // TODO(#6526): See if this method is actually useful. + // TODO(#6156): Fire events. return this.set(proc.getId(), proc); } } diff --git a/core/procedures/observable_procedure_model.ts b/core/procedures/observable_procedure_model.ts index aa51bb7f9..335667ab9 100644 --- a/core/procedures/observable_procedure_model.ts +++ b/core/procedures/observable_procedure_model.ts @@ -23,7 +23,6 @@ export class ObservableProcedureModel implements IProcedureModel { /** Sets the human-readable name of the procedure. */ setName(name: string): this { - // TODO(#6516): Fire events. this.name = name; return this; } @@ -34,14 +33,12 @@ export class ObservableProcedureModel implements IProcedureModel { * To move a parameter, first delete it, and then re-insert. */ insertParameter(parameterModel: IParameterModel, index: number): this { - // TODO(#6516): Fire events. this.parameters.splice(index, 0, parameterModel); return this; } /** Removes the parameter at the given index from the parameter list. */ deleteParameter(index: number): this { - // TODO(#6516): Fire events. this.parameters.splice(index, 1); return this; } @@ -52,7 +49,6 @@ export class ObservableProcedureModel implements IProcedureModel { * Pass null to represent a procedure that does not return. */ setReturnTypes(types: string[]|null): this { - // TODO(#6516): Fire events. this.returnTypes = types; return this; } @@ -62,7 +58,6 @@ export class ObservableProcedureModel implements IProcedureModel { * all procedure caller blocks should be disabled as well. */ setEnabled(enabled: boolean): this { - // TODO(#6516): Fire events. this.enabled = enabled; return this; } diff --git a/tests/mocha/procedure_map_test.js b/tests/mocha/procedure_map_test.js index 60a84ad37..08e5f8137 100644 --- a/tests/mocha/procedure_map_test.js +++ b/tests/mocha/procedure_map_test.js @@ -8,19 +8,18 @@ import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown goog.declareModuleId('Blockly.test.procedureMap'); -suite('Procedure Map', function() { +suite.skip('Procedure Map', function() { setup(function() { sharedTestSetup.call(this); this.workspace = new Blockly.Workspace(); - // this.procedureMap = this.workspace.getProcedureMap(); + this.procedureMap = this.workspace.getProcedureMap(); }); teardown(function() { sharedTestTeardown.call(this); }); - // TODO (#6515): Unskip tests. - suite.skip('triggering block updates', function() { + suite('triggering block updates', function() { setup(function() { Blockly.Blocks['procedure_mock'] = { init: function() { }, @@ -37,17 +36,8 @@ suite('Procedure Map', function() { }); suite('procedure map updates', function() { - test('inserting a procedure does not trigger an update', function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.set(procedureModel.getId(), procedureModel); - - chai.assert.isFalse( - this.updateSpy.called, 'Expected no update to be triggered'); - }); - test('adding a procedure does not trigger an update', function() { - this.procedureMap.add( + this.procedureMap.addProcedure( new Blockly.procedures.ObservableProcedureModel(this.workspace)); chai.assert.isFalse( @@ -57,9 +47,9 @@ suite('Procedure Map', function() { test('deleting a procedure triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); + this.procedureMap.addProcedure(procedureModel); - this.procedureMap.delete(procedureModel.getId()); + this.procedureMap.deleteProcedure(procedureModel.getId()); chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); @@ -70,7 +60,7 @@ suite('Procedure Map', function() { test('setting the name triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); + this.procedureMap.addProcedure(procedureModel); procedureModel.setName('new name'); @@ -81,9 +71,9 @@ suite('Procedure Map', function() { test('setting the return type triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); + this.procedureMap.addProcedure(procedureModel); - procedureModel.setReturnTypes(['return type 1', 'return type 2']); + procedureModel.setReturnType(['return type 1', 'return type 2']); chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); @@ -91,12 +81,12 @@ suite('Procedure Map', function() { test('removing the return type triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .setReturnTypes(['return type']); - this.procedureMap.add(procedureModel); - this.updateSpy.resetHistory(); + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); - procedureModel.setReturnTypes(null); + procedureModel.setReturnType(['return type']); + this.updateSpy.reset(); + procedureModel.setReturnType(null); chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); @@ -105,7 +95,7 @@ suite('Procedure Map', function() { test('disabling the procedure triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); + this.procedureMap.addProcedure(procedureModel); procedureModel.setEnabled(false); @@ -115,10 +105,10 @@ suite('Procedure Map', function() { test('enabling the procedure triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .setEnabled(false); - this.procedureMap.add(procedureModel); - this.updateSpy.resetHistory(); + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); + procedureModel.setEnabled(false); + this.updateSpy.reset(); procedureModel.setEnabled(true); @@ -129,7 +119,7 @@ suite('Procedure Map', function() { test('inserting a parameter triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); + this.procedureMap.addProcedure(procedureModel); procedureModel.insertParameter( new Blockly.procedures.ObservableParameterModel(this.workspace)); @@ -140,12 +130,11 @@ suite('Procedure Map', function() { test('deleting a parameter triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .insertParameter( - new Blockly.procedures.ObservableParameterModel( - this.workspace)); - this.procedureMap.add(procedureModel); - this.updateSpy.resetHistory(); + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); + procedureModel.insertParameter( + new Blockly.procedures.ObservableParameterModel(this.workspace)); + this.updateSpy.reset(); procedureModel.deleteParameter(0); @@ -155,31 +144,34 @@ suite('Procedure Map', function() { }); suite('parameter model updates', function() { - test('setting the name triggers an update', function() { + test('setting the variable model triggers an update', function() { + const procedureModel = + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); const parameterModel = - new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test1'); - this.procedureMap.add( - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .insertParameter(parameterModel)); - this.updateSpy.resetHistory(); + new Blockly.procedures.ObservableParameterModel(this.workspace); + procedureModel.insertParameter(parameterModel); + this.updateSpy.reset(); - parameterModel.setName('test2'); + parameterModel.setVariable( + new Blockly.VariableModel(this.workspace, 'variable')); chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); }); test('modifying the variable model does not trigger an update', function() { + const procedureModel = + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.addProcedure(procedureModel); const parameterModel = - new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test1'); - this.procedureMap.add( - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .insertParameter(parameterModel)); - this.updateSpy.resetHistory(); + new Blockly.procedures.ObservableParameterModel(this.workspace); + procedureModel.insertParameter(parameterModel); + const variableModel = + new Blockly.VariableModel(this.workspace, 'variable'); + parameterModel.setVariable(variableModel); + this.updateSpy.reset(); - const variableModel = parameterModel.getVariableModel(); variableModel.name = 'some name'; variableModel.type = 'some type'; @@ -192,65 +184,4 @@ suite('Procedure Map', function() { suite('event firing', function() { // TBA after the procedure map is implemented }); - - suite('backing variable to parameters', function() { - test( - 'construction references an existing variable if available', - function() { - const variable = this.workspace.createVariable('test1'); - const param = new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test1'); - - chai.assert.equal( - variable, - param.getVariableModel(), - 'Expected the parameter model to reference the existing variable'); - }); - - test('construction creates a variable if none exists', function() { - const param = new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test1'); - - chai.assert.equal( - this.workspace.getVariable('test1'), - param.getVariableModel(), - 'Expected the parameter model to create a variable'); - }); - - test('setName references an existing variable if available', function() { - const variable = this.workspace.createVariable('test2'); - const param = new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test1'); - - param.setName('test2'); - - chai.assert.equal( - variable, - param.getVariableModel(), - 'Expected the parameter model to reference the existing variable'); - }); - - test('setName creates a variable if none exits', function() { - const param = new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test1'); - - param.setName('test2'); - - chai.assert.equal( - this.workspace.getVariable('test2'), - param.getVariableModel(), - 'Expected the parameter model to create a variable'); - }); - - test('setTypes is unimplemented', function() { - const param = new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test1'); - - chai.assert.throws( - () => { - param.setTypes(['some', 'types']); - }, - 'The built-in ParameterModel does not support typing'); - }); - }); }); From ca4df2f8d056ae1afdf83636c52c70380411fbca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Oct 2022 08:12:10 -0700 Subject: [PATCH 43/69] chore(deps): bump peter-evans/create-pull-request from 4.1.4 to 4.2.0 (#6580) Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 4.1.4 to 4.2.0. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/ad43dccb4d726ca8514126628bec209b8354b6dd...b4d51739f96fca8047ad065eccef63442d8e99f7) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/update_metadata.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update_metadata.yml b/.github/workflows/update_metadata.yml index 8a1414f98..d360e2195 100644 --- a/.github/workflows/update_metadata.yml +++ b/.github/workflows/update_metadata.yml @@ -36,7 +36,7 @@ jobs: run: source ./tests/scripts/update_metadata.sh - name: Create Pull Request - uses: peter-evans/create-pull-request@ad43dccb4d726ca8514126628bec209b8354b6dd + uses: peter-evans/create-pull-request@b4d51739f96fca8047ad065eccef63442d8e99f7 with: commit-message: Update build artifact sizes in check_metadata.sh delete-branch: true From daee18010edc8c93be9b3b4e3dccec82f19a9312 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Oct 2022 08:12:37 -0700 Subject: [PATCH 44/69] chore(deps): bump @blockly/theme-modern from 3.0.0 to 3.0.1 (#6579) Bumps [@blockly/theme-modern](https://github.com/google/blockly-samples/tree/HEAD/plugins/theme-modern) from 3.0.0 to 3.0.1. - [Release notes](https://github.com/google/blockly-samples/releases) - [Changelog](https://github.com/google/blockly-samples/blob/master/plugins/theme-modern/CHANGELOG.md) - [Commits](https://github.com/google/blockly-samples/commits/@blockly/theme-modern@3.0.1/plugins/theme-modern) --- updated-dependencies: - dependency-name: "@blockly/theme-modern" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] 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 5e0804f8e..598b24e39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -231,9 +231,9 @@ } }, "node_modules/@blockly/theme-modern": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@blockly/theme-modern/-/theme-modern-3.0.0.tgz", - "integrity": "sha512-E7J70ymzxEOb4uDft2V6zeZ8XqX/DBHsRDZx3Ji6uQbFXjIAQpokhz7n+1epBTF625vxF/D87PG4z2eF7kupYA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@blockly/theme-modern/-/theme-modern-3.0.1.tgz", + "integrity": "sha512-rKB5NrAGFF+Vo4aIfk+zbXZYfKDULPMFNWkT5dS0cyMSNHvcy7Xgi3llq29YhTG/LLicOjitSc8cErcZsicjng==", "dev": true, "engines": { "node": ">=8.17.0" @@ -13844,9 +13844,9 @@ "requires": {} }, "@blockly/theme-modern": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@blockly/theme-modern/-/theme-modern-3.0.0.tgz", - "integrity": "sha512-E7J70ymzxEOb4uDft2V6zeZ8XqX/DBHsRDZx3Ji6uQbFXjIAQpokhz7n+1epBTF625vxF/D87PG4z2eF7kupYA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@blockly/theme-modern/-/theme-modern-3.0.1.tgz", + "integrity": "sha512-rKB5NrAGFF+Vo4aIfk+zbXZYfKDULPMFNWkT5dS0cyMSNHvcy7Xgi3llq29YhTG/LLicOjitSc8cErcZsicjng==", "dev": true, "requires": {} }, From f22303b91d317fdd33f5137e992737d34275401e Mon Sep 17 00:00:00 2001 From: Blake Thomas Williams <49404493+btw17@users.noreply.github.com> Date: Mon, 24 Oct 2022 16:35:25 -0500 Subject: [PATCH 45/69] chore: added type information to `core/field_dropdown.ts` (#6550) * chore: added generator type to `core/field_dropdown.ts` and updated affected files * chore: added type to ARROW_CHAR in `core/field_dropdown.ts` * chore: cleaned up misc 'AnyDuringMigration' cases and related comments * fix: misc adjustments from PR feedback * Fix: simplified `getOptions` * fix: removed outdated arrow and cleaned up formatting * fix: cleanup format after rebase --- core/blockly.ts | 4 +- core/field_dropdown.ts | 305 ++++++++++++++++++++--------------------- core/field_variable.ts | 15 +- 3 files changed, 153 insertions(+), 171 deletions(-) diff --git a/core/blockly.ts b/core/blockly.ts index 71c19f77d..b236c2118 100644 --- a/core/blockly.ts +++ b/core/blockly.ts @@ -57,7 +57,7 @@ import {Field} from './field.js'; import {FieldAngle} from './field_angle.js'; import {FieldCheckbox} from './field_checkbox.js'; import {FieldColour} from './field_colour.js'; -import {FieldDropdown} from './field_dropdown.js'; +import {FieldDropdown, MenuGenerator, MenuGeneratorFunction, MenuOption} from './field_dropdown.js'; import {FieldImage} from './field_image.js'; import {FieldLabel} from './field_label.js'; import {FieldLabelSerializable} from './field_label_serializable.js'; @@ -651,7 +651,7 @@ export {Field}; export {FieldAngle}; export {FieldCheckbox}; export {FieldColour}; -export {FieldDropdown}; +export {FieldDropdown, MenuGenerator, MenuGeneratorFunction, MenuOption}; export {FieldImage}; export {FieldLabel}; export {FieldLabelSerializable}; diff --git a/core/field_dropdown.ts b/core/field_dropdown.ts index 87580726f..4615db5ef 100644 --- a/core/field_dropdown.ts +++ b/core/field_dropdown.ts @@ -27,8 +27,6 @@ import * as parsing from './utils/parsing.js'; import type {Sentinel} from './utils/sentinel.js'; import * as utilsString from './utils/string.js'; import {Svg} from './utils/svg.js'; -import * as userAgent from './utils/useragent.js'; - /** * Class for an editable dropdown field. @@ -44,7 +42,8 @@ export class FieldDropdown extends Field { * height. */ static MAX_MENU_HEIGHT_VH = 0.45; - static ARROW_CHAR: AnyDuringMigration; + + static ARROW_CHAR = '▾'; /** A reference to the currently selected menu item. */ private selectedMenuItem_: MenuItem|null = null; @@ -71,14 +70,11 @@ export class FieldDropdown extends Field { /** Mouse cursor style when over the hotspot that initiates the editor. */ override CURSOR = 'default'; - // TODO(b/109816955): remove '!', see go/strict-prop-init-fix. - protected menuGenerator_!: AnyDuringMigration[][]| - ((this: FieldDropdown) => AnyDuringMigration[][]); + + protected menuGenerator_?: MenuGenerator; /** A cache of the most recently generated options. */ - // AnyDuringMigration because: Type 'null' is not assignable to type - // 'string[][]'. - private generatedOptions_: string[][] = null as AnyDuringMigration; + private generatedOptions_: MenuOption[]|null = null; /** * The prefix field label, of common words set after options are trimmed. @@ -95,7 +91,7 @@ export class FieldDropdown extends Field { override suffixField: string|null = null; // TODO(b/109816955): remove '!', see go/strict-prop-init-fix. private selectedOption_!: Array; - override clickTarget_: AnyDuringMigration; + override clickTarget_: SVGElement|null = null; /** * @param menuGenerator A non-empty array of options for a dropdown list, or a @@ -114,30 +110,31 @@ export class FieldDropdown extends Field { * @throws {TypeError} If `menuGenerator` options are incorrectly structured. */ constructor( - menuGenerator: AnyDuringMigration[][]|Function|Sentinel, - opt_validator?: Function, opt_config?: FieldConfig) { + menuGenerator: MenuGenerator, + opt_validator?: Function, + opt_config?: FieldConfig, + ); + constructor(menuGenerator: Sentinel); + constructor( + menuGenerator: MenuGenerator|Sentinel, + opt_validator?: Function, + opt_config?: FieldConfig, + ) { super(Field.SKIP_SETUP); // If we pass SKIP_SETUP, don't do *anything* with the menu generator. - if (menuGenerator === Field.SKIP_SETUP) { - return; - } + if (!isMenuGenerator(menuGenerator)) return; if (Array.isArray(menuGenerator)) { validateOptions(menuGenerator); - // Deep copy the option structure so it doesn't change. - menuGenerator = JSON.parse(JSON.stringify(menuGenerator)); + const trimmed = trimOptions(menuGenerator); + this.menuGenerator_ = trimmed.options; + this.prefixField = trimmed.prefix || null; + this.suffixField = trimmed.suffix || null; + } else { + this.menuGenerator_ = menuGenerator; } - /** - * An array of options for a dropdown list, - * or a function which generates these options. - */ - this.menuGenerator_ = menuGenerator as AnyDuringMigration[][] | - ((this: FieldDropdown) => AnyDuringMigration[][]); - - this.trimOptions_(); - /** * The currently selected option. The field is initialized with the * first option selected. @@ -227,14 +224,9 @@ export class FieldDropdown extends Field { this.getSourceBlock()?.RTL ? FieldDropdown.ARROW_CHAR + ' ' : ' ' + FieldDropdown.ARROW_CHAR)); if (this.getSourceBlock()?.RTL) { - // AnyDuringMigration because: Argument of type 'SVGTSpanElement | null' - // is not assignable to parameter of type 'Node'. - this.getTextElement().insertBefore( - this.arrow_ as AnyDuringMigration, this.textContent_); + this.getTextElement().insertBefore(this.arrow_, this.textContent_); } else { - // AnyDuringMigration because: Argument of type 'SVGTSpanElement | null' - // is not assignable to parameter of type 'Node'. - this.getTextElement().appendChild(this.arrow_ as AnyDuringMigration); + this.getTextElement().appendChild(this.arrow_); } } @@ -257,21 +249,14 @@ export class FieldDropdown extends Field { * @param opt_e Optional mouse event that triggered the field to open, or * undefined if triggered programmatically. */ - protected override showEditor_(opt_e?: Event) { + protected override showEditor_(opt_e?: MouseEvent) { const block = this.getSourceBlock(); if (!block) { throw new UnattachedFieldError(); } this.dropdownCreate_(); - // AnyDuringMigration because: Property 'clientX' does not exist on type - // 'Event'. - if (opt_e && typeof (opt_e as AnyDuringMigration).clientX === 'number') { - // AnyDuringMigration because: Property 'clientY' does not exist on type - // 'Event'. AnyDuringMigration because: Property 'clientX' does not exist - // on type 'Event'. - this.menu_!.openingCoords = new Coordinate( - (opt_e as AnyDuringMigration).clientX, - (opt_e as AnyDuringMigration).clientY); + if (opt_e && typeof opt_e.clientX === 'number') { + this.menu_!.openingCoords = new Coordinate(opt_e.clientX, opt_e.clientY); } else { this.menu_!.openingCoords = null; } @@ -318,15 +303,17 @@ export class FieldDropdown extends Field { const options = this.getOptions(false); this.selectedMenuItem_ = null; for (let i = 0; i < options.length; i++) { - let content = options[i][0]; // Human-readable text or image. - const value = options[i][1]; // Language-neutral value. - if (typeof content === 'object') { - // An image, not text. - const image = new Image(content['width'], content['height']); - image.src = content['src']; - image.alt = content['alt'] || ''; - content = image; - } + const [label, value] = options[i]; + const content = (() => { + if (typeof label === 'object') { + // Convert ImageProperties to an HTMLImageElement. + const image = new Image(label['width'], label['height']); + image.src = label['src']; + image.alt = label['alt'] || ''; + return image; + } + return label; + })(); const menuItem = new MenuItem(content, value); menuItem.setRole(aria.Role.OPTION); menuItem.setRightToLeft(block.RTL); @@ -372,57 +359,6 @@ export class FieldDropdown extends Field { this.setValue(menuItem.getValue()); } - /** - * Factor out common words in statically defined options. - * Create prefix and/or suffix labels. - */ - private trimOptions_() { - const options = this.menuGenerator_; - if (!Array.isArray(options)) { - return; - } - let hasImages = false; - - // Localize label text and image alt text. - for (let i = 0; i < options.length; i++) { - const label = options[i][0]; - if (typeof label === 'string') { - options[i][0] = parsing.replaceMessageReferences(label); - } else { - if (label.alt !== null) { - options[i][0].alt = parsing.replaceMessageReferences(label.alt); - } - hasImages = true; - } - } - if (hasImages || options.length < 2) { - return; // Do nothing if too few items or at least one label is an image. - } - const strings = []; - for (let i = 0; i < options.length; i++) { - strings.push(options[i][0]); - } - const shortest = utilsString.shortestStringLength(strings); - const prefixLength = utilsString.commonWordPrefix(strings, shortest); - const suffixLength = utilsString.commonWordSuffix(strings, shortest); - if (!prefixLength && !suffixLength) { - return; - } - if (shortest <= prefixLength + suffixLength) { - // One or more strings will entirely vanish if we proceed. Abort. - return; - } - if (prefixLength) { - this.prefixField = strings[0].substring(0, prefixLength - 1); - } - if (suffixLength) { - this.suffixField = strings[0].substr(1 - suffixLength); - } - - this.menuGenerator_ = - FieldDropdown.applyTrim_(options, prefixLength, suffixLength); - } - /** * @returns True if the option list is generated by a function. * Otherwise false. @@ -440,18 +376,18 @@ export class FieldDropdown extends Field { * (human-readable text or image, language-neutral name). * @throws {TypeError} If generated options are incorrectly structured. */ - getOptions(opt_useCache?: boolean): AnyDuringMigration[][] { - if (this.isOptionListDynamic()) { - if (!this.generatedOptions_ || !opt_useCache) { - // AnyDuringMigration because: Property 'call' does not exist on type - // 'any[][] | ((this: FieldDropdown) => any[][])'. - this.generatedOptions_ = - (this.menuGenerator_ as AnyDuringMigration).call(this); - validateOptions(this.generatedOptions_); - } - return this.generatedOptions_; + getOptions(opt_useCache?: boolean): MenuOption[] { + if (!this.menuGenerator_) { + // A subclass improperly skipped setup without defining the menu + // generator. + throw TypeError('A menu generator was never defined.'); } - return this.menuGenerator_ as string[][]; + if (Array.isArray(this.menuGenerator_)) return this.menuGenerator_; + if (opt_useCache && this.generatedOptions_) return this.generatedOptions_; + + this.generatedOptions_ = this.menuGenerator_(); + validateOptions(this.generatedOptions_); + return this.generatedOptions_; } /** @@ -460,17 +396,11 @@ export class FieldDropdown extends Field { * @param opt_newValue The input value. * @returns A valid language-neutral option, or null if invalid. */ - protected override doClassValidation_(opt_newValue?: AnyDuringMigration): - string|null { - let isValueValid = false; + protected override doClassValidation_(opt_newValue?: MenuOption[1]): string + |null { const options = this.getOptions(true); - for (let i = 0, option; option = options[i]; i++) { - // Options are tuples of human-readable text and language-neutral values. - if (option[1] === opt_newValue) { - isValueValid = true; - break; - } - } + const isValueValid = options.some((option) => option[1] === opt_newValue); + if (!isValueValid) { if (this.sourceBlock_) { console.warn( @@ -489,7 +419,7 @@ export class FieldDropdown extends Field { * @param newValue The value to be saved. The default validator guarantees * that this is one of the valid dropdown options. */ - protected override doValueUpdate_(newValue: AnyDuringMigration) { + protected override doValueUpdate_(newValue: MenuOption[1]) { super.doValueUpdate_(newValue); const options = this.getOptions(true); for (let i = 0, option; option = options[i]; i++) { @@ -554,14 +484,8 @@ export class FieldDropdown extends Field { this.imageElement_!.style.display = ''; this.imageElement_!.setAttributeNS( dom.XLINK_NS, 'xlink:href', imageJson.src); - // AnyDuringMigration because: Argument of type 'number' is not assignable - // to parameter of type 'string'. - this.imageElement_!.setAttribute( - 'height', imageJson.height as AnyDuringMigration); - // AnyDuringMigration because: Argument of type 'number' is not assignable - // to parameter of type 'string'. - this.imageElement_!.setAttribute( - 'width', imageJson.width as AnyDuringMigration); + this.imageElement_!.setAttribute('height', `${imageJson.height}`); + this.imageElement_!.setAttribute('width', `${imageJson.width}`); const imageHeight = Number(imageJson.height); const imageWidth = Number(imageJson.width); @@ -697,30 +621,6 @@ export class FieldDropdown extends Field { // override the static fromJson method. return new this(options.options, undefined, options); } - - /** - * Use the calculated prefix and suffix lengths to trim all of the options in - * the given array. - * - * @param options Array of option tuples: - * (human-readable text or image, language-neutral name). - * @param prefixLength The length of the common prefix. - * @param suffixLength The length of the common suffix - * @returns A new array with all of the option text trimmed. - */ - static applyTrim_( - options: AnyDuringMigration[][], prefixLength: number, - suffixLength: number): AnyDuringMigration[][] { - const newOptions = []; - // Remove the prefix and suffix from the options. - for (let i = 0; i < options.length; i++) { - let text = options[i][0]; - const value = options[i][1]; - text = text.substring(prefixLength, text.length - suffixLength); - newOptions[i] = [text, value]; - } - return newOptions; - } } /** @@ -740,6 +640,18 @@ export interface ImageProperties { */ export type MenuOption = [string | ImageProperties, string]; +/** + * A function that generates an array of menu options for FieldDropdown + * or its descendants. + */ +export type MenuGeneratorFunction = (this: FieldDropdown) => MenuOption[]; + +/** + * Either an array of menu options or a function that generates an array of + * menu options for FieldDropdown or its descendants. + */ +export type MenuGenerator = MenuOption[]|MenuGeneratorFunction; + /** * fromJson config for the dropdown field. */ @@ -756,8 +668,81 @@ const IMAGE_Y_OFFSET = 5; /** The total vertical padding above and below an image. */ const IMAGE_Y_PADDING: number = IMAGE_Y_OFFSET * 2; -/** Android can't (in 2014) display "▾", so use "▼" instead. */ -FieldDropdown.ARROW_CHAR = userAgent.ANDROID ? '▼' : '▾'; +/** + * NOTE: Because Sentinel is an empty class, proving a value is Sentinel does + * not resolve in TS that it isn't a MenuGenerator. + */ +function isMenuGenerator(menuGenerator: MenuGenerator| + Sentinel): menuGenerator is MenuGenerator { + return menuGenerator !== Field.SKIP_SETUP; +} + +/** + * Factor out common words in statically defined options. + * Create prefix and/or suffix labels. + */ +function trimOptions(options: MenuOption[]): + {options: MenuOption[]; prefix?: string; suffix?: string;} { + let hasImages = false; + const trimmedOptions = options.map(([label, value]): MenuOption => { + if (typeof label === 'string') { + return [parsing.replaceMessageReferences(label), value]; + } + + hasImages = true; + // Copy the image properties so they're not influenced by the original. + // NOTE: No need to deep copy since image properties are only 1 level deep. + const imageLabel = label.alt !== null ? + {...label, alt: parsing.replaceMessageReferences(label.alt)} : + {...label}; + return [imageLabel, value]; + }); + + if (hasImages || options.length < 2) return {options: trimmedOptions}; + + const stringOptions = trimmedOptions as [string, string][]; + const stringLabels = stringOptions.map(([label]) => label); + + const shortest = utilsString.shortestStringLength(stringLabels); + const prefixLength = utilsString.commonWordPrefix(stringLabels, shortest); + const suffixLength = utilsString.commonWordSuffix(stringLabels, shortest); + + if ((!prefixLength && !suffixLength) || + (shortest <= prefixLength + suffixLength)) { + // One or more strings will entirely vanish if we proceed. Abort. + return {options: stringOptions}; + } + + const prefix = + prefixLength ? stringLabels[0].substring(0, prefixLength - 1) : undefined; + const suffix = + suffixLength ? stringLabels[0].substr(1 - suffixLength) : undefined; + return { + options: applyTrim(stringOptions, prefixLength, suffixLength), + prefix, + suffix, + }; +} + +/** + * Use the calculated prefix and suffix lengths to trim all of the options in + * the given array. + * + * @param options Array of option tuples: + * (human-readable text or image, language-neutral name). + * @param prefixLength The length of the common prefix. + * @param suffixLength The length of the common suffix + * @returns A new array with all of the option text trimmed. + */ +function applyTrim( + options: [string, string][], prefixLength: number, + suffixLength: number): MenuOption[] { + return options.map( + ([text, value]) => + [text.substring(prefixLength, text.length - suffixLength), + value, + ]); +} /** * Validates the data structure to be processed as an options list. @@ -765,7 +750,7 @@ FieldDropdown.ARROW_CHAR = userAgent.ANDROID ? '▼' : '▾'; * @param options The proposed dropdown options. * @throws {TypeError} If proposed options are incorrectly structured. */ -function validateOptions(options: AnyDuringMigration) { +function validateOptions(options: MenuOption[]) { if (!Array.isArray(options)) { throw TypeError('FieldDropdown options must be an array.'); } diff --git a/core/field_variable.ts b/core/field_variable.ts index 879eb1aa9..040a2f0ff 100644 --- a/core/field_variable.ts +++ b/core/field_variable.ts @@ -17,7 +17,7 @@ import './events/events_block_change.js'; import type {Block} from './block.js'; import {Field, FieldConfig, UnattachedFieldError} from './field.js'; -import {FieldDropdown} from './field_dropdown.js'; +import {FieldDropdown, MenuGenerator, MenuOption} from './field_dropdown.js'; import * as fieldRegistry from './field_registry.js'; import * as internalConstants from './internal_constants.js'; import type {Menu} from './menu.js'; @@ -37,8 +37,7 @@ import * as Xml from './xml.js'; * @alias Blockly.FieldVariable */ export class FieldVariable extends FieldDropdown { - protected override menuGenerator_: AnyDuringMigration[][]| - ((this: FieldDropdown) => AnyDuringMigration[][]); + protected override menuGenerator_: MenuGenerator|undefined; defaultVariableName: string; /** The type of the default variable for this field. */ @@ -89,9 +88,7 @@ export class FieldVariable extends FieldDropdown { * An array of options for a dropdown list, * or a function which generates these options. */ - // AnyDuringMigration because: Type '(this: FieldVariable) => any[][]' is - // not assignable to type 'any[][] | ((this: FieldDropdown) => any[][])'. - this.menuGenerator_ = FieldVariable.dropdownCreate as AnyDuringMigration; + this.menuGenerator_ = FieldVariable.dropdownCreate as MenuGenerator; /** * The initial variable name passed to this field's constructor, or an @@ -528,14 +525,14 @@ export class FieldVariable extends FieldDropdown { * * @returns Array of variable names/id tuples. */ - static dropdownCreate(this: FieldVariable): AnyDuringMigration[][] { + static dropdownCreate(this: FieldVariable): MenuOption[] { if (!this.variable_) { throw Error( 'Tried to call dropdownCreate on a variable field with no' + ' variable selected.'); } const name = this.getText(); - let variableModelList: AnyDuringMigration[] = []; + let variableModelList: VariableModel[] = []; if (this.sourceBlock_ && !this.sourceBlock_.isDeadOrDying()) { const variableTypes = this.getVariableTypes_(); // Get a copy of the list, so that adding rename and new variable options @@ -549,7 +546,7 @@ export class FieldVariable extends FieldDropdown { } variableModelList.sort(VariableModel.compareByName); - const options = []; + const options: [string, string][] = []; for (let i = 0; i < variableModelList.length; i++) { // Set the UUID as the internal representation of the variable. options[i] = [variableModelList[i].name, variableModelList[i].getId()]; From a46e12b06b5e50b64b8c676d3ab16f96a658385b Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Tue, 25 Oct 2022 08:33:59 -0700 Subject: [PATCH 46/69] chore: remove underscores from menuitem and menu (#6567) * chore: remove underscores in menuitem.ts * chore: remove underscores in menu.ts * chore: format --- core/menu.ts | 169 +++++++++++++++++++++++------------------------ core/menuitem.ts | 67 +++++++++---------- 2 files changed, 114 insertions(+), 122 deletions(-) diff --git a/core/menu.ts b/core/menu.ts index 482785317..93edeb1df 100644 --- a/core/menu.ts +++ b/core/menu.ts @@ -33,7 +33,7 @@ export class Menu { * (Nulls are never in the array, but typing the array as nullable prevents * the compiler from objecting to .indexOf(null)) */ - private readonly menuItems_: MenuItem[] = []; + private readonly menuItems: MenuItem[] = []; /** * Coordinates of the mousedown event that caused this menu to open. Used to @@ -46,28 +46,28 @@ export class Menu { * This is the element that we will listen to the real focus events on. * A value of null means no menu item is highlighted. */ - private highlightedItem_: MenuItem|null = null; + private highlightedItem: MenuItem|null = null; /** Mouse over event data. */ - private mouseOverHandler_: browserEvents.Data|null = null; + private mouseOverHandler: browserEvents.Data|null = null; /** Click event data. */ - private clickHandler_: browserEvents.Data|null = null; + private clickHandler: browserEvents.Data|null = null; /** Mouse enter event data. */ - private mouseEnterHandler_: browserEvents.Data|null = null; + private mouseEnterHandler: browserEvents.Data|null = null; /** Mouse leave event data. */ - private mouseLeaveHandler_: browserEvents.Data|null = null; + private mouseLeaveHandler: browserEvents.Data|null = null; /** Key down event data. */ - private onKeyDownHandler_: browserEvents.Data|null = null; + private onKeyDownHandler: browserEvents.Data|null = null; /** The menu's root DOM element. */ - private element_: HTMLDivElement|null = null; + private element: HTMLDivElement|null = null; /** ARIA name for this menu. */ - private roleName_: aria.Role|null = null; + private roleName: aria.Role|null = null; /** Constructs a new Menu instance. */ constructor() {} @@ -79,7 +79,7 @@ export class Menu { * @internal */ addChild(menuItem: MenuItem) { - this.menuItems_.push(menuItem); + this.menuItems.push(menuItem); } /** @@ -93,27 +93,27 @@ export class Menu { // goog-menu is deprecated, use blocklyMenu. May 2020. element.className = 'blocklyMenu goog-menu blocklyNonSelectable'; element.tabIndex = 0; - if (this.roleName_) { - aria.setRole(element, this.roleName_); + if (this.roleName) { + aria.setRole(element, this.roleName); } - this.element_ = element; + this.element = element; // Add menu items. - for (let i = 0, menuItem; menuItem = this.menuItems_[i]; i++) { + for (let i = 0, menuItem; menuItem = this.menuItems[i]; i++) { element.appendChild(menuItem.createDom()); } // Add event handlers. - this.mouseOverHandler_ = browserEvents.conditionalBind( - element, 'mouseover', this, this.handleMouseOver_, true); - this.clickHandler_ = browserEvents.conditionalBind( - element, 'click', this, this.handleClick_, true); - this.mouseEnterHandler_ = browserEvents.conditionalBind( - element, 'mouseenter', this, this.handleMouseEnter_, true); - this.mouseLeaveHandler_ = browserEvents.conditionalBind( - element, 'mouseleave', this, this.handleMouseLeave_, true); - this.onKeyDownHandler_ = browserEvents.conditionalBind( - element, 'keydown', this, this.handleKeyEvent_); + this.mouseOverHandler = browserEvents.conditionalBind( + element, 'mouseover', this, this.handleMouseOver, true); + this.clickHandler = browserEvents.conditionalBind( + element, 'click', this, this.handleClick, true); + this.mouseEnterHandler = browserEvents.conditionalBind( + element, 'mouseenter', this, this.handleMouseEnter, true); + this.mouseLeaveHandler = browserEvents.conditionalBind( + element, 'mouseleave', this, this.handleMouseLeave, true); + this.onKeyDownHandler = browserEvents.conditionalBind( + element, 'keydown', this, this.handleKeyEvent); container.appendChild(element); return element; @@ -126,7 +126,7 @@ export class Menu { * @internal */ getElement(): HTMLDivElement|null { - return this.element_; + return this.element; } /** @@ -143,7 +143,7 @@ export class Menu { } /** Blur the menu element. */ - private blur_() { + private blur() { const el = this.getElement(); if (el) { el.blur(); @@ -158,38 +158,38 @@ export class Menu { * @internal */ setRole(roleName: aria.Role) { - this.roleName_ = roleName; + this.roleName = roleName; } /** Dispose of this menu. */ dispose() { // Remove event handlers. - if (this.mouseOverHandler_) { - browserEvents.unbind(this.mouseOverHandler_); - this.mouseOverHandler_ = null; + if (this.mouseOverHandler) { + browserEvents.unbind(this.mouseOverHandler); + this.mouseOverHandler = null; } - if (this.clickHandler_) { - browserEvents.unbind(this.clickHandler_); - this.clickHandler_ = null; + if (this.clickHandler) { + browserEvents.unbind(this.clickHandler); + this.clickHandler = null; } - if (this.mouseEnterHandler_) { - browserEvents.unbind(this.mouseEnterHandler_); - this.mouseEnterHandler_ = null; + if (this.mouseEnterHandler) { + browserEvents.unbind(this.mouseEnterHandler); + this.mouseEnterHandler = null; } - if (this.mouseLeaveHandler_) { - browserEvents.unbind(this.mouseLeaveHandler_); - this.mouseLeaveHandler_ = null; + if (this.mouseLeaveHandler) { + browserEvents.unbind(this.mouseLeaveHandler); + this.mouseLeaveHandler = null; } - if (this.onKeyDownHandler_) { - browserEvents.unbind(this.onKeyDownHandler_); - this.onKeyDownHandler_ = null; + if (this.onKeyDownHandler) { + browserEvents.unbind(this.onKeyDownHandler); + this.onKeyDownHandler = null; } // Remove menu items. - for (let i = 0, menuItem; menuItem = this.menuItems_[i]; i++) { + for (let i = 0, menuItem; menuItem = this.menuItems[i]; i++) { menuItem.dispose(); } - this.element_ = null; + this.element = null; } // Child component management. @@ -201,7 +201,7 @@ export class Menu { * @param elem DOM element whose owner is to be returned. * @returns Menu item for which the DOM element belongs to. */ - private getMenuItem_(elem: Element): MenuItem|null { + private getMenuItem(elem: Element): MenuItem|null { const menuElem = this.getElement(); // Node might be the menu border (resulting in no associated menu item), or // a menu item's div, or some element within the menu item. @@ -211,7 +211,7 @@ export class Menu { while (currentElement && currentElement !== menuElem) { if (currentElement.classList.contains('blocklyMenuItem')) { // Having found a menu item's div, locate that menu item in this menu. - for (let i = 0, menuItem; menuItem = this.menuItems_[i]; i++) { + for (let i = 0, menuItem; menuItem = this.menuItems[i]; i++) { if (menuItem.getElement() === currentElement) { return menuItem; } @@ -231,14 +231,14 @@ export class Menu { * @internal */ setHighlighted(item: MenuItem|null) { - const currentHighlighted = this.highlightedItem_; + const currentHighlighted = this.highlightedItem; if (currentHighlighted) { currentHighlighted.setHighlighted(false); - this.highlightedItem_ = null; + this.highlightedItem = null; } if (item) { item.setHighlighted(true); - this.highlightedItem_ = item; + this.highlightedItem = item; // Bring the highlighted item into view. This has no effect if the menu is // not scrollable. const el = this.getElement() as Element; @@ -255,10 +255,10 @@ export class Menu { * @internal */ highlightNext() { - const index = this.highlightedItem_ ? - this.menuItems_.indexOf(this.highlightedItem_) : + const index = this.highlightedItem ? + this.menuItems.indexOf(this.highlightedItem) : -1; - this.highlightHelper_(index, 1); + this.highlightHelper(index, 1); } /** @@ -268,20 +268,20 @@ export class Menu { * @internal */ highlightPrevious() { - const index = this.highlightedItem_ ? - this.menuItems_.indexOf(this.highlightedItem_) : + const index = this.highlightedItem ? + this.menuItems.indexOf(this.highlightedItem) : -1; - this.highlightHelper_(index < 0 ? this.menuItems_.length : index, -1); + this.highlightHelper(index < 0 ? this.menuItems.length : index, -1); } /** Highlights the first highlightable item. */ - private highlightFirst_() { - this.highlightHelper_(-1, 1); + private highlightFirst() { + this.highlightHelper(-1, 1); } /** Highlights the last highlightable item. */ - private highlightLast_() { - this.highlightHelper_(this.menuItems_.length, -1); + private highlightLast() { + this.highlightHelper(this.menuItems.length, -1); } /** @@ -291,10 +291,10 @@ export class Menu { * @param startIndex Start index. * @param delta Step direction: 1 to go down, -1 to go up. */ - private highlightHelper_(startIndex: number, delta: number) { + private highlightHelper(startIndex: number, delta: number) { let index = startIndex + delta; let menuItem; - while (menuItem = this.menuItems_[index]) { + while (menuItem = this.menuItems[index]) { if (menuItem.isEnabled()) { this.setHighlighted(menuItem); break; @@ -310,12 +310,12 @@ export class Menu { * * @param e Mouse event to handle. */ - private handleMouseOver_(e: Event) { - const menuItem = this.getMenuItem_(e.target as Element); + private handleMouseOver(e: Event) { + const menuItem = this.getMenuItem(e.target as Element); if (menuItem) { if (menuItem.isEnabled()) { - if (this.highlightedItem_ !== menuItem) { + if (this.highlightedItem !== menuItem) { this.setHighlighted(menuItem); } } else { @@ -329,7 +329,7 @@ export class Menu { * * @param e Click event to handle. */ - private handleClick_(e: Event) { + private handleClick(e: Event) { const oldCoords = this.openingCoords; // Clear out the saved opening coords immediately so they're not used twice. this.openingCoords = null; @@ -351,7 +351,7 @@ export class Menu { } } - const menuItem = this.getMenuItem_(e.target as Element); + const menuItem = this.getMenuItem(e.target as Element); if (menuItem) { menuItem.performAction(); } @@ -362,7 +362,7 @@ export class Menu { * * @param _e Mouse event to handle. */ - private handleMouseEnter_(_e: Event) { + private handleMouseEnter(_e: Event) { this.focus(); } @@ -371,9 +371,9 @@ export class Menu { * * @param _e Mouse event to handle. */ - private handleMouseLeave_(_e: Event) { + private handleMouseLeave(_e: Event) { if (this.getElement()) { - this.blur_(); + this.blur(); this.setHighlighted(null); } } @@ -387,27 +387,20 @@ export class Menu { * * @param e Key event to handle. */ - private handleKeyEvent_(e: Event) { - if (!this.menuItems_.length) { + private handleKeyEvent(e: Event) { + if (!this.menuItems.length) { // Empty menu. return; } - // AnyDuringMigration because: Property 'altKey' does not exist on type - // 'Event'. AnyDuringMigration because: Property 'metaKey' does not exist - // on type 'Event'. AnyDuringMigration because: Property 'ctrlKey' does not - // exist on type 'Event'. AnyDuringMigration because: Property 'shiftKey' - // does not exist on type 'Event'. - if ((e as AnyDuringMigration).shiftKey || - (e as AnyDuringMigration).ctrlKey || - (e as AnyDuringMigration).metaKey || (e as AnyDuringMigration).altKey) { + const keyboardEvent = e as KeyboardEvent; + if (keyboardEvent.shiftKey || keyboardEvent.ctrlKey || + keyboardEvent.metaKey || keyboardEvent.altKey) { // Do not handle the key event if any modifier key is pressed. return; } - const highlighted = this.highlightedItem_; - // AnyDuringMigration because: Property 'keyCode' does not exist on type - // 'Event'. - switch ((e as AnyDuringMigration).keyCode) { + const highlighted = this.highlightedItem; + switch (keyboardEvent.keyCode) { case KeyCodes.ENTER: case KeyCodes.SPACE: if (highlighted) { @@ -425,12 +418,12 @@ export class Menu { case KeyCodes.PAGE_UP: case KeyCodes.HOME: - this.highlightFirst_(); + this.highlightFirst(); break; case KeyCodes.PAGE_DOWN: case KeyCodes.END: - this.highlightLast_(); + this.highlightLast(); break; default: @@ -449,10 +442,10 @@ export class Menu { * @internal */ getSize(): Size { - const menuDom = this.getElement(); - const menuSize = style.getSize(menuDom as Element); + const menuDom = this.getElement() as HTMLDivElement; + const menuSize = style.getSize(menuDom); // Recalculate height for the total content, not only box height. - menuSize.height = menuDom!.scrollHeight; + menuSize.height = menuDom.scrollHeight; return menuSize; } } diff --git a/core/menuitem.ts b/core/menuitem.ts index 3eec5ac69..ee9b2ad0c 100644 --- a/core/menuitem.ts +++ b/core/menuitem.ts @@ -24,28 +24,28 @@ import * as idGenerator from './utils/idgenerator.js'; */ export class MenuItem { /** Is the menu item clickable, as opposed to greyed-out. */ - private enabled_ = true; + private enabled = true; /** The DOM element for the menu item. */ - private element_: HTMLDivElement|null = null; + private element: HTMLDivElement|null = null; /** Whether the menu item is rendered right-to-left. */ - private rightToLeft_ = false; + private rightToLeft = false; /** ARIA name for this menu. */ - private roleName_: aria.Role|null = null; + private roleName: aria.Role|null = null; /** Is this menu item checkable. */ - private checkable_ = false; + private checkable = false; /** Is this menu item currently checked. */ - private checked_ = false; + private checked = false; /** Is this menu item currently highlighted. */ - private highlight_ = false; + private highlight = false; /** Bound function to call when this menu item is clicked. */ - private actionHandler_: Function|null = null; + private actionHandler: Function|null = null; /** * @param content Text caption to display as the content of the item, or a @@ -64,22 +64,22 @@ export class MenuItem { createDom(): Element { const element = (document.createElement('div')); element.id = idGenerator.getNextUniqueId(); - this.element_ = element; + this.element = element; // Set class and style // goog-menuitem* is deprecated, use blocklyMenuItem*. May 2020. element.className = 'blocklyMenuItem goog-menuitem ' + - (this.enabled_ ? '' : - 'blocklyMenuItemDisabled goog-menuitem-disabled ') + - (this.checked_ ? 'blocklyMenuItemSelected goog-option-selected ' : '') + - (this.highlight_ ? 'blocklyMenuItemHighlight goog-menuitem-highlight ' : - '') + - (this.rightToLeft_ ? 'blocklyMenuItemRtl goog-menuitem-rtl ' : ''); + (this.enabled ? '' : + 'blocklyMenuItemDisabled goog-menuitem-disabled ') + + (this.checked ? 'blocklyMenuItemSelected goog-option-selected ' : '') + + (this.highlight ? 'blocklyMenuItemHighlight goog-menuitem-highlight ' : + '') + + (this.rightToLeft ? 'blocklyMenuItemRtl goog-menuitem-rtl ' : ''); const content = (document.createElement('div')); content.className = 'blocklyMenuItemContent goog-menuitem-content'; // Add a checkbox for checkable menu items. - if (this.checkable_) { + if (this.checkable) { const checkbox = (document.createElement('div')); checkbox.className = 'blocklyMenuItemCheckbox goog-menuitem-checkbox'; content.appendChild(checkbox); @@ -93,20 +93,19 @@ export class MenuItem { element.appendChild(content); // Initialize ARIA role and state. - if (this.roleName_) { - aria.setRole(element, this.roleName_); + if (this.roleName) { + aria.setRole(element, this.roleName); } aria.setState( - element, aria.State.SELECTED, - this.checkable_ && this.checked_ || false); - aria.setState(element, aria.State.DISABLED, !this.enabled_); + element, aria.State.SELECTED, this.checkable && this.checked || false); + aria.setState(element, aria.State.DISABLED, !this.enabled); return element; } /** Dispose of this menu item. */ dispose() { - this.element_ = null; + this.element = null; } /** @@ -116,7 +115,7 @@ export class MenuItem { * @internal */ getElement(): Element|null { - return this.element_; + return this.element; } /** @@ -126,7 +125,7 @@ export class MenuItem { * @internal */ getId(): string { - return this.element_!.id; + return this.element!.id; } /** @@ -146,7 +145,7 @@ export class MenuItem { * @internal */ setRightToLeft(rtl: boolean) { - this.rightToLeft_ = rtl; + this.rightToLeft = rtl; } /** @@ -156,7 +155,7 @@ export class MenuItem { * @internal */ setRole(roleName: aria.Role) { - this.roleName_ = roleName; + this.roleName = roleName; } /** @@ -167,7 +166,7 @@ export class MenuItem { * @internal */ setCheckable(checkable: boolean) { - this.checkable_ = checkable; + this.checkable = checkable; } /** @@ -177,7 +176,7 @@ export class MenuItem { * @internal */ setChecked(checked: boolean) { - this.checked_ = checked; + this.checked = checked; } /** @@ -187,7 +186,7 @@ export class MenuItem { * @internal */ setHighlighted(highlight: boolean) { - this.highlight_ = highlight; + this.highlight = highlight; const el = this.getElement(); if (el && this.isEnabled()) { @@ -212,7 +211,7 @@ export class MenuItem { * @internal */ isEnabled(): boolean { - return this.enabled_; + return this.enabled; } /** @@ -222,7 +221,7 @@ export class MenuItem { * @internal */ setEnabled(enabled: boolean) { - this.enabled_ = enabled; + this.enabled = enabled; } /** @@ -232,8 +231,8 @@ export class MenuItem { * @internal */ performAction() { - if (this.isEnabled() && this.actionHandler_) { - this.actionHandler_(this); + if (this.isEnabled() && this.actionHandler) { + this.actionHandler(this); } } @@ -246,6 +245,6 @@ export class MenuItem { * @internal */ onAction(fn: (p1: MenuItem) => void, obj: object) { - this.actionHandler_ = fn.bind(obj); + this.actionHandler = fn.bind(obj); } } From 41db0c5fb00d557412f04bc37e3d5c9797c29727 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 25 Oct 2022 08:46:42 -0700 Subject: [PATCH 47/69] fix: feedback on procedure model implementations (#6560) * fix: feedback on procedure model implementations * chore: format --- core/procedures/observable_parameter_model.ts | 9 ++++++--- core/procedures/observable_procedure_map.ts | 9 +++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/core/procedures/observable_parameter_model.ts b/core/procedures/observable_parameter_model.ts index 4c74a0505..9255037e1 100644 --- a/core/procedures/observable_parameter_model.ts +++ b/core/procedures/observable_parameter_model.ts @@ -17,7 +17,8 @@ export class ObservableParameterModel implements IParameterModel { constructor( private readonly workspace: Workspace, name: string, id?: string) { this.id = id ?? genUid(); - this.variable = workspace.createVariable(name); + this.variable = + this.workspace.getVariable(name) ?? workspace.createVariable(name); } /** @@ -34,12 +35,14 @@ export class ObservableParameterModel implements IParameterModel { * Unimplemented. The built-in ParameterModel does not support typing. * If you want your procedure blocks to have typed parameters, you need to * implement your own ParameterModel. + * + * @throws Throws for the ObservableParameterModel specifically because this + * method is unimplemented. */ setTypes(_types: string[]): this { - console.warn( + throw new Error( 'The built-in ParameterModel does not support typing. You need to ' + 'implement your own custom ParameterModel.'); - return this; } /** diff --git a/core/procedures/observable_procedure_map.ts b/core/procedures/observable_procedure_map.ts index db5edfe68..35ee4a5e7 100644 --- a/core/procedures/observable_procedure_map.ts +++ b/core/procedures/observable_procedure_map.ts @@ -17,7 +17,7 @@ export class ObservableProcedureMap extends Map { * Adds the given procedure model to the procedure map. */ override set(id: string, proc: IProcedureModel): this { - // TODO(#6156): Fire events. + // TODO(#6516): Fire events. super.set(id, proc); return this; } @@ -27,7 +27,7 @@ export class ObservableProcedureMap extends Map { * exists). */ override delete(id: string): boolean { - // TODO(#6156): Fire events. + // TODO(#6516): Fire events. return super.delete(id); } @@ -35,7 +35,7 @@ export class ObservableProcedureMap extends Map { * Removes all ProcedureModels from the procedure map. */ override clear() { - // TODO(#6156): Fire events. + // TODO(#6516): Fire events. super.clear(); } @@ -44,7 +44,8 @@ export class ObservableProcedureMap extends Map { * blocks can find it. */ add(proc: IProcedureModel): this { - // TODO(#6156): Fire events. + // TODO(#6516): Fire events. + // TODO(#6526): See if this method is actually useful. return this.set(proc.getId(), proc); } } From 7ffe1fa89f39efd0fb103c059d25d2002621b97f Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 25 Oct 2022 08:51:40 -0700 Subject: [PATCH 48/69] chore: update procedure map tests to match the refactored API (#6569) * chore: add tests for the backing variable of parameter models * chore: update existing procedure map tests * chore: update block update tests to use refactored API * chore: update tests to actually use fluent API * chore: format * chore: fix tests * chore: reorganize tests * chore: format * chore: add comment --- core/blockly.ts | 1 + core/procedures.ts | 9 + core/procedures/observable_parameter_model.ts | 1 + core/procedures/observable_procedure_model.ts | 5 + tests/mocha/procedure_map_test.js | 155 +++++++++++++----- 5 files changed, 128 insertions(+), 43 deletions(-) diff --git a/core/blockly.ts b/core/blockly.ts index b236c2118..b8acdfeaf 100644 --- a/core/blockly.ts +++ b/core/blockly.ts @@ -602,6 +602,7 @@ export {Css}; export {Events}; export {Extensions}; export {Procedures}; +export {Procedures as procedures}; export {ShortcutItems}; export {Themes}; export {Tooltip}; diff --git a/core/procedures.ts b/core/procedures.ts index 7fad925e6..e31d77d31 100644 --- a/core/procedures.ts +++ b/core/procedures.ts @@ -25,6 +25,9 @@ import * as eventUtils from './events/utils.js'; import {Field, UnattachedFieldError} from './field.js'; import {Msg} from './msg.js'; import {Names} from './names.js'; +import {ObservableProcedureMap} from './procedures/observable_procedure_map.js'; +import {ObservableProcedureModel} from './procedures/observable_procedure_model.js'; +import {ObservableParameterModel} from './procedures/observable_parameter_model.js'; import * as utilsXml from './utils/xml.js'; import * as Variables from './variables.js'; import type {Workspace} from './workspace.js'; @@ -450,3 +453,9 @@ export function getDefinition(name: string, workspace: Workspace): Block|null { } return null; } + +export { + ObservableProcedureMap, + ObservableProcedureModel, + ObservableParameterModel, +}; diff --git a/core/procedures/observable_parameter_model.ts b/core/procedures/observable_parameter_model.ts index 9255037e1..407b0ad6d 100644 --- a/core/procedures/observable_parameter_model.ts +++ b/core/procedures/observable_parameter_model.ts @@ -25,6 +25,7 @@ export class ObservableParameterModel implements IParameterModel { * Sets the name of this parameter to the given name. */ setName(name: string): this { + // TODO(#6516): Fire events. if (name == this.variable.name) return this; this.variable = this.workspace.getVariable(name) ?? this.workspace.createVariable(name); diff --git a/core/procedures/observable_procedure_model.ts b/core/procedures/observable_procedure_model.ts index 335667ab9..aa51bb7f9 100644 --- a/core/procedures/observable_procedure_model.ts +++ b/core/procedures/observable_procedure_model.ts @@ -23,6 +23,7 @@ export class ObservableProcedureModel implements IProcedureModel { /** Sets the human-readable name of the procedure. */ setName(name: string): this { + // TODO(#6516): Fire events. this.name = name; return this; } @@ -33,12 +34,14 @@ export class ObservableProcedureModel implements IProcedureModel { * To move a parameter, first delete it, and then re-insert. */ insertParameter(parameterModel: IParameterModel, index: number): this { + // TODO(#6516): Fire events. this.parameters.splice(index, 0, parameterModel); return this; } /** Removes the parameter at the given index from the parameter list. */ deleteParameter(index: number): this { + // TODO(#6516): Fire events. this.parameters.splice(index, 1); return this; } @@ -49,6 +52,7 @@ export class ObservableProcedureModel implements IProcedureModel { * Pass null to represent a procedure that does not return. */ setReturnTypes(types: string[]|null): this { + // TODO(#6516): Fire events. this.returnTypes = types; return this; } @@ -58,6 +62,7 @@ export class ObservableProcedureModel implements IProcedureModel { * all procedure caller blocks should be disabled as well. */ setEnabled(enabled: boolean): this { + // TODO(#6516): Fire events. this.enabled = enabled; return this; } diff --git a/tests/mocha/procedure_map_test.js b/tests/mocha/procedure_map_test.js index 08e5f8137..60a84ad37 100644 --- a/tests/mocha/procedure_map_test.js +++ b/tests/mocha/procedure_map_test.js @@ -8,18 +8,19 @@ import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown goog.declareModuleId('Blockly.test.procedureMap'); -suite.skip('Procedure Map', function() { +suite('Procedure Map', function() { setup(function() { sharedTestSetup.call(this); this.workspace = new Blockly.Workspace(); - this.procedureMap = this.workspace.getProcedureMap(); + // this.procedureMap = this.workspace.getProcedureMap(); }); teardown(function() { sharedTestTeardown.call(this); }); - suite('triggering block updates', function() { + // TODO (#6515): Unskip tests. + suite.skip('triggering block updates', function() { setup(function() { Blockly.Blocks['procedure_mock'] = { init: function() { }, @@ -36,8 +37,17 @@ suite.skip('Procedure Map', function() { }); suite('procedure map updates', function() { + test('inserting a procedure does not trigger an update', function() { + const procedureModel = + new Blockly.procedures.ObservableProcedureModel(this.workspace); + this.procedureMap.set(procedureModel.getId(), procedureModel); + + chai.assert.isFalse( + this.updateSpy.called, 'Expected no update to be triggered'); + }); + test('adding a procedure does not trigger an update', function() { - this.procedureMap.addProcedure( + this.procedureMap.add( new Blockly.procedures.ObservableProcedureModel(this.workspace)); chai.assert.isFalse( @@ -47,9 +57,9 @@ suite.skip('Procedure Map', function() { test('deleting a procedure triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); + this.procedureMap.add(procedureModel); - this.procedureMap.deleteProcedure(procedureModel.getId()); + this.procedureMap.delete(procedureModel.getId()); chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); @@ -60,7 +70,7 @@ suite.skip('Procedure Map', function() { test('setting the name triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); + this.procedureMap.add(procedureModel); procedureModel.setName('new name'); @@ -71,9 +81,9 @@ suite.skip('Procedure Map', function() { test('setting the return type triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); + this.procedureMap.add(procedureModel); - procedureModel.setReturnType(['return type 1', 'return type 2']); + procedureModel.setReturnTypes(['return type 1', 'return type 2']); chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); @@ -81,12 +91,12 @@ suite.skip('Procedure Map', function() { test('removing the return type triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); + new Blockly.procedures.ObservableProcedureModel(this.workspace) + .setReturnTypes(['return type']); + this.procedureMap.add(procedureModel); + this.updateSpy.resetHistory(); - procedureModel.setReturnType(['return type']); - this.updateSpy.reset(); - procedureModel.setReturnType(null); + procedureModel.setReturnTypes(null); chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); @@ -95,7 +105,7 @@ suite.skip('Procedure Map', function() { test('disabling the procedure triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); + this.procedureMap.add(procedureModel); procedureModel.setEnabled(false); @@ -105,10 +115,10 @@ suite.skip('Procedure Map', function() { test('enabling the procedure triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); - procedureModel.setEnabled(false); - this.updateSpy.reset(); + new Blockly.procedures.ObservableProcedureModel(this.workspace) + .setEnabled(false); + this.procedureMap.add(procedureModel); + this.updateSpy.resetHistory(); procedureModel.setEnabled(true); @@ -119,7 +129,7 @@ suite.skip('Procedure Map', function() { test('inserting a parameter triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); + this.procedureMap.add(procedureModel); procedureModel.insertParameter( new Blockly.procedures.ObservableParameterModel(this.workspace)); @@ -130,11 +140,12 @@ suite.skip('Procedure Map', function() { test('deleting a parameter triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); - procedureModel.insertParameter( - new Blockly.procedures.ObservableParameterModel(this.workspace)); - this.updateSpy.reset(); + new Blockly.procedures.ObservableProcedureModel(this.workspace) + .insertParameter( + new Blockly.procedures.ObservableParameterModel( + this.workspace)); + this.procedureMap.add(procedureModel); + this.updateSpy.resetHistory(); procedureModel.deleteParameter(0); @@ -144,34 +155,31 @@ suite.skip('Procedure Map', function() { }); suite('parameter model updates', function() { - test('setting the variable model triggers an update', function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); + test('setting the name triggers an update', function() { const parameterModel = - new Blockly.procedures.ObservableParameterModel(this.workspace); - procedureModel.insertParameter(parameterModel); - this.updateSpy.reset(); + new Blockly.procedures.ObservableParameterModel( + this.workspace, 'test1'); + this.procedureMap.add( + new Blockly.procedures.ObservableProcedureModel(this.workspace) + .insertParameter(parameterModel)); + this.updateSpy.resetHistory(); - parameterModel.setVariable( - new Blockly.VariableModel(this.workspace, 'variable')); + parameterModel.setName('test2'); chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); }); test('modifying the variable model does not trigger an update', function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.addProcedure(procedureModel); const parameterModel = - new Blockly.procedures.ObservableParameterModel(this.workspace); - procedureModel.insertParameter(parameterModel); - const variableModel = - new Blockly.VariableModel(this.workspace, 'variable'); - parameterModel.setVariable(variableModel); - this.updateSpy.reset(); + new Blockly.procedures.ObservableParameterModel( + this.workspace, 'test1'); + this.procedureMap.add( + new Blockly.procedures.ObservableProcedureModel(this.workspace) + .insertParameter(parameterModel)); + this.updateSpy.resetHistory(); + const variableModel = parameterModel.getVariableModel(); variableModel.name = 'some name'; variableModel.type = 'some type'; @@ -184,4 +192,65 @@ suite.skip('Procedure Map', function() { suite('event firing', function() { // TBA after the procedure map is implemented }); + + suite('backing variable to parameters', function() { + test( + 'construction references an existing variable if available', + function() { + const variable = this.workspace.createVariable('test1'); + const param = new Blockly.procedures.ObservableParameterModel( + this.workspace, 'test1'); + + chai.assert.equal( + variable, + param.getVariableModel(), + 'Expected the parameter model to reference the existing variable'); + }); + + test('construction creates a variable if none exists', function() { + const param = new Blockly.procedures.ObservableParameterModel( + this.workspace, 'test1'); + + chai.assert.equal( + this.workspace.getVariable('test1'), + param.getVariableModel(), + 'Expected the parameter model to create a variable'); + }); + + test('setName references an existing variable if available', function() { + const variable = this.workspace.createVariable('test2'); + const param = new Blockly.procedures.ObservableParameterModel( + this.workspace, 'test1'); + + param.setName('test2'); + + chai.assert.equal( + variable, + param.getVariableModel(), + 'Expected the parameter model to reference the existing variable'); + }); + + test('setName creates a variable if none exits', function() { + const param = new Blockly.procedures.ObservableParameterModel( + this.workspace, 'test1'); + + param.setName('test2'); + + chai.assert.equal( + this.workspace.getVariable('test2'), + param.getVariableModel(), + 'Expected the parameter model to create a variable'); + }); + + test('setTypes is unimplemented', function() { + const param = new Blockly.procedures.ObservableParameterModel( + this.workspace, 'test1'); + + chai.assert.throws( + () => { + param.setTypes(['some', 'types']); + }, + 'The built-in ParameterModel does not support typing'); + }); + }); }); From c9ced48de227f6fa3ccf9060fefd559a7656f42d Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 25 Oct 2022 08:56:13 -0700 Subject: [PATCH 49/69] feat: trigger updates to IProcedureBlock blocks (#6570) * feat: add interface and method for updating procedure blocks * chore: remove module ID declarations * feat: add actually triggering updates * chore: format * chore: clean up tests --- core/interfaces/i_procedure_block.ts | 19 ++++++++++++++++ core/procedures/observable_parameter_model.ts | 4 +++- core/procedures/observable_procedure_map.ts | 6 ++++- core/procedures/observable_procedure_model.ts | 8 ++++++- core/procedures/update_procedures.ts | 22 +++++++++++++++++++ tests/mocha/procedure_map_test.js | 7 +++--- 6 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 core/interfaces/i_procedure_block.ts create mode 100644 core/procedures/update_procedures.ts diff --git a/core/interfaces/i_procedure_block.ts b/core/interfaces/i_procedure_block.ts new file mode 100644 index 000000000..57318ba85 --- /dev/null +++ b/core/interfaces/i_procedure_block.ts @@ -0,0 +1,19 @@ +/** + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import type {Block} from '../block.js'; + + +/** The interface for a block which models a procedure. */ +export interface IProcedureBlock { + doProcedureUpdate(): void; +} + +/** A type guard which checks if the given block is a procedure block. */ +export function isProcedureBlock(block: Block| + IProcedureBlock): block is IProcedureBlock { + return (block as IProcedureBlock).doProcedureUpdate !== undefined; +} diff --git a/core/procedures/observable_parameter_model.ts b/core/procedures/observable_parameter_model.ts index 407b0ad6d..fe0f5bdb1 100644 --- a/core/procedures/observable_parameter_model.ts +++ b/core/procedures/observable_parameter_model.ts @@ -4,8 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import type {IParameterModel} from '../interfaces/i_parameter_model.js'; import {genUid} from '../utils/idgenerator.js'; +import type {IParameterModel} from '../interfaces/i_parameter_model.js'; +import {triggerProceduresUpdate} from './update_procedures.js'; import type {VariableModel} from '../variable_model.js'; import type {Workspace} from '../workspace.js'; @@ -29,6 +30,7 @@ export class ObservableParameterModel implements IParameterModel { if (name == this.variable.name) return this; this.variable = this.workspace.getVariable(name) ?? this.workspace.createVariable(name); + triggerProceduresUpdate(this.workspace); return this; } diff --git a/core/procedures/observable_procedure_map.ts b/core/procedures/observable_procedure_map.ts index 35ee4a5e7..781cb4682 100644 --- a/core/procedures/observable_procedure_map.ts +++ b/core/procedures/observable_procedure_map.ts @@ -5,6 +5,7 @@ */ import type {IProcedureModel} from '../interfaces/i_procedure_model.js'; +import {triggerProceduresUpdate} from './update_procedures.js'; import type {Workspace} from '../workspace.js'; @@ -28,7 +29,9 @@ export class ObservableProcedureMap extends Map { */ override delete(id: string): boolean { // TODO(#6516): Fire events. - return super.delete(id); + const existed = super.delete(id); + triggerProceduresUpdate(this.workspace); + return existed; } /** @@ -37,6 +40,7 @@ export class ObservableProcedureMap extends Map { override clear() { // TODO(#6516): Fire events. super.clear(); + triggerProceduresUpdate(this.workspace); } /** diff --git a/core/procedures/observable_procedure_model.ts b/core/procedures/observable_procedure_model.ts index aa51bb7f9..e338d5161 100644 --- a/core/procedures/observable_procedure_model.ts +++ b/core/procedures/observable_procedure_model.ts @@ -4,10 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {genUid} from '../utils/idgenerator.js'; import type {IParameterModel} from '../interfaces/i_parameter_model.js'; import type {IProcedureModel} from '../interfaces/i_procedure_model.js'; +import {triggerProceduresUpdate} from './update_procedures.js'; import type {Workspace} from '../workspace.js'; -import {genUid} from '../utils/idgenerator.js'; export class ObservableProcedureModel implements IProcedureModel { @@ -25,6 +26,7 @@ export class ObservableProcedureModel implements IProcedureModel { setName(name: string): this { // TODO(#6516): Fire events. this.name = name; + triggerProceduresUpdate(this.workspace); return this; } @@ -36,6 +38,7 @@ export class ObservableProcedureModel implements IProcedureModel { insertParameter(parameterModel: IParameterModel, index: number): this { // TODO(#6516): Fire events. this.parameters.splice(index, 0, parameterModel); + triggerProceduresUpdate(this.workspace); return this; } @@ -43,6 +46,7 @@ export class ObservableProcedureModel implements IProcedureModel { deleteParameter(index: number): this { // TODO(#6516): Fire events. this.parameters.splice(index, 1); + triggerProceduresUpdate(this.workspace); return this; } @@ -54,6 +58,7 @@ export class ObservableProcedureModel implements IProcedureModel { setReturnTypes(types: string[]|null): this { // TODO(#6516): Fire events. this.returnTypes = types; + triggerProceduresUpdate(this.workspace); return this; } @@ -64,6 +69,7 @@ export class ObservableProcedureModel implements IProcedureModel { setEnabled(enabled: boolean): this { // TODO(#6516): Fire events. this.enabled = enabled; + triggerProceduresUpdate(this.workspace); return this; } diff --git a/core/procedures/update_procedures.ts b/core/procedures/update_procedures.ts new file mode 100644 index 000000000..53d06caa5 --- /dev/null +++ b/core/procedures/update_procedures.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import {isProcedureBlock} from '../interfaces/i_procedure_block.js'; +import {Workspace} from '../workspace.js'; + + +/** + * Calls the `doProcedureUpdate` method on all blocks which implement it. + * + * @internal + */ +export function triggerProceduresUpdate(workspace: Workspace) { + for (const block of workspace.getAllBlocks(false)) { + if (isProcedureBlock(block)) { + block.doProcedureUpdate(); + } + } +} diff --git a/tests/mocha/procedure_map_test.js b/tests/mocha/procedure_map_test.js index 60a84ad37..34426eff4 100644 --- a/tests/mocha/procedure_map_test.js +++ b/tests/mocha/procedure_map_test.js @@ -13,18 +13,19 @@ suite('Procedure Map', function() { sharedTestSetup.call(this); this.workspace = new Blockly.Workspace(); // this.procedureMap = this.workspace.getProcedureMap(); + this.procedureMap = + new Blockly.procedures.ObservableProcedureMap(this.workspace); }); teardown(function() { sharedTestTeardown.call(this); }); - // TODO (#6515): Unskip tests. - suite.skip('triggering block updates', function() { + suite('triggering block updates', function() { setup(function() { Blockly.Blocks['procedure_mock'] = { init: function() { }, - doProcedureUpdate: function() {}, + doProcedureUpdate: function() { }, }; this.procedureBlock = this.workspace.newBlock('procedure_mock'); From 97450b2622c27a39ac2ba6d9d567e120fcaf51a6 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 25 Oct 2022 09:05:44 -0700 Subject: [PATCH 50/69] chore: add tests for procedure serialization (#6574) * chore: define necessary tests * chore: implement tests for procedure serialization * chore: format * chore: change tests from only to skip * chore: update tests to use mocks * chore: cleanup * chore: skip tests * chore: add deserialization tests * chore: cleanup from rebase --- tests/mocha/jso_deserialization_test.js | 305 ++++++++++++++++++++++++ tests/mocha/jso_serialization_test.js | 202 ++++++++++++++++ 2 files changed, 507 insertions(+) diff --git a/tests/mocha/jso_deserialization_test.js b/tests/mocha/jso_deserialization_test.js index a476436fb..3fa342ed0 100644 --- a/tests/mocha/jso_deserialization_test.js +++ b/tests/mocha/jso_deserialization_test.js @@ -713,4 +713,309 @@ suite('JSO Deserialization', function() { chai.assert.equal(block.someProperty, 'some value'); }); }); + + // TODO(#6522): Unskip tests. + suite.skip('Procedures', function() { + class MockProcedureModel { + constructor(id) { + this.id = id ?? Blockly.utils.idGenerator.genUid(); + this.name = ''; + this.parameters = []; + this.returnTypes = null; + this.enabled = true; + } + + setName(name) { + this.name = name; + return this; + } + + insertParameter(parameterModel, index) { + this.parameters.splice(index, 0, parameterModel); + return this; + } + + deleteParameter(index) { + this.parameters.splice(index, 1); + return this; + } + + setReturnTypes(types) { + this.returnTypes = types; + return this; + } + + setEnabled(enabled) { + this.enabled = enabled; + return this; + } + + getId() { + return this.id; + } + + getName() { + return this.name; + } + + getParameter(index) { + return this.parameters[index]; + } + + getParameters() { + return [...this.parameters]; + } + + getReturnTypes() { + return this.returnTypes; + } + + getEnabled() { + return this.enabled; + } + } + + class MockParameterModel { + constructor(name, id) { + this.id = id ?? Blockly.utils.idGenerator.genUid(); + this.name = name; + this.types = []; + } + + setName(name) { + this.name = name; + return this; + } + + setTypes(types) { + this.types = types; + return this; + } + + getName() { + return this.name; + } + + getTypes() { + return this.types; + } + + getId() { + return this.id; + } + } + + setup(function() { + this.procedureSerializer = new + Blockly.serialization.procedures.ProcedureSerializer( + MockProcedureModel, MockParameterModel); + this.procedureMap = this.workspace.getProcedureMap(); + }); + + teardown(function() { + this.procedureSerializer = null; + this.procedureMap = null; + }); + + suite('invariant properties', function() { + test('the id property is assigned', function() { + const jso = { + 'id': 'test id', + 'name': 'test name', + 'returnTypes': [], + }; + + this.procedureSerializer.load([jso], this.workspace); + + const procedureModel = this.procedureMap.getProcedures()[0]; + chai.assert.isNotNull( + procedureModel, 'Expected a procedure model to exist'); + chai.assert.equal( + procedureModel.getId(), + 'test id', + 'Expected the procedure model ID to match the serialized ID'); + }); + + test('the name property is assigned', function() { + const jso = { + 'id': 'test id', + 'name': 'test name', + 'returnTypes': [], + }; + + this.procedureSerializer.load([jso], this.workspace); + + const procedureModel = this.procedureMap.getProcedures()[0]; + chai.assert.isNotNull( + procedureModel, 'Expected a procedure model to exist'); + chai.assert.equal( + procedureModel.getName(), + 'test name', + 'Expected the procedure model name to match the serialized name'); + }); + }); + + suite('return types', function() { + test('if the return type property is null it is assigned', function() { + const jso = { + 'id': 'test id', + 'name': 'test name', + 'returnTypes': null, + }; + + this.procedureSerializer.load([jso], this.workspace); + + const procedureModel = this.procedureMap.getProcedures()[0]; + chai.assert.isNotNull( + procedureModel, 'Expected a procedure model to exist'); + chai.assert.isNull( + procedureModel.getReturnTypes(), + 'Expected the procedure model types to be null'); + }); + + test('if the return type property is an empty array it is assigned', function() { + const jso = { + 'id': 'test id', + 'name': 'test name', + 'returnTypes': [], + }; + + this.procedureSerializer.load([jso], this.workspace); + + const procedureModel = this.procedureMap.getProcedures()[0]; + chai.assert.isNotNull( + procedureModel, 'Expected a procedure model to exist'); + chai.assert.isArray( + procedureModel.getReturnTypes(), + 'Expected the procedure model types to be an array'); + chai.assert.isEmpty( + procedureModel.getReturnTypes(), + 'Expected the procedure model types array to be empty'); + }); + + test('if the return type property is a string array it is assigned', function() { + const jso = { + 'id': 'test id', + 'name': 'test name', + 'returnTypes': ['test type 1', 'test type 2'], + }; + + this.procedureSerializer.load([jso], this.workspace); + + const procedureModel = this.procedureMap.getProcedures()[0]; + chai.assert.isNotNull( + procedureModel, 'Expected a procedure model to exist'); + chai.assert.isArray( + procedureModel.getReturnTypes(), + 'Expected the procedure model types to be an array'); + chai.assert.deepEqual( + procedureModel.getReturnTypes(), + ['test type 1', 'test type 2'], + 'Expected the procedure model types array to be match the ' + + 'serialized array'); + }); + }); + + suite('parameters', function() { + suite('invariant properties', function() { + test('the id property is assigned', function() { + const jso = { + 'id': 'test id', + 'name': 'test name', + 'returnTypes': [], + 'parameters': [ + { + 'id': 'test id', + 'name': 'test name', + }, + ], + }; + + this.procedureSerializer.load([jso], this.workspace); + + const parameterModel = + this.procedureMap.getProcedures()[0].getParameters()[0]; + chai.assert.isNotNull( + parameterModel, 'Expected a parameter model to exist'); + chai.assert.equal( + parameterModel.getId(), + 'test id', + 'Expected the parameter model ID to match the serialized ID'); + }); + + test('the name property is assigned', function() { + const jso = { + 'id': 'test id', + 'name': 'test name', + 'returnTypes': [], + 'parameters': [ + { + 'id': 'test id', + 'name': 'test name', + }, + ], + }; + + this.procedureSerializer.load([jso], this.workspace); + + const parameterModel = + this.procedureMap.getProcedures()[0].getParameters()[0]; + chai.assert.isNotNull( + parameterModel, 'Expected a parameter model to exist'); + chai.assert.equal( + parameterModel.getName(), + 'test name', + 'Expected the parameter model name to match the serialized name'); + }); + }); + + suite('types', function() { + test('if the type property does not exist, nothing is assigned', function() { + const jso = { + 'id': 'test id', + 'name': 'test name', + 'returnTypes': [], + 'parameters': [ + { + 'id': 'test id', + 'name': 'test name', + }, + ], + }; + + chai.assert.doesNotThrow( + () => { + this.procedureMap.getProcedures()[0].getParameters()[0]; + }, + 'Expected the deserializer to skip the non-existant type property'); + }); + + test('if the type property exists, it is assigned', function() { + const jso = { + 'id': 'test id', + 'name': 'test name', + 'returnTypes': [], + 'parameters': [ + { + 'id': 'test id', + 'name': 'test name', + 'types': ['test type 1', 'test type 2'], + }, + ], + }; + + this.procedureSerializer.load([jso], this.workspace); + + const parameterModel = + this.procedureMap.getProcedures()[0].getParameters()[0]; + chai.assert.isNotNull( + parameterModel, 'Expected a parameter model to exist'); + chai.assert.deepEqual( + parameterModel.getTypes(), + ['test type 1', 'test type 2'], + 'Expected the parameter model types to match the serialized types'); + }); + }); + }); + }); }); diff --git a/tests/mocha/jso_serialization_test.js b/tests/mocha/jso_serialization_test.js index 810f5f295..1fd218134 100644 --- a/tests/mocha/jso_serialization_test.js +++ b/tests/mocha/jso_serialization_test.js @@ -794,4 +794,206 @@ suite('JSO Serialization', function() { assertProperty(variable, 'type', 'testType'); }); }); + + // TODO(#6522): Unskip serialization tests. + suite.skip('Procedures', function() { + class MockProcedureModel { + constructor() { + this.id = Blockly.utils.idGenerator.genUid(); + this.name = ''; + this.parameters = []; + this.returnTypes = null; + this.enabled = true; + } + + setName(name) { + this.name = name; + return this; + } + + insertParameter(parameterModel, index) { + this.parameters.splice(index, 0, parameterModel); + return this; + } + + deleteParameter(index) { + this.parameters.splice(index, 1); + return this; + } + + setReturnTypes(types) { + this.returnTypes = types; + return this; + } + + setEnabled(enabled) { + this.enabled = enabled; + return this; + } + + getId() { + return this.id; + } + + getName() { + return this.name; + } + + getParameter(index) { + return this.parameters[index]; + } + + getParameters() { + return [...this.parameters]; + } + + getReturnTypes() { + return this.returnTypes; + } + + getEnabled() { + return this.enabled; + } + } + + class MockParameterModel { + constructor(name) { + this.id = Blockly.utils.idGenerator.genUid(); + this.name = name; + this.types = []; + } + + setName(name) { + this.name = name; + return this; + } + + setTypes(types) { + this.types = types; + return this; + } + + getName() { + return this.name; + } + + getTypes() { + return this.types; + } + + getId() { + return this.id; + } + } + + setup(function() { + this.procedureMap = this.workspace.getProcedureMap(); + }); + + teardown(function() { + this.procedureMap = null; + }); + + suite('invariant properties', function() { + test('the state always has an id property', function() { + const procedureModel = new MockProcedureModel(); + this.procedureMap.add(procedureModel); + const jso = Blockly.serialization.workspaces.save(this.workspace); + const procedure = jso['procedures'][0]; + assertProperty(procedure, 'id', procedureModel.getId()); + }); + + test('if the name has not been set, name is an empty string', function() { + const procedureModel = new MockProcedureModel(); + this.procedureMap.add(procedureModel); + const jso = Blockly.serialization.workspaces.save(this.workspace); + const procedure = jso['procedures'][0]; + assertProperty(procedure, 'name', ''); + }); + + test('if the name has been set, name is the string', function() { + const procedureModel = new MockProcedureModel().setName('testName'); + this.procedureMap.add(procedureModel); + const jso = Blockly.serialization.workspaces.save(this.workspace); + const procedure = jso['procedures'][0]; + assertProperty(procedure, 'name', 'testName'); + }); + }); + + suite('return types', function() { + test('if the procedure does not return, returnTypes is null', function() { + const procedureModel = new MockProcedureModel(); + this.procedureMap.add(procedureModel); + const jso = Blockly.serialization.workspaces.save(this.workspace); + const procedure = jso['procedures'][0]; + assertProperty(procedure, 'returnTypes', null); + }); + + test( + 'if the procedure has no return type, returnTypes is an empty array', + function() { + const procedureModel = new MockProcedureModel().setReturnTypes([]); + this.procedureMap.add(procedureModel); + const jso = Blockly.serialization.workspaces.save(this.workspace); + const procedure = jso['procedures'][0]; + assertProperty(procedure, 'returnTypes', []); + }); + + test( + 'if the procedure has return types, returnTypes is the array', + function() { + const procedureModel = new MockProcedureModel() + .setReturnTypes(['a type']); + this.procedureMap.add(procedureModel); + const jso = Blockly.serialization.workspaces.save(this.workspace); + const procedure = jso['procedures'][0]; + assertProperty(procedure, 'returnTypes', ['a type']); + }); + }); + + suite('parameters', function() { + suite('invariant properties', function() { + test('the state always has an id property', function() { + const parameterModel = new MockParameterModel('testparam'); + this.procedureMap.add( + new MockProcedureModel().insertParameter(parameterModel, 0)); + const jso = Blockly.serialization.workspaces.save(this.workspace); + const parameter = jso['procedures'][0]['parameters'][0]; + assertProperty(parameter, 'id', parameterModel.getId()); + }); + + test('the state always has a name property', function() { + const parameterModel = new MockParameterModel('testparam'); + this.procedureMap.add( + new MockProcedureModel().insertParameter(parameterModel, 0)); + const jso = Blockly.serialization.workspaces.save(this.workspace); + const parameter = jso['procedures'][0]['parameters'][0]; + assertProperty(parameter, 'id', 'testparam'); + }); + }); + + suite('types', function() { + test( + 'if the parameter has no type, there is no type property', + function() { + const parameterModel = new MockParameterModel('testparam'); + this.procedureMap.add( + new MockProcedureModel().insertParameter(parameterModel, 0)); + const jso = Blockly.serialization.workspaces.save(this.workspace); + const parameter = jso['procedures'][0]['parameters'][0]; + assertNoProperty(parameter, 'types'); + }); + + test('if the parameter has types, types is an array', function() { + const parameterModel = + new MockParameterModel('testparam').setTypes(['a type']); + this.procedureMap.add( + new MockProcedureModel().insertParameter(parameterModel, 0)); + const jso = Blockly.serialization.workspaces.save(this.workspace); + const parameter = jso['procedures'][0]['parameters'][0]; + assertProperty(parameter, 'types', ['a type']); + }); + }); + }); + }); }); From 8db4eb0a413ad5d4cf45a37300da18bc6a6bc425 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Tue, 25 Oct 2022 13:11:39 -0700 Subject: [PATCH 51/69] chore: start command uses tsc watch (#6577) --- package-lock.json | 2 +- package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f67fc10de..0a482c9d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "chai": "^4.2.0", "clang-format": "^1.6.0", "closure-calculate-chunks": "^3.0.2", - "concurrently": "^7.0.0", + "concurrently": "^7.4.0", "eslint": "^8.4.1", "eslint-config-google": "^0.14.0", "eslint-plugin-jsdoc": "^39.3.6", diff --git a/package.json b/package.json index 1842c70be..af8979de4 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "publish:beta": "gulp publishBeta", "recompile": "gulp recompile", "release": "gulp gitCreateRC", - "start": "http-server ./ -o /tests/playground.html -c-1", + "start": "concurrently -n tsc,server \"tsc --watch --preserveWatchOutput --outDir 'build/src' --declarationDir 'build/declarations'\" \"http-server ./ -s -o /tests/playground.html -c-1\"", "test": "tests/run_all_tests.sh", "test:generators": "tests/scripts/run_generators.sh", "test:mocha:interactive": "http-server ./ -o /tests/mocha/index.html -c-1", @@ -76,7 +76,7 @@ "chai": "^4.2.0", "clang-format": "^1.6.0", "closure-calculate-chunks": "^3.0.2", - "concurrently": "^7.0.0", + "concurrently": "^7.4.0", "eslint": "^8.4.1", "eslint-config-google": "^0.14.0", "eslint-plugin-jsdoc": "^39.3.6", From fed57f24b7d6b4dec7bb834a7f13cb8e58733ca6 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 25 Oct 2022 14:12:57 -0700 Subject: [PATCH 52/69] fix: refactors concrete implementations of the procedure data models (#6575) * fix: expand the IParameterModel interface * fix: remove support for return types from the concrete procedure model * feat: add an interface for the procedure map, and add getting procedures * fix: add procedure map to workspace * chore: format * fix: add name parameter to procedure model to match parameter model * chore: format * chore: fix comments --- core/interfaces/i_parameter_model.ts | 10 +++++ core/interfaces/i_procedure_map.ts | 20 +++++++++ core/procedures/observable_parameter_model.ts | 14 ++++++ core/procedures/observable_procedure_map.ts | 11 ++++- core/procedures/observable_procedure_model.ts | 21 ++++++--- core/workspace.ts | 8 ++++ tests/mocha/procedure_map_test.js | 44 ++++++++++++------- 7 files changed, 105 insertions(+), 23 deletions(-) create mode 100644 core/interfaces/i_procedure_map.ts diff --git a/core/interfaces/i_parameter_model.ts b/core/interfaces/i_parameter_model.ts index 00d117240..fe9eda6b0 100644 --- a/core/interfaces/i_parameter_model.ts +++ b/core/interfaces/i_parameter_model.ts @@ -25,6 +25,16 @@ export interface IParameterModel { */ setTypes(types: string[]): this; + /** + * Returns the name of this parameter. + */ + getName(): string; + + /** + * Return the types of this parameter. + */ + getTypes(): string[]; + /** * Returns the unique language-neutral ID for the parameter. * diff --git a/core/interfaces/i_procedure_map.ts b/core/interfaces/i_procedure_map.ts new file mode 100644 index 000000000..0eead4025 --- /dev/null +++ b/core/interfaces/i_procedure_map.ts @@ -0,0 +1,20 @@ +/** + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import {IProcedureModel} from './i_procedure_model.js'; + + +export interface IProcedureMap extends Map { + /** + * Adds the given ProcedureModel to the map of procedure models, so that + * blocks can find it. + */ + add(proc: IProcedureModel): this; + + + /** Returns all of the procedures stored in this map. */ + getProcedures(): IProcedureModel[]; +} diff --git a/core/procedures/observable_parameter_model.ts b/core/procedures/observable_parameter_model.ts index fe0f5bdb1..535c6aea1 100644 --- a/core/procedures/observable_parameter_model.ts +++ b/core/procedures/observable_parameter_model.ts @@ -48,6 +48,20 @@ export class ObservableParameterModel implements IParameterModel { 'implement your own custom ParameterModel.'); } + /** + * Returns the name of this parameter. + */ + getName(): string { + return this.variable.name; + } + + /** + * Returns the types of this parameter. + */ + getTypes(): string[] { + return []; + } + /** * Returns the unique language-neutral ID for the parameter. * diff --git a/core/procedures/observable_procedure_map.ts b/core/procedures/observable_procedure_map.ts index 781cb4682..a9ad169c5 100644 --- a/core/procedures/observable_procedure_map.ts +++ b/core/procedures/observable_procedure_map.ts @@ -7,9 +7,11 @@ import type {IProcedureModel} from '../interfaces/i_procedure_model.js'; import {triggerProceduresUpdate} from './update_procedures.js'; import type {Workspace} from '../workspace.js'; +import {IProcedureMap} from '../interfaces/i_procedure_map.js'; -export class ObservableProcedureMap extends Map { +export class ObservableProcedureMap extends + Map implements IProcedureMap { constructor(private readonly workspace: Workspace) { super(); } @@ -52,4 +54,11 @@ export class ObservableProcedureMap extends Map { // TODO(#6526): See if this method is actually useful. return this.set(proc.getId(), proc); } + + /** + * Returns all of the procedures stored in this map. + */ + getProcedures(): IProcedureModel[] { + return [...this.values()]; + } } diff --git a/core/procedures/observable_procedure_model.ts b/core/procedures/observable_procedure_model.ts index e338d5161..be8d05fe5 100644 --- a/core/procedures/observable_procedure_model.ts +++ b/core/procedures/observable_procedure_model.ts @@ -13,13 +13,15 @@ import type {Workspace} from '../workspace.js'; export class ObservableProcedureModel implements IProcedureModel { private id: string; - private name = ''; + private name: string; private parameters: IParameterModel[] = []; private returnTypes: string[]|null = null; private enabled = true; - constructor(private readonly workspace: Workspace, id?: string) { + constructor( + private readonly workspace: Workspace, name: string, id?: string) { this.id = id ?? genUid(); + this.name = name; } /** Sets the human-readable name of the procedure. */ @@ -51,13 +53,22 @@ export class ObservableProcedureModel implements IProcedureModel { } /** - * Sets the return type(s) of the procedure. + * Sets whether the procedure has a return value (empty array) or no return + * value (null). * - * Pass null to represent a procedure that does not return. + * The built-in procedure model does not support procedures that have actual + * return types (i.e. non-empty arrays, e.g. ['number']). If you want your + * procedure block to have return types, you need to implement your own + * procedure model. */ setReturnTypes(types: string[]|null): this { - // TODO(#6516): Fire events. + if (types && types.length) { + throw new Error( + 'The built-in ProcedureModel does not support typing. You need to ' + + 'implement your own custom ProcedureModel.'); + } this.returnTypes = types; + // TODO(#6516): Fire events. triggerProceduresUpdate(this.workspace); return this; } diff --git a/core/workspace.ts b/core/workspace.ts index 101596374..0602fa834 100644 --- a/core/workspace.ts +++ b/core/workspace.ts @@ -32,6 +32,8 @@ import type * as toolbox from './utils/toolbox.js'; import {VariableMap} from './variable_map.js'; import type {VariableModel} from './variable_model.js'; import type {WorkspaceComment} from './workspace_comment.js'; +import {IProcedureMap} from './interfaces/i_procedure_map.js'; +import {ObservableProcedureMap} from './procedures.js'; /** @@ -110,6 +112,7 @@ export class Workspace implements IASTNodeLocation { private readonly blockDB = new Map(); private readonly typedBlocksDB = new Map(); private variableMap: VariableMap; + private procedureMap: IProcedureMap = new ObservableProcedureMap(this); /** * Blocks in the flyout can refer to variables that don't exist in the main @@ -829,6 +832,11 @@ export class Workspace implements IASTNodeLocation { this.variableMap = variableMap; } + /** Returns the map of all procedures on the workpace. */ + getProcedureMap(): IProcedureMap { + return this.procedureMap; + } + /** * Find the workspace with the specified ID. * diff --git a/tests/mocha/procedure_map_test.js b/tests/mocha/procedure_map_test.js index 34426eff4..848dda8dd 100644 --- a/tests/mocha/procedure_map_test.js +++ b/tests/mocha/procedure_map_test.js @@ -12,9 +12,7 @@ suite('Procedure Map', function() { setup(function() { sharedTestSetup.call(this); this.workspace = new Blockly.Workspace(); - // this.procedureMap = this.workspace.getProcedureMap(); - this.procedureMap = - new Blockly.procedures.ObservableProcedureMap(this.workspace); + this.procedureMap = this.workspace.getProcedureMap(); }); teardown(function() { @@ -40,7 +38,8 @@ suite('Procedure Map', function() { suite('procedure map updates', function() { test('inserting a procedure does not trigger an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); + new Blockly.procedures.ObservableProcedureModel( + this.workspace, 'test name'); this.procedureMap.set(procedureModel.getId(), procedureModel); chai.assert.isFalse( @@ -49,7 +48,8 @@ suite('Procedure Map', function() { test('adding a procedure does not trigger an update', function() { this.procedureMap.add( - new Blockly.procedures.ObservableProcedureModel(this.workspace)); + new Blockly.procedures.ObservableProcedureModel( + this.workspace, 'test name')); chai.assert.isFalse( this.updateSpy.called, 'Expected no update to be triggered'); @@ -57,7 +57,8 @@ suite('Procedure Map', function() { test('deleting a procedure triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); + new Blockly.procedures.ObservableProcedureModel( + this.workspace, 'test name'); this.procedureMap.add(procedureModel); this.procedureMap.delete(procedureModel.getId()); @@ -70,7 +71,8 @@ suite('Procedure Map', function() { suite('procedure model updates', function() { test('setting the name triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); + new Blockly.procedures.ObservableProcedureModel( + this.workspace, 'test name'); this.procedureMap.add(procedureModel); procedureModel.setName('new name'); @@ -81,10 +83,11 @@ suite('Procedure Map', function() { test('setting the return type triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); + new Blockly.procedures.ObservableProcedureModel( + this.workspace, 'test name'); this.procedureMap.add(procedureModel); - procedureModel.setReturnTypes(['return type 1', 'return type 2']); + procedureModel.setReturnTypes([]); chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); @@ -92,8 +95,9 @@ suite('Procedure Map', function() { test('removing the return type triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .setReturnTypes(['return type']); + new Blockly.procedures.ObservableProcedureModel( + this.workspace, 'test name') + .setReturnTypes([]); this.procedureMap.add(procedureModel); this.updateSpy.resetHistory(); @@ -105,7 +109,8 @@ suite('Procedure Map', function() { test('disabling the procedure triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); + new Blockly.procedures.ObservableProcedureModel( + this.workspace, 'test name'); this.procedureMap.add(procedureModel); procedureModel.setEnabled(false); @@ -116,7 +121,8 @@ suite('Procedure Map', function() { test('enabling the procedure triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) + new Blockly.procedures.ObservableProcedureModel( + this.workspace, 'test name') .setEnabled(false); this.procedureMap.add(procedureModel); this.updateSpy.resetHistory(); @@ -129,7 +135,8 @@ suite('Procedure Map', function() { test('inserting a parameter triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); + new Blockly.procedures.ObservableProcedureModel( + this.workspace, 'test name'); this.procedureMap.add(procedureModel); procedureModel.insertParameter( @@ -141,7 +148,8 @@ suite('Procedure Map', function() { test('deleting a parameter triggers an update', function() { const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) + new Blockly.procedures.ObservableProcedureModel( + this.workspace, 'test name') .insertParameter( new Blockly.procedures.ObservableParameterModel( this.workspace)); @@ -161,7 +169,8 @@ suite('Procedure Map', function() { new Blockly.procedures.ObservableParameterModel( this.workspace, 'test1'); this.procedureMap.add( - new Blockly.procedures.ObservableProcedureModel(this.workspace) + new Blockly.procedures.ObservableProcedureModel( + this.workspace, 'test name') .insertParameter(parameterModel)); this.updateSpy.resetHistory(); @@ -176,7 +185,8 @@ suite('Procedure Map', function() { new Blockly.procedures.ObservableParameterModel( this.workspace, 'test1'); this.procedureMap.add( - new Blockly.procedures.ObservableProcedureModel(this.workspace) + new Blockly.procedures.ObservableProcedureModel( + this.workspace, 'test name') .insertParameter(parameterModel)); this.updateSpy.resetHistory(); From db70be2c964f5010994cdf35061853b24f0eb257 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Wed, 26 Oct 2022 12:26:46 +0100 Subject: [PATCH 53/69] fix(build): Fix spurious tsc errors cause by tsc version bump * Bump @types/inquirer to version that resolves type errors. * Add types: [] directive to tsconfig.json's compilerOptions to prevent future issues of this kind. See https://github.com/google/blockly/pull/6564#issuecomment-1291885382 for details. --- package-lock.json | 18 ++++++++---------- tsconfig.json | 13 +++++++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 40e12b2f7..3e48bd464 100644 --- a/package-lock.json +++ b/package-lock.json @@ -828,14 +828,13 @@ "dev": true }, "node_modules/@types/inquirer": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-8.1.3.tgz", - "integrity": "sha512-AayK4ZL5ssPzR1OtnOLGAwpT0Dda3Xi/h1G0l1oJDNrowp7T1423q4Zb8/emr7tzRlCy4ssEri0LWVexAqHyKQ==", + "version": "8.2.4", + "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-8.2.4.tgz", + "integrity": "sha512-Pxxx3i3AyK7vKAj3LRM/vF7ETcHKiLJ/u5CnNgbz/eYj/vB3xGAYtRxI5IKtq0hpe5iFHD22BKV3n6WHUu0k4Q==", "dev": true, "peer": true, "dependencies": { - "@types/through": "*", - "rxjs": "^7.2.0" + "@types/through": "*" } }, "node_modules/@types/json-schema": { @@ -14345,14 +14344,13 @@ "dev": true }, "@types/inquirer": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-8.1.3.tgz", - "integrity": "sha512-AayK4ZL5ssPzR1OtnOLGAwpT0Dda3Xi/h1G0l1oJDNrowp7T1423q4Zb8/emr7tzRlCy4ssEri0LWVexAqHyKQ==", + "version": "8.2.4", + "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-8.2.4.tgz", + "integrity": "sha512-Pxxx3i3AyK7vKAj3LRM/vF7ETcHKiLJ/u5CnNgbz/eYj/vB3xGAYtRxI5IKtq0hpe5iFHD22BKV3n6WHUu0k4Q==", "dev": true, "peer": true, "requires": { - "@types/through": "*", - "rxjs": "^7.2.0" + "@types/through": "*" } }, "@types/json-schema": { diff --git a/tsconfig.json b/tsconfig.json index a414b74e8..8d3243af4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,5 +26,18 @@ // cannot leave it enabled. // See: https://github.com/microsoft/TypeScript/issues/49974 // "importsNotUsedAsValues": "error" + + // tsc has a clever and usually helpful feature ("@types support") + // wherein it automatically ingests any type definitions found in + // node_modues/@types/**/*.d.ts. This lets you tell it about the + // types for your favourite framework or library just by + // installing the relevant @types/ npm package. + // + // We don't (as of this writing) use this feature, and it causes a + // problem when one of our dependencies pulls in such a package + // which turns out to have syntax errors (see e.g. discussion on + // PR #6564: https://github.com/google/blockly/pull/6564), so + // disable it except for the explicitly-specified types. + "types": [], } } From c1fbcc5bed93229acc941c6bf7d7cc621fb02765 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Wed, 26 Oct 2022 14:06:51 -0700 Subject: [PATCH 54/69] chore(release): delete release-please configuration (#6546) --- .github/release-please.yml | 7 ------- .release-please-manifest.json | 3 --- release-please-config.json | 6 ------ 3 files changed, 16 deletions(-) delete mode 100644 .github/release-please.yml delete mode 100644 .release-please-manifest.json delete mode 100644 release-please-config.json diff --git a/.github/release-please.yml b/.github/release-please.yml deleted file mode 100644 index f18bc7a70..000000000 --- a/.github/release-please.yml +++ /dev/null @@ -1,7 +0,0 @@ -primaryBranch: develop -releaseType: node -packageName: blockly -manifest: true -manifestConfig: release-please-config.json -manifestFile: .release-please-manifest.json -handleGHRelease: true diff --git a/.release-please-manifest.json b/.release-please-manifest.json deleted file mode 100644 index 32ac6588b..000000000 --- a/.release-please-manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - ".": "8.0.0" -} diff --git a/release-please-config.json b/release-please-config.json deleted file mode 100644 index 1a90aca04..000000000 --- a/release-please-config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "packages": { - ".": {} - }, - "draft": true -} From 52879dd953df0916fec9481c145468f6ae762605 Mon Sep 17 00:00:00 2001 From: YAMADA Yutaka Date: Fri, 28 Oct 2022 05:02:50 +0900 Subject: [PATCH 55/69] fix(build): build/test on windows (#6431) * build: build/test on windows * chore(deps): bump @hyperjump/json-schema from 0.18.4 to 0.18.5 * chore(deps): add gulp-gzip 1.4.2 * build: migrate test scripts to gulp task (test_tasks.js) * build: not to use the grep command * build: normalize path * fix: Modified based on review suggestions. * Add JSDoc comment * Line length <= 80 characters. * Formatting test output as previously. * Always continue even if a test unit fails. * Suppress the gulp messages. * Fix test_tasks.js to pass eslint. * fix: Modified based on review suggestions. * Change generator test output directory. * Formatting test output as previously. * fix: Formatting test output as previously. * fix: Modified based on review suggestions. --- gulpfile.js | 3 + package-lock.json | 219 ++++++++--- package.json | 7 +- scripts/gulpfiles/build_tasks.js | 37 +- scripts/gulpfiles/test_tasks.js | 350 ++++++++++++++++++ scripts/helpers.js | 35 ++ tests/generators/run_generators_in_browser.js | 8 +- tests/migration/validate-renamings.js | 3 +- tests/mocha/run_mocha_tests_in_browser.js | 3 +- tests/run_all_tests.sh | 91 ----- tests/scripts/run_generators.sh | 57 --- 11 files changed, 604 insertions(+), 209 deletions(-) create mode 100644 scripts/gulpfiles/test_tasks.js create mode 100644 scripts/helpers.js mode change 100755 => 100644 tests/migration/validate-renamings.js delete mode 100755 tests/run_all_tests.sh delete mode 100755 tests/scripts/run_generators.sh diff --git a/gulpfile.js b/gulpfile.js index f8bbbca6b..3bfe4f7b9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -19,6 +19,7 @@ const licenseTasks = require('./scripts/gulpfiles/license_tasks'); const appengineTasks = require('./scripts/gulpfiles/appengine_tasks'); const releaseTasks = require('./scripts/gulpfiles/release_tasks'); const cleanupTasks = require('./scripts/gulpfiles/cleanup_tasks'); +const testTasks = require('./scripts/gulpfiles/test_tasks'); module.exports = { deployDemos: appengineTasks.deployDemos, @@ -50,4 +51,6 @@ module.exports = { publish: releaseTasks.publish, publishBeta: releaseTasks.publishBeta, sortRequires: cleanupTasks.sortRequires, + test: testTasks.test, + testGenerators: testTasks.generators, }; diff --git a/package-lock.json b/package-lock.json index 0a482c9d7..97d12a615 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,10 +12,11 @@ "jsdom": "15.2.1" }, "devDependencies": { + "@blockly/block-test": "^3.0.0", "@blockly/dev-tools": "^5.0.0", "@blockly/theme-modern": "^3.0.0", - "@hyperjump/json-schema": "^0.18.4", + "@hyperjump/json-schema": "^0.18.5", "@microsoft/api-extractor": "^7.29.5", "@typescript-eslint/eslint-plugin": "^5.33.1", "@wdio/selenium-standalone-service": "^7.10.1", @@ -31,6 +32,7 @@ "gulp": "^4.0.2", "gulp-clang-format": "^1.0.27", "gulp-concat": "^2.6.1", + "gulp-gzip": "^1.4.2", "gulp-insert": "^0.5.0", "gulp-rename": "^2.0.0", "gulp-replace": "^1.0.0", @@ -419,13 +421,13 @@ "dev": true }, "node_modules/@hyperjump/json-pointer": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/@hyperjump/json-pointer/-/json-pointer-0.9.2.tgz", - "integrity": "sha512-PGCyTWO+WTkNWhMdlgE7OiQYPVkme9/e6d7K2xiZxH1wMGxGgZEEDNCe8hox7rkuD1equ4eZM+K3eoPCexckmA==", + "version": "0.9.6", + "resolved": "https://registry.npmjs.org/@hyperjump/json-pointer/-/json-pointer-0.9.6.tgz", + "integrity": "sha512-3szMJLfz+1wtfPHnGi1sHzwFfFdZqIZLCCYtaD47vLZMAQCbtoBRVZn44jJgIQ6v37+8fom5rsxSSIMKWi0zbg==", "dev": true, "hasInstallScript": true, "dependencies": { - "just-curry-it": "^3.2.1" + "just-curry-it": "^5.2.1" }, "funding": { "type": "github", @@ -448,9 +450,9 @@ } }, "node_modules/@hyperjump/json-schema-core": { - "version": "0.23.6", - "resolved": "https://registry.npmjs.org/@hyperjump/json-schema-core/-/json-schema-core-0.23.6.tgz", - "integrity": "sha512-X0IzGRi5K4c91awB3xNt5bvbs34UyHwOpRKKFFJ2nWDWW7e22VNGvibqo/S2rdFyta3wqOHTICFNTQjjcVdIZg==", + "version": "0.23.7", + "resolved": "https://registry.npmjs.org/@hyperjump/json-schema-core/-/json-schema-core-0.23.7.tgz", + "integrity": "sha512-64gBteTl+zAvI1D68l/+gH7ncuM+Cf0rGdm/YwtsYZlNfbybgFD5R5uuJCsPGJDm5ZYqqWMdPIq6Nh5jDENYRw==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -467,9 +469,9 @@ } }, "node_modules/@hyperjump/pact": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@hyperjump/pact/-/pact-0.2.1.tgz", - "integrity": "sha512-imzl9j1UiqM/HC3kgfS0/TdXcEFGFkq5EwjyaztLfdmia8KLBXGy3rC96K+nnyY+2fA69yA9HtnDappub5VSQQ==", + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@hyperjump/pact/-/pact-0.2.4.tgz", + "integrity": "sha512-BGmyLaUSCMVyHrwXr67rMxgiQHPHwcmVCjROoY8q232EpMz9d9aFCkgGhdx//yEfHM7zgsm0zZ8RD/F89uPySg==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -480,6 +482,12 @@ "url": "https://github.com/sponsors/jdesrosiers" } }, + "node_modules/@hyperjump/pact/node_modules/just-curry-it": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/just-curry-it/-/just-curry-it-3.2.1.tgz", + "integrity": "sha512-Q8206k8pTY7krW32cdmPsP+DqqLgWx/hYPSj9/+7SYqSqz7UuwPbfSe07lQtvuuaVyiSJveXk0E5RydOuWwsEg==", + "dev": true + }, "node_modules/@microsoft/api-extractor": { "version": "7.31.2", "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.31.2.tgz", @@ -2078,6 +2086,12 @@ "node": ">=0.10.0" } }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true + }, "node_modules/anymatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", @@ -2733,6 +2747,15 @@ "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=", "dev": true }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/cac": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/cac/-/cac-3.0.4.tgz", @@ -4258,15 +4281,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/diff": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/diff/-/diff-2.2.3.tgz", - "integrity": "sha1-YOr9DSjukG5Oj/ClLBIpUhAzv5k=", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -6521,6 +6535,15 @@ "through2": "^2.0.0" } }, + "node_modules/gulp-diff/node_modules/diff": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/diff/-/diff-2.2.3.tgz", + "integrity": "sha512-9wfm3RLzMp/PyTFWuw9liEzdlxsdGixCW0ZTU1XDmtlAkvpVXTPGF8KnfSs0hm3BPbg19OrUPPsRkHXoREpP1g==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/gulp-diff/node_modules/through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", @@ -6531,6 +6554,45 @@ "xtend": "~4.0.1" } }, + "node_modules/gulp-gzip": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/gulp-gzip/-/gulp-gzip-1.4.2.tgz", + "integrity": "sha512-ZIxfkUwk2XmZPTT9pPHrHUQlZMyp9nPhg2sfoeN27mBGpi7OaHnOD+WCN41NXjfJQ69lV1nQ9LLm1hYxx4h3UQ==", + "dev": true, + "dependencies": { + "ansi-colors": "^1.0.1", + "bytes": "^3.0.0", + "fancy-log": "^1.3.2", + "plugin-error": "^1.0.0", + "stream-to-array": "^2.3.0", + "through2": "^2.0.3" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/gulp-gzip/node_modules/ansi-colors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", + "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", + "dev": true, + "dependencies": { + "ansi-wrap": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gulp-gzip/node_modules/through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dev": true, + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, "node_modules/gulp-insert": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/gulp-insert/-/gulp-insert-0.5.0.tgz", @@ -8006,9 +8068,9 @@ } }, "node_modules/just-curry-it": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/just-curry-it/-/just-curry-it-3.2.1.tgz", - "integrity": "sha512-Q8206k8pTY7krW32cdmPsP+DqqLgWx/hYPSj9/+7SYqSqz7UuwPbfSe07lQtvuuaVyiSJveXk0E5RydOuWwsEg==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/just-curry-it/-/just-curry-it-5.2.1.tgz", + "integrity": "sha512-M8qhhO9WVNc3yZgf3qfiNxMIsQlHqFHJ3vMI8N/rkp852h1utOB/N3ebS8jeXGAwYSbkdd0K6zP9eZneUtjHwA==", "dev": true }, "node_modules/just-debounce": { @@ -11919,6 +11981,15 @@ "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==", "dev": true }, + "node_modules/stream-to-array": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/stream-to-array/-/stream-to-array-2.3.0.tgz", + "integrity": "sha512-UsZtOYEn4tWU2RGLOXr/o/xjRBftZRlG3dEWoaHr8j4GuypJ3isitGbVyjQKAuMu+xbiop8q224TjiZWc4XTZA==", + "dev": true, + "dependencies": { + "any-promise": "^1.1.0" + } + }, "node_modules/streamqueue": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/streamqueue/-/streamqueue-0.0.6.tgz", @@ -13988,12 +14059,12 @@ "dev": true }, "@hyperjump/json-pointer": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/@hyperjump/json-pointer/-/json-pointer-0.9.2.tgz", - "integrity": "sha512-PGCyTWO+WTkNWhMdlgE7OiQYPVkme9/e6d7K2xiZxH1wMGxGgZEEDNCe8hox7rkuD1equ4eZM+K3eoPCexckmA==", + "version": "0.9.6", + "resolved": "https://registry.npmjs.org/@hyperjump/json-pointer/-/json-pointer-0.9.6.tgz", + "integrity": "sha512-3szMJLfz+1wtfPHnGi1sHzwFfFdZqIZLCCYtaD47vLZMAQCbtoBRVZn44jJgIQ6v37+8fom5rsxSSIMKWi0zbg==", "dev": true, "requires": { - "just-curry-it": "^3.2.1" + "just-curry-it": "^5.2.1" } }, "@hyperjump/json-schema": { @@ -14007,9 +14078,9 @@ } }, "@hyperjump/json-schema-core": { - "version": "0.23.6", - "resolved": "https://registry.npmjs.org/@hyperjump/json-schema-core/-/json-schema-core-0.23.6.tgz", - "integrity": "sha512-X0IzGRi5K4c91awB3xNt5bvbs34UyHwOpRKKFFJ2nWDWW7e22VNGvibqo/S2rdFyta3wqOHTICFNTQjjcVdIZg==", + "version": "0.23.7", + "resolved": "https://registry.npmjs.org/@hyperjump/json-schema-core/-/json-schema-core-0.23.7.tgz", + "integrity": "sha512-64gBteTl+zAvI1D68l/+gH7ncuM+Cf0rGdm/YwtsYZlNfbybgFD5R5uuJCsPGJDm5ZYqqWMdPIq6Nh5jDENYRw==", "dev": true, "requires": { "@hyperjump/json-pointer": "^0.9.1", @@ -14021,12 +14092,20 @@ } }, "@hyperjump/pact": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@hyperjump/pact/-/pact-0.2.1.tgz", - "integrity": "sha512-imzl9j1UiqM/HC3kgfS0/TdXcEFGFkq5EwjyaztLfdmia8KLBXGy3rC96K+nnyY+2fA69yA9HtnDappub5VSQQ==", + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@hyperjump/pact/-/pact-0.2.4.tgz", + "integrity": "sha512-BGmyLaUSCMVyHrwXr67rMxgiQHPHwcmVCjROoY8q232EpMz9d9aFCkgGhdx//yEfHM7zgsm0zZ8RD/F89uPySg==", "dev": true, "requires": { "just-curry-it": "^3.1.0" + }, + "dependencies": { + "just-curry-it": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/just-curry-it/-/just-curry-it-3.2.1.tgz", + "integrity": "sha512-Q8206k8pTY7krW32cdmPsP+DqqLgWx/hYPSj9/+7SYqSqz7UuwPbfSe07lQtvuuaVyiSJveXk0E5RydOuWwsEg==", + "dev": true + } } }, "@microsoft/api-extractor": { @@ -15266,6 +15345,12 @@ "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", "dev": true }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true + }, "anymatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", @@ -15768,6 +15853,12 @@ "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=", "dev": true }, + "bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true + }, "cac": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/cac/-/cac-3.0.4.tgz", @@ -16966,12 +17057,6 @@ "integrity": "sha512-QeoiFUnCNlXusSIfCOov0bn9uGTx7Q+9Cj+vvNFzHym5OcJeXyFxXNtvWtFmDorlEnTJYL5S6wXv+kgAg1s/Zw==", "dev": true }, - "diff": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/diff/-/diff-2.2.3.tgz", - "integrity": "sha1-YOr9DSjukG5Oj/ClLBIpUhAzv5k=", - "dev": true - }, "dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -18788,6 +18873,47 @@ "through2": "^2.0.0" }, "dependencies": { + "diff": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/diff/-/diff-2.2.3.tgz", + "integrity": "sha512-9wfm3RLzMp/PyTFWuw9liEzdlxsdGixCW0ZTU1XDmtlAkvpVXTPGF8KnfSs0hm3BPbg19OrUPPsRkHXoREpP1g==", + "dev": true + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } + } + }, + "gulp-gzip": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/gulp-gzip/-/gulp-gzip-1.4.2.tgz", + "integrity": "sha512-ZIxfkUwk2XmZPTT9pPHrHUQlZMyp9nPhg2sfoeN27mBGpi7OaHnOD+WCN41NXjfJQ69lV1nQ9LLm1hYxx4h3UQ==", + "dev": true, + "requires": { + "ansi-colors": "^1.0.1", + "bytes": "^3.0.0", + "fancy-log": "^1.3.2", + "plugin-error": "^1.0.0", + "stream-to-array": "^2.3.0", + "through2": "^2.0.3" + }, + "dependencies": { + "ansi-colors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", + "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", + "dev": true, + "requires": { + "ansi-wrap": "^0.1.0" + } + }, "through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", @@ -19964,9 +20090,9 @@ } }, "just-curry-it": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/just-curry-it/-/just-curry-it-3.2.1.tgz", - "integrity": "sha512-Q8206k8pTY7krW32cdmPsP+DqqLgWx/hYPSj9/+7SYqSqz7UuwPbfSe07lQtvuuaVyiSJveXk0E5RydOuWwsEg==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/just-curry-it/-/just-curry-it-5.2.1.tgz", + "integrity": "sha512-M8qhhO9WVNc3yZgf3qfiNxMIsQlHqFHJ3vMI8N/rkp852h1utOB/N3ebS8jeXGAwYSbkdd0K6zP9eZneUtjHwA==", "dev": true }, "just-debounce": { @@ -23117,6 +23243,15 @@ "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==", "dev": true }, + "stream-to-array": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/stream-to-array/-/stream-to-array-2.3.0.tgz", + "integrity": "sha512-UsZtOYEn4tWU2RGLOXr/o/xjRBftZRlG3dEWoaHr8j4GuypJ3isitGbVyjQKAuMu+xbiop8q224TjiZWc4XTZA==", + "dev": true, + "requires": { + "any-promise": "^1.1.0" + } + }, "streamqueue": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/streamqueue/-/streamqueue-0.0.6.tgz", diff --git a/package.json b/package.json index af8979de4..0e30f04f3 100644 --- a/package.json +++ b/package.json @@ -49,8 +49,8 @@ "recompile": "gulp recompile", "release": "gulp gitCreateRC", "start": "concurrently -n tsc,server \"tsc --watch --preserveWatchOutput --outDir 'build/src' --declarationDir 'build/declarations'\" \"http-server ./ -s -o /tests/playground.html -c-1\"", - "test": "tests/run_all_tests.sh", - "test:generators": "tests/scripts/run_generators.sh", + "test": "gulp --silent test", + "test:generators": "gulp --silent testGenerators", "test:mocha:interactive": "http-server ./ -o /tests/mocha/index.html -c-1", "test:compile:advanced": "gulp buildAdvancedCompilationTest --debug", "updateGithubPages": "gulp gitUpdateGithubPages" @@ -69,7 +69,7 @@ "@blockly/block-test": "^3.0.0", "@blockly/dev-tools": "^5.0.0", "@blockly/theme-modern": "^3.0.0", - "@hyperjump/json-schema": "^0.18.4", + "@hyperjump/json-schema": "^0.18.5", "@microsoft/api-extractor": "^7.29.5", "@typescript-eslint/eslint-plugin": "^5.33.1", "@wdio/selenium-standalone-service": "^7.10.1", @@ -85,6 +85,7 @@ "gulp": "^4.0.2", "gulp-clang-format": "^1.0.27", "gulp-concat": "^2.6.1", + "gulp-gzip": "^1.4.2", "gulp-insert": "^0.5.0", "gulp-rename": "^2.0.0", "gulp-replace": "^1.0.0", diff --git a/scripts/gulpfiles/build_tasks.js b/scripts/gulpfiles/build_tasks.js index 8f0cecfeb..811281814 100644 --- a/scripts/gulpfiles/build_tasks.js +++ b/scripts/gulpfiles/build_tasks.js @@ -28,6 +28,8 @@ var rimraf = require('rimraf'); var {BUILD_DIR, DEPS_FILE, TEST_DEPS_FILE, TSC_OUTPUT_DIR, TYPINGS_BUILD_DIR} = require('./config'); var {getPackageJson} = require('./helper_tasks'); +var {posixPath} = require('../helpers'); + //////////////////////////////////////////////////////////// // Build // //////////////////////////////////////////////////////////// @@ -102,7 +104,9 @@ const NAMESPACE_PROPERTY = '__namespace__'; const chunks = [ { name: 'blockly', - entry: path.join(CORE_DIR, 'main.js'), + entry: posixPath((argv.compileTs) ? + path.join(TSC_OUTPUT_DIR, CORE_DIR, 'main.js') : + path.join(CORE_DIR, 'main.js')), exports: 'module$build$src$core$blockly', reexport: 'Blockly', }, @@ -337,6 +341,18 @@ function buildDeps(done) { 'tests/mocha' ]; + /** + * Extracts lines that contain the specified keyword. + * @param {string} text output text + * @param {string} keyword extract lines with this keyword + * @returns {string} modified text + */ + function extractOutputs(text, keyword) { + return text.split('\n') + .filter((line) => line.includes(keyword)) + .join('\n'); + } + function filterErrors(text) { return text.split('\n') .filter( @@ -349,29 +365,29 @@ function buildDeps(done) { new Promise((resolve, reject) => { const args = roots.map(root => `--root '${root}' `).join(''); exec( - `closure-make-deps ${args} >'${DEPS_FILE}'`, - {stdio: ['inherit', 'inherit', 'pipe']}, + `closure-make-deps ${args}`, (error, stdout, stderr) => { console.warn(filterErrors(stderr)); if (error) { reject(error); } else { + fs.writeFileSync(DEPS_FILE, stdout); resolve(); } }); }).then(() => new Promise((resolve, reject) => { - // Use grep to filter out the entries that are already in deps.js. + // Filter out the entries that are already in deps.js. const testArgs = testRoots.map(root => `--root '${root}' `).join(''); exec( - `closure-make-deps ${testArgs} 2>/dev/null\ - | grep 'tests/mocha' > '${TEST_DEPS_FILE}'`, - {stdio: ['inherit', 'inherit', 'pipe']}, + `closure-make-deps ${testArgs}`, (error, stdout, stderr) => { console.warn(filterErrors(stderr)); if (error) { reject(error); } else { + fs.writeFileSync(TEST_DEPS_FILE, + extractOutputs(stdout, 'tests/mocha')); resolve(); } }); @@ -520,9 +536,6 @@ return ${chunk.exports}; * closure-calculate-chunks. */ function getChunkOptions() { - if (argv.compileTs) { - chunks[0].entry = path.join(TSC_OUTPUT_DIR, chunks[0].entry); - } const basePath = path.join(TSC_OUTPUT_DIR, 'closure', 'goog', 'base_minimal.js'); const cccArgs = [ @@ -560,7 +573,9 @@ function getChunkOptions() { // chunk depends on any chunk but the first), so we look for // one of the entrypoints amongst the files in each chunk. const chunkByNickname = Object.create(null); - const jsFiles = rawOptions.js.slice(); // Will be modified via .splice! + // Copy and convert to posix js file paths. + // Result will be modified via `.splice`! + const jsFiles = rawOptions.js.map(p => posixPath(p)); const chunkList = rawOptions.chunk.map((element) => { const [nickname, numJsFiles, parentNick] = element.split(':'); diff --git a/scripts/gulpfiles/test_tasks.js b/scripts/gulpfiles/test_tasks.js new file mode 100644 index 000000000..54a5ffa92 --- /dev/null +++ b/scripts/gulpfiles/test_tasks.js @@ -0,0 +1,350 @@ +/** + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Gulp tasks to test. + */ +/* eslint-env node */ + +const gulp = require('gulp'); +const gzip = require('gulp-gzip'); +const fs = require('fs'); +const path = require('path'); +const {execSync} = require('child_process'); +const rimraf = require('rimraf'); + +const {BUILD_DIR} = require('./config'); + +const runMochaTestsInBrowser = + require('../../tests/mocha/run_mocha_tests_in_browser.js'); + +const runGeneratorsInBrowser = + require('../../tests/generators/run_generators_in_browser.js'); + +const OUTPUT_DIR = 'build/generators/'; +const GOLDEN_DIR = 'tests/generators/golden/'; + +const BOLD_GREEN = '\x1b[1;32m'; +const BOLD_RED = '\x1b[1;31m'; +const ANSI_RESET = '\x1b[0m'; + +let failerCount = 0; + +/** + * Helper method for running test code block. + * @param {string} id test id + * @param {function} block test code block + * @return {Promise} asynchronous result + */ +function runTestBlock(id, block) { + return new Promise((resolve) => { + console.log('======================================='); + console.log(`== ${id}`); + if (process.env.CI) console.log('::group::'); + block() + .then((result) => { + if (process.env.CI) console.log('::endgroup::'); + console.log(`${BOLD_GREEN}SUCCESS:${ANSI_RESET} ${id}`); + resolve(result); + }) + .catch((err) => { + failerCount++; + console.error(err.message); + if (process.env.CI) console.log('::endgroup::'); + console.log(`${BOLD_RED}FAILED:${ANSI_RESET} ${id}`); + // Always continue. + resolve(err); + }); + }); +} + +/** + * Helper method for running test command. + * @param {string} id test id + * @param {string} command command line to run + * @return {Promise} asynchronous result + */ +function runTestCommand(id, command) { + return runTestBlock(id, async() => { + return execSync(command, {stdio: 'inherit'}); + }, false); +} + +/** + * Lint the codebase. + * Skip for CI environments, because linting is run separately. + * @return {Promise} asynchronous result + */ +function eslint() { + if (process.env.CI) { + console.log('Skip linting.'); + return Promise.resolve(); + } + return runTestCommand('eslint', 'eslint .'); +} + +/** + * Run the full usual build process, checking to ensure there are no + * closure compiler warnings / errors. + * @return {Promise} asynchronous result + */ +function buildDebug() { + return runTestCommand('build-debug', 'npm run build-debug'); +} + +/** + * Run renaming validation test. + * @return {Promise} asynchronous result + */ +function renamings() { + return runTestCommand('renamings', 'node tests/migration/validate-renamings.js'); +} + +/** + * Helper method for gzipping file. + * @param {string} file target file + * @return {Promise} asynchronous result + */ +function gzipFile(file) { + return new Promise((resolve) => { + const name = path.posix.join('build', file); + + const stream = gulp.src(name) + .pipe(gzip()) + .pipe(gulp.dest('build')); + + stream.on('end', () => { + resolve(); + }); + }); +} + +/** + * Helper method for comparing file size. + * @param {string} file target file + * @param {number} expected expected size + * @return {number} 0: success / 1: failed + */ +function compareSize(file, expected) { + const name = path.posix.join(BUILD_DIR, file); + const compare = Math.floor(expected * 1.1); + const stat = fs.statSync(name); + const size = stat.size; + + if (size > compare) { + const message = `Failed: ` + + `Size of ${name} has grown more than 10%. ${size} vs ${expected} `; + console.log(`${BOLD_RED}${message}${ANSI_RESET}`); + return 1; + } else { + const message = + `Size of ${name} at ${size} compared to previous ${expected}`; + console.log(`${BOLD_GREEN}${message}${ANSI_RESET}`); + return 0; + } +} + +/** + * Helper method for zipping the compressed files. + * @return {Promise} asynchronous result + */ +function zippingFiles() { + // GZip them for additional size comparisons (keep originals, force + // overwite previously-gzipped copies). + console.log('Zipping the compressed files'); + const gzip1 = gzipFile('blockly_compressed.js'); + const gzip2 = gzipFile('blocks_compressed.js'); + return Promise.all([gzip1, gzip2]); +} + +/** + * Check the sizes of built files for unexpected growth. + * @return {Promise} asynchronous result + */ +function metadata() { + return runTestBlock('metadata', async() => { + // Zipping the compressed files. + await zippingFiles(); + // Read expected size from script. + const contents = fs.readFileSync('tests/scripts/check_metadata.sh') + .toString(); + const pattern = /^readonly (?[A-Z_]+)=(?\d+)$/gm; + const matches = contents.matchAll(pattern); + const expected = {}; + for (const match of matches) { + expected[match.groups.key] = match.groups.value; + } + + // Check the sizes of the files. + let failed = 0; + failed += compareSize('blockly_compressed.js', + expected.BLOCKLY_SIZE_EXPECTED); + failed += compareSize('blocks_compressed.js', + expected.BLOCKS_SIZE_EXPECTED); + failed += compareSize('blockly_compressed.js.gz', + expected.BLOCKLY_GZ_SIZE_EXPECTED); + failed += compareSize('blocks_compressed.js.gz', + expected.BLOCKS_GZ_SIZE_EXPECTED); + if (failed > 0) { + throw new Error('Unexpected growth was detected.'); + } + }); +} + +/** + * Run Mocha tests inside a browser. + * @return {Promise} asynchronous result + */ +function mocha() { + return runTestBlock('mocha', async() => { + const result = await runMochaTestsInBrowser().catch(e => { + throw e; + }); + if (result) { + throw new Error('Mocha tests failed'); + } + console.log('Mocha tests passed'); + }); +} + +/** + * Helper method for comparison file. + * @param {string} file1 first target file + * @param {string} file2 second target file + * @return {boolean} comparison result (true: same / false: different) + */ +function compareFile(file1, file2) { + const buf1 = fs.readFileSync(file1); + const buf2 = fs.readFileSync(file2); + // Normalize the line feed. + const code1 = buf1.toString().replace(/(?:\r\n|\r|\n)/g, '\n'); + const code2 = buf2.toString().replace(/(?:\r\n|\r|\n)/g, '\n'); + const result = (code1 === code2); + return result; +} + +/** + * Helper method for checking the result of generator. + * @param {string} suffix target suffix + * @return {number} check result (0: success / 1: failed) + */ +function checkResult(suffix) { + const fileName = `generated.${suffix}`; + const resultFileName = path.posix.join(OUTPUT_DIR, fileName); + + const SUCCESS_PREFIX = `${BOLD_GREEN}SUCCESS:${ANSI_RESET}`; + const FAILURE_PREFIX = `${BOLD_RED}FAILED:${ANSI_RESET}`; + + if (fs.existsSync(resultFileName)) { + const goldenFileName = path.posix.join(GOLDEN_DIR, fileName); + if (fs.existsSync(goldenFileName)) { + if (compareFile(resultFileName, goldenFileName)) { + console.log(`${SUCCESS_PREFIX} ${suffix}: ` + + `${resultFileName} matches ${goldenFileName}`); + return 0; + } else { + console.log( + `${FAILURE_PREFIX} ${suffix}: ` + + `${resultFileName} does not match ${goldenFileName}`); + } + } else { + console.log(`File ${goldenFileName} not found!`); + } + } else { + console.log(`File ${resultFileName} not found!`); + } + return 1; +} + +/** + * Run generator tests inside a browser and check the results. + * @return {Promise} asynchronous result + */ +function generators() { + return runTestBlock('generators', async() => { + // Clean up. + rimraf.sync(OUTPUT_DIR); + fs.mkdirSync(OUTPUT_DIR); + + await runGeneratorsInBrowser(OUTPUT_DIR).catch(() => {}); + + const generatorSuffixes = ['js', 'py', 'dart', 'lua', 'php']; + let failed = 0; + generatorSuffixes.forEach((suffix) => { + failed += checkResult(suffix); + }); + + if (failed === 0) { + console.log(`${BOLD_GREEN}All generator tests passed.${ANSI_RESET}`); + } else { + console.log( + `${BOLD_RED}Failures in ${failed} generator tests.${ANSI_RESET}`); + throw new Error('Generator tests failed.'); + } + }); +} + +/** + * Run the package build process, as Node tests depend on it. + * @return {Promise} asynchronous result + */ +function package() { + return runTestCommand('package', 'npm run package'); +} + +/** + * Run Node tests. + * @return {Promise} asynchronous result + */ +function node() { + return runTestCommand('node', 'mocha tests/node --config tests/node/.mocharc.js'); +} + +/** + * Attempt advanced compilation of a Blockly app. + * @return {Promise} asynchronous result + */ +function advancedCompile() { + return runTestCommand('advanced_compile', 'npm run test:compile:advanced'); +} + +/** + * Report test result. + * @return {Promise} asynchronous result + */ +function reportTestResult() { + console.log('======================================='); + // Check result. + if (failerCount === 0) { + console.log(`${BOLD_GREEN}All tests passed.${ANSI_RESET}`); + return Promise.resolve(); + } else { + console.log(`${BOLD_RED}Failures in ${failerCount} test groups.${ANSI_RESET}`); + return Promise.reject(); + } +} + +// Indivisual tasks. +const testTasks = [ + eslint, + buildDebug, + renamings, + metadata, + mocha, + generators, + package, + node, + advancedCompile, + reportTestResult, +]; + +// Run all tests in sequence. +const test = gulp.series(...testTasks); + +module.exports = { + test, + generators, +}; diff --git a/scripts/helpers.js b/scripts/helpers.js new file mode 100644 index 000000000..8dd013835 --- /dev/null +++ b/scripts/helpers.js @@ -0,0 +1,35 @@ +/** + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Helper functions for build/test. + */ +/* eslint-env node */ + +const path = require('path'); + +/** + * Escape regular expression pattern + * @param {string} pattern regular expression pattern + * @return {string} escaped regular expression pattern + */ +function escapeRegex(pattern) { + return pattern.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'); +} + +/** + * Replaces OS-specific path with POSIX style path. + * @param {string} target target path + * @return {string} posix path + */ +function posixPath(target) { + const osSpecificSep = new RegExp(escapeRegex(path.sep), 'g'); + return target.replace(osSpecificSep, path.posix.sep); +} + +module.exports = { + posixPath, +}; diff --git a/tests/generators/run_generators_in_browser.js b/tests/generators/run_generators_in_browser.js index 280a59fe5..2dd2f95b9 100644 --- a/tests/generators/run_generators_in_browser.js +++ b/tests/generators/run_generators_in_browser.js @@ -9,6 +9,7 @@ */ var webdriverio = require('webdriverio'); var fs = require('fs'); +var path = require('path'); module.exports = runGeneratorsInBrowser; @@ -35,9 +36,10 @@ async function runLangGeneratorInBrowser(browser, filename, codegenFn) { * Runs the generator tests in Chrome. It uses webdriverio to * launch Chrome and load index.html. Outputs a summary of the test results * to the console and outputs files for later validation. + * @param {string} outputDir output directory * @return the Thenable managing the processing of the browser tests. */ -async function runGeneratorsInBrowser() { +async function runGeneratorsInBrowser(outputDir) { var options = { capabilities: { browserName: 'chrome', @@ -60,7 +62,7 @@ async function runGeneratorsInBrowser() { } var url = 'file://' + __dirname + '/index.html'; - var prefix = 'tests/generators/tmp/generated'; + var prefix = path.join(outputDir, 'generated'); console.log('Starting webdriverio...'); const browser = await webdriverio.remote(options); @@ -97,7 +99,7 @@ async function runGeneratorsInBrowser() { } if (require.main === module) { - runGeneratorsInBrowser().catch(e => { + runGeneratorsInBrowser('tests/generators/tmp').catch(e => { console.error(e); process.exit(1); }).then(function(result) { diff --git a/tests/migration/validate-renamings.js b/tests/migration/validate-renamings.js old mode 100755 new mode 100644 index 8b66e3bea..a5c084b3f --- a/tests/migration/validate-renamings.js +++ b/tests/migration/validate-renamings.js @@ -17,6 +17,7 @@ const JsonSchema = require('@hyperjump/json-schema'); const JSON5 = require('json5'); const fs = require('fs'); const path = require('path'); +const {posixPath} = require('../../scripts/helpers'); /** @@ -35,7 +36,7 @@ const RENAMINGS_FILENAME = // Can't use top-level await outside a module, and can't use require // in a module, so use an IIAFE. (async function() { - const schemaUrl = 'file://' + path.resolve(SCHEMA_FILENAME); + const schemaUrl = 'file://' + posixPath(path.resolve(SCHEMA_FILENAME)); const schema = await JsonSchema.get(schemaUrl); const renamingsJson5 = fs.readFileSync(RENAMINGS_FILENAME); diff --git a/tests/mocha/run_mocha_tests_in_browser.js b/tests/mocha/run_mocha_tests_in_browser.js index 217c9992b..34e1c0fba 100644 --- a/tests/mocha/run_mocha_tests_in_browser.js +++ b/tests/mocha/run_mocha_tests_in_browser.js @@ -8,6 +8,7 @@ * @fileoverview Node.js script to run Mocha tests in Chrome, via webdriver. */ var webdriverio = require('webdriverio'); +var {posixPath} = require('../../scripts/helpers'); module.exports = runMochaTestsInBrowser; @@ -44,7 +45,7 @@ async function runMochaTestsInBrowser() { }; } - var url = 'file://' + __dirname + '/index.html'; + var url = 'file://' + posixPath(__dirname) + '/index.html'; console.log('Starting webdriverio...'); const browser = await webdriverio.remote(options); console.log('Initialized.\nLoading url: ' + url); diff --git a/tests/run_all_tests.sh b/tests/run_all_tests.sh deleted file mode 100755 index 36ae667b7..000000000 --- a/tests/run_all_tests.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash - -if [ ! -z $CI ]; then echo "Executing run_all_tests.sh from $(pwd)"; fi - -# ANSI colors -BOLD_GREEN='\033[1;32m' -BOLD_RED='\033[1;31m' -ANSI_RESET='\033[0m' - -gh_actions_fold () { - local startOrEnd=$1 # Either "start" or "end" - - if [ ! -z $CI ]; then - echo "::$startOrEnd::" - fi -} - -# Find the Blockly project root if pwd is the root -# or if pwd is the directory containing this script. -if [ -f ./run_all_tests.js ]; then - BLOCKLY_ROOT=".." -elif [ -f tests/run_all_tests.sh ]; then - BLOCKLY_ROOT="." -else - echo -e "${BOLD_RED}ERROR: Cannot determine BLOCKLY_ROOT${ANSI_RESET}" 1>&2; - exit 1 -fi -pushd $BLOCKLY_ROOT -echo "pwd: $(pwd)" - -FAILURE_COUNT=0 - -run_test_command () { - local test_id=$1 # The id to use for folds and similar. No spaces. - local command=$2 # The command to run. - - echo "=======================================" - echo "== $test_id" - gh_actions_fold group - $command - local test_result=$? - gh_actions_fold endgroup - if [ $test_result -eq 0 ]; then - echo -e "${BOLD_GREEN}SUCCESS:${ANSI_RESET} ${test_id}" - else - echo -e "${BOLD_RED}FAILED:${ANSI_RESET} ${test_id}" - FAILURE_COUNT=$((FAILURE_COUNT+1)) - fi -} - -# Lint the codebase. -# Skip for CI environments, because linting is run separately. -if [ -z $CI ]; then - run_test_command "eslint" "eslint ." -fi - -# Run the full usual build process, checking to ensure there are no -# closure compiler warnings / errors. -run_test_command "build-debug" "npm run build-debug" - -# Run renaming validation test. -run_test_command "renamings" "tests/migration/validate-renamings.js" - -# Check the sizes of built files for unexpected growth. -run_test_command "metadata" "tests/scripts/check_metadata.sh" - -# Run Mocha tests inside a browser. -run_test_command "mocha" "node tests/mocha/run_mocha_tests_in_browser.js" - -# Run generator tests inside a browser and check the results. -run_test_command "generators" "tests/scripts/run_generators.sh" - -# Run the package build process, as Node tests depend on it. -run_test_command "package" "npm run package" - -# Run Node tests. -run_test_command "node" "./node_modules/.bin/mocha tests/node --config tests/node/.mocharc.js" - -# Attempt advanced compilation of a Blockly app. -run_test_command "advanced_compile" "npm run test:compile:advanced" - -# End of tests. -popd -echo "=======================================" -if [ "$FAILURE_COUNT" -eq "0" ]; then - echo -e "${BOLD_GREEN}All tests passed.${ANSI_RESET}" - exit 0 -else - echo -e "${BOLD_RED}Failures in ${FAILURE_COUNT} test groups.${ANSI_RESET}" - exit 1 -fi diff --git a/tests/scripts/run_generators.sh b/tests/scripts/run_generators.sh deleted file mode 100755 index 8c461f8e0..000000000 --- a/tests/scripts/run_generators.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -# ANSI colors -BOLD_GREEN='\033[1;32m' -BOLD_RED='\033[1;31m' -ANSI_RESET='\033[0m' -SUCCESS_PREFIX="${BOLD_GREEN}SUCCESS:${ANSI_RESET}" -FAILURE_PREFIX="${BOLD_RED}FAILED:${ANSI_RESET}" - -TMP_DIR="tests/generators/tmp/" -GOLDEN_DIR="tests/generators/golden/" - -FAILURE_COUNT=0 -check_result() { - local suffix=$1 # One of: js, py, dart, lua, php - local tmp_filename="${TMP_DIR}generated.$suffix" - - if [ -f $tmp_filename ]; then - local golden_filename="${GOLDEN_DIR}generated.$suffix" - if [ -f $golden_filename ]; then - if cmp $tmp_filename $golden_filename; then - echo -e "$SUCCESS_PREFIX $suffix: $tmp_filename matches $golden_filename" - else - echo -e "$FAILURE_PREFIX $suffix: $tmp_filename does not match $golden_filename" - FAILURE_COUNT=$((FAILURE_COUNT+1)) - fi - else - echo "File $golden_filename not found!" - FAILURE_COUNT=$((FAILURE_COUNT+1)) - fi - else - echo "File $tmp_filename not found!" - FAILURE_COUNT=$((FAILURE_COUNT+1)) - fi -} - - -mkdir $TMP_DIR - -node tests/generators/run_generators_in_browser.js -generator_suffixes=( "js" "py" "dart" "lua" "php" ) -for i in "${generator_suffixes[@]}" -do - check_result "$i" -done - - -# Clean up. -rm -r $TMP_DIR - -if [ "$FAILURE_COUNT" -eq "0" ]; then - echo -e "${BOLD_GREEN}All generator tests passed.${ANSI_RESET}" - exit 0 -else - echo -e "${BOLD_RED}Failures in ${FAILURE_COUNT} generator tests.${ANSI_RESET}" - exit 1 -fi From 2311a94b037fb011304ea3fb1eae4217ab6d2dad Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 27 Oct 2022 15:41:46 -0700 Subject: [PATCH 56/69] feat: add serialization of procedure models (#6582) * feat: add procedure model serializer * chore: cleanup * fix: serializer registration * chore: add inline docs * chore: cleanup and unskip tests * chore: format * fix: refactor factories to use generics * chore: format * chore: add docs to constructor --- core/serialization.ts | 2 + core/serialization/priorities.ts | 6 + core/serialization/procedures.ts | 152 ++++++++++++++++++++++++ tests/mocha/jso_deserialization_test.js | 11 +- tests/mocha/jso_serialization_test.js | 5 +- 5 files changed, 167 insertions(+), 9 deletions(-) create mode 100644 core/serialization/procedures.ts diff --git a/core/serialization.ts b/core/serialization.ts index 991b022ad..1b9739df0 100644 --- a/core/serialization.ts +++ b/core/serialization.ts @@ -13,6 +13,7 @@ goog.declareModuleId('Blockly.serialization'); import * as blocks from './serialization/blocks.js'; import * as exceptions from './serialization/exceptions.js'; import * as priorities from './serialization/priorities.js'; +import * as procedures from './serialization/procedures.js'; import * as registry from './serialization/registry.js'; import * as variables from './serialization/variables.js'; import * as workspaces from './serialization/workspaces.js'; @@ -22,6 +23,7 @@ export { blocks, exceptions, priorities, + procedures, registry, variables, workspaces, diff --git a/core/serialization/priorities.ts b/core/serialization/priorities.ts index b8c8f2613..b49c7222d 100644 --- a/core/serialization/priorities.ts +++ b/core/serialization/priorities.ts @@ -21,6 +21,12 @@ goog.declareModuleId('Blockly.serialization.priorities'); * @alias Blockly.serialization.priorities.VARIABLES */ export const VARIABLES = 100; + +/** + * The priority for deserializing variable data. + */ +export const PROCEDURES = 75; + /** * The priority for deserializing blocks. * diff --git a/core/serialization/procedures.ts b/core/serialization/procedures.ts new file mode 100644 index 000000000..606104fb4 --- /dev/null +++ b/core/serialization/procedures.ts @@ -0,0 +1,152 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import {IParameterModel} from '../interfaces/i_parameter_model.js'; +import {IProcedureModel} from '../interfaces/i_procedure_model.js'; +import type {ISerializer} from '../interfaces/i_serializer.js'; +import {ObservableProcedureModel} from '../procedures/observable_procedure_model.js'; +import {ObservableParameterModel} from '../procedures/observable_parameter_model.js'; +import * as priorities from './priorities.js'; +import * as serializationRegistry from './registry.js'; +import type {Workspace} from '../workspace.js'; + + +/** + * Representation of a procedure data model. + */ +export interface State { + id: string, name: string, returnTypes: string[]|null, + parameters?: ParameterState[], +} + +/** + * Representation of a parameter data model. + */ +export interface ParameterState { + id: string, name: string, types?: string[], +} + +/** + * A newable signature for an IProcedureModel. + * + * Refer to + * https://www.typescriptlang.org/docs/handbook/2/generics.html#using-class-types-in-generics + * for what is going on with this. + */ +type ProcedureModelConstructor = + new (workspace: Workspace, name: string, id: string) => ProcedureModel; + +/** + * A newable signature for an IParameterModel. + * + * Refer to + * https://www.typescriptlang.org/docs/handbook/2/generics.html#using-class-types-in-generics + * for what is going on with this. + */ +type ParameterModelConstructor = + new (workspace: Workspace, name: string, id: string) => ParameterModel; + + +/** Serializes the given IProcedureModel to JSON. */ +function saveProcedure(proc: IProcedureModel): State { + const state: State = { + id: proc.getId(), + name: proc.getName(), + returnTypes: proc.getReturnTypes(), + }; + if (!proc.getParameters().length) return state; + state.parameters = proc.getParameters().map((param) => saveParameter(param)); + return state; +} + +/** Serializes the given IParameterModel to JSON. */ +function saveParameter(param: IParameterModel): ParameterState { + const state: ParameterState = { + id: param.getId(), + name: param.getName(), + }; + if (!param.getTypes().length) return state; + state.types = param.getTypes(); + return state; +} + +/** Deserializes the given procedure model State from JSON. */ +function +loadProcedure( + procedureModelClass: ProcedureModelConstructor, + parameterModelClass: ParameterModelConstructor, + state: State, workspace: Workspace): ProcedureModel { + const proc = new procedureModelClass(workspace, state.name, state.id) + .setReturnTypes(state.returnTypes); + if (!state.parameters) return proc; + for (const [index, param] of state.parameters.entries()) { + proc.insertParameter( + loadParameter(parameterModelClass, param, workspace), index); + } + return proc; +} + +/** Deserializes the given ParameterState from JSON. */ +function loadParameter( + parameterModelClass: ParameterModelConstructor, + state: ParameterState, workspace: Workspace): ParameterModel { + return new parameterModelClass(workspace, state.name, state.id) + .setTypes(state.types || []); +} + +/** Serializer for saving and loading procedure state. */ +export class ProcedureSerializer implements ISerializer { + public priority = priorities.PROCEDURES; + + /** + * Constructs the procedure serializer. + * + * Example usage: + * new ProcedureSerializer(MyProcedureModelClass, MyParameterModelClass) + * + * @param procedureModelClass The class (implementing IProcedureModel) that + * you want this serializer to deserialize. + * @param parameterModelClass The class (implementing IParameterModel) that + * you want this serializer to deserialize. + */ + constructor( + private readonly procedureModelClass: + ProcedureModelConstructor, + private readonly parameterModelClass: + ParameterModelConstructor) {} + + /** Serializes the procedure models of the given workspace. */ + save(workspace: Workspace): State[]|null { + return workspace.getProcedureMap().getProcedures().map( + (proc) => saveProcedure(proc)); + } + + /** + * Deserializes the procedures models defined by the given state into the + * workspace. + */ + load(state: State[], workspace: Workspace) { + const map = workspace.getProcedureMap(); + for (const procState of state) { + map.add(loadProcedure( + this.procedureModelClass, this.parameterModelClass, procState, + workspace)); + } + } + + /** Disposes of any procedure models that exist on the workspace. */ + clear(workspace: Workspace) { + workspace.getProcedureMap().clear(); + } +} + +serializationRegistry.register( + 'procedures', + new ProcedureSerializer( + ObservableProcedureModel, ObservableParameterModel)); diff --git a/tests/mocha/jso_deserialization_test.js b/tests/mocha/jso_deserialization_test.js index 3fa342ed0..889e93b7b 100644 --- a/tests/mocha/jso_deserialization_test.js +++ b/tests/mocha/jso_deserialization_test.js @@ -714,12 +714,11 @@ suite('JSO Deserialization', function() { }); }); - // TODO(#6522): Unskip tests. - suite.skip('Procedures', function() { + suite('Procedures', function() { class MockProcedureModel { - constructor(id) { + constructor(workspace, name, id) { this.id = id ?? Blockly.utils.idGenerator.genUid(); - this.name = ''; + this.name = name; this.parameters = []; this.returnTypes = null; this.enabled = true; @@ -776,7 +775,7 @@ suite('JSO Deserialization', function() { } class MockParameterModel { - constructor(name, id) { + constructor(workspace, name, id) { this.id = id ?? Blockly.utils.idGenerator.genUid(); this.name = name; this.types = []; @@ -808,7 +807,7 @@ suite('JSO Deserialization', function() { setup(function() { this.procedureSerializer = new Blockly.serialization.procedures.ProcedureSerializer( - MockProcedureModel, MockParameterModel); + MockProcedureModel, MockParameterModel); this.procedureMap = this.workspace.getProcedureMap(); }); diff --git a/tests/mocha/jso_serialization_test.js b/tests/mocha/jso_serialization_test.js index 1fd218134..55c014840 100644 --- a/tests/mocha/jso_serialization_test.js +++ b/tests/mocha/jso_serialization_test.js @@ -795,8 +795,7 @@ suite('JSO Serialization', function() { }); }); - // TODO(#6522): Unskip serialization tests. - suite.skip('Procedures', function() { + suite('Procedures', function() { class MockProcedureModel { constructor() { this.id = Blockly.utils.idGenerator.genUid(); @@ -968,7 +967,7 @@ suite('JSO Serialization', function() { new MockProcedureModel().insertParameter(parameterModel, 0)); const jso = Blockly.serialization.workspaces.save(this.workspace); const parameter = jso['procedures'][0]['parameters'][0]; - assertProperty(parameter, 'id', 'testparam'); + assertProperty(parameter, 'name', 'testparam'); }); }); From e90aba9273bfd8b42334aa1831ab9f4925ba6152 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Fri, 28 Oct 2022 01:59:00 +0200 Subject: [PATCH 57/69] fix: Rename Generator to CodeGenerator (#6585) Stops collisions with ES6's Generator. The old Blockly.Generator still exists as a name, but is now deprecated. --- .eslintrc.json | 1 - .github/CONTRIBUTING.md | 4 +- .github/dependabot.yml | 2 +- .github/workflows/tag_module_cleanup.yml | 4 +- .github/workflows/update_metadata.yml | 2 +- closure/goog/base_minimal.js | 2 +- core/blockly.ts | 9 ++-- core/generator.ts | 20 +++---- demos/blockfactory/analytics.js | 1 - demos/code/code.js | 4 +- demos/mobile/android/build.gradle | 4 +- .../ios/Blockly WebView/ViewController.swift | 29 +++++------ generators/dart.js | 10 ++-- generators/javascript.js | 10 ++-- generators/lua.js | 10 ++-- generators/php.js | 10 ++-- generators/python.js | 12 ++--- scripts/gulpfiles/build_tasks.js | 6 +-- scripts/package/README.md | 4 +- scripts/package/templates/node.template | 2 +- scripts/package/templates/umd-msg.template | 2 +- scripts/package/templates/umd.template | 2 +- tests/bootstrap.js | 2 +- tests/generators/run_generators_in_browser.js | 4 +- tests/mocha/block_change_event_test.js | 4 +- tests/mocha/field_angle_test.js | 2 +- tests/mocha/field_checkbox_test.js | 2 +- tests/mocha/field_colour_test.js | 2 +- tests/mocha/field_dropdown_test.js | 1 - tests/mocha/field_label_serializable_test.js | 2 +- tests/mocha/field_multilineinput_test.js | 2 +- tests/mocha/field_number_test.js | 2 +- tests/mocha/field_registry_test.js | 2 +- tests/mocha/field_test.js | 26 +++++----- tests/mocha/field_variable_test.js | 4 +- tests/mocha/generator_test.js | 2 +- tests/mocha/jso_deserialization_test.js | 20 +++---- tests/mocha/jso_serialization_test.js | 52 +++++++++---------- tests/mocha/procedure_map_test.js | 12 ++--- tests/mocha/registry_test.js | 2 +- tests/mocha/run_mocha_tests_in_browser.js | 2 +- tests/mocha/test_helpers/code_generation.js | 4 +- tests/mocha/touch_test.js | 2 +- tests/mocha/widget_div_test.js | 8 +-- tests/playground.html | 2 +- tests/scripts/setup_osx_env.sh | 2 +- 46 files changed, 155 insertions(+), 158 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 4f28defcc..eb5b9f339 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -160,7 +160,6 @@ "jsdoc/check-param-names": ["off", {"checkDestructured": false}], // Allow any text in the license tag. Other checks are not relevant. "jsdoc/check-values": ["off"] - } }] } diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f66aaaa60..dc0ea8c44 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -29,9 +29,9 @@ All submissions, including submissions by project members, require review. We use Github pull requests for this purpose. ### Browser compatibility -We care strongly about making Blockly work on all browsers. As of 2022 we +We care strongly about making Blockly work on all browsers. As of 2022 we support Edge, Chrome, Safari, and Firefox. We will not accept changes that only -work on a subset of those browsers. You can check [caniuse.com](https://caniuse.com/) +work on a subset of those browsers. You can check [caniuse.com](https://caniuse.com/) for compatibility information. ### The small print diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 65f8104c4..434334e54 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -22,7 +22,7 @@ updates: - "PR: chore" - "PR: dependencies" - package-ecosystem: "github-actions" # See documentation for possible values - directory: "/" + directory: "/" target-branch: "develop" schedule: interval: "weekly" diff --git a/.github/workflows/tag_module_cleanup.yml b/.github/workflows/tag_module_cleanup.yml index a6b68c3fc..d5555d962 100644 --- a/.github/workflows/tag_module_cleanup.yml +++ b/.github/workflows/tag_module_cleanup.yml @@ -5,14 +5,14 @@ name: Tag module cleanup # Trigger on pull requests against goog_module branch only # Uses pull_request_target to get write permissions so that it can write labels. -on: +on: pull_request_target: branches: - goog_module jobs: tag-module-cleanup: - + # Add the type: cleanup label runs-on: ubuntu-latest steps: diff --git a/.github/workflows/update_metadata.yml b/.github/workflows/update_metadata.yml index d360e2195..125236983 100644 --- a/.github/workflows/update_metadata.yml +++ b/.github/workflows/update_metadata.yml @@ -13,7 +13,7 @@ jobs: permissions: contents: write # for peter-evans/create-pull-request to create branch pull-requests: write # for peter-evans/create-pull-request to create a PR - runs-on: ubuntu-latest + runs-on: ubuntu-latest steps: - name: Check Out Blockly diff --git a/closure/goog/base_minimal.js b/closure/goog/base_minimal.js index 6f884e841..096976e5a 100644 --- a/closure/goog/base_minimal.js +++ b/closure/goog/base_minimal.js @@ -23,7 +23,7 @@ var goog = goog || {}; /** * Reference to the global object. This is provided as 'root' by the * UMD wrapper, but prefer globalThis if it is defined. - * + * * https://www.ecma-international.org/ecma-262/9.0/index.html#sec-global-object * * @const diff --git a/core/blockly.ts b/core/blockly.ts index b8acdfeaf..dcb1d8ba9 100644 --- a/core/blockly.ts +++ b/core/blockly.ts @@ -71,7 +71,7 @@ import {FlyoutButton} from './flyout_button.js'; import {HorizontalFlyout} from './flyout_horizontal.js'; import {FlyoutMetricsManager} from './flyout_metrics_manager.js'; import {VerticalFlyout} from './flyout_vertical.js'; -import {Generator} from './generator.js'; +import {CodeGenerator} from './generator.js'; import {Gesture} from './gesture.js'; import {Grid} from './grid.js'; import {Icon} from './icon.js'; @@ -567,12 +567,12 @@ WorkspaceCommentSvg.prototype.showContextMenu = return; } const menuOptions = []; - + if (this.isDeletable() && this.isMovable()) { menuOptions.push(ContextMenu.commentDuplicateOption(this)); menuOptions.push(ContextMenu.commentDeleteOption(this)); } - + ContextMenu.show(e, menuOptions, this.RTL); }; @@ -663,7 +663,8 @@ export {FieldVariable}; export {Flyout}; export {FlyoutButton}; export {FlyoutMetricsManager}; -export {Generator}; +export {CodeGenerator}; +export {CodeGenerator as Generator}; // Deprecated name, October 2022. export {Gesture}; export {Grid}; export {HorizontalFlyout}; diff --git a/core/generator.ts b/core/generator.ts index 1d47d43c2..e78bd4b41 100644 --- a/core/generator.ts +++ b/core/generator.ts @@ -11,7 +11,7 @@ * @class */ import * as goog from '../closure/goog/goog.js'; -goog.declareModuleId('Blockly.Generator'); +goog.declareModuleId('Blockly.CodeGenerator'); import type {Block} from './block.js'; import * as common from './common.js'; @@ -24,14 +24,14 @@ import type {Workspace} from './workspace.js'; * Class for a code generator that translates the blocks into a language. * * @unrestricted - * @alias Blockly.Generator + * @alias Blockly.CodeGenerator */ -export class Generator { +export class CodeGenerator { name_: string; /** * This is used as a placeholder in functions defined using - * Generator.provideFunction_. It must not be legal code that could + * CodeGenerator.provideFunction_. It must not be legal code that could * legitimately appear in a function definition (or comment), and it must * not confuse the regular expression parser. */ @@ -205,7 +205,7 @@ export class Generator { |[string, number] { if (this.isInitialized === false) { console.warn( - 'Generator init was not called before blockToCode was called.'); + 'CodeGenerator init was not called before blockToCode was called.'); } if (!block) { return ''; @@ -414,7 +414,7 @@ export class Generator { * "listRandom", not "random"). There is no danger of colliding with reserved * words, or user-defined variable or procedure names. * - * The code gets output when Generator.finish() is called. + * The code gets output when CodeGenerator.finish() is called. * * @param desiredName The desired name of the function (e.g. mathIsPrime). * @param code A list of statements or one multi-line code string. Use ' ' @@ -514,23 +514,23 @@ export class Generator { } } -Object.defineProperties(Generator.prototype, { +Object.defineProperties(CodeGenerator.prototype, { /** * A database of variable names. * - * @name Blockly.Generator.prototype.variableDB_ + * @name Blockly.CodeGenerator.prototype.variableDB_ * @deprecated 'variableDB_' was renamed to 'nameDB_' (May 2021). * @suppress {checkTypes} */ variableDB_: ({ /** @returns Name database. */ - get(this: Generator): Names | + get(this: CodeGenerator): Names | undefined { deprecation.warn('variableDB_', 'version 9', 'version 10', 'nameDB_'); return this.nameDB_; }, /** @param nameDb New name database. */ - set(this: Generator, nameDb: Names|undefined) { + set(this: CodeGenerator, nameDb: Names|undefined) { deprecation.warn('variableDB_', 'version 9', 'version 10', 'nameDB_'); this.nameDB_ = nameDb; }, diff --git a/demos/blockfactory/analytics.js b/demos/blockfactory/analytics.js index b22070844..6febb8858 100644 --- a/demos/blockfactory/analytics.js +++ b/demos/blockfactory/analytics.js @@ -194,4 +194,3 @@ BlocklyDevTools.Analytics.sendQueued = function() { // stub this.LOG_TO_CONSOLE_ && console.log('Analytics.sendQueued'); }; - diff --git a/demos/code/code.js b/demos/code/code.js index e976903ee..b9635034e 100644 --- a/demos/code/code.js +++ b/demos/code/code.js @@ -373,7 +373,7 @@ Code.renderContent = function() { /** * Attempt to generate the code and display it in the UI, pretty printed. - * @param generator {!Blockly.Generator} The generator to use. + * @param generator {!Blockly.CodeGenerator} The generator to use. */ Code.attemptCodeGeneration = function(generator) { var content = document.getElementById('content_' + Code.selected); @@ -388,7 +388,7 @@ Code.attemptCodeGeneration = function(generator) { /** * Check whether all blocks in use have generator functions. - * @param generator {!Blockly.Generator} The generator to use. + * @param generator {!Blockly.CodeGenerator} The generator to use. */ Code.checkAllGeneratorFunctionsDefined = function(generator) { var blocks = Code.workspace.getAllBlocks(false); diff --git a/demos/mobile/android/build.gradle b/demos/mobile/android/build.gradle index 4e8009dbd..e13c05ada 100644 --- a/demos/mobile/android/build.gradle +++ b/demos/mobile/android/build.gradle @@ -1,14 +1,14 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - + repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.2.0' - + // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/demos/mobile/ios/Blockly WebView/ViewController.swift b/demos/mobile/ios/Blockly WebView/ViewController.swift index f8ad8018e..e9f75dab4 100644 --- a/demos/mobile/ios/Blockly WebView/ViewController.swift +++ b/demos/mobile/ios/Blockly WebView/ViewController.swift @@ -15,9 +15,9 @@ class ViewController: UIViewController, WKUIDelegate { /// The name used to reference this iOS object when executing callbacks from the JS code. /// If this value is changed, it should also be changed in the `CODE_GENERATOR_BRIDGE_JS` file. fileprivate static let HOST_HTML = "Blockly/webview.html" - + @IBOutlet weak var webView: WKWebView! - + /// Additional setup after loading the UI NIB. override func viewDidLoad() { super.viewDidLoad() @@ -25,7 +25,7 @@ class ViewController: UIViewController, WKUIDelegate { // Do any additional setup after loading the view, typically from a nib. loadWebContent() } - + /// Load the root HTML page into the webview. func loadWebContent() { if let htmlUrl = Bundle.main.url(forResource: "webview", withExtension: "html", @@ -41,7 +41,7 @@ class ViewController: UIViewController, WKUIDelegate { runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) { - + let alert = UIAlertController(title: nil, message: message, preferredStyle: .alert) let title = NSLocalizedString("OK", comment: "OK Button") let ok = UIAlertAction(title: title, style: .default) { (action: UIAlertAction) -> Void in @@ -51,25 +51,25 @@ class ViewController: UIViewController, WKUIDelegate { present(alert, animated: true) completionHandler() } - + /// Handle window.confirm() with a native dialog. func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) { - + let alert = UIAlertController(title: nil, message: message, preferredStyle: .alert) let closeAndHandle = { (okayed: Bool) in alert.dismiss(animated: true, completion: nil) completionHandler(okayed) } - + let okTitle = NSLocalizedString("OK", comment: "OK button title") let ok = UIAlertAction(title: okTitle, style: .default) { (action: UIAlertAction) -> Void in closeAndHandle(true) } alert.addAction(ok) - + let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel button title") let cancel = UIAlertAction(title: cancelTitle, style: .default) { (action: UIAlertAction) -> Void in @@ -78,34 +78,33 @@ class ViewController: UIViewController, WKUIDelegate { alert.addAction(cancel) present(alert, animated: true) } - + /// Handle window.prompt() with a native dialog. func webView(_ webView: WKWebView, runJavaScriptTextInputPanelWithPrompt prompt: String, defaultText: String?, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (String?) -> Void) { - + let alert = UIAlertController(title: prompt, message: nil, preferredStyle: .alert) - + alert.addTextField { (textField) in textField.text = defaultText } - + let okTitle = NSLocalizedString("OK", comment: "OK button title") let okAction = UIAlertAction(title: okTitle, style: .default) { (_) in let textInput = alert.textFields![0] as UITextField completionHandler(textInput.text) } alert.addAction(okAction) - + let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel button title") let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel) { (_) in completionHandler(nil) } alert.addAction(cancelAction) - + present(alert, animated: true) } } - diff --git a/generators/dart.js b/generators/dart.js index dacbcd2a5..964d9ae80 100644 --- a/generators/dart.js +++ b/generators/dart.js @@ -15,7 +15,7 @@ goog.module('Blockly.Dart'); const Variables = goog.require('Blockly.Variables'); const stringUtils = goog.require('Blockly.utils.string'); const {Block} = goog.requireType('Blockly.Block'); -const {Generator} = goog.require('Blockly.Generator'); +const {CodeGenerator} = goog.require('Blockly.CodeGenerator'); const {Names, NameType} = goog.require('Blockly.Names'); const {Workspace} = goog.requireType('Blockly.Workspace'); const {inputTypes} = goog.require('Blockly.inputTypes'); @@ -23,9 +23,9 @@ const {inputTypes} = goog.require('Blockly.inputTypes'); /** * Dart code generator. - * @type {!Generator} + * @type {!CodeGenerator} */ -const Dart = new Generator('Dart'); +const Dart = new CodeGenerator('Dart'); /** * List of illegal variable names. @@ -86,7 +86,7 @@ Dart.isInitialized = false; * @param {!Workspace} workspace Workspace to generate code from. */ Dart.init = function(workspace) { - // Call Blockly.Generator's init. + // Call Blockly.CodeGenerator's init. Object.getPrototypeOf(this).init.call(this); if (!this.nameDB_) { @@ -145,7 +145,7 @@ Dart.finish = function(code) { definitions.push(def); } } - // Call Blockly.Generator's finish. + // Call Blockly.CodeGenerator's finish. code = Object.getPrototypeOf(this).finish.call(this, code); this.isInitialized = false; diff --git a/generators/javascript.js b/generators/javascript.js index c9634057c..c3e6aa90e 100644 --- a/generators/javascript.js +++ b/generators/javascript.js @@ -15,7 +15,7 @@ goog.module('Blockly.JavaScript'); const Variables = goog.require('Blockly.Variables'); const stringUtils = goog.require('Blockly.utils.string'); const {Block} = goog.requireType('Blockly.Block'); -const {Generator} = goog.require('Blockly.Generator'); +const {CodeGenerator} = goog.require('Blockly.CodeGenerator'); const {inputTypes} = goog.require('Blockly.inputTypes'); const {Names, NameType} = goog.require('Blockly.Names'); const {Workspace} = goog.requireType('Blockly.Workspace'); @@ -23,9 +23,9 @@ const {Workspace} = goog.requireType('Blockly.Workspace'); /** * JavaScript code generator. - * @type {!Generator} + * @type {!CodeGenerator} */ -const JavaScript = new Generator('JavaScript'); +const JavaScript = new CodeGenerator('JavaScript'); /** * List of illegal variable names. @@ -127,7 +127,7 @@ JavaScript.isInitialized = false; * @param {!Workspace} workspace Workspace to generate code from. */ JavaScript.init = function(workspace) { - // Call Blockly.Generator's init. + // Call Blockly.CodeGenerator's init. Object.getPrototypeOf(this).init.call(this); if (!this.nameDB_) { @@ -169,7 +169,7 @@ JavaScript.init = function(workspace) { JavaScript.finish = function(code) { // Convert the definitions dictionary into a list. const definitions = Object.values(this.definitions_); - // Call Blockly.Generator's finish. + // Call Blockly.CodeGenerator's finish. code = Object.getPrototypeOf(this).finish.call(this, code); this.isInitialized = false; diff --git a/generators/lua.js b/generators/lua.js index aec7db2cf..2409c3355 100644 --- a/generators/lua.js +++ b/generators/lua.js @@ -15,7 +15,7 @@ goog.module('Blockly.Lua'); const stringUtils = goog.require('Blockly.utils.string'); const {Block} = goog.requireType('Blockly.Block'); -const {Generator} = goog.require('Blockly.Generator'); +const {CodeGenerator} = goog.require('Blockly.CodeGenerator'); const {inputTypes} = goog.require('Blockly.inputTypes'); const {Names} = goog.require('Blockly.Names'); const {Workspace} = goog.requireType('Blockly.Workspace'); @@ -23,9 +23,9 @@ const {Workspace} = goog.requireType('Blockly.Workspace'); /** * Lua code generator. - * @type {!Generator} + * @type {!CodeGenerator} */ -const Lua = new Generator('Lua'); +const Lua = new CodeGenerator('Lua'); /** * List of illegal variable names. @@ -92,7 +92,7 @@ Lua.isInitialized = false; * @param {!Workspace} workspace Workspace to generate code from. */ Lua.init = function(workspace) { - // Call Blockly.Generator's init. + // Call Blockly.CodeGenerator's init. Object.getPrototypeOf(this).init.call(this); if (!this.nameDB_) { @@ -115,7 +115,7 @@ Lua.init = function(workspace) { Lua.finish = function(code) { // Convert the definitions dictionary into a list. const definitions = Object.values(this.definitions_); - // Call Blockly.Generator's finish. + // Call Blockly.CodeGenerator's finish. code = Object.getPrototypeOf(this).finish.call(this, code); this.isInitialized = false; diff --git a/generators/php.js b/generators/php.js index f47d763a4..043a3c6a7 100644 --- a/generators/php.js +++ b/generators/php.js @@ -14,7 +14,7 @@ goog.module('Blockly.PHP'); const stringUtils = goog.require('Blockly.utils.string'); const {Block} = goog.requireType('Blockly.Block'); -const {Generator} = goog.require('Blockly.Generator'); +const {CodeGenerator} = goog.require('Blockly.CodeGenerator'); const {inputTypes} = goog.require('Blockly.inputTypes'); const {Names} = goog.require('Blockly.Names'); const {Workspace} = goog.requireType('Blockly.Workspace'); @@ -22,9 +22,9 @@ const {Workspace} = goog.requireType('Blockly.Workspace'); /** * PHP code generator. - * @type {!Generator} + * @type {!CodeGenerator} */ -const PHP = new Generator('PHP'); +const PHP = new CodeGenerator('PHP'); /** * List of illegal variable names. @@ -130,7 +130,7 @@ PHP.isInitialized = false; * @param {!Workspace} workspace Workspace to generate code from. */ PHP.init = function(workspace) { - // Call Blockly.Generator's init. + // Call Blockly.CodeGenerator's init. Object.getPrototypeOf(this).init.call(this); if (!this.nameDB_) { @@ -154,7 +154,7 @@ PHP.init = function(workspace) { PHP.finish = function(code) { // Convert the definitions dictionary into a list. const definitions = Object.values(this.definitions_); - // Call Blockly.Generator's finish. + // Call Blockly.CodeGenerator's finish. code = Object.getPrototypeOf(this).finish.call(this, code); this.isInitialized = false; diff --git a/generators/python.js b/generators/python.js index dd00ff2cd..09d92d19d 100644 --- a/generators/python.js +++ b/generators/python.js @@ -15,7 +15,7 @@ goog.module('Blockly.Python'); const stringUtils = goog.require('Blockly.utils.string'); const Variables = goog.require('Blockly.Variables'); const {Block} = goog.requireType('Blockly.Block'); -const {Generator} = goog.require('Blockly.Generator'); +const {CodeGenerator} = goog.require('Blockly.CodeGenerator'); const {inputTypes} = goog.require('Blockly.inputTypes'); const {Names, NameType} = goog.require('Blockly.Names'); const {Workspace} = goog.requireType('Blockly.Workspace'); @@ -23,9 +23,9 @@ const {Workspace} = goog.requireType('Blockly.Workspace'); /** * Python code generator. - * @type {!Generator} + * @type {!CodeGenerator} */ -const Python = new Generator('Python'); +const Python = new CodeGenerator('Python'); /** * List of illegal variable names. @@ -137,10 +137,10 @@ Python.isInitialized = false; /** * Initialise the database of variable names. * @param {!Workspace} workspace Workspace to generate code from. - * @this {Generator} + * @this {CodeGenerator} */ Python.init = function(workspace) { - // Call Blockly.Generator's init. + // Call Blockly.CodeGenerator's init. Object.getPrototypeOf(this).init.call(this); /** @@ -196,7 +196,7 @@ Python.finish = function(code) { definitions.push(def); } } - // Call Blockly.Generator's finish. + // Call Blockly.CodeGenerator's finish. code = Object.getPrototypeOf(this).finish.call(this, code); this.isInitialized = false; diff --git a/scripts/gulpfiles/build_tasks.js b/scripts/gulpfiles/build_tasks.js index 811281814..f186bb30c 100644 --- a/scripts/gulpfiles/build_tasks.js +++ b/scripts/gulpfiles/build_tasks.js @@ -178,7 +178,7 @@ function stripApacheLicense() { * For a full list of closure compiler groups, consult the output of * google-closure-compiler --help or look in the source here: * https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/DiagnosticGroups.java#L117 - * + * * The list in JSCOMP_ERROR contains all the diagnostic groups we know * about, but some are commented out if we don't want them, and may * appear in JSCOMP_WARNING or JSCOMP_OFF instead. Items not @@ -281,7 +281,7 @@ var JSCOMP_OFF = [ * core/utils/*. We were downgrading access control violations * (including @private) to warnings, but this ends up being so * spammy that it makes the compiler output nearly useless. - * + * * Once ES module migration is complete, they will be re-enabled and * an alternative to @package will be established. */ @@ -480,7 +480,7 @@ function chunkWrapper(chunk) { browserDepsExpr = `root.${chunk.parent.reexport}`; factoryArgs = '__parent__'; namespaceExpr = `${factoryArgs}.${NAMESPACE_PROPERTY}`; - } + } // Code to assign the result of the factory function to the desired // export location when running in a browser. When diff --git a/scripts/package/README.md b/scripts/package/README.md index 6140edfef..80748bfe3 100644 --- a/scripts/package/README.md +++ b/scripts/package/README.md @@ -36,9 +36,9 @@ For samples on how to integrate Blockly into your project, view the list of samp ### Importing Blockly When you import Blockly with ``import * as Blockly from 'blockly';`` you'll get the default modules: -Blockly core, Blockly built-in blocks, the JavaScript generator and the English lang files. +Blockly core, Blockly built-in blocks, the JavaScript generator and the English lang files. -If you need more flexibility, you'll want to define your imports more carefully: +If you need more flexibility, you'll want to define your imports more carefully: #### Blockly Core diff --git a/scripts/package/templates/node.template b/scripts/package/templates/node.template index eef05d742..e9887243e 100644 --- a/scripts/package/templates/node.template +++ b/scripts/package/templates/node.template @@ -2,4 +2,4 @@ (function (<%= param %>){ <%= contents %> module.exports = <%= exports %>; -})(<%= cjs %>); +})(<%= cjs %>); diff --git a/scripts/package/templates/umd-msg.template b/scripts/package/templates/umd-msg.template index 527936f16..dda7334b3 100644 --- a/scripts/package/templates/umd-msg.template +++ b/scripts/package/templates/umd-msg.template @@ -13,4 +13,4 @@ }(this, function() { <%= contents %> return Blockly.Msg; -})); +})); diff --git a/scripts/package/templates/umd.template b/scripts/package/templates/umd.template index ab62e103c..9eaa0e3cd 100644 --- a/scripts/package/templates/umd.template +++ b/scripts/package/templates/umd.template @@ -10,4 +10,4 @@ }(this, function(<%= param %>) { <%= contents %> return <%= exports %>; -})); +})); diff --git a/tests/bootstrap.js b/tests/bootstrap.js index 9fe73d7f0..844d1cfef 100644 --- a/tests/bootstrap.js +++ b/tests/bootstrap.js @@ -68,7 +68,7 @@ depsFiles: [ 'build/deps.js', ], - + // List of goog.modules to goog.require. requires: [ 'Blockly', diff --git a/tests/generators/run_generators_in_browser.js b/tests/generators/run_generators_in_browser.js index 2dd2f95b9..f97049805 100644 --- a/tests/generators/run_generators_in_browser.js +++ b/tests/generators/run_generators_in_browser.js @@ -54,8 +54,8 @@ async function runGeneratorsInBrowser(outputDir) { }; } else { // --disable-gpu is needed to prevent Chrome from hanging on Linux with - // NVIDIA drivers older than v295.20. See - // https://github.com/google/blockly/issues/5345 for details. + // NVIDIA drivers older than v295.20. See + // https://github.com/google/blockly/issues/5345 for details. options.capabilities['goog:chromeOptions'] = { args: ['--allow-file-access-from-files', '--disable-gpu'] }; diff --git a/tests/mocha/block_change_event_test.js b/tests/mocha/block_change_event_test.js index ecd62f4b4..8574c1f68 100644 --- a/tests/mocha/block_change_event_test.js +++ b/tests/mocha/block_change_event_test.js @@ -25,12 +25,12 @@ suite('Block Change Event', function() { setup(function() { defineMutatorBlocks(); }); - + teardown(function() { Blockly.Extensions.unregister('xml_mutator'); Blockly.Extensions.unregister('jso_mutator'); }); - + suite('XML', function() { test('Undo', function() { const block = this.workspace.newBlock('xml_block', 'block_id'); diff --git a/tests/mocha/field_angle_test.js b/tests/mocha/field_angle_test.js index 172b0eeba..d23acd80e 100644 --- a/tests/mocha/field_angle_test.js +++ b/tests/mocha/field_angle_test.js @@ -323,7 +323,7 @@ suite('Angle Fields', function() { setup(function() { this.workspace = new Blockly.Workspace(); defineRowBlock(); - + this.assertValue = (value) => { const block = this.workspace.newBlock('row_block'); const field = new Blockly.FieldAngle(value); diff --git a/tests/mocha/field_checkbox_test.js b/tests/mocha/field_checkbox_test.js index 60a95430c..771ce6627 100644 --- a/tests/mocha/field_checkbox_test.js +++ b/tests/mocha/field_checkbox_test.js @@ -217,7 +217,7 @@ suite('Checkbox Fields', function() { setup(function() { this.workspace = new Blockly.Workspace(); defineRowBlock(); - + this.assertValue = (value) => { const block = this.workspace.newBlock('row_block'); const field = new Blockly.FieldCheckbox(value); diff --git a/tests/mocha/field_colour_test.js b/tests/mocha/field_colour_test.js index bf7c00f1a..65d4a9d2c 100644 --- a/tests/mocha/field_colour_test.js +++ b/tests/mocha/field_colour_test.js @@ -290,7 +290,7 @@ suite('Colour Fields', function() { setup(function() { this.workspace = new Blockly.Workspace(); defineRowBlock(); - + this.assertValue = (value) => { const block = this.workspace.newBlock('row_block'); const field = new Blockly.FieldColour(value); diff --git a/tests/mocha/field_dropdown_test.js b/tests/mocha/field_dropdown_test.js index b16303eaf..2704ccf27 100644 --- a/tests/mocha/field_dropdown_test.js +++ b/tests/mocha/field_dropdown_test.js @@ -166,7 +166,6 @@ suite('Dropdown Fields', function() { this.workspace = new Blockly.Workspace(); defineRowBlock(); - this.assertValue = (value, field) => { const block = this.workspace.newBlock('row_block'); field.setValue(value); diff --git a/tests/mocha/field_label_serializable_test.js b/tests/mocha/field_label_serializable_test.js index 928f0aa66..77705288f 100644 --- a/tests/mocha/field_label_serializable_test.js +++ b/tests/mocha/field_label_serializable_test.js @@ -194,7 +194,7 @@ suite('Label Serializable Fields', function() { setup(function() { this.workspace = new Blockly.Workspace(); defineRowBlock(); - + this.assertValue = (value) => { const block = this.workspace.newBlock('row_block'); const field = new Blockly.FieldLabelSerializable(value); diff --git a/tests/mocha/field_multilineinput_test.js b/tests/mocha/field_multilineinput_test.js index 594dc863d..ecf86cdd5 100644 --- a/tests/mocha/field_multilineinput_test.js +++ b/tests/mocha/field_multilineinput_test.js @@ -172,7 +172,7 @@ suite('Multiline Input Fields', function() { setup(function() { this.workspace = new Blockly.Workspace(); defineRowBlock(); - + this.assertValue = (value) => { const block = this.workspace.newBlock('row_block'); const field = new Blockly.FieldMultilineInput(value); diff --git a/tests/mocha/field_number_test.js b/tests/mocha/field_number_test.js index 10176cf22..23b112c81 100644 --- a/tests/mocha/field_number_test.js +++ b/tests/mocha/field_number_test.js @@ -346,7 +346,7 @@ suite('Number Fields', function() { setup(function() { this.workspace = new Blockly.Workspace(); defineRowBlock(); - + this.assertValue = (value) => { const block = this.workspace.newBlock('row_block'); const field = new Blockly.FieldNumber(value); diff --git a/tests/mocha/field_registry_test.js b/tests/mocha/field_registry_test.js index 7c2378d39..09d4da02b 100644 --- a/tests/mocha/field_registry_test.js +++ b/tests/mocha/field_registry_test.js @@ -93,7 +93,7 @@ suite('Field Registry', function() { }; const field = Blockly.fieldRegistry.fromJson(json); - + chai.assert.isNotNull(field); chai.assert.equal(field.getValue(), 'ok'); }); diff --git a/tests/mocha/field_test.js b/tests/mocha/field_test.js index ca5cad5f5..fcd124ed2 100644 --- a/tests/mocha/field_test.js +++ b/tests/mocha/field_test.js @@ -192,13 +192,13 @@ suite('Abstract Fields', function() { const value = field.saveState(); chai.assert.equal(value, 'test value'); }); - + test('Xml implementations', function() { const field = new CustomXmlField('test value'); const value = field.saveState(); chai.assert.equal(value, 'custom value'); }); - + test('Xml super implementation', function() { const field = new CustomXmlCallSuperField('test value'); const value = field.saveState(); @@ -206,13 +206,13 @@ suite('Abstract Fields', function() { value, 'test value'); }); - + test('JSO implementations', function() { const field = new CustomJsoField('test value'); const value = field.saveState(); chai.assert.equal(value, 'custom value'); }); - + test('JSO super implementations', function() { const field = new CustomJsoCallSuperField('test value'); const value = field.saveState(); @@ -236,7 +236,7 @@ suite('Abstract Fields', function() { value, 'test value'); }); - + test('Xml implementations', function() { const field = new CustomXmlField('test value'); const element = document.createElement('field'); @@ -246,7 +246,7 @@ suite('Abstract Fields', function() { 'custom value' ); }); - + test('Xml super implementation', function() { const field = new CustomXmlCallSuperField('test value'); const element = document.createElement('field'); @@ -276,13 +276,13 @@ suite('Abstract Fields', function() { field.loadState('test value'); chai.assert.equal(field.getValue(), 'test value'); }); - + test('Xml implementations', function() { const field = new CustomXmlField(''); field.loadState('custom value'); chai.assert.equal(field.someProperty, 'custom value'); }); - + test('Xml super implementation', function() { const field = new CustomXmlCallSuperField(''); field.loadState( @@ -290,20 +290,20 @@ suite('Abstract Fields', function() { chai.assert.equal(field.getValue(), 'test value'); chai.assert.equal(field.someProperty, 'custom value'); }); - + test('JSO implementations', function() { const field = new CustomJsoField(''); field.loadState('custom value'); chai.assert.equal(field.someProperty, 'custom value'); }); - + test('JSO super implementations', function() { const field = new CustomJsoCallSuperField(''); field.loadState({default: 'test value', val: 'custom value'}); chai.assert.equal(field.getValue(), 'test value'); chai.assert.equal(field.someProperty, 'custom value'); }); - + test('Xml and JSO implementations', function() { const field = new CustomXmlAndJsoField(''); field.loadState('custom value'); @@ -318,14 +318,14 @@ suite('Abstract Fields', function() { Blockly.Xml.textToDom('test value')); chai.assert.equal(field.getValue(), 'test value'); }); - + test('Xml implementations', function() { const field = new CustomXmlField(''); field.fromXml( Blockly.Xml.textToDom('custom value')); chai.assert.equal(field.someProperty, 'custom value'); }); - + test('Xml super implementation', function() { const field = new CustomXmlCallSuperField(''); field.fromXml( diff --git a/tests/mocha/field_variable_test.js b/tests/mocha/field_variable_test.js index 5872f12bc..478fb1a77 100644 --- a/tests/mocha/field_variable_test.js +++ b/tests/mocha/field_variable_test.js @@ -406,7 +406,7 @@ suite('Variable Fields', function() { chai.assert.deepEqual( jso['fields'], {'VAR': {'id': 'id2', 'name': 'x', 'type': ''}}); }); - + test('Typed', function() { const block = this.workspace.newBlock('row_block'); const field = @@ -429,7 +429,7 @@ suite('Variable Fields', function() { chai.assert.isUndefined(jso['fields']['VAR']['name']); chai.assert.isUndefined(jso['fields']['VAR']['type']); }); - + test('Typed', function() { const block = this.workspace.newBlock('row_block'); const field = diff --git a/tests/mocha/generator_test.js b/tests/mocha/generator_test.js index 321d5f1cb..6a05ded2d 100644 --- a/tests/mocha/generator_test.js +++ b/tests/mocha/generator_test.js @@ -27,7 +27,7 @@ suite('Generator', function() { suite('prefix', function() { setup(function() { - this.generator = new Blockly.Generator('INTERCAL'); + this.generator = new Blockly.CodeGenerator('INTERCAL'); }); test('Nothing', function() { diff --git a/tests/mocha/jso_deserialization_test.js b/tests/mocha/jso_deserialization_test.js index 889e93b7b..5dee84852 100644 --- a/tests/mocha/jso_deserialization_test.js +++ b/tests/mocha/jso_deserialization_test.js @@ -728,47 +728,47 @@ suite('JSO Deserialization', function() { this.name = name; return this; } - + insertParameter(parameterModel, index) { this.parameters.splice(index, 0, parameterModel); return this; } - + deleteParameter(index) { this.parameters.splice(index, 1); return this; } - + setReturnTypes(types) { this.returnTypes = types; return this; } - + setEnabled(enabled) { this.enabled = enabled; return this; } - + getId() { return this.id; } - + getName() { return this.name; } - + getParameter(index) { return this.parameters[index]; } - + getParameters() { return [...this.parameters]; } - + getReturnTypes() { return this.returnTypes; } - + getEnabled() { return this.enabled; } diff --git a/tests/mocha/jso_serialization_test.js b/tests/mocha/jso_serialization_test.js index 55c014840..1dd86ab59 100644 --- a/tests/mocha/jso_serialization_test.js +++ b/tests/mocha/jso_serialization_test.js @@ -388,21 +388,21 @@ suite('JSO Serialization', function() { '')); return block; }; - + this.assertChild = function(blockType, inputName) { const block = this.createBlockWithChild(blockType, inputName); const jso = Blockly.serialization.blocks.save(block); this.assertInput( jso, inputName, {'block': {'type': blockType, 'id': 'id2'}}); }; - + this.assertShadow = function(blockType, inputName) { const block = this.createBlockWithShadow(blockType, inputName); const jso = Blockly.serialization.blocks.save(block); this.assertInput( jso, inputName, {'shadow': {'type': blockType, 'id': 'test'}}); }; - + this.assertOverwrittenShadow = function(blockType, inputName) { const block = this.createBlockWithShadowAndChild(blockType, inputName); @@ -428,14 +428,14 @@ suite('JSO Serialization', function() { Blockly.serialization.blocks.save(block, {addInputBlocks: false}); chai.assert.isUndefined(jso['inputs']); }; - + this.assertNoShadow = function(blockType, inputName) { const block = this.createBlockWithShadow(blockType, inputName); const jso = Blockly.serialization.blocks.save(block, {addInputBlocks: false}); chai.assert.isUndefined(jso['inputs']); }; - + this.assertNoOverwrittenShadow = function(blockType, inputName) { const block = this.createBlockWithShadowAndChild(blockType, inputName); @@ -506,11 +506,11 @@ suite('JSO Serialization', function() { test('Child', function() { this.assertChild('row_block', 'INPUT'); }); - + test('Shadow', function() { this.assertShadow('row_block', 'INPUT'); }); - + test('Overwritten shadow', function() { this.assertOverwrittenShadow('row_block', 'INPUT'); }); @@ -520,11 +520,11 @@ suite('JSO Serialization', function() { test('Child', function() { this.assertNoChild('row_block', 'INPUT'); }); - + test('Shadow', function() { this.assertNoShadow('row_block', 'INPUT'); }); - + test('Overwritten shadow', function() { this.assertNoOverwrittenShadow('row_block', 'INPUT'); }); @@ -536,11 +536,11 @@ suite('JSO Serialization', function() { test('Child', function() { this.assertChild('statement_block', 'NAME'); }); - + test('Shadow', function() { this.assertShadow('statement_block', 'NAME'); }); - + test('Overwritten shadow', function() { this.assertOverwrittenShadow('statement_block', 'NAME'); }); @@ -577,11 +577,11 @@ suite('JSO Serialization', function() { test('Child', function() { this.assertNoChild('statement_block', 'NAME'); }); - + test('Shadow', function() { this.assertNoShadow('statement_block', 'NAME'); }); - + test('Overwritten shadow', function() { this.assertNoOverwrittenShadow('statement_block', 'NAME'); }); @@ -624,14 +624,14 @@ suite('JSO Serialization', function() { chai.assert.deepInclude( jso['next'], {'block': {'type': 'stack_block', 'id': 'id2'}}); }); - + test('Shadow', function() { const block = this.createNextWithShadow(); const jso = Blockly.serialization.blocks.save(block); chai.assert.deepInclude( jso['next'], {'shadow': {'type': 'stack_block', 'id': 'test'}}); }); - + test('Overwritten shadow', function() { const block = this.createNextWithShadowAndChild(); const jso = Blockly.serialization.blocks.save(block); @@ -684,7 +684,7 @@ suite('JSO Serialization', function() { block, {addNextBlocks: false}); chai.assert.isUndefined(jso['next']); }); - + test('Shadow', function() { const block = this.createNextWithShadow(); const jso = Blockly.serialization.blocks.save( @@ -809,47 +809,47 @@ suite('JSO Serialization', function() { this.name = name; return this; } - + insertParameter(parameterModel, index) { this.parameters.splice(index, 0, parameterModel); return this; } - + deleteParameter(index) { this.parameters.splice(index, 1); return this; } - + setReturnTypes(types) { this.returnTypes = types; return this; } - + setEnabled(enabled) { this.enabled = enabled; return this; } - + getId() { return this.id; } - + getName() { return this.name; } - + getParameter(index) { return this.parameters[index]; } - + getParameters() { return [...this.parameters]; } - + getReturnTypes() { return this.returnTypes; } - + getEnabled() { return this.enabled; } diff --git a/tests/mocha/procedure_map_test.js b/tests/mocha/procedure_map_test.js index 848dda8dd..e3339a1cf 100644 --- a/tests/mocha/procedure_map_test.js +++ b/tests/mocha/procedure_map_test.js @@ -80,7 +80,7 @@ suite('Procedure Map', function() { chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); }); - + test('setting the return type triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel( @@ -92,7 +92,7 @@ suite('Procedure Map', function() { chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); }); - + test('removing the return type triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel( @@ -106,7 +106,7 @@ suite('Procedure Map', function() { chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); }); - + test('disabling the procedure triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel( @@ -118,7 +118,7 @@ suite('Procedure Map', function() { chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); }); - + test('enabling the procedure triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel( @@ -145,7 +145,7 @@ suite('Procedure Map', function() { chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); }); - + test('deleting a parameter triggers an update', function() { const procedureModel = new Blockly.procedures.ObservableProcedureModel( @@ -179,7 +179,7 @@ suite('Procedure Map', function() { chai.assert.isTrue( this.updateSpy.calledOnce, 'Expected an update to be triggered'); }); - + test('modifying the variable model does not trigger an update', function() { const parameterModel = new Blockly.procedures.ObservableParameterModel( diff --git a/tests/mocha/registry_test.js b/tests/mocha/registry_test.js index b6bb66086..ba83bd351 100644 --- a/tests/mocha/registry_test.js +++ b/tests/mocha/registry_test.js @@ -26,7 +26,7 @@ suite('Registry', function() { Blockly.registry.unregister('test', 'test_name'); } }); - + suite('Registration', function() { test('Simple', function() { Blockly.registry.register('test', 'test_name', TestClass); diff --git a/tests/mocha/run_mocha_tests_in_browser.js b/tests/mocha/run_mocha_tests_in_browser.js index 34e1c0fba..f2d7f4a8b 100644 --- a/tests/mocha/run_mocha_tests_in_browser.js +++ b/tests/mocha/run_mocha_tests_in_browser.js @@ -38,7 +38,7 @@ async function runMochaTestsInBrowser() { }; } else { // --disable-gpu is needed to prevent Chrome from hanging on Linux with - // NVIDIA drivers older than v295.20. See + // NVIDIA drivers older than v295.20. See // https://github.com/google/blockly/issues/5345 for details. options.capabilities['goog:chromeOptions'] = { args: ['--allow-file-access-from-files', '--disable-gpu'] diff --git a/tests/mocha/test_helpers/code_generation.js b/tests/mocha/test_helpers/code_generation.js index 82358da63..10344957b 100644 --- a/tests/mocha/test_helpers/code_generation.js +++ b/tests/mocha/test_helpers/code_generation.js @@ -55,7 +55,7 @@ export class CodeGenerationTestSuite { */ constructor() { /** - * @type {!Blockly.Generator} The generator to use for running test cases. + * @type {!Blockly.CodeGenerator} The generator to use for running test cases. */ this.generator; } @@ -64,7 +64,7 @@ export class CodeGenerationTestSuite { /** * Returns mocha test callback for code generation based on provided * generator. - * @param {!Blockly.Generator} generator The generator to use in test. + * @param {!Blockly.CodeGenerator} generator The generator to use in test. * @return {function(!CodeGenerationTestCase):!Function} Function that * returns mocha test callback based on test case. * @private diff --git a/tests/mocha/touch_test.js b/tests/mocha/touch_test.js index 5c6eab803..77f4fb841 100644 --- a/tests/mocha/touch_test.js +++ b/tests/mocha/touch_test.js @@ -7,7 +7,7 @@ goog.declareModuleId('Blockly.test.touch'); import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js'; - + suite('Touch', function() { setup(function() { sharedTestSetup.call(this); diff --git a/tests/mocha/widget_div_test.js b/tests/mocha/widget_div_test.js index 864f4c09d..b7c51f39c 100644 --- a/tests/mocha/widget_div_test.js +++ b/tests/mocha/widget_div_test.js @@ -64,7 +64,7 @@ suite('WidgetDiv', function() { this.testWidgetPosition( anchorBBox, false, expectedX, expectedY, this.widgetSize.height); }); - + test('topConflict', function() { // Anchor close to the top. const anchorBBox = @@ -75,7 +75,7 @@ suite('WidgetDiv', function() { this.testWidgetPosition( anchorBBox, false, expectedX, expectedY, this.widgetSize.height); }); - + test('bottomConflict', function() { // Anchor placed close to the bottom. const anchorBBox = @@ -86,7 +86,7 @@ suite('WidgetDiv', function() { this.testWidgetPosition( anchorBBox, false, expectedX, expectedY, this.widgetSize.height); }); - + test('leftConflict', function() { // Anchor placed close to the left side. const anchorBBox = @@ -97,7 +97,7 @@ suite('WidgetDiv', function() { this.testWidgetPosition( anchorBBox, false, expectedX, expectedY, this.widgetSize.height); }); - + test('rightConflict', function() { // Anchor placed close to the right side. const anchorBBox = diff --git a/tests/playground.html b/tests/playground.html index 89f836055..965296e6c 100644 --- a/tests/playground.html +++ b/tests/playground.html @@ -436,7 +436,7 @@ function addEventHandlers() { document.getElementById('hide') .addEventListener('click', function() { workspace.setVisible(false); }); } - + // Call start(). Because this - - - + + + + diff --git a/demos/blockfactory_old/index.html b/demos/blockfactory_old/index.html index 34b930dc5..2509e7138 100644 --- a/demos/blockfactory_old/index.html +++ b/demos/blockfactory_old/index.html @@ -6,8 +6,8 @@ Blockly Demo: Block Factory - - + +